From faabfa11c2c42ddfd7d1ea788fbc2c401517556e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 9 Jun 2022 18:11:32 +0200 Subject: [PATCH 1/5] screenshot-window-sizer: Remove superfluous check We already filter out sizes that don't fit the screen when building the scaledSizes array, no need to check again. Part-of: --- extensions/screenshot-window-sizer/extension.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/extensions/screenshot-window-sizer/extension.js b/extensions/screenshot-window-sizer/extension.js index 997bb700..1b57fd60 100644 --- a/extensions/screenshot-window-sizer/extension.js +++ b/extensions/screenshot-window-sizer/extension.js @@ -101,10 +101,6 @@ function cycleScreenshotSizes(display, window, binding) { for (let i = 0; i < scaledSizes.length; i++) { let [width, height] = scaledSizes[i]; - // ignore sizes bigger than the workArea - if (width > workArea.width || height > workArea.height) - continue; - // get the best initial window size let error = Math.abs(width - outerRect.width) + Math.abs(height - outerRect.height); if (nearestIndex === undefined || error < nearestError) { From 1e833f542f0a2eadab57ee5f1278efec97e26f9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 9 Jun 2022 18:11:32 +0200 Subject: [PATCH 2/5] screenshot-window-sizer: Delay size popup We use the actual frame size for the popup rather than the target size. That means (on wayland), we have to wait for the size to actually change. Part-of: --- extensions/screenshot-window-sizer/extension.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/extensions/screenshot-window-sizer/extension.js b/extensions/screenshot-window-sizer/extension.js index 1b57fd60..aa613a7d 100644 --- a/extensions/screenshot-window-sizer/extension.js +++ b/extensions/screenshot-window-sizer/extension.js @@ -121,8 +121,18 @@ function cycleScreenshotSizes(display, window, binding) { if (newY + newHeight > workArea.y + workArea.height) newY = Math.max(workArea.y + workArea.height - newHeight); + const id = window.connect('size-changed', () => { + window.disconnect(id); + _notifySizeChange(window); + }); window.move_resize_frame(true, newX, newY, newWidth, newHeight); +} +/** + * @param {Meta.Window} window - the window whose size changed + */ +function _notifySizeChange(window) { + const { scaleFactor } = St.ThemeContext.get_for_stage(global.stage); let newOuterRect = window.get_frame_rect(); let message = '%d×%d'.format( newOuterRect.width / scaleFactor, From fe60614b41ac844f109d2961782c247f6b40cad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 21 Apr 2022 16:34:50 +0200 Subject: [PATCH 3/5] window-list: Fix primary button action on touch If a click event was triggered via touch rather than a pointer device, the button parameter is 0 rather than a mouse button number. Account for that to make sure that touch events are not misinterpreted as right clicks. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/146 Part-of: --- extensions/window-list/extension.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js index 500695b4..f3045ec5 100644 --- a/extensions/window-list/extension.js +++ b/extensions/window-list/extension.js @@ -391,7 +391,7 @@ class WindowButton extends BaseButton { return; } - if (button === 1) + if (!button || button === 1) this._minimizeOrActivateWindow(this.metaWindow); else this._openMenu(this._contextMenu); @@ -637,7 +637,7 @@ class AppButton extends BaseButton { if (contextMenuWasOpen) this._contextMenu.close(); - if (button === 1) { + if (!button || button === 1) { if (menuWasOpen) return; From 4667b4704d8927ffb1a44b453512b30bc9f2f728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 5 May 2022 20:55:20 +0200 Subject: [PATCH 4/5] window-list: Open menu on long press Right-click isn't available on touch, so implement long-press as an alternative. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/146 Part-of: --- extensions/window-list/extension.js | 42 +++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js index f3045ec5..198a30db 100644 --- a/extensions/window-list/extension.js +++ b/extensions/window-list/extension.js @@ -246,6 +246,48 @@ class BaseButton extends St.Button { this._updateVisibility(); } + _setLongPressTimeout() { + if (this._longPressTimeoutId) + return; + + const { longPressDuration } = Clutter.Settings.get_default(); + this._longPressTimeoutId = + GLib.timeout_add(GLib.PRIORITY_DEFAULT, longPressDuration, () => { + delete this._longPressTimeoutId; + + if (this._canOpenPopupMenu() && !this._contextMenu.isOpen) + this._openMenu(this._contextMenu); + return GLib.SOURCE_REMOVE; + }); + } + + _removeLongPressTimeout() { + if (!this._longPressTimeoutId) + return; + GLib.source_remove(this._longPressTimeoutId); + delete this._longPressTimeoutId; + } + + vfunc_button_press_event(buttonEvent) { + if (buttonEvent.button === 1) + this._setLongPressTimeout(); + return super.vfunc_button_press_event(buttonEvent); + } + + vfunc_button_release_event(buttonEvent) { + this._removeLongPressTimeout(); + + return super.vfunc_button_release_event(buttonEvent); + } + + vfunc_touch_event(touchEvent) { + if (touchEvent.type === Clutter.EventType.TOUCH_BEGIN) + this._setLongPressTimeout(); + else if (touchEvent.type === Clutter.EventType.TOUCH_END) + this._removeLongPressTimeout(); + return super.vfunc_touch_event(touchEvent); + } + activate() { if (this.active) return; From 8b62c38e2073a3bcb9f89cc29eae00d8831829c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sat, 2 Jul 2022 18:41:28 +0200 Subject: [PATCH 5/5] Bump version to 42.3 Update NEWS. --- NEWS | 8 ++++++++ meson.build | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 8066a9cc..5457d17a 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,11 @@ +42.3 +==== +* screenshot-window-sizer: Fix reported sizes on wayland [Florian; !232] +* window-list: Improve touch support [Florian; !233] + +Contributors: + Florian Müllner + 42.2 ==== * native-window-placement: Adjust to gnome-shell 42 changes [Florian; !229] diff --git a/meson.build b/meson.build index 91c3a6f9..25af71e0 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('gnome-shell-extensions', - version: '42.2', + version: '42.3', meson_version: '>= 0.53.0', license: 'GPL2+' )