diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2023-11-13 16:39:03 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2023-11-13 16:39:03 +0100 |
| commit | 52f6b6abbb9c5438efba270f8dfff6d2759a0f89 (patch) | |
| tree | 7eafa23ebce01d4a7ac2a3402df82ec0100a997c /libdecor | |
| parent | d32de2fc14a507b7a15279546c892b57c175e9bd (diff) | |
Libdecor GTK plugin: use gnome value for doubleclick time
Diffstat (limited to 'libdecor')
| -rw-r--r-- | libdecor/build/fl_libdecor-plugins.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libdecor/build/fl_libdecor-plugins.c b/libdecor/build/fl_libdecor-plugins.c index e25f79285..0f7e2fe34 100644 --- a/libdecor/build/fl_libdecor-plugins.c +++ b/libdecor/build/fl_libdecor-plugins.c @@ -328,6 +328,7 @@ unsigned char *fl_libdecor_titlebar_buffer(struct libdecor_frame *frame, # include "gtk-shell-client-protocol.h" static struct gtk_shell1 *gtk_shell = NULL; +static uint32_t doubleclick_time = 250; // libdecor's button member of wl_pointer_listener objects static void (*decor_pointer_button)(void*, struct wl_pointer *, @@ -367,9 +368,8 @@ static void fltk_pointer_button(void *data, gtk_surface1_release(gtk_surface); return; } else if (button == BTN_LEFT && state == WL_POINTER_BUTTON_STATE_PRESSED) { - static uint32_t previous_click = 0; - if (previous_click && time - previous_click < 250) { // < 0.25 sec for dble clicks - previous_click = 0; + if (time - seat->pointer_button_time_stamp < doubleclick_time) { + seat->pointer_button_time_stamp = 0; struct gtk_surface1 *gtk_surface = gtk_shell1_get_gtk_surface(gtk_shell, frame_gtk->headerbar.wl_surface); gtk_surface1_titlebar_gesture(gtk_surface, serial, @@ -377,7 +377,6 @@ static void fltk_pointer_button(void *data, gtk_surface1_release(gtk_surface); return; } - previous_click = time; } decor_pointer_button(data, wl_pointer, serial, time, button, state); } @@ -417,6 +416,8 @@ void use_FLTK_pointer_button(struct libdecor_frame *frame) { fltk_listener->button = fltk_pointer_button; // replace the pointer listener by a copy whose button member is FLTK's object->implementation = fltk_listener; + // get gnome's double_click_time_ms value + doubleclick_time = lfg->plugin_gtk->double_click_time_ms; #endif // HAVE_GTK && !USE_SYSTEM_LIBDECOR } |
