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.
This commit is contained in:
Chris Feng 2016-09-25 19:58:16 +08:00
parent 7fbd5220f2
commit 1c8101afbf

View file

@ -560,6 +560,20 @@ Would you like to kill it? "
(defconst exwm-manage--width-delta-min 5) (defconst exwm-manage--width-delta-min 5)
(defconst exwm-manage--height-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) (defun exwm-manage--on-ConfigureRequest (data _synthetic)
"Handle ConfigureRequest event." "Handle ConfigureRequest event."
(let ((obj (make-instance 'xcb:ConfigureRequest)) (let ((obj (make-instance 'xcb:ConfigureRequest))
@ -638,14 +652,19 @@ border-width: %d; sibling: #x%x; stack-mode: %d"
nil t))) nil t)))
(exwm--log "ConfigureWindow (preserve geometry)") (exwm--log "ConfigureWindow (preserve geometry)")
;; Configure the unmanaged window. ;; Configure the unmanaged window.
(xcb:+request exwm--connection ;; But Emacs frames should be excluded. Generally we don't
(make-instance 'xcb:ConfigureWindow ;; receive ConfigureRequest events from Emacs frames since we
:window window ;; have set OverrideRedirect on them, but this is not true for
:value-mask value-mask ;; Lucid build (as of 25.1).
:x x :y y :width width :height height (unless (memq window exwm-manage--frame-outer-id-list)
:border-width border-width (xcb:+request exwm--connection
:sibling sibling (make-instance 'xcb:ConfigureWindow
:stack-mode stack-mode)))))) :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)) (xcb:flush exwm--connection))
(declare-function exwm-layout--iconic-state-p "exwm-layout.el" (&optional id)) (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-len (length atom-name)
:name atom-name)) :name atom-name))
'atom))) '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 (xcb:+event exwm--connection 'xcb:ConfigureRequest
#'exwm-manage--on-ConfigureRequest) #'exwm-manage--on-ConfigureRequest)
(xcb:+event exwm--connection 'xcb:MapRequest #'exwm-manage--on-MapRequest) (xcb:+event exwm--connection 'xcb:MapRequest #'exwm-manage--on-MapRequest)