Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
scroll_latch.c File Reference
Include dependency graph for scroll_latch.c:

Go to the source code of this file.

Data Structures

struct  dt_scroll_latch_t

Macros

#define DT_SCROLL_LATCH_REST_MS   500
#define DT_SCROLL_LATCH_DRIFT_PX   4.0
#define DT_SCROLL_LATCH_KEY   "dt-scroll-latch"

Typedefs

typedef struct dt_scroll_latch_t dt_scroll_latch_t

Functions

static void _latch_release (dt_scroll_latch_t *latch)
static gboolean _latch_rested (gpointer data)
static gboolean _window_step (GtkWidget *widget, const GdkEventScroll *event, dt_scroll_latch_t *latch)
static void _window_moved (GtkAdjustment *adjustment __attribute__((unused)), gpointer scrolled_window)
static void _step_to_window (dt_scroll_latch_t *latch)
static void _step (GtkEventControllerScroll *controller __attribute__((unused)), gdouble dx __attribute__((unused)), gdouble dy __attribute__((unused)), dt_scroll_latch_t *latch)
static void _step_end (GtkEventControllerScroll *controller __attribute__((unused)), dt_scroll_latch_t *latch)
static void _pointer_moved (GtkEventControllerMotion *controller __attribute__((unused)), gdouble x __attribute__((unused)), gdouble y __attribute__((unused)), dt_scroll_latch_t *latch)
static void _latch_free (gpointer data)
void dt_ui_scroll_latch (GtkWidget *scrolled_window)
 Keep the mouse wheel on scrolled_window once it has started scrolling.

Macro Definition Documentation

◆ DT_SCROLL_LATCH_DRIFT_PX

#define DT_SCROLL_LATCH_DRIFT_PX   4.0

Definition at line 26 of file scroll_latch.c.

Referenced by _pointer_moved().

◆ DT_SCROLL_LATCH_KEY

#define DT_SCROLL_LATCH_KEY   "dt-scroll-latch"

Definition at line 28 of file scroll_latch.c.

Referenced by _window_moved(), and dt_ui_scroll_latch().

◆ DT_SCROLL_LATCH_REST_MS

#define DT_SCROLL_LATCH_REST_MS   500

Definition at line 24 of file scroll_latch.c.

Referenced by _window_moved(), and _window_step().

Typedef Documentation

◆ dt_scroll_latch_t

typedef struct dt_scroll_latch_t dt_scroll_latch_t

Function Documentation

◆ _latch_free()

void _latch_free ( gpointer data)
static

◆ _latch_release()

void _latch_release ( dt_scroll_latch_t * latch)
static

◆ _latch_rested()

gboolean _latch_rested ( gpointer data)
static

Definition at line 48 of file scroll_latch.c.

References _latch_release(), data, and dt_scroll_latch_t::rest.

Referenced by _window_moved(), and _window_step().

◆ _pointer_moved()

void _pointer_moved ( GtkEventControllerMotion *controller __attribute__(unused),
gdouble x __attribute__(unused),
gdouble y __attribute__(unused),
dt_scroll_latch_t * latch )
static

◆ _step()

void _step ( GtkEventControllerScroll *controller __attribute__(unused),
gdouble dx __attribute__(unused),
gdouble dy __attribute__(unused),
dt_scroll_latch_t * latch )
static

Definition at line 92 of file scroll_latch.c.

References _step_to_window().

Referenced by dt_ui_scroll_latch().

◆ _step_end()

void _step_end ( GtkEventControllerScroll *controller __attribute__(unused),
dt_scroll_latch_t * latch )
static

Definition at line 99 of file scroll_latch.c.

References _step_to_window().

Referenced by dt_ui_scroll_latch().

◆ _step_to_window()

void _step_to_window ( dt_scroll_latch_t * latch)
static

Definition at line 84 of file scroll_latch.c.

References IS_NULL_PTR, and dt_scroll_latch_t::scrolled_window.

Referenced by _step(), and _step_end().

◆ _window_moved()

void _window_moved ( GtkAdjustment *adjustment __attribute__(unused),
gpointer scrolled_window )
static

◆ _window_step()

gboolean _window_step ( GtkWidget * widget,
const GdkEventScroll * event,
dt_scroll_latch_t * latch )
static

◆ dt_ui_scroll_latch()

void dt_ui_scroll_latch ( GtkWidget * scrolled_window)

Keep the mouse wheel on scrolled_window once it has started scrolling.

GTK gives each wheel step to the deepest widget under the pointer. While a scrolled window scrolls, its content moves under a still pointer, and the first child that takes the wheel (a graph, a list, a focused slider) stops the scroll and takes the steps that follow. Once scrolled_window has taken a step, every step over its content goes to it, until the wheel rests or the pointer moves.

Parameters
scrolled_windowa GtkScrolledWindow that already has its child: the latch is held on that child.

Definition at line 129 of file scroll_latch.c.

References _latch_free(), _pointer_moved(), _step(), _step_end(), _window_moved(), _window_step(), DT_SCROLL_LATCH_KEY, dt_scroll_latch_t::motion, dt_scroll_latch_t::scrolled_window, and dt_scroll_latch_t::steps.

Referenced by _ui_init_panel_container_center().