From 8dac50e6266b0679a34c682190bed7ea599a95b7 Mon Sep 17 00:00:00 2001 From: Tsu Jan Date: Fri, 6 Sep 2024 18:41:37 +0330 Subject: [PATCH] Fixed the enabled state of moving to next/previous monitor Related to https://github.com/lxqt/lxqt-panel/pull/2110, but the code had a problem before it too. --- plugin-taskbar/lxqttaskbutton.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugin-taskbar/lxqttaskbutton.cpp b/plugin-taskbar/lxqttaskbutton.cpp index 76c81c631..cca3e9a17 100644 --- a/plugin-taskbar/lxqttaskbutton.cpp +++ b/plugin-taskbar/lxqttaskbutton.cpp @@ -608,14 +608,15 @@ void LXQtTaskButton::contextMenuEvent(QContextMenuEvent* event) if (QGuiApplication::screens().size() > 1) { menu->addSeparator(); + bool enable(mBackend->supportsAction(mWindow, LXQtTaskBarBackendAction::Move) && + mBackend->supportsAction(mWindow, LXQtTaskBarBackendAction::MoveToOutput) && + (state != LXQtTaskBarWindowState::FullScreen + || mBackend->supportsAction(mWindow, LXQtTaskBarBackendAction::FullScreen))); a = menu->addAction(tr("Move To N&ext Monitor")); - a->setEnabled(mBackend->supportsAction(mWindow, LXQtTaskBarBackendAction::MoveToOutput)); + a->setEnabled(enable); connect(a, &QAction::triggered, this, [this] { moveApplicationToPrevNextMonitor(true); }); - a->setEnabled(mBackend->supportsAction(mWindow, LXQtTaskBarBackendAction::Move) && - (state != LXQtTaskBarWindowState::FullScreen - || ((state == LXQtTaskBarWindowState::FullScreen) && mBackend->supportsAction(mWindow, LXQtTaskBarBackendAction::FullScreen)))); a = menu->addAction(tr("Move To &Previous Monitor")); - a->setEnabled(mBackend->supportsAction(mWindow, LXQtTaskBarBackendAction::MoveToOutput)); + a->setEnabled(enable); connect(a, &QAction::triggered, this, [this] { moveApplicationToPrevNextMonitor(false); }); }