From ed24ac86d296b043d28cc5ef04461bdb6f897534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 26 Jul 2013 14:22:43 +0200 Subject: [PATCH] Enable enter notify event handling in Client --- client.h | 2 +- events.cpp | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/client.h b/client.h index d4d723b371..9216200e00 100644 --- a/client.h +++ b/client.h @@ -678,7 +678,7 @@ private: void configureRequestEvent(xcb_configure_request_event_t *e); virtual void propertyNotifyEvent(xcb_property_notify_event_t *e) override; void clientMessageEvent(XClientMessageEvent* e); - void enterNotifyEvent(XCrossingEvent* e); + void enterNotifyEvent(xcb_enter_notify_event_t *e); void leaveNotifyEvent(XCrossingEvent* e); void focusInEvent(XFocusInEvent* e); void focusOutEvent(XFocusOutEvent* e); diff --git a/events.cpp b/events.cpp index 4598f47472..f9cd5ae76f 100644 --- a/events.cpp +++ b/events.cpp @@ -542,18 +542,20 @@ bool Client::windowEvent(xcb_generic_event_t *e) workspace()->updateFocusMousePosition(QPoint(event->root_x, event->root_y)); break; } -#if KWIN_QT5_PORTING - case EnterNotify: - enterNotifyEvent(&e->xcrossing); + case XCB_ENTER_NOTIFY: { + auto *event = reinterpret_cast(e); + enterNotifyEvent(event); // MotionNotify is guaranteed to be generated only if the mouse // move start and ends in the window; for cases when it only // starts or only ends there, Enter/LeaveNotify are generated. // Fake a MotionEvent in such cases to make handle of mouse // events simpler (Qt does that too). - motionNotifyEvent(e->xcrossing.window, e->xcrossing.state, - e->xcrossing.x, e->xcrossing.y, e->xcrossing.x_root, e->xcrossing.y_root); - workspace()->updateFocusMousePosition(QPoint(e->xcrossing.x_root, e->xcrossing.y_root)); + motionNotifyEvent(event->event, event->state, + event->event_x, event->event_y, event->root_x, event->root_y); + workspace()->updateFocusMousePosition(QPoint(event->root_x, event->root_y)); break; + } +#if KWIN_QT5_PORTING case LeaveNotify: motionNotifyEvent(e->xcrossing.window, e->xcrossing.state, e->xcrossing.x, e->xcrossing.y, e->xcrossing.x_root, e->xcrossing.y_root); @@ -789,14 +791,14 @@ void Client::propertyNotifyEvent(xcb_property_notify_event_t *e) } -void Client::enterNotifyEvent(XCrossingEvent* e) +void Client::enterNotifyEvent(xcb_enter_notify_event_t *e) { - if (e->window != frameId()) + if (e->event != frameId()) return; // care only about entering the whole frame #define MOUSE_DRIVEN_FOCUS (!options->focusPolicyIsReasonable() || \ (options->focusPolicy() == Options::FocusFollowsMouse && options->isNextFocusPrefersMouse())) - if (e->mode == NotifyNormal || (e->mode == NotifyUngrab && MOUSE_DRIVEN_FOCUS)) { + if (e->mode == XCB_NOTIFY_MODE_NORMAL || (e->mode == XCB_NOTIFY_MODE_UNGRAB && MOUSE_DRIVEN_FOCUS)) { if (options->isShadeHover()) { cancelShadeHoverTimer(); @@ -812,7 +814,7 @@ void Client::enterNotifyEvent(XCrossingEvent* e) if (options->focusPolicy() == Options::ClickToFocus || workspace()->userActionsMenu()->isShown()) return; - QPoint currentPos(e->x_root, e->y_root); + QPoint currentPos(e->root_x, e->root_y); if (options->isAutoRaise() && !isDesktop() && !isDock() && workspace()->focusChangeEnabled() && currentPos != workspace()->focusMousePosition() &&