Bug 341195 - Creating window pixmap can fail after changing client geometry through script
Summary: Creating window pixmap can fail after changing client geometry through script
Status: RESOLVED WORKSFORME
Alias: None
Product: kwin
Classification: Plasma
Component: scripting (show other bugs)
Version: 5.1.1
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL: https://github.com/faho/kwin-bugs/tre...
Keywords:
: 365821 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-11-23 16:22 UTC by Fabian Homborg
Modified: 2021-12-06 04:38 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
test script (1.33 KB, text/plain)
2014-11-23 16:23 UTC, Fabian Homborg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fabian Homborg 2014-11-23 16:22:16 UTC
Under certain circumstances, changing the client geometry in a script (like one made for tiling window management) may lead to corrupted visuals (the former visuals are filled in to the new size) and unresponsive windows.

This happens mostly when changing geometry in the handler for client.geometry{Shape,}Changed, but can also happen when changing the geometry too early after the client is just added or when violating the clients min/maxSize.

Clients particularly prone to this are vlc (when violating minSize, which is what the linked script does for ease of reproduction), firefox (when restoring a session) and emacs (pretty much always).

Reproducible: Always

Steps to Reproduce:
1. Run the attached script
2. Open vlc
3. Resize vlc

Actual Results:  
The old client image is filled in to the new client size and kwin shows _tons_ of 

>Creating window pixmap failed: SOMETHING

in the console.

Expected Results:  
The client either sticks to its old size and the script is notified (by throwing an error it can react to) or (my preferred solution) the client is properly resized to the geometry the script specified.

As far as I remember, this has already been present in 4.9 and is also present up to and including 5.1.1.

I would also be okay with an API change, i.e. providing a "client.setGeometry(rectangle)" method that provides a success return value instead of directly accessing the property if that helps.
Comment 1 Fabian Homborg 2014-11-23 16:23:21 UTC
Created attachment 89700 [details]
test script
Comment 2 Thomas Lübking 2014-11-23 20:26:56 UTC
Just to be sure: happens with oxygen decoration, not aurorae?
Comment 3 Fabian Homborg 2014-11-23 20:48:54 UTC
Yes, I just tested again to be sure.

It also happens with client.noBorder set to true (that's what I use for the most part), though I'm not sure how much of the decoration code that disables.
Comment 4 Martin Flöser 2014-11-24 08:20:18 UTC
if it's about violating minSize: we should probably not allow to do that from the script.
Comment 5 Fabian Homborg 2014-11-24 10:35:22 UTC
Just to be clear: It can also be triggered in non-minSize related cases. It's just that that case is the easiest and most reliable to reproduce.

Another requires resizing firefox after it tries to resize to the value from the previous session, which it only does when it shows about:sessionrestore.

There may also be some races involved - as far as I can see in the firefox case creating the pixmap fails because the geometry was changed between kwin requesting and receiving a pixmap (i.e. the important test seems to be "windowGeometry->width != toplevel()->width()" or the same for height in scene.cpp). This may require some ordering guarantees for the scripting API - something I already mentioned regarding FFM (in a bug I can't find right now).
Comment 6 Martin Flöser 2014-11-24 11:01:17 UTC
Yes, that certainly needs better improvement. I wanted just to point out the obvious: resizing below minSize doesn't make much sense.
Comment 7 Martin Flöser 2016-10-26 14:18:22 UTC
*** Bug 365821 has been marked as a duplicate of this bug. ***
Comment 8 kde.org 2021-11-06 18:10:58 UTC
This issue report is quite old. Can you please confirm, that it still persists with KDE 5.23?
Comment 9 Bug Janitor Service 2021-11-21 04:38:53 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 10 Bug Janitor Service 2021-12-06 04:38:17 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!