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

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

[elpa] externals/exwm 35d04c3: Fix bugs on managing/unmanaging X windows


From: Chris Feng
Subject: [elpa] externals/exwm 35d04c3: Fix bugs on managing/unmanaging X windows
Date: Tue, 09 Feb 2016 05:29:07 +0000

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

    Fix bugs on managing/unmanaging X windows
    
    * exwm-manage.el (exwm-manage--scan): Unmap X windows before managing them.
    
    (exwm-manage--on-UnmapNotify): Do not ignore synthetic UnmapNotify events
    (according to ICCCM).  Do not use the `from-configure' slot which was
    mistakenly introduced due to the bug in `exwm-manage--scan'.
    
    * exwm-workspace.el (exwm-workspace--confirm-kill-emacs): Do more cleanups.
---
 exwm-manage.el    |   19 +++++++++----------
 exwm-workspace.el |   18 ++++++++++++++++++
 2 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/exwm-manage.el b/exwm-manage.el
index d7edee0..21e18ff 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -171,8 +171,6 @@ corresponding buffer.")
           (make-instance 'xcb:ConfigureWindow
                          :window id :value-mask xcb:ConfigWindow:BorderWidth
                          :border-width 0))
-      ;; (xcb:+request exwm--connection    ;map the window
-      ;;     (make-instance 'xcb:MapWindow :window id))
       (dolist (button       ;grab buttons to set focus / move / resize
                (list xcb:ButtonIndex:1 xcb:ButtonIndex:2 xcb:ButtonIndex:3))
         (xcb:+request-checked+request-check exwm--connection
@@ -272,6 +270,9 @@ corresponding buffer.")
           (xcb:+request-unchecked+reply exwm--connection
               (make-instance 'xcb:GetWindowAttributes :window i))
         (when (and (= 0 override-redirect) (= xcb:MapState:Viewable map-state))
+          (xcb:+request exwm--connection
+              (make-instance 'xcb:UnmapWindow :window i))
+          (xcb:flush exwm--connection)
           (exwm-manage--manage-window i))))))
 
 (defvar exwm-manage--ping-lock nil
@@ -417,15 +418,13 @@ Would you like to kill it? "
           (exwm--log "MapRequest from #x%x" window)
           (exwm-manage--manage-window window))))))
 
-(defun exwm-manage--on-UnmapNotify (data synthetic)
+(defun exwm-manage--on-UnmapNotify (data _synthetic)
   "Handle UnmapNotify event."
-  (unless synthetic
-    (let ((obj (make-instance 'xcb:UnmapNotify)))
-      (xcb:unmarshal obj data)
-      (with-slots (window from-configure) obj
-        (unless from-configure          ;the parent is being resized
-          (exwm--log "UnmapNotify from #x%x" window)
-          (exwm-manage--unmanage-window window t))))))
+  (let ((obj (make-instance 'xcb:UnmapNotify)))
+    (xcb:unmarshal obj data)
+    (with-slots (window) obj
+      (exwm--log "UnmapNotify from #x%x" window)
+      (exwm-manage--unmanage-window window t))))
 
 (defun exwm-manage--on-DestroyNotify (data synthetic)
   "Handle DestroyNotify event."
diff --git a/exwm-workspace.el b/exwm-workspace.el
index feeb2fe..3d7f67e 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -462,11 +462,29 @@ This functions is modified from 
`display-buffer-reuse-window' and
           (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))))
+    ;; Remove SubstructureRedirect event.
+    (xcb:+request exwm--connection
+        (make-instance 'xcb:ChangeWindowAttributes
+                       :window exwm--root :value-mask xcb:CW:EventMask
+                       :event-mask 0))
+    ;; Remove the _NET_SUPPORTING_WM_CHECK X window.
+    (with-slots (value)
+        (xcb:+request-unchecked+reply exwm--connection
+            (make-instance 'xcb:ewmh:get-_NET_SUPPORTING_WM_CHECK
+                           :window exwm--root))
+      (xcb:+request exwm--connection
+          (make-instance 'xcb:DeleteProperty
+                         :window exwm--root
+                         :property xcb:Atom:_NET_SUPPORTING_WM_CHECK))
+      (xcb:+request exwm--connection
+          (make-instance 'xcb:DestroyWindow :window value)))
+    ;; Unmanage all X windows.
     (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)
+    (xcb:disconnect exwm--connection)
     t))
 
 (defun exwm-workspace--init ()



reply via email to

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