[gnome-shell/wip/carlosg/cleanup-gtk-usage: 9/12] 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: 9/12] dnd: Use GSettings instead of GtkSettings
- Date: Wed, 28 Nov 2018 16:51:08 +0000 (UTC)
commit 9e1e832e290f078fd0a8611b4fe7947e2f946122
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 8483e89fc..5c79b5902 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 Lang = imports.lang;
const Meta = imports.gi.Meta;
@@ -112,6 +112,12 @@ var _Draggable = new Lang.Class({
this._dragCancellable = true;
this._eventsGrabbed = false;
+
+ 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) {
@@ -401,9 +407,8 @@ var _Draggable = new Lang.Class({
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 ((Math.abs(stageX - this._dragStartX) > threshold ||
- Math.abs(stageY - this._dragStartY) > threshold)) {
+ if ((Math.abs(stageX - this._dragStartX) > this._dragThreshold ||
+ Math.abs(stageY - this._dragStartY) > this._dragThreshold)) {
this.startDrag(stageX, stageY, event.get_time(), this._touchSequence);
this._updateDragPosition(event);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]