Skip to content

Commit 9b6ae3f

Browse files
committed
TaskBar: remove last X11 specific code
1 parent 01704dd commit 9b6ae3f

File tree

3 files changed

+17
-23
lines changed

3 files changed

+17
-23
lines changed

plugin-taskbar/lxqttaskbar.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@
5252

5353
#include "lxqttaskbarbackend_x11.h"
5454

55-
//TODO: remove
56-
#include <KX11Extras>
57-
5855
using namespace LXQt;
5956

6057
/************************************************
@@ -108,21 +105,19 @@ LXQtTaskBar::LXQtTaskBar(ILXQtPanelPlugin *plugin, QWidget *parent) :
108105

109106

110107
// Temporary workaround
111-
auto onWindowChanged_ = [this](WId window, NET::Properties prop, NET::Properties2 prop2)
108+
auto onWindowChanged_ = [this](WId window, int prop)
112109
{
113110
auto i = mKnownWindows.find(window);
114111
if (mKnownWindows.end() != i)
115112
{
116-
if (!(*i)->onWindowChanged(window, prop, prop2) && acceptWindow(window))
113+
if (!(*i)->onWindowChanged(window, LXQtTaskBarWindowProperty(prop)))
117114
{ // window is removed from a group because of class change, so we should add it again
118115
addWindow(window);
119116
}
120117
}
121118
};
122119

123-
connect(KX11Extras::self(),
124-
static_cast<void (KX11Extras::*)(WId, NET::Properties, NET::Properties2)>(&KX11Extras::windowChanged),
125-
this, onWindowChanged_);
120+
connect(mBackend, &ILXQtTaskbarAbstractBackend::windowPropertyChanged, this, onWindowChanged_);
126121

127122
connect(mBackend, &ILXQtTaskbarAbstractBackend::windowAdded, this, &LXQtTaskBar::onWindowAdded);
128123
connect(mBackend, &ILXQtTaskbarAbstractBackend::windowRemoved, this, &LXQtTaskBar::onWindowRemoved);

plugin-taskbar/lxqttaskgroup.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -617,8 +617,10 @@ void LXQtTaskGroup::wheelEvent(QWheelEvent* event)
617617
/************************************************
618618
619619
************************************************/
620-
bool LXQtTaskGroup::onWindowChanged(WId window, NET::Properties prop, NET::Properties2 prop2)
621-
{ // returns true if the class is preserved
620+
bool LXQtTaskGroup::onWindowChanged(WId window, LXQtTaskBarWindowProperty prop)
621+
{
622+
// Returns true if the class is preserved
623+
622624
bool needsRefreshVisibility{false};
623625
QVector<LXQtTaskButton *> buttons;
624626
if (mButtonHash.contains(window))
@@ -631,17 +633,16 @@ bool LXQtTaskGroup::onWindowChanged(WId window, NET::Properties prop, NET::Prope
631633
if (!buttons.isEmpty())
632634
{
633635
// if class is changed the window won't belong to our group any more
634-
if (parentTaskBar()->isGroupingEnabled() && prop2.testFlag(NET::WM2WindowClass))
636+
if (parentTaskBar()->isGroupingEnabled() && prop == LXQtTaskBarWindowProperty::WindowClass)
635637
{
636-
KWindowInfo info(window, NET::Properties(), NET::WM2WindowClass);
637-
if (QString::fromUtf8(info.windowClassClass()) != mGroupName)
638+
if (mBackend->getWindowClass(windowId()) != mGroupName)
638639
{
639640
onWindowRemoved(window);
640641
return false;
641642
}
642643
}
643644
// window changed virtual desktop
644-
if (prop.testFlag(NET::WMDesktop) || prop.testFlag(NET::WMGeometry))
645+
if (prop == LXQtTaskBarWindowProperty::Workspace)
645646
{
646647
if (parentTaskBar()->isShowOnlyOneDesktopTasks()
647648
|| parentTaskBar()->isShowOnlyCurrentScreenTasks())
@@ -650,31 +651,28 @@ bool LXQtTaskGroup::onWindowChanged(WId window, NET::Properties prop, NET::Prope
650651
}
651652
}
652653

653-
if (prop.testFlag(NET::WMVisibleName) || prop.testFlag(NET::WMName))
654+
if (prop == LXQtTaskBarWindowProperty::Title)
654655
std::for_each(buttons.begin(), buttons.end(), std::mem_fn(&LXQtTaskButton::updateText));
655656

656657
// XXX: we are setting window icon geometry -> don't need to handle NET::WMIconGeometry
657658
// Icon of the button can be based on windowClass
658-
if (prop.testFlag(NET::WMIcon) || prop2.testFlag(NET::WM2WindowClass))
659+
if (prop == LXQtTaskBarWindowProperty::Icon)
659660
std::for_each(buttons.begin(), buttons.end(), std::mem_fn(&LXQtTaskButton::updateIcon));
660661

661662
bool set_urgency = false;
662663
bool urgency = false;
663-
if (prop2.testFlag(NET::WM2Urgency))
664+
if (prop == LXQtTaskBarWindowProperty::Urgency)
664665
{
665666
set_urgency = true;
666667
//FIXME: original code here did not consider "demand attention", was it intentional?
667668
urgency = mBackend->applicationDemandsAttention(window);
668669
}
669-
if (prop.testFlag(NET::WMState))
670+
if (prop == LXQtTaskBarWindowProperty::State)
670671
{
671-
KWindowInfo info{window, NET::WMState};
672672
if (!set_urgency)
673673
urgency = mBackend->applicationDemandsAttention(window);
674674
std::for_each(buttons.begin(), buttons.end(), std::bind(&LXQtTaskButton::setUrgencyHint, std::placeholders::_1, urgency));
675675
set_urgency = false;
676-
if (info.hasState(NET::SkipTaskbar))
677-
onWindowRemoved(window);
678676

679677
if (parentTaskBar()->isShowOnlyMinimizedTasks())
680678
{

plugin-taskbar/lxqttaskgroup.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
#include "lxqttaskbutton.h"
3535

36-
#include <KF5/KWindowSystem/kwindowsystem.h>
36+
#include "lxqttaskbartypes.h"
3737

3838
class QVBoxLayout;
3939
class ILXQtPanelPlugin;
@@ -60,7 +60,8 @@ class LXQtTaskGroup: public LXQtTaskButton
6060
// if circular is true, then it will go around the list of buttons
6161
LXQtTaskButton * getNextPrevChildButton(bool next, bool circular);
6262

63-
bool onWindowChanged(WId window, NET::Properties prop, NET::Properties2 prop2);
63+
bool onWindowChanged(WId window, LXQtTaskBarWindowProperty prop);
64+
6465
void setAutoRotation(bool value, ILXQtPanel::Position position);
6566
Qt::ToolButtonStyle popupButtonStyle() const;
6667
void setToolButtonsStyle(Qt::ToolButtonStyle style);

0 commit comments

Comments
 (0)