This forum has been archived. All content is frozen. Please use KDE Discuss instead.

KWindowSystem::setStrut not working with multiple monitors

Tags: None
(comma "," separated)
majewsky
KDE Developer
Posts
46
Karma
0
OS
The minimal example code pasted below works correctly when I have only one monitor active: A widget will appear at the specified location, and some space will be reserved at the bottom of the screen (as can be seen from maximised windows stepping aside).

However, the strut does not work when I have multiple screens. The maximised windows won't move by a pixel. Can someone see what I'm doing wrong?

For reference, my WM is (of course) KWin 4.8. Plasma is also running, with one panel at the top of the same screen where I want to reserve the strut. (A top panel should AFAIK not interfere with my bottom strut.)

Code: Select all
// compile me with: g++ -lkdeui -lQtGui -lQtCore test.cpp -o test

#include <QtGui/QWidget>
#include <QtGui/QApplication>
#include <KDE/KWindowSystem>

int main(int argc, char** argv)
{
   QApplication app(argc, argv);

   QWidget widget;
   //set explicit geometry to determine which screen the widget is on
   widget.setGeometry(50, 50, 50, 50);
   widget.show();

   //reserve 100 pixels at the bottom edge of the screen
   KWindowSystem::setStrut(widget.winId(), 0, 0, 0, 100);

   return app.exec();
}
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
I've temporarily moved this to the KWin forum to attract the attention of the KWin developers, who maintain this part of kdelibs I believe...


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
mgraesslin
KDE Developer
Posts
572
Karma
7
OS
please use setExtendedStrut
luebking
Karma
0
struts are only accepted for dock type windows - questionable sanity check, but always been like this
majewsky
KDE Developer
Posts
46
Karma
0
OS
luebking wrote:struts are only accepted for dock type windows - questionable sanity check, but always been like this


This is the minimal example. I observe the same behavior with a dock-shaped window that occupies exactly the strut and has been marked as dock using the corresponding Qt::WA_whatever.

Re setExtendedStrut(): I considered it, but the APIDOX say that setStrut() is a convenience shortcut for a common case of setExtendedStrut().

Wait a moment, I'm just looking at the source of setStrut() on api.kde.org, and I think the variables "w" and "h" need to be swapped. (That is: In the line where setExtendedStrut() is called, the expressions for left and right strut end need to use "h", while bottom and top strut end need to use "w".) Can someone with a self-compiled kdelibs please check if this fixes the multi-monitor problem?


Proud kdegames developer since 2008, and member of the KDE forums since March 2009
luebking
Karma
0
sorry, i clipped on the plain QWidget and ignored the essence of your post:
how are the screens arranged? do you run into https://bugs.kde.org/show_bug.cgi?id=167852
majewsky
KDE Developer
Posts
46
Karma
0
OS
luebking wrote:how are the screens arranged? do you run into https://bugs.kde.org/show_bug.cgi?id=167852


My monitors stand besides each other, so the primary display is left of the secondary display. Since I want a bottom panel, I don't think this particular bug is relevant for my situation.

But admittedly, I'm a bit confused by how the WM knows at all which display I refer to, when the strut message does not include any reference to a display (only pixel metrics).


Proud kdegames developer since 2008, and member of the KDE forums since March 2009
luebking
Karma
0
You cannot refer to a display (by the regular NETWM spec) - the struts only apply to the combined (outer) edges.
Also the physical layout is not relevant, you can check the actual layout with xrandr or "kcmshell4 randr" or in nvidia-settings

For a quick check run "openbox --replace" and see how it behaves or how struts on other edges behave.

Another pitfall might be screen geometries - please post "xrandr -q"
majewsky
KDE Developer
Posts
46
Karma
0
OS
luebking wrote:For a quick check run "openbox --replace" and see how it behaves or how struts on other edges behave.


OpenBox behaves just like KWin does.

luebking wrote:Another pitfall might be screen geometries - please post "xrandr -q"


Output follows, with deactivated outputs and modes omitted for brevity. (My xrandr setup of course follows the physical arrangement of the monitors.)

LVDS1 connected 1280x800+0+0 (normal left inverted right x axis y axis) 331mm x 207mm
1280x800 60.0*+
VGA1 connected 1920x1080+1280+0 (normal left inverted right x axis y axis) 510mm x 287mm
1920x1080 60.0*+


Proud kdegames developer since 2008, and member of the KDE forums since March 2009
luebking
Karma
0
Are struts on the top also affected?


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot]