Commit d30303b9 authored by Dan Torop's avatar Dan Torop

gtk: turn off smooth scrolling for X11/Quartz

Try to fix reports since dt 2.4 of jittery or too fast scrolling with
trackpad/touch on Quartz and X11. GDK_SMOOTH_SCROLL_MASK needs to be set
for Wayland to receive trackpad/touch events, but for X11 (and
Quartz?) these events are converted to regular scroll events if
GDK_SMOOTH_SCROLL_MASK is not set but GDK_SCROLL_MASK is.

I haven't seen bad scroll behavior for X11, but for safety's sake, am
eliminating this for X11 too.

Fixes #11974.
parent 0a6a32ce
......@@ -549,7 +549,7 @@ void dt_bauhaus_init()
gtk_widget_add_events(darktable.bauhaus->popup_area, GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_KEY_PRESS_MASK | GDK_LEAVE_NOTIFY_MASK
| GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK);
| darktable.gui->scroll_mask);
g_signal_connect(G_OBJECT(darktable.bauhaus->popup_window), "show", G_CALLBACK(dt_bauhaus_window_show), (gpointer)NULL);
g_signal_connect(G_OBJECT(darktable.bauhaus->popup_area), "draw", G_CALLBACK(dt_bauhaus_popup_draw),
......@@ -618,8 +618,7 @@ static void dt_bauhaus_widget_init(dt_bauhaus_widget_t *w, dt_iop_module_t *self
gtk_widget_add_events(GTK_WIDGET(w), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_LEAVE_NOTIFY_MASK | GDK_SCROLL_MASK
| GDK_SMOOTH_SCROLL_MASK);
| GDK_LEAVE_NOTIFY_MASK | darktable.gui->scroll_mask);
g_signal_connect(G_OBJECT(w), "draw", G_CALLBACK(dt_bauhaus_draw), NULL);
......
......@@ -421,7 +421,7 @@ static void _gradient_slider_realize(GtkWidget *widget)
attributes.event_mask = gtk_widget_get_events(widget) | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK
| GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_POINTER_MOTION_MASK
| GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK;
| darktable.gui->scroll_mask;
attributes_mask = GDK_WA_X | GDK_WA_Y;
gtk_widget_set_can_focus(GTK_WIDGET(widget), TRUE);
......
......@@ -40,6 +40,9 @@
#include "views/view.h"
#include <gdk/gdkkeysyms.h>
#ifdef GDK_WINDOWING_WAYLAND
#include <gdk/gdkwayland.h>
#endif
#include <gtk/gtk.h>
#include <math.h>
#include <stdlib.h>
......@@ -979,6 +982,14 @@ int dt_gui_gtk_init(dt_gui_gtk_t *gui)
// Connecting the callback to update keyboard accels for key_pressed
g_signal_connect(G_OBJECT(gtk_accel_map_get()), "changed", G_CALLBACK(key_accel_changed), NULL);
// smooth scrolling must be enabled for Wayland to handle
// trackpad/touch events, but due to problem reports for Quartz &
// X11, leave it off in other cases
gui->scroll_mask = GDK_SCROLL_MASK;
#ifdef GDK_WINDOWING_WAYLAND
if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) gui->scroll_mask |= GDK_SMOOTH_SCROLL_MASK;
#endif
// Initializing widgets
init_widgets(gui);
......@@ -1399,7 +1410,7 @@ static void init_main_table(GtkWidget *container)
gtk_widget_set_app_paintable(cda, TRUE);
gtk_widget_set_events(cda, GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK
| GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK);
| darktable.gui->scroll_mask);
gtk_widget_set_can_focus(cda, TRUE);
gtk_widget_set_visible(cda, TRUE);
......
......@@ -83,6 +83,7 @@ typedef struct dt_gui_gtk_t
GtkWidget *scroll_to[2]; // one for left, one for right
gint scroll_mask;
} dt_gui_gtk_t;
#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 13, 1))
......
......@@ -1684,8 +1684,7 @@ void gui_init(struct dt_iop_module_t *self)
gtk_widget_add_events(GTK_WIDGET(c->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_LEAVE_NOTIFY_MASK | GDK_SCROLL_MASK
| GDK_SMOOTH_SCROLL_MASK);
| GDK_LEAVE_NOTIFY_MASK | darktable.gui->scroll_mask);
g_signal_connect(G_OBJECT(c->area), "draw", G_CALLBACK(area_draw), self);
g_signal_connect(G_OBJECT(c->area), "button-press-event", G_CALLBACK(area_button_press), self);
g_signal_connect(G_OBJECT(c->area), "button-release-event", G_CALLBACK(area_button_release), self);
......
......@@ -1950,7 +1950,7 @@ void gui_init(struct dt_iop_module_t *self)
gtk_widget_add_events(GTK_WIDGET(c->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_LEAVE_NOTIFY_MASK | GDK_SCROLL_MASK
| GDK_SMOOTH_SCROLL_MASK | GDK_KEY_PRESS_MASK);
| darktable.gui->scroll_mask);
gtk_widget_set_can_focus(GTK_WIDGET(c->area), TRUE);
g_signal_connect(G_OBJECT(c->area), "draw", G_CALLBACK(dt_iop_basecurve_draw), self);
g_signal_connect(G_OBJECT(c->area), "button-press-event", G_CALLBACK(dt_iop_basecurve_button_press), self);
......
......@@ -268,7 +268,7 @@ void gui_init(struct dt_iop_module_t *self)
gtk_widget_add_events(GTK_WIDGET(g->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_LEAVE_NOTIFY_MASK | GDK_SCROLL_MASK
| GDK_SMOOTH_SCROLL_MASK | GDK_KEY_PRESS_MASK);
| darktable.gui->scroll_mask);
gtk_widget_set_can_focus(GTK_WIDGET(g->area), TRUE);
g_signal_connect(G_OBJECT(g->area), "draw", G_CALLBACK(dt_iop_colorcorrection_draw), self);
g_signal_connect(G_OBJECT(g->area), "button-press-event", G_CALLBACK(dt_iop_colorcorrection_button_press),
......
......@@ -1113,8 +1113,7 @@ void gui_init(struct dt_iop_module_t *self)
gtk_widget_add_events(GTK_WIDGET(c->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_LEAVE_NOTIFY_MASK | GDK_SCROLL_MASK
| GDK_SMOOTH_SCROLL_MASK);
| GDK_LEAVE_NOTIFY_MASK | darktable.gui->scroll_mask);
g_signal_connect(G_OBJECT(c->area), "draw", G_CALLBACK(colorzones_draw), self);
g_signal_connect(G_OBJECT(c->area), "button-press-event", G_CALLBACK(colorzones_button_press), self);
g_signal_connect(G_OBJECT(c->area), "button-release-event", G_CALLBACK(colorzones_button_release), self);
......
......@@ -369,7 +369,7 @@ void gui_init(struct dt_iop_module_t *self)
gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(c->area), TRUE, TRUE, 0);
gtk_widget_set_size_request(GTK_WIDGET(c->area), 195, 195);
gtk_widget_add_events(GTK_WIDGET(c->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK);
gtk_widget_add_events(GTK_WIDGET(c->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK | darktable.gui.scroll_mask);
g_signal_connect (G_OBJECT (c->area), "draw",
G_CALLBACK (dt_iop_equalizer_expose), self);
g_signal_connect (G_OBJECT (c->area), "button-press-event",
......
......@@ -588,8 +588,7 @@ void gui_init(dt_iop_module_t *self)
gtk_widget_add_events(GTK_WIDGET(c->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_LEAVE_NOTIFY_MASK | GDK_SCROLL_MASK
| GDK_SMOOTH_SCROLL_MASK);
| GDK_LEAVE_NOTIFY_MASK | darktable.gui->scroll_mask);
g_signal_connect(G_OBJECT(c->area), "draw", G_CALLBACK(dt_iop_levels_area_draw), self);
g_signal_connect(G_OBJECT(c->area), "button-press-event", G_CALLBACK(dt_iop_levels_button_press), self);
g_signal_connect(G_OBJECT(c->area), "button-release-event", G_CALLBACK(dt_iop_levels_button_release), self);
......
......@@ -840,8 +840,7 @@ void gui_init(struct dt_iop_module_t *self)
gtk_widget_add_events(GTK_WIDGET(c->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_LEAVE_NOTIFY_MASK | GDK_SCROLL_MASK
| GDK_SMOOTH_SCROLL_MASK);
| GDK_LEAVE_NOTIFY_MASK | darktable.gui->scroll_mask);
g_signal_connect(G_OBJECT(c->area), "draw", G_CALLBACK(lowlight_draw), self);
g_signal_connect(G_OBJECT(c->area), "button-press-event", G_CALLBACK(lowlight_button_press), self);
g_signal_connect(G_OBJECT(c->area), "button-release-event", G_CALLBACK(lowlight_button_release), self);
......
......@@ -592,8 +592,7 @@ void gui_init(struct dt_iop_module_t *self)
gtk_widget_add_events(GTK_WIDGET(g->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_LEAVE_NOTIFY_MASK | GDK_SCROLL_MASK
| GDK_SMOOTH_SCROLL_MASK);
| GDK_LEAVE_NOTIFY_MASK | darktable.gui->scroll_mask);
g_signal_connect(G_OBJECT(g->area), "draw", G_CALLBACK(dt_iop_monochrome_draw), self);
g_signal_connect(G_OBJECT(g->area), "button-press-event", G_CALLBACK(dt_iop_monochrome_button_press), self);
g_signal_connect(G_OBJECT(g->area), "button-release-event", G_CALLBACK(dt_iop_monochrome_button_release),
......
......@@ -948,7 +948,7 @@ void gui_init(struct dt_iop_module_t *self)
gtk_widget_add_events(GTK_WIDGET(c->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_LEAVE_NOTIFY_MASK | GDK_SCROLL_MASK
| GDK_SMOOTH_SCROLL_MASK | GDK_KEY_PRESS_MASK);
| darktable.gui->scroll_mask);
gtk_widget_set_can_focus(GTK_WIDGET(c->area), TRUE);
g_signal_connect(G_OBJECT(c->area), "draw", G_CALLBACK(dt_iop_tonecurve_draw), self);
g_signal_connect(G_OBJECT(c->area), "button-press-event", G_CALLBACK(dt_iop_tonecurve_button_press), self);
......
......@@ -553,8 +553,7 @@ void gui_init(struct dt_iop_module_t *self)
g_signal_connect(G_OBJECT(g->zones), "scroll-event", G_CALLBACK(dt_iop_zonesystem_bar_scrolled), self);
gtk_widget_add_events(GTK_WIDGET(g->zones), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_LEAVE_NOTIFY_MASK | GDK_SCROLL_MASK
| GDK_SMOOTH_SCROLL_MASK);
| GDK_LEAVE_NOTIFY_MASK | darktable.gui->scroll_mask);
gtk_widget_set_size_request(g->zones, -1, DT_PIXEL_APPLY_DPI(40));
gtk_box_pack_start(GTK_BOX(self->widget), g->preview, TRUE, TRUE, 0);
......
......@@ -129,7 +129,7 @@ void gui_init(dt_lib_module_t *self)
gtk_widget_add_events(self->widget, GDK_LEAVE_NOTIFY_MASK | GDK_ENTER_NOTIFY_MASK | GDK_POINTER_MOTION_MASK
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
// GDK_STRUCTURE_MASK |
GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK);
darktable.gui->scroll_mask);
/* connect callbacks */
gtk_widget_set_tooltip_text(self->widget, _("drag to change exposure,\ndoubleclick resets"));
......
......@@ -312,7 +312,7 @@ void gui_init(dt_lib_module_t *self)
gtk_widget_add_events(d->filmstrip, GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK
| darktable.gui->scroll_mask
| GDK_LEAVE_NOTIFY_MASK);
/* connect callbacks */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment