Xpra-org / xpra

Persistent remote applications for X11; screen sharing for X11, MacOS and MSWindows.
https://xpra.org/
GNU General Public License v2.0
1.97k stars 169 forks source link

Window scrolls too fast in MacOS Sonoma #4309

Open seflerZ opened 3 months ago

seflerZ commented 3 months ago

Describe the bug Window scrolls too fast in MacOS Sonoma

To Reproduce Steps to reproduce the behavior:

  1. server cmd: xpra start :100 --bind-tcp=0.0.0.0:7999 --ssl=off
  2. client cmd: xpra attach tcp://xxxx:7999/100 --start=chromium
  3. The browser window scrolls too fast, unable to use.

System Information (please complete the following information):

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.

totaam commented 3 months ago

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

seflerZ commented 3 months ago

@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 ~

totaam commented 3 months ago

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?

totaam commented 3 months ago

Maybe we should disable smooth scrolling if the server doesn't support it?

totaam commented 3 months ago

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
seflerZ commented 3 months ago

@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.

totaam commented 3 months ago

Then it is the regular scroll handler that fires and it would be very odd if we needed to normalize these values.

totaam commented 2 weeks ago

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?