Bug 426988 - Client unresponsive when geometry changes if both signals are connected
Summary: Client unresponsive when geometry changes if both signals are connected
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: scripting (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-26 10:51 UTC by LinG
Modified: 2020-09-29 14:59 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 5.20
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description LinG 2020-09-26 10:51:24 UTC
SUMMARY
When you set the same geometry in both the clientStepUserMovedResized and clientFinishedUserMovedResized signals the client becomes unresponsive until you can force a new geometry, such as by changing the border property (it feels like a deadlock, because CPU usage does not go up, it's just no longer takes input)

STEPS TO REPRODUCE
1. open a konsole application
2. run this small kwin script that illustrates the problem, this example connects both client geometry change signals to a running konsole application and forces a certain geometry (100,100, 200, 400)
```
var clients = workspace.clientList();
for (var i = 0; i < clients.length; i++) {
  var client = clients[i];
  if (client && client.resourceClass.toString() === 'konsole')
  {
    client.clientStepUserMovedResized.connect(function(c){
      c.geometry = {
        x: 100,
        y: 100,
        width: 200,
        height:400
      };
    });
    client.clientFinishUserMovedResized.connect(function(c)
    {
      c.geometry = {
        x: 100,
        y: 100,
        width: 200,
        height:400
      };
    });
  }
}
```
3. resize the konsole application by dragging one of the borders

OBSERVED RESULT
client becomes unresponsive to input

EXPECTED RESULT
client should be responsive to input

SOFTWARE/OS VERSIONS
latest archlinux packages (Plasma 5.19.5/Framework 5.74.0 at the time of writing this report)

ADDITIONAL INFORMATION
If you comment one of the two signals then it works fine and the client doesn't become unresponsive.
I remember in older versions of KWin, this would result in weird visual artificats, this is now resolved but now the client becomes unresponsive. Origin of report: https://github.com/lingtjien/Grid-Tiling-Kwin/issues/83
Comment 1 Bug Janitor Service 2020-09-28 08:37:40 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/298
Comment 2 Vlad Zahorodnii 2020-09-29 13:55:58 UTC
Git commit 6f153552dab35f46bc88c0b736a16a47cc3297d4 by Vlad Zahorodnii.
Committed on 29/09/2020 at 13:55.
Pushed by vladz into branch 'master'.

Allow calling setFrameGeometry() while the client is being resized

Currently, if some script attempts to resize a window while it's being
interactively resized, the corresponding change won't be propagated to
the X server.

The main reason for that is that we don't want to configure the frame
window, the wrapper window, and the client window twice. However, since
Xcb::Window keeps track of the last configured geometry, we can adjust
X11Client::updateServerGeometry() so it only configures windows that
have mismatching geometry.

By doing so, the setFrameGeometry() function can be called by scripts
even when the associated X11 window is being interactively resized.

Note that this bug doesn't affect Wayland windows.

M  +9    -6    x11client.cpp

https://invent.kde.org/plasma/kwin/commit/6f153552dab35f46bc88c0b736a16a47cc3297d4
Comment 3 Vlad Zahorodnii 2020-09-29 13:57:00 UTC
Git commit dfa08f22598582753638cfe6016232bc3b62edb9 by Vlad Zahorodnii.
Committed on 29/09/2020 at 13:56.
Pushed by vladz into branch 'Plasma/5.20'.

Allow calling setFrameGeometry() while the client is being resized

Currently, if some script attempts to resize a window while it's being
interactively resized, the corresponding change won't be propagated to
the X server.

The main reason for that is that we don't want to configure the frame
window, the wrapper window, and the client window twice. However, since
Xcb::Window keeps track of the last configured geometry, we can adjust
X11Client::updateServerGeometry() so it only configures windows that
have mismatching geometry.

By doing so, the setFrameGeometry() function can be called by scripts
even when the associated X11 window is being interactively resized.

Note that this bug doesn't affect Wayland windows.


(cherry picked from commit 6f153552dab35f46bc88c0b736a16a47cc3297d4)

M  +9    -6    x11client.cpp

https://invent.kde.org/plasma/kwin/commit/dfa08f22598582753638cfe6016232bc3b62edb9