From e1f7f997ab3d60174a5d22383992d614ab6935bc Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Mon, 5 Feb 2018 19:51:43 -0600 Subject: [PATCH] Set the initial task button text (and icon) correctly. --- debian/changelog | 3 +++ debian/patches/series | 1 + .../set-initial-task-button-correctly.patch | 27 +++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 debian/patches/set-initial-task-button-correctly.patch diff --git a/debian/changelog b/debian/changelog index 70d62ce..6203bb9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -23,6 +23,9 @@ lxqt-panel (0.12.0-8ubuntu1) UNRELEASED; urgency=medium - Add Move and Resize items in the task-button context menu. + add-move-resize-items.patch + Upstream commit b69fe72. + - Set the initial task button text (and icon) correctly. + + set-initial-task-button-correctly.patch + + Upstream commit 563d6bf. -- Simon Quigley Mon, 05 Feb 2018 19:00:18 -0600 diff --git a/debian/patches/series b/debian/patches/series index 2e33b97..8e86f59 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -8,3 +8,4 @@ use-specific-panel-icon.patch fix-memory-leaks.patch avoid-infinite-recursion-icons.patch add-move-resize-items.patch +set-initial-task-button-correctly.patch diff --git a/debian/patches/set-initial-task-button-correctly.patch b/debian/patches/set-initial-task-button-correctly.patch new file mode 100644 index 0000000..63b4206 --- /dev/null +++ b/debian/patches/set-initial-task-button-correctly.patch @@ -0,0 +1,27 @@ +Description: Set the initial task button text (and icon) correctly + Detailed explanation: + . + When a window shows up, the signal `KWindowSystem::stackingOrderChanged` is emitted *before* `KWindowSystem::windowAdded`. The former signal is connected to the function `LXQtTaskBar::refreshTaskList()`, which calls the functions `LXQtTaskBar::addWindow()` and `LXQtTaskBar::removeWindow()` to add and remove monitored windows. + . + Connecting `LXQtTaskBar::refreshTaskList()` to the signal `KWindowSystem::stackingOrderChanged` not only is redundant but also causes a problem: + . + (1) It's redundant because the job of adding *new* windows should be done by `LXQtTaskBar::onWindowAdded()` connected to the signal `KWindowSystem::windowAdded`. However, with the current code, `LXQtTaskBar::addWindow()` is never called by that function because the new window is already added through `KWindowSystem::stackingOrderChanged`. Similarly, `LXQtTaskBar::onWindowRemoved()` should be responsible for removing windows by being connected to the signal `KWindowSystem::windowRemoved`. + . + (2) More importantly, as the window name can change in the short interval between the emissions of `KWindowSystem::stackingOrderChanged` and `KWindowSystem::windowAdded`, the corresponding taskbar button may get a wrong text. The reason is that the signal `WindowSystem::windowChanged` announces changes only starting from the emission of `KWindowSystem::windowAdded`. (Theoretically, the initial icon might also be wrong but that's rarer). + . + Here, the connection to `KWindowSystem::stackingOrderChanged` is removed, so that the initial task button text/icon is set correctly. In this way, several useless calls to `LXQtTaskBar::refreshTaskList()` are also prevented when a window is shown/closed or focused/unfocused. +Author: Tsu Jan +Origin: backport +Bug: https://github.com/lxde/lxqt/issues/1303 +Applied-Upstream: commit:563d6bf +Last-Update: 2018-02-05 +--- a/plugin-taskbar/lxqttaskbar.cpp ++++ b/plugin-taskbar/lxqttaskbar.cpp +@@ -93,7 +93,6 @@ LXQtTaskBar::LXQtTaskBar(ILXQtPanelPlugi + connect(mSignalMapper, static_cast(&QSignalMapper::mapped), this, &LXQtTaskBar::activateTask); + QTimer::singleShot(0, this, &LXQtTaskBar::registerShortcuts); + +- connect(KWindowSystem::self(), SIGNAL(stackingOrderChanged()), SLOT(refreshTaskList())); + connect(KWindowSystem::self(), static_cast(&KWindowSystem::windowChanged) + , this, &LXQtTaskBar::onWindowChanged); + connect(KWindowSystem::self(), &KWindowSystem::windowAdded, this, &LXQtTaskBar::onWindowAdded);