2001-08-22 08:06:41 -04:00
|
|
|
; Norbert Freudemann
|
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; grab-pointer grabs control of a pointer for your client only.
|
|
|
|
;; It returns on of the symbols:
|
|
|
|
;; (success not-viewable already-grabbed frozen invalide-time)
|
|
|
|
;; See XGrabPointer.
|
2001-08-22 08:06:41 -04:00
|
|
|
|
2002-02-08 12:09:43 -05:00
|
|
|
(define-enumerated-type grab-status :grab-status
|
|
|
|
grab-status? grab-states grab-status-name grab-status-index
|
|
|
|
(success already-grabbed invalid-time not-viewable frozen))
|
|
|
|
|
|
|
|
(define (integer->grab-status i)
|
|
|
|
(vector-ref grab-states i))
|
|
|
|
|
2002-03-17 10:41:56 -05:00
|
|
|
(define (grab-pointer window owner? events ptr-mode kbd-mode
|
2001-08-22 08:06:41 -04:00
|
|
|
confine-to cursor time)
|
2002-02-08 12:09:43 -05:00
|
|
|
(integer->grab-status
|
|
|
|
(%grab-pointer (display-Xdisplay (window-display window))
|
|
|
|
(window-Xwindow window)
|
|
|
|
owner?
|
|
|
|
(event-mask->integer events)
|
2002-03-17 10:41:56 -05:00
|
|
|
(grab-mode->integer ptr-mode)
|
|
|
|
(grab-mode->integer kbd-mode)
|
2002-02-08 12:09:43 -05:00
|
|
|
(window-Xwindow confine-to)
|
|
|
|
(cursor-Xcursor cursor)
|
|
|
|
time)))
|
2001-08-22 08:06:41 -04:00
|
|
|
|
|
|
|
(import-lambda-definition %grab-pointer (Xdisplay Xwindow owner? events
|
2002-03-17 10:41:56 -05:00
|
|
|
ptr-mode kbd-mode
|
2001-08-22 08:06:41 -04:00
|
|
|
Xconfine-to Xcursor time)
|
|
|
|
"scx_Grab_Pointer")
|
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; ungrab-pointer releases the pointer. See XUngrabPointer.
|
2001-08-22 08:06:41 -04:00
|
|
|
|
|
|
|
(define (ungrab-pointer display time)
|
|
|
|
(%ungrab-pointer (display-Xdisplay display)
|
|
|
|
time))
|
|
|
|
|
|
|
|
(import-lambda-definition %ungrab-pointer (Xdisplay time)
|
|
|
|
"scx_Ungrab_Pointer")
|
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; grab-button performs a grab-pointer depending on a corresponding
|
|
|
|
;; button press event. See XGrabButton.
|
2001-08-22 08:06:41 -04:00
|
|
|
|
2002-03-17 10:41:56 -05:00
|
|
|
(define-enumerated-type grab-mode :grab-mode
|
|
|
|
grab-mode? grab-modes grab-mode-name grab-mode-index
|
|
|
|
(sync async))
|
|
|
|
|
|
|
|
(define (grab-mode->integer m)
|
|
|
|
(grab-mode-index m))
|
|
|
|
|
|
|
|
(define (interger->grab-mode i)
|
|
|
|
(vector-ref grab-modes i))
|
|
|
|
|
|
|
|
(define (grab-button window button mod owner? events ptr-mode kbd-mode
|
2001-08-22 08:06:41 -04:00
|
|
|
confine-to cursor)
|
|
|
|
(%grab-button (display-Xdisplay (window-display window))
|
|
|
|
(window-Xwindow window)
|
2002-02-08 12:09:43 -05:00
|
|
|
(button->integer button) ;; any-button
|
|
|
|
(state-set->integer mod)
|
|
|
|
owner?
|
|
|
|
(event-mask->integer events)
|
2002-03-17 10:41:56 -05:00
|
|
|
(grab-mode->integer ptr-mode)
|
|
|
|
(grab-mode->integer kbd-mode)
|
2001-08-22 08:06:41 -04:00
|
|
|
(window-Xwindow confine-to)
|
|
|
|
(cursor-Xcursor cursor)))
|
|
|
|
|
2001-08-29 10:43:49 -04:00
|
|
|
(import-lambda-definition %grab-button (Xdisplay Xwindow button
|
|
|
|
mods ownerp events
|
2002-03-17 10:41:56 -05:00
|
|
|
ptr-mode kbd-mode
|
2001-08-29 10:43:49 -04:00
|
|
|
Xconfine-to Xcursor)
|
2001-08-22 08:06:41 -04:00
|
|
|
"scx_Grab_Button")
|
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; ungrab-button releases the passive grab, performed by
|
|
|
|
;; grab-button. See XUngrabButton.
|
2001-08-22 08:06:41 -04:00
|
|
|
|
|
|
|
(define (ungrab-button window button modifiers)
|
|
|
|
(%ungrab-button (display-Xdisplay (window-display window))
|
|
|
|
(window-Xwindow window)
|
2002-02-08 12:09:43 -05:00
|
|
|
(button->integer button)
|
|
|
|
(state-set->integer modifiers)))
|
2001-08-22 08:06:41 -04:00
|
|
|
|
|
|
|
(import-lambda-definition %ungrab-button (Xdisplay Xwindow
|
|
|
|
button modifiers)
|
|
|
|
"scx_Ungrab_Button")
|
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; change-active-pointer-grab changes the specified dynamic parameters
|
|
|
|
;; if the pointer is actively grabbed by the client (by grab-pointer,
|
|
|
|
;; not by grab-button). See XChangeActivePointerGrab.
|
2001-08-22 08:06:41 -04:00
|
|
|
|
|
|
|
(define (change-active-pointer-grab display events cursor time)
|
|
|
|
(%change-active-p-g (display-Xdisplay display)
|
2002-02-08 12:09:43 -05:00
|
|
|
(event-mask->integer events)
|
|
|
|
(cursor-Xcursor cursor)
|
|
|
|
time))
|
2001-08-22 08:06:41 -04:00
|
|
|
|
|
|
|
(import-lambda-definition %change-active-p-g (Xdislay events
|
|
|
|
cursor time)
|
|
|
|
"scx_Change_Active_Pointer_Grab")
|
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; grab-keyboard actively grabs control of the keyboard and generates
|
|
|
|
;; FocusIn and FocusOut events. Further key events are reported only
|
|
|
|
;; to the grabbing client.
|
|
|
|
;; ungrab-keyboard releases the keyboard and any queued events if this
|
|
|
|
;; client has it actively grabbed from either grab-keyboard or
|
|
|
|
;; grab-Key. See XGrabKeyboard and XUngrabKeyboard.
|
2001-08-22 08:06:41 -04:00
|
|
|
|
2002-03-17 10:41:56 -05:00
|
|
|
(define (grab-keyboard window owner? ptr-mode kbd-mode time)
|
2002-02-08 12:09:43 -05:00
|
|
|
(integer->grab-status
|
|
|
|
(%grab-keyboard (display-Xdisplay (window-display window))
|
|
|
|
(window-Xwindow window)
|
2002-03-17 10:41:56 -05:00
|
|
|
owner?
|
|
|
|
(grab-mode->integer ptr-mode)
|
|
|
|
(grab-mode->integer kbd-mode)
|
|
|
|
time)))
|
2001-08-22 08:06:41 -04:00
|
|
|
|
2001-08-29 10:43:49 -04:00
|
|
|
(import-lambda-definition %grab-keyboard (Xdisplay Xwindow
|
2002-03-17 10:41:56 -05:00
|
|
|
owner? ptr-mode kbd-mode
|
2001-08-29 10:43:49 -04:00
|
|
|
time)
|
|
|
|
"scx_Grab_Keyboard")
|
2001-08-22 08:06:41 -04:00
|
|
|
|
2001-08-29 10:43:49 -04:00
|
|
|
(define (ungrab-keyboard display time)
|
|
|
|
(%ungrab-keyboard (display-Xdisplay display)
|
|
|
|
time))
|
2001-08-22 08:06:41 -04:00
|
|
|
|
|
|
|
|
2001-08-29 10:43:49 -04:00
|
|
|
(import-lambda-definition %ungrab-keyboard (Xdisplay time)
|
|
|
|
"scx_Ungrab_Keyboard")
|
2001-08-22 08:06:41 -04:00
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; The grab-key function establishes a passive grab on the
|
|
|
|
;; keyboard. In the future, the keyboard is actively
|
|
|
|
;; grabbed.
|
|
|
|
;; ungrab-key releases this passive grab. See XGrabKey and XUngrabKey.
|
2001-08-22 08:06:41 -04:00
|
|
|
|
2002-03-17 10:41:56 -05:00
|
|
|
(define (grab-key window key mod owner? ptr-mode kbd-mode)
|
2001-08-22 08:06:41 -04:00
|
|
|
(%grab-key (display-Xdisplay (window-display window))
|
|
|
|
(window-Xwindow window)
|
2002-02-08 12:09:43 -05:00
|
|
|
key
|
|
|
|
(state-set->integer mod)
|
2002-03-17 10:41:56 -05:00
|
|
|
owner?
|
|
|
|
(grab-mode->integer ptr-mode)
|
|
|
|
(grab-mode->integer kbd-mode)
|
|
|
|
(symbol? key)))
|
2001-08-22 08:06:41 -04:00
|
|
|
|
|
|
|
(import-lambda-definition %grab-key (Xdisplay xwindow key mod
|
2002-03-17 10:41:56 -05:00
|
|
|
owner ptr-mode kbd-mode flag)
|
2002-02-08 12:09:43 -05:00
|
|
|
"scx_Grab_Key")
|
2001-08-22 08:06:41 -04:00
|
|
|
|
|
|
|
(define (ungrab-key window key mod)
|
|
|
|
(%ungrab-key (display-Xdisplay (window-display window))
|
|
|
|
(window-Xwindow window)
|
2002-02-08 12:09:43 -05:00
|
|
|
key
|
|
|
|
(state-set->integer mod)
|
|
|
|
(symbol? key)))
|
2001-08-22 08:06:41 -04:00
|
|
|
|
2001-10-30 09:31:36 -05:00
|
|
|
(import-lambda-definition %ungrab-key (Xdisplay Xwindow key mod
|
2001-08-22 08:06:41 -04:00
|
|
|
flag)
|
|
|
|
"scx_Ungrab_Key")
|
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; allow-events function releases some queued events if the client has
|
|
|
|
;; caused a device to freeze. See XAllowEvents.
|
2001-08-22 08:06:41 -04:00
|
|
|
|
2002-02-08 12:09:43 -05:00
|
|
|
(define-enumerated-type allow-event :allow-event
|
|
|
|
allow-event? allow-events allow-event-name allow-event-index
|
|
|
|
(async-pointer sync-pointer replay-pointer async-keyboard
|
|
|
|
sync-keyboard replay-keyboard async-both sync-both))
|
|
|
|
|
|
|
|
(define (allow-event->integer v)
|
|
|
|
(allow-event-index v))
|
|
|
|
|
2001-08-22 08:06:41 -04:00
|
|
|
(define (allow-events display mode time)
|
|
|
|
(%allow-events (display-Xdisplay display)
|
2002-02-08 12:09:43 -05:00
|
|
|
(allow-event->integer mode)
|
|
|
|
time))
|
2001-08-22 08:06:41 -04:00
|
|
|
|
|
|
|
(import-lambda-definition %allow-events (Xdisplay mode time)
|
|
|
|
"scx_Allow_Events")
|
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; grab-server disables processing of requests and close downs on all
|
|
|
|
;; other connections than the one this request arrived on. You should
|
|
|
|
;; not grab the X server any more than is absolutely necessary. See
|
|
|
|
;; XGrabServer.
|
2001-08-22 08:06:41 -04:00
|
|
|
|
|
|
|
(define (grab-server display)
|
|
|
|
(%grab-server (display-Xdisplay display)))
|
|
|
|
|
|
|
|
(import-lambda-definition %grab-server (Xdisplay)
|
|
|
|
"scx_Grab_Server")
|
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; ungrab-server restarts processing of requests and close downs on
|
|
|
|
;; other connections. You should avoid grabbing the X server as much
|
|
|
|
;; as possible. See XUngrabServer.
|
2001-08-22 08:06:41 -04:00
|
|
|
|
|
|
|
(define (ungrab-server display)
|
|
|
|
(%ungrab-server (display-Xdisplay display)))
|
|
|
|
|
|
|
|
(import-lambda-definition %ungrab-server (Xdisplay)
|
|
|
|
"scx_Ungrab_Server")
|
|
|
|
|
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; with-server-grabbed not implemented (yet).
|
2001-08-22 08:06:41 -04:00
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;;(define-syntax (with-server-grabbed display . body-forms))
|