[gnome-shell-extensions] screenshot-window-sizer: Delay size popup



commit 1e833f542f0a2eadab57ee5f1278efec97e26f9e
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Jun 9 18:11:32 2022 +0200

    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: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/232>

 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 1b57fd6..aa613a7 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,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]