You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
3.0 KiB
79 lines
3.0 KiB
7 years ago
|
Description: Add Move and Resize items in the task-button context menu
|
||
|
Author: Tsu Jan <tsujan2000@gmail.com>
|
||
|
Origin: backport
|
||
|
Bug: https://github.com/lxde/lxqt/issues/1434
|
||
|
Applied-Upstream: commit:b69fe72
|
||
|
Last-Update: 2018-02-05
|
||
|
--- a/plugin-taskbar/lxqttaskbutton.cpp
|
||
|
+++ b/plugin-taskbar/lxqttaskbutton.cpp
|
||
|
@@ -464,6 +464,42 @@ void LXQtTaskButton::moveApplicationToDe
|
||
|
/************************************************
|
||
|
|
||
|
************************************************/
|
||
|
+void LXQtTaskButton::moveApplication()
|
||
|
+{
|
||
|
+ KWindowInfo info(mWindow, NET::WMDesktop);
|
||
|
+ if (!info.isOnCurrentDesktop())
|
||
|
+ KWindowSystem::setCurrentDesktop(info.desktop());
|
||
|
+ if (isMinimized())
|
||
|
+ KWindowSystem::unminimizeWindow(mWindow);
|
||
|
+ KWindowSystem::forceActiveWindow(mWindow);
|
||
|
+ const QRect& g = KWindowInfo(mWindow, NET::WMGeometry).geometry();
|
||
|
+ int X = g.center().x();
|
||
|
+ int Y = g.center().y();
|
||
|
+ QCursor::setPos(X, Y);
|
||
|
+ NETRootInfo(QX11Info::connection(), NET::WMMoveResize).moveResizeRequest(mWindow, X, Y, NET::Move);
|
||
|
+}
|
||
|
+
|
||
|
+/************************************************
|
||
|
+
|
||
|
+ ************************************************/
|
||
|
+void LXQtTaskButton::resizeApplication()
|
||
|
+{
|
||
|
+ KWindowInfo info(mWindow, NET::WMDesktop);
|
||
|
+ if (!info.isOnCurrentDesktop())
|
||
|
+ KWindowSystem::setCurrentDesktop(info.desktop());
|
||
|
+ if (isMinimized())
|
||
|
+ KWindowSystem::unminimizeWindow(mWindow);
|
||
|
+ KWindowSystem::forceActiveWindow(mWindow);
|
||
|
+ const QRect& g = KWindowInfo(mWindow, NET::WMGeometry).geometry();
|
||
|
+ int X = g.bottomRight().x();
|
||
|
+ int Y = g.bottomRight().y();
|
||
|
+ QCursor::setPos(X, Y);
|
||
|
+ NETRootInfo(QX11Info::connection(), NET::WMMoveResize).moveResizeRequest(mWindow, X, Y, NET::BottomRight);
|
||
|
+}
|
||
|
+
|
||
|
+/************************************************
|
||
|
+
|
||
|
+ ************************************************/
|
||
|
void LXQtTaskButton::contextMenuEvent(QContextMenuEvent* event)
|
||
|
{
|
||
|
if (event->modifiers().testFlag(Qt::ControlModifier))
|
||
|
@@ -532,6 +568,15 @@ void LXQtTaskButton::contextMenuEvent(QC
|
||
|
connect(a, SIGNAL(triggered(bool)), this, SLOT(moveApplicationToDesktop()));
|
||
|
}
|
||
|
|
||
|
+ /********** Move/Resize **********/
|
||
|
+ menu->addSeparator();
|
||
|
+ a = menu->addAction(tr("&Move"));
|
||
|
+ a->setEnabled(info.actionSupported(NET::ActionMove) && !(state & NET::Max) && !(state & NET::FullScreen));
|
||
|
+ connect(a, &QAction::triggered, this, &LXQtTaskButton::moveApplication);
|
||
|
+ a = menu->addAction(tr("Resi&ze"));
|
||
|
+ a->setEnabled(info.actionSupported(NET::ActionResize) && !(state & NET::Max) && !(state & NET::FullScreen));
|
||
|
+ connect(a, &QAction::triggered, this, &LXQtTaskButton::resizeApplication);
|
||
|
+
|
||
|
/********** State menu **********/
|
||
|
menu->addSeparator();
|
||
|
|
||
|
--- a/plugin-taskbar/lxqttaskbutton.h
|
||
|
+++ b/plugin-taskbar/lxqttaskbutton.h
|
||
|
@@ -95,6 +95,8 @@ public slots:
|
||
|
void unShadeApplication();
|
||
|
void closeApplication();
|
||
|
void moveApplicationToDesktop();
|
||
|
+ void moveApplication();
|
||
|
+ void resizeApplication();
|
||
|
void setApplicationLayer();
|
||
|
|
||
|
void setOrigin(Qt::Corner);
|