From 272c770815e2ef7719b73d698eb1d2b9f8a134d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Fri, 9 Dec 2022 20:15:29 +0100 Subject: [PATCH] Revert "appDisplay: Bring back drag overshoot region" With MR https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335, the page navigation in the app grid was redone and prominent, always visible navigation arrows were added. This larger change in the navigation of the app grid also involved changes to the drag and drop behavior. Before those changes (in GNOME 42), switching pages during DND in the app grid worked like this: By "bumping" the cursor against the monitor/appGrid edge, an immediate page switch would be triggered. Leaving the cursor in that edge area would then trigger repeated page switches every second. By repeating the "bump" gesture (moving cursor back into the grid, then "bumping" against the edge again), it was possible to switch pages even faster than every second. When adding the always visible navigation arrows, we briefly tried out a different way of page-switching during DND with commit 09b975fa: The "bump against monitor edge" gesture (or "overshoot" behavior as it's called in the code) was replaced with a hover timeout on the navigation arrows. The idea behind that was to allow hovering the navigation arrow during DND to eventually trigger a page switch, which also makes sense. The replacement of the "overshoot" behavior made some people unhappy though, so it was decided to bring back the old "overshoot" behavior with commit 4dcae8dd. Due to time pressure before the release that didn't go very well and we ended up with a mixup of both approaches that doesn't feel too polished. So let's try to fix that by first going back to the working "overshoot" implementation as it was in 42, then slightly refactoring that implementation, to finally incorporate the new "page indicator hover" behavior that https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335 originally intended to use. This reverts commit 4dcae8ddd2637384b82fcbaa5ebd26c3dc2b77cd. Part-of: --- js/ui/appDisplay.js | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index 8972ff33c..8e02e7f85 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -844,23 +844,6 @@ var BaseAppView = GObject.registerClass({ this._overshootTimeoutId = 0; } - _dragWithinOvershootRegion(dragEvent) { - const rtl = this.get_text_direction() === Clutter.TextDirection.RTL; - const {x, y, targetActor: indicator} = dragEvent; - const [indicatorX, indicatorY] = indicator.get_transformed_position(); - const [indicatorWidth, indicatorHeight] = indicator.get_transformed_size(); - - let overshootX = indicatorX; - if (indicator === this._nextPageIndicator || rtl) - overshootX += indicatorWidth - OVERSHOOT_THRESHOLD; - - const overshootBox = new Clutter.ActorBox(); - overshootBox.set_origin(overshootX, indicatorY); - overshootBox.set_size(OVERSHOOT_THRESHOLD, indicatorHeight); - - return overshootBox.contains(x, y); - } - _handleDragOvershoot(dragEvent) { // Already animating if (this._adjustment.get_transition('value') !== null) @@ -886,13 +869,6 @@ var BaseAppView = GObject.registerClass({ if (targetPage < 0 || targetPage >= this._grid.nPages) return; // don't go beyond first/last page - // If dragging over the drag overshoot threshold region, immediately - // switch pages - if (this._dragWithinOvershootRegion(dragEvent)) { - this._resetOvershoot(); - this.goToPage(targetPage); - } - this._overshootTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, OVERSHOOT_TIMEOUT, () => { this._resetOvershoot();