Bug 330099 - clientArea always returns area before resolutionchange in screenResized handler
Summary: clientArea always returns area before resolutionchange in screenResized handler
Status: CONFIRMED
Alias: None
Product: kwin
Classification: Plasma
Component: scripting (show other bugs)
Version: 4.11.5
Platform: Arch Linux Linux
: NOR minor
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-17 20:28 UTC by Fabian Homborg
Modified: 2021-03-10 00:12 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabian Homborg 2014-01-17 20:28:25 UTC
When I call workspace.clientArea() in my screenResized handling, it always returns the area it used to be, i.e. when I change resolution from 1366x768 to 1024x768, it will have a width of 1366.

After the signal is handled it will be the correct size.

This means I'm currently unable to autoadjust to resolution changes in my tiling script.

This is somewhat related to https://bugs.kde.org/show_bug.cgi?id=326233, as that would be a superset of the current screenResized signal.


Reproducible: Always

Steps to Reproduce:
Run the following:

workspace.screenResized.connect(function(screen) {
	print("SCREEN RESIZED");
	var screenRect = workspace.clientArea(KWin.PlacementArea, screen, workspace.currentDesktop);
	print(screenRect.x, screenRect.y, screenRect.width, screenRect.height);
});

change resolution and check the output.


Actual Results:  
Output is something like:

SCREEN RESIZED
0 0 1366 768

Expected Results:  
SCREEN RESIZED
0 0 1024 768

The workaround currently is to require the user to do something (e.g. open, close or move a window).
Comment 1 Thomas Lübking 2014-01-17 21:44:20 UTC
Ran into that, used a timer:
http://kde-look.org/content/show.php?content=162304

The problem is that kwin has an internal delay before acting (maaaany screen resizes can happen on a single change - depending on how stupid the change is caused), but the signal is directly bound to QDesktopWidget::resized(int)

I suggest to act later in scripts as well, either the way done by the linked script or by adding a signal hopper in the wrapper.
The latter would prevent scripts to really react on every single resize action (no idea whether that's required - just mentioning)
Comment 2 Fabian Homborg 2014-01-22 21:02:15 UTC
After some googling, I've found that either there is a Qt bug (QTimer isn't accesible from my code), or I need to refactor my code into one file so I can drop qml (which I only need for Qt.include).

Either way, I can't see any use for the current behavior regarding screenResized, so it should be changed.
Comment 3 Justin Zobel 2021-03-10 00:12:36 UTC
Thank you for the bug report.

As this report hasn't seen any changes in 5 years or more, we ask if you can please confirm that the issue still persists.

If this bug is no longer persisting or relevant please change the status to resolved.