diff options
Diffstat (limited to 'kicker')
-rw-r--r-- | kicker/taskmanager/taskmanager.cpp | 10 | ||||
-rw-r--r-- | kicker/taskmanager/taskmanager.h | 6 | ||||
-rw-r--r-- | kicker/taskmanager/taskrmbmenu.cpp | 37 | ||||
-rw-r--r-- | kicker/taskmanager/taskrmbmenu.h | 5 |
4 files changed, 55 insertions, 3 deletions
diff --git a/kicker/taskmanager/taskmanager.cpp b/kicker/taskmanager/taskmanager.cpp index 54bf6d919..43cd3c7e9 100644 --- a/kicker/taskmanager/taskmanager.cpp +++ b/kicker/taskmanager/taskmanager.cpp @@ -26,6 +26,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <tqimage.h> #include <tqtimer.h> +#include <tdeapplication.h> #include <tdeconfig.h> #include <kdebug.h> #include <tdeglobal.h> @@ -36,6 +37,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <twinmodule.h> #include <kxerrorhandler.h> #include <netwm.h> +#include "dcopclient.h" #include "taskmanager.h" #include "taskmanager.moc" @@ -1452,6 +1454,14 @@ void Task::updateWindowPixmap() #endif // THUMBNAILING_POSSIBLE } +void Task::tileTo(int position) +{ + TQByteArray params; + TQDataStream stream(params, IO_WriteOnly); + stream << _win << position; + TDEApplication::kApplication()->dcopClient()->send("twin", "KWinInterface", "tileWindowToBorder(unsigned long int, int)", params); +} + Startup::Startup(const TDEStartupInfoId& id, const TDEStartupInfoData& data, TQObject * parent, const char *name) : TQObject(parent, name), _id(id), _data(data) diff --git a/kicker/taskmanager/taskmanager.h b/kicker/taskmanager/taskmanager.h index 289c6af55..3f8e2f5e2 100644 --- a/kicker/taskmanager/taskmanager.h +++ b/kicker/taskmanager/taskmanager.h @@ -423,6 +423,12 @@ public slots: */ void updateThumbnail(); + /** + * Tile the task's window to the specified position. The position is one of the + * valid value for ActiveBorder enum + */ + void tileTo(int); + signals: /** * Indicates that this task has changed in some way. diff --git a/kicker/taskmanager/taskrmbmenu.cpp b/kicker/taskmanager/taskrmbmenu.cpp index 943160d26..c2c8a11bc 100644 --- a/kicker/taskmanager/taskrmbmenu.cpp +++ b/kicker/taskmanager/taskrmbmenu.cpp @@ -24,6 +24,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <assert.h> +#include <tdeglobal.h> #include <kiconloader.h> #include <tdelocale.h> @@ -44,6 +45,8 @@ TaskRMBMenu::TaskRMBMenu(const Task::List& theTasks, bool show, TQPopupMenu* mov , showAll( show ) , taskMoveMenu( moveMenu ) { + TDEGlobal::iconLoader()->addAppDir("twin"); + assert(tasks.count() > 0); if (tasks.count() == 1) { @@ -68,9 +71,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 +288,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( UserIconSet("tile_left"), i18n("&Left"), t, TQ_SLOT( tileTo(int) ) ); + m->setItemParameter( id, 6 ); + id = m->insertItem( UserIconSet("tile_right"), i18n("&Right"), t, TQ_SLOT( tileTo(int) ) ); + m->setItemParameter( id, 2 ); + id = m->insertItem( UserIconSet("tile_top"), i18n("&Top"), t, TQ_SLOT( tileTo(int) ) ); + m->setItemParameter( id, 0 ); + id = m->insertItem( UserIconSet("tile_bottom"), i18n("&Bottom"), t, TQ_SLOT( tileTo(int) ) ); + m->setItemParameter( id, 4 ); + + // Tile to corner (the menu id matched the ActiveBorder index used for tiling) + id = m->insertItem( UserIconSet("tile_topleft"), i18n("Top &Left"), t, TQ_SLOT( tileTo(int) ) ); + m->setItemParameter( id, 7 ); + id = m->insertItem( UserIconSet("tile_topright"), i18n("Top &Right"), t, TQ_SLOT( tileTo(int) ) ); + m->setItemParameter( id, 1 ); + id = m->insertItem( UserIconSet("tile_bottomleft"), i18n("Bottom L&eft"), t, TQ_SLOT( tileTo(int) ) ); + m->setItemParameter( id, 5 ); + id = m->insertItem( UserIconSet("tile_bottomright"), i18n("&Bottom R&ight"), t, TQ_SLOT( tileTo(int) ) ); + m->setItemParameter( id, 3 ); + + return m; +} + void TaskRMBMenu::slotMinimizeAll() { Task::List::iterator itEnd = tasks.end(); diff --git a/kicker/taskmanager/taskrmbmenu.h b/kicker/taskmanager/taskrmbmenu.h index b82d0338d..5dd66b98f 100644 --- a/kicker/taskmanager/taskrmbmenu.h +++ b/kicker/taskmanager/taskrmbmenu.h @@ -38,9 +38,10 @@ public: private: void fillMenu(Task::Ptr); void fillMenu(); - TQPopupMenu* makeAdvancedMenu(Task::Ptr); + TQPopupMenu* makeAdvancedMenu(Task::Ptr); TQPopupMenu* makeDesktopsMenu(Task::Ptr); TQPopupMenu* makeDesktopsMenu(); + TQPopupMenu* makeTileMenu(Task::Ptr); private slots: void slotMinimizeAll(); @@ -48,7 +49,7 @@ private slots: void slotRestoreAll(); void slotShadeAll(); void slotCloseAll(); - void slotAllToDesktop( int desktop ); + void slotAllToDesktop(int desktop); void slotAllToCurrentDesktop(); private: |