Get double-click time from GTK API instead of hard-coded value 250.
authorwwp <subscript@free.fr>
Wed, 2 Oct 2019 11:40:20 +0000 (13:40 +0200)
committerwwp <subscript@free.fr>
Wed, 2 Oct 2019 11:40:20 +0000 (13:40 +0200)
src/mimeview.c

index edc768dd61c0c5d089f885454d2a438430a792fb..2bb967ca660a81556427b38e4d58c72edd30a0df 100644 (file)
@@ -1528,6 +1528,7 @@ static gboolean mimeview_scrolled(GtkWidget *widget, GdkEventScroll *event,
        return TRUE;
 }
 
+#include "gdk/gdkscreen.h"
 /* from gdkevents.c */
 #define DOUBLE_CLICK_TIME 250
 
@@ -1537,8 +1538,11 @@ static gboolean part_button_pressed(MimeView *mimeview, GdkEventButton *event,
        static MimeInfo *lastinfo;
        static guint32 lasttime;
 
+       gint double_click_time;
+       g_object_get(gtk_settings_get_default(), "gtk-double-click-time", &double_click_time, NULL);
+
        if (event->button == 2 ||
-           (event->button == 1 && (event->time - lasttime) < DOUBLE_CLICK_TIME && lastinfo == partinfo)) {
+           (event->button == 1 && (event->time - lasttime) < double_click_time && lastinfo == partinfo)) {
                /* call external program for image, audio or html */
                mimeview_launch(mimeview, partinfo);
                return TRUE;