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

Window scrolls too fast in MacOS Sonoma #4309

Open
seflerZ opened this issue Jul 26, 2024 · 8 comments
Open

Window scrolls too fast in MacOS Sonoma #4309

seflerZ opened this issue Jul 26, 2024 · 8 comments
Labels
bug Something isn't working client macos

Comments

@seflerZ
Copy link

seflerZ commented Jul 26, 2024

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):

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

@seflerZ seflerZ added the bug Something isn't working label Jul 26, 2024
@totaam
Copy link
Collaborator

totaam commented Jul 27, 2024

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:

def _do_scroll_event(self, event) -> bool:
if self._client.readonly:
return True
if event.direction == Gdk.ScrollDirection.SMOOTH:
mouselog("smooth scroll event: %s", event)
pointer = self.get_pointer_data(event)
device_id = -1
self._client.wheel_event(device_id, self.wid, event.delta_x, -event.delta_y, pointer)
return True
button_mapping = GDK_SCROLL_MAP.get(event.direction, -1)
mouselog("do_scroll_event device=%s, direction=%s, button_mapping=%s",
self._device_info(event), event.direction, button_mapping)
if button_mapping >= 0:
self._button_action(button_mapping, event, True)
self._button_action(button_mapping, event, False)
return True

@seflerZ
Copy link
Author

seflerZ commented Jul 27, 2024

@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
Copy link
Collaborator

totaam commented Jul 27, 2024

code link:

# mouse wheel:
mw = (opts.mousewheel or "").lower().replace("-", "").split(",")
if "coarse" in mw:
mw.remove("coarse")
self.wheel_smooth = False

This flag is only used here:

def get_window_event_mask(self) -> Gdk.EventMask:
mask = WINDOW_EVENT_MASK
if self._client.wheel_smooth:
mask |= Gdk.EventMask.SMOOTH_SCROLL_MASK
return mask

In turn this allows us to process smooth scroll events here:

if event.direction == Gdk.ScrollDirection.SMOOTH:
mouselog("smooth scroll event: %s", event)
pointer = self.get_pointer_data(event)
device_id = -1
self._client.wheel_event(device_id, self.wid, event.delta_x, -event.delta_y, pointer)
return True

Perhaps the delta_x and delta_y attributes are too large?

@totaam
Copy link
Collaborator

totaam commented Jul 27, 2024

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

@totaam
Copy link
Collaborator

totaam commented Jul 27, 2024

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
Copy link
Author

seflerZ commented Jul 29, 2024

@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
Copy link
Collaborator

totaam commented Jul 29, 2024

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

@totaam
Copy link
Collaborator

totaam commented Oct 12, 2024

The reason I'm using 6.0.1 is when using 6.1 the keyboard can not be recongized.

Sounds like: #4360 (comment)
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:

if WHEEL and PYTHON2:
from xpra.platform.darwin.gdk_bindings import init_quartz_filter, set_wheel_event_handler #@UnresolvedImport
set_wheel_event_handler(self.wheel_event_handler)
init_quartz_filter()

Which calls wheel_event_handler from the quartz event filter:
if event_type==NSScrollWheel:

This commit claims to re-enable the handler: 4991165 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working client macos
Projects
None yet
Development

No branches or pull requests

2 participants