summaryrefslogtreecommitdiffstats
path: root/kicker/taskmanager/taskrmbmenu.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2024-08-02 13:45:09 +0900
committerMichele Calgaro <[email protected]>2024-08-02 15:27:22 +0900
commit4cd5817775a7e3618081bfed788f361307cfef41 (patch)
treebeeed52fdaca7c3e372048a42b6e2ce9ace840b0 /kicker/taskmanager/taskrmbmenu.cpp
parent8afb12b32bbc7ef5de9a3821b6f2dae7c658e7db (diff)
downloadtdebase-4cd5817775a7e3618081bfed788f361307cfef41.tar.gz
tdebase-4cd5817775a7e3618081bfed788f361307cfef41.zip
Add support for window tiling to the taskbar and window's popup menus. This relates to TDE/tdebase#349.
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'kicker/taskmanager/taskrmbmenu.cpp')
-rw-r--r--kicker/taskmanager/taskrmbmenu.cpp43
1 files changed, 42 insertions, 1 deletions
diff --git a/kicker/taskmanager/taskrmbmenu.cpp b/kicker/taskmanager/taskrmbmenu.cpp
index 943160d26..85522357d 100644
--- a/kicker/taskmanager/taskrmbmenu.cpp
+++ b/kicker/taskmanager/taskrmbmenu.cpp
@@ -68,9 +68,14 @@ void TaskRMBMenu::fillMenu(Task::Ptr t)
int id;
setCheckable(true);
- insertItem(i18n("Ad&vanced"), makeAdvancedMenu(t));
bool checkActions = KWin::allowedActionsSupported();
+ insertItem(i18n("Ad&vanced"), makeAdvancedMenu(t));
+
+ id = insertItem(i18n("T&ile"), makeTileMenu(t));
+ setItemEnabled(id, !checkActions ||
+ (t->info().actionSupported(NET::ActionMove) && t->info().actionSupported(NET::ActionResize)));
+
if (TaskManager::the()->numberOfDesktops() > 1)
{
id = insertItem(i18n("To &Desktop"), makeDesktopsMenu(t));
@@ -280,6 +285,33 @@ TQPopupMenu* TaskRMBMenu::makeDesktopsMenu()
return m;
}
+TQPopupMenu* TaskRMBMenu::makeTileMenu(Task::Ptr t)
+{
+ TQPopupMenu *m = new TQPopupMenu( this );
+
+ // Tile to side (the menu id matched the ActiveBorder index used for tiling)
+ int id = m->insertItem( i18n("&Left"), this, TQ_SLOT( slotTileTo(int) ) );
+ m->setItemParameter( id, 6 );
+ id = m->insertItem( i18n("&Right"), this, TQ_SLOT( slotTileTo(int) ) );
+ m->setItemParameter( id, 2 );
+ id = m->insertItem( i18n("&Top"), this, TQ_SLOT( slotTileTo(int) ) );
+ m->setItemParameter( id, 0 );
+ id = m->insertItem( i18n("&Bottom"), this, TQ_SLOT( slotTileTo(int) ) );
+ m->setItemParameter( id, 4 );
+
+ // Tile to corner (the menu id matched the ActiveBorder index used for tiling)
+ id = m->insertItem( i18n("Top &Left"), this, TQ_SLOT( slotTileTo(int) ) );
+ m->setItemParameter( id, 7 );
+ id = m->insertItem( i18n("Top &Right"), this, TQ_SLOT( slotTileTo(int) ) );
+ m->setItemParameter( id, 1 );
+ id = m->insertItem( i18n("Bottom L&eft"), this, TQ_SLOT( slotTileTo(int) ) );
+ m->setItemParameter( id, 5 );
+ id = m->insertItem( i18n("&Bottom R&ight"), this, TQ_SLOT( slotTileTo(int) ) );
+ m->setItemParameter( id, 3 );
+
+ return m;
+}
+
void TaskRMBMenu::slotMinimizeAll()
{
Task::List::iterator itEnd = tasks.end();
@@ -342,3 +374,12 @@ void TaskRMBMenu::slotAllToCurrentDesktop()
(*it)->toCurrentDesktop();
}
}
+
+void TaskRMBMenu::slotTileTo(int position)
+{
+ Task::List::iterator itEnd = tasks.end();
+ for (Task::List::iterator it = tasks.begin(); it != itEnd; ++it)
+ {
+ (*it)->tileTo(position);
+ }
+}