diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-03-18 20:00:44 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-03-18 20:00:44 +0000 |
| commit | 7d215bd255d0744101b9ceb52c235bdc985fa034 (patch) | |
| tree | 5e7d3dfcf7d7470de08b91df8d3bd92b64732179 /openbox/grab.c | |
| parent | 598c5d6c07118517b47d7c416a79dc9743271aa8 (diff) | |
add 'grab_server' for grabbing .. the .. server!
Diffstat (limited to 'openbox/grab.c')
| -rw-r--r-- | openbox/grab.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/openbox/grab.c b/openbox/grab.c index 3bba14b3..c6beee74 100644 --- a/openbox/grab.c +++ b/openbox/grab.c @@ -2,7 +2,7 @@ #include <glib.h> #include <X11/Xlib.h> -static guint kgrabs, pgrabs; +static guint kgrabs, pgrabs, sgrabs; void grab_keyboard(gboolean grab) { @@ -28,13 +28,29 @@ void grab_pointer(gboolean grab, Cursor cur) } } +void grab_server(gboolean grab) +{ + if (grab) { + if (sgrabs++ == 0) { + XGrabServer(ob_display); + XSync(ob_display, FALSE); + } + } else if (sgrabs > 0) { + if (--sgrabs == 0) { + XUngrabServer(ob_display); + XFlush(ob_display); + } + } +} + void grab_startup() { - kgrabs = pgrabs = 0; + kgrabs = pgrabs = sgrabs = 0; } void grab_shutdown() { while (kgrabs) grab_keyboard(FALSE); while (pgrabs) grab_pointer(FALSE, None); + while (sgrabs) grab_server(FALSE); } |
