emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/exwm ccc4cce 4/6: Fix floating X window size with menu-


From: Chris Feng
Subject: [elpa] externals/exwm ccc4cce 4/6: Fix floating X window size with menu-bar/tool-bar enabled
Date: Sun, 8 Sep 2019 09:07:08 -0400 (EDT)

branch: externals/exwm
commit ccc4cce0e0df426f4eccb81479c4a773c488155d
Author: Chris Feng <address@hidden>
Commit: Chris Feng <address@hidden>

    Fix floating X window size with menu-bar/tool-bar enabled
    
    * exwm-floating.el (exwm-floating--set-floating)
    exwm-floating--do-moveresize)
    exwm-layout.el (exwm-layout--show): Take menu-bar/tool-bar into
    consideration.
---
 exwm-floating.el | 31 +++++++++++++++++++++----------
 exwm-layout.el   |  8 ++++++--
 2 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/exwm-floating.el b/exwm-floating.el
index c478e75..f4557eb 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -211,10 +211,14 @@ This is also used by X window containers.")
     ;; The frame will be made visible by `select-frame-set-input-focus'.
     (make-frame-invisible frame)
     (let* ((edges (window-inside-pixel-edges window))
+           (geometry (frame-geometry frame))
            (frame-width (+ width (- (frame-pixel-width frame)
                                     (- (elt edges 2) (elt edges 0)))))
            (frame-height (+ height (- (frame-pixel-height frame)
-                                      (- (elt edges 3) (elt edges 1)))))
+                                      (- (elt edges 3) (elt edges 1)))
+                            ;; Use `frame-outer-height' in the future.
+                            (or (cddr (assq 'menu-bar-size geometry)) 0)
+                            (or (cddr (assq 'tool-bar-size geometry)) 0)))
            (floating-mode-line (plist-get exwm--configurations
                                           'floating-mode-line))
            (floating-header-line (plist-get exwm--configurations
@@ -466,7 +470,7 @@ This is also used by X window containers.")
                 height (frame-pixel-height frame))
           (unless type
             ;; Determine the resize type according to the pointer position
-            ;; Clicking the center 1/3 part to resize has not effect
+            ;; Clicking the center 1/3 part to resize has no effect
             (setq x (/ (* 3 win-x) (float width))
                   y (/ (* 3 win-y) (float height))
                   type (cond ((and (< x 1) (< y 1))
@@ -603,7 +607,8 @@ This is also used by X window containers.")
   "Perform move/resize."
   (when exwm-floating--moveresize-calculate
     (let* ((obj (make-instance 'xcb:MotionNotify))
-           result value-mask x y width height buffer-or-id container-or-id)
+           result value-mask x y width height buffer-or-id container-or-id
+           geometry y-offset)
       (xcb:unmarshal obj data)
       (setq result (funcall exwm-floating--moveresize-calculate
                             (slot-value obj 'root-x) (slot-value obj 'root-y))
@@ -613,13 +618,19 @@ This is also used by X window containers.")
             y (aref result 3)
             width (max 1 (aref result 4))
             height (max 1 (aref result 5)))
-      (setq container-or-id
-            (if (bufferp buffer-or-id)
-                ;; Managed.
-                (with-current-buffer buffer-or-id
-                  (frame-parameter exwm--floating-frame 'exwm-container))
-              ;; Unmanaged.
-              buffer-or-id))
+      (if (not (bufferp buffer-or-id))
+          ;; Unmanaged.
+          (setq container-or-id buffer-or-id)
+        ;; Managed.
+        (setq container-or-id
+              (with-current-buffer buffer-or-id
+                (frame-parameter exwm--floating-frame 'exwm-container))
+              geometry (frame-geometry exwm--floating-frame)
+              ;; Use `frame-outer-height' in the future.
+              y-offset (+ (or (cddr (assq 'menu-bar-size geometry)) 0)
+                          (or (cddr (assq 'tool-bar-size geometry)) 0))
+              y (- y y-offset)
+              height (+ height y-offset)))
       (xcb:+request exwm--connection
           (make-instance 'xcb:ConfigureWindow
                          :window container-or-id
diff --git a/exwm-layout.el b/exwm-layout.el
index 9ef516b..5644dba 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -102,11 +102,15 @@
          (y (pop edges))
          (width (- (pop edges) x))
          (height (- (pop edges) y))
-         frame-x frame-y frame-width frame-height)
+         geometry frame-x frame-y frame-width frame-height)
     (with-current-buffer (exwm--id->buffer id)
       (when exwm--floating-frame
         (setq frame-width (frame-pixel-width exwm--floating-frame)
-              frame-height (frame-pixel-height exwm--floating-frame))
+              geometry (frame-geometry exwm--floating-frame)
+              frame-height (+ (frame-pixel-height exwm--floating-frame)
+                              ;; Use `frame-outer-height' in the future.
+                              (or (cddr (assq 'menu-bar-size geometry)) 0)
+                              (or (cddr (assq 'tool-bar-size geometry)) 0)))
         (when exwm--floating-frame-position
           (setq frame-x (elt exwm--floating-frame-position 0)
                 frame-y (elt exwm--floating-frame-position 1)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]