From 2b1624b83173ca1fee4cbba351cf02269e4d0d25 Mon Sep 17 00:00:00 2001 From: Gregor Niehl Date: Sat, 20 Apr 2024 19:04:59 +0200 Subject: [PATCH 1/3] touch: Remove 3-finger gestures This was talked about in the GNOME Design Matrix room recently. 3-finger gestures interfere with apps, and also aren't really an intuitive way to interact with a touchscreen. --- js/ui/swipeTracker.js | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/js/ui/swipeTracker.js b/js/ui/swipeTracker.js index cef904c05..14f7ba289 100644 --- a/js/ui/swipeTracker.js +++ b/js/ui/swipeTracker.js @@ -477,19 +477,6 @@ export const SwipeTracker = GObject.registerClass({ this.bind_property('orientation', this._touchpadGesture, 'orientation', GObject.BindingFlags.SYNC_CREATE); - this._touchGesture = new TouchSwipeGesture(allowedModes, - GESTURE_FINGER_COUNT, - Clutter.GestureTriggerEdge.AFTER); - this._touchGesture.connect('begin', this._beginTouchSwipe.bind(this)); - this._touchGesture.connect('update', this._updateGesture.bind(this)); - this._touchGesture.connect('end', this._endTouchGesture.bind(this)); - this._touchGesture.connect('cancel', this._cancelTouchGesture.bind(this)); - this.bind_property('enabled', this._touchGesture, 'enabled', 0); - this.bind_property('orientation', this._touchGesture, 'orientation', - GObject.BindingFlags.SYNC_CREATE); - this.bind_property('distance', this._touchGesture, 'distance', 0); - global.stage.add_action_full('swipe', Clutter.EventPhase.CAPTURE, this._touchGesture); - if (params.allowDrag) { this._dragGesture = new TouchSwipeGesture(allowedModes, 1, Clutter.GestureTriggerEdge.AFTER); @@ -774,10 +761,5 @@ export const SwipeTracker = GObject.registerClass({ this._touchpadGesture.destroy(); delete this._touchpadGesture; } - - if (this._touchGesture) { - global.stage.remove_action(this._touchGesture); - delete this._touchGesture; - } } }); From 50c40531fb384e4013e1c35f398ed9aa8995b6f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 5 Mar 2024 20:37:15 +0100 Subject: [PATCH 2/3] cleanup: Don't use substring to check prefix String.prototype.startsWith() is more idiomatic in that case. Part-of: --- js/ui/notificationDaemon.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js index 71d8e6cc5..ff4c26caf 100644 --- a/js/ui/notificationDaemon.js +++ b/js/ui/notificationDaemon.js @@ -63,9 +63,9 @@ class FdoNotificationDaemon { _iconForNotificationData(icon) { if (icon) { - if (icon.substr(0, 7) === 'file://') + if (icon.startsWith('file://')) return new Gio.FileIcon({file: Gio.File.new_for_uri(icon)}); - else if (icon[0] === '/') + else if (icon.startsWith('/')) return new Gio.FileIcon({file: Gio.File.new_for_path(icon)}); else return new Gio.ThemedIcon({name: icon}); From 236cc3e8c0ac94a1f85ae46f05a3825494fa1fd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 5 Mar 2024 20:20:49 +0100 Subject: [PATCH 3/3] cleanup: Replace deprecated String.prototype.substr() The method is documented as deprecated: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr Switch to the non-deprecated substring() method. Part-of: --- js/misc/dbusUtils.js | 2 +- js/ui/calendar.js | 2 +- js/ui/messageList.js | 6 +++--- js/ui/runDialog.js | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/js/misc/dbusUtils.js b/js/misc/dbusUtils.js index 2813de2a7..6e15f9e14 100644 --- a/js/misc/dbusUtils.js +++ b/js/misc/dbusUtils.js @@ -62,6 +62,6 @@ export function loadSubInterfaceXML(iface, ifaceFile) { return ( xmlHeader + - xml.substr(ifaceStartIndex, ifaceEndIndex - ifaceStartIndex) + + xml.substring(ifaceStartIndex, ifaceEndIndex) + xmlFooter); } diff --git a/js/ui/calendar.js b/js/ui/calendar.js index fa683de0c..43079ed6d 100644 --- a/js/ui/calendar.js +++ b/js/ui/calendar.js @@ -319,7 +319,7 @@ class DBusEventSource extends EventSourceBase { let event = new CalendarEvent(id, date, end, summary); /* It's a recurring event */ if (!id.endsWith('\n')) { - const parentId = id.substr(0, id.lastIndexOf('\n') + 1); + const parentId = id.substring(0, id.lastIndexOf('\n') + 1); if (!handledRemovals.has(parentId)) { handledRemovals.add(parentId); this._removeMatching(parentId); diff --git a/js/ui/messageList.js b/js/ui/messageList.js index acc503319..dda9f22a9 100644 --- a/js/ui/messageList.js +++ b/js/ui/messageList.js @@ -57,7 +57,7 @@ class URLHighlighter extends St.Label { this.connect('style-changed', () => { let [hasColor, color] = this.get_theme_node().lookup_color('link-color', false); if (hasColor) { - let linkColor = color.to_string().substr(0, 7); + let linkColor = color.to_string().substring(0, 7); if (linkColor !== this._linkColor) { this._linkColor = linkColor; this._highlightUrls(); @@ -143,11 +143,11 @@ class URLHighlighter extends St.Label { let pos = 0; for (let i = 0; i < urls.length; i++) { let url = urls[i]; - let str = this._text.substr(pos, url.pos - pos); + let str = this._text.substring(pos, url.pos); markup += `${str}${url.url}`; pos = url.pos + url.url.length; } - markup += this._text.substr(pos); + markup += this._text.substring(pos); this.clutter_text.set_markup(markup); } diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js index 667608796..29a015b16 100644 --- a/js/ui/runDialog.js +++ b/js/ui/runDialog.js @@ -107,7 +107,7 @@ class RunDialog extends ModalDialog.ModalDialog { if (text.lastIndexOf(' ') === -1) prefix = text; else - prefix = text.substr(text.lastIndexOf(' ') + 1); + prefix = text.substring(text.lastIndexOf(' ') + 1); let postfix = this._getCompletion(prefix); if (postfix != null && postfix.length > 0) { o.insert_text(postfix, -1); @@ -143,7 +143,7 @@ class RunDialog extends ModalDialog.ModalDialog { } if (k === 0) return ''; - return s1.substr(0, k); + return s1.substring(0, k); } let paths = GLib.getenv('PATH').split(':'); @@ -172,7 +172,7 @@ class RunDialog extends ModalDialog.ModalDialog { return null; let common = results.reduce(_getCommon, null); - return common.substr(text.length); + return common.substring(text.length); } _getCompletion(text) {