Unmanage X windows on exit
* exwm-workspace.el (exwm-workspace--confirm-kill-emacs): New function called on exit to unmanage X windows. (exwm-workspace--init): Set `confirm-kill-emacs' to `exwm-workspace--confirm-kill-emacs'. * exwm-manage.el (exwm-manage--on-UnmapNotify): Ignore UnmapNotify event generated as a result of parent being resized.
This commit is contained in:
		
							parent
							
								
									e2edf81271
								
							
						
					
					
						commit
						15cdf8f589
					
				
					 2 changed files with 18 additions and 8 deletions
				
			
		| 
						 | 
					@ -421,8 +421,10 @@ Would you like to kill it? "
 | 
				
			||||||
  (unless synthetic
 | 
					  (unless synthetic
 | 
				
			||||||
    (let ((obj (make-instance 'xcb:UnmapNotify)))
 | 
					    (let ((obj (make-instance 'xcb:UnmapNotify)))
 | 
				
			||||||
      (xcb:unmarshal obj data)
 | 
					      (xcb:unmarshal obj data)
 | 
				
			||||||
      (exwm--log "UnmapNotify from #x%x" (slot-value obj 'window))
 | 
					      (with-slots (window from-configure) obj
 | 
				
			||||||
      (exwm-manage--unmanage-window (slot-value obj 'window) t))))
 | 
					        (unless from-configure          ;the parent is being resized
 | 
				
			||||||
 | 
					          (exwm--log "UnmapNotify from #x%x" window)
 | 
				
			||||||
 | 
					          (exwm-manage--unmanage-window window t))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun exwm-manage--on-DestroyNotify (data synthetic)
 | 
					(defun exwm-manage--on-DestroyNotify (data synthetic)
 | 
				
			||||||
  "Handle DestroyNotify event."
 | 
					  "Handle DestroyNotify event."
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -454,16 +454,24 @@ This functions is modified from `display-buffer-reuse-window' and
 | 
				
			||||||
    (cancel-timer exwm-workspace--display-echo-area-timer)
 | 
					    (cancel-timer exwm-workspace--display-echo-area-timer)
 | 
				
			||||||
    (setq exwm-workspace--display-echo-area-timer nil)))
 | 
					    (setq exwm-workspace--display-echo-area-timer nil)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun exwm-workspace--confirm-kill-emacs (prompt)
 | 
				
			||||||
 | 
					  "Confirm before exiting Emacs."
 | 
				
			||||||
 | 
					  (when (pcase (length exwm--id-buffer-alist)
 | 
				
			||||||
 | 
					          (0 (y-or-n-p prompt))
 | 
				
			||||||
 | 
					          (x (yes-or-no-p (format "[EXWM] %d window%s currently alive. %s"
 | 
				
			||||||
 | 
					                                  x (if (= x 1) "" "s") prompt))))
 | 
				
			||||||
 | 
					    (dolist (i exwm--id-buffer-alist)
 | 
				
			||||||
 | 
					      (exwm-manage--unmanage-window (car i) t)
 | 
				
			||||||
 | 
					      (xcb:+request exwm--connection
 | 
				
			||||||
 | 
					          (make-instance 'xcb:MapWindow :window (car i))))
 | 
				
			||||||
 | 
					    (xcb:flush exwm--connection)
 | 
				
			||||||
 | 
					    t))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun exwm-workspace--init ()
 | 
					(defun exwm-workspace--init ()
 | 
				
			||||||
  "Initialize workspace module."
 | 
					  "Initialize workspace module."
 | 
				
			||||||
  (cl-assert (and (< 0 exwm-workspace-number) (>= 10 exwm-workspace-number)))
 | 
					  (cl-assert (and (< 0 exwm-workspace-number) (>= 10 exwm-workspace-number)))
 | 
				
			||||||
  ;; Prevent unexpected exit
 | 
					  ;; Prevent unexpected exit
 | 
				
			||||||
  (setq confirm-kill-emacs
 | 
					  (setq confirm-kill-emacs #'exwm-workspace--confirm-kill-emacs)
 | 
				
			||||||
        (lambda (prompt)
 | 
					 | 
				
			||||||
          (pcase (length exwm--id-buffer-alist)
 | 
					 | 
				
			||||||
            (0 (y-or-n-p prompt))
 | 
					 | 
				
			||||||
            (x (yes-or-no-p (format "[EXWM] %d window%s currently alive. %s"
 | 
					 | 
				
			||||||
                                    x (if (= x 1) "" "s") prompt))))))
 | 
					 | 
				
			||||||
  (if (not (exwm-workspace--minibuffer-own-frame-p))
 | 
					  (if (not (exwm-workspace--minibuffer-own-frame-p))
 | 
				
			||||||
      ;; Initialize workspaces with minibuffers.
 | 
					      ;; Initialize workspaces with minibuffers.
 | 
				
			||||||
      (progn
 | 
					      (progn
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue