Skip to content
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

Solo window freezes on attempted resize #83

Closed
JackyFWong opened this issue Sep 16, 2020 · 6 comments
Closed

Solo window freezes on attempted resize #83

JackyFWong opened this issue Sep 16, 2020 · 6 comments

Comments

@JackyFWong
Copy link

Hi. First, thanks for making the script, it has been very helpful in my productivity.

The issue: This occurs when there is one window open on one desktop. Occasionally I accidentally try to resize the window (e.g. I click the border of a Firefox window when I mean to choose a different Firefox tab). When this happens, the entire window freezes until I close and re open it.

This occurs on all applications as far as I can tell. Also, when the window is frozen, I can still interact with the application (I can see stuff happening because I have an active window title widget) through clicking or the keyboard, but the window's visuals remain frozen.

This does not when there are multiple windows on one desktop, and a window freezing on one desktop does not affect other applications on other desktops. This also does not occur when the Grid-Tiling-Kwin script is off.

@lingtjien lingtjien added the bug label Sep 17, 2020
@lingtjien
Copy link
Owner

lingtjien commented Sep 17, 2020

Seems to be a problem with KWin (or my use of the API). I reduced the problem to this small example

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
      };
    });
  }
}

This example connects both client geometry change signals to a running konsole client and when you then try to resize the konsole client, this script will force this geometry on the client. Which does happen, but the application also no longer takes input (still takes a kill signal though). It only happens when you resize the client, moving should also trigger both these signals but it doesn't make the application unresponsive, only resizing does.

My guess is that it has something to do with both signals setting the geometry property simultaneously (guessing a deadlock) when you release your cursor, because if you uncomment the first signal clientStepUserMovedResized then it won't cause a hang anymore, but you also don't get the gradual client resizing (which is actually better performance wise, since it doesn't have to resize all clients continuously as you're dragging, but only at the end when the user releases the mouse)

Also, for some weird reason, if you can trigger a new client geometry, the hanging will stop. So in your example, if you toggle the borders with the global shortcut Grid-Tiling: Toggle Border the client will become responsive again... (guessing that toggling the border property releases the lock)

Final note, I remember some years ago when I first started creating this script that KWin would behave differently in this case. This behavior also happens when you drag clients outside their divider bounds, which now also results in the hanging of the clients. When I first started creating this script, KWin would create weird visual artifacts when you dragged clients outside their bounds, but that doesn't happen now anymore... so I guess it's good they fixed that... but now the client hangs...

Anyways, so the quickest fix for now, if this occurs often for you, is if you comment out the clientStepUserMovedResized signal (lines 834 - 844) in main.js

Currently having some time off work, I'll make a detailed bug report later (I mean... this is already pretty detailed, but put it in bugzilla)

@Crendgrim
Copy link

I have encountered this behaviour as well when starting a resize from the screen edges. Triggering a new geometry by adding/removing other clients to/from the same screen also unfreezes the broken window. Sometimes simply swapping the window with another helps as well, though I have found this to not be completely reliable.

@lingtjien
Copy link
Owner

lingtjien commented Sep 26, 2020

@lingtjien
Copy link
Owner

that's fast https://invent.kde.org/plasma/kwin/-/merge_requests/298

@lingtjien
Copy link
Owner

lingtjien commented Sep 29, 2020

Well, they shipped it (already merged to trunk) and the report says fixed in 5.20, so we'll see once 5.20 hits the repos

@lingtjien
Copy link
Owner

lingtjien commented Oct 14, 2020

Well, I got it in my Arch packages update today and it seems to work now after a quick test 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants