Merging from old trunk:

r633205 | lunakl | 2007-02-13 15:09:23 +0100 (Tue, 13 Feb 2007) | 3 lines

Implement _NET_DESKTOP_LAYOUT.


svn path=/trunk/KDE/kdebase/workspace/; revision=659545
This commit is contained in:
Luboš Luňák 2007-04-30 12:00:32 +00:00
parent 843ad559d3
commit 8bb79367cd
4 changed files with 18 additions and 31 deletions

View file

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

View file

@ -23,11 +23,6 @@
<arg name="x" type="i" direction="in"/>
<arg name="y" type="i" direction="in"/>
</method>
<method name="setDesktopLayout">
<arg name="orientation" type="i" direction="in"/>
<arg name="x" type="i" direction="in"/>
<arg name="y" type="i" direction="in"/>
</method>
<method name="setCurrentDesktop">
<arg name="desktop" type="i" direction="in"/>
<arg type="b" direction="out"/>

View file

@ -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;

View file

@ -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();