mirror of
https://github.com/ch11ng/exwm.git
synced 2024-11-23 19:47:58 +01:00
Handle failed GrabPointer requests.
This commit is contained in:
parent
5222dc17d6
commit
fd7791fc39
1 changed files with 14 additions and 13 deletions
|
@ -234,6 +234,19 @@
|
||||||
(defvar exwm-floating--moveresize-calculate nil
|
(defvar exwm-floating--moveresize-calculate nil
|
||||||
"Calculate move/resize parameters [frame-id event-mask x y width height].")
|
"Calculate move/resize parameters [frame-id event-mask x y width height].")
|
||||||
|
|
||||||
|
;; Test if the pointer can be grabbed
|
||||||
|
(defun exwm-floating--grab-pointer (frame-id)
|
||||||
|
(let ((result (xcb:+request-unchecked+reply exwm--connection
|
||||||
|
(make-instance 'xcb:GrabPointer
|
||||||
|
:owner-events 0 :grab-window frame-id
|
||||||
|
:event-mask xcb:EventMask:NoEvent
|
||||||
|
:pointer-mode xcb:GrabMode:Async
|
||||||
|
:keyboard-mode xcb:GrabMode:Async
|
||||||
|
:confine-to xcb:Window:None
|
||||||
|
:cursor xcb:Cursor:None
|
||||||
|
:time xcb:Time:CurrentTime))))
|
||||||
|
(and result (= (slot-value result 'status) xcb:GrabStatus:Success))))
|
||||||
|
|
||||||
(defun exwm-floating--start-moveresize (id &optional type)
|
(defun exwm-floating--start-moveresize (id &optional type)
|
||||||
"Start move/resize."
|
"Start move/resize."
|
||||||
(let ((buffer (exwm--id->buffer id))
|
(let ((buffer (exwm--id->buffer id))
|
||||||
|
@ -241,19 +254,7 @@
|
||||||
(when (and buffer
|
(when (and buffer
|
||||||
(setq frame (with-current-buffer buffer exwm--floating-frame))
|
(setq frame (with-current-buffer buffer exwm--floating-frame))
|
||||||
(setq frame-id (frame-parameter frame 'exwm-outer-id))
|
(setq frame-id (frame-parameter frame 'exwm-outer-id))
|
||||||
;; Test if the pointer can be grabbed
|
(exwm-floating--grab-pointer frame-id))
|
||||||
(= xcb:GrabStatus:Success
|
|
||||||
(slot-value
|
|
||||||
(xcb:+request-unchecked+reply exwm--connection
|
|
||||||
(make-instance 'xcb:GrabPointer
|
|
||||||
:owner-events 0 :grab-window frame-id
|
|
||||||
:event-mask xcb:EventMask:NoEvent
|
|
||||||
:pointer-mode xcb:GrabMode:Async
|
|
||||||
:keyboard-mode xcb:GrabMode:Async
|
|
||||||
:confine-to xcb:Window:None
|
|
||||||
:cursor xcb:Cursor:None
|
|
||||||
:time xcb:Time:CurrentTime))
|
|
||||||
'status)))
|
|
||||||
(setq exwm--floating-edges nil) ;invalid by now
|
(setq exwm--floating-edges nil) ;invalid by now
|
||||||
(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
|
||||||
|
|
Loading…
Reference in a new issue