diff --git a/client.cpp b/client.cpp index 4b8f1f3b52..648706ad52 100644 --- a/client.cpp +++ b/client.cpp @@ -26,6 +26,7 @@ Copyright (C) 1999, 2000 Matthias Ettrich #include "client.h" #include "events.h" #include "atoms.h" +#include // Needed in x11Event() below #include #include #include @@ -403,17 +404,19 @@ bool WindowWrapper::x11Event( XEvent * e) switch ( e->type ) { case ButtonPress: { - bool mod1 = (e->xbutton.state & Mod1Mask) == Mod1Mask; + uint keyModX = (options->keyCmdAllModKey() == Qt::Key_Meta) ? + KAccel::keyModXMeta() : KAccel::keyModXAlt(); + bool bModKeyHeld = e->xbutton.state & keyModX; if ( ((Client*)parentWidget())->isActive() && ( options->focusPolicy != Options::ClickToFocus - && options->clickRaise && !mod1 ) ) { + && options->clickRaise && !bModKeyHeld ) ) { ((Client*)parentWidget())->autoRaise(); ungrabButton( winId(), None ); } Options::MouseCommand com = Options::MouseNothing; - if ( mod1){ + if ( bModKeyHeld ){ switch (e->xbutton.button) { case Button1: com = options->commandAll1(); diff --git a/kwinbindings.cpp b/kwinbindings.cpp index 76f11dc5df..5d22ddfe65 100644 --- a/kwinbindings.cpp +++ b/kwinbindings.cpp @@ -1,47 +1,48 @@ - keys->insertItem(i18n("Switch to desktop 1"), "Switch to desktop 1" ,"CTRL+F1"); - keys->insertItem(i18n("Switch to desktop 2"), "Switch to desktop 2" ,"CTRL+F2"); - keys->insertItem(i18n("Switch to desktop 3"), "Switch to desktop 3" ,"CTRL+F3"); - keys->insertItem(i18n("Switch to desktop 4"), "Switch to desktop 4" ,"CTRL+F4"); - keys->insertItem(i18n("Switch to desktop 5"), "Switch to desktop 5" ,"CTRL+F5"); - keys->insertItem(i18n("Switch to desktop 6"), "Switch to desktop 6" ,"CTRL+F6"); - keys->insertItem(i18n("Switch to desktop 7"), "Switch to desktop 7" ,"CTRL+F7"); - keys->insertItem(i18n("Switch to desktop 8"), "Switch to desktop 8" ,"CTRL+F8"); - keys->insertItem(i18n("Switch to desktop 9"), "Switch to desktop 9" ,"CTRL+F9"); - keys->insertItem(i18n("Switch to desktop 10"), "Switch to desktop 10" ,"CTRL+F10"); - keys->insertItem(i18n("Switch to desktop 11"), "Switch to desktop 11" ,"CTRL+F11"); - keys->insertItem(i18n("Switch to desktop 12"), "Switch to desktop 12" ,"CTRL+F12"); - keys->insertItem(i18n("Switch to desktop 13"), "Switch to desktop 13" ,"CTRL+SHIFT+F1"); - keys->insertItem(i18n("Switch to desktop 14"), "Switch to desktop 14" ,"CTRL+SHIFT+F2"); - keys->insertItem(i18n("Switch to desktop 15"), "Switch to desktop 15" ,"CTRL+SHIFT+F3"); - keys->insertItem(i18n("Switch to desktop 16"), "Switch to desktop 16" ,"CTRL+SHIFT+F4"); - keys->insertItem(i18n("Switch to next desktop"), "Switch desktop next" ,""); - keys->insertItem(i18n("Switch to previous desktop"), "Switch desktop previous" ,""); - keys->insertItem(i18n("Switch one desktop to the right"), "Switch desktop right" ,""); - keys->insertItem(i18n("Switch one desktop to the left"), "Switch desktop left" ,""); - keys->insertItem(i18n("Switch one desktop up"), "Switch desktop up" ,""); - keys->insertItem(i18n("Switch one desktop down"), "Switch desktop down" ,""); + 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()); - keys->insertItem(i18n("Window operations menu"), "Pop-up window operations menu" ,"ALT+F3"); - keys->insertItem(i18n("Window close"),"Window close", "ALT+F4"); - keys->insertItem(i18n("Window maximize"),"Window maximize", "Meta+Plus"); - keys->insertItem(i18n("Window maximize vertical"),"Window maximize vertical", "Meta+Bar"); - keys->insertItem(i18n("Window maximize horizontal"),"Window maximize horizontal", "Meta+Equal"); - keys->insertItem(i18n("Window iconify"),"Window iconify", "Meta+Minus"); - keys->insertItem(i18n("Window shade"),"Window shade", "Meta+Underscore"); - keys->insertItem(i18n("Window move"),"Window move", ""); - keys->insertItem(i18n("Window resize"),"Window resize", ""); - keys->insertItem(i18n("Window raise"),"Window raise", ""); - keys->insertItem(i18n("Window lower"),"Window lower", ""); - keys->insertItem(i18n("Window raise or lower"), "Toggle raise and lower", ""); - keys->insertItem(i18n("Window to next desktop"),"Window to next desktop", ""); - keys->insertItem(i18n("Window to previous desktop"),"Window to previous desktop", ""); + 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); - keys->insertItem(i18n("Walk through desktops"),"Walk through desktops", "CTRL+Tab"); - keys->insertItem(i18n("Walk back through desktops"),"Walk back through desktops", "SHIFT+CTRL+Tab"); - keys->insertItem(i18n("Walk through windows"),"Walk through windows", "ALT+Tab"); - keys->insertItem(i18n("Walk back through windows"),"Walk back through windows", "SHIFT+ALT+Tab"); + 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")); - keys->insertItem(i18n("Mouse emulation"),"Mouse emulation", "ALT+F12"); + keys->insertItem(i18n("Mouse emulation"), "Mouse emulation", KKey("ALT+F12"), KKey("Meta+F12")); + + keys->insertItem(i18n("Kill Window"), "Kill Window", KKey("CTRL+ALT+Escape"), KKey("Meta+Ctrl+Delete")); - keys->insertItem(i18n("Kill Window"),"Kill Window", "CTRL+ALT+Escape"); - diff --git a/options.cpp b/options.cpp index 065f388885..646458ea95 100644 --- a/options.cpp +++ b/options.cpp @@ -10,6 +10,7 @@ Copyright (C) 1999, 2000 Matthias Ettrich #include #include #include +#include // for KAccel::keyboardHasMetaKey() using namespace KWinInternal; @@ -239,6 +240,7 @@ void Options::reload() CmdWindow1 = mouseCommand(config->readEntry("CommandWindow1","Activate, raise and pass click")); CmdWindow2 = mouseCommand(config->readEntry("CommandWindow2","Activate and pass click")); CmdWindow3 = mouseCommand(config->readEntry("CommandWindow3","Activate and pass click")); + CmdAllModKey = (config->readEntry("CommandAllKey", KAccel::keyboardHasMetaKey() ? "Meta" : "Alt") == "Meta") ? Qt::Key_Meta : Qt::Key_Alt; CmdAll1 = mouseCommand(config->readEntry("CommandAll1","Move")); CmdAll2 = mouseCommand(config->readEntry("CommandAll2","Toggle raise and lower")); CmdAll3 = mouseCommand(config->readEntry("CommandAll3","Resize")); @@ -254,7 +256,7 @@ void Options::reload() d->title_buttons_left = "MS"; d->title_buttons_right = "HIAX"; } - + emit resetPlugin(); emit resetClients(); } @@ -308,16 +310,16 @@ QString Options::titleButtonsLeft() { return d->title_buttons_left; } - + QString Options::titleButtonsRight() { return d->title_buttons_right; } - + bool Options::customButtonPositions() { return d->custom_button_positions; } - + #include "options.moc" diff --git a/options.h b/options.h index b8c1f71a84..4231c47002 100644 --- a/options.h +++ b/options.h @@ -231,7 +231,7 @@ public: MouseRaise, MouseLower, MouseOperationsMenu, MouseToggleRaiseAndLower, MouseActivateAndRaise, MouseActivateAndLower, MouseActivate, MouseActivateRaiseAndPassClick, MouseActivateAndPassClick, - MouseMove, MouseResize, + MouseMove, MouseResize, MouseShade, MouseNothing }; @@ -248,6 +248,7 @@ public: MouseCommand commandAll1() { return CmdAll1; } MouseCommand commandAll2() { return CmdAll2; } MouseCommand commandAll3() { return CmdAll3; } + uint keyCmdAllModKey() { return CmdAllModKey; } static WindowOperation windowOperation(const QString &name ); @@ -316,7 +317,8 @@ private: MouseCommand CmdAll1; MouseCommand CmdAll2; MouseCommand CmdAll3; - + uint CmdAllModKey; + OptionsPrivate* d; }; diff --git a/workspace.cpp b/workspace.cpp index 4b98e34651..ad5d80ac49 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -2413,6 +2413,7 @@ void Workspace::createKeybindings(){ keys->connectItem( "Window maximize horizontal", this, SLOT( slotWindowMaximizeHorizontal() ) ); keys->connectItem( "Window maximize vertical", this, SLOT( slotWindowMaximizeVertical() ) ); keys->connectItem( "Window iconify", this, SLOT( slotWindowIconify() ) ); + keys->connectItem( "Window iconify all", this, SLOT( slotWindowIconifyAll() ) ); keys->connectItem( "Window shade", this, SLOT( slotWindowShade() ) ); keys->connectItem( "Window move", this, SLOT( slotWindowMove() ) ); keys->connectItem( "Window resize", this, SLOT( slotWindowResize() ) ); @@ -2564,6 +2565,16 @@ void Workspace::slotWindowIconify() performWindowOperation( popup_client, Options::IconifyOp ); } +void Workspace::slotWindowIconifyAll() +{ + int iDesktop = currentDesktop(); + + for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it) { + if( (*it)->isOnDesktop( iDesktop ) && !(*it)->isIconified() ) + performWindowOperation( *it, Options::IconifyOp ); + } +} + /*! Shades/unshades the popup client respectively */ diff --git a/workspace.h b/workspace.h index 2f00a77b85..852fc8a538 100644 --- a/workspace.h +++ b/workspace.h @@ -246,6 +246,7 @@ public slots: void slotWindowMaximizeVertical(); void slotWindowMaximizeHorizontal(); void slotWindowIconify(); + void slotWindowIconifyAll(); void slotWindowShade(); void slotWindowRaise(); void slotWindowLower();