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.
This commit is contained in:
Martin Gräßlin 2013-07-26 14:51:56 +02:00
parent 6af74b86f4
commit d47d0b2eb8
2 changed files with 12 additions and 9 deletions

View file

@ -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);

View file

@ -567,10 +567,10 @@ bool Client::windowEvent(xcb_generic_event_t *e)
case XCB_FOCUS_IN:
focusInEvent(reinterpret_cast<xcb_focus_in_event_t*>(e));
break;
#if KWIN_QT5_PORTING
case FocusOut:
focusOutEvent(&e->xfocus);
case XCB_FOCUS_OUT:
focusOutEvent(reinterpret_cast<xcb_focus_out_event_t*>(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);
}