From 4d6bf949a83e54a52a14133560940ae1a95c5b80 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 6 Apr 2009 13:27:53 +0200 Subject: [PATCH] Revert "event: add FocusOut handler" This reverts commit 31ba9620657e0bb427e130ce13d82b958db65fc2. --- client.c | 15 ++++++++++----- client.h | 1 - event.c | 24 ------------------------ 3 files changed, 10 insertions(+), 30 deletions(-) diff --git a/client.c b/client.c index 8afc0a23..a195d9fe 100644 --- a/client.c +++ b/client.c @@ -202,7 +202,7 @@ client_unfocus_hook(client_t *c) /** Unfocus a client. * \param c The client. */ -void +static void client_unfocus(client_t *c) { xcb_window_t root_win = xutil_screen_get(globalconf.connection, c->phys_screen)->root; @@ -293,10 +293,6 @@ client_focus(client_t *c, bool sendmessage) if(c == focused_before) return; - /* If we recieved a FocusOut event, this condition won't be hit. */ - if(focused_before) - client_unfocus(focused_before); - /* stop hiding c */ c->ishidden = false; client_setminimized(c, false); @@ -323,6 +319,15 @@ client_focus(client_t *c, bool sendmessage) * And anyway, we have maybe unhidden */ client_need_arrange(c); + /* unfocus current selected client + * We don't really need to unfocus here, + * because client already received FocusOut event. + * What we need to do is call unfocus hook, to + * inform lua script, about this event. + */ + if(focused_before) + client_unfocus_hook(focused_before); + client_focus_hook(c); /* according to EWMH, we have to remove the urgent state from a client */ diff --git a/client.h b/client.h index 160cf3de..b1d10778 100644 --- a/client.h +++ b/client.h @@ -76,7 +76,6 @@ void client_setminimized(client_t *, bool); void client_setborder(client_t *, int); void client_seturgent(client_t *, bool); void client_focus(client_t *, bool); -void client_unfocus(client_t *); int luaA_client_newindex(lua_State *); diff --git a/event.c b/event.c index c89dbb63..3e970dfc 100644 --- a/event.c +++ b/event.c @@ -551,29 +551,6 @@ event_handle_focusin(void *data __attribute__ ((unused)), return 0; } -/** The focus out event handler. - * \param data currently unused. - * \param connection The connection to the X server. - * \param ev The event. - */ -static int -event_handle_focusout(void *data __attribute__ ((unused)), - xcb_connection_t *connection, - xcb_focus_out_event_t *ev) -{ - /* filter focus-out events */ - if (ev->detail != XCB_NOTIFY_DETAIL_NONLINEAR) - return 0; - - client_t *c; - - if((c = client_getbytitlebarwin(ev->event)) - || (c = client_getbywin(ev->event))) - client_unfocus(c); - - return 0; -} - /** The expose event handler. * \param data currently unused. * \param connection The connection to the X server. @@ -891,7 +868,6 @@ void a_xcb_set_event_handlers(void) xcb_event_set_enter_notify_handler(&globalconf.evenths, event_handle_enternotify, NULL); xcb_event_set_leave_notify_handler(&globalconf.evenths, event_handle_leavenotify, NULL); xcb_event_set_focus_in_handler(&globalconf.evenths, event_handle_focusin, NULL); - xcb_event_set_focus_out_handler(&globalconf.evenths, event_handle_focusout, NULL); xcb_event_set_motion_notify_handler(&globalconf.evenths, event_handle_motionnotify, NULL); xcb_event_set_expose_handler(&globalconf.evenths, event_handle_expose, NULL); xcb_event_set_key_press_handler(&globalconf.evenths, event_handle_key, NULL);