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] 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,