all repos — openbox @ 4d5dd00229c3cfcacfc98b4194702d513283edf1

openbox fork - make it a bit more like ryudo

ignore fake generated enters if they are in the serial-ignore-range too
Dana Jansens danakj@orodu.net
commit

4d5dd00229c3cfcacfc98b4194702d513283edf1

parent

deb0aa720a4feda3b52c17e16ed7324c61dc331a

1 files changed, 11 insertions(+), 11 deletions(-)

jump to
M openbox/event.copenbox/event.c

@@ -92,7 +92,7 @@ static void event_handle_dock(ObDock *s, XEvent *e);

static void event_handle_dockapp(ObDockApp *app, XEvent *e); static void event_handle_client(ObClient *c, XEvent *e); static void event_handle_user_input(ObClient *client, XEvent *e); -static gboolean is_enter_focus_event_ignored(XEvent *e); +static gboolean is_enter_focus_event_ignored(gulong serial); static void event_ignore_enter_range(gulong start, gulong end); static void focus_delay_dest(gpointer data);

@@ -795,6 +795,12 @@ void event_enter_client(ObClient *client)

{ g_assert(config_focus_follow); + if (is_enter_focus_event_ignored(event_curserial)) { + ob_debug_type(OB_DEBUG_FOCUS, "Ignoring enter event with serial %lu\n" + "on client 0x%x", event_curserial, client->window); + return; + } + if (client_enter_focusable(client) && client_can_focus(client)) { if (config_focus_delay) { ObFocusDelayData *data;

@@ -1039,8 +1045,7 @@ break;

if (e->xcrossing.mode == NotifyGrab || e->xcrossing.mode == NotifyUngrab || /*ignore enters when we're already in the window */ - e->xcrossing.detail == NotifyInferior || - is_enter_focus_event_ignored(e)) + e->xcrossing.detail == NotifyInferior) { ob_debug_type(OB_DEBUG_FOCUS, "%sNotify mode %d detail %d serial %lu on %lx "

@@ -1959,26 +1964,21 @@ we will be *past* the range of ignored serials */

event_ignore_enter_range(start, NextRequest(ob_display)-1); } -static gboolean is_enter_focus_event_ignored(XEvent *e) +static gboolean is_enter_focus_event_ignored(gulong serial) { GSList *it, *next; - g_assert(e->type == EnterNotify && - !(e->xcrossing.mode == NotifyGrab || - e->xcrossing.mode == NotifyUngrab || - e->xcrossing.detail == NotifyInferior)); - for (it = ignore_serials; it; it = next) { ObSerialRange *r = it->data; next = g_slist_next(it); - if ((glong)(e->xany.serial - r->end) > 0) { + if ((glong)(serial - r->end) > 0) { /* past the end */ ignore_serials = g_slist_delete_link(ignore_serials, it); g_free(r); } - else if ((glong)(e->xany.serial - r->start) >= 0) + else if ((glong)(serial - r->start) >= 0) return TRUE; } return FALSE;