Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
GI.Gdk.Unions.Event
Contents
- Exported types
- Methods
- copy
- free
- get
- getAxis
- getButton
- getClickCount
- getCoords
- getDevice
- getDeviceTool
- getEventSequence
- getEventType
- getKeycode
- getKeyval
- getPointerEmulated
- getRootCoords
- getScancode
- getScreen
- getScrollDeltas
- getScrollDirection
- getSeat
- getSourceDevice
- getState
- getTime
- getWindow
- handlerSet
- isScrollStopEvent
- new
- peek
- put
- requestMotions
- setDevice
- setDeviceTool
- setScreen
- setSourceDevice
- triggersContextMenu
- Properties
Description
A Event
contains a union of all of the event types,
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 types, and can always be accessed with the following code, no matter what type of event it is:
C code
GdkEvent *event; GdkEventType type; type = event->type;
To access other fields of the event, the pointer to the event
can be cast to the appropriate event type, or the union member
name can be used. For example if the event type is EventTypeButtonPress
then the x coordinate of the button press can be accessed with:
C code
GdkEvent *event; gdouble x; x = ((GdkEventButton*)event)->x;
or:
C code
GdkEvent *event; gdouble x; x = event->button.x;
- newtype Event = Event (ManagedPtr Event)
- newZeroEvent :: MonadIO m => m Event
- noEvent :: Maybe Event
- eventCopy :: (HasCallStack, MonadIO m) => Event -> m Event
- eventFree :: (HasCallStack, MonadIO m) => Event -> m ()
- eventGet :: (HasCallStack, MonadIO m) => m (Maybe Event)
- eventGetAxis :: (HasCallStack, MonadIO m) => Event -> AxisUse -> m (Bool, Double)
- eventGetButton :: (HasCallStack, MonadIO m) => Event -> m (Bool, Word32)
- eventGetClickCount :: (HasCallStack, MonadIO m) => Event -> m (Bool, Word32)
- eventGetCoords :: (HasCallStack, MonadIO m) => Event -> m (Bool, Double, Double)
- eventGetDevice :: (HasCallStack, MonadIO m) => Event -> m (Maybe Device)
- eventGetDeviceTool :: (HasCallStack, MonadIO m) => Event -> m DeviceTool
- eventGetEventSequence :: (HasCallStack, MonadIO m) => Event -> m EventSequence
- eventGetEventType :: (HasCallStack, MonadIO m) => Event -> m EventType
- eventGetKeycode :: (HasCallStack, MonadIO m) => Event -> m (Bool, Word16)
- eventGetKeyval :: (HasCallStack, MonadIO m) => Event -> m (Bool, Word32)
- eventGetPointerEmulated :: (HasCallStack, MonadIO m) => Event -> m Bool
- eventGetRootCoords :: (HasCallStack, MonadIO m) => Event -> m (Bool, Double, Double)
- eventGetScancode :: (HasCallStack, MonadIO m) => Event -> m Int32
- eventGetScreen :: (HasCallStack, MonadIO m) => Event -> m Screen
- eventGetScrollDeltas :: (HasCallStack, MonadIO m) => Event -> m (Bool, Double, Double)
- eventGetScrollDirection :: (HasCallStack, MonadIO m) => Event -> m (Bool, ScrollDirection)
- eventGetSeat :: (HasCallStack, MonadIO m) => Event -> m Seat
- eventGetSourceDevice :: (HasCallStack, MonadIO m) => Event -> m (Maybe Device)
- eventGetState :: (HasCallStack, MonadIO m) => Event -> m (Bool, [ModifierType])
- eventGetTime :: (HasCallStack, MonadIO m) => Event -> m Word32
- eventGetWindow :: (HasCallStack, MonadIO m) => Event -> m Window
- eventHandlerSet :: (HasCallStack, MonadIO m) => EventFunc -> m ()
- eventIsScrollStopEvent :: (HasCallStack, MonadIO m) => Event -> m Bool
- eventNew :: (HasCallStack, MonadIO m) => EventType -> m Event
- eventPeek :: (HasCallStack, MonadIO m) => m (Maybe Event)
- eventPut :: (HasCallStack, MonadIO m) => Event -> m ()
- eventRequestMotions :: (HasCallStack, MonadIO m) => EventMotion -> m ()
- eventSetDevice :: (HasCallStack, MonadIO m, IsDevice a) => Event -> a -> m ()
- eventSetDeviceTool :: (HasCallStack, MonadIO m, IsDeviceTool a) => Event -> Maybe a -> m ()
- eventSetScreen :: (HasCallStack, MonadIO m, IsScreen a) => Event -> a -> m ()
- eventSetSourceDevice :: (HasCallStack, MonadIO m, IsDevice a) => Event -> a -> m ()
- eventTriggersContextMenu :: (HasCallStack, MonadIO m) => Event -> m Bool
- getEventAny :: MonadIO m => Event -> m EventAny
- getEventButton :: MonadIO m => Event -> m EventButton
- getEventConfigure :: MonadIO m => Event -> m EventConfigure
- getEventCrossing :: MonadIO m => Event -> m EventCrossing
- getEventDnd :: MonadIO m => Event -> m EventDND
- getEventExpose :: MonadIO m => Event -> m EventExpose
- getEventFocusChange :: MonadIO m => Event -> m EventFocus
- getEventGrabBroken :: MonadIO m => Event -> m EventGrabBroken
- getEventKey :: MonadIO m => Event -> m EventKey
- getEventMotion :: MonadIO m => Event -> m EventMotion
- getEventOwnerChange :: MonadIO m => Event -> m EventOwnerChange
- getEventPadAxis :: MonadIO m => Event -> m EventPadAxis
- getEventPadButton :: MonadIO m => Event -> m EventPadButton
- getEventPadGroupMode :: MonadIO m => Event -> m EventPadGroupMode
- getEventProperty :: MonadIO m => Event -> m EventProperty
- getEventProximity :: MonadIO m => Event -> m EventProximity
- getEventScroll :: MonadIO m => Event -> m EventScroll
- getEventSelection :: MonadIO m => Event -> m EventSelection
- getEventSetting :: MonadIO m => Event -> m EventSetting
- getEventTouch :: MonadIO m => Event -> m EventTouch
- getEventTouchpadPinch :: MonadIO m => Event -> m EventTouchpadPinch
- getEventTouchpadSwipe :: MonadIO m => Event -> m EventTouchpadSwipe
- getEventType :: MonadIO m => Event -> m EventType
- setEventType :: MonadIO m => Event -> EventType -> m ()
- getEventVisibility :: MonadIO m => Event -> m EventVisibility
- getEventWindowState :: MonadIO m => Event -> m EventWindowState
Exported types
Constructors
Event (ManagedPtr Event) |
Instances
BoxedObject Event Source # | |
(~) AttrOpTag tag AttrSet => Constructible Event tag Source # | |
Methods
copy
free
Arguments
:: (HasCallStack, MonadIO m) | |
=> Event |
|
-> m () |
get
Arguments
:: (HasCallStack, MonadIO m) | |
=> m (Maybe Event) | Returns: the next |
Checks all open displays for a Event
to process,to be processed
on, fetching events from the windowing system if necessary.
See displayGetEvent
.
getAxis
Arguments
:: (HasCallStack, MonadIO m) | |
=> Event |
|
-> AxisUse |
|
-> m (Bool, Double) | Returns: |
Extract the axis value for a particular axis use from an event structure.
getButton
Arguments
:: (HasCallStack, MonadIO m) | |
=> Event |
|
-> m (Bool, Word32) | Returns: |
Extract the button number from an event.
Since: 3.2
getClickCount
Arguments
:: (HasCallStack, MonadIO m) | |
=> Event |
|
-> m (Bool, Word32) | Returns: |
Extracts the click count from an event.
Since: 3.2
getCoords
Arguments
:: (HasCallStack, MonadIO m) | |
=> Event |
|
-> m (Bool, Double, Double) | Returns: |
Extract the event window relative x/y coordinates from an event.
getDevice
If the event contains a “device” field, this function will return
it, else it will return Nothing
.
Since: 3.0
getDeviceTool
Arguments
:: (HasCallStack, MonadIO m) | |
=> Event |
|
-> m DeviceTool | Returns: The current device tool, or |
If the event was generated by a device that supports
different tools (eg. a tablet), this function will
return a DeviceTool
representing the tool that
caused the event. Otherwise, Nothing
will be returned.
Note: the DeviceTool
<!-- -->s will be constant during
the application lifetime, if settings must be stored
persistently across runs, see deviceToolGetSerial
Since: 3.22
getEventSequence
eventGetEventSequence Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> Event |
|
-> m EventSequence | Returns: the event sequence that the event belongs to |
If event
if of type EventTypeTouchBegin
, EventTypeTouchUpdate
,
EventTypeTouchEnd
or EventTypeTouchCancel
, returns the EventSequence
to which the event belongs. Otherwise, return Nothing
.
Since: 3.4
getEventType
Retrieves the type of the event.
Since: 3.10
getKeycode
getKeyval
Arguments
:: (HasCallStack, MonadIO m) | |
=> Event |
|
-> m (Bool, Word32) | Returns: |
Extracts the keyval from an event.
Since: 3.2
getPointerEmulated
eventGetPointerEmulated Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> Event | |
-> m Bool | Returns: |
event
: a Event
Returns whether this event is an 'emulated' pointer event (typically
from a touch event), as opposed to a real one.
Since: 3.22
getRootCoords
Arguments
:: (HasCallStack, MonadIO m) | |
=> Event |
|
-> m (Bool, Double, Double) | Returns: |
Extract the root window relative x/y coordinates from an event.
getScancode
Arguments
:: (HasCallStack, MonadIO m) | |
=> Event |
|
-> m Int32 | Returns: The associated keyboard scancode or 0 |
Gets the keyboard low-level scancode of a key event.
This is usually hardware_keycode. On Windows this is the high word of WM_KEY{DOWN,UP} lParam which contains the scancode and some extended flags.
Since: 3.22
getScreen
Arguments
:: (HasCallStack, MonadIO m) | |
=> Event |
|
-> m Screen | Returns: the screen for the event |
Returns the screen for the event. The screen is
typically the screen for event->any.window
, but
for events such as mouse events, it is the screen
where the pointer was when the event occurs -
that is, the screen which has the root window
to which event->motion.x_root
and
event->motion.y_root
are relative.
Since: 2.2
getScrollDeltas
Arguments
:: (HasCallStack, MonadIO m) | |
=> Event |
|
-> m (Bool, Double, Double) | Returns: |
Retrieves the scroll deltas from a Event
Since: 3.4
getScrollDirection
eventGetScrollDirection Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> Event |
|
-> m (Bool, ScrollDirection) | Returns: |
Extracts the scroll direction from an event.
Since: 3.2
getSeat
Arguments
:: (HasCallStack, MonadIO m) | |
=> Event |
|
-> m Seat | Returns: The |
Returns the Seat
this event was generated for.
Since: 3.20
getSourceDevice
This function returns the hardware (slave) Device
that has
triggered the event, falling back to the virtual (master) device
(as in eventGetDevice
) if the event wasn’t caused by
interaction with a hardware device. This may happen for example
in synthesized crossing events after a Window
updates its
geometry or a grab is acquired/released.
If the event does not contain a device field, this function will
return Nothing
.
Since: 3.0
getState
Arguments
:: (HasCallStack, MonadIO m) | |
=> Event | |
-> m (Bool, [ModifierType]) | Returns: |
getTime
Arguments
:: (HasCallStack, MonadIO m) | |
=> Event |
|
-> m Word32 | Returns: time stamp field from |
Returns the time stamp from event
, if there is one; otherwise
returns CURRENT_TIME
. If event
is Nothing
, returns CURRENT_TIME
.
getWindow
Arguments
:: (HasCallStack, MonadIO m) | |
=> Event |
|
-> m Window | Returns: The |
Extracts the Window
associated with an event.
Since: 3.10
handlerSet
Arguments
:: (HasCallStack, MonadIO m) | |
=> EventFunc |
|
-> m () |
Sets the function to call to handle all events from GDK.
Note that GTK+ uses this to install its own event handler, so it is
usually not useful for GTK+ applications. (Although an application
can call this function then call gtk_main_do_event()
to pass
events to GTK+.)
isScrollStopEvent
eventIsScrollStopEvent Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> Event |
|
-> m Bool | Returns: |
Check whether a scroll event is a stop scroll event. Scroll sequences with smooth scroll information may provide a stop scroll event once the interaction with the device finishes, e.g. by lifting a finger. This stop scroll event is the signal that a widget may trigger kinetic scrolling based on the current velocity.
Stop scroll events always have a a delta of 0/0.
Since: 3.20
new
Arguments
:: (HasCallStack, MonadIO m) | |
=> EventType |
|
-> m Event | Returns: a newly-allocated |
Creates a new event of the given type. All fields are set to 0.
Since: 2.2
peek
Arguments
:: (HasCallStack, MonadIO m) | |
=> m (Maybe Event) | Returns: a copy of the first |
If there is an event waiting in the event queue of some open
display, returns a copy of it. See displayPeekEvent
.
put
Arguments
:: (HasCallStack, MonadIO m) | |
=> Event |
|
-> m () |
Appends a copy of the given event onto the front of the event
queue for event->any.window’s display, or the default event
queue if event->any.window is Nothing
. See displayPutEvent
.
requestMotions
Arguments
:: (HasCallStack, MonadIO m) | |
=> EventMotion |
|
-> m () |
Request more motion notifies if event
is a motion notify hint event.
This function should be used instead of windowGetPointer
to
request further motion notifies, because it also works for extension
events where motion notifies are provided for devices other than the
core pointer. Coordinate extraction, processing and requesting more
motion events from a EventTypeMotionNotify
event usually works like this:
C code
{ // motion_event handler x = motion_event->x; y = motion_event->y; // handle (x,y) motion gdk_event_request_motions (motion_event); // handles is_hint events }
Since: 2.12
setDevice
Arguments
:: (HasCallStack, MonadIO m, IsDevice a) | |
=> Event |
|
-> a |
|
-> m () |
Sets the device for event
to device
. The event must
have been allocated by GTK+, for instance, by
eventCopy
.
Since: 3.0
setDeviceTool
Arguments
:: (HasCallStack, MonadIO m, IsDeviceTool a) | |
=> Event |
|
-> Maybe a |
|
-> m () |
Sets the device tool for this event, should be rarely used.
Since: 3.22
setScreen
Arguments
:: (HasCallStack, MonadIO m, IsScreen a) | |
=> Event |
|
-> a |
|
-> m () |
Sets the screen for event
to screen
. The event must
have been allocated by GTK+, for instance, by
eventCopy
.
Since: 2.2
setSourceDevice
Arguments
:: (HasCallStack, MonadIO m, IsDevice a) | |
=> Event |
|
-> a |
|
-> m () |
Sets the slave device for event
to device
.
The event must have been allocated by GTK+,
for instance by eventCopy
.
Since: 3.0
triggersContextMenu
eventTriggersContextMenu Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> Event |
|
-> m Bool | Returns: |
This function returns whether a EventButton
should trigger a
context menu, according to platform conventions. The right mouse
button always triggers context menus. Additionally, if
keymapGetModifierMask
returns a non-0 mask for
ModifierIntentContextMenu
, then the left mouse button will
also trigger a context menu if this modifier is pressed.
This function should always be used instead of simply checking for
event->button == BUTTON_SECONDARY
.
Since: 3.4
Properties
any
button
getEventButton :: MonadIO m => Event -> m EventButton Source #
configure
getEventConfigure :: MonadIO m => Event -> m EventConfigure Source #
crossing
getEventCrossing :: MonadIO m => Event -> m EventCrossing Source #
dnd
expose
getEventExpose :: MonadIO m => Event -> m EventExpose Source #
focusChange
getEventFocusChange :: MonadIO m => Event -> m EventFocus Source #
grabBroken
getEventGrabBroken :: MonadIO m => Event -> m EventGrabBroken Source #
key
motion
getEventMotion :: MonadIO m => Event -> m EventMotion Source #
ownerChange
getEventOwnerChange :: MonadIO m => Event -> m EventOwnerChange Source #
padAxis
getEventPadAxis :: MonadIO m => Event -> m EventPadAxis Source #
padButton
getEventPadButton :: MonadIO m => Event -> m EventPadButton Source #
padGroupMode
getEventPadGroupMode :: MonadIO m => Event -> m EventPadGroupMode Source #
property
getEventProperty :: MonadIO m => Event -> m EventProperty Source #
proximity
getEventProximity :: MonadIO m => Event -> m EventProximity Source #
scroll
getEventScroll :: MonadIO m => Event -> m EventScroll Source #
selection
getEventSelection :: MonadIO m => Event -> m EventSelection Source #
setting
getEventSetting :: MonadIO m => Event -> m EventSetting Source #
touch
getEventTouch :: MonadIO m => Event -> m EventTouch Source #
touchpadPinch
getEventTouchpadPinch :: MonadIO m => Event -> m EventTouchpadPinch Source #
touchpadSwipe
getEventTouchpadSwipe :: MonadIO m => Event -> m EventTouchpadSwipe Source #
type
visibility
getEventVisibility :: MonadIO m => Event -> m EventVisibility Source #
windowState
getEventWindowState :: MonadIO m => Event -> m EventWindowState Source #