Window scrolls too fast in MacOS Sonoma
Describe the bug Window scrolls too fast in MacOS Sonoma
To Reproduce Steps to reproduce the behavior:
- server cmd: xpra start :100 --bind-tcp=0.0.0.0:7999 --ssl=off
- client cmd: xpra attach tcp://xxxx:7999/100 --start=chromium
- The browser window scrolls too fast, unable to use.
System Information (please complete the following information):
- Server OS: Ubuntu 24.04 server
- Client OS: MacOS Sonoma 14.5
- Xpra Server Version: 6.1
- Xpra Client Version: 6.0.1
Additional context The Windows client version 6.1 is okay. The reason I'm using 6.0.1 is when using 6.1 the keyboard can not be recongized. But it's another thread for sure.
xpra start :100 --bind-tcp=0.0.0.0:7999 --ssl=off
ssl=off does nothing if you don't have ssl certificates specified with --ssl-cert=
xpra attach tcp://xxxx:7999/100 --start=chromium
You don't need to specify the display 100 since this is a seamless session with a fixed endpoint (port 7999) - no other displays are available through it.
The reason I'm using 6.0.1 is when using 6.1 the keyboard can not be recognized. But it's another thread for sure.
That's odd, there were no significant changes to the keyboard mapping code in 6.1 Please do file a separate issue.
The browser window scrolls too fast, unable to use.
Is it really scrolling too fast or is the display garbled?
If the latter, running with --encodings=all,-webp might solve this issue.
If the former, please run with -d mouse so we can see what Gtk scroll events it is receiving:
https://github.com/Xpra-org/xpra/blob/6aeb1f93f372f113c26e4636ab59bc58786c98bd/xpra/client/gtk3/window_base.py#L2595-L2610
@totaam Thanks! I digged in to the code. It seems that the server doesn't support precise wheel scrolling, but the MacOS client continue using smooth scrolling. It can be told from the two log entries.
2024-07-27 22:22:12,402 wheel_map(['on'])={4: 4, ......}, wheel_smooth=True
2024-07-27 22:19:04,017 send_wheel_deltas(-1, 1, 6, -1.0, (1146, 856, 1146, 812)
, None) precise wheel=False, modifiers=[], pointer=(1146, 856, 1146, 812)
I also noticed in ./xpra/client/mixins/windows.py:275 if the --mousewheel=coarse, the client will disable smooth wheel.
# mouse wheel:
275 mw = (opts.mousewheel or "").lower().replace("-", "").split(",")
276 if "coarse" in mw:
277 mw.remove("coarse")
278 self.wheel_smooth = False
279 if not any(x in FALSE_OPTIONS for x in mw):
After setting that parameter, it's better. But we lost smooth scrolling (It's like the touchpad scrolling events were intercepted into multiple old style mouse wheel actions). I'm using Ubuntu in a virtual machine as the server. Maybe I need to mock a mouse with precision wheels. Do you have any idea? Thank you so much ~
code link: https://github.com/Xpra-org/xpra/blob/85c7a366008f15b39b6dc527aa9d4649bdfbba6c/xpra/client/mixins/windows.py#L274-L278
This flag is only used here: https://github.com/Xpra-org/xpra/blob/85c7a366008f15b39b6dc527aa9d4649bdfbba6c/xpra/client/gtk3/window_base.py#L385-L389
In turn this allows us to process smooth scroll events here: https://github.com/Xpra-org/xpra/blob/85c7a366008f15b39b6dc527aa9d4649bdfbba6c/xpra/client/gtk3/window_base.py#L2598-L2603
Perhaps the delta_x and delta_y attributes are too large?
Maybe we should disable smooth scrolling if the server doesn't support it?
How about this patch:
diff --git a/xpra/client/gtk3/window_base.py b/xpra/client/gtk3/window_base.py
index 15b59c3294..e9941bdf8c 100644
--- a/xpra/client/gtk3/window_base.py
+++ b/xpra/client/gtk3/window_base.py
@@ -384,7 +384,7 @@ class GTKClientWindowBase(ClientWindowBase, Gtk.Window):
def get_window_event_mask(self) -> Gdk.EventMask:
mask = WINDOW_EVENT_MASK
- if self._client.wheel_smooth:
+ if self._client.wheel_smooth and self._client.server_precise_wheel:
mask |= Gdk.EventMask.SMOOTH_SCROLL_MASK
return mask
@totaam No effect. Event if I comment out this function, the scroll still works. Looks like it is not how it works. I'll continue digging into the code.
Then it is the regular scroll handler that fires and it would be very odd if we needed to normalize these values.
The reason I'm using 6.0.1 is when using 6.1 the keyboard can not be recongized.
Sounds like: https://github.com/Xpra-org/xpra/issues/4360#issuecomment-2380411119 But perhaps for a different reason since you are running a recent enough version of macos?
I was working on another ticket and stumbled upon this code:
https://github.com/Xpra-org/xpra/blob/8441c73ef3f5e913cf4a4521fddcda45901c7543/xpra/platform/darwin/gui.py#L621-L624
Which calls wheel_event_handler from the quartz event filter:
https://github.com/Xpra-org/xpra/blob/8441c73ef3f5e913cf4a4521fddcda45901c7543/xpra/platform/darwin/gdk_bindings.pyx#L90
This commit claims to re-enable the handler: 499116596bda81345c318cd70e8466349f0445de but I think it is still missing from when we moved to GTK3.
When you say "Window scrolls too fast in MacOS Sonoma", did you try older versions?
I don't think we necessarily need to port the old custom wheel handler since Gtk's new "smooth" scrolling handler should do the same thing. But maybe we need to restore this smoothing function: https://github.com/Xpra-org/xpra/blob/8441c73ef3f5e913cf4a4521fddcda45901c7543/xpra/platform/darwin/gui.py#L633-L648 With these values: https://github.com/Xpra-org/xpra/blob/8441c73ef3f5e913cf4a4521fddcda45901c7543/xpra/platform/darwin/gui.py#L48-L49
In the meantime, did you play with these settings: https://github.com/Xpra-org/xpra/blob/154984dc7b423eaf5dc639f62ae42269547abb28/xpra/client/mixins/windows.py#L109-L110 This would give me an idea of what values to use for your version of MacOS.
@seflerZ To make it easier for you to test, cfcbc1ccb95279ed45b7dbeb6d934fddbb9e4e52 adds the XPRA_SMOOTH_SCROLL_NORM environment variable that controls how aggressively we normalize smooth scroll events.
XPRA_SMOOTH_SCROLL_NORM=50 is the default on macos and takes the square root of the value.
XPRA_SMOOTH_SCROLL_NORM=100 is the default on other platforms and leaves the value unchanged.
Lower values normalize even more, and at the extreme end of the scale XPRA_SMOOTH_SCROLL_NORM=0 turns all values into single events.
XPRA_SMOOTH_SCROLL_NORM>100 should probably not be used, ever.
Please try 6.3-r37131 or later builds from the beta area: https://xpra.org/beta/MacOS/
Not heard back and no hardware to use for testing.