kdebase/kcontrol/keys/: add ability to separate between 'normal' shortcuts and a shortcut series

kdebase/kwin/tabbox: allow for choosing between switching between desktops in focus order versus numeric order.

kdebase/kwin/workspace: add key bindings for focus-order-desktop-walking and sending a window to a specific desktop.

*bindings.cpp: add labels for kcontrol

svn path=/trunk/kdebase/kwin/; revision=101281
This commit is contained in:
Ellis Whitehead 2001-06-10 04:10:42 +00:00
parent f8c8380275
commit 9e0653455e
5 changed files with 340 additions and 77 deletions

View file

@ -1,48 +1,115 @@
keys->insertItem(i18n("Switch to desktop 1"), "Switch to desktop 1", KKey("CTRL+F1"), KKey("Meta+1"));
keys->insertItem(i18n("Switch to desktop 2"), "Switch to desktop 2", KKey("CTRL+F2"), KKey("Meta+2"));
keys->insertItem(i18n("Switch to desktop 3"), "Switch to desktop 3", KKey("CTRL+F3"), KKey("Meta+3"));
keys->insertItem(i18n("Switch to desktop 4"), "Switch to desktop 4", KKey("CTRL+F4"), KKey("Meta+4"));
keys->insertItem(i18n("Switch to desktop 5"), "Switch to desktop 5", KKey("CTRL+F5"), KKey("Meta+5"));
keys->insertItem(i18n("Switch to desktop 6"), "Switch to desktop 6", KKey("CTRL+F6"), KKey("Meta+6"));
keys->insertItem(i18n("Switch to desktop 7"), "Switch to desktop 7", KKey("CTRL+F7"), KKey("Meta+7"));
keys->insertItem(i18n("Switch to desktop 8"), "Switch to desktop 8", KKey("CTRL+F8"), KKey("Meta+8"));
keys->insertItem(i18n("Switch to desktop 9"), "Switch to desktop 9", KKey("CTRL+F9"), KKey("Meta+9"));
keys->insertItem(i18n("Switch to desktop 10"), "Switch to desktop 10", KKey("CTRL+F10"), KKey());
keys->insertItem(i18n("Switch to desktop 11"), "Switch to desktop 11", KKey("CTRL+F11"), KKey());
keys->insertItem(i18n("Switch to desktop 12"), "Switch to desktop 12", KKey("CTRL+F12"), KKey());
keys->insertItem(i18n("Switch to desktop 13"), "Switch to desktop 13", KKey("CTRL+SHIFT+F1"), KKey());
keys->insertItem(i18n("Switch to desktop 14"), "Switch to desktop 14", KKey("CTRL+SHIFT+F2"), KKey());
keys->insertItem(i18n("Switch to desktop 15"), "Switch to desktop 15", KKey("CTRL+SHIFT+F3"), KKey());
keys->insertItem(i18n("Switch to desktop 16"), "Switch to desktop 16", KKey("CTRL+SHIFT+F4"), KKey());
keys->insertItem(i18n("Switch to next desktop"), "Switch desktop next", KKey().key());
keys->insertItem(i18n("Switch to previous desktop"), "Switch desktop previous", KKey().key());
keys->insertItem(i18n("Switch one desktop to the right"), "Switch desktop right", KKey().key());
keys->insertItem(i18n("Switch one desktop to the left"), "Switch desktop left", KKey().key());
keys->insertItem(i18n("Switch one desktop up"), "Switch desktop up", KKey().key());
keys->insertItem(i18n("Switch one desktop down"), "Switch desktop down", KKey().key());
#ifdef WITH_LABELS
keys->insertItem(i18n("System"), "Program:kwin", 0);
#endif
keys->insertItem(i18n("Window operations menu"), "Pop-up window operations menu", KKey("ALT+F3"), KKey("Alt+Space"));
keys->insertItem(i18n("Window close"), "Window close", KKey("ALT+F4"), KKey("Alt+Escape"));
keys->insertItem(i18n("Window maximize"), "Window maximize", KKey(), KKey("Meta+Plus"));
keys->insertItem(i18n("Window maximize vertical"), "Window maximize vertical", KKey(), KKey("Meta+Bar"));
keys->insertItem(i18n("Window maximize horizontal"), "Window maximize horizontal", KKey(), KKey("Meta+Equal"));
keys->insertItem(i18n("Window iconify"), "Window iconify", KKey(), KKey("Meta+Minus"));
keys->insertItem(i18n("Window iconify (all)"), "Window iconify all", KKey(), KKey("Meta+Ctrl+Minus"));
keys->insertItem(i18n("Window shade"), "Window shade", KKey(), KKey("Meta+Underscore"));
keys->insertItem(i18n("Window move"), "Window move", 0);
keys->insertItem(i18n("Window resize"), "Window resize", 0);
keys->insertItem(i18n("Window raise"), "Window raise", 0);
keys->insertItem(i18n("Window lower"), "Window lower", 0);
keys->insertItem(i18n("Window raise or lower"), "Toggle raise and lower", 0);
keys->insertItem(i18n("Window to next desktop"), "Window to next desktop", 0);
keys->insertItem(i18n("Window to previous desktop"), "Window to previous desktop", 0);
#ifdef WITH_LABELS
keys->insertItem(i18n("Navigation"), "Group:Navigation", 0);
#endif
keys->insertItem(i18n("Walk through Windows"), "Walk through windows", KKey("ALT+Tab"), KKey("Alt+Tab"));
keys->insertItem(i18n("Walk through Windows (Reverse)"), "Walk back through windows", KKey("SHIFT+ALT+Tab"), KKey("Alt+Shift+Tab"));
keys->insertItem(i18n("Walk through Desktops"), "Walk through desktops", KKey("CTRL+Tab"), KKey("Meta+Tab"));
keys->insertItem(i18n("Walk through Desktops (Reverse)"), "Walk back through desktops", KKey("SHIFT+CTRL+Tab"), KKey("Meta+Shift+Tab"));
keys->insertItem(i18n("Walk through Desktop List"), "Walk through desktop list", KKey(), KKey());
keys->insertItem(i18n("Walk through Desktop List (Reverse)"), "Walk back through desktop list", KKey(), KKey());
keys->insertItem(i18n("Walk through desktops"), "Walk through desktops", KKey("CTRL+Tab"), KKey("Meta+Tab"));
keys->insertItem(i18n("Walk back through desktops"), "Walk back through desktops", KKey("SHIFT+CTRL+Tab"), KKey("Meta+Shift+Tab"));
keys->insertItem(i18n("Walk through windows"), "Walk through windows", KKey("ALT+Tab"), KKey("Alt+Tab"));
keys->insertItem(i18n("Walk back through windows"), "Walk back through windows", KKey("SHIFT+ALT+Tab"), KKey("Alt+Shift+Tab"));
#ifdef WITH_LABELS
keys->insertItem(i18n("Windows"), "Group:Windows", 0);
#endif
keys->insertItem(i18n("Window Operations Menu"), "Pop-up window operations menu", KKey("ALT+F3"), KKey("Alt+Space"));
keys->insertItem(i18n("Window Close"), "Window close", KKey("ALT+F4"), KKey("Alt+Escape"));
keys->insertItem(i18n("Window Close (All)"), "Window close all", KKey("ALT+Ctrl+F4"), KKey("Alt+Ctrl+Escape"));
keys->insertItem(i18n("Window Maximize"), "Window maximize", KKey(), KKey("Meta+Plus"));
keys->insertItem(i18n("Window Maximize Vertical"), "Window maximize vertical", KKey(), KKey("Meta+Bar"));
keys->insertItem(i18n("Window Maximize Horizontal"), "Window maximize horizontal", KKey(), KKey("Meta+Equal"));
keys->insertItem(i18n("Window Iconify"), "Window iconify", KKey(), KKey("Meta+Minus"));
keys->insertItem(i18n("Window Iconify (All)"), "Window iconify all", KKey(), KKey("Meta+Ctrl+Minus"));
keys->insertItem(i18n("Window Shade"), "Window shade", KKey(), KKey("Meta+Underscore"));
keys->insertItem(i18n("Window Move"), "Window move", 0);
keys->insertItem(i18n("Window Resize"), "Window resize", 0);
keys->insertItem(i18n("Window Raise"), "Window raise", 0);
keys->insertItem(i18n("Window Lower"), "Window lower", 0);
keys->insertItem(i18n("Window Raise or lower"), "Toggle raise and lower", 0);
/*
This belongs in taskbar rather than here, so it'll have to wait until after 2.2 is done.
-- ellis
keys->insertItem(i18n("Switch to Window 1"), "Switch to Window 1", KKey(), KKey("Meta+1"));
keys->insertItem(i18n("Switch to Window 2"), "Switch to Window 2", KKey(), KKey("Meta+2"));
keys->insertItem(i18n("Switch to Window 3"), "Switch to Window 3", KKey(), KKey("Meta+3"));
keys->insertItem(i18n("Switch to Window 4"), "Switch to Window 4", KKey(), KKey("Meta+4"));
keys->insertItem(i18n("Switch to Window 5"), "Switch to Window 5", KKey(), KKey("Meta+5"));
keys->insertItem(i18n("Switch to Window 6"), "Switch to Window 6", KKey(), KKey("Meta+6"));
keys->insertItem(i18n("Switch to Window 7"), "Switch to Window 7", KKey(), KKey("Meta+7"));
keys->insertItem(i18n("Switch to Window 8"), "Switch to Window 8", KKey(), KKey("Meta+8"));
keys->insertItem(i18n("Switch to Window 9"), "Switch to Window 9", KKey(), KKey("Meta+9"));
*/
keys->insertItem(i18n("Mouse emulation"), "Mouse emulation", KKey("ALT+F12"), KKey("Meta+F12"));
#ifdef WITH_LABELS
keys->insertItem(i18n("Window & Desktop"), "Group:Window Desktop", 0);
#endif
keys->insertItem(i18n("Window to Desktop 1"), "Window to Desktop 1", KKey(), KKey("Meta+Alt+F1"));
keys->insertItem(i18n("Window to Desktop 2"), "Window to Desktop 2", KKey(), KKey("Meta+Alt+F2"));
keys->insertItem(i18n("Window to Desktop 3"), "Window to Desktop 3", KKey(), KKey("Meta+Alt+F3"));
keys->insertItem(i18n("Window to Desktop 4"), "Window to Desktop 4", KKey(), KKey("Meta+Alt+F4"));
keys->insertItem(i18n("Window to Desktop 5"), "Window to Desktop 5", KKey(), KKey("Meta+Alt+F5"));
keys->insertItem(i18n("Window to Desktop 6"), "Window to Desktop 6", KKey(), KKey("Meta+Alt+F6"));
keys->insertItem(i18n("Window to Desktop 7"), "Window to Desktop 7", KKey(), KKey("Meta+Alt+F7"));
keys->insertItem(i18n("Window to Desktop 8"), "Window to Desktop 8", KKey(), KKey("Meta+Alt+F8"));
keys->insertItem(i18n("Window to Desktop 9"), "Window to Desktop 9", KKey(), KKey("Meta+Alt+F9"));
keys->insertItem(i18n("Window to Desktop 10"), "Window to Desktop 10", KKey(), KKey("Meta+Alt+F10"));
keys->insertItem(i18n("Window to Desktop 11"), "Window to Desktop 11", KKey(), KKey());
keys->insertItem(i18n("Window to Desktop 12"), "Window to Desktop 12", KKey(), KKey());
keys->insertItem(i18n("Window to Desktop 13"), "Window to Desktop 13", KKey(), KKey());
keys->insertItem(i18n("Window to Desktop 14"), "Window to Desktop 14", KKey(), KKey());
keys->insertItem(i18n("Window to Desktop 15"), "Window to Desktop 15", KKey(), KKey());
keys->insertItem(i18n("Window to Desktop 16"), "Window to Desktop 16", KKey(), KKey());
keys->insertItem(i18n("Window to Next Desktop"), "Window to next desktop", 0);
keys->insertItem(i18n("Window to Previous Desktop"), "Window to previous desktop", 0);
/*
This belongs in taskbar rather than here, so it'll have to wait until after 2.2 is done.
-- ellis
#ifdef WITH_LABELS
keys->insertItem(i18n("Window & Taskbar"), "Group:Window Desktop", 0);
#endif
keys->insertItem(i18n("Window to Taskbar Position 1"), "Window to Taskbar Position 1", KKey(), KKey("Meta+Alt+1"));
keys->insertItem(i18n("Window to Taskbar Position 2"), "Window to Taskbar Position 2", KKey(), KKey("Meta+Alt+2"));
keys->insertItem(i18n("Window to Taskbar Position 3"), "Window to Taskbar Position 3", KKey(), KKey("Meta+Alt+3"));
keys->insertItem(i18n("Window to Taskbar Position 4"), "Window to Taskbar Position 4", KKey(), KKey("Meta+Alt+4"));
keys->insertItem(i18n("Window to Taskbar Position 5"), "Window to Taskbar Position 5", KKey(), KKey("Meta+Alt+5"));
keys->insertItem(i18n("Window to Taskbar Position 6"), "Window to Taskbar Position 6", KKey(), KKey("Meta+Alt+6"));
keys->insertItem(i18n("Window to Taskbar Position 7"), "Window to Taskbar Position 7", KKey(), KKey("Meta+Alt+7"));
keys->insertItem(i18n("Window to Taskbar Position 8"), "Window to Taskbar Position 8", KKey(), KKey("Meta+Alt+8"));
keys->insertItem(i18n("Window to Taskbar Position 9"), "Window to Taskbar Position 9", KKey(), KKey("Meta+Alt+9"));
*/
#ifdef WITH_LABELS
keys->insertItem(i18n("Desktop Switching"), "Group:Desktop Switching", 0);
#endif
keys->insertItem(i18n("Switch to Desktop 1"), "Switch to desktop 1", KKey("CTRL+F1"), KKey("Meta+F1"));
keys->insertItem(i18n("Switch to Desktop 2"), "Switch to desktop 2", KKey("CTRL+F2"), KKey("Meta+F2"));
keys->insertItem(i18n("Switch to Desktop 3"), "Switch to desktop 3", KKey("CTRL+F3"), KKey("Meta+F3"));
keys->insertItem(i18n("Switch to Desktop 4"), "Switch to desktop 4", KKey("CTRL+F4"), KKey("Meta+F4"));
keys->insertItem(i18n("Switch to Desktop 5"), "Switch to desktop 5", KKey("CTRL+F5"), KKey("Meta+F5"));
keys->insertItem(i18n("Switch to Desktop 6"), "Switch to desktop 6", KKey("CTRL+F6"), KKey("Meta+F6"));
keys->insertItem(i18n("Switch to Desktop 7"), "Switch to desktop 7", KKey("CTRL+F7"), KKey("Meta+F7"));
keys->insertItem(i18n("Switch to Desktop 8"), "Switch to desktop 8", KKey("CTRL+F8"), KKey("Meta+F8"));
keys->insertItem(i18n("Switch to Desktop 9"), "Switch to desktop 9", KKey("CTRL+F9"), KKey("Meta+F9"));
keys->insertItem(i18n("Switch to Desktop 10"), "Switch to desktop 10", KKey("CTRL+F10"), KKey("Meta+F10"));
keys->insertItem(i18n("Switch to Desktop 11"), "Switch to desktop 11", KKey("CTRL+F11"), KKey());
keys->insertItem(i18n("Switch to Desktop 12"), "Switch to desktop 12", KKey("CTRL+F12"), KKey());
keys->insertItem(i18n("Switch to Desktop 13"), "Switch to desktop 13", KKey("CTRL+SHIFT+F1"), KKey());
keys->insertItem(i18n("Switch to Desktop 14"), "Switch to desktop 14", KKey("CTRL+SHIFT+F2"), KKey());
keys->insertItem(i18n("Switch to Desktop 15"), "Switch to desktop 15", KKey("CTRL+SHIFT+F3"), KKey());
keys->insertItem(i18n("Switch to Desktop 16"), "Switch to desktop 16", KKey("CTRL+SHIFT+F4"), KKey());
keys->insertItem(i18n("Switch to Next Desktop"), "Switch desktop next", KKey().key());
keys->insertItem(i18n("Switch to Previous Desktop"), "Switch desktop previous", KKey().key());
keys->insertItem(i18n("Switch One Desktop to the Right"), "Switch desktop right", KKey().key());
keys->insertItem(i18n("Switch One Desktop to the Left"), "Switch desktop left", KKey().key());
keys->insertItem(i18n("Switch One Desktop Up"), "Switch desktop up", KKey().key());
keys->insertItem(i18n("Switch One Desktop Down"), "Switch desktop down", KKey().key());
#ifdef WITH_LABELS
keys->insertItem(i18n("Miscellaneous"), "Group:Miscellaneous", 0);
#endif
keys->insertItem(i18n("Mouse Emulation"), "Mouse emulation", KKey("ALT+F12"), KKey());
keys->insertItem(i18n("Kill Window"), "Kill Window", KKey("CTRL+ALT+Escape"), KKey("Meta+Ctrl+Delete"));

View file

@ -37,7 +37,7 @@ TabBox::~TabBox()
/*!
Sets the current mode to \a mode, either DesktopMode or WindowsMode
Sets the current mode to \a mode, either DesktopListMode or WindowsMode
\sa mode()
*/
@ -49,7 +49,7 @@ void TabBox::setMode( Mode mode )
/*!
Resets the tab box to display the active client in WindowsMode, or the
current desktop in DesktopMode
current desktop in DesktopListMode
*/
void TabBox::reset()
{
@ -84,7 +84,7 @@ void TabBox::reset()
}
wmax = QMAX( wmax, int(clients.count())*20 );
}
else { // DesktopMode
else { // DesktopListMode
desk = workspace()->currentDesktop();
}
@ -129,7 +129,13 @@ void TabBox::nextPrev( bool next)
&& !client->isOnDesktop(workspace()->currentDesktop()))
client = 0;
}
else { // DesktopMode
else if( mode() == DesktopMode ) {
if ( next )
desk = workspace()->nextDesktop( desk );
else
desk = workspace()->previousDesktop( desk );
}
else { // DesktopListMode
if ( next ) {
desk++;
if ( desk > workspace()->numberOfDesktops() )
@ -159,14 +165,15 @@ Client* TabBox::currentClient()
/*!
Returns the currently displayed virtual desktop ( only works in
DesktopMode )
DesktopListMode )
Returns -1 if no desktop is displayed.
*/
int TabBox::currentDesktop()
{
if ( mode() != DesktopMode )
if ( mode() == DesktopListMode || mode() == DesktopMode )
return desk;
else
return -1;
return desk;
}
@ -255,7 +262,7 @@ void TabBox::paintContents()
x += 20;
}
}
} else { // DesktopMode
} else { // DesktopMode || DesktopListMode
p.drawText( r, AlignCenter, workspace()->desktopName(desk) );
int x = (width() - workspace()->numberOfDesktops() * 20 )/2;
int y = height() - 26;
@ -263,15 +270,24 @@ void TabBox::paintContents()
f.setPointSize( 12 );
f.setBold( FALSE );
p.setFont(f );
// In DesktopMode, start at the current desktop
// In DesktopListMode, start at desktop #1
int iDesktop = (mode() == DesktopMode) ? workspace()->currentDesktop() : 1;
for ( int i = 1; i <= workspace()->numberOfDesktops(); i++ ) {
p.setPen( i == desk?
p.setPen( iDesktop == desk?
colorGroup().highlight():colorGroup().background() );
p.drawRect( x-2, y-2, 20, 20 );
qDrawWinPanel( &p, QRect( x, y, 16, 16), colorGroup(), FALSE,
&colorGroup().brush(QColorGroup::Base ) );
&colorGroup().brush(QColorGroup::Base ) );
p.setPen( colorGroup().text() );
p.drawText( x, y, 16, 16, AlignCenter, QString::number(i) );
p.drawText( x, y, 16, 16, AlignCenter, QString::number(iDesktop) );
x += 20;
if( mode() == DesktopMode )
iDesktop = workspace()->nextDesktop( iDesktop );
else
iDesktop++;
}
}
}

View file

@ -26,7 +26,10 @@ public:
Client* currentClient();
int currentDesktop();
enum Mode { DesktopMode, WindowsMode };
// DesktopMode and WindowsMode are based on the order in which the desktop
// or window were viewed.
// DesktopListMode lists them in the order created.
enum Mode { DesktopMode, DesktopListMode, WindowsMode };
void setMode( Mode mode );
Mode mode() const;
@ -37,7 +40,7 @@ public:
void hide();
Workspace* workspace() const;
void reconfigure();
protected:
@ -69,7 +72,7 @@ inline Workspace* TabBox::workspace() const
}
/*!
Returns the current mode, either DesktopMode or WindowsMode
Returns the current mode, either DesktopListMode or WindowsMode
\sa setMode()
*/

View file

@ -802,6 +802,34 @@ void Workspace::slotWalkBackThroughDesktops()
}
}
void Workspace::slotWalkThroughDesktopList()
{
if ( root != qt_xrootwin() )
return;
if( tab_grab || control_grab )
return;
if (( keyToXMod( walkThroughDesktopListKeycode ) & XMODMASK ) != 0 ) {
if ( startWalkThroughDesktopList() )
walkThroughDesktops( true );
} else {
oneStepThroughDesktopList( true );
}
}
void Workspace::slotWalkBackThroughDesktopList()
{
if ( root != qt_xrootwin() )
return;
if( tab_grab || control_grab )
return;
if (( keyToXMod( walkBackThroughDesktopListKeycode ) & XMODMASK ) != 0 ) {
if ( startWalkThroughDesktopList() )
walkThroughDesktops( false );
} else {
oneStepThroughDesktopList( false );
}
}
bool Workspace::startKDEWalkThroughWindows()
{
if ( XGrabPointer( qt_xdisplay(), root, TRUE,
@ -824,7 +852,7 @@ bool Workspace::startKDEWalkThroughWindows()
return TRUE;
}
bool Workspace::startWalkThroughDesktops()
bool Workspace::startWalkThroughDesktops( int mode )
{
if ( XGrabPointer( qt_xdisplay(), root, TRUE,
(uint)(ButtonPressMask | ButtonReleaseMask |
@ -841,11 +869,21 @@ bool Workspace::startWalkThroughDesktops()
kwin_time);
control_grab = TRUE;
keys->setKeyEventsEnabled( FALSE );
tab_box->setMode( TabBox::DesktopMode );
tab_box->setMode( (TabBox::Mode) mode );
tab_box->reset();
return TRUE;
}
bool Workspace::startWalkThroughDesktops()
{
return startWalkThroughDesktops( TabBox::DesktopMode );
}
bool Workspace::startWalkThroughDesktopList()
{
return startWalkThroughDesktops( TabBox::DesktopListMode );
}
void Workspace::KDEWalkThroughWindows( bool forward )
{
tab_box->nextPrev( forward );
@ -896,15 +934,25 @@ void Workspace::KDEOneStepThroughWindows( bool forward )
}
}
void Workspace::oneStepThroughDesktops( bool forward )
void Workspace::oneStepThroughDesktops( bool forward, int mode )
{
tab_box->setMode( TabBox::DesktopMode );
tab_box->setMode( (TabBox::Mode) mode );
tab_box->reset();
tab_box->nextPrev( forward );
if ( tab_box->currentDesktop() != -1 )
setCurrentDesktop( tab_box->currentDesktop() );
}
void Workspace::oneStepThroughDesktops( bool forward )
{
oneStepThroughDesktops( forward, TabBox::DesktopMode );
}
void Workspace::oneStepThroughDesktopList( bool forward )
{
oneStepThroughDesktops( forward, TabBox::DesktopListMode );
}
/*!
Handles holding alt-tab / control-tab
*/
@ -936,6 +984,14 @@ bool Workspace::keyPress(XKeyEvent key)
}
walkThroughDesktops( keyCombQt == walkThroughDesktopsKeycode );
}
else if( keyCombQt == walkThroughDesktopListKeycode
|| keyCombQt == walkBackThroughDesktopListKeycode ) {
if (!control_grab) {
freeKeyboard(FALSE);
return FALSE;
}
walkThroughDesktops( keyCombQt == walkThroughDesktopListKeycode );
}
}
if (control_grab || tab_grab){
@ -1015,6 +1071,28 @@ bool Workspace::keyRelease(XKeyEvent key)
#undef XMODMASK
int Workspace::nextDesktop( int iDesktop ) const
{
int i = desktop_focus_chain.find( iDesktop );
if( i >= 0 && i+1 < (int)desktop_focus_chain.size() )
return desktop_focus_chain[i+1];
else if( desktop_focus_chain.size() > 0 )
return 1;
else
return 0;
}
int Workspace::previousDesktop( int iDesktop ) const
{
int i = desktop_focus_chain.find( iDesktop );
if( i-1 >= 0 )
return desktop_focus_chain[i-1];
else if( desktop_focus_chain.size() > 0 )
return desktop_focus_chain[desktop_focus_chain.size()-1];
else
return numberOfDesktops();
}
/*!
auxiliary functions to travers all clients according the focus
order. Useful for kwm´s Alt-tab feature.
@ -1775,6 +1853,8 @@ void Workspace::slotReconfigure()
tab_box->reconfigure();
walkThroughDesktopsKeycode = keys->currentKey( "Walk through desktops" );
walkBackThroughDesktopsKeycode = keys->currentKey( "Walk back through desktops" );
walkThroughDesktopListKeycode = keys->currentKey( "Walk through desktop list" );
walkBackThroughDesktopListKeycode = keys->currentKey( "Walk back through desktop list" );
walkThroughWindowsKeycode = keys->currentKey( "Walk through windows" );
walkBackThroughWindowsKeycode = keys->currentKey( "Walk back through windows" );
mgr->updatePlugin();
@ -2248,6 +2328,20 @@ void Workspace::setCurrentDesktop( int new_desktop ){
if( w_tmp == null_focus_window )
requestFocus( desktop_client );
}
// Update focus chain:
// If input: chain = { 1, 2, 3, 4 } and current_desktop = 3,
// Output: chain = { 3, 1, 2, 4 }.
kdDebug() << QString("Switching to desktop #%1, at focus_chain index %2\n")
.arg(current_desktop).arg(desktop_focus_chain.find( current_desktop ));
for( int i = desktop_focus_chain.find( current_desktop ); i > 0; i-- )
desktop_focus_chain[i] = desktop_focus_chain[i-1];
desktop_focus_chain[0] = current_desktop;
QString s = "desktop_focus_chain[] = { ";
for( uint i = 0; i < desktop_focus_chain.size(); i++ )
s += QString::number(desktop_focus_chain[i]) + ", ";
kdDebug() << s << "}\n";
}
void Workspace::nextDesktop()
@ -2282,6 +2376,11 @@ void Workspace::setNumberOfDesktops( int n )
number_of_desktops = n;
rootInfo->setNumberOfDesktops( number_of_desktops );
saveDesktopSettings();
// Resize and reset the desktop focus chain.
desktop_focus_chain.resize( n );
for( int i = 0; i < (int)desktop_focus_chain.size(); i++ )
desktop_focus_chain[i] = i+1;
}
/*!
@ -2394,22 +2493,22 @@ void Workspace::createKeybindings(){
#include "kwinbindings.cpp"
keys->connectItem( "Switch to desktop 1", this, SLOT( slotSwitchDesktop1() ));
keys->connectItem( "Switch to desktop 2", this, SLOT( slotSwitchDesktop2() ));
keys->connectItem( "Switch to desktop 3", this, SLOT( slotSwitchDesktop3() ));
keys->connectItem( "Switch to desktop 4", this, SLOT( slotSwitchDesktop4() ));
keys->connectItem( "Switch to desktop 5", this, SLOT( slotSwitchDesktop5() ));
keys->connectItem( "Switch to desktop 6", this, SLOT( slotSwitchDesktop6() ));
keys->connectItem( "Switch to desktop 7", this, SLOT( slotSwitchDesktop7() ));
keys->connectItem( "Switch to desktop 8", this, SLOT( slotSwitchDesktop8() ));
keys->connectItem( "Switch to desktop 9", this, SLOT( slotSwitchDesktop9() ));
keys->connectItem( "Switch to desktop 10", this, SLOT( slotSwitchDesktop10() ));
keys->connectItem( "Switch to desktop 11", this, SLOT( slotSwitchDesktop11() ));
keys->connectItem( "Switch to desktop 12", this, SLOT( slotSwitchDesktop12() ));
keys->connectItem( "Switch to desktop 13", this, SLOT( slotSwitchDesktop13() ));
keys->connectItem( "Switch to desktop 14", this, SLOT( slotSwitchDesktop14() ));
keys->connectItem( "Switch to desktop 15", this, SLOT( slotSwitchDesktop15() ));
keys->connectItem( "Switch to desktop 16", this, SLOT( slotSwitchDesktop16() ));
keys->connectItem( "Switch to desktop 1", this, SLOT( slotSwitchToDesktop( int ) ));
keys->connectItem( "Switch to desktop 2", this, SLOT( slotSwitchToDesktop( int ) ));
keys->connectItem( "Switch to desktop 3", this, SLOT( slotSwitchToDesktop( int ) ));
keys->connectItem( "Switch to desktop 4", this, SLOT( slotSwitchToDesktop( int ) ));
keys->connectItem( "Switch to desktop 5", this, SLOT( slotSwitchToDesktop( int ) ));
keys->connectItem( "Switch to desktop 6", this, SLOT( slotSwitchToDesktop( int ) ));
keys->connectItem( "Switch to desktop 7", this, SLOT( slotSwitchToDesktop( int ) ));
keys->connectItem( "Switch to desktop 8", this, SLOT( slotSwitchToDesktop( int ) ));
keys->connectItem( "Switch to desktop 9", this, SLOT( slotSwitchToDesktop( int ) ));
keys->connectItem( "Switch to desktop 10", this, SLOT( slotSwitchToDesktop( int ) ));
keys->connectItem( "Switch to desktop 11", this, SLOT( slotSwitchToDesktop( int ) ));
keys->connectItem( "Switch to desktop 12", this, SLOT( slotSwitchToDesktop( int ) ));
keys->connectItem( "Switch to desktop 13", this, SLOT( slotSwitchToDesktop( int ) ));
keys->connectItem( "Switch to desktop 14", this, SLOT( slotSwitchToDesktop( int ) ));
keys->connectItem( "Switch to desktop 15", this, SLOT( slotSwitchToDesktop( int ) ));
keys->connectItem( "Switch to desktop 16", this, SLOT( slotSwitchToDesktop( int ) ));
keys->connectItem( "Switch desktop previous", this, SLOT( slotSwitchDesktopPrevious() ));
keys->connectItem( "Switch desktop next", this, SLOT( slotSwitchDesktopNext() ));
keys->connectItem( "Switch desktop left", this, SLOT( slotSwitchDesktopLeft() ));
@ -2417,8 +2516,36 @@ void Workspace::createKeybindings(){
keys->connectItem( "Switch desktop up", this, SLOT( slotSwitchDesktopUp() ));
keys->connectItem( "Switch desktop down", this, SLOT( slotSwitchDesktopDown() ));
/*keys->connectItem( "Switch to Window 1", this, SLOT( slotSwitchToWindow( int ) ));
keys->connectItem( "Switch to Window 2", this, SLOT( slotSwitchToWindow( int ) ));
keys->connectItem( "Switch to Window 3", this, SLOT( slotSwitchToWindow( int ) ));
keys->connectItem( "Switch to Window 4", this, SLOT( slotSwitchToWindow( int ) ));
keys->connectItem( "Switch to Window 5", this, SLOT( slotSwitchToWindow( int ) ));
keys->connectItem( "Switch to Window 6", this, SLOT( slotSwitchToWindow( int ) ));
keys->connectItem( "Switch to Window 7", this, SLOT( slotSwitchToWindow( int ) ));
keys->connectItem( "Switch to Window 8", this, SLOT( slotSwitchToWindow( int ) ));
keys->connectItem( "Switch to Window 9", this, SLOT( slotSwitchToWindow( int ) ));*/
keys->connectItem( "Window to Desktop 1", this, SLOT( slotWindowToDesktop( int ) ));
keys->connectItem( "Window to Desktop 2", this, SLOT( slotWindowToDesktop( int ) ));
keys->connectItem( "Window to Desktop 3", this, SLOT( slotWindowToDesktop( int ) ));
keys->connectItem( "Window to Desktop 4", this, SLOT( slotWindowToDesktop( int ) ));
keys->connectItem( "Window to Desktop 5", this, SLOT( slotWindowToDesktop( int ) ));
keys->connectItem( "Window to Desktop 6", this, SLOT( slotWindowToDesktop( int ) ));
keys->connectItem( "Window to Desktop 7", this, SLOT( slotWindowToDesktop( int ) ));
keys->connectItem( "Window to Desktop 8", this, SLOT( slotWindowToDesktop( int ) ));
keys->connectItem( "Window to Desktop 9", this, SLOT( slotWindowToDesktop( int ) ));
keys->connectItem( "Window to Desktop 10", this, SLOT( slotWindowToDesktop( int ) ));
keys->connectItem( "Window to Desktop 11", this, SLOT( slotWindowToDesktop( int ) ));
keys->connectItem( "Window to Desktop 12", this, SLOT( slotWindowToDesktop( int ) ));
keys->connectItem( "Window to Desktop 13", this, SLOT( slotWindowToDesktop( int ) ));
keys->connectItem( "Window to Desktop 14", this, SLOT( slotWindowToDesktop( int ) ));
keys->connectItem( "Window to Desktop 15", this, SLOT( slotWindowToDesktop( int ) ));
keys->connectItem( "Window to Desktop 16", this, SLOT( slotWindowToDesktop( int ) ));
keys->connectItem( "Pop-up window operations menu", this, SLOT( slotWindowOperations() ) );
keys->connectItem( "Window close", this, SLOT( slotWindowClose() ) );
keys->connectItem( "Window close all", this, SLOT( slotWindowCloseAll() ) );
keys->connectItem( "Window maximize", this, SLOT( slotWindowMaximize() ) );
keys->connectItem( "Window maximize horizontal", this, SLOT( slotWindowMaximizeHorizontal() ) );
keys->connectItem( "Window maximize vertical", this, SLOT( slotWindowMaximizeVertical() ) );
@ -2539,6 +2666,31 @@ void Workspace::slotSwitchDesktopDown(){
setCurrentDesktop(d);
}
void Workspace::slotSwitchToDesktop( int i )
{
setCurrentDesktop( i );
}
/*void Workspace::slotSwitchToWindow( int i )
{
int n = 0;
for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it) {
if( (*it)->isOnDesktop( currentDesktop() ) ) {
if( n == i ) {
activateClient( (*it) );
break;
}
n++;
}
}
}*/
void Workspace::slotWindowToDesktop( int i )
{
if( i >= 1 && i <= numberOfDesktops() && popup_client )
sendClientToDesktop( popup_client, i );
}
/*!
Maximizes the popup client
*/
@ -2825,6 +2977,13 @@ void Workspace::slotWindowClose()
performWindowOperation( popup_client, Options::CloseOp );
}
void Workspace::slotWindowCloseAll()
{
for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it) {
if( (*it)->isOnDesktop( currentDesktop() ) )
performWindowOperation( *it, Options::CloseOp );
}
}
/*!
Starts keyboard move mode for the popup client
@ -3688,10 +3847,12 @@ void Workspace::loadDesktopSettings()
int n = c.readNumEntry("Number", 4);
number_of_desktops = n;
rootInfo->setNumberOfDesktops( number_of_desktops );
desktop_focus_chain.resize( n );
for(int i = 1; i <= n; i++) {
QString s = c.readEntry(QString("Name_%1").arg(i),
i18n("Desktop %1").arg(i));
rootInfo->setDesktopName( i, s.utf8().data() );
desktop_focus_chain[i-1] = i;
}
}

View file

@ -160,6 +160,8 @@ public:
* Returns the current virtual desktop of this workspace
*/
int currentDesktop() const;
int nextDesktop( int iDesktop ) const;
int previousDesktop( int iDesktop ) const;
/**
* Returns the number of virtual desktops of this workspace
@ -244,6 +246,11 @@ public slots:
void slotSwitchDesktopUp();
void slotSwitchDesktopDown();
void slotSwitchToDesktop( int );
//void slotSwitchToWindow( int );
void slotWindowToDesktop( int );
//void slotWindowToListPosition( int );
void slotWindowMaximize();
void slotWindowMaximizeVertical();
void slotWindowMaximizeHorizontal();
@ -256,11 +263,14 @@ public slots:
void slotWalkThroughDesktops();
void slotWalkBackThroughDesktops();
void slotWalkThroughDesktopList();
void slotWalkBackThroughDesktopList();
void slotWalkThroughWindows();
void slotWalkBackThroughWindows();
void slotWindowOperations();
void slotWindowClose();
void slotWindowCloseAll();
void slotWindowMove();
void slotWindowResize();
@ -297,12 +307,16 @@ private:
void freeKeyboard(bool pass);
bool startKDEWalkThroughWindows();
bool startWalkThroughDesktops( int mode ); // TabBox::Mode::DesktopMode | DesktopListMode
bool startWalkThroughDesktops();
bool startWalkThroughDesktopList();
void KDEWalkThroughWindows( bool forward );
void CDEWalkThroughWindows( bool forward );
void walkThroughDesktops( bool forward );
void KDEOneStepThroughWindows( bool forward );
void oneStepThroughDesktops( bool forward, int mode ); // TabBox::Mode::DesktopMode | DesktopListMode
void oneStepThroughDesktops( bool forward );
void oneStepThroughDesktopList( bool forward );
ClientList constrainedStackingOrder( const ClientList& list );
@ -347,6 +361,7 @@ private:
int current_desktop;
int number_of_desktops;
QArray<int> desktop_focus_chain;
QGuardedPtr<Client> popup_client;
@ -374,6 +389,7 @@ private:
bool control_grab;
bool tab_grab;
unsigned int walkThroughDesktopsKeycode,walkBackThroughDesktopsKeycode;
unsigned int walkThroughDesktopListKeycode,walkBackThroughDesktopListKeycode;
unsigned int walkThroughWindowsKeycode,walkBackThroughWindowsKeycode;
bool mouse_emulation;
unsigned int mouse_emulation_state;