From c455087248b990d7c95575e8514d640a9694dae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sun, 15 Jun 2014 14:05:53 +0200 Subject: [PATCH] add selectWmInputEventMask function It sets the mask required for a WM and in addition preserves the eventmask present on the root window for this client (as set by any lib etc.) --- workspace.cpp | 31 ++++++++++++++++++++++--------- workspace.h | 1 + 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/workspace.cpp b/workspace.cpp index 0e17bb0243..df3a98785c 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -187,15 +187,7 @@ Workspace::Workspace(bool restore) KStartupInfo::DisableKWinModule | KStartupInfo::AnnounceSilenceChanges, this); // Select windowmanager privileges - Xcb::selectInput(rootWindow(), - XCB_EVENT_MASK_KEY_PRESS | - XCB_EVENT_MASK_PROPERTY_CHANGE | - XCB_EVENT_MASK_COLOR_MAP_CHANGE | - XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | - XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | - XCB_EVENT_MASK_FOCUS_CHANGE | // For NotifyDetailNone - XCB_EVENT_MASK_EXPOSURE - ); + selectWmInputEventMask(); #ifdef KWIN_BUILD_SCREENEDGES ScreenEdges::create(this); @@ -1115,6 +1107,27 @@ void Workspace::resetClientAreas(uint desktopCount) updateClientArea(true); } +void Workspace::selectWmInputEventMask() +{ + uint32_t presentMask = 0; + Xcb::WindowAttributes attr(rootWindow()); + Xcb::WindowGeometry geo(rootWindow()); + if (!attr.isNull()) { + presentMask = attr->your_event_mask; + } + + Xcb::selectInput(rootWindow(), + presentMask | + XCB_EVENT_MASK_KEY_PRESS | + XCB_EVENT_MASK_PROPERTY_CHANGE | + XCB_EVENT_MASK_COLOR_MAP_CHANGE | + XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | + XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | + XCB_EVENT_MASK_FOCUS_CHANGE | // For NotifyDetailNone + XCB_EVENT_MASK_EXPOSURE + ); +} + /** * Sends client \a c to desktop \a desk. * diff --git a/workspace.h b/workspace.h index 6c76006a3e..e08bf55e6b 100644 --- a/workspace.h +++ b/workspace.h @@ -451,6 +451,7 @@ private: template void initShortcut(const QString &actionName, const QString &description, const QKeySequence &shortcut, Slot slot, const QVariant &data = QVariant()); + void selectWmInputEventMask(); void setupWindowShortcut(Client* c); enum Direction { DirectionNorth,