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

Contents

Description

 

Synopsis

Methods

addOptionEntriesLibgtkOnly

addOptionEntriesLibgtkOnly Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> OptionGroup

group: An option group.

-> m () 

Deprecated: (Since version 3.16)This symbol was never meant to be used outside of GTK+

Appends gdk option entries to the passed in option group. This is not public API and must not be used by applications.

beep

beep :: (HasCallStack, MonadIO m) => m () Source #

Emits a short beep on the default display.

cairoCreate

cairoCreate Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindow a) 
=> a

window: a Window

-> m Context

Returns: A newly created Cairo context. Free with cairo_destroy() when you are done drawing.

Deprecated: (Since version 3.22)Use windowBeginDrawFrame and drawingContextGetCairoContext instead

Creates a Cairo context for drawing to window.

Note that calling cairo_reset_clip() on the resulting Context will produce undefined results, so avoid it at all costs.

Typically, this function is used to draw on a Window out of the paint cycle of the toolkit; this should be avoided, as it breaks various assumptions and optimizations.

If you are drawing on a native Window in response to a EventTypeExpose event you should use windowBeginDrawFrame and drawingContextGetCairoContext instead. GTK will automatically do this for you when drawing a widget.

Since: 2.8

cairoDrawFromGl

cairoDrawFromGl Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindow a) 
=> Context

cr: a cairo context

-> a

window: The window we're rendering for (not necessarily into)

-> Int32

source: The GL ID of the source buffer

-> Int32

sourceType: The type of the source

-> Int32

bufferScale: The scale-factor that the source buffer is allocated for

-> Int32

x: The source x position in source to start copying from in GL coordinates

-> Int32

y: The source y position in source to start copying from in GL coordinates

-> Int32

width: The width of the region to draw

-> Int32

height: The height of the region to draw

-> m () 

This is the main way to draw GL content in GTK+. It takes a render buffer ID (sourceType == GL_RENDERBUFFER) or a texture id (sourceType == GL_TEXTURE) and draws it onto cr with an OVER operation, respecting the current clip. The top left corner of the rectangle specified by x, y, width and height will be drawn at the current (0,0) position of the cairo_t.

This will work for *all* cairo_t, as long as window is realized, but the fallback implementation that reads back the pixels from the buffer may be used in the general case. In the case of direct drawing to a window with no special effects applied to cr it will however use a more efficient approach.

For GL_RENDERBUFFER the code will always fall back to software for buffers with alpha components, so make sure you use GL_TEXTURE if using alpha.

Calling this may change the current GL context.

Since: 3.16

cairoGetClipRectangle

cairoGetClipRectangle Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Context

cr: a cairo context

-> m (Bool, Rectangle)

Returns: True if a clip rectangle exists, False if all of cr is clipped and all drawing can be skipped

This is a convenience function around cairo_clip_extents(). It rounds the clip extents to integer coordinates and returns a boolean indicating if a clip area exists.

cairoGetDrawingContext

cairoGetDrawingContext Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Context

cr: a Cairo context

-> m (Maybe DrawingContext)

Returns: a DrawingContext, if any is set

Retrieves the DrawingContext that created the Cairo context cr.

Since: 3.22

cairoRectangle

cairoRectangle Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Context

cr: a cairo context

-> Rectangle

rectangle: a Rectangle

-> m () 

Adds the given rectangle to the current path of cr.

Since: 2.8

cairoRegion

cairoRegion Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Context

cr: a cairo context

-> Region

region: a Region

-> m () 

Adds the given region to the current path of cr.

Since: 2.8

cairoRegionCreateFromSurface

cairoRegionCreateFromSurface Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Surface

surface: a cairo surface

-> m Region

Returns: A Region; must be freed with cairo_region_destroy()

Creates region that describes covers the area where the given surface is more than 50% opaque.

This function takes into account device offsets that might be set with cairo_surface_set_device_offset().

cairoSetSourceColor

cairoSetSourceColor Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Context

cr: a cairo context

-> Color

color: a Color

-> m () 

Deprecated: (Since version 3.4)Use cairoSetSourceRgba instead

Sets the specified Color as the source color of cr.

Since: 2.8

cairoSetSourcePixbuf

cairoSetSourcePixbuf Source #

Arguments

:: (HasCallStack, MonadIO m, IsPixbuf a) 
=> Context

cr: a cairo context

-> a

pixbuf: a Pixbuf

-> Double

pixbufX: X coordinate of location to place upper left corner of pixbuf

-> Double

pixbufY: Y coordinate of location to place upper left corner of pixbuf

-> m () 

Sets the given pixbuf as the source pattern for cr.

The pattern has an extend mode of CAIRO_EXTEND_NONE and is aligned so that the origin of pixbuf is pixbufX, pixbufY.

Since: 2.8

cairoSetSourceRgba

cairoSetSourceRgba Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Context

cr: a cairo context

-> RGBA

rgba: a RGBA

-> m () 

Sets the specified RGBA as the source color of cr.

Since: 3.0

cairoSetSourceWindow

cairoSetSourceWindow Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindow a) 
=> Context

cr: a cairo context

-> a

window: a Window

-> Double

x: X coordinate of location to place upper left corner of window

-> Double

y: Y coordinate of location to place upper left corner of window

-> m () 

Sets the given window as the source pattern for cr.

The pattern has an extend mode of CAIRO_EXTEND_NONE and is aligned so that the origin of window is x, y. The window contains all its subwindows when rendering.

Note that the contents of window are undefined outside of the visible part of window, so use this function with care.

Since: 2.24

cairoSurfaceCreateFromPixbuf

cairoSurfaceCreateFromPixbuf Source #

Arguments

:: (HasCallStack, MonadIO m, IsPixbuf a, IsWindow b) 
=> a

pixbuf: a Pixbuf

-> Int32

scale: the scale of the new surface, or 0 to use same as window

-> Maybe b

forWindow: The window this will be drawn to, or Nothing

-> m Surface

Returns: a new cairo surface, must be freed with cairo_surface_destroy()

Creates an image surface with the same contents as the pixbuf.

Since: 3.10

disableMultidevice

disableMultidevice :: (HasCallStack, MonadIO m) => m () Source #

Disables multidevice support in GDK. This call must happen prior to displayOpen, gtk_init(), gtk_init_with_args() or gtk_init_check() in order to take effect.

Most common GTK+ applications won’t ever need to call this. Only applications that do mixed GDK/Xlib calls could want to disable multidevice support if such Xlib code deals with input devices in any way and doesn’t observe the presence of XInput 2.

Since: 3.0

dragAbort

dragAbort Source #

Arguments

:: (HasCallStack, MonadIO m, IsDragContext a) 
=> a

context: a DragContext

-> Word32

time_: the timestamp for this operation

-> m () 

Aborts a drag without dropping.

This function is called by the drag source.

This function does not need to be called in managed drag and drop operations. See dragContextManageDnd for more information.

dragBegin

dragBegin Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindow a) 
=> a

window: the source window for this drag.

-> [Atom]

targets: the offered targets, as list of GdkAtoms

-> m DragContext

Returns: a newly created DragContext

Starts a drag and creates a new drag context for it. This function assumes that the drag is controlled by the client pointer device, use dragBeginForDevice to begin a drag with a different device.

This function is called by the drag source.

dragBeginForDevice

dragBeginForDevice Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindow a, IsDevice b) 
=> a

window: the source window for this drag

-> b

device: the device that controls this drag

-> [Atom]

targets: the offered targets, as list of GdkAtoms

-> m DragContext

Returns: a newly created DragContext

Starts a drag and creates a new drag context for it.

This function is called by the drag source.

dragBeginFromPoint

dragBeginFromPoint Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindow a, IsDevice b) 
=> a

window: the source window for this drag

-> b

device: the device that controls this drag

-> [Atom]

targets: the offered targets, as list of GdkAtoms

-> Int32

xRoot: the x coordinate where the drag nominally started

-> Int32

yRoot: the y coordinate where the drag nominally started

-> m DragContext

Returns: a newly created DragContext

Starts a drag and creates a new drag context for it.

This function is called by the drag source.

Since: 3.20

dragDrop

dragDrop Source #

Arguments

:: (HasCallStack, MonadIO m, IsDragContext a) 
=> a

context: a DragContext

-> Word32

time_: the timestamp for this operation

-> m () 

Drops on the current destination.

This function is called by the drag source.

This function does not need to be called in managed drag and drop operations. See dragContextManageDnd for more information.

dragDropDone

dragDropDone Source #

Arguments

:: (HasCallStack, MonadIO m, IsDragContext a) 
=> a

context: a DragContext

-> Bool

success: whether the drag was ultimatively successful

-> m () 

Inform GDK if the drop ended successfully. Passing False for success may trigger a drag cancellation animation.

This function is called by the drag source, and should be the last call before dropping the reference to the context.

The DragContext will only take the first dragDropDone call as effective, if this function is called multiple times, all subsequent calls will be ignored.

Since: 3.20

dragDropSucceeded

dragDropSucceeded Source #

Arguments

:: (HasCallStack, MonadIO m, IsDragContext a) 
=> a

context: a DragContext

-> m Bool

Returns: True if the drop was successful.

Returns whether the dropped data has been successfully transferred. This function is intended to be used while handling a EventTypeDropFinished event, its return value is meaningless at other times.

Since: 2.6

dragFindWindowForScreen

dragFindWindowForScreen Source #

Arguments

:: (HasCallStack, MonadIO m, IsDragContext a, IsWindow b, IsScreen c) 
=> a

context: a DragContext

-> b

dragWindow: a window which may be at the pointer position, but should be ignored, since it is put up by the drag source as an icon

-> c

screen: the screen where the destination window is sought

-> Int32

xRoot: the x position of the pointer in root coordinates

-> Int32

yRoot: the y position of the pointer in root coordinates

-> m (Window, DragProtocol) 

Finds the destination window and DND protocol to use at the given pointer position.

This function is called by the drag source to obtain the destWindow and protocol parameters for dragMotion.

Since: 2.2

dragGetSelection

dragGetSelection Source #

Arguments

:: (HasCallStack, MonadIO m, IsDragContext a) 
=> a

context: a DragContext.

-> m Atom

Returns: the selection atom, or GDK_NONE

Returns the selection atom for the current source window.

dragMotion

dragMotion Source #

Arguments

:: (HasCallStack, MonadIO m, IsDragContext a, IsWindow b) 
=> a

context: a DragContext

-> b

destWindow: the new destination window, obtained by gdk_drag_find_window()

-> DragProtocol

protocol: the DND protocol in use, obtained by gdk_drag_find_window()

-> Int32

xRoot: the x position of the pointer in root coordinates

-> Int32

yRoot: the y position of the pointer in root coordinates

-> [DragAction]

suggestedAction: the suggested action

-> [DragAction]

possibleActions: the possible actions

-> Word32

time_: the timestamp for this operation

-> m Bool 

Updates the drag context when the pointer moves or the set of actions changes.

This function is called by the drag source.

This function does not need to be called in managed drag and drop operations. See dragContextManageDnd for more information.

dragStatus

dragStatus Source #

Arguments

:: (HasCallStack, MonadIO m, IsDragContext a) 
=> a

context: a DragContext

-> [DragAction]

action: the selected action which will be taken when a drop happens, or 0 to indicate that a drop will not be accepted

-> Word32

time_: the timestamp for this operation

-> m () 

Selects one of the actions offered by the drag source.

This function is called by the drag destination in response to dragMotion called by the drag source.

dropFinish

dropFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsDragContext a) 
=> a

context: a DragContext

-> Bool

success: True if the data was successfully received

-> Word32

time_: the timestamp for this operation

-> m () 

Ends the drag operation after a drop.

This function is called by the drag destination.

dropReply

dropReply Source #

Arguments

:: (HasCallStack, MonadIO m, IsDragContext a) 
=> a

context: a DragContext

-> Bool

accepted: True if the drop is accepted

-> Word32

time_: the timestamp for this operation

-> m () 

Accepts or rejects a drop.

This function is called by the drag destination in response to a drop initiated by the drag source.

errorTrapPop

errorTrapPop Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Int32

Returns: X error code or 0 on success

Removes an error trap pushed with errorTrapPush. May block until an error has been definitively received or not received from the X server. errorTrapPopIgnored is preferred if you don’t need to know whether an error occurred, because it never has to block. If you don't need the return value of errorTrapPop, use errorTrapPopIgnored.

Prior to GDK 3.0, this function would not automatically sync for you, so you had to flush if your last call to Xlib was not a blocking round trip.

errorTrapPopIgnored

errorTrapPopIgnored :: (HasCallStack, MonadIO m) => m () Source #

Removes an error trap pushed with errorTrapPush, but without bothering to wait and see whether an error occurred. If an error arrives later asynchronously that was triggered while the trap was pushed, that error will be ignored.

Since: 3.0

errorTrapPush

errorTrapPush :: (HasCallStack, MonadIO m) => m () Source #

This function allows X errors to be trapped instead of the normal behavior of exiting the application. It should only be used if it is not possible to avoid the X error in any other way. Errors are ignored on all Display currently known to the DisplayManager. If you don’t care which error happens and just want to ignore everything, pop with errorTrapPopIgnored. If you need the error code, use errorTrapPop which may have to block and wait for the error to arrive from the X server.

This API exists on all platforms but only does anything on X.

You can use gdk_x11_display_error_trap_push() to ignore errors on only a single display.

Trapping an X error

C code

gdk_error_trap_push ();

 // ... Call the X function which may cause an error here ...


if (gdk_error_trap_pop ())
 {
   // ... Handle the error here ...
 }

eventsGetAngle

eventsGetAngle Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event1: first Event

-> Event

event2: second Event

-> m (Bool, Double)

Returns: True if the angle could be calculated.

If both events contain X/Y information, this function will return True and return in angle the relative angle from event1 to event2. The rotation direction for positive angles is from the positive X axis towards the positive Y axis.

Since: 3.0

eventsGetCenter

eventsGetCenter Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event1: first Event

-> Event

event2: second Event

-> m (Bool, Double, Double)

Returns: True if the center could be calculated.

If both events contain X/Y information, the center of both coordinates will be returned in x and y.

Since: 3.0

eventsGetDistance

eventsGetDistance Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Event

event1: first Event

-> Event

event2: second Event

-> m (Bool, Double)

Returns: True if the distance could be calculated.

If both events have X/Y information, the distance between both coordinates (as in a straight line going from event1 to event2) will be returned.

Since: 3.0

eventsPending

eventsPending Source #

Arguments

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

Returns: True if any events are pending.

Checks if any events are ready to be processed for any display.

flush

flush :: (HasCallStack, MonadIO m) => m () Source #

Flushes the output buffers of all display connections and waits until all requests have been processed. This is rarely needed by applications.

getDefaultRootWindow

getDefaultRootWindow Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Window

Returns: the default root window

Obtains the root window (parent all other windows are inside) for the default display and screen.

getDisplay

getDisplay Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Text

Returns: the name of the display.

Deprecated: (Since version 3.8)Call gdk_display_get_name (gdk_display_get_default ())) instead.

Gets the name of the display, which usually comes from the DISPLAY environment variable or the --display command line option.

getDisplayArgName

getDisplayArgName Source #

Arguments

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

Returns: the display name, if specified explicitly, otherwise Nothing this string is owned by GTK+ and must not be modified or freed.

Gets the display name specified in the command line arguments passed to init or parseArgs, if any.

Since: 2.2

getProgramClass

getProgramClass Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Text

Returns: the program class.

Gets the program class. Unless the program class has explicitly been set with setProgramClass or with the --class commandline option, the default value is the program name (determined with getPrgname) with the first character converted to uppercase.

getShowEvents

getShowEvents Source #

Arguments

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

Returns: True if event debugging output is enabled.

Gets whether event debugging output is enabled.

init

init Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [Text]

argv: the array of command line arguments.

-> m [Text] 

Initializes the GDK library and connects to the windowing system. If initialization fails, a warning message is output and the application terminates with a call to exit(1).

Any arguments used by GDK are removed from the array and argc and argv are updated accordingly.

GTK+ initializes GDK in gtk_init() and so this function is not usually needed by GTK+ applications.

initCheck

initCheck Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [Text]

argv: the array of command line arguments.

-> m (Bool, [Text])

Returns: True if initialization succeeded.

Initializes the GDK library and connects to the windowing system, returning True on success.

Any arguments used by GDK are removed from the array and argc and argv are updated accordingly.

GTK+ initializes GDK in gtk_init() and so this function is not usually needed by GTK+ applications.

keyboardGrab

keyboardGrab Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindow a) 
=> a

window: the Window which will own the grab (the grab window).

-> Bool

ownerEvents: if False then all keyboard events are reported with respect to window. If True then keyboard events for this application are reported as normal, but keyboard events outside this application are reported with respect to window. Both key press and key release events are always reported, independant of the event mask set by the application.

-> Word32

time_: a timestamp from a Event, or CURRENT_TIME if no timestamp is available.

-> m GrabStatus

Returns: GrabStatusSuccess if the grab was successful.

Deprecated: (Since version 3.0)Use deviceGrab instead.

Grabs the keyboard so that all events are passed to this application until the keyboard is ungrabbed with keyboardUngrab. This overrides any previous keyboard grab by this client.

If you set up anything at the time you take the grab that needs to be cleaned up when the grab ends, you should handle the EventGrabBroken events that are emitted when the grab ends unvoluntarily.

keyboardUngrab

keyboardUngrab Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

time_: a timestamp from a Event, or CURRENT_TIME if no timestamp is available.

-> m () 

Deprecated: (Since version 3.0)Use deviceUngrab, together with deviceGrab instead.

Ungrabs the keyboard on the default display, if it is grabbed by this application.

keyvalConvertCase

keyvalConvertCase Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

symbol: a keyval

-> m (Word32, Word32) 

Obtains the upper- and lower-case versions of the keyval symbol. Examples of keyvals are KEY_a, GDK_KEY_Enter, KEY_F1, etc.

keyvalFromName

keyvalFromName Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

keyvalName: a key name

-> m Word32

Returns: the corresponding key value, or KEY_VoidSymbol if the key name is not a valid key

Converts a key name to a key value.

The names are the same as those in the gdk/gdkkeysyms.h header file but without the leading “GDK_KEY_”.

keyvalIsLower

keyvalIsLower Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

keyval: a key value.

-> m Bool

Returns: True if keyval is in lower case, or if keyval is not subject to case conversion.

Returns True if the given key value is in lower case.

keyvalIsUpper

keyvalIsUpper Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

keyval: a key value.

-> m Bool

Returns: True if keyval is in upper case, or if keyval is not subject to case conversion.

Returns True if the given key value is in upper case.

keyvalName

keyvalName Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

keyval: a key value

-> m (Maybe Text)

Returns: a string containing the name of the key, or Nothing if keyval is not a valid key. The string should not be modified.

Converts a key value into a symbolic name.

The names are the same as those in the gdk/gdkkeysyms.h header file but without the leading “GDK_KEY_”.

keyvalToLower

keyvalToLower Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

keyval: a key value.

-> m Word32

Returns: the lower case form of keyval, or keyval itself if it is already in lower case or it is not subject to case conversion.

Converts a key value to lower case, if applicable.

keyvalToUnicode

keyvalToUnicode Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

keyval: a GDK key symbol

-> m Word32

Returns: the corresponding unicode character, or 0 if there is no corresponding character.

Convert from a GDK key symbol to the corresponding ISO10646 (Unicode) character.

keyvalToUpper

keyvalToUpper Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

keyval: a key value.

-> m Word32

Returns: the upper case form of keyval, or keyval itself if it is already in upper case or it is not subject to case conversion.

Converts a key value to upper case, if applicable.

listVisuals

listVisuals Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m [Visual]

Returns: a list of visuals; the list must be freed, but not its contents

Deprecated: (Since version 3.22)Use gdk_screen_list_visuals (gdk_screen_get_default ()).

Lists the available visuals for the default screen. (See screenListVisuals) A visual describes a hardware image data format. For example, a visual might support 24-bit color, or 8-bit color, and might expect pixels to be in a certain format.

Call g_list_free() on the return value when you’re finished with it.

notifyStartupComplete

notifyStartupComplete :: (HasCallStack, MonadIO m) => m () Source #

Indicates to the GUI environment that the application has finished loading. If the applications opens windows, this function is normally called after opening the application’s initial set of windows.

GTK+ will call this function automatically after opening the first GtkWindow unless gtk_window_set_auto_startup_notification() is called to disable that feature.

Since: 2.2

notifyStartupCompleteWithId

notifyStartupCompleteWithId Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

startupId: a startup-notification identifier, for which notification process should be completed

-> m () 

Indicates to the GUI environment that the application has finished loading, using a given identifier.

GTK+ will call this function automatically for GtkWindow with custom startup-notification identifier unless gtk_window_set_auto_startup_notification() is called to disable that feature.

Since: 2.12

offscreenWindowGetEmbedder

offscreenWindowGetEmbedder Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindow a) 
=> a

window: a Window

-> m (Maybe Window)

Returns: the embedding Window, or Nothing if window is not an mbedded offscreen window

Gets the window that window is embedded in.

Since: 2.18

offscreenWindowGetSurface

offscreenWindowGetSurface Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindow a) 
=> a

window: a Window

-> m (Maybe Surface)

Returns: The offscreen surface, or Nothing if not offscreen

Gets the offscreen surface that an offscreen window renders into. If you need to keep this around over window resizes, you need to add a reference to it.

offscreenWindowSetEmbedder

offscreenWindowSetEmbedder Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindow a, IsWindow b) 
=> a

window: a Window

-> b

embedder: the Window that window gets embedded in

-> m () 

Sets window to be embedded in embedder.

To fully embed an offscreen window, in addition to calling this function, it is also necessary to handle the Window::pick-embedded-child signal on the embedder and the Window::to-embedder and Window::from-embedder signals on window.

Since: 2.18

pangoContextGet

pangoContextGet Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Context

Returns: a new Context for the default display

Creates a Context for the default GDK screen.

The context must be freed when you’re finished with it.

When using GTK+, normally you should use gtk_widget_get_pango_context() instead of this function, to get the appropriate context for the widget you intend to render text onto.

The newly created context will have the default font options (see FontOptions) for the default screen; if these options change it will not be updated. Using gtk_widget_get_pango_context() is more convenient if you want to keep a context around and track changes to the screen’s font rendering settings.

pangoContextGetForDisplay

pangoContextGetForDisplay Source #

Arguments

:: (HasCallStack, MonadIO m, IsDisplay a) 
=> a

display: the Display for which the context is to be created

-> m Context

Returns: a new Context for display

Creates a Context for display.

The context must be freed when you’re finished with it.

When using GTK+, normally you should use gtk_widget_get_pango_context() instead of this function, to get the appropriate context for the widget you intend to render text onto.

The newly created context will have the default font options (see FontOptions) for the display; if these options change it will not be updated. Using gtk_widget_get_pango_context() is more convenient if you want to keep a context around and track changes to the font rendering settings.

Since: 3.22

pangoContextGetForScreen

pangoContextGetForScreen Source #

Arguments

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

screen: the Screen for which the context is to be created.

-> m Context

Returns: a new Context for screen

Creates a Context for screen.

The context must be freed when you’re finished with it.

When using GTK+, normally you should use gtk_widget_get_pango_context() instead of this function, to get the appropriate context for the widget you intend to render text onto.

The newly created context will have the default font options (see FontOptions) for the screen; if these options change it will not be updated. Using gtk_widget_get_pango_context() is more convenient if you want to keep a context around and track changes to the screen’s font rendering settings.

Since: 2.2

parseArgs

parseArgs Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [Text]

argv: the array of command line arguments.

-> m [Text] 

Parse command line arguments, and store for future use by calls to displayOpen.

Any arguments used by GDK are removed from the array and argc and argv are updated accordingly.

You shouldn’t call this function explicitly if you are using gtk_init(), gtk_init_check(), init, or initCheck.

Since: 2.2

pixbufGetFromSurface

pixbufGetFromSurface Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Surface

surface: surface to copy from

-> Int32

srcX: Source X coordinate within surface

-> Int32

srcY: Source Y coordinate within surface

-> Int32

width: Width in pixels of region to get

-> Int32

height: Height in pixels of region to get

-> m (Maybe Pixbuf)

Returns: A newly-created pixbuf with a reference count of 1, or Nothing on error

Transfers image data from a Surface and converts it to an RGB(A) representation inside a Pixbuf. This allows you to efficiently read individual pixels from cairo surfaces. For GdkWindows, use pixbufGetFromWindow instead.

This function will create an RGB pixbuf with 8 bits per channel. The pixbuf will contain an alpha channel if the surface contains one.

pixbufGetFromWindow

pixbufGetFromWindow Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindow a) 
=> a

window: Source window

-> Int32

srcX: Source X coordinate within window

-> Int32

srcY: Source Y coordinate within window

-> Int32

width: Width in pixels of region to get

-> Int32

height: Height in pixels of region to get

-> m (Maybe Pixbuf)

Returns: A newly-created pixbuf with a reference count of 1, or Nothing on error

Transfers image data from a Window and converts it to an RGB(A) representation inside a Pixbuf. In other words, copies image data from a server-side drawable to a client-side RGB(A) buffer. This allows you to efficiently read individual pixels on the client side.

This function will create an RGB pixbuf with 8 bits per channel with the size specified by the width and height arguments scaled by the scale factor of window. The pixbuf will contain an alpha channel if the window contains one.

If the window is off the screen, then there is no image data in the obscured/offscreen regions to be placed in the pixbuf. The contents of portions of the pixbuf corresponding to the offscreen region are undefined.

If the window you’re obtaining data from is partially obscured by other windows, then the contents of the pixbuf areas corresponding to the obscured regions are undefined.

If the window is not mapped (typically because it’s iconified/minimized or not on the current workspace), then Nothing will be returned.

If memory can’t be allocated for the return value, Nothing will be returned instead.

(In short, there are several ways this function can fail, and if it fails it returns Nothing; so check the return value.)

pointerGrab

pointerGrab Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindow a, IsWindow b, IsCursor c) 
=> a

window: the Window which will own the grab (the grab window).

-> Bool

ownerEvents: if False then all pointer events are reported with respect to window and are only reported if selected by eventMask. If True then pointer events for this application are reported as normal, but pointer events outside this application are reported with respect to window and only if selected by eventMask. In either mode, unreported events are discarded.

-> [EventMask]

eventMask: specifies the event mask, which is used in accordance with ownerEvents. Note that only pointer events (i.e. button and motion events) may be selected.

-> Maybe b

confineTo: If non-Nothing, the pointer will be confined to this window during the grab. If the pointer is outside confineTo, it will automatically be moved to the closest edge of confineTo and enter and leave events will be generated as necessary.

-> Maybe c

cursor: the cursor to display while the grab is active. If this is Nothing then the normal cursors are used for window and its descendants, and the cursor for window is used for all other windows.

-> Word32

time_: the timestamp of the event which led to this pointer grab. This usually comes from a EventButton struct, though CURRENT_TIME can be used if the time isn’t known.

-> m GrabStatus

Returns: GrabStatusSuccess if the grab was successful.

Deprecated: (Since version 3.0)Use deviceGrab instead.

Grabs the pointer (usually a mouse) so that all events are passed to this application until the pointer is ungrabbed with pointerUngrab, or the grab window becomes unviewable. This overrides any previous pointer grab by this client.

Pointer grabs are used for operations which need complete control over mouse events, even if the mouse leaves the application. For example in GTK+ it is used for Drag and Drop, for dragging the handle in the GtkHPaned and GtkVPaned widgets.

Note that if the event mask of an X window has selected both button press and button release events, then a button press event will cause an automatic pointer grab until the button is released. X does this automatically since most applications expect to receive button press and release events in pairs. It is equivalent to a pointer grab on the window with ownerEvents set to True.

If you set up anything at the time you take the grab that needs to be cleaned up when the grab ends, you should handle the EventGrabBroken events that are emitted when the grab ends unvoluntarily.

pointerIsGrabbed

pointerIsGrabbed Source #

Arguments

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

Returns: True if the pointer is currently grabbed by this application.

Deprecated: (Since version 3.0)Use displayDeviceIsGrabbed instead.

Returns True if the pointer on the default display is currently grabbed by this application.

Note that this does not take the inmplicit pointer grab on button presses into account.

pointerUngrab

pointerUngrab Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

time_: a timestamp from a Event, or CURRENT_TIME if no timestamp is available.

-> m () 

Deprecated: (Since version 3.0)Use deviceUngrab, together with deviceGrab instead.

Ungrabs the pointer on the default display, if it is grabbed by this application.

preParseLibgtkOnly

preParseLibgtkOnly :: (HasCallStack, MonadIO m) => m () Source #

Deprecated: (Since version 3.16)This symbol was never meant to be used outside of GTK+

Prepare for parsing command line arguments for GDK. This is not public API and should not be used in application code.

propertyDelete

propertyDelete Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindow a) 
=> a

window: a Window

-> Atom

property: the property to delete

-> m () 

Deletes a property from a window.

queryDepths

queryDepths :: (HasCallStack, MonadIO m) => m [Int32] Source #

Deprecated: (Since version 3.22)Visual selection should be done using screenGetSystemVisual and screenGetRgbaVisual

This function returns the available bit depths for the default screen. It’s equivalent to listing the visuals (listVisuals) and then looking at the depth field in each visual, removing duplicates.

The array returned by this function should not be freed.

queryVisualTypes

queryVisualTypes :: (HasCallStack, MonadIO m) => m [VisualType] Source #

Deprecated: (Since version 3.22)Visual selection should be done using screenGetSystemVisual and screenGetRgbaVisual

This function returns the available visual types for the default screen. It’s equivalent to listing the visuals (listVisuals) and then looking at the type field in each visual, removing duplicates.

The array returned by this function should not be freed.

selectionConvert

selectionConvert Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindow a) 
=> a

requestor: a Window.

-> Atom

selection: an atom identifying the selection to get the contents of.

-> Atom

target: the form in which to retrieve the selection.

-> Word32

time_: the timestamp to use when retrieving the selection. The selection owner may refuse the request if it did not own the selection at the time indicated by the timestamp.

-> m () 

Retrieves the contents of a selection in a given form.

selectionOwnerGet

selectionOwnerGet Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Atom

selection: an atom indentifying a selection.

-> m (Maybe Window)

Returns: if there is a selection owner for this window, and it is a window known to the current process, the Window that owns the selection, otherwise Nothing. Note that the return value may be owned by a different process if a foreign window was previously created for that window, but a new foreign window will never be created by this call.

Determines the owner of the given selection.

selectionOwnerGetForDisplay

selectionOwnerGetForDisplay Source #

Arguments

:: (HasCallStack, MonadIO m, IsDisplay a) 
=> a

display: a Display

-> Atom

selection: an atom indentifying a selection

-> m (Maybe Window)

Returns: if there is a selection owner for this window, and it is a window known to the current process, the Window that owns the selection, otherwise Nothing.

Determine the owner of the given selection.

Note that the return value may be owned by a different process if a foreign window was previously created for that window, but a new foreign window will never be created by this call.

Since: 2.2

selectionOwnerSet

selectionOwnerSet Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindow a) 
=> Maybe a

owner: a Window or Nothing to indicate that the the owner for the given should be unset.

-> Atom

selection: an atom identifying a selection.

-> Word32

time_: timestamp to use when setting the selection. If this is older than the timestamp given last time the owner was set for the given selection, the request will be ignored.

-> Bool

sendEvent: if True, and the new owner is different from the current owner, the current owner will be sent a SelectionClear event.

-> m Bool

Returns: True if the selection owner was successfully changed to owner, otherwise False.

Sets the owner of the given selection.

selectionOwnerSetForDisplay

selectionOwnerSetForDisplay Source #

Arguments

:: (HasCallStack, MonadIO m, IsDisplay a, IsWindow b) 
=> a

display: the Display

-> Maybe b

owner: a Window or Nothing to indicate that the owner for the given should be unset

-> Atom

selection: an atom identifying a selection

-> Word32

time_: timestamp to use when setting the selection If this is older than the timestamp given last time the owner was set for the given selection, the request will be ignored

-> Bool

sendEvent: if True, and the new owner is different from the current owner, the current owner will be sent a SelectionClear event

-> m Bool

Returns: True if the selection owner was successfully changed to owner, otherwise False.

Sets the Window owner as the current owner of the selection selection.

Since: 2.2

selectionSendNotify

selectionSendNotify Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindow a) 
=> a

requestor: window to which to deliver response.

-> Atom

selection: selection that was requested.

-> Atom

target: target that was selected.

-> Atom

property: property in which the selection owner stored the data, or GDK_NONE to indicate that the request was rejected.

-> Word32

time_: timestamp.

-> m () 

Sends a response to SelectionRequest event.

selectionSendNotifyForDisplay

selectionSendNotifyForDisplay Source #

Arguments

:: (HasCallStack, MonadIO m, IsDisplay a, IsWindow b) 
=> a

display: the Display where requestor is realized

-> b

requestor: window to which to deliver response

-> Atom

selection: selection that was requested

-> Atom

target: target that was selected

-> Atom

property: property in which the selection owner stored the data, or GDK_NONE to indicate that the request was rejected

-> Word32

time_: timestamp

-> m () 

Send a response to SelectionRequest event.

Since: 2.2

setAllowedBackends

setAllowedBackends Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

backends: a comma-separated list of backends

-> m () 

Sets a list of backends that GDK should try to use.

This can be be useful if your application does not work with certain GDK backends.

By default, GDK tries all included backends.

For example,

C code

gdk_set_allowed_backends ("wayland,quartz,*");

instructs GDK to try the Wayland backend first, followed by the Quartz backend, and then all others.

If the GDK_BACKEND environment variable is set, it determines what backends are tried in what order, while still respecting the set of allowed backends that are specified by this function.

The possible backend names are x11, win32, quartz, broadway, wayland. You can also include a * in the list to try all remaining backends.

This call must happen prior to displayOpen, gtk_init(), gtk_init_with_args() or gtk_init_check() in order to take effect.

Since: 3.10

setDoubleClickTime

setDoubleClickTime Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

msec: double click time in milliseconds (thousandths of a second)

-> m () 

Set the double click time for the default display. See displaySetDoubleClickTime. See also displaySetDoubleClickDistance. Applications should not set this, it is a global user-configured setting.

setProgramClass

setProgramClass Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

programClass: a string.

-> m () 

Sets the program class. The X11 backend uses the program class to set the class name part of the WM_CLASS property on toplevel windows; see the ICCCM.

The program class can still be overridden with the --class command line option.

setShowEvents

setShowEvents Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Bool

showEvents: True to output event debugging information.

-> m () 

Sets whether a trace of received events is output. Note that GTK+ must be compiled with debugging (that is, configured using the --enable-debug option) to use this option.

settingGet

settingGet Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

name: the name of the setting.

-> GValue

value: location to store the value of the setting.

-> m Bool

Returns: True if the setting existed and a value was stored in value, False otherwise.

Obtains a desktop-wide setting, such as the double-click time, for the default screen. See screenGetSetting.

synthesizeWindowState

synthesizeWindowState :: (HasCallStack, MonadIO m, IsWindow a) => a -> [WindowState] -> [WindowState] -> m () Source #

No description available in the introspection data.

testRenderSync

testRenderSync Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindow a) 
=> a

window: a mapped Window

-> m () 

Retrieves a pixel from window to force the windowing system to carry out any pending rendering commands.

This function is intended to be used to synchronize with rendering pipelines, to benchmark windowing system rendering operations.

Since: 2.14

testSimulateButton

testSimulateButton Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindow a) 
=> a

window: a Window to simulate a button event for

-> Int32

x: x coordinate within window for the button event

-> Int32

y: y coordinate within window for the button event

-> Word32

button: Number of the pointer button for the event, usually 1, 2 or 3

-> [ModifierType]

modifiers: Keyboard modifiers the event is setup with

-> EventType

buttonPressrelease: either EventTypeButtonPress or EventTypeButtonRelease

-> m Bool

Returns: whether all actions necessary for a button event simulation were carried out successfully

This function is intended to be used in GTK+ test programs. It will warp the mouse pointer to the given (x,y) coordinates within window and simulate a button press or release event. Because the mouse pointer needs to be warped to the target location, use of this function outside of test programs that run in their own virtual windowing system (e.g. Xvfb) is not recommended.

Also, testSimulateButton is a fairly low level function, for most testing purposes, gtk_test_widget_click() is the right function to call which will generate a button press event followed by its accompanying button release event.

Since: 2.14

testSimulateKey

testSimulateKey Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindow a) 
=> a

window: a Window to simulate a key event for

-> Int32

x: x coordinate within window for the key event

-> Int32

y: y coordinate within window for the key event

-> Word32

keyval: A GDK keyboard value

-> [ModifierType]

modifiers: Keyboard modifiers the event is setup with

-> EventType

keyPressrelease: either EventTypeKeyPress or EventTypeKeyRelease

-> m Bool

Returns: whether all actions necessary for a key event simulation were carried out successfully

This function is intended to be used in GTK+ test programs. If (x,y) are > (-1,-1), it will warp the mouse pointer to the given (x,y) coordinates within window and simulate a key press or release event.

When the mouse pointer is warped to the target location, use of this function outside of test programs that run in their own virtual windowing system (e.g. Xvfb) is not recommended. If (x,y) are passed as (-1,-1), the mouse pointer will not be warped and window origin will be used as mouse pointer location for the event.

Also, testSimulateKey is a fairly low level function, for most testing purposes, gtk_test_widget_send_key() is the right function to call which will generate a key press event followed by its accompanying key release event.

Since: 2.14

textPropertyToUtf8ListForDisplay

textPropertyToUtf8ListForDisplay Source #

Arguments

:: (HasCallStack, MonadIO m, IsDisplay a) 
=> a

display: a Display

-> Atom

encoding: an atom representing the encoding of the text

-> Int32

format: the format of the property

-> ByteString

text: the text to convert

-> m (Int32, [Text])

Returns: the number of strings in the resulting list

Converts a text property in the given encoding to a list of UTF-8 strings.

Since: 2.2

threadsAddIdle

threadsAddIdle Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Int32

priority: the priority of the idle source. Typically this will be in the range between PRIORITY_DEFAULT_IDLE and PRIORITY_HIGH_IDLE

-> SourceFunc

function: function to call

-> m Word32

Returns: the ID (greater than 0) of the event source.

Adds a function to be called whenever there are no higher priority events pending. If the function returns False it is automatically removed from the list of event sources and will not be called again.

This variant of idleAdd calls function with the GDK lock held. It can be thought of a MT-safe version for GTK+ widgets for the following use case, where you have to worry about idle_callback() running in thread A and accessing self after it has been finalized in thread B:

C code

static gboolean
idle_callback (gpointer data)
{
   // gdk_threads_enter(); would be needed for g_idle_add()

   SomeWidget *self = data;
   // do stuff with self

   self->idle_id = 0;

   // gdk_threads_leave(); would be needed for g_idle_add()
   return FALSE;
}

static void
some_widget_do_stuff_later (SomeWidget *self)
{
   self->idle_id = gdk_threads_add_idle (idle_callback, self)
   // using g_idle_add() here would require thread protection in the callback
}

static void
some_widget_finalize (GObject *object)
{
   SomeWidget *self = SOME_WIDGET (object);
   if (self->idle_id)
     g_source_remove (self->idle_id);
   G_OBJECT_CLASS (parent_class)->finalize (object);
}

Since: 2.12

threadsAddTimeout

threadsAddTimeout Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Int32

priority: the priority of the timeout source. Typically this will be in the range between PRIORITY_DEFAULT_IDLE and PRIORITY_HIGH_IDLE.

-> Word32

interval: the time between calls to the function, in milliseconds (1/1000ths of a second)

-> SourceFunc

function: function to call

-> m Word32

Returns: the ID (greater than 0) of the event source.

Sets a function to be called at regular intervals holding the GDK lock, with the given priority. The function is called repeatedly until it returns False, at which point the timeout is automatically destroyed and the function will not be called again. The notify function is called when the timeout is destroyed. The first call to the function will be at the end of the first interval.

Note that timeout functions may be delayed, due to the processing of other event sources. Thus they should not be relied on for precise timing. After each call to the timeout function, the time of the next timeout is recalculated based on the current time and the given interval (it does not try to “catch up” time lost in delays).

This variant of timeoutAdd can be thought of a MT-safe version for GTK+ widgets for the following use case:

C code

static gboolean timeout_callback (gpointer data)
{
   SomeWidget *self = data;
   
   // do stuff with self
   
   self->timeout_id = 0;
   
   return G_SOURCE_REMOVE;
}
 
static void some_widget_do_stuff_later (SomeWidget *self)
{
   self->timeout_id = g_timeout_add (timeout_callback, self)
}
 
static void some_widget_finalize (GObject *object)
{
   SomeWidget *self = SOME_WIDGET (object);
   
   if (self->timeout_id)
     g_source_remove (self->timeout_id);
   
   G_OBJECT_CLASS (parent_class)->finalize (object);
}

Since: 2.12

threadsAddTimeoutSeconds

threadsAddTimeoutSeconds Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Int32

priority: the priority of the timeout source. Typically this will be in the range between PRIORITY_DEFAULT_IDLE and PRIORITY_HIGH_IDLE.

-> Word32

interval: the time between calls to the function, in seconds

-> SourceFunc

function: function to call

-> m Word32

Returns: the ID (greater than 0) of the event source.

A variant of threadsAddTimeout with second-granularity. See timeoutAddSeconds for a discussion of why it is a good idea to use this function if you don’t need finer granularity.

Since: 2.14

threadsEnter

threadsEnter :: (HasCallStack, MonadIO m) => m () Source #

Deprecated: (Since version 3.6)All GDK and GTK+ calls should be made from the main thread

This function marks the beginning of a critical section in which GDK and GTK+ functions can be called safely and without causing race conditions. Only one thread at a time can be in such a critial section.

threadsInit

threadsInit :: (HasCallStack, MonadIO m) => m () Source #

Deprecated: (Since version 3.6)All GDK and GTK+ calls should be made from the main thread

Initializes GDK so that it can be used from multiple threads in conjunction with threadsEnter and threadsLeave.

This call must be made before any use of the main loop from GTK+; to be safe, call it before gtk_init().

threadsLeave

threadsLeave :: (HasCallStack, MonadIO m) => m () Source #

Deprecated: (Since version 3.6)All GDK and GTK+ calls should be made from the main thread

Leaves a critical region begun with threadsEnter.

unicodeToKeyval

unicodeToKeyval Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

wc: a ISO10646 encoded character

-> m Word32

Returns: the corresponding GDK key symbol, if one exists. or, if there is no corresponding symbol, wc | 0x01000000

Convert from a ISO10646 character to a key symbol.

utf8ToStringTarget

utf8ToStringTarget Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

str: a UTF-8 string

-> m (Maybe Text)

Returns: the newly-allocated string, or Nothing if the conversion failed. (It should not fail for any properly formed UTF-8 string unless system limits like memory or file descriptors are exceeded.)

Converts an UTF-8 string into the best possible representation as a STRING. The representation of characters not in STRING is not specified; it may be as pseudo-escape sequences \x{ABCD}, or it may be in some other form of approximation.