Package: gdk

GBoxed gdk-event

Superclasses

common-lisp:structure-object, common-lisp:t

Documented Subclasses

Details

The gdk-event structure contains a union of all of the event structures, and allows access to the data fields in a number of ways.

The event type is always the first field in all of the event structures, and can always be accessed with the following code, no matter what type of event it is:
(let ((event (gdk-event-new :button-press))) (gdk-event-type event))
=> :BUTTON-PRESS  
To access other fields of the event structures, the appropriate event structure accesor can be used. For example if the event type is :button-press then the x coordinate of the button press can be accessed with:
(let ((event (gdk-event-new :button-press :x 10.0))) (gdk-event-button-x event))
=> 10.0  
The complete variant structure which contains all event structures is as follows:
(define-g-boxed-variant-cstruct gdk-event "GdkEvent"
  (type gdk-event-type)
  (window (g-object gdk-window))
  (send-event (:boolean :int8))
  (:variant type
            ;; GdkEventKey
            ((:key-press :key-release) gdk-event-key
             (time :uint32)
             (state gdk-modifier-type)
             (keyval :uint)
             (length :int)
             (string (:string :free-from-foreign nil
                              :free-to-foreign nil))
             (hardware-keycode :uint16)
             (group :uint8)
             (is-modifier :uint))
            ;; GdkEventButton
            ((:button-press
              :2button-press
              :double-button-press
              :3button-press
              :triple-button-press
              :button-release) gdk-event-button
             (time :uint32)
             (x :double)
             (y :double)
             (axes (fixed-array :double 2))
             (state gdk-modifier-type)
             (button :uint)
             (device (g-object gdk-device))
             (x-root :double)
             (y-root :double))
            ;; GdkEventTouch
            ((:touch-begin
              :touch-update
              :touch-end
              :touch-cancel) gdk-event-touch
             (time :uint32)
             (x :double)
             (y :double)
             (axes (fixed-array :double 2))
             (state gdk-modifier-type)
             (sequence (g-boxed-foreign gdk-event-sequence))
             (emulating-pointer :boolean)
             (device (g-object gdk-device))
             (x-root :double)
             (y-root :double))
            ;; GdkEventScroll
            ((:scroll) gdk-event-scroll
             (time :uint32)
             (x :double)
             (y :double)
             (state gdk-modifier-type)
             (direction gdk-scroll-direction)
             (device (g-object gdk-device))
             (x-root :double)
             (y-root :double)
             (delta-x :double)
             (delta-y :double))
            ;; GdkEventMotion
            ((:motion-notify) gdk-event-motion
             (time :uint32)
             (x :double)
             (y :double)
             (axes (fixed-array :double 2))
             (state gdk-modifier-type)
             (is-hint :int16)
             (device (g-object gdk-device))
             (x-root :double)
             (y-root :double))
            ;; GdkEventExpose
            ((:expose) gdk-event-expose
             (area gdk-rectangle :inline t)
             (region (:pointer (:struct cairo-region-t)))
             (count :int))
            ;; GdkEventVisibity
            ((:visibility-notify) gdk-event-visibility
             (state gdk-visibility-state))
            ;; GdkEventCrossing
            ((:enter-notify :leave-notify) gdk-event-crossing
             (subwindow (g-object gdk-window))
             (time :uint32)
             (x :double)
             (y :double)
             (x-root :double)
             (y-root :double)
             (mode gdk-crossing-mode)
             (detail gdk-notify-type)
             (focus :boolean)
             (state gdk-modifier-type))
            ;; GdkEventFocus
            ((:focus-change) gdk-event-focus
             (in :int16))
            ;; GdkEventConfigure
            ((:configure) gdk-event-configure
             (x :int)
             (y :int)
             (width :int)
             (height :int))
            ;; GdkEventProperty
            ((:property-notify) gdk-event-property
             (atom gdk-atom)
             (time :uint32)
             (state gdk-property-state))
            ;; GdkEventSelection
            ((:selection-clear
              :selection-notify
              :selection-request) gdk-event-selection
             (selection gdk-atom)
             (target gdk-atom)
             (property gdk-atom)
             (time :uint32)
             (requestor (g-object gdk-window)))
            ;; GdkEventDND
            ((:drag-enter
              :drag-leave
              :drag-motion
              :drag-status
              :drop-start
              :drop-finished) gdk-event-dnd
             (context (g-object gdk-drag-context))
             (time :uint32)
             (x-root :short)
             (y-root :short))
            ;; GdkEventProximity
            ((:proximity-in
              :proximity-out) gdk-event-proximity
             (time :uint32)
             (device (g-object gdk-device)))
            ;; GdkEventWindowState
            ((:window-state) gdk-event-window-state
             (changed-mask gdk-window-state)
             (new-window-state gdk-window-state))
            ;; GdkEventSetting
            ((:setting) gdk-event-setting
             (action gdk-setting-action)
             (name (:string :free-from-foreign nil :free-to-foreign nil)))
            ;; GdkEventOwnerChange
            ((:owner-change) gdk-event-owner-change
             (owner (g-object gdk-window))
             (reason gdk-owner-change)
             (selection gdk-atom)
             (time :uint32)
             (selection-time :uint32))
            ;; GdkEventGrabBroken
            ((:grab-broken) gdk-event-grab-broken
             (keyboard :boolean)
             (implicit :boolean)
             (grab-window (g-object gdk-window)))
            ;; GdkEventTouchpadSwipe
            ((:touchpad-swipe) gdk-event-touchpad-swipe
             (phase :int8)
             (n-fingers :int8)
             (time :uint32)
             (x :double)
             (y :double)
             (dx :double)
             (dy :double)
             (x-root :double)
             (y-root :double)
             (state gdk-modifier-type))
            ;; GdkEventTouchpadPinch
            ((:touchpad-pinch) gdk-event-touchpad-pinch
             (phase :int8)
             (n-fingers :int8)
             (time :uint32)
             (x :double)
             (y :double)
             (dx :double)
             (dy :double)
             (angle-delta :double)
             (scale :double)
             (x-root :double)
             (y-root :double)
             (state gdk-modifier-type))
            ;; GdkEventPadButton
            ((:pad-button-press :pad-button-release) gdk-event-pad-button
             (time :uint32)
             (group :uint)
             (button :uint)
             (mode :uint)) ; TODO: Check the type of mode
            ;; GdkEventPadAxis
            ((:pad-ring :pad-strip) gdk-event-pad-axis
             (time :uint32)
             (group :uint)
             (index :uint)
             (mode :uint)
             (value :double))
            ;; GdkEventPadGroupMode
            ((:pad-group-mode) gdk-event-pad-group-mode
             (time :uint32)
             (group :uint)
             (mode :uint))))  
The following fields are common to all event structures.
(define-g-boxed-variant-cstruct gdk-event "GdkEvent"
  (type gdk-event-type)
  (window (g-object gdk-window))
  (send-event (:boolean :int8))
  ... )  
type
The gdk-event-type type of the event.
window
The gdk-window object which received the event.
send-event
True if the event was sent explicitly.
 

Slot Access Functions

See also

2021-12-13