Add Move and Resize items in the task-button context menu.

ubuntu/bionic
Simon Quigley 6 years ago
parent 8d4c93c600
commit 8df82483c5

3
debian/changelog vendored

@ -20,6 +20,9 @@ lxqt-panel (0.12.0-8ubuntu1) UNRELEASED; urgency=medium
- Avoid infinite recursion when no icon is available.
+ avoid-infinite-recursion-icons.patch
+ Upstream commit b9b4133.
- Add Move and Resize items in the task-button context menu.
+ add-move-resize-items.patch
+ Upstream commit b69fe72.
-- Simon Quigley <tsimonq2@ubuntu.com> Mon, 05 Feb 2018 19:00:18 -0600

@ -0,0 +1,78 @@
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);

@ -7,3 +7,4 @@ fix-wrongly-positioned-popups.patch
use-specific-panel-icon.patch
fix-memory-leaks.patch
avoid-infinite-recursion-icons.patch
add-move-resize-items.patch

Loading…
Cancel
Save