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.)
This commit is contained in:
Thomas Lübking 2014-06-15 14:05:53 +02:00
parent ddd8ea4c74
commit c455087248
2 changed files with 23 additions and 9 deletions

View file

@ -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.
*

View file

@ -451,6 +451,7 @@ private:
template <typename Slot>
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,