gnome-shell/js/ui
Sergey Bugaev f50cac3005 workspace: Sort windows to minimize travel distance
When transitioning to or from the overview, windows travel
a certain distance between their real desktop position and
their place in the overview window grid. The less this travel
distance is, the smoother, more polished, and less jarring
the overall transition looks. This is why it makes sense to
try reordering and repositioning windows to minimize their
travel distance. That being said, there are other factors
that impact the quality of the overview layout, such as how
much the windows get scaled and what portion of the overall
available space they take up.

The existing code tries to minimize the travel distance by
sorting the windows in each row by their horizontal position.
There are, however, two problems with this implementation.
First, it compares the coordinates of windows' left edges as
opposed to their centers, which means it yields unexpected
results when a small window is positioned next to the left
edge of a large window. Second, it completely disregards
vertical coordinates, instead assigning windows to the grid
rows using their monotonically increasing window numbers,
effectively vertically sorting them by the order they were
created in.

This commit changes both vertical and horizontal ordering
to work based on the coordinates of the geometric centers
of the windows. That is to say, windows are first assigned
to grid rows based on the vertical coordinates of their
centers, and subsequently sorted inside each row based on
the horizontal coordinates of said centers. In my testing,
this leads to a much more intuitive and visually pleasing
window placement.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/267
2019-08-08 13:13:35 +02:00
..
components cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
status volume: Fix overdrive in slider 2019-08-07 16:17:45 +00:00
accessDialog.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
altTab.js js: Use implicit animations for animatable properties 2019-08-06 23:54:29 +02:00
animation.js js: Use implicit animations for animatable properties 2019-08-06 23:54:29 +02:00
appDisplay.js js: Use Clutter transitions for adjustment changes 2019-08-07 18:40:49 +02:00
appFavorites.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
audioDeviceSelection.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
background.js js: Use implicit animations for animatable properties 2019-08-06 23:54:29 +02:00
backgroundMenu.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
barLevel.js barLevel: Fix value range 2019-08-07 16:17:45 +00:00
boxpointer.js js: Use implicit animations for animatable properties 2019-08-06 23:54:29 +02:00
calendar.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
checkBox.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
closeDialog.js js: Use implicit animations for animatable properties 2019-08-06 23:54:29 +02:00
ctrlAltTab.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
dash.js js: Use implicit animations for animatable properties 2019-08-06 23:54:29 +02:00
dateMenu.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
dialog.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
dnd.js dnd: Stop using getTweenCount() 2019-08-07 18:40:49 +02:00
edgeDragAction.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
endSessionDialog.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
environment.js environment: Add convenience method for adjustment transitions 2019-08-07 18:40:49 +02:00
extensionDownloader.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
extensionSystem.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
focusCaretTracker.js cleanup: Prefer template strings 2019-07-05 11:32:31 +00:00
grabHelper.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
ibusCandidatePopup.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
iconGrid.js js: Use implicit animations for animatable properties 2019-08-06 23:54:29 +02:00
inhibitShortcutsDialog.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
kbdA11yDialog.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
keyboard.js js: Ease non-animatable actor properties 2019-08-06 23:54:29 +02:00
layout.js js: Use implicit animations for animatable properties 2019-08-06 23:54:29 +02:00
lightbox.js js: Ease non-animatable actor properties 2019-08-06 23:54:29 +02:00
locatePointer.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
lookingGlass.js lookingGlass: Remove Tweener from preimported modules 2019-08-07 18:40:49 +02:00
magnifier.js cleanup: Mark unused (but useful) variables as ignored 2019-07-24 00:28:45 +02:00
magnifierDBus.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
main.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
messageList.js js: Ease non-animatable actor properties 2019-08-06 23:54:29 +02:00
messageTray.js js: Use implicit animations for animatable properties 2019-08-06 23:54:29 +02:00
modalDialog.js js: Use implicit animations for animatable properties 2019-08-06 23:54:29 +02:00
mpris.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
notificationDaemon.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
osdMonitorLabeler.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
osdWindow.js js: Ease non-animatable actor properties 2019-08-06 23:54:29 +02:00
overview.js js: Ease non-animatable actor properties 2019-08-06 23:54:29 +02:00
overviewControls.js js: Ease non-animatable actor properties 2019-08-06 23:54:29 +02:00
padOsd.js style: Disable camelcase rule for GObject properties 2019-07-24 00:28:45 +02:00
pageIndicators.js js: Use implicit animations for animatable properties 2019-08-06 23:54:29 +02:00
panel.js js: Use implicit animations for animatable properties 2019-08-06 23:54:29 +02:00
panelMenu.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
pointerA11yTimeout.js js: Use implicit animations for animatable properties 2019-08-06 23:54:29 +02:00
pointerWatcher.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
popupMenu.js js: Use implicit animations for animatable properties 2019-08-06 23:54:29 +02:00
remoteSearch.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
ripples.js js: Use implicit animations for animatable properties 2019-08-06 23:54:29 +02:00
runDialog.js js: Use implicit animations for animatable properties 2019-08-06 23:54:29 +02:00
screencast.js cleanup: Use destructuring for imports from GI 2019-02-09 07:39:20 +01:00
screenShield.js js: Use implicit animations for animatable properties 2019-08-06 23:54:29 +02:00
screenshot.js js: Use implicit animations for animatable properties 2019-08-06 23:54:29 +02:00
scripting.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
search.js cleanup: Mark unused (but useful) variables as ignored 2019-07-24 00:28:45 +02:00
sessionMode.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
shellDBus.js shellDBus: Use floats instead of percentages for OSD levels 2019-07-28 17:27:53 +02:00
shellEntry.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
shellMountOperation.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
slider.js js: Actorize animated objects 2019-08-06 23:54:29 +02:00
switcherPopup.js js: Use Clutter transitions for adjustment changes 2019-08-07 18:40:49 +02:00
switchMonitor.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
tweener.js tweener: Use new adjustAnimationTime() helper 2019-08-06 20:50:43 +02:00
unlockDialog.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
userWidget.js userWidget: Handle non-square icons gracefully 2019-07-29 16:16:22 +00:00
viewSelector.js js: Use implicit animations for animatable properties 2019-08-06 23:54:29 +02:00
windowAttentionHandler.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
windowManager.js keybindings: Remove pause-resume-tweens shortcut 2019-08-07 18:40:49 +02:00
windowMenu.js cleanup: Mark globals used from other modules as exported 2019-07-24 00:28:45 +02:00
workspace.js workspace: Sort windows to minimize travel distance 2019-08-08 13:13:35 +02:00
workspacesView.js js: Use Clutter transitions for adjustment changes 2019-08-07 18:40:49 +02:00
workspaceSwitcherPopup.js js: Use implicit animations for animatable properties 2019-08-06 23:54:29 +02:00
workspaceThumbnail.js js: Ease non-animatable actor properties 2019-08-06 23:54:29 +02:00
xdndHandler.js cleanup: Mark unused (but useful) variables as ignored 2019-07-24 00:28:45 +02:00