Skip to content
Commits on Source (6)
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]
......
......@@ -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) {
......@@ -125,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,
......
......@@ -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;
......@@ -391,7 +433,7 @@ class WindowButton extends BaseButton {
return;
}
if (button === 1)
if (!button || button === 1)
this._minimizeOrActivateWindow(this.metaWindow);
else
this._openMenu(this._contextMenu);
......@@ -637,7 +679,7 @@ class AppButton extends BaseButton {
if (contextMenuWasOpen)
this._contextMenu.close();
if (button === 1) {
if (!button || button === 1) {
if (menuWasOpen)
return;
......
project('gnome-shell-extensions',
version: '42.2',
version: '42.3',
meson_version: '>= 0.53.0',
license: 'GPL2+'
)
......