diff options
Diffstat (limited to 'lumina-desktop/panel-plugins/taskmanager')
3 files changed, 45 insertions, 15 deletions
diff --git a/lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp b/lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp index 3b88b537..79981754 100644 --- a/lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp +++ b/lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp @@ -7,6 +7,10 @@ #include "LTaskButton.h" #include "LSession.h" +#ifndef DEBUG +#define DEBUG 0 +#endif + LTaskButton::LTaskButton(QWidget *parent, bool smallDisplay) : LTBWidget(parent){ actMenu = new QMenu(this); winMenu = new QMenu(this); @@ -119,11 +123,14 @@ void LTaskButton::UpdateButton(){ else{ this->setText("("+QString::number(WINLIST.length())+")"); } } this->setState(showstate); //Make sure this is after the button setup so that it properly sets the margins/etc + cstate = showstate; //save this for later } void LTaskButton::UpdateMenus(){ //Action menu is very simple right now - can expand it later actMenu->clear(); + actMenu->addAction( LXDG::findIcon("view-close",""), tr("Minimize Window"), this, SLOT(minimizeWindow()) ); + actMenu->addAction( LXDG::findIcon("view-fullscreen",""), tr("Maximize Window"), this, SLOT(maximizeWindow()) ); actMenu->addAction( LXDG::findIcon("window-close",""), tr("Close Window"), this, SLOT(closeWindow()) ); } @@ -139,27 +146,47 @@ void LTaskButton::buttonClicked(){ } void LTaskButton::closeWindow(){ + if(DEBUG){ qDebug() << "Close Window:" << this->text(); } if(winMenu->isVisible()){ winMenu->hide(); } LWinInfo win = currentWindow(); LSession::handle()->XCB->CloseWindow(win.windowID()); - //LX11::CloseWindow(win.windowID()); cWin = LWinInfo(); //clear the current } +void LTaskButton::maximizeWindow(){ + if(DEBUG){ qDebug() << "Maximize Window:" << this->text(); } + if(winMenu->isVisible()){ winMenu->hide(); } + LWinInfo win = currentWindow(); + LSession::handle()->XCB->MaximizeWindow(win.windowID()); + cWin = LWinInfo(); //clear the current +} + +void LTaskButton::minimizeWindow(){ + if(DEBUG){ qDebug() << "Minimize Window:" << this->text(); } + if(winMenu->isVisible()){ winMenu->hide(); } + LWinInfo win = currentWindow(); + LSession::handle()->XCB->MinimizeWindow(win.windowID()); + cWin = LWinInfo(); //clear the current +} + void LTaskButton::triggerWindow(){ LWinInfo win = currentWindow(); //Check which state the window is currently in and flip it to the other - LX11::WINDOWSTATE state = LX11::GetWindowState(win.windowID()); - if(state == LX11::ACTIVE){ - qDebug() << "Minimize Window:" << this->text(); - LX11::IconifyWindow(win.windowID()); - }else if(state == LX11::VISIBLE){ - qDebug() << "Activate Window:" << this->text(); - LX11::ActivateWindow(win.windowID()); + LXCB::WINDOWSTATE state = cstate; + //if(WINLIST[0].windowID() != win.windowID()){ state = LSession::handle()->XCB->WindowState(win.windowID()); } //need to fetch the state of the window + state = LSession::handle()->XCB->WindowState(win.windowID()); + if(DEBUG){ qDebug() << "Window State: " << state; } + if(state == LXCB::ACTIVE){ + if(DEBUG){ qDebug() << "Minimize Window:" << this->text(); } + LSession::handle()->XCB->MinimizeWindow(win.windowID()); }else{ + if(DEBUG){ qDebug() << "Activate Window:" << this->text(); } + LSession::handle()->XCB->ActivateWindow(win.windowID()); + }/*else{ qDebug() << "Restore Window:" << this->text(); + LSession::handle()->XCB->MinimizeWindow(win.windowID()); LX11::RestoreWindow(win.windowID()); - } + }*/ cWin = LWinInfo(); //clear the current } @@ -177,6 +204,7 @@ void LTaskButton::openActionMenu(){ QAction *act = winMenu->actionAt(QCursor::pos()); if( act != 0 && winMenu->isVisible() ){ //Get the window from the action + qDebug() << "Found Action:" << act->data().toInt(); if(act->data().toInt() < WINLIST.length()){ cWin = WINLIST[act->data().toInt()]; }else{ cWin = LWinInfo(); } //clear it diff --git a/lumina-desktop/panel-plugins/taskmanager/LTaskButton.h b/lumina-desktop/panel-plugins/taskmanager/LTaskButton.h index 1fd81e0b..3202d676 100644 --- a/lumina-desktop/panel-plugins/taskmanager/LTaskButton.h +++ b/lumina-desktop/panel-plugins/taskmanager/LTaskButton.h @@ -48,7 +48,7 @@ private: bool noicon, showText; LWinInfo currentWindow(); //For getting the currently-active window - + LXCB::WINDOWSTATE cstate; //current state of the button public slots: void UpdateButton(); //re-sync the current window infomation void UpdateMenus(); //re-create the menus (text + icons) @@ -56,6 +56,8 @@ public slots: private slots: void buttonClicked(); void closeWindow(); //send the signal to close a window + void maximizeWindow(); //send the signal to maximize/restore a window + void minimizeWindow(); //send the signal to minimize a window (iconify) void triggerWindow(); //change b/w visible and invisible void winClicked(QAction*); void openActionMenu(); diff --git a/lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.cpp b/lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.cpp index b551a795..ccad7531 100644 --- a/lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.cpp +++ b/lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.cpp @@ -51,14 +51,14 @@ void LTaskManagerPlugin::UpdateButtons(){ //Window was closed - remove it if(WI.length()==1){ //Remove the entire button - qDebug() << "Window Closed: Remove Button" ; + //qDebug() << "Window Closed: Remove Button" ; this->layout()->takeAt(i); //remove from the layout delete BUTTONS.takeAt(i); i--; updated = true; //prevent updating a removed button break; //break out of the button->window loop }else{ - qDebug() << "Window Closed: Remove from button:" << WI[w].windowID() << "Button:" << w; + //qDebug() << "Window Closed: Remove from button:" << WI[w].windowID() << "Button:" << w; BUTTONS[i]->rmWindow(WI[w]); // one of the multiple windows for the button WI.removeAt(w); //remove this window from the list w--; @@ -68,7 +68,7 @@ void LTaskManagerPlugin::UpdateButtons(){ if(updating > ctime){ return; } //another thread kicked off already - stop this one } if(!updated){ - qDebug() << "Update Button:" << i; + //qDebug() << "Update Button:" << i; if(updating > ctime){ return; } //another thread kicked off already - stop this one QTimer::singleShot(1,BUTTONS[i], SLOT(UpdateButton()) ); //keep moving on } @@ -85,7 +85,7 @@ void LTaskManagerPlugin::UpdateButtons(){ if(BUTTONS[b]->classname()== ctxt && usegroups){ //This adds a window to an existing group found = true; - qDebug() << "Add Window to Button:" << b; + //qDebug() << "Add Window to Button:" << b; BUTTONS[b]->addWindow(winlist[i]); break; } @@ -93,7 +93,7 @@ void LTaskManagerPlugin::UpdateButtons(){ if(!found){ if(updating > ctime){ return; } //another thread kicked off already - stop this one //No group, create a new button - qDebug() << "New Button"; + //qDebug() << "New Button"; LTaskButton *but = new LTaskButton(this, usegroups); but->addWindow( LWinInfo(winlist[i]) ); if(this->layout()->direction()==QBoxLayout::LeftToRight){ |