-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Begin windowlist rebuild and start using KWindowSystem
- Loading branch information
Nicholas Yoder
committed
Dec 28, 2022
1 parent
b45acc5
commit 4bef603
Showing
11 changed files
with
306 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#include "windowbutton.h" | ||
|
||
#include "xcbutills/xcbutills.h" | ||
|
||
windowbutton::windowbutton(ulong windowid, int desktop, QIcon icon, QString text) : window_id(windowid), window_desktop(desktop){ | ||
setupIconAndTextButton(text, icon, 16); | ||
|
||
pmenu = new popupmenu(this, CenteredOnWidget); | ||
|
||
pmenuitem *item = new pmenuitem("Raise", QIcon::fromTheme("arrow-up")); | ||
connect(item, &pmenuitem::clicked, this, &windowbutton::raise_w); | ||
pmenu->additem(item); | ||
pmenuitem *item2 = new pmenuitem("Maximize", QIcon::fromTheme("arrow-up-double")); | ||
connect(item2, &pmenuitem::clicked, this, &windowbutton::maximize_w); | ||
pmenu->additem(item2); | ||
pmenuitem *item3 = new pmenuitem("Demaximize", QIcon::fromTheme("arrow-down")); | ||
connect(item3, &pmenuitem::clicked, this, &windowbutton::demaximize_w); | ||
pmenu->additem(item3); | ||
pmenuitem *item4 = new pmenuitem("Minimize", QIcon::fromTheme("arrow-down-double")); | ||
connect(item4, &pmenuitem::clicked, this, &windowbutton::minimize_w); | ||
pmenu->additem(item4); | ||
pmenuitem *item5 = new pmenuitem("Close", QIcon::fromTheme("application-exit")); | ||
connect(item5, &pmenuitem::clicked, this, &windowbutton::close_w); | ||
pmenu->additem(item5); | ||
} | ||
|
||
void windowbutton::mouseReleaseEvent(QMouseEvent *event){ | ||
panelbutton::mouseReleaseEvent(event); | ||
|
||
if (event->button() == Qt::LeftButton){ | ||
raise_w(); | ||
} | ||
else if(event->button() == Qt::RightButton){ | ||
QSize sizeHint = pmenu->popupw->sizeHint(); | ||
if (width() > sizeHint.width()) | ||
pmenu->popupw->setFixedSize(width(), sizeHint.height()); | ||
else | ||
pmenu->popupw->setFixedSize(sizeHint.width(), sizeHint.height()); | ||
|
||
pmenu->show(); | ||
} | ||
} | ||
|
||
void windowbutton::raise_w(){ | ||
Xcbutills::raiseWindow(window_id); | ||
} | ||
|
||
void windowbutton::maximize_w(){ | ||
Xcbutills::maximizeWindow(window_id); | ||
} | ||
|
||
void windowbutton::minimize_w(){ | ||
Xcbutills::minimizeWindow(window_id); | ||
} | ||
|
||
void windowbutton::close_w(){ | ||
Xcbutills::closeWindow(window_id); | ||
} | ||
|
||
void windowbutton::demaximize_w(){ | ||
Xcbutills::demaximizeWindow(window_id); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#ifndef WINDOWBUTTON_H | ||
#define WINDOWBUTTON_H | ||
|
||
#include "panelbutton.h" | ||
|
||
#include "popupmenu.h" | ||
|
||
class windowbutton : public panelbutton | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit windowbutton(ulong window, int desktop, QIcon icon, QString text); | ||
|
||
ulong windowId(){return window_id;} | ||
void setWindowDesktop(int desktop){window_desktop = desktop;} | ||
int windowDesktop(){return window_desktop;} | ||
|
||
signals: | ||
|
||
private slots: | ||
void raise_w(); | ||
void maximize_w(); | ||
void minimize_w(); | ||
void close_w(); | ||
void demaximize_w(); | ||
|
||
protected: | ||
void mouseReleaseEvent(QMouseEvent *event); | ||
|
||
private: | ||
ulong window_id; | ||
int window_desktop; | ||
|
||
popupmenu *pmenu = nullptr; | ||
}; | ||
|
||
#endif // WINDOWBUTTON_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.