]>
Dogcows Code - chaz/openbox/blob - openbox/grab.c
7 static guint kgrabs
, pgrabs
, sgrabs
;
9 #define MASK_LIST_SIZE 8
11 /*! A list of all possible combinations of keyboard lock masks */
12 static unsigned int mask_list
[MASK_LIST_SIZE
];
14 void grab_keyboard(gboolean grab
)
18 XGrabKeyboard(ob_display
, ob_root
, 0, GrabModeAsync
, GrabModeSync
,
20 } else if (kgrabs
> 0) {
22 XUngrabKeyboard(ob_display
, CurrentTime
);
26 void grab_pointer(gboolean grab
, Cursor cur
)
30 XGrabPointer(ob_display
, ob_root
, False
, 0, GrabModeAsync
,
31 GrabModeAsync
, FALSE
, cur
, CurrentTime
);
32 } else if (pgrabs
> 0) {
34 XUngrabPointer(ob_display
, CurrentTime
);
38 void grab_server(gboolean grab
)
42 XGrabServer(ob_display
);
43 XSync(ob_display
, FALSE
);
45 } else if (sgrabs
> 0) {
47 XUngrabServer(ob_display
);
57 kgrabs
= pgrabs
= sgrabs
= 0;
60 mask_list
[i
++] = LockMask
;
61 mask_list
[i
++] = NumLockMask
;
62 mask_list
[i
++] = LockMask
| NumLockMask
;
63 mask_list
[i
++] = ScrollLockMask
;
64 mask_list
[i
++] = ScrollLockMask
| LockMask
;
65 mask_list
[i
++] = ScrollLockMask
| NumLockMask
;
66 mask_list
[i
++] = ScrollLockMask
| LockMask
| NumLockMask
;
67 g_assert(i
== MASK_LIST_SIZE
);
72 while (kgrabs
) grab_keyboard(FALSE
);
73 while (pgrabs
) grab_pointer(FALSE
, None
);
74 while (sgrabs
) grab_server(FALSE
);
77 void grab_button(guint button
, guint state
, Window win
, guint mask
,
82 for (i
= 0; i
< MASK_LIST_SIZE
; ++i
)
83 XGrabButton(ob_display
, button
, state
| mask_list
[i
], win
, FALSE
, mask
,
84 pointer_mode
, GrabModeAsync
, None
, None
);
87 void ungrab_button(guint button
, guint state
, Window win
)
91 for (i
= 0; i
< MASK_LIST_SIZE
; ++i
)
92 XUngrabButton(ob_display
, button
, state
| mask_list
[i
], win
);
95 void grab_key(guint keycode
, guint state
, int keyboard_mode
)
99 for (i
= 0; i
< MASK_LIST_SIZE
; ++i
)
100 XGrabKey(ob_display
, keycode
, state
| mask_list
[i
], ob_root
, FALSE
,
101 GrabModeAsync
, keyboard_mode
);
104 void ungrab_all_keys()
106 XUngrabKey(ob_display
, AnyKey
, AnyModifier
, ob_root
);
This page took 0.04415 seconds and 4 git commands to generate.