Functions
The following functions are available globally.
-
Checks all open displays for a
GdkEvent
to process,to be processed on, fetching events from the windowing system if necessary. Seegdk_display_get_event()
.Declaration
Swift
@inlinable public func get() -> EventRef!
-
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+.)Declaration
Swift
@inlinable public func handlerSet(func: GdkEventFunc?, data: gpointer! = nil, notify: GDestroyNotify?)
-
If there is an event waiting in the event queue of some open display, returns a copy of it. See
gdk_display_peek_event()
.Declaration
Swift
@inlinable public func peek() -> EventRef!
-
Request more motion notifies if
event
is a motion notify hint event.This function should be used instead of
gdk_window_get_pointer()
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 aGDK_MOTION_NOTIFY
event usually works like this:(C Language Example):
{ // 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 }
Declaration
Swift
@inlinable public func requestMotions<EventMotionT>(event: EventMotionT) where EventMotionT : EventMotionProtocol
-
Appends gdk option entries to the passed in option group. This is not public API and must not be used by applications.
add_option_entries_libgtk_only is deprecated: This symbol was never meant to be used outside of GTK+
Declaration
Swift
@available(*, deprecated) @inlinable public func addOptionEntriesLibgtkOnly<OptionGroupT>(group: OptionGroupT) where OptionGroupT : OptionGroupProtocol
-
Finds or creates an atom corresponding to a given string.
Declaration
Swift
@inlinable public func atomIntern(atomName: UnsafePointer<gchar>!, onlyIfExists: Bool) -> GdkAtom!
-
Finds or creates an atom corresponding to a given string.
Note that this function is identical to
gdk_atom_intern()
except that if a newGdkAtom
is created the string itself is used rather than a copy. This saves memory, but can only be used if the string will always exist. It can be used with statically allocated strings in the main program, but not with statically allocated memory in dynamically loaded modules, if you expect to ever unload the module again (e.g. do not use this function in GTK+ theme engines).Declaration
Swift
@inlinable public func atomInternStaticString(atomName: UnsafePointer<gchar>!) -> GdkAtom!
-
Emits a short beep on the default display.
Declaration
Swift
@available(*, deprecated) @inlinable public func beep()
-
Creates a Cairo context for drawing to
window
.Note that calling
cairo_reset_clip()
on the resultingcairo_t
will produce undefined results, so avoid it at all costs.Typically, this function is used to draw on a
GdkWindow
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
GdkWindow
in response to aGDK_EXPOSE
event you should usegdk_window_begin_draw_frame()
andgdk_drawing_context_get_cairo_context()
instead. GTK will automatically do this for you when drawing a widget.cairo_create is deprecated: Use gdk_window_begin_draw_frame() and gdk_drawing_context_get_cairo_context() instead
Declaration
Swift
@available(*, deprecated) @inlinable public func cairoCreate<WindowT>(window: WindowT) -> Cairo.ContextRef! where WindowT : WindowProtocol
-
This is the main way to draw GL content in GTK+. It takes a render buffer ID (
source_type
==GL_RENDERBUFFER
) or a texture id (source_type
==GL_TEXTURE
) and draws it ontocr
with an OVER operation, respecting the current clip. The top left corner of the rectangle specified byx
,y
,width
andheight
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 tocr
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 useGL_TEXTURE
if using alpha.Calling this may change the current GL context.
Declaration
Swift
@inlinable public func cairoDrawFromGl<ContextT, WindowT>(cr: ContextT, window: WindowT, source: Int, sourceType: Int, bufferScale: Int, x: Int, y: Int, width: Int, height: Int) where ContextT : ContextProtocol, WindowT : WindowProtocol
-
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.Declaration
Swift
@inlinable public func cairoGetClipRectangle<ContextT>(cr: ContextT, rect: RectangleRef? = nil) -> Bool where ContextT : ContextProtocol
-
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.Declaration
Swift
@inlinable public func cairoGetClipRectangle<ContextT, RectangleT>(cr: ContextT, rect: RectangleT?) -> Bool where ContextT : ContextProtocol, RectangleT : RectangleProtocol
-
Retrieves the
GdkDrawingContext
that created the Cairo contextcr
.Declaration
Swift
@inlinable public func cairoGetDrawingContext<ContextT>(cr: ContextT) -> DrawingContextRef! where ContextT : ContextProtocol
-
Adds the given rectangle to the current path of
cr
.Declaration
Swift
@inlinable public func cairoRectangle<ContextT, RectangleT>(cr: ContextT, rectangle: RectangleT) where ContextT : ContextProtocol, RectangleT : RectangleProtocol
-
Adds the given region to the current path of
cr
.Declaration
Swift
@inlinable public func cairoRegion<ContextT, RegionT>(cr: ContextT, region: RegionT) where ContextT : ContextProtocol, RegionT : RegionProtocol
-
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()
.Declaration
Swift
@inlinable public func cairoRegionCreateFrom<SurfaceT>(surface: SurfaceT) -> Cairo.RegionRef! where SurfaceT : SurfaceProtocol
-
Sets the specified
GdkColor
as the source color ofcr
.cairo_set_source_color is deprecated: Use gdk_cairo_set_source_rgba() instead
Declaration
Swift
@available(*, deprecated) @inlinable public func cairoSetSourceColor<ColorT, ContextT>(cr: ContextT, color: ColorT) where ColorT : ColorProtocol, ContextT : ContextProtocol
-
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 ofpixbuf
ispixbuf_x
,pixbuf_y
.Declaration
Swift
@inlinable public func cairoSetSourcePixbuf<ContextT, PixbufT>(cr: ContextT, pixbuf: PixbufT, pixbufX: Double, pixbufY: Double) where ContextT : ContextProtocol, PixbufT : PixbufProtocol
-
Sets the specified
GdkRGBA
as the source color ofcr
.Declaration
Swift
@inlinable public func cairoSetSourceRgba<ContextT, RGBAT>(cr: ContextT, rgba: RGBAT) where ContextT : ContextProtocol, RGBAT : RGBAProtocol
-
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 ofwindow
isx
,y
. The window contains all its subwindows when rendering.Note that the contents of
window
are undefined outside of the visible part ofwindow
, so use this function with care.Declaration
Swift
@inlinable public func cairoSetSourceWindow<ContextT, WindowT>(cr: ContextT, window: WindowT, x: Double, y: Double) where ContextT : ContextProtocol, WindowT : WindowProtocol
-
Creates an image surface with the same contents as the pixbuf.
Declaration
Swift
@inlinable public func cairoSurfaceCreateFrom<PixbufT>(pixbuf: PixbufT, scale: Int, for window: WindowRef? = nil) -> Cairo.SurfaceRef! where PixbufT : PixbufProtocol
-
Creates an image surface with the same contents as the pixbuf.
Declaration
Swift
@inlinable public func cairoSurfaceCreateFrom<PixbufT, WindowT>(pixbuf: PixbufT, scale: Int, for window: WindowT?) -> Cairo.SurfaceRef! where PixbufT : PixbufProtocol, WindowT : WindowProtocol
-
Parses a textual specification of a color and fill in the
red
,green
, andblue
fields of aGdkColor
.The string can either one of a large set of standard names (taken from the X11
rgb.txt
file), or it can be a hexadecimal value in the form “`rgb” “\
rrggbb”, “\
rrrgggbbb” or “\
rrrrggggbbbb” where “r”, “g” and “b” are hex digits of the red, green, and blue components of the color, respectively. (White in the four forms is “\
fff”, “\
ffffff”, “\
fffffffff” and “\
ffffffffffff`”).color_parse is deprecated: Use #GdkRGBA
Declaration
Swift
@available(*, deprecated) @inlinable public func colorParse<ColorT>(spec: UnsafePointer<gchar>!, color: ColorT) -> Bool where ColorT : ColorProtocol
-
Disables multidevice support in GDK. This call must happen prior to
gdk_display_open()
,gtk_init()
,gtk_init_with_args()
orgtk_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.
Declaration
Swift
@inlinable public func disableMultidevice()
-
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
gdk_drag_context_manage_dnd()
for more information.Declaration
Swift
@inlinable public func dragAbort<DragContextT>(context: DragContextT, time_: guint32) where DragContextT : DragContextProtocol
-
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
gdk_drag_begin_for_device()
to begin a drag with a different device.This function is called by the drag source.
Declaration
Swift
@inlinable public func dragBegin<ListT, WindowT>(window: WindowT, targets: ListT) -> DragContextRef! where ListT : ListProtocol, WindowT : WindowProtocol
-
Starts a drag and creates a new drag context for it.
This function is called by the drag source.
Declaration
Swift
@inlinable public func dragBeginForDevice<DeviceT, ListT, WindowT>(window: WindowT, device: DeviceT, targets: ListT) -> DragContextRef! where DeviceT : DeviceProtocol, ListT : ListProtocol, WindowT : WindowProtocol
-
Starts a drag and creates a new drag context for it.
This function is called by the drag source.
Declaration
Swift
@inlinable public func dragBeginFromPoint<DeviceT, ListT, WindowT>(window: WindowT, device: DeviceT, targets: ListT, xRoot: Int, yRoot: Int) -> DragContextRef! where DeviceT : DeviceProtocol, ListT : ListProtocol, WindowT : WindowProtocol
-
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
gdk_drag_context_manage_dnd()
for more information.Declaration
Swift
@inlinable public func dragDrop<DragContextT>(context: DragContextT, time_: guint32) where DragContextT : DragContextProtocol
-
Inform GDK if the drop ended successfully. Passing
false
forsuccess
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
GdkDragContext
will only take the firstgdk_drag_drop_done()
call as effective, if this function is called multiple times, all subsequent calls will be ignored.Declaration
Swift
@inlinable public func dragDropDone<DragContextT>(context: DragContextT, success: Bool) where DragContextT : DragContextProtocol
-
Returns whether the dropped data has been successfully transferred. This function is intended to be used while handling a
GDK_DROP_FINISHED
event, its return value is meaningless at other times.Declaration
Swift
@inlinable public func dragDropSucceeded<DragContextT>(context: DragContextT) -> Bool where DragContextT : DragContextProtocol
-
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
dest_window
andprotocol
parameters forgdk_drag_motion()
.Declaration
Swift
@inlinable public func dragFindWindowForScreen<DragContextT, ScreenT, WindowT>(context: DragContextT, dragWindow: WindowT, screen: ScreenT, xRoot: Int, yRoot: Int, destWindow: UnsafeMutablePointer<UnsafeMutablePointer<GdkWindow>?>!, protocol: UnsafeMutablePointer<GdkDragProtocol>!) where DragContextT : DragContextProtocol, ScreenT : ScreenProtocol, WindowT : WindowProtocol
-
Returns the selection atom for the current source window.
Declaration
Swift
@inlinable public func dragGetSelection<DragContextT>(context: DragContextT) -> GdkAtom! where DragContextT : DragContextProtocol
-
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
gdk_drag_context_manage_dnd()
for more information.Declaration
Swift
@inlinable public func dragMotion<DragContextT, WindowT>(context: DragContextT, destWindow: WindowT, protocol: GdkDragProtocol, xRoot: Int, yRoot: Int, suggestedAction: DragAction, possibleActions: DragAction, time_: guint32) -> Bool where DragContextT : DragContextProtocol, WindowT : WindowProtocol
-
Selects one of the actions offered by the drag source.
This function is called by the drag destination in response to
gdk_drag_motion()
called by the drag source.Declaration
Swift
@inlinable public func dragStatus<DragContextT>(context: DragContextT, action: DragAction, time_: guint32) where DragContextT : DragContextProtocol
-
Ends the drag operation after a drop.
This function is called by the drag destination.
Declaration
Swift
@inlinable public func dropFinish<DragContextT>(context: DragContextT, success: Bool, time_: guint32) where DragContextT : DragContextProtocol
-
Accepts or rejects a drop.
This function is called by the drag destination in response to a drop initiated by the drag source.
Declaration
Swift
@inlinable public func dropReply<DragContextT>(context: DragContextT, accepted: Bool, time_: guint32) where DragContextT : DragContextProtocol
-
Removes an error trap pushed with
gdk_error_trap_push()
. May block until an error has been definitively received or not received from the X server.gdk_error_trap_pop_ignored()
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 ofgdk_error_trap_pop()
, usegdk_error_trap_pop_ignored()
.Prior to GDK 3.0, this function would not automatically sync for you, so you had to
gdk_flush()
if your last call to Xlib was not a blocking round trip.Declaration
Swift
@available(*, deprecated) @inlinable public func errorTrapPop() -> Int
-
Removes an error trap pushed with
gdk_error_trap_push()
, 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.Declaration
Swift
@available(*, deprecated) @inlinable public func errorTrapPopIgnored()
-
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
GdkDisplay
currently known to theGdkDisplayManager
. If you don’t care which error happens and just want to ignore everything, pop withgdk_error_trap_pop_ignored()
. If you need the error code, usegdk_error_trap_pop()
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 Language Example):
gdk_error_trap_push (); // ... Call the X function which may cause an error here ... if (gdk_error_trap_pop ()) { // ... Handle the error here ... }
Declaration
Swift
@available(*, deprecated) @inlinable public func errorTrapPush()
-
Checks all open displays for a
GdkEvent
to process,to be processed on, fetching events from the windowing system if necessary. Seegdk_display_get_event()
.Declaration
Swift
@inlinable public func eventGet() -> EventRef!
-
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+.)Declaration
Swift
@inlinable public func eventHandlerSet(func: GdkEventFunc?, data: gpointer! = nil, notify: GDestroyNotify?)
-
If there is an event waiting in the event queue of some open display, returns a copy of it. See
gdk_display_peek_event()
.Declaration
Swift
@inlinable public func eventPeek() -> EventRef!
-
Request more motion notifies if
event
is a motion notify hint event.This function should be used instead of
gdk_window_get_pointer()
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 aGDK_MOTION_NOTIFY
event usually works like this:(C Language Example):
{ // 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 }
Declaration
Swift
@inlinable public func eventRequestMotions<EventMotionT>(event: EventMotionT) where EventMotionT : EventMotionProtocol
-
If both events contain X/Y information, this function will return
true
and return inangle
the relative angle fromevent1
toevent2
. The rotation direction for positive angles is from the positive X axis towards the positive Y axis.Declaration
Swift
@inlinable public func eventsGetAngle<EventT>(event1: EventT, event2: EventT, angle: UnsafeMutablePointer<gdouble>!) -> Bool where EventT : EventProtocol
-
If both events contain X/Y information, the center of both coordinates will be returned in
x
andy
.Declaration
Swift
@inlinable public func eventsGetCenter<EventT>(event1: EventT, event2: EventT, x: UnsafeMutablePointer<gdouble>!, y: UnsafeMutablePointer<gdouble>!) -> Bool where EventT : EventProtocol
-
If both events have X/Y information, the distance between both coordinates (as in a straight line going from
event1
toevent2
) will be returned.Declaration
Swift
@inlinable public func eventsGetDistance<EventT>(event1: EventT, event2: EventT, distance: UnsafeMutablePointer<gdouble>!) -> Bool where EventT : EventProtocol
-
Checks if any events are ready to be processed for any display.
Declaration
Swift
@inlinable public func eventsPending() -> Bool
-
Flushes the output buffers of all display connections and waits until all requests have been processed. This is rarely needed by applications.
Declaration
Swift
@available(*, deprecated) @inlinable public func flush()
-
Obtains the root window (parent all other windows are inside) for the default display and screen.
Declaration
Swift
@inlinable public func getDefaultRootWindow() -> WindowRef!
-
Gets the name of the display, which usually comes from the
DISPLAY
environment variable or the--display
command line option.get_display is deprecated: Call gdk_display_get_name (gdk_display_get_default ())) instead.
Declaration
Swift
@available(*, deprecated) @inlinable public func getDisplay() -> String!
-
Gets the display name specified in the command line arguments passed to
gdk_init()
orgdk_parse_args()
, if any.Declaration
Swift
@inlinable public func getDisplayArgName() -> String!
-
Gets the program class. Unless the program class has explicitly been set with
gdk_set_program_class()
or with the--class
commandline option, the default value is the program name (determined withg_get_prgname()
) with the first character converted to uppercase.Declaration
Swift
@inlinable public func getProgramClass() -> String!
-
Gets whether event debugging output is enabled.
Declaration
Swift
@inlinable public func getShowEvents() -> Bool
-
Undocumented
Declaration
Swift
@inlinable public func glErrorQuark() -> GQuark
-
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
andargv
are updated accordingly.GTK+ initializes GDK in
gtk_init()
and so this function is not usually needed by GTK+ applications.Declaration
Swift
@inlinable public func init_(argc: UnsafeMutablePointer<gint>!, argv: UnsafeMutablePointer<UnsafeMutablePointer<UnsafeMutablePointer<gchar>?>?>!)
-
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
andargv
are updated accordingly.GTK+ initializes GDK in
gtk_init()
and so this function is not usually needed by GTK+ applications.Declaration
Swift
@inlinable public func initCheck(argc: UnsafeMutablePointer<gint>!, argv: UnsafeMutablePointer<UnsafeMutablePointer<UnsafeMutablePointer<gchar>?>?>!) -> Bool
-
Grabs the keyboard so that all events are passed to this application until the keyboard is ungrabbed with
gdk_keyboard_ungrab()
. 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
GdkEventGrabBroken
events that are emitted when the grab ends unvoluntarily.keyboard_grab is deprecated: Use gdk_device_grab() instead.
Declaration
Swift
@available(*, deprecated) @inlinable public func keyboardGrab<WindowT>(window: WindowT, ownerEvents: Bool, time_: guint32) -> GdkGrabStatus where WindowT : WindowProtocol
-
Ungrabs the keyboard on the default display, if it is grabbed by this application.
keyboard_ungrab is deprecated: Use gdk_device_ungrab(), together with gdk_device_grab() instead.
Declaration
Swift
@available(*, deprecated) @inlinable public func keyboardUngrab(time_: guint32)
-
Obtains the upper- and lower-case versions of the keyval
symbol
. Examples of keyvals areGDK_KEY_a
,GDK_KEY_Enter
,GDK_KEY_F1
, etc.Declaration
Swift
@inlinable public func keyvalConvertCase(symbol: Int, lower: UnsafeMutablePointer<guint>!, upper: UnsafeMutablePointer<guint>!)
-
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_”.Declaration
Swift
@inlinable public func keyvalFromName(keyvalName: UnsafePointer<gchar>!) -> Int
-
Returns
true
if the given key value is in lower case.Declaration
Swift
@inlinable public func keyvalIsLower(keyval: Int) -> Bool
-
Returns
true
if the given key value is in upper case.Declaration
Swift
@inlinable public func keyvalIsUpper(keyval: Int) -> Bool
-
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_”.Declaration
Swift
@inlinable public func keyvalName(keyval: Int) -> String!
-
Converts a key value to lower case, if applicable.
Declaration
Swift
@inlinable public func keyvalToLower(keyval: Int) -> Int
-
Convert from a GDK key symbol to the corresponding ISO10646 (Unicode) character.
Declaration
Swift
@inlinable public func keyvalToUnicode(keyval: Int) -> guint32
-
Converts a key value to upper case, if applicable.
Declaration
Swift
@inlinable public func keyvalToUpper(keyval: Int) -> Int
-
Lists the available visuals for the default screen. (See
gdk_screen_list_visuals()
) 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.list_visuals is deprecated: Use gdk_screen_list_visuals (gdk_screen_get_default ()).
Declaration
Swift
@available(*, deprecated) @inlinable public func listVisuals() -> GLib.ListRef!
-
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
unlessgtk_window_set_auto_startup_notification()
is called to disable that feature.Declaration
Swift
@inlinable public func notifyStartupComplete()
-
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 unlessgtk_window_set_auto_startup_notification()
is called to disable that feature.Declaration
Swift
@inlinable public func notifyStartupCompleteWithId(startupId: UnsafePointer<gchar>!)
-
Gets the window that
window
is embedded in.Declaration
Swift
@inlinable public func offscreenWindowGetEmbedder<WindowT>(window: WindowT) -> WindowRef! where WindowT : WindowProtocol
-
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.
Declaration
Swift
@inlinable public func offscreenWindowGetSurface<WindowT>(window: WindowT) -> Cairo.SurfaceRef! where WindowT : WindowProtocol
-
Sets
window
to be embedded inembedder
.To fully embed an offscreen window, in addition to calling this function, it is also necessary to handle the
GdkWindow::pick-embedded-child
signal on theembedder
and theGdkWindow::to-embedder
andGdkWindow::from-embedder
signals onwindow
.Declaration
Swift
@inlinable public func offscreenWindowSetEmbedder<WindowT>(window: WindowT, embedder: WindowT) where WindowT : WindowProtocol
-
Creates a
PangoContext
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
cairo_font_options_t
) for the default screen; if these options change it will not be updated. Usinggtk_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.Declaration
Swift
@inlinable public func pangoContextGet() -> Pango.ContextRef!
-
Creates a
PangoContext
fordisplay
.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
cairo_font_options_t
) for the display; if these options change it will not be updated. Usinggtk_widget_get_pango_context()
is more convenient if you want to keep a context around and track changes to the font rendering settings.Declaration
Swift
@inlinable public func pangoContextGetFor<DisplayT>(display: DisplayT) -> Pango.ContextRef! where DisplayT : DisplayProtocol
-
Creates a
PangoContext
forscreen
.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
cairo_font_options_t
) for the screen; if these options change it will not be updated. Usinggtk_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.Declaration
Swift
@inlinable public func pangoContextGetFor<ScreenT>(screen: ScreenT) -> Pango.ContextRef! where ScreenT : ScreenProtocol
-
Obtains a clip region which contains the areas where the given ranges of text would be drawn.
x_origin
andy_origin
are the top left point to center the layout.index_ranges
should contain ranges of bytes in the layout’s text.Note that the regions returned correspond to logical extents of the text ranges, not ink extents. So the drawn layout may in fact touch areas out of the clip region. The clip region is mainly useful for highlightling parts of text, such as when text is selected.
Declaration
Swift
@inlinable public func pangoLayoutGetClipRegion<LayoutT>(layout: LayoutT, xOrigin: Int, yOrigin: Int, indexRanges: UnsafePointer<gint>!, nRanges: Int) -> Cairo.RegionRef! where LayoutT : LayoutProtocol
-
Obtains a clip region which contains the areas where the given ranges of text would be drawn.
x_origin
andy_origin
are the top left position of the layout.index_ranges
should contain ranges of bytes in the layout’s text. The clip region will include space to the left or right of the line (to the layout bounding box) if you have indexes above or below the indexes contained inside the line. This is to draw the selection all the way to the side of the layout. However, the clip region is in line coordinates, not layout coordinates.Note that the regions returned correspond to logical extents of the text ranges, not ink extents. So the drawn line may in fact touch areas out of the clip region. The clip region is mainly useful for highlightling parts of text, such as when text is selected.
Declaration
Swift
@inlinable public func pangoLayoutLineGetClipRegion<LayoutLineT>(line: LayoutLineT, xOrigin: Int, yOrigin: Int, indexRanges: UnsafePointer<gint>!, nRanges: Int) -> Cairo.RegionRef! where LayoutLineT : LayoutLineProtocol
-
Parse command line arguments, and store for future use by calls to
gdk_display_open()
.Any arguments used by GDK are removed from the array and
argc
andargv
are updated accordingly.You shouldn’t call this function explicitly if you are using
gtk_init()
,gtk_init_check()
,gdk_init()
, orgdk_init_check()
.Declaration
Swift
@inlinable public func parseArgs(argc: UnsafeMutablePointer<gint>!, argv: UnsafeMutablePointer<UnsafeMutablePointer<UnsafeMutablePointer<gchar>?>?>!)
-
Transfers image data from a
cairo_surface_t
and converts it to anRGB(A)
representation inside aGdkPixbuf
. This allows you to efficiently read individual pixels from cairo surfaces. ForGdkWindows
, usegdk_pixbuf_get_from_window()
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.Declaration
Swift
@inlinable public func pixbufGetFrom<SurfaceT>(surface: SurfaceT, srcX: Int, srcY: Int, width: Int, height: Int) -> PixbufRef! where SurfaceT : SurfaceProtocol
-
Transfers image data from a
GdkWindow
and converts it to anRGB(A)
representation inside aGdkPixbuf
. In other words, copies image data from a server-side drawable to a client-sideRGB(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
andheight
arguments scaled by the scale factor ofwindow
. The pixbuf will contain an alpha channel if thewindow
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
nil
will be returned.If memory can’t be allocated for the return value,
nil
will be returned instead.(In short, there are several ways this function can fail, and if it fails it returns
nil
; so check the return value.)Declaration
Swift
@inlinable public func pixbufGetFrom<WindowT>(window: WindowT, srcX: Int, srcY: Int, width: Int, height: Int) -> PixbufRef! where WindowT : WindowProtocol
-
Grabs the pointer (usually a mouse) so that all events are passed to this application until the pointer is ungrabbed with
gdk_pointer_ungrab()
, 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
andGtkVPaned
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
owner_events
set totrue
.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
GdkEventGrabBroken
events that are emitted when the grab ends unvoluntarily.pointer_grab is deprecated: Use gdk_device_grab() instead.
Declaration
Swift
@available(*, deprecated) @inlinable public func pointerGrab<WindowT>(window: WindowT, ownerEvents: Bool, eventMask: EventMask, confineTo: WindowRef? = nil, cursor: CursorRef? = nil, time_: guint32) -> GdkGrabStatus where WindowT : WindowProtocol
-
Grabs the pointer (usually a mouse) so that all events are passed to this application until the pointer is ungrabbed with
gdk_pointer_ungrab()
, 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
andGtkVPaned
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
owner_events
set totrue
.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
GdkEventGrabBroken
events that are emitted when the grab ends unvoluntarily.pointer_grab is deprecated: Use gdk_device_grab() instead.
Declaration
Swift
@available(*, deprecated) @inlinable public func pointerGrab<CursorT, WindowT>(window: WindowT, ownerEvents: Bool, eventMask: EventMask, confineTo: WindowT?, cursor: CursorT?, time_: guint32) -> GdkGrabStatus where CursorT : CursorProtocol, WindowT : WindowProtocol
-
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.
pointer_is_grabbed is deprecated: Use gdk_display_device_is_grabbed() instead.
Declaration
Swift
@available(*, deprecated) @inlinable public func pointerIsGrabbed() -> Bool
-
Ungrabs the pointer on the default display, if it is grabbed by this application.
pointer_ungrab is deprecated: Use gdk_device_ungrab(), together with gdk_device_grab() instead.
Declaration
Swift
@available(*, deprecated) @inlinable public func pointerUngrab(time_: guint32)
-
Prepare for parsing command line arguments for GDK. This is not public API and should not be used in application code.
pre_parse_libgtk_only is deprecated: This symbol was never meant to be used outside of GTK+
Declaration
Swift
@available(*, deprecated) @inlinable public func preParseLibgtkOnly()
-
Changes the contents of a property on a window.
Declaration
Swift
@inlinable public func propertyChange<WindowT, AtomT>(window: WindowT, property: AtomT!, type: AtomT!, format: Int, mode: GdkPropMode, data: UnsafePointer<guchar>!, nelements: Int) where WindowT : WindowProtocol, AtomT : AtomProtocol
-
Deletes a property from a window.
Declaration
Swift
@inlinable public func propertyDelete<WindowT>(window: WindowT, property: GdkAtom!) where WindowT : WindowProtocol
-
This function returns the available bit depths for the default screen. It’s equivalent to listing the visuals (
gdk_list_visuals()
) and then looking at the depth field in each visual, removing duplicates.The array returned by this function should not be freed.
query_depths is deprecated: Visual selection should be done using gdk_screen_get_system_visual() and gdk_screen_get_rgba_visual()
Declaration
Swift
@available(*, deprecated) @inlinable public func query(depths: UnsafeMutablePointer<UnsafeMutablePointer<gint>?>!, count: UnsafeMutablePointer<gint>!)
-
This function returns the available visual types for the default screen. It’s equivalent to listing the visuals (
gdk_list_visuals()
) and then looking at the type field in each visual, removing duplicates.The array returned by this function should not be freed.
query_visual_types is deprecated: Visual selection should be done using gdk_screen_get_system_visual() and gdk_screen_get_rgba_visual()
Declaration
Swift
@available(*, deprecated) @inlinable public func query(visualTypes: UnsafeMutablePointer<UnsafeMutablePointer<GdkVisualType>?>!, count: UnsafeMutablePointer<gint>!)
-
Retrieves the contents of a selection in a given form.
Declaration
Swift
@inlinable public func selectionConvert<WindowT>(requestor: WindowT, selection: GdkAtom!, target: GdkAtom!, time_: guint32) where WindowT : WindowProtocol
-
Determines the owner of the given selection.
Declaration
Swift
@inlinable public func selectionOwnerGet(selection: GdkAtom!) -> WindowRef!
-
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.
Declaration
Swift
@inlinable public func selectionOwnerGetFor<DisplayT>(display: DisplayT, selection: GdkAtom!) -> WindowRef! where DisplayT : DisplayProtocol
-
Sets the owner of the given selection.
Declaration
Swift
@inlinable public func selectionOwnerSet(owner: WindowRef? = nil, selection: GdkAtom!, time_: guint32, sendEvent: Bool) -> Bool
-
Sets the owner of the given selection.
Declaration
Swift
@inlinable public func selectionOwnerSet<WindowT>(owner: WindowT?, selection: GdkAtom!, time_: guint32, sendEvent: Bool) -> Bool where WindowT : WindowProtocol
-
Sets the
GdkWindow
owner
as the current owner of the selectionselection
.Declaration
Swift
@inlinable public func selectionOwnerSetFor<DisplayT>(display: DisplayT, owner: WindowRef? = nil, selection: GdkAtom!, time_: guint32, sendEvent: Bool) -> Bool where DisplayT : DisplayProtocol
-
Sets the
GdkWindow
owner
as the current owner of the selectionselection
.Declaration
Swift
@inlinable public func selectionOwnerSetFor<DisplayT, WindowT>(display: DisplayT, owner: WindowT?, selection: GdkAtom!, time_: guint32, sendEvent: Bool) -> Bool where DisplayT : DisplayProtocol, WindowT : WindowProtocol
-
Retrieves selection data that was stored by the selection data in response to a call to
gdk_selection_convert()
. This function will not be used by applications, who should use theGtkClipboard
API instead.Declaration
Swift
@inlinable public func selectionPropertyGet<WindowT>(requestor: WindowT, data: UnsafeMutablePointer<UnsafeMutablePointer<guchar>?>!, propertyType: UnsafeMutablePointer<GdkAtom?>!, propertyFormat: UnsafeMutablePointer<gint>!) -> Int where WindowT : WindowProtocol
-
Sends a response to SelectionRequest event.
Declaration
Swift
@inlinable public func selectionSendNotify<WindowT>(requestor: WindowT, selection: GdkAtom!, target: GdkAtom!, property: GdkAtom!, time_: guint32) where WindowT : WindowProtocol
-
Send a response to SelectionRequest event.
Declaration
Swift
@inlinable public func selectionSendNotifyFor<DisplayT, WindowT>(display: DisplayT, requestor: WindowT, selection: GdkAtom!, target: GdkAtom!, property: GdkAtom!, time_: guint32) where DisplayT : DisplayProtocol, WindowT : WindowProtocol
-
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 Language Example):
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
gdk_display_open()
,gtk_init()
,gtk_init_with_args()
orgtk_init_check()
in order to take effect.Declaration
Swift
@inlinable public func setAllowed(backends: UnsafePointer<gchar>!)
-
Set the double click time for the default display. See
gdk_display_set_double_click_time()
. See alsogdk_display_set_double_click_distance()
. Applications should not set this, it is a global user-configured setting.Declaration
Swift
@available(*, deprecated) @inlinable public func setDoubleClickTime(msec: Int)
-
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.
Declaration
Swift
@inlinable public func set(programClass: UnsafePointer<gchar>!)
-
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.Declaration
Swift
@inlinable public func set(showEvents: Bool)
-
Obtains a desktop-wide setting, such as the double-click time, for the default screen. See
gdk_screen_get_setting()
.Declaration
Swift
@inlinable public func settingGet<ValueT>(name: UnsafePointer<gchar>!, value: ValueT) -> Bool where ValueT : ValueProtocol
-
Undocumented
Declaration
Swift
@inlinable public func synthesizeWindowState<WindowT>(window: WindowT, unsetFlags: WindowState, setFlags: WindowState) where WindowT : WindowProtocol
-
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.
Declaration
Swift
@inlinable public func testRenderSync<WindowT>(window: WindowT) where WindowT : WindowProtocol
-
This function is intended to be used in GTK+ test programs. It will warp the mouse pointer to the given (
x
,y
) coordinates withinwindow
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,
gdk_test_simulate_button()
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.Declaration
Swift
@inlinable public func testSimulateButton<WindowT>(window: WindowT, x: Int, y: Int, button: Int, modifiers: ModifierType, buttonPressrelease: GdkEventType) -> Bool where WindowT : WindowProtocol
-
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 withinwindow
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 andwindow
origin will be used as mouse pointer location for the event.Also,
gdk_test_simulate_key()
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.Declaration
Swift
@inlinable public func testSimulateKey<WindowT>(window: WindowT, x: Int, y: Int, keyval: Int, modifiers: ModifierType, keyPressrelease: GdkEventType) -> Bool where WindowT : WindowProtocol
-
Converts a text property in the given encoding to a list of UTF-8 strings.
Declaration
Swift
@inlinable public func textPropertyToUtf8ListFor<DisplayT>(display: DisplayT, encoding: GdkAtom!, format: Int, text: UnsafePointer<guchar>!, length: Int, list: UnsafeMutablePointer<UnsafeMutablePointer<UnsafeMutablePointer<gchar>?>?>!) -> Int where DisplayT : DisplayProtocol
-
A wrapper for the common usage of
gdk_threads_add_idle_full()
assigning the default priority,G_PRIORITY_DEFAULT_IDLE
.See
gdk_threads_add_idle_full()
.Declaration
Swift
@inlinable public func threadsAddIdle(function: GSourceFunc?, data: gpointer! = nil) -> Int
-
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
g_idle_add_full()
callsfunction
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 aboutidle_callback()
running in thread A and accessingself
after it has been finalized in thread B:(C Language Example):
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); }
Declaration
Swift
@inlinable public func threadsAddIdleFull(priority: Int, function: GSourceFunc?, data: gpointer! = nil, notify: GDestroyNotify? = nil) -> Int
-
A wrapper for the common usage of
gdk_threads_add_timeout_full()
assigning the default priority,G_PRIORITY_DEFAULT
.See
gdk_threads_add_timeout_full()
.Declaration
Swift
@inlinable public func threadsAddTimeout(interval: Int, function: GSourceFunc?, data: gpointer! = nil) -> Int
-
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. Thenotify
function is called when the timeout is destroyed. The first call to the function will be at the end of the firstinterval
.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
g_timeout_add_full()
can be thought of a MT-safe version for GTK+ widgets for the following use case:(C Language Example):
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); }
Declaration
Swift
@inlinable public func threadsAddTimeoutFull(priority: Int, interval: Int, function: GSourceFunc?, data: gpointer! = nil, notify: GDestroyNotify? = nil) -> Int
-
A wrapper for the common usage of
gdk_threads_add_timeout_seconds_full()
assigning the default priority,G_PRIORITY_DEFAULT
.For details, see
gdk_threads_add_timeout_full()
.Declaration
Swift
@inlinable public func threadsAddTimeoutSeconds(interval: Int, function: GSourceFunc?, data: gpointer! = nil) -> Int
-
A variant of
gdk_threads_add_timeout_full()
with second-granularity. Seeg_timeout_add_seconds_full()
for a discussion of why it is a good idea to use this function if you don’t need finer granularity.Declaration
Swift
@inlinable public func threadsAddTimeoutSecondsFull(priority: Int, interval: Int, function: GSourceFunc?, data: gpointer! = nil, notify: GDestroyNotify? = nil) -> Int
-
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.
threads_enter is deprecated: All GDK and GTK+ calls should be made from the main thread
Declaration
Swift
@available(*, deprecated) @inlinable public func threadsEnter()
-
Initializes GDK so that it can be used from multiple threads in conjunction with
gdk_threads_enter()
andgdk_threads_leave()
.This call must be made before any use of the main loop from GTK+; to be safe, call it before
gtk_init()
.threads_init is deprecated: All GDK and GTK+ calls should be made from the main thread
Declaration
Swift
@available(*, deprecated) @inlinable public func threadsInit()
-
Leaves a critical region begun with
gdk_threads_enter()
.threads_leave is deprecated: All GDK and GTK+ calls should be made from the main thread
Declaration
Swift
@available(*, deprecated) @inlinable public func threadsLeave()
-
Allows the application to replace the standard method that GDK uses to protect its data structures. Normally, GDK creates a single
GMutex
that is locked bygdk_threads_enter()
, and released bygdk_threads_leave()
; using this function an application provides, instead, a functionenter_fn
that is called bygdk_threads_enter()
and a functionleave_fn
that is called bygdk_threads_leave()
.The functions must provide at least same locking functionality as the default implementation, but can also do extra application specific processing.
As an example, consider an application that has its own recursive lock that when held, holds the GTK+ lock as well. When GTK+ unlocks the GTK+ lock when entering a recursive main loop, the application must temporarily release its lock as well.
Most threaded GTK+ apps won’t need to use this method.
This method must be called before
gdk_threads_init()
, and cannot be called multiple times.threads_set_lock_functions is deprecated: All GDK and GTK+ calls should be made from the main thread
Declaration
Swift
@available(*, deprecated) @inlinable public func threadsSetLockFunctions(enterFn: GCallback?, leaveFn: GCallback?)
-
Convert from a ISO10646 character to a key symbol.
Declaration
Swift
@inlinable public func unicodeToKeyval(wc: guint32) -> Int
-
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.
Declaration
Swift
@inlinable public func utf8ToStringTarget(str: UnsafePointer<gchar>!) -> String!
-
Adds a closure or 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.
Declaration
Swift
@inlinable public func threadsAddIdle(priority p: Int32 = PRIORITY_DEFAULT_IDLE, callback: @escaping ThreadCallback) -> Int
Parameters
p
The priority to run, such as
PRIORITY_HIGH_IDLE
callback
The callback function or closure to call
Return Value
The ID (greater than 0) of the event source.