diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2b2ef8ccf573c4d2e091b01bc89bd59525e44bbe..2e7c802578def4223b726b93fd2d6cc283a4cab7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -470,6 +470,7 @@ set(kwin_KDEINIT_SRCS
moving_client_x11_filter.cpp
effects_mouse_interception_x11_filter.cpp
window_property_notify_x11_filter.cpp
+ rootinfo_filter.cpp
)
if(KWIN_BUILD_TABBOX)
diff --git a/events.cpp b/events.cpp
index 599af666c56c02e8ac504adfd80b1d585edfd001..c3c028bfbea683c215f8d964d38cbeb834c90867 100644
--- a/events.cpp
+++ b/events.cpp
@@ -247,16 +247,6 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e)
&& (eventType == XCB_KEY_PRESS || eventType == XCB_KEY_RELEASE))
return false; // let Qt process it, it'll be intercepted again in eventFilter()
- if (eventType == XCB_PROPERTY_NOTIFY || eventType == XCB_CLIENT_MESSAGE) {
- NET::Properties dirtyProtocols;
- NET::Properties2 dirtyProtocols2;
- rootInfo()->event(e, &dirtyProtocols, &dirtyProtocols2);
- if (dirtyProtocols & NET::DesktopNames)
- VirtualDesktopManager::self()->save();
- if (dirtyProtocols2 & NET::WM2DesktopLayout)
- VirtualDesktopManager::self()->updateLayout();
- }
-
// events that should be handled before Clients can get them
switch (eventType) {
case XCB_CONFIGURE_NOTIFY:
diff --git a/netinfo.cpp b/netinfo.cpp
index 9da14d63f0bf8a19a1761c809bf5526fa0a7cf45..8589a774d51295415d95afe6d23217ef7bd57c44 100644
--- a/netinfo.cpp
+++ b/netinfo.cpp
@@ -23,6 +23,7 @@ along with this program. If not, see .
#include "netinfo.h"
// kwin
#include "client.h"
+#include "rootinfo_filter.h"
#include "virtualdesktops.h"
#include "workspace.h"
// Qt
@@ -139,6 +140,7 @@ RootInfo::RootInfo(xcb_window_t w, const char *name, NET::Properties properties,
NET::States states, NET::Properties2 properties2, NET::Actions actions, int scr)
: NETRootInfo(connection(), w, name, properties, types, states, properties2, actions, scr)
, m_activeWindow(activeWindow())
+ , m_eventFilter(std::make_unique(this))
{
}
diff --git a/netinfo.h b/netinfo.h
index b5f8a2e620bdd6f655a5a9abcac849f409a41cba..94939de357f0443644093d6b54a816e3f8433647 100644
--- a/netinfo.h
+++ b/netinfo.h
@@ -26,12 +26,14 @@ along with this program. If not, see .
#include
#include
+#include
namespace KWin
{
class AbstractClient;
class Client;
+class RootInfoFilter;
/**
* NET WM Protocol handler class
@@ -65,6 +67,7 @@ private:
friend RootInfo *rootInfo();
xcb_window_t m_activeWindow;
+ std::unique_ptr m_eventFilter;
};
inline RootInfo *rootInfo()
diff --git a/rootinfo_filter.cpp b/rootinfo_filter.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..1a0cb358fe61cb532009e2597a4a4172bf3ea030
--- /dev/null
+++ b/rootinfo_filter.cpp
@@ -0,0 +1,45 @@
+/********************************************************************
+ KWin - the KDE window manager
+ This file is part of the KDE project.
+
+Copyright (C) 2017 Martin Flöser
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*********************************************************************/
+#include "rootinfo_filter.h"
+#include "netinfo.h"
+#include "virtualdesktops.h"
+
+namespace KWin
+{
+
+RootInfoFilter::RootInfoFilter(RootInfo *parent)
+ : X11EventFilter(QVector{XCB_PROPERTY_NOTIFY, XCB_CLIENT_MESSAGE})
+ , m_rootInfo(parent)
+{
+}
+
+bool RootInfoFilter::event(xcb_generic_event_t *event)
+{
+ NET::Properties dirtyProtocols;
+ NET::Properties2 dirtyProtocols2;
+ m_rootInfo->event(event, &dirtyProtocols, &dirtyProtocols2);
+ if (dirtyProtocols & NET::DesktopNames)
+ VirtualDesktopManager::self()->save();
+ if (dirtyProtocols2 & NET::WM2DesktopLayout)
+ VirtualDesktopManager::self()->updateLayout();
+ return false;
+}
+
+}
diff --git a/rootinfo_filter.h b/rootinfo_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..777f6b899e9a985bafe51c4e977e0a3de3583239
--- /dev/null
+++ b/rootinfo_filter.h
@@ -0,0 +1,42 @@
+/********************************************************************
+ KWin - the KDE window manager
+ This file is part of the KDE project.
+
+Copyright (C) 2017 Martin Flöser
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*********************************************************************/
+#ifndef KWIN_ROOTINFO_FILTER_H
+#define KWIN_ROOTINFO_FILTER_H
+
+#include "x11eventfilter.h"
+
+namespace KWin
+{
+class RootInfo;
+
+class RootInfoFilter : public X11EventFilter
+{
+public:
+ explicit RootInfoFilter(RootInfo *parent);
+
+ bool event(xcb_generic_event_t *event) override;
+
+private:
+ RootInfo *m_rootInfo;
+};
+
+}
+
+#endif