kill enter events without using pointer grabs

This commit is contained in:
Dana Jansens 2007-05-17 02:21:22 +00:00
parent b1076c9333
commit 281c1edb42
4 changed files with 16 additions and 22 deletions

View file

@ -3272,10 +3272,6 @@ void client_set_state(ObClient *self, Atom action, glong data1, glong data2)
} }
} }
/* Grab pointer across these, so it is the same as actions. Enter events
won't be generated by the windows moving around */
grab_pointer(FALSE, FALSE, OB_CURSOR_NONE);
if (max_horz != self->max_horz || max_vert != self->max_vert) { if (max_horz != self->max_horz || max_vert != self->max_vert) {
if (max_horz != self->max_horz && max_vert != self->max_vert) { if (max_horz != self->max_horz && max_vert != self->max_vert) {
/* toggling both */ /* toggling both */
@ -3313,19 +3309,11 @@ void client_set_state(ObClient *self, Atom action, glong data1, glong data2)
transients needs to change */ transients needs to change */
stacking_raise(CLIENT_AS_WINDOW(self)); stacking_raise(CLIENT_AS_WINDOW(self));
/* These things below can change focus so we can't grab pointer for
them. Note how we have two ungrab_pointers.. */
ungrab_pointer();
/* it also may get focused. if something is focused that shouldn't /* it also may get focused. if something is focused that shouldn't
be focused anymore, then move the focus */ be focused anymore, then move the focus */
if (focus_client && client_focus_target(focus_client) != focus_client) if (focus_client && client_focus_target(focus_client) != focus_client)
client_focus(focus_client); client_focus(focus_client);
} }
else
/* These things below can change focus so we can't grab pointer for
them. Note how we have two ungrab_pointers.. */
ungrab_pointer();
if (iconic != self->iconic) if (iconic != self->iconic)
client_iconify(self, iconic, FALSE, FALSE); client_iconify(self, iconic, FALSE, FALSE);

View file

@ -24,6 +24,7 @@
#include "openbox.h" #include "openbox.h"
#include "frame.h" #include "frame.h"
#include "moveresize.h" #include "moveresize.h"
#include "event.h"
#include "prop.h" #include "prop.h"
#include "gettext.h" #include "gettext.h"
@ -118,15 +119,19 @@ static void client_menu_execute(ObMenuEntry *e, ObMenuFrame *f,
break; break;
case CLIENT_RESTORE: case CLIENT_RESTORE:
client_maximize(c, FALSE, 0); client_maximize(c, FALSE, 0);
event_ignore_queued_enters();
break; break;
case CLIENT_MAXIMIZE: case CLIENT_MAXIMIZE:
client_maximize(c, TRUE, 0); client_maximize(c, TRUE, 0);
event_ignore_queued_enters();
break; break;
case CLIENT_SHADE: case CLIENT_SHADE:
client_shade(c, !c->shaded); client_shade(c, !c->shaded);
event_ignore_queued_enters();
break; break;
case CLIENT_DECORATE: case CLIENT_DECORATE:
client_set_undecorated(c, !c->undecorated); client_set_undecorated(c, !c->undecorated);
event_ignore_queued_enters();
break; break;
case CLIENT_MOVE: case CLIENT_MOVE:
/* this needs to grab the keyboard so hide the menu */ /* this needs to grab the keyboard so hide the menu */
@ -212,6 +217,8 @@ static void layer_menu_execute(ObMenuEntry *e, ObMenuFrame *f,
g_assert_not_reached(); g_assert_not_reached();
} }
event_ignore_queued_enters();
/* update the menu cuz stuff can have changed */ /* update the menu cuz stuff can have changed */
if (f) { if (f) {
layer_menu_update(f, NULL); layer_menu_update(f, NULL);

View file

@ -1082,11 +1082,10 @@ static void event_handle_client(ObClient *client, XEvent *e)
if (config) { if (config) {
client_find_onscreen(client, &x, &y, w, h, FALSE); client_find_onscreen(client, &x, &y, w, h, FALSE);
/* don't create enter events from clients moving themselves */
grab_pointer(FALSE, FALSE, OB_CURSOR_NONE);
client_configure(client, x, y, w, h, FALSE, TRUE); client_configure(client, x, y, w, h, FALSE, TRUE);
ungrab_pointer();
/* ignore enter events caused by these like ob actions do */
event_ignore_queued_enters();
} }
break; break;
} }
@ -1180,6 +1179,9 @@ static void event_handle_client(ObClient *client, XEvent *e)
client->window); client->window);
client_set_state(client, e->xclient.data.l[0], client_set_state(client, e->xclient.data.l[0],
e->xclient.data.l[1], e->xclient.data.l[2]); e->xclient.data.l[1], e->xclient.data.l[2]);
/* ignore enter events caused by these like ob actions do */
event_ignore_queued_enters();
} else if (msgtype == prop_atoms.net_close_window) { } else if (msgtype == prop_atoms.net_close_window) {
ob_debug("net_close_window for 0x%lx\n", client->window); ob_debug("net_close_window for 0x%lx\n", client->window);
client_close(client); client_close(client);
@ -1264,10 +1266,10 @@ static void event_handle_client(ObClient *client, XEvent *e)
client_convert_gravity(client, grav, &x, &y, w, h); client_convert_gravity(client, grav, &x, &y, w, h);
client_find_onscreen(client, &x, &y, w, h, FALSE); client_find_onscreen(client, &x, &y, w, h, FALSE);
/* don't create enter events from clients moving themselves */
grab_pointer(FALSE, FALSE, OB_CURSOR_NONE);
client_configure(client, x, y, w, h, FALSE, TRUE); client_configure(client, x, y, w, h, FALSE, TRUE);
ungrab_pointer();
/* ignore enter events caused by these like ob actions do */
event_ignore_queued_enters();
} else if (msgtype == prop_atoms.net_restack_window) { } else if (msgtype == prop_atoms.net_restack_window) {
if (e->xclient.data.l[0] != 2) { if (e->xclient.data.l[0] != 2) {
ob_debug_type(OB_DEBUG_APP_BUGS, ob_debug_type(OB_DEBUG_APP_BUGS,

View file

@ -51,7 +51,4 @@ void event_halt_focus_delay();
comes at the same time or later than t2. */ comes at the same time or later than t2. */
gboolean event_time_after(Time t1, Time t2); gboolean event_time_after(Time t1, Time t2);
/*! Used with XCheckIfEvent to find a focusin event on a client window */
Bool event_look_for_focusin_client(Display *d, XEvent *e, XPointer arg);
#endif #endif