diff --git a/NEWS b/NEWS index 8066a9c..5457d17 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/extensions/screenshot-window-sizer/extension.js b/extensions/screenshot-window-sizer/extension.js index 997bb70..aa613a7 100644 --- a/extensions/screenshot-window-sizer/extension.js +++ b/extensions/screenshot-window-sizer/extension.js @@ -101,10 +101,6 @@ 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) { @@ -125,8 +121,18 @@ 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, diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js index 500695b..198a30d 100644 --- a/extensions/window-list/extension.js +++ b/extensions/window-list/extension.js @@ -246,6 +246,48 @@ 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; @@ -391,7 +433,7 @@ return; } - if (button === 1) + if (!button || button === 1) this._minimizeOrActivateWindow(this.metaWindow); else this._openMenu(this._contextMenu); @@ -637,7 +679,7 @@ if (contextMenuWasOpen) this._contextMenu.close(); - if (button === 1) { + if (!button || button === 1) { if (menuWasOpen) return; diff --git a/meson.build b/meson.build index 91c3a6f..25af71e 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+' )