[gnome-shell/wip/carlosg/cleanup-gtk-usage: 12/17] dnd: Use StSettings instead of GtkSettings



commit 5cfba8fc77ed7d9e44010ad3220c161d6c6e3b23
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Nov 27 14:42:43 2018 +0100

    dnd: Use StSettings instead of GtkSettings
    
    Cut a middle man by listening to dconf settings directly, and stop relying
    on XSettings for it.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/317

 js/ui/dnd.js | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index 07c19202a..d77aee976 100644
--- a/js/ui/dnd.js
+++ b/js/ui/dnd.js
@@ -1,8 +1,8 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 
 const Clutter = imports.gi.Clutter;
+const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
-const Gtk = imports.gi.Gtk;
 const St = imports.gi.St;
 const Meta = imports.gi.Meta;
 const Shell = imports.gi.Shell;
@@ -110,6 +110,12 @@ var _Draggable = class _Draggable {
 
         this._eventsGrabbed = false;
         this._capturedEventId = 0;
+
+        this._settings = St.Settings.get();
+        this._settings.connect ('notify::drag-threshold', () => {
+            this._dragThreshold = this._settings.drag_threshold;
+        });
+        this._dragThreshold = this._settings.drag_threshold;
     }
 
     _onButtonPress(actor, event) {
@@ -442,10 +448,9 @@ var _Draggable = class _Draggable {
         let [stageX, stageY] = event.get_coords();
 
         // See if the user has moved the mouse enough to trigger a drag
-        let threshold = Gtk.Settings.get_default().gtk_dnd_drag_threshold;
         if (!currentDraggable &&
-            (Math.abs(stageX - this._dragStartX) > threshold ||
-             Math.abs(stageY - this._dragStartY) > threshold)) {
+            (Math.abs(stageX - this._dragStartX) > this._dragThreshold ||
+             Math.abs(stageY - this._dragStartY) > this._dragThreshold)) {
             this.startDrag(stageX, stageY, event.get_time(), this._touchSequence, event.get_device());
             this._updateDragPosition(event);
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]