mirror of
https://github.com/ch11ng/exwm.git
synced 2024-11-27 13:07:59 +01:00
; * exwm-input.el: Prevent moving/resizing a tiling X window.
This commit is contained in:
parent
6ecd8b921f
commit
5529790b03
1 changed files with 31 additions and 23 deletions
|
@ -205,41 +205,49 @@ This value should always be overwritten.")
|
||||||
(defun exwm-input--on-ButtonPress (data _synthetic)
|
(defun exwm-input--on-ButtonPress (data _synthetic)
|
||||||
"Handle ButtonPress event."
|
"Handle ButtonPress event."
|
||||||
(let ((obj (make-instance 'xcb:ButtonPress))
|
(let ((obj (make-instance 'xcb:ButtonPress))
|
||||||
(mode xcb:Allow:SyncPointer))
|
(mode xcb:Allow:SyncPointer)
|
||||||
|
window buffer frame)
|
||||||
(xcb:unmarshal obj data)
|
(xcb:unmarshal obj data)
|
||||||
(with-slots (detail time event state) obj
|
(with-slots (detail time event state) obj
|
||||||
(setq exwm-input--timestamp time)
|
(setq exwm-input--timestamp time)
|
||||||
|
(setq window (get-buffer-window (exwm--id->buffer event) t)
|
||||||
|
buffer (window-buffer window))
|
||||||
(cond ((and (= state exwm-input--move-mask)
|
(cond ((and (= state exwm-input--move-mask)
|
||||||
(= detail exwm-input--move-keysym))
|
(= detail exwm-input--move-keysym)
|
||||||
|
;; Either an undecorated or a floating X window.
|
||||||
|
(with-current-buffer buffer
|
||||||
|
(or (not (eq major-mode 'exwm-mode))
|
||||||
|
exwm--floating-frame)))
|
||||||
;; Move
|
;; Move
|
||||||
(exwm-floating--start-moveresize
|
(exwm-floating--start-moveresize
|
||||||
event xcb:ewmh:_NET_WM_MOVERESIZE_MOVE))
|
event xcb:ewmh:_NET_WM_MOVERESIZE_MOVE))
|
||||||
((and (= state exwm-input--resize-mask)
|
((and (= state exwm-input--resize-mask)
|
||||||
(= detail exwm-input--resize-keysym))
|
(= detail exwm-input--resize-keysym)
|
||||||
|
(with-current-buffer buffer
|
||||||
|
(or (not (eq major-mode 'exwm-mode))
|
||||||
|
exwm--floating-frame)))
|
||||||
;; Resize
|
;; Resize
|
||||||
(exwm-floating--start-moveresize event))
|
(exwm-floating--start-moveresize event))
|
||||||
(t
|
(t
|
||||||
;; Click to focus
|
;; Click to focus
|
||||||
(let ((window (get-buffer-window (exwm--id->buffer event) t))
|
(unless (eq window (selected-window))
|
||||||
frame)
|
(setq frame (window-frame window))
|
||||||
(unless (eq window (selected-window))
|
(unless (eq frame exwm-workspace--current)
|
||||||
(setq frame (window-frame window))
|
(if (exwm-workspace--workspace-p frame)
|
||||||
(unless (eq frame exwm-workspace--current)
|
;; The X window is on another workspace
|
||||||
(if (exwm-workspace--workspace-p frame)
|
(exwm-workspace-switch frame)
|
||||||
;; The X window is on another workspace
|
(with-current-buffer buffer
|
||||||
(exwm-workspace-switch frame)
|
(when (and (eq major-mode 'exwm-mode)
|
||||||
(with-current-buffer (window-buffer window)
|
(not (eq exwm--frame
|
||||||
(when (and (eq major-mode 'exwm-mode)
|
exwm-workspace--current)))
|
||||||
(not (eq exwm--frame
|
;; The floating X window is on another workspace
|
||||||
exwm-workspace--current)))
|
(exwm-workspace-switch exwm--frame)))))
|
||||||
;; The floating X window is on another workspace
|
;; It has been reported that the `window' may have be deleted
|
||||||
(exwm-workspace-switch exwm--frame)))))
|
(if (window-live-p window)
|
||||||
;; It has been reported that the `window' may have be deleted
|
(select-window window)
|
||||||
(if (window-live-p window)
|
(setq window
|
||||||
(select-window window)
|
(get-buffer-window (exwm--id->buffer event) t))
|
||||||
(setq window
|
(when window (select-window window))))
|
||||||
(get-buffer-window (exwm--id->buffer event) t))
|
|
||||||
(when window (select-window window)))))
|
|
||||||
;; The event should be replayed
|
;; The event should be replayed
|
||||||
(setq mode xcb:Allow:ReplayPointer))))
|
(setq mode xcb:Allow:ReplayPointer))))
|
||||||
(xcb:+request exwm--connection
|
(xcb:+request exwm--connection
|
||||||
|
|
Loading…
Reference in a new issue