Skip to content

Commit

Permalink
#3127 listen for smooth scroll events
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed May 15, 2021
1 parent ed5f289 commit ec51fd9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion xpra/client/gtk_base/gtk_client_window_base.py
Expand Up @@ -36,7 +36,7 @@
DEST_DEFAULT_MOTION, DEST_DEFAULT_HIGHLIGHT, ACTION_COPY,
BUTTON_PRESS_MASK, BUTTON_RELEASE_MASK, POINTER_MOTION_MASK,
POINTER_MOTION_HINT_MASK, ENTER_NOTIFY_MASK, LEAVE_NOTIFY_MASK,
WINDOW_EVENT_MASK,
WINDOW_EVENT_MASK, SMOOTH_SCROLL_MASK,
)
from xpra.gtk_common.keymap import KEY_TRANSLATIONS
from xpra.client.client_window_base import ClientWindowBase
Expand Down Expand Up @@ -2121,6 +2121,10 @@ def get_mouse_event_wid(self, x, y):
def _do_scroll_event(self, event):
if self._client.readonly:
return
if SMOOTH_SCROLL_MASK and event.direction==SMOOTH_SCROLL_MASK:
mouselog("smooth scroll event: %s", event)
self._client.wheel_event(self._id, event.delta_x, event.delta_y)
return
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)
Expand Down
2 changes: 2 additions & 0 deletions xpra/gtk_common/gtk_util.py
Expand Up @@ -283,6 +283,7 @@ def pixbuf_new_from_data(*args):
SUBSTRUCTURE_MASK = gdk.EventMask.SUBSTRUCTURE_MASK
STRUCTURE_MASK = gdk.EventMask.STRUCTURE_MASK
EXPOSURE_MASK = gdk.EventMask.EXPOSURE_MASK
SMOOTH_SCROLL_MASK = gdk.EventMask.SMOOTH_SCROLL_MASK
ACCEL_LOCKED = gtk.AccelFlags.LOCKED
ACCEL_VISIBLE = gtk.AccelFlags.VISIBLE
JUSTIFY_LEFT = gtk.Justification.LEFT
Expand Down Expand Up @@ -584,6 +585,7 @@ def cairo_set_source_pixbuf(cr, pixbuf, x, y):
SUBSTRUCTURE_MASK = gdk.SUBSTRUCTURE_MASK
STRUCTURE_MASK = gdk.STRUCTURE_MASK
EXPOSURE_MASK = gdk.EXPOSURE_MASK
SMOOTH_SCROLL_MASK = 0
ACCEL_LOCKED = gtk.ACCEL_LOCKED
ACCEL_VISIBLE = gtk.ACCEL_VISIBLE
JUSTIFY_LEFT = gtk.JUSTIFY_LEFT
Expand Down

0 comments on commit ec51fd9

Please sign in to comment.