about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2016-09-25T11·58+0800
committerChris Feng <chris.w.feng@gmail.com>2016-09-25T11·58+0800
commit1c8101afbf8eda6f990cde6b551a6bd59e1f7dfd (patch)
tree4127ca2be762b28a8f3dd8b6ee17e21a7f687b73
parent7fbd5220f2e92059ad38776a3f8c674002396870 (diff)
Fix a frame resizing problem for Lucid build
* exwm-manage.el (exwm-manage--frame-outer-id-list): New variable for
storing frame window-outer-id's.
(exwm-manage--add-frame, exwm-manage--remove-frame): New functions for
adding/removing ids to/from the variable.
(exwm-manage--init): Add the functions to the corresponding hooks.
(exwm-manage--on-ConfigureRequest): Check for frames and avoid handling
them.
-rw-r--r--exwm-manage.el37
1 files changed, 29 insertions, 8 deletions
diff --git a/exwm-manage.el b/exwm-manage.el
index 42a4353dcdcb..52c324db3613 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -560,6 +560,20 @@ Would you like to kill it? "
 (defconst exwm-manage--width-delta-min 5)
 (defconst exwm-manage--height-delta-min 5)
 
+(defvar exwm-manage--frame-outer-id-list nil
+  "List of window-outer-id's of all frames.")
+
+(defun exwm-manage--add-frame (frame)
+  "Run in `after-make-frame-functions'."
+  (push (string-to-number (frame-parameter frame 'outer-window-id))
+        exwm-manage--frame-outer-id-list))
+
+(defun exwm-manage--remove-frame (frame)
+  "Run in `delete-frame-functions'."
+  (setq exwm-manage--frame-outer-id-list
+        (delq (string-to-number (frame-parameter frame 'outer-window-id))
+              exwm-manage--frame-outer-id-list)))
+
 (defun exwm-manage--on-ConfigureRequest (data _synthetic)
   "Handle ConfigureRequest event."
   (let ((obj (make-instance 'xcb:ConfigureRequest))
@@ -638,14 +652,19 @@ border-width: %d; sibling: #x%x; stack-mode: %d"
                                   nil t)))
           (exwm--log "ConfigureWindow (preserve geometry)")
           ;; Configure the unmanaged window.
-          (xcb:+request exwm--connection
-              (make-instance 'xcb:ConfigureWindow
-                             :window window
-                             :value-mask value-mask
-                             :x x :y y :width width :height height
-                             :border-width border-width
-                             :sibling sibling
-                             :stack-mode stack-mode))))))
+          ;; But Emacs frames should be excluded.  Generally we don't
+          ;; receive ConfigureRequest events from Emacs frames since we
+          ;; have set OverrideRedirect on them, but this is not true for
+          ;; Lucid build (as of 25.1).
+          (unless (memq window exwm-manage--frame-outer-id-list)
+            (xcb:+request exwm--connection
+                (make-instance 'xcb:ConfigureWindow
+                               :window window
+                               :value-mask value-mask
+                               :x x :y y :width width :height height
+                               :border-width border-width
+                               :sibling sibling
+                               :stack-mode stack-mode)))))))
   (xcb:flush exwm--connection))
 
 (declare-function exwm-layout--iconic-state-p "exwm-layout.el" (&optional id))
@@ -698,6 +717,8 @@ border-width: %d; sibling: #x%x; stack-mode: %d"
                                          :name-len (length atom-name)
                                          :name atom-name))
                       'atom)))
+  (add-hook 'after-make-frame-functions #'exwm-manage--add-frame)
+  (add-hook 'delete-frame-functions #'exwm-manage--remove-frame)
   (xcb:+event exwm--connection 'xcb:ConfigureRequest
               #'exwm-manage--on-ConfigureRequest)
   (xcb:+event exwm--connection 'xcb:MapRequest #'exwm-manage--on-MapRequest)