it won't work right unless we XUngrabKeyboard first,
even though we grabbed the key/button Asychronously.
e.g. "gnome-panel-control --main-menu" */
- XUngrabKeyboard(ob_display, event_curtime);
+ grab_keyboard(FALSE);
}
for (it = acts; it; it = g_slist_next(it)) {
g_assert(self != NULL);
frame_hide(self->frame);
+ /* sync to send the hide to the server quickly, and to get back the enter
+ events */
XSync(ob_display, FALSE);
if (focus_client == self) {
NULL, g_direct_equal, NULL);
if (e->type == ButtonPress || e->type == ButtonRelease ||
- e->type == MotionNotify)
+ e->type == MotionNotify) {
mouse_event(client, e);
- else if (e->type == KeyPress) {
+ } else if (e->type == KeyPress) {
keyboard_event((focus_cycle_target ? focus_cycle_target :
(focus_hilite ? focus_hilite : client)),
e);
frame_adjust_state(client->frame);
break;
case OB_FRAME_CONTEXT_FRAME:
+ if (keyboard_interactively_grabbed())
+ break;
if (config_focus_follow && config_focus_delay)
ob_main_loop_timeout_remove_data(ob_main_loop,
focus_delay_func,
frame_adjust_state(client->frame);
break;
case OB_FRAME_CONTEXT_FRAME:
+ if (keyboard_interactively_grabbed())
+ break;
if (e->xcrossing.mode == NotifyGrab ||
e->xcrossing.mode == NotifyUngrab)
{
void focus_cycle_draw_indicator()
{
if (!focus_cycle_target) {
+ XEvent e;
+
XUnmapWindow(ob_display, focus_indicator.top.win);
XUnmapWindow(ob_display, focus_indicator.left.win);
XUnmapWindow(ob_display, focus_indicator.right.win);
XUnmapWindow(ob_display, focus_indicator.bottom.win);
+
+ /* kill enter events cause by this unmapping */
+ XSync(ob_display, FALSE);
+ while (XCheckTypedEvent(ob_display, EnterNotify, &e));
} else {
/*
if (focus_cycle_target)
return ret;
}
-gboolean grab_pointer_window(gboolean grab, gboolean owner_events,
- ObCursor cur, Window win)
-{
- gboolean ret = FALSE;
-
- if (grab) {
- if (pgrabs++ == 0) {
- ret = XGrabPointer(ob_display, win, owner_events,
- GRAB_PTR_MASK,
- GrabModeAsync, GrabModeAsync, None,
- ob_cursor(cur),
- event_curtime) == Success;
- if (!ret)
- --pgrabs;
- else
- grab_time = event_curtime;
- } else
- ret = TRUE;
- } else if (pgrabs > 0) {
- if (--pgrabs == 0) {
- XUngrabPointer(ob_display, ungrab_time());
- }
- ret = TRUE;
- }
- return ret;
-}
-
gint grab_server(gboolean grab)
{
static guint sgrabs = 0;
while (grab_keyboard(FALSE));
while (grab_pointer(FALSE, FALSE, OB_CURSOR_NONE));
- while (grab_pointer_window(FALSE, FALSE, OB_CURSOR_NONE, None));
while (grab_server(FALSE));
}
gboolean grab_keyboard(gboolean grab);
gboolean grab_pointer(gboolean grab, gboolean owner_events, ObCursor cur);
-gboolean grab_pointer_window(gboolean grab, gboolean owner_events,
- ObCursor cur, Window win);
gint grab_server(gboolean grab);
gboolean grab_on_keyboard();
g_assert(action->data.any.interactive);
if (!interactive_states) {
- if (!grab_keyboard(TRUE))
- return FALSE;
- if (!grab_pointer(TRUE, FALSE, OB_CURSOR_NONE)) {
- grab_keyboard(FALSE);
+ if (!grab_keyboard(TRUE)) {
+ ob_debug("grab KEYBOARD failed\n");
return FALSE;
}
}
if (!interactive_states) {
grab_keyboard(FALSE);
- grab_pointer(FALSE, FALSE, OB_CURSOR_NONE);
keyboard_reset_chains();
}
}
void popup_hide(ObPopup *self)
{
if (self->mapped) {
+ XEvent e;
+
XUnmapWindow(ob_display, self->bg);
self->mapped = FALSE;
+
+ /* kill enter events cause by this unmapping */
+ XSync(ob_display, FALSE);
+ while (XCheckTypedEvent(ob_display, EnterNotify, &e));
}
}