Index: krita/ui/input/wintab/kis_tablet_support_win.cpp =================================================================== --- krita/ui/input/wintab/kis_tablet_support_win.cpp +++ krita/ui/input/wintab/kis_tablet_support_win.cpp @@ -683,38 +683,22 @@ bool KisTabletSupportWin::nativeEventFilter(const QByteArray &/*eventType*/, void *message, long *result) { - MSG *msg = static_cast(message); Q_UNUSED(result); static bool mouseEnteredFlag = false; + bool handled = false; // If we handle a tablet event, tell Qt we took care of it + MSG *msg = static_cast(message); + switch(msg->message){ case WT_CTXOPEN: qt_tablet_context = reinterpret_cast(msg->wParam); + handled = true; break; case WT_CTXCLOSE: qt_tablet_context = 0; + handled = true; break; - case WM_ACTIVATE: { - /** - * Workaround for a focus bug by Qt - * - * Looks like modal windows do not grab focus on Windows. The - * parent widget will still be regarded as a focusWidget() - * although it gets no events. So notify the pure parent that - * he is not in focus anymore. - */ - QWidget *modalWidget = QApplication::activeModalWidget(); - if (modalWidget) { - QWidget *focusWidget = QApplication::focusWidget(); - if (focusWidget) { - bool active = msg->wParam == WA_ACTIVE || msg->wParam == WA_CLICKACTIVE; - QFocusEvent focusEvent(active ? QEvent::FocusIn : QEvent::FocusOut); - QApplication::sendEvent(focusWidget, &focusEvent); - } - } - break; - } case WM_MOUSELEAVE: mouseEnteredFlag = false; break; @@ -734,27 +718,21 @@ tabletUpdateCursor(proximityBuffer.pkCursor); } } + handled = true; break; } case WT_PACKET: { Q_ASSERT(qt_tablet_context); - - /** - * We eat WT_PACKET events.. We are bad! - * - * But we can do nothing, because the packets are removed from the - * WinTab queue by WTPacketsGet - */ - int nPackets; if ((nPackets = ptrWTPacketsGet(qt_tablet_context, QT_TABLET_NPACKETQSIZE, &globalPacketBuf))) { return translateTabletEvent(*msg, globalPacketBuf, nPackets); } + handled = true; break; } } - return false; + return handled; }