diff --git a/events.cpp b/events.cpp index 8ec14bf40d..b8c5ca9b6e 100644 --- a/events.cpp +++ b/events.cpp @@ -209,10 +209,15 @@ bool Workspace::workspaceEvent( XEvent * e ) && ( e->type == KeyPress || e->type == KeyRelease )) return false; // let Qt process it, it'll be intercepted again in eventFilter() - if ( e->type == PropertyNotify || e->type == ClientMessage ) + if( e->type == PropertyNotify || e->type == ClientMessage ) { - if ( netCheck( e ) ) - return true; + unsigned long dirty[ NETRootInfo::PROPERTIES_SIZE ]; + rootInfo->event( e, dirty, NETRootInfo::PROPERTIES_SIZE ); + if( dirty[ NETRootInfo::PROTOCOLS ] & NET::DesktopNames ) + saveDesktopSettings(); + if( dirty[ NETRootInfo::PROTOCOLS2 ] & NET::WM2DesktopLayout ) + setDesktopLayout( rootInfo->desktopLayoutOrientation(), rootInfo->desktopLayoutColumnsRows().width(), + rootInfo->desktopLayoutColumnsRows().height(), rootInfo->desktopLayoutCorner()); } // events that should be handled before Clients can get them @@ -548,20 +553,6 @@ Window Workspace::findSpecialEventWindow( XEvent* e ) }; } -/*! - Handles client messages sent to the workspace - */ -bool Workspace::netCheck( XEvent* e ) - { - unsigned int dirty = rootInfo->event( e ); - - if ( dirty & NET::DesktopNames ) - saveDesktopSettings(); - - return dirty != 0; - } - - // **************************************** // Client // **************************************** diff --git a/org.kde.KWin.xml b/org.kde.KWin.xml index 6f9908b863..b3573195a3 100644 --- a/org.kde.KWin.xml +++ b/org.kde.KWin.xml @@ -23,11 +23,6 @@ - - - - - diff --git a/workspace.cpp b/workspace.cpp index 1a8dfd369d..51e6a98126 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -292,6 +292,7 @@ void Workspace::init() NET::WM2ExtendedStrut | NET::WM2KDETemporaryRules | NET::WM2ShowingDesktop | + NET::WM2DesktopLayout | 0 , NET::ActionMove | @@ -1599,25 +1600,26 @@ void Workspace::sendClientToDesktop( Client* c, int desk, bool dont_activate ) updateClientArea(); } -void Workspace::setDesktopLayout(int o, int x, int y) +void Workspace::setDesktopLayout(NET::Orientation o, int x, int y,NET::DesktopLayoutCorner c) { - layoutOrientation = (Qt::Orientation) o; + Q_UNUSED( c ); // I don't find this worth bothering, feel free to + layoutOrientation = ( o == NET::OrientationHorizontal ? Qt::Horizontal : Qt::Vertical ); layoutX = x; layoutY = y; } void Workspace::calcDesktopLayout(int* xp, int* yp, Qt::Orientation* orientation) const { - int x = layoutX; + x = layoutX; // <= 0 means compute it from the other and total number of desktops int y = layoutY; - if ((x == -1) && (y > 0)) + if((x <= 0) && (y > 0)) x = (numberOfDesktops()+y-1) / y; - else if ((y == -1) && (x > 0)) + else if((y <=0) && (x > 0)) y = (numberOfDesktops()+x-1) / x; - if (x == -1) + if(x <=0) x = 1; - if (y == -1) + if (y <= 0) y = 1; *xp = x; *yp = y; diff --git a/workspace.h b/workspace.h index 9470bfa35e..d2a2165dc1 100644 --- a/workspace.h +++ b/workspace.h @@ -248,7 +248,7 @@ class Workspace : public QObject, public KDecorationDefines void circulateDesktopApplications(); QString desktopName( int desk ) const; - void setDesktopLayout(int o, int x, int y); + void setDesktopLayout(NET::Orientation o, int x, int y, NET::DesktopLayoutCorner c); void setShowingDesktop( bool showing ); void resetShowingDesktop( bool keep_hidden ); bool showingDesktop() const; @@ -457,7 +457,6 @@ class Workspace : public QObject, public KDecorationDefines protected: bool keyPressMouseEmulation( XKeyEvent& ev ); - bool netCheck( XEvent* e ); private: void init();