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