diff options
-rw-r--r-- | exwm-floating.el | 132 | ||||
-rw-r--r-- | exwm-manage.el | 80 | ||||
-rw-r--r-- | exwm.el | 6 |
3 files changed, 109 insertions, 109 deletions
diff --git a/exwm-floating.el b/exwm-floating.el index cce6de0a7b7e..a67bc1977ed7 100644 --- a/exwm-floating.el +++ b/exwm-floating.el @@ -313,10 +313,10 @@ (let ((buffer-or-id (or (exwm--id->buffer id) id)) frame container-or-id x y width height cursor) (if (bufferp buffer-or-id) - ;; Managed. - (with-current-buffer buffer-or-id - (setq frame exwm--floating-frame - container-or-id exwm--container)) + ;; Managed. + (with-current-buffer buffer-or-id + (setq frame exwm--floating-frame + container-or-id exwm--container)) ;; Unmanaged. (setq container-or-id id)) (when (and container-or-id @@ -326,7 +326,7 @@ (xcb:+request-unchecked+reply exwm--connection (make-instance 'xcb:GrabPointer :owner-events 0 - :grab-window container-or-id + :grab-window container-or-id :event-mask xcb:EventMask:NoEvent :pointer-mode xcb:GrabMode:Async :keyboard-mode xcb:GrabMode:Async @@ -337,36 +337,36 @@ (with-slots (root-x root-y win-x win-y) (xcb:+request-unchecked+reply exwm--connection (make-instance 'xcb:QueryPointer :window id)) - (if (not (bufferp buffer-or-id)) - ;; Unmanaged. - (unless (eq type xcb:ewmh:_NET_WM_MOVERESIZE_MOVE) - (with-slots ((width* width) - (height* height)) - (xcb:+request-unchecked+reply exwm--connection - (make-instance 'xcb:GetGeometry :drawable id)) - (setq width width* - height height*))) - ;; Managed. - (select-window (frame-first-window frame)) ;transfer input focus - (setq width (frame-pixel-width frame) - height (frame-pixel-height frame)) - (unless type - ;; Determine the resize type according to the pointer position - ;; Clicking the center 1/3 part to resize has not effect - (setq x (/ (* 3 win-x) (float width)) - y (/ (* 3 win-y) (float height)) - type (cond ((and (< x 1) (< y 1)) - xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_TOPLEFT) - ((and (> x 2) (< y 1)) - xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_TOPRIGHT) - ((and (> x 2) (> y 2)) - xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT) - ((and (< x 1) (> y 2)) - xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT) - ((> x 2) xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_RIGHT) - ((> y 2) xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_BOTTOM) - ((< x 1) xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_LEFT) - ((< y 1) xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_TOP))))) + (if (not (bufferp buffer-or-id)) + ;; Unmanaged. + (unless (eq type xcb:ewmh:_NET_WM_MOVERESIZE_MOVE) + (with-slots ((width* width) + (height* height)) + (xcb:+request-unchecked+reply exwm--connection + (make-instance 'xcb:GetGeometry :drawable id)) + (setq width width* + height height*))) + ;; Managed. + (select-window (frame-first-window frame)) ;transfer input focus + (setq width (frame-pixel-width frame) + height (frame-pixel-height frame)) + (unless type + ;; Determine the resize type according to the pointer position + ;; Clicking the center 1/3 part to resize has not effect + (setq x (/ (* 3 win-x) (float width)) + y (/ (* 3 win-y) (float height)) + type (cond ((and (< x 1) (< y 1)) + xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_TOPLEFT) + ((and (> x 2) (< y 1)) + xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_TOPRIGHT) + ((and (> x 2) (> y 2)) + xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT) + ((and (< x 1) (> y 2)) + xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT) + ((> x 2) xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_RIGHT) + ((> y 2) xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_BOTTOM) + ((< x 1) xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_LEFT) + ((< y 1) xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_TOP))))) (if (not type) (exwm-floating--stop-moveresize) (cond ((= type xcb:ewmh:_NET_WM_MOVERESIZE_MOVE) @@ -416,7 +416,7 @@ exwm-floating--moveresize-calculate `(lambda (x y) (vector ,buffer-or-id - ,xcb:ConfigWindow:Width + ,xcb:ConfigWindow:Width 0 0 (- x ,(- root-x width)) 0)))) ((= type xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT) (setq cursor exwm-floating--cursor-bottom-right @@ -476,8 +476,8 @@ (make-instance 'xcb:UngrabPointer :time xcb:Time:CurrentTime)) ;; Inform the X window that its absolute position is changed (when (and exwm-floating--moveresize-calculate - ;; Unmanaged. - (eq major-mode 'exwm-mode)) + ;; Unmanaged. + (eq major-mode 'exwm-mode)) (let ((edges (window-inside-absolute-pixel-edges (frame-selected-window))) (id (with-current-buffer (window-buffer (frame-selected-window)) exwm--id))) @@ -523,36 +523,36 @@ height (aref result 5)) (setq buffer-or-id (aref result 0)) (setq container-or-id - (if (bufferp buffer-or-id) - ;; Managed. - (with-current-buffer buffer-or-id exwm--container) - ;; Unmanaged. - buffer-or-id)) + (if (bufferp buffer-or-id) + ;; Managed. + (with-current-buffer buffer-or-id exwm--container) + ;; Unmanaged. + buffer-or-id)) (xcb:+request exwm--connection - (make-instance 'xcb:ConfigureWindow - :window container-or-id - :value-mask (aref result 1) - :x (- (aref result 2) frame-x) - :y (- (aref result 3) frame-y) - :width width - :height height)) + (make-instance 'xcb:ConfigureWindow + :window container-or-id + :value-mask (aref result 1) + :x (- (aref result 2) frame-x) + :y (- (aref result 3) frame-y) + :width width + :height height)) (when (bufferp buffer-or-id) - ;; Managed. - (with-current-buffer buffer-or-id - (xcb:+request exwm--connection - (make-instance 'xcb:ConfigureWindow - :window (frame-parameter exwm--floating-frame - 'exwm-container) - :value-mask value-mask - :width width - :height height)) - (xcb:+request exwm--connection - (make-instance 'xcb:ConfigureWindow - :window (frame-parameter exwm--floating-frame - 'exwm-outer-id) - :value-mask value-mask - :width width - :height height)))) + ;; Managed. + (with-current-buffer buffer-or-id + (xcb:+request exwm--connection + (make-instance 'xcb:ConfigureWindow + :window (frame-parameter exwm--floating-frame + 'exwm-container) + :value-mask value-mask + :width width + :height height)) + (xcb:+request exwm--connection + (make-instance 'xcb:ConfigureWindow + :window (frame-parameter exwm--floating-frame + 'exwm-outer-id) + :value-mask value-mask + :width width + :height height)))) (xcb:flush exwm--connection)))) (defun exwm-floating-move (&optional delta-x delta-y) diff --git a/exwm-manage.el b/exwm-manage.el index 9f9c844c86be..adc851966499 100644 --- a/exwm-manage.el +++ b/exwm-manage.el @@ -101,7 +101,7 @@ corresponding buffer.") (memq xcb:Atom:_NET_WM_WINDOW_TYPE_NORMAL exwm-window-type))) ;; Check the _MOTIF_WM_HINTS property. (and exwm--mwm-hints - ;; See <Xm/MwmUtil.h> for fields definitions. + ;; See <Xm/MwmUtil.h> for fields definitions. (/= 0 (logand (elt exwm--mwm-hints 0) ;MotifWmHints.flags 2)) ;MWM_HINTS_DECORATIONS (= 0 (elt exwm--mwm-hints 2)) ;MotifWmHints.decorations @@ -334,54 +334,54 @@ corresponding buffer.") (let ((id exwm--id)) ;; Try to close the X window with WM_DELETE_WINDOW client message. (xcb:+request exwm--connection - (make-instance 'xcb:icccm:SendEvent - :destination id - :event (xcb:marshal - (make-instance 'xcb:icccm:WM_DELETE_WINDOW - :window id) - exwm--connection))) + (make-instance 'xcb:icccm:SendEvent + :destination id + :event (xcb:marshal + (make-instance 'xcb:icccm:WM_DELETE_WINDOW + :window id) + exwm--connection))) (xcb:flush exwm--connection) ;; (unless (memq xcb:Atom:_NET_WM_PING exwm--protocols) - ;; The window does not support _NET_WM_PING. To make sure it'll die, - ;; kill it after the time runs out. - ;; Hide the container to prevent flickering. - (xcb:+request exwm--connection - (make-instance 'xcb:UnmapWindow :window exwm--container)) - (xcb:flush exwm--connection) - (run-with-timer exwm-manage-ping-timeout nil - `(lambda () (exwm-manage--kill-client ,id))) - ;; Wait for DestroyNotify event. - (throw 'return nil)) + ;; The window does not support _NET_WM_PING. To make sure it'll die, + ;; kill it after the time runs out. + ;; Hide the container to prevent flickering. + (xcb:+request exwm--connection + (make-instance 'xcb:UnmapWindow :window exwm--container)) + (xcb:flush exwm--connection) + (run-with-timer exwm-manage-ping-timeout nil + `(lambda () (exwm-manage--kill-client ,id))) + ;; Wait for DestroyNotify event. + (throw 'return nil)) ;; Try to determine if the X window is dead with _NET_WM_PING. (setq exwm-manage--ping-lock t) (xcb:+request exwm--connection - (make-instance 'xcb:SendEvent - :propagate 0 - :destination id - :event-mask xcb:EventMask:NoEvent - :event (xcb:marshal - (make-instance 'xcb:ewmh:_NET_WM_PING - :window id - :timestamp 0 - :client-window id) - exwm--connection))) + (make-instance 'xcb:SendEvent + :propagate 0 + :destination id + :event-mask xcb:EventMask:NoEvent + :event (xcb:marshal + (make-instance 'xcb:ewmh:_NET_WM_PING + :window id + :timestamp 0 + :client-window id) + exwm--connection))) (xcb:flush exwm--connection) (with-timeout (exwm-manage-ping-timeout - (if (yes-or-no-p (format "'%s' is not responding. \ + (if (yes-or-no-p (format "'%s' is not responding. \ Would you like to kill it? " - (buffer-name))) - (progn (exwm-manage--kill-client id) - ;; Kill the unresponsive X window and - ;; wait for DestroyNotify event. - (throw 'return nil)) - ;; Give up. - (throw 'return nil))) - (while (and exwm-manage--ping-lock - (exwm--id->buffer id)) ;may have been destroyed. - (accept-process-output nil 0.1)) - ;; Give up. - (throw 'return nil))))) + (buffer-name))) + (progn (exwm-manage--kill-client id) + ;; Kill the unresponsive X window and + ;; wait for DestroyNotify event. + (throw 'return nil)) + ;; Give up. + (throw 'return nil))) + (while (and exwm-manage--ping-lock + (exwm--id->buffer id)) ;may have been destroyed. + (accept-process-output nil 0.1)) + ;; Give up. + (throw 'return nil))))) (defun exwm-manage--kill-client (&optional id) "Kill an X client." diff --git a/exwm.el b/exwm.el index 39eb35004db8..e60b341bc3a5 100644 --- a/exwm.el +++ b/exwm.el @@ -326,14 +326,14 @@ (= action xcb:ewmh:_NET_WM_STATE_ADD)) (dolist (f exwm-workspace--list) (when (equal (frame-parameter f 'exwm-outer-id) id) - (exwm-layout--set-frame-fullscreen f) - (xcb:+request + (exwm-layout--set-frame-fullscreen f) + (xcb:+request exwm--connection (make-instance 'xcb:ewmh:set-_NET_WM_STATE :window id :data (vector xcb:Atom:_NET_WM_STATE_FULLSCREEN))) - (xcb:flush exwm--connection)))) + (xcb:flush exwm--connection)))) (when buffer ;ensure it's managed (with-current-buffer buffer ;; _NET_WM_STATE_MODAL |