24#define DT_SCROLL_LATCH_REST_MS 500
26#define DT_SCROLL_LATCH_DRIFT_PX 4.0
28#define DT_SCROLL_LATCH_KEY "dt-scroll-latch"
42 gtk_event_controller_set_propagation_phase(latch->
steps, GTK_PHASE_NONE);
43 gtk_event_controller_set_propagation_phase(latch->
motion, GTK_PHASE_NONE);
44 if(latch->
rest) g_source_remove(latch->
rest);
53 return G_SOURCE_REMOVE;
60 GtkScrolledWindow *
window = GTK_SCROLLED_WINDOW(widget);
61 if(!gtk_widget_get_child_visible(gtk_scrolled_window_get_vscrollbar(
window))
62 && !gtk_widget_get_child_visible(gtk_scrolled_window_get_hscrollbar(
window)))
65 latch->
x_root =
event->x_root;
66 latch->
y_root =
event->y_root;
67 gtk_event_controller_set_propagation_phase(latch->
steps, GTK_PHASE_CAPTURE);
68 gtk_event_controller_set_propagation_phase(latch->
motion, GTK_PHASE_CAPTURE);
69 if(latch->
rest) g_source_remove(latch->
rest);
78 if(latch->
rest == 0)
return;
79 g_source_remove(latch->
rest);
86 GdkEvent *
event = gtk_get_current_event();
89 gdk_event_free(event);
108 GdkEvent *
event = gtk_get_current_event();
110 gdouble x_root = 0.0;
111 gdouble y_root = 0.0;
112 gdk_event_get_root_coords(event, &x_root, &y_root);
113 gdk_event_free(event);
115 const gdouble dx = x_root - latch->
x_root;
116 const gdouble dy = y_root - latch->
y_root;
123 if(latch->
rest) g_source_remove(latch->
rest);
124 g_object_unref(latch->
steps);
125 g_object_unref(latch->
motion);
131 GtkWidget *child = gtk_bin_get_child(GTK_BIN(scrolled_window));
139 latch->
steps = gtk_event_controller_scroll_new(child, GTK_EVENT_CONTROLLER_SCROLL_BOTH_AXES);
140 gtk_event_controller_set_propagation_phase(latch->
steps, GTK_PHASE_NONE);
141 g_signal_connect(G_OBJECT(latch->
steps),
"scroll", G_CALLBACK(
_step), latch);
142 g_signal_connect(G_OBJECT(latch->
steps),
"scroll-end", G_CALLBACK(
_step_end), latch);
144 latch->
motion = gtk_event_controller_motion_new(child);
145 gtk_event_controller_set_propagation_phase(latch->
motion, GTK_PHASE_NONE);
146 gtk_widget_add_events(child, GDK_POINTER_MOTION_MASK);
149 g_signal_connect(G_OBJECT(scrolled_window),
"scroll-event", G_CALLBACK(
_window_step), latch);
150 g_signal_connect_object(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scrolled_window)),
"value-changed",
152 g_signal_connect_object(gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(scrolled_window)),
"value-changed",
struct _GtkWidget GtkWidget
GtkWidget, opaque, spelled exactly as GTK spells it.
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
#define dt_free(ptr)
g_free() ptr and set it to NULL, skipping both if it is already NULL.
float dt_aligned_pixel_simd_t __attribute__((vector_size(16), aligned(16)))
Apply one channel's tone curve to each of the three colour channels, or pass the channel through unto...