[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kde-workspace] kwin: [kwin] Port away from deprecated functionality in KWindowSystem
From:       Martin_Gräßlin <mgraesslin () kde ! org>
Date:       2014-03-17 9:25:49
Message-ID: E1WPTnp-0001F8-9g () scm ! kde ! org
[Download RAW message or body]

Git commit 5e55b45675fd83f818f305a8b2c310a82df22c49 by Martin Gräßlin.
Committed on 17/03/2014 at 09:22.
Pushed by graesslin into branch 'master'.

[kwin] Port away from deprecated functionality in KWindowSystem

Less warnings and more type safety.

M  +1    -1    kwin/composite.cpp
M  +22   -19   kwin/events.cpp
M  +1    -1    kwin/geometry.cpp
M  +1    -1    kwin/kcmkwin/kwinrules/main.cpp

http://commits.kde.org/kde-workspace/5e55b45675fd83f818f305a8b2c310a82df22c49

diff --git a/kwin/composite.cpp b/kwin/composite.cpp
index 0a83fb2..8e961b6 100644
--- a/kwin/composite.cpp
+++ b/kwin/composite.cpp
@@ -317,7 +317,7 @@ void Compositor::finish()
             ++it) {
         // forward all opacity values to the frame in case there'll be other CM running
         if ((*it)->opacity() != 1.0) {
-            NETWinInfo i(connection(), (*it)->frameId(), rootWindow(), 0);
+            NETWinInfo i(connection(), (*it)->frameId(), rootWindow(), 0, 0);
             i.setOpacity(static_cast< unsigned long >((*it)->opacity() * 0xffffffff));
         }
     }
diff --git a/kwin/events.cpp b/kwin/events.cpp
index a2ba41f..463462d 100644
--- a/kwin/events.cpp
+++ b/kwin/events.cpp
@@ -152,11 +152,12 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e)
     }
 
     if (eventType == XCB_PROPERTY_NOTIFY || eventType == XCB_CLIENT_MESSAGE) {
-        unsigned long dirty[ NETRootInfo::PROPERTIES_SIZE ];
-        rootInfo()->event(e, dirty, NETRootInfo::PROPERTIES_SIZE);
-        if (dirty[ NETRootInfo::PROTOCOLS ] & NET::DesktopNames)
+        NET::Properties dirtyProtocols;
+        NET::Properties2 dirtyProtocols2;
+        rootInfo()->event(e, &dirtyProtocols, &dirtyProtocols2);
+        if (dirtyProtocols & NET::DesktopNames)
             VirtualDesktopManager::self()->save();
-        if (dirty[ NETRootInfo::PROTOCOLS2 ] & NET::WM2DesktopLayout)
+        if (dirtyProtocols2 & NET::WM2DesktopLayout)
             VirtualDesktopManager::self()->updateLayout();
     }
 
@@ -482,40 +483,41 @@ bool Workspace::workspaceEvent(QEvent* e)
 bool Client::windowEvent(xcb_generic_event_t *e)
 {
     if (findEventWindow(e) == window()) { // avoid doing stuff on frame or wrapper
-        unsigned long dirty[ 2 ];
+        NET::Properties dirtyProperties;
+        NET::Properties2 dirtyProperties2;
         double old_opacity = opacity();
-        info->event(e, dirty, 2);   // pass through the NET stuff
+        info->event(e, &dirtyProperties, &dirtyProperties2);   // pass through the NET stuff
 
-        if ((dirty[ NETWinInfo::PROTOCOLS ] & NET::WMName) != 0)
+        if ((dirtyProperties & NET::WMName) != 0)
             fetchName();
-        if ((dirty[ NETWinInfo::PROTOCOLS ] & NET::WMIconName) != 0)
+        if ((dirtyProperties & NET::WMIconName) != 0)
             fetchIconicName();
-        if ((dirty[ NETWinInfo::PROTOCOLS ] & NET::WMStrut) != 0
-                || (dirty[ NETWinInfo::PROTOCOLS2 ] & NET::WM2ExtendedStrut) != 0) {
+        if ((dirtyProperties & NET::WMStrut) != 0
+                || (dirtyProperties2 & NET::WM2ExtendedStrut) != 0) {
             workspace()->updateClientArea();
         }
-        if ((dirty[ NETWinInfo::PROTOCOLS ] & NET::WMIcon) != 0)
+        if ((dirtyProperties & NET::WMIcon) != 0)
             getIcons();
         // Note there's a difference between userTime() and info->userTime()
         // info->userTime() is the value of the property, userTime() also includes
         // updates of the time done by KWin (ButtonPress on windowrapper etc.).
-        if ((dirty[ NETWinInfo::PROTOCOLS2 ] & NET::WM2UserTime) != 0) {
+        if ((dirtyProperties2 & NET::WM2UserTime) != 0) {
             workspace()->setWasUserInteraction();
             updateUserTime(info->userTime());
         }
-        if ((dirty[ NETWinInfo::PROTOCOLS2 ] & NET::WM2StartupId) != 0)
+        if ((dirtyProperties2 & NET::WM2StartupId) != 0)
             startupIdChanged();
-        if (dirty[ NETWinInfo::PROTOCOLS2 ] & NET::WM2Opacity) {
+        if (dirtyProperties2 & NET::WM2Opacity) {
             if (compositing()) {
                 addRepaintFull();
                 emit opacityChanged(this, old_opacity);
             } else {
                 // forward to the frame if there's possibly another compositing manager running
-                NETWinInfo i(connection(), frameId(), rootWindow(), 0);
+                NETWinInfo i(connection(), frameId(), rootWindow(), 0, 0);
                 i.setOpacity(info->opacity());
             }
         }
-        if (dirty[ NETWinInfo::PROTOCOLS2 ] & NET::WM2FrameOverlap) {
+        if (dirtyProperties2 & NET::WM2FrameOverlap) {
             // ### Inform the decoration
         }
     }
@@ -1494,9 +1496,10 @@ void Client::syncEvent(xcb_sync_alarm_notify_event_t* e)
 bool Unmanaged::windowEvent(xcb_generic_event_t *e)
 {
     double old_opacity = opacity();
-    unsigned long dirty[ 2 ];
-    info->event(e, dirty, 2);   // pass through the NET stuff
-    if (dirty[ NETWinInfo::PROTOCOLS2 ] & NET::WM2Opacity) {
+    NET::Properties dirtyProperties;
+    NET::Properties2 dirtyProperties2;
+    info->event(e, &dirtyProperties, &dirtyProperties2);   // pass through the NET stuff
+    if (dirtyProperties2 & NET::WM2Opacity) {
         if (compositing()) {
             addRepaintFull();
             emit opacityChanged(this, old_opacity);
diff --git a/kwin/geometry.cpp b/kwin/geometry.cpp
index c3e2122..c633427 100644
--- a/kwin/geometry.cpp
+++ b/kwin/geometry.cpp
@@ -816,7 +816,7 @@ void Workspace::setClientIsMoving(Client *c)
 // (the property with the size of the frame remains on the window after the crash).
 void Workspace::fixPositionAfterCrash(xcb_window_t w, const xcb_get_geometry_reply_t *geometry)
 {
-    NETWinInfo i(connection(), w, rootWindow(), NET::WMFrameExtents);
+    NETWinInfo i(connection(), w, rootWindow(), NET::WMFrameExtents, 0);
     NETStrut frame = i.frameExtents();
 
     if (frame.left != 0 || frame.top != 0) {
diff --git a/kwin/kcmkwin/kwinrules/main.cpp b/kwin/kcmkwin/kwinrules/main.cpp
index 3386aa4..915bd2f 100644
--- a/kwin/kcmkwin/kwinrules/main.cpp
+++ b/kwin/kcmkwin/kwinrules/main.cpp
@@ -68,7 +68,7 @@ static void saveRules(const QList< Rules* >& rules)
 
 static Rules* findRule(const QList< Rules* >& rules, Window wid, bool whole_app)
 {
-    KWindowInfo info = KWindowSystem::windowInfo(wid,
+    KWindowInfo info = KWindowInfo(wid,
                        NET::WMName | NET::WMWindowType,
                        NET::WM2WindowClass | NET::WM2WindowRole | NET::WM2ClientMachine);
     if (!info.valid())  // shouldn't really happen
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic