[gnome-shell/wip/carlosg/cleanup-gtk-usage: 16/19] dnd: Use GSettings instead of GtkSettings
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/cleanup-gtk-usage: 16/19] dnd: Use GSettings instead of GtkSettings
- Date: Sun, 27 Jan 2019 10:44:29 +0000 (UTC)
commit 2bdb7141d8ab48b3754b30c066bd97e0a4d4b3bb
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Nov 27 14:42:43 2018 +0100
dnd: Use GSettings instead of GtkSettings
Cut a middle man by listening to dconf settings directly, and stop relying
on XSettings for it.
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 8bffeb408..7ef936815 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 = new Gio.Settings({ schema_id: 'org.gnome.settings-daemon.peripherals.mouse' });
+ this._settings.connect ('changed::drag-threshold', () => {
+ this._dragThreshold = this._settings.get_int('drag-threshold');
+ });
+ this._dragThreshold = this._settings.get_int('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]