[Gtk-sharp-list] How disable entire gnome desktop

Felipe Almeida Lessa felipe.lessa at gmail.com
Sun Dec 11 08:44:39 EST 2005


Em 11/12/05, Arx Henrique<arxcruz at gmail.com> escreveu:
> the synaptic make this, in ubuntu, i dont know if is the gksu or
> synaptic, but when you click in show updates, they disable all desktop
> until you put the root passwd or click in cancel button.

Grab the keyboard and the mouse. Quoting SharpMusic's code (a program of mine):

private Window wnd; // This is your window
private bool TryGrab() {
    Gdk.EventMask mask = Gdk.EventMask.ButtonPressMask
        | Gdk.EventMask.ButtonReleaseMask
        | Gdk.EventMask.PointerMotionMask;

    Gtk.Grab.Add(wnd);

    if (Gdk.Keyboard.Grab(wnd.GdkWindow, true, 0) != Gdk.GrabStatus.Success) {
        Gtk.Grab.Remove(wnd);
        return false;
    }

    if (Gdk.Pointer.Grab(wnd.GdkWindow, true, mask, null, null, 0) !=
Gdk.GrabStatus.Success) {
        Gtk.Grab.Remove(wnd);
        Gdk.Keyboard.Ungrab(0);
        return false;
    }

    return true;
}

> i want this.

And here you have it. You may need to adjust the value of the mask
variable, but I don't know if or how. If that doesnt work, try with
"Gdk.EventMask mask = Gdk.EventMask.AllEventsMask", maybe it works.

Cya,
Felipe.

--
"Quem excele em empregar a força militar subjulga os exércitos dos outros
povos sem travar batalha, toma cidades fortificadas dos outros povos sem as
atacar e destrói os estados dos outros povos sem lutas prolongadas. Deve
lutar sob o Céu com o propósito primordial da 'preservação'. Desse modo suas
armas não se embotarão, e os ganhos poderão ser preservados. Essa é a
estratégia para planejar ofensivas."

  -- Sun Tzu, em "A arte da guerra"


More information about the Gtk-sharp-list mailing list