about summary refs log tree commit diff
path: root/exwm-floating.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2015-09-27T11·31+0800
committerChris Feng <chris.w.feng@gmail.com>2015-09-27T11·43+0800
commit5184f0d7c1b540a6241904528d068dce288a911e (patch)
tree1f7cecd5399eb739293104f8e5dc9c6cab50b5d6 /exwm-floating.el
parentf685de12d464b334ba7efdfe67e989dd63a96fa0 (diff)
Work around subrs that block EXWM; other minor fixes
Some subrs (e.g. x-file-dialog) create X windows and block the execution of
EXWM, so they won't work normally.  This commit partly fixes this issue by
invoking them in a subordinate Emacs instance and trying to fetch the
result back.

* exwm.el (exwm-blocking-subrs): New variable for specify such subrs.
* exwm.el (exwm-enable, exwm--server-name, exwm--server-stop)
  (exwm--server-eval-at): The implementation.

* exwm-core.el:
* exwm-floating.el:
* exwm-layout.el:
* exwm-manage.el:
* exwm-randr.el:
  Evaluate constants at compile-time.

* README.md: Renamed from README.org to make the 'Commentary:' section
  used by GNU ELPA instead.

* exwm.el: Depends on XELB version 0.3.
Diffstat (limited to 'exwm-floating.el')
-rw-r--r--exwm-floating.el62
1 files changed, 36 insertions, 26 deletions
diff --git a/exwm-floating.el b/exwm-floating.el
index 0994cb9914cc..59b4e4432d0f 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -247,9 +247,10 @@ are provided. You should call `xcb:flush' and restore the value of
                      :window (or frame-outer-id
                                  (frame-parameter exwm--floating-frame
                                                   'exwm-outer-id))
-                     :value-mask (logior xcb:ConfigWindow:Width
-                                         xcb:ConfigWindow:Height
-                                         xcb:ConfigWindow:StackMode)
+                     :value-mask (eval-when-compile
+                                   (logior xcb:ConfigWindow:Width
+                                           xcb:ConfigWindow:Height
+                                           xcb:ConfigWindow:StackMode))
                      :width (+ width (* 2 exwm-floating-border-width))
                      :height (+ height (* 2 exwm-floating-border-width)
                                 (window-mode-line-height)
@@ -336,18 +337,20 @@ are provided. You should call `xcb:flush' and restore the value of
                        exwm-floating--moveresize-calculate
                        `(lambda (x y)
                           (vector ,frame-id
-                                  ,(logior xcb:ConfigWindow:X
-                                           xcb:ConfigWindow:Y)
+                                  ,(eval-when-compile
+                                     (logior xcb:ConfigWindow:X
+                                             xcb:ConfigWindow:Y))
                                   (- x ,win-x) (- y ,win-y) 0 0))))
                 ((= type xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_TOPLEFT)
                  (setq cursor exwm-floating--cursor-top-left
                        exwm-floating--moveresize-calculate
                        `(lambda (x y)
                           (vector ,frame-id
-                                  ,(logior xcb:ConfigWindow:X
-                                           xcb:ConfigWindow:Y
-                                           xcb:ConfigWindow:Width
-                                           xcb:ConfigWindow:Height)
+                                  ,(eval-when-compile
+                                     (logior xcb:ConfigWindow:X
+                                             xcb:ConfigWindow:Y
+                                             xcb:ConfigWindow:Width
+                                             xcb:ConfigWindow:Height))
                                   (- x ,win-x) (- y ,win-y)
                                   (- ,(+ root-x width) x)
                                   (- ,(+ root-y height) y)))))
@@ -356,17 +359,19 @@ are provided. You should call `xcb:flush' and restore the value of
                        exwm-floating--moveresize-calculate
                        `(lambda (x y)
                           (vector ,frame-id
-                                  ,(logior xcb:ConfigWindow:Y
-                                           xcb:ConfigWindow:Height)
+                                  ,(eval-when-compile
+                                     (logior xcb:ConfigWindow:Y
+                                             xcb:ConfigWindow:Height))
                                   0 (- y ,win-y) 0 (- ,(+ root-y height) y)))))
                 ((= type xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_TOPRIGHT)
                  (setq cursor exwm-floating--cursor-top-right
                        exwm-floating--moveresize-calculate
                        `(lambda (x y)
                           (vector ,frame-id
-                                  ,(logior xcb:ConfigWindow:Y
-                                           xcb:ConfigWindow:Width
-                                           xcb:ConfigWindow:Height)
+                                  ,(eval-when-compile
+                                     (logior xcb:ConfigWindow:Y
+                                             xcb:ConfigWindow:Width
+                                             xcb:ConfigWindow:Height))
                                   0 (- y ,win-y) (- x ,(- root-x width))
                                   (- ,(+ root-y height) y)))))
                 ((= type xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_RIGHT)
@@ -380,8 +385,9 @@ are provided. You should call `xcb:flush' and restore the value of
                        exwm-floating--moveresize-calculate
                        `(lambda (x y)
                           (vector ,frame-id
-                                  ,(logior xcb:ConfigWindow:Width
-                                           xcb:ConfigWindow:Height)
+                                  ,(eval-when-compile
+                                     (logior xcb:ConfigWindow:Width
+                                             xcb:ConfigWindow:Height))
                                   0 0 (- x ,(- root-x width))
                                   (- y ,(- root-y height))))))
                 ((= type xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_BOTTOM)
@@ -396,9 +402,10 @@ are provided. You should call `xcb:flush' and restore the value of
                        exwm-floating--moveresize-calculate
                        `(lambda (x y)
                           (vector ,frame-id
-                                  ,(logior xcb:ConfigWindow:X
-                                           xcb:ConfigWindow:Width
-                                           xcb:ConfigWindow:Height)
+                                  ,(eval-when-compile
+                                     (logior xcb:ConfigWindow:X
+                                             xcb:ConfigWindow:Width
+                                             xcb:ConfigWindow:Height))
                                   (- x ,win-x)
                                   0
                                   (- ,(+ root-x width) x)
@@ -408,15 +415,17 @@ are provided. You should call `xcb:flush' and restore the value of
                        exwm-floating--moveresize-calculate
                        `(lambda (x y)
                           (vector ,frame-id
-                                  ,(logior xcb:ConfigWindow:X
-                                           xcb:ConfigWindow:Width)
+                                  ,(eval-when-compile
+                                     (logior xcb:ConfigWindow:X
+                                             xcb:ConfigWindow:Width))
                                   (- x ,win-x) 0 (- ,(+ root-x width) x) 0)))))
           ;; Select events and change cursor (should always succeed)
           (xcb:+request-unchecked+reply exwm--connection
               (make-instance 'xcb:GrabPointer
                              :owner-events 0 :grab-window frame-id
-                             :event-mask (logior xcb:EventMask:ButtonRelease
-                                                 xcb:EventMask:ButtonMotion)
+                             :event-mask (eval-when-compile
+                                           (logior xcb:EventMask:ButtonRelease
+                                                   xcb:EventMask:ButtonMotion))
                              :pointer-mode xcb:GrabMode:Async
                              :keyboard-mode xcb:GrabMode:Async
                              :confine-to xcb:Window:None
@@ -472,7 +481,7 @@ are provided. You should call `xcb:flush' and restore the value of
           (make-instance 'xcb:ConfigureWindow
                          :window (elt result 0) :value-mask (elt result 1)
                          :x (- (elt result 2) frame-x)
-                         :y (-  (elt result 3) frame-y)
+                         :y (- (elt result 3) frame-y)
                          :width (elt result 4) :height (elt result 5)))
       (xcb:flush exwm--connection))))
 
@@ -492,8 +501,9 @@ Both DELTA-X and DELTA-Y default to 1.  This command should be bound locally."
       (xcb:+request exwm--connection
           (make-instance 'xcb:ConfigureWindow
                          :window id
-                         :value-mask (logior xcb:ConfigWindow:X
-                                             xcb:ConfigWindow:Y)
+                         :value-mask (eval-when-compile
+                                       (logior xcb:ConfigWindow:X
+                                               xcb:ConfigWindow:Y))
                          :x (+ (slot-value geometry 'x) delta-x)
                          :y (+ (slot-value geometry 'y) delta-y)))
       ;; Inform the X window that its absolute position is changed