gi-gdk-3.0.11: Gdk bindings

CopyrightWill Thompson, Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Gdk.Unions.Event

Contents

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;

Synopsis

Exported types

newtype Event Source #

Constructors

Event (ManagedPtr Event) 

Instances

BoxedObject Event Source # 

Methods

boxedType :: Event -> IO GType #

(~) AttrOpTag tag AttrSet => Constructible Event tag Source # 

Methods

new :: MonadIO m => (ManagedPtr Event -> Event) -> [AttrOp Event tag] -> m Event #

((~) * info (ResolveEventMethod t Event), MethodInfo * info Event p) => IsLabel t (Event -> p) Source # 

Methods

fromLabel :: Proxy# Symbol t -> Event -> p #

((~) * info (ResolveEventMethod t Event), MethodInfo * info Event p) => IsLabelProxy t (Event -> p) Source # 

Methods

fromLabelProxy :: Proxy Symbol t -> Event -> p #

HasAttributeList * Event Source # 
((~) * signature (m Bool), MonadIO m) => MethodInfo * EventTriggersContextMenuMethodInfo Event signature Source # 
((~) * signature (a -> m ()), MonadIO m, IsDevice a) => MethodInfo * EventSetSourceDeviceMethodInfo Event signature Source # 
((~) * signature (a -> m ()), MonadIO m, IsScreen a) => MethodInfo * EventSetScreenMethodInfo Event signature Source # 
((~) * signature (Maybe a -> m ()), MonadIO m, IsDeviceTool a) => MethodInfo * EventSetDeviceToolMethodInfo Event signature Source # 
((~) * signature (a -> m ()), MonadIO m, IsDevice a) => MethodInfo * EventSetDeviceMethodInfo Event signature Source # 
((~) * signature (m ()), MonadIO m) => MethodInfo * EventPutMethodInfo Event signature Source # 
((~) * signature (m Bool), MonadIO m) => MethodInfo * EventIsScrollStopEventMethodInfo Event signature Source # 
((~) * signature (m Window), MonadIO m) => MethodInfo * EventGetWindowMethodInfo Event signature Source # 
((~) * signature (m Word32), MonadIO m) => MethodInfo * EventGetTimeMethodInfo Event signature Source # 
((~) * signature (m (Bool, [ModifierType])), MonadIO m) => MethodInfo * EventGetStateMethodInfo Event signature Source # 
((~) * signature (m (Maybe Device)), MonadIO m) => MethodInfo * EventGetSourceDeviceMethodInfo Event signature Source # 
((~) * signature (m Seat), MonadIO m) => MethodInfo * EventGetSeatMethodInfo Event signature Source # 
((~) * signature (m (Bool, ScrollDirection)), MonadIO m) => MethodInfo * EventGetScrollDirectionMethodInfo Event signature Source # 
((~) * signature (m (Bool, Double, Double)), MonadIO m) => MethodInfo * EventGetScrollDeltasMethodInfo Event signature Source # 
((~) * signature (m Screen), MonadIO m) => MethodInfo * EventGetScreenMethodInfo Event signature Source # 
((~) * signature (m Int32), MonadIO m) => MethodInfo * EventGetScancodeMethodInfo Event signature Source # 
((~) * signature (m (Bool, Double, Double)), MonadIO m) => MethodInfo * EventGetRootCoordsMethodInfo Event signature Source # 
((~) * signature (m Bool), MonadIO m) => MethodInfo * EventGetPointerEmulatedMethodInfo Event signature Source # 
((~) * signature (m (Bool, Word32)), MonadIO m) => MethodInfo * EventGetKeyvalMethodInfo Event signature Source # 
((~) * signature (m (Bool, Word16)), MonadIO m) => MethodInfo * EventGetKeycodeMethodInfo Event signature Source # 
((~) * signature (m EventType), MonadIO m) => MethodInfo * EventGetEventTypeMethodInfo Event signature Source # 
((~) * signature (m EventSequence), MonadIO m) => MethodInfo * EventGetEventSequenceMethodInfo Event signature Source # 
((~) * signature (m DeviceTool), MonadIO m) => MethodInfo * EventGetDeviceToolMethodInfo Event signature Source # 
((~) * signature (m (Maybe Device)), MonadIO m) => MethodInfo * EventGetDeviceMethodInfo Event signature Source # 
((~) * signature (m (Bool, Double, Double)), MonadIO m) => MethodInfo * EventGetCoordsMethodInfo Event signature Source # 
((~) * signature (m (Bool, Word32)), MonadIO m) => MethodInfo * EventGetClickCountMethodInfo Event signature Source # 
((~) * signature (m (Bool, Word32)), MonadIO m) => MethodInfo * EventGetButtonMethodInfo Event signature Source # 
((~) * signature (AxisUse -> m (Bool, Double)), MonadIO m) => MethodInfo * EventGetAxisMethodInfo Event signature Source # 
((~) * signature (m ()), MonadIO m) => MethodInfo * EventFreeMethodInfo Event signature Source # 
((~) * signature (m Event), MonadIO m) => MethodInfo * EventCopyMethodInfo Event signature Source # 
type AttributeList Event Source # 

newZeroEvent :: MonadIO m => m Event Source #

Construct a Event struct initialized to zero.

Methods

copy

data EventCopyMethodInfo Source #

Instances

((~) * signature (m Event), MonadIO m) => MethodInfo * EventCopyMethodInfo Event signature Source # 

eventCopy Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event: a Event

-> m Event

Returns: a copy of event. The returned Event should be freed with eventFree.

Copies a Event, copying or incrementing the reference count of the resources associated with it (e.g. Window’s and strings).

free

data EventFreeMethodInfo Source #

Instances

((~) * signature (m ()), MonadIO m) => MethodInfo * EventFreeMethodInfo Event signature Source # 

eventFree Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event: a Event.

-> m () 

Frees a Event, freeing or decrementing any resources associated with it. Note that this function should only be called with events returned from functions such as eventPeek, eventGet, eventCopy and eventNew.

get

eventGet Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m (Maybe Event)

Returns: the next Event to be processed, or Nothing if no events are pending. The returned Event should be freed with eventFree.

Checks all open displays for a Event to process,to be processed on, fetching events from the windowing system if necessary. See displayGetEvent.

getAxis

data EventGetAxisMethodInfo Source #

Instances

((~) * signature (AxisUse -> m (Bool, Double)), MonadIO m) => MethodInfo * EventGetAxisMethodInfo Event signature Source # 

eventGetAxis Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event: a Event

-> AxisUse

axisUse: the axis use to look for

-> m (Bool, Double)

Returns: True if the specified axis was found, otherwise False

Extract the axis value for a particular axis use from an event structure.

getButton

eventGetButton Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event: a Event

-> m (Bool, Word32)

Returns: True if the event delivered a button number

Extract the button number from an event.

Since: 3.2

getClickCount

eventGetClickCount Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event: a Event

-> m (Bool, Word32)

Returns: True if the event delivered a click count

Extracts the click count from an event.

Since: 3.2

getCoords

eventGetCoords Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event: a Event

-> m (Bool, Double, Double)

Returns: True if the event delivered event window coordinates

Extract the event window relative x/y coordinates from an event.

getDevice

eventGetDevice Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event: a Event.

-> m (Maybe Device)

Returns: a Device, or Nothing.

If the event contains a “device” field, this function will return it, else it will return Nothing.

Since: 3.0

getDeviceTool

eventGetDeviceTool Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event: a Event

-> m DeviceTool

Returns: The current device tool, or Nothing

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

event: a 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

eventGetEventType Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event: a Event

-> m EventType

Returns: a EventType

Retrieves the type of the event.

Since: 3.10

getKeycode

eventGetKeycode Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event: a Event

-> m (Bool, Word16)

Returns: True if the event delivered a hardware keycode

Extracts the hardware keycode from an event.

Also see eventGetScancode.

Since: 3.2

getKeyval

eventGetKeyval Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event: a Event

-> m (Bool, Word32)

Returns: True if the event delivered a key symbol

Extracts the keyval from an event.

Since: 3.2

getPointerEmulated

eventGetPointerEmulated Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event 
-> m Bool

Returns: True if this event is emulated

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

eventGetRootCoords Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event: a Event

-> m (Bool, Double, Double)

Returns: True if the event delivered root window coordinates

Extract the root window relative x/y coordinates from an event.

getScancode

eventGetScancode Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event: a 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

eventGetScreen Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event: a 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

eventGetScrollDeltas Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event: a Event

-> m (Bool, Double, Double)

Returns: True if the event contains smooth scroll information

Retrieves the scroll deltas from a Event

Since: 3.4

getScrollDirection

eventGetScrollDirection Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event: a Event

-> m (Bool, ScrollDirection)

Returns: True if the event delivered a scroll direction

Extracts the scroll direction from an event.

Since: 3.2

getSeat

data EventGetSeatMethodInfo Source #

Instances

((~) * signature (m Seat), MonadIO m) => MethodInfo * EventGetSeatMethodInfo Event signature Source # 

eventGetSeat Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event: a Event

-> m Seat

Returns: The Seat of this event

Returns the Seat this event was generated for.

Since: 3.20

getSourceDevice

eventGetSourceDevice Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event: a Event

-> m (Maybe Device)

Returns: a Device, or Nothing.

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

eventGetState Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event: a Event or Nothing

-> m (Bool, [ModifierType])

Returns: True if there was a state field in the event

If the event contains a “state” field, puts that field in state. Otherwise stores an empty state (0). Returns True if there was a state field in the event. event may be Nothing, in which case it’s treated as if the event had no state field.

getTime

eventGetTime Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event: a Event

-> m Word32

Returns: time stamp field from event

Returns the time stamp from event, if there is one; otherwise returns CURRENT_TIME. If event is Nothing, returns CURRENT_TIME.

getWindow

eventGetWindow Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event: a Event

-> m Window

Returns: The Window associated with the event

Extracts the Window associated with an event.

Since: 3.10

handlerSet

eventHandlerSet Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> EventFunc

func: the function to call to handle events from GDK.

-> 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

event: a Event

-> m Bool

Returns: True if the event is a scroll stop event

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

eventNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> EventType

type: a EventType

-> m Event

Returns: a newly-allocated Event. The returned Event should be freed with eventFree.

Creates a new event of the given type. All fields are set to 0.

Since: 2.2

peek

eventPeek Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m (Maybe Event)

Returns: a copy of the first Event on some event queue, or Nothing if no events are in any queues. The returned Event should be freed with eventFree.

If there is an event waiting in the event queue of some open display, returns a copy of it. See displayPeekEvent.

put

data EventPutMethodInfo Source #

Instances

((~) * signature (m ()), MonadIO m) => MethodInfo * EventPutMethodInfo Event signature Source # 

eventPut Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event: a 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

eventRequestMotions Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> EventMotion

event: a valid Event

-> 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

data EventSetDeviceMethodInfo Source #

Instances

((~) * signature (a -> m ()), MonadIO m, IsDevice a) => MethodInfo * EventSetDeviceMethodInfo Event signature Source # 

eventSetDevice Source #

Arguments

:: (HasCallStack, MonadIO m, IsDevice a) 
=> Event

event: a Event

-> a

device: a Device

-> m () 

Sets the device for event to device. The event must have been allocated by GTK+, for instance, by eventCopy.

Since: 3.0

setDeviceTool

eventSetDeviceTool Source #

Arguments

:: (HasCallStack, MonadIO m, IsDeviceTool a) 
=> Event

event: a Event

-> Maybe a

tool: tool to set on the event, or Nothing

-> m () 

Sets the device tool for this event, should be rarely used.

Since: 3.22

setScreen

data EventSetScreenMethodInfo Source #

Instances

((~) * signature (a -> m ()), MonadIO m, IsScreen a) => MethodInfo * EventSetScreenMethodInfo Event signature Source # 

eventSetScreen Source #

Arguments

:: (HasCallStack, MonadIO m, IsScreen a) 
=> Event

event: a Event

-> a

screen: a Screen

-> m () 

Sets the screen for event to screen. The event must have been allocated by GTK+, for instance, by eventCopy.

Since: 2.2

setSourceDevice

eventSetSourceDevice Source #

Arguments

:: (HasCallStack, MonadIO m, IsDevice a) 
=> Event

event: a Event

-> a

device: a Device

-> 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

event: a Event, currently only button events are meaningful values

-> m Bool

Returns: True if the event should trigger a context menu.

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

configure

crossing

dnd

expose

focusChange

grabBroken

key

motion

ownerChange

padAxis

padButton

padGroupMode

property

proximity

scroll

selection

setting

touch

touchpadPinch

touchpadSwipe

type

visibility

windowState