Take into account a wide range of pager-layouts, the pager can set the
required layout via DCOP. Used for desktop left/right/up/down. svn path=/trunk/kdebase/kwin/; revision=124773
This commit is contained in:
parent
631c5d45e3
commit
8c5a34d322
5 changed files with 106 additions and 34 deletions
|
@ -16,6 +16,7 @@ class KWinInterface : virtual public DCOPObject
|
||||||
virtual void refresh() = 0;
|
virtual void refresh() = 0;
|
||||||
virtual void doNotManage(QString)= 0;
|
virtual void doNotManage(QString)= 0;
|
||||||
virtual void showWindowMenuAt(unsigned long winId, int x, int y)= 0;
|
virtual void showWindowMenuAt(unsigned long winId, int x, int y)= 0;
|
||||||
|
virtual void setDesktopLayout(int orientation, int x, int y)= 0;
|
||||||
virtual void setCurrentDesktop(int)= 0;
|
virtual void setCurrentDesktop(int)= 0;
|
||||||
virtual int currentDesktop() const = 0;
|
virtual int currentDesktop() const = 0;
|
||||||
virtual void nextDesktop() = 0;
|
virtual void nextDesktop() = 0;
|
||||||
|
|
|
@ -228,14 +228,6 @@ void Options::reload()
|
||||||
|
|
||||||
ignorePositionClasses = config->readListEntry("IgnorePositionClasses");
|
ignorePositionClasses = config->readListEntry("IgnorePositionClasses");
|
||||||
|
|
||||||
|
|
||||||
// desktop settings
|
|
||||||
|
|
||||||
config->setGroup("Desktops");
|
|
||||||
desktopRows = config->readNumEntry( "DesktopRows", 2 );
|
|
||||||
if ( desktopRows < 1 )
|
|
||||||
desktopRows = 1;
|
|
||||||
|
|
||||||
// Mouse bindings
|
// Mouse bindings
|
||||||
config->setGroup( "MouseBindings");
|
config->setGroup( "MouseBindings");
|
||||||
CmdActiveTitlebar1 = mouseCommand(config->readEntry("CommandActiveTitlebar1","Raise"));
|
CmdActiveTitlebar1 = mouseCommand(config->readEntry("CommandActiveTitlebar1","Raise"));
|
||||||
|
|
|
@ -116,12 +116,6 @@ public:
|
||||||
bool xineramaMovementEnabled;
|
bool xineramaMovementEnabled;
|
||||||
bool xineramaMaximizeEnabled;
|
bool xineramaMaximizeEnabled;
|
||||||
|
|
||||||
/**
|
|
||||||
Number of desktop rowsd
|
|
||||||
*/
|
|
||||||
int desktopRows;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
MoveResizeMode, either Tranparent or Opaque.
|
MoveResizeMode, either Tranparent or Opaque.
|
||||||
*/
|
*/
|
||||||
|
|
121
workspace.cpp
121
workspace.cpp
|
@ -105,7 +105,10 @@ public:
|
||||||
electric_right_border(None),
|
electric_right_border(None),
|
||||||
electric_time_first(0),
|
electric_time_first(0),
|
||||||
electric_time_last(0),
|
electric_time_last(0),
|
||||||
movingClient(0)
|
movingClient(0),
|
||||||
|
layoutOrientation(Qt::Vertical),
|
||||||
|
layoutX(-1),
|
||||||
|
layoutY(2)
|
||||||
{ };
|
{ };
|
||||||
~WorkspacePrivate() {};
|
~WorkspacePrivate() {};
|
||||||
KStartupInfo* startup;
|
KStartupInfo* startup;
|
||||||
|
@ -123,6 +126,9 @@ public:
|
||||||
Time electric_time_last;
|
Time electric_time_last;
|
||||||
QPoint electric_push_point;
|
QPoint electric_push_point;
|
||||||
Client *movingClient;
|
Client *movingClient;
|
||||||
|
Qt::Orientation layoutOrientation;
|
||||||
|
int layoutX;
|
||||||
|
int layoutY;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -2543,6 +2549,7 @@ void Workspace::setNumberOfDesktops( int n )
|
||||||
if ( n == number_of_desktops )
|
if ( n == number_of_desktops )
|
||||||
return;
|
return;
|
||||||
number_of_desktops = n;
|
number_of_desktops = n;
|
||||||
|
|
||||||
rootInfo->setNumberOfDesktops( number_of_desktops );
|
rootInfo->setNumberOfDesktops( number_of_desktops );
|
||||||
saveDesktopSettings();
|
saveDesktopSettings();
|
||||||
|
|
||||||
|
@ -2770,34 +2777,108 @@ void Workspace::slotSwitchDesktopPrevious(){
|
||||||
d = numberOfDesktops();
|
d = numberOfDesktops();
|
||||||
setCurrentDesktop(d);
|
setCurrentDesktop(d);
|
||||||
}
|
}
|
||||||
void Workspace::slotSwitchDesktopRight(){
|
|
||||||
|
|
||||||
int d = currentDesktop() + options->desktopRows;
|
void Workspace::setDesktopLayout(int o, int x, int y)
|
||||||
if ( d > numberOfDesktops() )
|
{
|
||||||
d -= numberOfDesktops();
|
d->layoutOrientation = (Qt::Orientation) o;
|
||||||
setCurrentDesktop(d);
|
d->layoutX = x;
|
||||||
|
d->layoutY = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Workspace::calcDesktopLayout(int &x, int &y)
|
||||||
|
{
|
||||||
|
x = d->layoutX;
|
||||||
|
y = d->layoutY;
|
||||||
|
if ((x == -1) && (y > 0))
|
||||||
|
x = (numberOfDesktops()+y-1) / y;
|
||||||
|
else if ((y == -1) && (x > 0))
|
||||||
|
y = (numberOfDesktops()+x-1) / x;
|
||||||
|
|
||||||
|
if (x == -1)
|
||||||
|
x = 1;
|
||||||
|
if (y == -1)
|
||||||
|
y = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Workspace::slotSwitchDesktopRight()
|
||||||
|
{
|
||||||
|
int x,y;
|
||||||
|
calcDesktopLayout(x,y);
|
||||||
|
int dt = currentDesktop()-1;
|
||||||
|
if (d->layoutOrientation == Qt::Vertical)
|
||||||
|
{
|
||||||
|
dt += y;
|
||||||
|
if ( dt >= numberOfDesktops() )
|
||||||
|
dt -= numberOfDesktops();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int d = (dt % x) + 1;
|
||||||
|
if (d >= x)
|
||||||
|
d -= x;
|
||||||
|
dt = dt - (dt % x) + d;
|
||||||
|
}
|
||||||
|
setCurrentDesktop(dt+1);
|
||||||
|
}
|
||||||
|
|
||||||
void Workspace::slotSwitchDesktopLeft(){
|
void Workspace::slotSwitchDesktopLeft(){
|
||||||
int d = currentDesktop() - options->desktopRows;
|
int x,y;
|
||||||
if ( d < 1 )
|
calcDesktopLayout(x,y);
|
||||||
d += numberOfDesktops();
|
int dt = currentDesktop()-1;
|
||||||
setCurrentDesktop(d);
|
if (d->layoutOrientation == Qt::Vertical)
|
||||||
|
{
|
||||||
|
dt -= y;
|
||||||
|
if ( dt < 0 )
|
||||||
|
dt += numberOfDesktops();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int d = (dt % x) - 1;
|
||||||
|
if (d < 0)
|
||||||
|
d += x;
|
||||||
|
dt = dt - (dt % x) + d;
|
||||||
|
}
|
||||||
|
setCurrentDesktop(dt+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Workspace::slotSwitchDesktopUp(){
|
void Workspace::slotSwitchDesktopUp(){
|
||||||
int d = currentDesktop();
|
int x,y;
|
||||||
if ( (d-1) % options->desktopRows == 0 )
|
calcDesktopLayout(x,y);
|
||||||
d += options->desktopRows - 1;
|
int dt = currentDesktop()-1;
|
||||||
|
if (d->layoutOrientation == Qt::Horizontal)
|
||||||
|
{
|
||||||
|
dt -= x;
|
||||||
|
if ( dt < 0 )
|
||||||
|
dt += numberOfDesktops();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
d--;
|
{
|
||||||
setCurrentDesktop(d);
|
int d = (dt % y) - 1;
|
||||||
|
if (d < 0)
|
||||||
|
d += y;
|
||||||
|
dt = dt - (dt % y) + d;
|
||||||
|
}
|
||||||
|
setCurrentDesktop(dt+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Workspace::slotSwitchDesktopDown(){
|
void Workspace::slotSwitchDesktopDown(){
|
||||||
int d = currentDesktop();
|
int x,y;
|
||||||
if ( d % options->desktopRows == 0 )
|
calcDesktopLayout(x,y);
|
||||||
d -= options->desktopRows - 1;
|
int dt = currentDesktop()-1;
|
||||||
|
if (d->layoutOrientation == Qt::Horizontal)
|
||||||
|
{
|
||||||
|
dt += x;
|
||||||
|
if ( dt >= numberOfDesktops() )
|
||||||
|
dt -= numberOfDesktops();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
d++;
|
{
|
||||||
setCurrentDesktop(d);
|
int d = (dt % y) + 1;
|
||||||
|
if (d >= y)
|
||||||
|
d -= y;
|
||||||
|
dt = dt - (dt % y) + d;
|
||||||
|
}
|
||||||
|
setCurrentDesktop(dt+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Workspace::slotSwitchToDesktop( int i )
|
void Workspace::slotSwitchToDesktop( int i )
|
||||||
|
|
|
@ -225,6 +225,7 @@ public:
|
||||||
void previousDesktop();
|
void previousDesktop();
|
||||||
|
|
||||||
QString desktopName( int desk );
|
QString desktopName( int desk );
|
||||||
|
void setDesktopLayout(int o, int x, int y);
|
||||||
|
|
||||||
bool isNotManaged( const QString& title );
|
bool isNotManaged( const QString& title );
|
||||||
|
|
||||||
|
@ -373,6 +374,9 @@ private:
|
||||||
|
|
||||||
// ------------------
|
// ------------------
|
||||||
|
|
||||||
|
void calcDesktopLayout(int &x, int &y);
|
||||||
|
|
||||||
|
|
||||||
SystemTrayWindowList systemTrayWins;
|
SystemTrayWindowList systemTrayWins;
|
||||||
|
|
||||||
int current_desktop;
|
int current_desktop;
|
||||||
|
|
Loading…
Reference in a new issue