Gdk-3.0 Python API Documentation

Class: Gdk.AppLaunchContext

GdkAppLaunchContext is an implementation of #GAppLaunchContext that handles launching an application in a graphical context. It provides startup notification and allows to launch applications on a specific screen or workspace. <example> <title>Launching an application</title> <programlisting> GdkAppLaunchContext *context; context = gdk_display_get_app_launch_context (display); gdk_app_launch_context_set_screen (screen); gdk_app_launch_context_set_timestamp (event->time); if (!g_app_info_launch_default_for_uri ("http://www.gtk.org", context, &error)) g_object_unref (context); </programlisting> </example>

Properties

Gdk.Display"display"construct-only

Methods

voidset_desktop(desktop)

voidset_display(display)

voidset_icon(icon)

voidset_icon_name(icon_name)

voidset_screen(screen)

voidset_timestamp(timestamp)

Abstract Class: Gdk.Cursor

The #GdkCursor structure represents a cursor. Its contents are private.

Properties

Gdk.CursorType"cursor-type"construct-only

Gdk.Display"display"construct-only

Methods

Gdk.CursorTypeget_cursor_type()

Gdk.Displayget_display()

GdkPixbuf.Pixbufget_image()

Gdk.Cursorref()

voidunref()

Abstract Class: Gdk.Device

The #GdkDevice object represents a single input device, such as a keyboard, a mouse, a touchpad, etc. See the #GdkDeviceManager documentation for more information about the various kinds of master and slave devices, and their relationships.

Properties

Gdk.Device"associated-device"read-only

Associated pointer or keyboard with this device, if any. Devices of type #GDK_DEVICE_TYPE_MASTER always come in keyboard/pointer pairs. Other device types will have a %NULL associated device.

Gdk.InputMode"input-mode"read/write

Input mode for the device.

int"n-axes"read-only

Number of axes in the device.

string"name"construct-only

The device name.

Gdk.InputSource"input-source"construct-only

Source type for the device.

Gdk.DeviceManager"device-manager"construct-only

The #GdkDeviceManager the #GdkDevice pertains to.

Gdk.DeviceType"type"construct-only

Device role in the device manager.

Gdk.Display"display"construct-only

The #GdkDisplay the #GdkDevice pertains to.

bool"has-cursor"construct-only

Whether the device is represented by a cursor on the screen. Devices of type %GDK_DEVICE_TYPE_MASTER will have %TRUE here.

Signals

void"changed"(self, device)

The ::changed signal is emitted either when the #GdkDevice has changed the number of either axes or keys. For example In X this will normally happen when the slave device routing events through the master device changes (for example, user switches from the USB mouse to a tablet), in that case the master device will change to reflect the new slave device axes and keys.

Methods

Gdk.Deviceget_associated_device()

Gdk.AxisUseget_axis_use(index_)

Gdk.DeviceTypeget_device_type()

Gdk.Displayget_display()

boolget_has_cursor()

bool, int, Gdk.ModifierTypeget_key(index_)

Gdk.InputModeget_mode()

intget_n_axes()

intget_n_keys()

stringget_name()

void, Gdk.Screen, int, intget_position()

Gdk.InputSourceget_source()

Gdk.Window, int, intget_window_at_position()

Gdk.GrabStatusgrab(window, grab_ownership, owner_events, event_mask, cursor, time_)

bool, Gdk.Window, boolgrab_info_libgtk_only(display, device)(static method)

GLib.Listlist_axes()

GLib.Listlist_slave_devices()

voidset_axis_use(index_, use)

voidset_key(index_, keyval, modifiers)

boolset_mode(mode)

voidungrab(time_)

voidwarp(screen, x, y)

Abstract Class: Gdk.DeviceManager

In addition to a single pointer and keyboard for user interface input, GDK contains support for a variety of input devices, including graphics tablets, touchscreens and multiple pointers/keyboards interacting simultaneously with the user interface. Under X, the support for multiple input devices is done through the <firstterm>XInput 2</firstterm> extension, which also supports additional features such as sub-pixel positioning information and additional device-dependent information. By default, and if the platform supports it, GDK is aware of multiple keyboard/pointer pairs and multitouch devices, this behavior can be changed by calling gdk_disable_multidevice() before gdk_display_open(), although there would rarely be a reason to do that. For a widget or window to be dealt as multipointer aware, gdk_window_set_support_multidevice() or gtk_widget_set_support_multidevice() must have been called on it. Conceptually, in multidevice mode there are 2 device types. Virtual devices (or master devices) are represented by the pointer cursors and keyboard foci that are seen on the screen. Physical devices (or slave devices) represent the hardware that is controlling the virtual devices, and thus have no visible cursor on the screen. Virtual devices are always paired, so there is a keyboard device for every pointer device. Associations between devices may be inspected through gdk_device_get_associated_device(). There may be several virtual devices, and several physical devices could be controlling each of these virtual devices. Physical devices may also be "floating", which means they are not attached to any virtual device. By default, GDK will automatically listen for events coming from all master devices, setting the #GdkDevice for all events coming from input devices, <footnote> Events containing device information are #GDK_MOTION_NOTIFY, #GDK_BUTTON_PRESS, #GDK_2BUTTON_PRESS, #GDK_3BUTTON_PRESS, #GDK_BUTTON_RELEASE, #GDK_SCROLL, #GDK_KEY_PRESS, #GDK_KEY_RELEASE, #GDK_ENTER_NOTIFY, #GDK_LEAVE_NOTIFY, #GDK_FOCUS_CHANGE, #GDK_PROXIMITY_IN, #GDK_PROXIMITY_OUT, #GDK_DRAG_ENTER, #GDK_DRAG_LEAVE, #GDK_DRAG_MOTION, #GDK_DRAG_STATUS, #GDK_DROP_START, #GDK_DROP_FINISHED and #GDK_GRAB_BROKEN. </footnote> Although gdk_window_set_support_multidevice() must be called on #GdkWindows in order to support additional features of multiple pointer interaction, such as multiple per-device enter/leave events, the default setting will emit just one enter/leave event pair for all devices on the window. See gdk_window_set_support_multidevice() documentation for more information. In order to listen for events coming from other than a virtual device, gdk_window_set_device_events() must be called. Generally, this function can be used to modify the event mask for any given device. Input devices may also provide additional information besides X/Y. For example, graphics tablets may also provide pressure and X/Y tilt information. This information is device-dependent, and may be queried through gdk_device_get_axis(). In multidevice mode, virtual devices will change axes in order to always represent the physical device that is routing events through it. Whenever the physical device changes, the #GdkDevice:n-axes property will be notified, and gdk_device_list_axes() will return the new device axes. Devices may also have associated <firstterm>keys</firstterm> or macro buttons. Such keys can be globally set to map into normal X keyboard events. The mapping is set using gdk_device_set_key(). In order to query the device hierarchy and be aware of changes in the device hierarchy (such as virtual devices being created or removed, or physical devices being plugged or unplugged), GDK provides #GdkDeviceManager. On X11, multidevice support is implemented through XInput 2. Unless gdk_disable_multidevice() is called, the XInput 2.x #GdkDeviceManager implementation will be used as the input source. Otherwise either the core or XInput 1.x implementations will be used.

Properties

Gdk.Display"display"construct-only

Signals

void"device-removed"(self, device_manager, device)

The ::device-removed signal is emitted either when a master pointer is removed, or when a slave (Hardware) input device is unplugged.

void"device-added"(self, device_manager, device)

The ::device-added signal is emitted either when a new master pointer is created, or when a slave (Hardware) input device is plugged in.

void"device-changed"(self, device_manager, device)

The ::device-changed signal is emitted whenever a device has changed in the hierarchy, either slave devices being disconnected from their master device or connected to another one, or master devices being added or removed a slave device. If a slave device is detached from all master devices (gdk_device_get_associated_device() returns %NULL), its #GdkDeviceType will change to %GDK_DEVICE_TYPE_FLOATING, if it's attached, it will change to %GDK_DEVICE_TYPE_SLAVE.

Methods

Gdk.Deviceget_client_pointer()

Gdk.Displayget_display()

GLib.Listlist_devices(type)

Class: Gdk.Display

#GdkDisplay objects purpose are two fold: <itemizedlist> <listitem> To manage and provide information about input devices (pointers and keyboards) </listitem> <listitem> To manage and provide information about the available #GdkScreens </listitem> </itemizedlist> GdkDisplay objects are the GDK representation of an X Display, which can be described as <emphasis>a workstation consisting of a keyboard, a pointing device (such as a mouse) and one or more screens</emphasis>. It is used to open and keep track of various GdkScreen objects currently instantiated by the application. It is also used to access the keyboard(s) and mouse pointer(s) of the display. Most of the input device handling has been factored out into the separate #GdkDeviceManager object. Every display has a device manager, which you can obtain using gdk_display_get_device_manager().

Signals

void"opened"(self, display)

The ::opened signal is emitted when the connection to the windowing system for @display is opened.

void"closed"(self, display, is_error)

The ::closed signal is emitted when the connection to the windowing system for @display is closed.

Methods

voidbeep()

voidclose()

booldevice_is_grabbed(device)

voidflush()

Gdk.AppLaunchContextget_app_launch_context()

Gdk.Displayget_default()(static method)

intget_default_cursor_size()

Gdk.Windowget_default_group()

Gdk.Screenget_default_screen()

Gdk.DeviceManagerget_device_manager()

Gdk.Eventget_event()

void, int, intget_maximal_cursor_size()

intget_n_screens()

stringget_name()

void, Gdk.Screen, int, int, Gdk.ModifierTypeget_pointer()

Gdk.Screenget_screen(screen_num)

Gdk.Window, int, intget_window_at_pointer()

boolhas_pending()

boolis_closed()

voidkeyboard_ungrab(time_)

GLib.Listlist_devices()

voidnotify_startup_complete(startup_id)

Gdk.Displayopen(display_name)(static method)

Gdk.Displayopen_default_libgtk_only()(static method)

Gdk.Eventpeek_event()

boolpointer_is_grabbed()

voidpointer_ungrab(time_)

voidput_event(event)

boolrequest_selection_notification(selection)

voidset_double_click_distance(distance)

voidset_double_click_time(msec)

voidstore_clipboard(clipboard_window, time_, targets, n_targets)

boolsupports_clipboard_persistence()

boolsupports_composite()

boolsupports_cursor_alpha()

boolsupports_cursor_color()

boolsupports_input_shapes()

boolsupports_selection_notification()

boolsupports_shapes()

voidsync()

voidwarp_pointer(screen, x, y)

Class: Gdk.DisplayManager

The purpose of the #GdkDisplayManager singleton object is to offer notification when displays appear or disappear or the default display changes. You can use gdk_display_manager_get() to obtain the GdkDisplayManager singleton, but that should be rarely necessary. Typically, initializing GTK+ opens a display that you can work with without ever accessing the GdkDisplayManager. The GDK library can be built with support for multiple backends. The GdkDisplayManager object determines which backend is used at runtime. When writing backend-specific code that is supposed to work with multiple GDK backends, you have to consider both compile time and runtime. At compile time, use the #GDK_WINDOWING_X11, #GDK_WINDOWING_WIN32 macros, etc. to find out which backends are present in the GDK library you are building your application against. At runtime, use type-check macros like GDK_IS_X11_DISPLAY() to find out which backend is in use: <example id="backend-specific"> <title>Backend-specific code</title> <programlisting> #ifdef GDK_WINDOWING_X11 if (GDK_IS_X11_DISPLAY (display)) { /&ast; make X11-specific calls here &ast;/ } else #endif #ifdef GDK_WINDOWING_QUARTZ if (GDK_IS_QUARTZ_DISPLAY (display)) { /&ast; make Quartz-specific calls here &ast;/ } else #endif g_error ("Unsupported GDK backend"); </programlisting> </example>

Properties

Gdk.Display"default-display"read/write

Signals

void"display-opened"(self, display_manager, display)

The ::display-opened signal is emitted when a display is opened.

Methods

Gdk.DisplayManagerget()(static method)

Gdk.Displayget_default_display()

GLib.SListlist_displays()

Gdk.Displayopen_display(name)

voidset_default_display(display)

Class: Gdk.DragContext

Methods

Gdk.DragActionget_actions()

Gdk.Windowget_dest_window()

Gdk.Deviceget_device()

Gdk.DragProtocolget_protocol()

Gdk.DragActionget_selected_action()

Gdk.Windowget_source_window()

Gdk.DragActionget_suggested_action()

GLib.Listlist_targets()

voidset_device(device)

Class: Gdk.Keymap

A #GdkKeymap defines the translation from keyboard state (including a hardware key, a modifier mask, and active keyboard group) to a keyval. This translation has two phases. The first phase is to determine the effective keyboard group and level for the keyboard state; the second phase is to look up the keycode/group/level triplet in the keymap and see what keyval it corresponds to.

Signals

void"direction-changed"(self, keymap)

The ::direction-changed signal gets emitted when the direction of the keymap changes.

void"state-changed"(self, keymap)

The ::state-changed signal is emitted when the state of the keyboard changes, e.g when Caps Lock is turned on or off. See gdk_keymap_get_caps_lock_state().

void"keys-changed"(self, keymap)

The ::keys-changed signal is emitted when the mapping represented by

Methods

void, Gdk.ModifierTypeadd_virtual_modifiers()

boolget_caps_lock_state()

Gdk.Keymapget_default()(static method)

Pango.Directionget_direction()

bool, Array, Array, intget_entries_for_keycode(hardware_keycode)

bool, Array, intget_entries_for_keyval(keyval)

Gdk.Keymapget_for_display(display)(static method)

boolget_num_lock_state()

boolhave_bidi_layouts()

intlookup_key(key)

bool, Gdk.ModifierTypemap_virtual_modifiers()

bool, int, int, int, Gdk.ModifierTypetranslate_keyboard_state(hardware_keycode, state, group)

Class: Gdk.Screen

#GdkScreen objects are the GDK representation of the screen on which windows can be displayed and on which the pointer moves. X originally identified screens with physical screens, but nowadays it is more common to have a single #GdkScreen which combines several physical monitors (see gdk_screen_get_n_monitors()). GdkScreen is used throughout GDK and GTK+ to specify which screen the top level windows are to be displayed on. it is also used to query the screen specification and default settings such as the default visual (gdk_screen_get_system_visual()), the dimensions of the physical monitors (gdk_screen_get_monitor_geometry()), etc.

Properties

float"resolution"read/write

gpointer"font-options"read/write

Signals

void"size-changed"(self, screen)

The ::size-changed signal is emitted when the pixel width or height of a screen changes.

void"monitors-changed"(self, screen)

The ::monitors-changed signal is emitted when the number, size or position of the monitors attached to the screen change. Only for X11 and OS X for now. A future implementation for Win32 may be a possibility.

void"composited-changed"(self, screen)

The ::composited-changed signal is emitted when the composited status of the screen changes

Methods

Gdk.Windowget_active_window()

Gdk.Screenget_default()(static method)

Gdk.Displayget_display()

cairo.FontOptionsget_font_options()

intget_height()

intget_height_mm()

intget_monitor_at_point(x, y)

intget_monitor_at_window(window)

void, Gdk.Rectangleget_monitor_geometry(monitor_num)

intget_monitor_height_mm(monitor_num)

stringget_monitor_plug_name(monitor_num)

intget_monitor_width_mm(monitor_num)

intget_n_monitors()

intget_number()

intget_primary_monitor()

floatget_resolution()

Gdk.Visualget_rgba_visual()

Gdk.Windowget_root_window()

boolget_setting(name, value)

Gdk.Visualget_system_visual()

GLib.Listget_toplevel_windows()

intget_width()

intget_width_mm()

GLib.Listget_window_stack()

intheight()(static method)

intheight_mm()(static method)

boolis_composited()

GLib.Listlist_visuals()

stringmake_display_name()

voidset_font_options(options)

voidset_resolution(dpi)

intwidth()(static method)

intwidth_mm()(static method)

Class: Gdk.Visual

The #GdkVisual structure contains information about a particular visual.

Methods

Gdk.Visualget_best()(static method)

intget_best_depth()(static method)

Gdk.VisualTypeget_best_type()(static method)

Gdk.Visualget_best_with_both(depth, visual_type)(static method)

Gdk.Visualget_best_with_depth(depth)(static method)

Gdk.Visualget_best_with_type(visual_type)(static method)

intget_bits_per_rgb()

void, int, int, intget_blue_pixel_details()

Gdk.ByteOrderget_byte_order()

intget_colormap_size()

intget_depth()

void, int, int, intget_green_pixel_details()

void, int, int, intget_red_pixel_details()

Gdk.Screenget_screen()

Gdk.Visualget_system()(static method)

Gdk.VisualTypeget_visual_type()

Abstract Class: Gdk.Window

Properties

Gdk.Cursor"cursor"read/write

The mouse pointer for a #GdkWindow. See gdk_window_set_cursor() and gdk_window_get_cursor() for details.

Signals

Gdk.Window"pick-embedded-child"(self, window, x, y)

The ::pick-embedded-child signal is emitted to find an embedded child at the given position.

void"from-embedder"(self, window, embedder-x, embedder-y, offscreen-x, offscreen-y)

The ::from-embedder signal is emitted to translate coordinates in the embedder of an offscreen window to the offscreen window. See also #GtkWindow::to-embedder.

cairo.Surface"create-surface"(self, window, width, height)

The ::create-surface signal is emitted when an offscreen window needs its surface (re)created, which happens either when the the window is first drawn to, or when the window is being resized. The first signal handler that returns a non-%NULL surface will stop any further signal emission, and its surface will be used. Note that it is not possible to access the window's previous surface from within any callback of this signal. Calling gdk_offscreen_window_get_surface() will lead to a crash.

void"to-embedder"(self, window, offscreen-x, offscreen-y, embedder-x, embedder-y)

The ::to-embedder signal is emitted to translate coordinates in an offscreen window to its embedder. See also #GtkWindow::from-embedder.

Methods

Gdk.Window, int, intat_pointer()(static method)

voidbeep()

voidbegin_move_drag(button, root_x, root_y, timestamp)

voidbegin_paint_rect(rectangle)

voidbegin_paint_region(region)

voidbegin_resize_drag(edge, button, root_x, root_y, timestamp)

voidconfigure_finished()

void, int, intconstrain_size(geometry, flags, width, height)(static method)

void, float, floatcoords_from_parent(parent_x, parent_y)

void, float, floatcoords_to_parent(x, y)

cairo.Surfacecreate_similar_surface(content, width, height)

cairo.Surfacecreate_surface(width, height)

voiddeiconify()

voiddestroy()

voiddestroy_notify()

voidenable_synchronized_configure()

voidend_paint()

boolensure_native()

voidflush()

voidfocus(timestamp)

voidfreeze_toplevel_updates_libgtk_only()

voidfreeze_updates()

voidfrom_embedder(embedder_x, embedder_y, offscreen_x, offscreen_y)

voidfullscreen()

voidgeometry_changed()

boolget_accept_focus()

cairo.Patternget_background_pattern()

GLib.Listget_children()

cairo.Regionget_clip_region()

boolget_composited()

Gdk.Cursorget_cursor()

bool, Gdk.WMDecorationget_decorations()

Gdk.Cursorget_device_cursor(device)

Gdk.EventMaskget_device_events(device)

Gdk.Window, int, int, Gdk.ModifierTypeget_device_position(device)

Gdk.Displayget_display()

Gdk.DragProtocol, Gdk.Windowget_drag_protocol()

Gdk.Windowget_effective_parent()

Gdk.Windowget_effective_toplevel()

Gdk.EventMaskget_events()

boolget_focus_on_map()

voidget_frame_extents(rect)

void, int, int, int, intget_geometry()

Gdk.Windowget_group()

intget_height()

boolget_modal_hint()

int, int, intget_origin()

Gdk.Windowget_parent()

Gdk.Window, int, int, Gdk.ModifierTypeget_pointer()

void, int, intget_position()

void, int, intget_root_coords(x, y)

void, int, intget_root_origin()

Gdk.Screenget_screen()

Gdk.EventMaskget_source_events(source)

Gdk.WindowStateget_state()

boolget_support_multidevice()

Gdk.Windowget_toplevel()

Gdk.WindowTypeHintget_type_hint()

cairo.Regionget_update_area()

void, gpointerget_user_data()

cairo.Regionget_visible_region()

Gdk.Visualget_visual()

intget_width()

Gdk.WindowTypeget_window_type()

boolhas_native()

voidhide()

voidiconify()

voidinput_shape_combine_region(shape_region, offset_x, offset_y)

voidinvalidate_maybe_recurse(region, child_func, user_data)

voidinvalidate_rect(rect, invalidate_children)

voidinvalidate_region(region, invalidate_children)

boolis_destroyed()

boolis_input_only()

boolis_shaped()

boolis_viewable()

boolis_visible()

voidlower()

voidmaximize()

voidmerge_child_input_shapes()

voidmerge_child_shapes()

voidmove(x, y)

voidmove_region(region, dx, dy)

voidmove_resize(x, y, width, height)

GLib.Listpeek_children()

voidprocess_all_updates()(static method)

voidprocess_updates(update_children)

voidraise()

voidregister_dnd()

voidreparent(new_parent, x, y)

voidresize(width, height)

voidrestack(sibling, above)

voidscroll(dx, dy)

voidset_accept_focus(accept_focus)

voidset_background(color)

voidset_background_pattern(pattern)

voidset_background_rgba(rgba)

voidset_child_input_shapes()

voidset_child_shapes()

voidset_composited(composited)

voidset_cursor(cursor)

voidset_debug_updates(setting)(static method)

voidset_decorations(decorations)

voidset_device_cursor(device, cursor)

voidset_device_events(device, event_mask)

voidset_events(event_mask)

voidset_focus_on_map(focus_on_map)

voidset_functions(functions)

voidset_geometry_hints(geometry, geom_mask)

voidset_group(leader)

voidset_icon_list(pixbufs)

voidset_icon_name(name)

voidset_keep_above(setting)

voidset_keep_below(setting)

voidset_modal_hint(modal)

voidset_opacity(opacity)

voidset_override_redirect(override_redirect)

voidset_role(role)

voidset_skip_pager_hint(skips_pager)

voidset_skip_taskbar_hint(skips_taskbar)

voidset_source_events(source, event_mask)

voidset_startup_id(startup_id)

boolset_static_gravities(use_static)

voidset_support_multidevice(support_multidevice)

voidset_title(title)

voidset_transient_for(parent)

voidset_type_hint(hint)

voidset_urgency_hint(urgent)

voidset_user_data(user_data)

voidshape_combine_region(shape_region, offset_x, offset_y)

voidshow()

voidshow_unraised()

voidstick()

voidthaw_toplevel_updates_libgtk_only()

voidthaw_updates()

voidto_embedder(offscreen_x, offscreen_y, embedder_x, embedder_y)

voidunfullscreen()

voidunmaximize()

voidunstick()

voidwithdraw()