-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
High CPU load in case of QT_SCALE_FACTOR > 1 #1926
Comments
Not reproducible here, whether I used So, there should be another factor. I'll keep this open for a while, hoping that you might find that factor. |
Oops! I'd tested with my old laptop, which didn't have the latest git. With my work laptop and the latest git lxqt-panel, I confirm that the CPU usage is high (~20% here). The cause may be in a recent commit. |
The cause is that the X11-based function This is a new behavior (as I mentioned above, it didn't happen in older versions of lxqt-panel). I guess it's caused by a change or bug in |
Ok, thank you for your feedback! |
Sadly, I was right; it's a bug in @palinek, any suggestion? Can we avoid this nasty problem in a persistent way? |
I'm not sure — never dealt with this function before. Perhaps misplaced icons under special circumstances. EDIT: You could also add a |
The KDE doc says that I tested with 1.2.1 in my old laptop by removing @smirnovskysaha |
@tsujan |
@smirnovskysaha, thanks!
I don't see any either, whether with git or with an older version. The behavior of icons are also the same when I change the panel's height/width or the icon size of the taskbar (suboptimal). |
But I should notice that just adding |
Yes. Here the signal EDIT: I'm using this patch: diff -ruNp lxqt-panel-orig/plugin-taskbar/lxqttaskbutton.cpp lxqt-panel/plugin-taskbar/lxqttaskbutton.cpp
--- lxqt-panel-orig/plugin-taskbar/lxqttaskbutton.cpp
+++ lxqt-panel/plugin-taskbar/lxqttaskbutton.cpp
@@ -159,35 +159,6 @@ void LXQtTaskButton::updateIcon()
/************************************************
************************************************/
-void LXQtTaskButton::refreshIconGeometry(QRect const & geom)
-{
- xcb_connection_t* x11conn = QX11Info::connection();
-
- if (!x11conn) {
- return;
- }
-
- NETWinInfo info(x11conn,
- windowId(),
- (WId) QX11Info::appRootWindow(),
- NET::WMIconGeometry,
- NET::Properties2());
- NETRect const curr = info.iconGeometry();
- if (curr.pos.x != geom.x() || curr.pos.y != geom.y()
- || curr.size.width != geom.width() || curr.size.height != geom.height())
- {
- NETRect nrect;
- nrect.pos.x = geom.x();
- nrect.pos.y = geom.y();
- nrect.size.height = geom.height();
- nrect.size.width = geom.width();
- info.setIconGeometry(nrect);
- }
-}
-
-/************************************************
-
- ************************************************/
void LXQtTaskButton::changeEvent(QEvent *event)
{
if (event->type() == QEvent::StyleChange)
diff -ruNp lxqt-panel-orig/plugin-taskbar/lxqttaskbutton.h lxqt-panel/plugin-taskbar/lxqttaskbutton.h
--- lxqt-panel-orig/plugin-taskbar/lxqttaskbutton.h
+++ lxqt-panel/plugin-taskbar/lxqttaskbutton.h
@@ -79,7 +79,6 @@ public:
LXQtTaskBar * parentTaskBar() const {return mParentTaskBar;}
- void refreshIconGeometry(QRect const & geom);
static QString mimeDataFormat() { return QLatin1String("lxqt/lxqttaskbutton"); }
/*! \return true if this button received DragEnter event (and no DragLeave event yet)
* */
diff -ruNp lxqt-panel-orig/plugin-taskbar/lxqttaskgroup.cpp lxqt-panel/plugin-taskbar/lxqttaskgroup.cpp
--- lxqt-panel-orig/plugin-taskbar/lxqttaskgroup.cpp
+++ lxqt-panel/plugin-taskbar/lxqttaskgroup.cpp
@@ -439,18 +439,8 @@ void LXQtTaskGroup::setPopupVisible(bool
************************************************/
void LXQtTaskGroup::refreshIconsGeometry()
{
- QRect rect = geometry();
- rect.moveTo(mapToGlobal(QPoint(0, 0)));
-
- if (mSingleButton)
- {
- refreshIconGeometry(rect);
- return;
- }
-
for(LXQtTaskButton *but : qAsConst(mButtonHash))
{
- but->refreshIconGeometry(rect);
but->setIconSize(QSize(plugin()->panel()->iconSize(), plugin()->panel()->iconSize()));
}
}
|
… by removing `LXQtTaskButton::refreshIconGeometry`, for which I found no use. The high CPU usage was a result of a recent change — or perhaps bug — in `KWindowSystem`. Fixes #1926
`KWindowSystem` started to take the scale factor into account; we should also do so in task bar. NOTE: `KWindowSystem` 5.101.0, which is our minimum required version, does it too. Fixes #1926
`KWindowSystem` started to take the scale factor into account; we should also do so in task bar. NOTE: `KWindowSystem` 5.101.0, which is our minimum required version, does it too. Fixes #1926
Problem
lxqt-panel loads CPU heavily when QT_SCALE_FACTOR is not equal to 1.
Steps to reproduce
run "QT_SCALE_FACTOR=1.5 lxqt-panel", CPU usage by lxqt-panel becomes about 70%.
Version
current (commit 9918a0e).
Source of the problem and possible fix
I have found that the problem goes away when the TaskBar widget is removed from the panel.
Profiling with gprof shows that
LXQtTaskBar::onWindowChanged()
,LXQtTaskGroup::regroup()
,LXQtTaskGroup::onWindowChanged()
are called very often in case of QT_SCALE_FACTOR>1.I have commented out the line 64
connect(parent, &LXQtTaskBar::refreshIconGeometry, this, &LXQtTaskGroup::refreshIconsGeometry);
in the file plugin-taskbar/lxqttaskgroup.cpp and the problem disappears.
The text was updated successfully, but these errors were encountered: