From d47d0b2eb8c93b7ce57cab8f9a1a06a5cf4793a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 26 Jul 2013 14:51:56 +0200 Subject: [PATCH] Enable focus out event handling in Client Focus out handling used to check the event queue for a matching focus in event to prevent short flickers when no window is active. This is not possible with XCB and needs a replacement. Maybe a short timer event. --- client.h | 2 +- events.cpp | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/client.h b/client.h index d69fd7dd33..1088667262 100644 --- a/client.h +++ b/client.h @@ -681,7 +681,7 @@ private: void enterNotifyEvent(xcb_enter_notify_event_t *e); void leaveNotifyEvent(xcb_leave_notify_event_t *e); void focusInEvent(xcb_focus_in_event_t *e); - void focusOutEvent(XFocusOutEvent* e); + void focusOutEvent(xcb_focus_out_event_t *e); virtual void damageNotifyEvent(); bool buttonPressEvent(xcb_window_t w, int button, int state, int x, int y, int x_root, int y_root); diff --git a/events.cpp b/events.cpp index 0c45c335b1..13e61b025f 100644 --- a/events.cpp +++ b/events.cpp @@ -567,10 +567,10 @@ bool Client::windowEvent(xcb_generic_event_t *e) case XCB_FOCUS_IN: focusInEvent(reinterpret_cast(e)); break; -#if KWIN_QT5_PORTING - case FocusOut: - focusOutEvent(&e->xfocus); + case XCB_FOCUS_OUT: + focusOutEvent(reinterpret_cast(e)); break; +#if KWIN_QT5_PORTING case ReparentNotify: break; case ClientMessage: @@ -1403,21 +1403,24 @@ static bool check_follows_focusin(Client* c) } -void Client::focusOutEvent(XFocusOutEvent* e) +void Client::focusOutEvent(xcb_focus_out_event_t *e) { - if (e->window != window()) + if (e->event != window()) return; // only window gets focus - if (e->mode == NotifyGrab) + if (e->mode == XCB_NOTIFY_MODE_GRAB) return; // we don't care if (isShade()) return; // here neither - if (e->detail != NotifyNonlinear - && e->detail != NotifyNonlinearVirtual) + if (e->detail != XCB_NOTIFY_DETAIL_NONLINEAR + && e->detail != XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL) // SELI check all this return; // hack for motif apps like netscape if (QApplication::activePopupWidget()) return; +#warning Port for XCheckIfEvent is needed, see documentation above +#if KWIN_QT5_PORTING if (!check_follows_focusin(this)) +#endif setActive(false); }