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

Fixes: add Gnome 44 support #515

Merged
merged 27 commits into from
May 19, 2023
Merged

Fixes: add Gnome 44 support #515

merged 27 commits into from
May 19, 2023

Conversation

jtaala
Copy link
Collaborator

@jtaala jtaala commented Apr 22, 2023

This PR fixes reported issues in Gnome 44: fixes #494, fixes #495, closes #490, fixes #523.

Note: these are compatibility fixes to support Gnome 44 in develop branch (i.e. Gnome 43 should still work fine with these changes).

Gnome 44 has a new (improved?) mechanism for grabs (e.g. grabbing and moving windows), and no longer uses end_grab_op.

This PR also adds a polyfill to support Gnome 44's removal of Meta.later_add (which is replaced with global.compositor.get_laters().add(...).

Note: GJS porting guide suggests using Meta.Laters.add but in testing the latest Gnome 44 (and what was released in Fedora 38), this was not present. The implemented approach is used heavily in the latest/official gnome-shell source code (which is why I moved to using that).

Note2: for the first fix (end_grab_op) - it still not quite perfect, it seems to require a second click to activate a window (after moving a window) - but at least it doesn't completely/irreversibly lose mouse click control.
Will look at this and see how to improve here.
fix now implemented for this ✔️

@jtaala jtaala added the gnome-44 Specific to GNOME Shell 44 label Apr 22, 2023
@jtaala jtaala added this to the Gnome 44 support milestone Apr 22, 2023
@jtaala
Copy link
Collaborator Author

jtaala commented Apr 23, 2023

Fiddlesticks... so, I've run into deadends with the grab and drag windows for Gnome 44. They removed the ability (as far as I can see) to stop a gnome grab operation (which was previously done with global.display.end_grab_op). We need this as we stop the default grab operation and do our own when moving windows.

Gnome did this since now it does it all internally and automatically now... which is simpler... except if you don't want to do grab/drag operation and want to do your own (PaperWM wants to do this).

As mentioned in this PR - it works... but the grab operation is still running after we finish our grab/drag operations... and we then need to "click" again to stop the default gnome drag operation. It's annoying, but I'm not sure how to (or if we can) fix that in Gnome 44.

Hopefully, we can find another way to end the default grab op before we do our own. The method/functionality is still there but I haven't found a way yet to access it.

If anyone has any ideas here - either how to stop the default gnome grab op - or alternatively how to fire off a mouse click after we've done our drag operation let me know.

@jtaala
Copy link
Collaborator Author

jtaala commented Apr 25, 2023

If anyone has any ideas here - either how to stop the default gnome grab op - or alternatively how to fire off a mouse click after we've done our drag operation let me know.

Huzzah! so I've implemented a fix for the "needs a second click after pointer grab/moving a window" issue. Spent a few days trying to regain access to the end_grab_op function, then tried rewriting the grab class to fight against the more pervasive gnome 44 grabbing operations.

In the end "if you can't beat em, join em"... we now embrace (lol) the new grab behaviour and then generate a "click out" event automatically to force an internal end_grab_op (if needed).

@jtaala
Copy link
Collaborator Author

jtaala commented Apr 25, 2023

To all gnome-44 PaperWM users - could you please test this branch out and report back how it's working for you? It's working well now in Fedora 38 for me.

git fetch --all
git checkout fixes-gnome-44-support
git pull

and do a logout/login etc.

@jtaala
Copy link
Collaborator Author

jtaala commented Apr 25, 2023

@Lythenas, if you're on 44, give this a test. If you're on 43 for your main setup (like me) please test this out (in principle, this PR won't impact/change gnome 43 behaviour as the main changes are polyfills and if end_grab_op doesn't exist).

@jtaala jtaala requested a review from Lythenas April 25, 2023 01:57
@jtaala jtaala mentioned this pull request Apr 25, 2023
1 task
@jtaala
Copy link
Collaborator Author

jtaala commented Apr 25, 2023

I updated README.md to state gnome 44 support and clarify previous gnome release support.

On a relate note, is this still relevant in README.md? Seems old - but I don't use Ubuntu. If it's old and not relevant would be happy to remove that section:
https://github.com/paperwm/PaperWM/blob/develop/README.md?plain=1#L37-L58

@jtaala
Copy link
Collaborator Author

jtaala commented Apr 25, 2023

uhh - looks like Wayland doesn't like imports.gi.Atspi.generate_mouse_event. Works fine in X11, but hard crashes in Wayland. Looking for another approach now.

Okay, this is now fixed - now using Clutter.virtualInputDevice - which is safe for X11 and Wayland.

jtaala added 3 commits April 25, 2023 18:20
… grab operation to force `end_grab_op`."

`gi.Atspi` appears to have severe issues in Wayland - was getting gnome
shell hard crash in wayland with this (X11 is fine).
This reverts commit 566f628.
…t" of pointer grab operation to force `end_grab_op`

Now using Clutter virtual device to "click out" - safe to use in X11 and Wayland.
@crispinb
Copy link

I'll be running the latest commits for the day today. So far so good. Though I wasn't hitting the drag/drop issue and am not clear whether it could be reproduced to test. I don't think I use the mouse enough.

jtaala added 2 commits April 27, 2023 20:56
…an cause holding onto titlebar and maximizing window). Moved click out to main loop after activate.
…ion. Also moved to Meta.LaterType.BEFORE_REDRAW for safety.
grab.js Outdated Show resolved Hide resolved
@paradajz
Copy link
Contributor

paradajz commented Apr 27, 2023

I'm seeing some very weird issue which is both hard to describe and hard to reproduce. Sometimes when I use my mouse to cycle between opened windows (by clicking on the edge), the WM starts to act as if I started to drag a window. Once I hit this it is very difficult to get out of it - it makes things quite unusable. Last time it happened I just started clicking around and mashing some keys on the keyboard and eventually I managed to get out of it. Very frustrating.

EDIT: Got triggered again simply by pressing Win+Right to switch the active window. Ugh. Think I'll revert to 43 for now.
EDIT2: But I'd be happy to share some logs! Don't know which, though.

@jtaala
Copy link
Collaborator Author

jtaala commented Apr 27, 2023

Last time it happened I just started clicking around and mashing some keys on the keyboard and eventually I managed to get out of it. Very frustrating.

Yes, I hear you. Unfortunately, Gnome 44 completely removed the ability to stop using their new grab/drag Clutter grab actions. This has left us with really no good option. We're trying to work around this, but it has impacted various things in PaperWM with mouse clicking - I hadn't seen the one with clicking on window previews.

All, unless we can find stable workarounds - I'm starting to get the sinking feeling that the only real option is to fork mutter and re-add the ability to end / disable gnome's default grab/drag actions (which was previously available publicly). Hopefully we don't need to go there as it's seems crazy just to restore the ability to end_grab_op (which is still there but just not publicly available now). It would also make it more difficult to install PaperWM as we'd need to install a mutter fork to get it to work right...

@crispinb
Copy link

I'm starting to get the sinking feeling that the only real option is to fork mutter

Sinking feeling indeed! This would also complicate matters for anyone already using a patched mutter. Probably a small number - I'm using https://copr.fedorainfracloud.org/coprs/calcastor/gnome-patched/. Though tbh I'd prioritise PaperWM over it.

@jtaala
Copy link
Collaborator Author

jtaala commented Apr 27, 2023

Hey all, I've now implemented some fixes/changes - could you give this one a test? (apologies for lots of test requests - this gnome 44 changes has thrown us for a loop).

Latest changes in this PR seems to be behaving better in my (brief) tests - but others running it for a day (@crispinb, @paradajz etc) would help confirm.

@jtaala
Copy link
Collaborator Author

jtaala commented May 18, 2023

Please include this information in your bug report on GitHub!
Distribution: openSUSE Tumbleweed
GNOME Shell 44.1
Display server: Xorg
PaperWM branch/tag: fixes-gnome-44-support
PaperWM commit: 477e87a4f04a01ad05245852c0cf645fd19bec0c
Enabled extensions:
- paperwm@hedning:matrix.org
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- io.github.mreditor.gnome-shell-extensions.scroll-panel
- [email protected]

Thanks - that looks fine. Assuming you logged out / logged in again after switching branches etc.

Any logs output would be appreciated too (just output from journalctl -f /usr/bin/gnome-shell that covers any "stuck-in-dragging-issue" occurences would do).

@paradajz
Copy link
Contributor

I just upgraded to 44 on my main PC and pulled the latest changes from this branch. Ran into dragging issues within seconds.

Oh, can you give some more detail on the dragging issues?
Also, just for checking, can you run the gather-system-info.sh script and paste output here.

Sure, the issue is basically the same as in the video I've posted few days ago. Opened a few windows, switched to one them and got stuck in dragging mode.

Dang, I haven't seen any dragging issues in a week now - I've been trying to produce them again.

Anyone else still seeing these dragging issues?

@paradajz I haven't seen the video you mentioned you posted - we'll need to reproduce them to isolate and fix the issues. Point me to the vid or outline any steps and I'll try reproduce them.

Here: #515 (comment)

@paradajz
Copy link
Contributor

I really don't know how to reproduce. It happens randomly. I just clicked onto a window and the dragging operation started.

@paradajz
Copy link
Contributor

I've disabled the extension, run the journalctl, enabled PaperWM, switched to the window and the dragging occurred instantly. Nothing special in the log:

paradajz@desktop ~
> journalctl -f /usr/bin/gnome-shell
Hint: You are currently not seeing messages from other users and the system.
      Users in the 'systemd-journal' group can see all messages. Pass -q to
      turn off this notice.
svi 18 15:46:59 desktop gnome-shell[8951]: #paperwm disable scratch
svi 18 15:46:59 desktop gnome-shell[8951]: #paperwm disable liveAltTab
svi 18 15:46:59 desktop gnome-shell[8951]: #paperwm disable utils
svi 18 15:46:59 desktop gnome-shell[8951]: #paperwm disable stackoverlay
svi 18 15:46:59 desktop gnome-shell[8951]: #paperwm disable app
svi 18 15:46:59 desktop gnome-shell[8951]: #paperwm disable kludges
svi 18 15:46:59 desktop gnome-shell[8951]: #paperwm disable topbar
svi 18 15:46:59 desktop gnome-shell[8951]: #paperwm disable settings
svi 18 15:46:59 desktop gnome-shell[8951]: #paperwm disable gestures
svi 18 15:46:59 desktop gnome-shell[8951]: #paperwm disable user
svi 18 15:51:33 desktop gnome-shell[8951]: #paperwm enable 1684415573966#
svi 18 15:51:33 desktop gnome-shell[8951]: #paperwm enable tiling
svi 18 15:51:33 desktop gnome-shell[8951]: #paperwm enable navigator
svi 18 15:51:33 desktop gnome-shell[8951]: #paperwm enable keybindings
svi 18 15:51:33 desktop gnome-shell[8951]: #paperwm enable scratch
svi 18 15:51:33 desktop gnome-shell[8951]: #paperwm enable liveAltTab
svi 18 15:51:33 desktop gnome-shell[8951]: #paperwm enable utils
svi 18 15:51:33 desktop gnome-shell[8951]: #paperwm enable stackoverlay
svi 18 15:51:33 desktop gnome-shell[8951]: #paperwm enable app
svi 18 15:51:33 desktop gnome-shell[8951]: #paperwm enable kludges
svi 18 15:51:33 desktop gnome-shell[8951]: #paperwm enable topbar
svi 18 15:51:33 desktop gnome-shell[8951]: #paperwm enable settings
svi 18 15:51:33 desktop gnome-shell[8951]: #paperwm enable gestures
svi 18 15:51:33 desktop gnome-shell[8951]: #paperwm enable user
svi 18 15:51:33 desktop gnome-shell[8951]: Window manager warning: Overwriting existing binding of keysym 2f7259c9 with keysym 2f7259c9 (keycode 31).
svi 18 15:51:33 desktop gnome-shell[8951]: Window manager warning: Overwriting existing binding of keysym ff53 with keysym ff53 (keycode 72).
svi 18 15:51:33 desktop gnome-shell[8951]: Window manager warning: Overwriting existing binding of keysym ff1b with keysym ff1b (keycode 9).
svi 18 15:51:33 desktop gnome-shell[8951]: Window manager warning: Overwriting existing binding of keysym ff51 with keysym ff51 (keycode 71).

@jtaala
Copy link
Collaborator Author

jtaala commented May 18, 2023

Hmm - yeah, nothing in the logs there. I just want to rule out branch issues, if you haven't already done so, if you're on the branch, can fully logout/login (or even reboot - gasp) - you're probably aware but disabling/enabling isn't enough after a branch change.

After this, just for testing, I'll get you to fully disable window dragging and see if you're still getting that issue.

@paradajz
Copy link
Contributor

I did log out, no worries, I actually performed system upgrade, pulled the changes, then restarted my PC.

@jtaala
Copy link
Collaborator Author

jtaala commented May 18, 2023

I did log out, no worries, I actually performed system upgrade, pulled the changes, then restarted my PC.

A few other things to check,

  1. check in ~/.local/share/gnome-shell/extensions and make sure only one paperwm symlink is there;
  2. rerun the install.sh script - there's been a few changes to disable a few keybinds that had weird clashes;

if still no luck, can you disable these lines (comment out or delete) in tiling.js:

https://github.com/paperwm/PaperWM/blob/fixes-gnome-44-support/tiling.js#LL1669C1-L1672C67

Then logout/login (or looks like you're on X11 so can do a alt-f2 and type r then press enter).

@jtaala
Copy link
Collaborator Author

jtaala commented May 18, 2023

Just want to double-check, if you're still getting drag issues after that last one then there's something else going on.

@randomvariable
Copy link

Anyone else still seeing these dragging issues?

I've had one issue but no idea how to reproduce it. Got stuck in a state where the scroll wheel would switch between windows horizontally and nothing else. Escape wouldn't get out either, and ultimately had to reboot. Happened once in a whole day.

@cab404
Copy link

cab404 commented May 18, 2023

Anyone else still seeing these dragging issues?

I had experienced them before the clicky drag mode fixes (on 477d546 for sure), but on 477e87a either somehow I don't notice or it is gone

org.gnome.desktop.wm.keybindings switch-group
org.gnome.desktop.wm.keybindings switch-group-backward
org.gnome.desktop.wm.keybindings switch-to-workspace-left
org.gnome.desktop.wm.keybindings switch-to-workspace-right
@paradajz
Copy link
Contributor

Okay - did a total reinstall - wiped everything and started from scratch - so far so good. Hope it stays that way. :) @jtaala your work is unbelievably appreciated here.

@crispinb
Copy link

I've been f/t on the penultimate commit (477e87a) for the last couple of days. All's been good for me (though I only tend to use the mouse to arrange windows in the scratch layer, so may not come across infrequent dragging problems).

@jtaala
Copy link
Collaborator Author

jtaala commented May 18, 2023

Okay - did a total reinstall - wiped everything and started from scratch - so far so good. Hope it stays that way. :) @jtaala your work is unbelievably appreciated here.

This is interesting, @paradajz, could you give us a bit more info on the reinstall - you didn't have to reinstall the OS did you? Was it just a reinstall of PaperWM? (and if so how did you do that - delete the extension (just click the Remove... button from the Extensions app?

What's interesting, is that (I believe) you previously tried this branch on an older commit - and then reverted back to Gnome 43 (since we were still trying to figure out the grabbing issues). If that's the case, it seems that a checkout of that older commit was still symlinked to ~/.local/share/gnome-shell/extensions? I'm just trying to think of possibilities there.

Oh, did you wipe/reset the paperWM gnome settings (in like dconf or something?).

Appreciate any info here so we can record and try to avoid this happening again for others.

@paradajz
Copy link
Contributor

To be honest I'm not sure what happened in my setup but I did had two PaperWM versions in extensions directory - the one from this repo and the other one from your redux fork. Right now I'm not sure what was active. I've removed symlinks for both of them and then reinstalled the extension (not the entire OS :)). So far everything working fine - didn't run into dragging issue since yesterday.

@sebastianheuer
Copy link

Happy to confirm that PaperWM works really well again thanks to all the work you put into this branch and also thanks to all the contributions in forms of feedback and bug reports. I am on Fedora 38 and run Gnome 44 on Xorg. No dragging issues, keybindings work reliably, it's a real pleasure to use it (again :D)!

jtaala added 2 commits May 20, 2023 06:14
…keybinds that used to

clash before fixing keybind clash detection).  Also renamed parameter
for keybind fix to reflect Gtk documentation name better.
@jtaala jtaala merged commit 6b50846 into develop May 19, 2023
@jtaala jtaala deleted the fixes-gnome-44-support branch May 19, 2023 20:58
@jtaala
Copy link
Collaborator Author

jtaala commented May 19, 2023

Big thanks to everyone for helping with Gnome 44 support in PaperWM. It was quite a bit more work than first envisioned (those Clutter grab changes threw us for a loop!).

Much appreciated all.

@letavocado
Copy link

Thanks @jtaala!
You're Awesome! 👓
PaperWM! ❤️

p.s. : merging soon can be removed

@jtaala jtaala removed the merging soon Label for PRs that are planned to be merged soon (usually within the next week) label May 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gnome-44 Specific to GNOME Shell 44
Projects
None yet