diff --git a/lib/kdecoration.h b/lib/kdecoration.h index 11868e0168..553ae09eec 100644 --- a/lib/kdecoration.h +++ b/lib/kdecoration.h @@ -110,6 +110,7 @@ public: CloseClientGroupOp, // Close the group MoveClientInGroupLeftOp, // Move left in the group MoveClientInGroupRightOp, // Move right in the group + ToggleClientTiledStateOp, // put a floating client into tiling ClientGroupDragOp }; /** diff --git a/useractions.cpp b/useractions.cpp index 8bc3eb3b48..c3950ce840 100644 --- a/useractions.cpp +++ b/useractions.cpp @@ -30,6 +30,8 @@ along with this program. If not, see . #include "client.h" #include "workspace.h" #include "effects.h" +#include "tile.h" +#include "tilinglayout.h" #include #include @@ -190,6 +192,22 @@ QMenu* Workspace::clientPopup() popup->addSeparator(); } + // create it anyway + mTilingStateOpAction = popup->addAction( i18nc("When in tiling mode, toggle's the window's floating/tiled state", "&Float Window") ); + // then hide it + mTilingStateOpAction->setVisible(false); + // actions for window tiling + if( tilingEnabled() ) + { + kaction = qobject_cast( keys->action("Toggle Floating") ); + mTilingStateOpAction->setCheckable( true ); + mTilingStateOpAction->setData( Options::ToggleClientTiledStateOp ); + if( kaction!=0 ) + mTilingStateOpAction->setShortcut( kaction->globalShortcut().primary() ); + } + + popup->addSeparator(); + action = popup->addMenu( advanced_popup ); action->setText( i18n("Ad&vanced") ); @@ -266,6 +284,18 @@ void Workspace::clientPopupAboutToShow() mMinimizeOpAction->setEnabled( active_popup_client->isMinimizable() ); mCloseOpAction->setEnabled( active_popup_client->isCloseable() ); + if( tilingEnabled() ) + { + int desktop = active_popup_client->desktop(); + if( tilingLayouts.value(desktop) ) + { + Tile *t = tilingLayouts[desktop]->findTile(active_popup_client); + if( t ) + mTilingStateOpAction->setChecked( t->floating() ); + } + } + mTilingStateOpAction->setVisible( tilingEnabled() ); + delete switch_to_tab_popup; switch_to_tab_popup = 0; delete add_tabs_popup; @@ -787,6 +817,14 @@ void Workspace::performWindowOperation( Client* c, Options::WindowOperation op ) } case Options::CloseClientGroupOp: c->clientGroup()->closeAll(); + case Options::ToggleClientTiledStateOp: + { + int desktop = c->desktop(); + if( tilingLayouts.value( desktop ) ) + { + tilingLayouts[desktop]->toggleFloatTile( c ); + } + } } } diff --git a/workspace.h b/workspace.h index 39d882e18e..ea0aabc137 100644 --- a/workspace.h +++ b/workspace.h @@ -924,6 +924,7 @@ class Workspace : public QObject, public KDecorationDefines QAction* mMoveOpAction; QAction* mMaximizeOpAction; QAction* mShadeOpAction; + QAction* mTilingStateOpAction; QAction* mKeepAboveOpAction; QAction* mKeepBelowOpAction; QAction* mFullScreenOpAction;