diff --git a/src/core/prefs.c b/src/core/prefs.c index 3e04ccec8..af2e2063c 100644 --- a/src/core/prefs.c +++ b/src/core/prefs.c @@ -67,6 +67,7 @@ #define SCHEMA_INTERFACE "org.gnome.desktop.interface" #define SCHEMA_INPUT_SOURCES "org.gnome.desktop.input-sources" #define SCHEMA_XSETTINGS "org.gnome.settings-daemon.plugins.xsettings" +#define SCHEMA_MOUSE "org.gnome.settings-daemon.peripherals.mouse" #define SETTINGS(s) g_hash_table_lookup (settings_schemas, (s)) @@ -101,6 +102,7 @@ static gboolean gnome_animations = TRUE; static char *cursor_theme = NULL; static int cursor_size = 24; static int draggable_border_width = 10; +static int drag_threshold; static gboolean resize_with_right_button = FALSE; static gboolean edge_tiling = FALSE; static gboolean force_fullscreen = TRUE; @@ -492,6 +494,13 @@ static MetaIntPreference preferences_int[] = }, &draggable_border_width }, + { + { "drag-threshold", + SCHEMA_MOUSE, + META_PREF_DRAG_THRESHOLD, + }, + &drag_threshold + }, { { NULL, 0, 0 }, NULL }, }; @@ -1924,6 +1933,9 @@ meta_preference_to_string (MetaPreference pref) case META_PREF_DRAGGABLE_BORDER_WIDTH: return "DRAGGABLE_BORDER_WIDTH"; + case META_PREF_DRAG_THRESHOLD: + return "DRAG_TRHESHOLD"; + case META_PREF_DYNAMIC_WORKSPACES: return "DYNAMIC_WORKSPACES"; @@ -2389,6 +2401,12 @@ meta_prefs_get_draggable_border_width (void) return draggable_border_width; } +int +meta_prefs_get_drag_threshold (void) +{ + return drag_threshold; +} + void meta_prefs_set_force_fullscreen (gboolean whether) { diff --git a/src/core/window.c b/src/core/window.c index fcb06aca2..9aa250885 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -5534,7 +5534,7 @@ update_move (MetaWindow *window, * because it's about the right size */ #define DRAG_THRESHOLD_TO_SHAKE_THRESHOLD_FACTOR 6 - shake_threshold = meta_ui_get_drag_threshold (window->screen->ui) * + shake_threshold = meta_prefs_get_drag_threshold () * DRAG_THRESHOLD_TO_SHAKE_THRESHOLD_FACTOR; if (snap) @@ -5726,7 +5726,7 @@ check_resize_unmaximize(MetaWindow *window, #define DRAG_THRESHOLD_TO_RESIZE_THRESHOLD_FACTOR 3 - threshold = meta_ui_get_drag_threshold (window->screen->ui) * + threshold = meta_prefs_get_drag_threshold () * DRAG_THRESHOLD_TO_RESIZE_THRESHOLD_FACTOR; new_unmaximize = 0; diff --git a/src/meta/prefs.h b/src/meta/prefs.h index a0b4a1d4f..dac81c332 100644 --- a/src/meta/prefs.h +++ b/src/meta/prefs.h @@ -102,7 +102,8 @@ typedef enum META_PREF_WORKSPACES_ONLY_ON_PRIMARY, META_PREF_DRAGGABLE_BORDER_WIDTH, META_PREF_AUTO_MAXIMIZE, - META_PREF_CENTER_NEW_WINDOWS + META_PREF_CENTER_NEW_WINDOWS, + META_PREF_DRAG_THRESHOLD, } MetaPreference; typedef void (* MetaPrefsChangedFunc) (MetaPreference pref, @@ -166,6 +167,7 @@ void meta_prefs_set_force_fullscreen (gboolean whether); gboolean meta_prefs_get_workspaces_only_on_primary (void); int meta_prefs_get_draggable_border_width (void); +int meta_prefs_get_drag_threshold (void); gboolean meta_prefs_get_ignore_request_hide_titlebar (void); void meta_prefs_set_ignore_request_hide_titlebar (gboolean whether); diff --git a/src/ui/ui.c b/src/ui/ui.c index 0328572db..d6fbb80e1 100644 --- a/src/ui/ui.c +++ b/src/ui/ui.c @@ -654,20 +654,6 @@ meta_ui_window_is_widget (MetaUI *ui, return FALSE; } -int -meta_ui_get_drag_threshold (MetaUI *ui) -{ - GtkSettings *settings; - int threshold; - - settings = gtk_widget_get_settings (GTK_WIDGET (ui->frames)); - - threshold = 8; - g_object_get (G_OBJECT (settings), "gtk-dnd-drag-threshold", &threshold, NULL); - - return threshold; -} - MetaUIDirection meta_ui_get_direction (void) { diff --git a/src/ui/ui.h b/src/ui/ui.h index 9bb332cf3..71902953b 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -123,8 +123,6 @@ gboolean meta_ui_have_a_theme (void); gboolean meta_ui_window_is_widget (MetaUI *ui, Window xwindow); -int meta_ui_get_drag_threshold (MetaUI *ui); - MetaUIDirection meta_ui_get_direction (void); #endif