GdkDisplay

GdkDisplay — Controls a set of monitors and their associated input devices

Properties

gboolean composited Read
gboolean rgba Read

Signals

void closed Run Last
void monitor-added Run Last
void monitor-removed Run Last
void opened Run Last
void seat-added Run Last
void seat-removed Run Last
void setting-changed Run Last

Types and Values

Object Hierarchy

    GObject
    ╰── GdkDisplay

Includes

#include <gdk/gdk.h>

Description

GdkDisplay objects are the GDK representation of a workstation.

Their purpose are two-fold:

  • To manage and provide information about input devices (pointers, keyboards, etc)

  • To manage and provide information about output devices (monitors, projectors, etc)

Most of the input device handling has been factored out into separate GdkSeat objects. Every display has a one or more seats, which can be accessed with gdk_display_get_default_seat() and gdk_display_list_seats().

Output devices are represented by GdkMonitor objects, which can be accessed with gdk_display_get_monitor() and similar APIs.

Functions

gdk_display_open ()

GdkDisplay *
gdk_display_open (const gchar *display_name);

Opens a display.

Parameters

display_name

the name of the display to open

 

Returns

a GdkDisplay, or NULL if the display could not be opened.

[nullable][transfer none]


gdk_display_get_default ()

GdkDisplay *
gdk_display_get_default (void);

Gets the default GdkDisplay. This is a convenience function for: gdk_display_manager_get_default_display (gdk_display_manager_get()).

Returns

a GdkDisplay, or NULL if there is no default display.

[nullable][transfer none]


gdk_display_get_name ()

const gchar *
gdk_display_get_name (GdkDisplay *display);

Gets the name of the display.

Parameters

display

a GdkDisplay

 

Returns

a string representing the display name. This string is owned by GDK and should not be modified or freed.


gdk_display_device_is_grabbed ()

gboolean
gdk_display_device_is_grabbed (GdkDisplay *display,
                               GdkDevice *device);

Returns TRUE if there is an ongoing grab on device for display .

Parameters

display

a GdkDisplay

 

device

a GdkDevice

 

Returns

TRUE if there is a grab in effect for device .


gdk_display_beep ()

void
gdk_display_beep (GdkDisplay *display);

Emits a short beep on display

Parameters

display

a GdkDisplay

 

gdk_display_sync ()

void
gdk_display_sync (GdkDisplay *display);

Flushes any requests queued for the windowing system and waits until all requests have been handled. This is often used for making sure that the display is synchronized with the current state of the program. Calling gdk_display_sync() before gdk_error_trap_pop() makes sure that any errors generated from earlier requests are handled before the error trap is removed.

This is most useful for X11. On windowing systems where requests are handled synchronously, this function will do nothing.

Parameters

display

a GdkDisplay

 

gdk_display_flush ()

void
gdk_display_flush (GdkDisplay *display);

Flushes any requests queued for the windowing system; this happens automatically when the main loop blocks waiting for new events, but if your application is drawing without returning control to the main loop, you may need to call this function explicitly. A common case where this function needs to be called is when an application is executing drawing commands from a thread other than the thread where the main loop is running.

This is most useful for X11. On windowing systems where requests are handled synchronously, this function will do nothing.

Parameters

display

a GdkDisplay

 

gdk_display_close ()

void
gdk_display_close (GdkDisplay *display);

Closes the connection to the windowing system for the given display, and cleans up associated resources.

Parameters

display

a GdkDisplay

 

gdk_display_is_closed ()

gboolean
gdk_display_is_closed (GdkDisplay *display);

Finds out if the display has been closed.

Parameters

display

a GdkDisplay

 

Returns

TRUE if the display is closed.


gdk_display_get_event ()

GdkEvent *
gdk_display_get_event (GdkDisplay *display);

Gets the next GdkEvent to be processed for display , fetching events from the windowing system if necessary.

Parameters

display

a GdkDisplay

 

Returns

the next GdkEvent to be processed, or NULL if no events are pending.

[nullable][transfer full]


gdk_display_peek_event ()

GdkEvent *
gdk_display_peek_event (GdkDisplay *display);

Gets a copy of the first GdkEvent in the display ’s event queue, without removing the event from the queue. (Note that this function will not get more events from the windowing system. It only checks the events that have already been moved to the GDK event queue.)

Parameters

display

a GdkDisplay

 

Returns

the first GdkEvent on the event queue.

[nullable][transfer full]


gdk_display_put_event ()

void
gdk_display_put_event (GdkDisplay *display,
                       const GdkEvent *event);

Appends a copy of the given event onto the front of the event queue for display .

Parameters

display

a GdkDisplay

 

event

a GdkEvent.

 

gdk_display_has_pending ()

gboolean
gdk_display_has_pending (GdkDisplay *display);

Returns whether the display has events that are waiting to be processed.

Parameters

display

a GdkDisplay

 

Returns

TRUE if there are events ready to be processed.


gdk_display_is_rgba ()

gboolean
gdk_display_is_rgba (GdkDisplay *display);

Returns wether surfaces on this display are created with an alpha channel.

Even if a TRUE is returned, it is possible that the surface’s alpha channel won’t be honored when displaying the surface on the screen: in particular, for X an appropriate windowing manager and compositing manager must be running to provide appropriate display. Use gdk_display_is_composited() to check if that is the case.

For setting an overall opacity for a top-level surface, see gdk_surface_set_opacity().

On modern displays, this value is always TRUE.

Parameters

display

a GdkDisplay

 

Returns

TRUE if surfaces are created with an alpha channel or FALSE if the display does not support this functionality.


gdk_display_is_composited ()

gboolean
gdk_display_is_composited (GdkDisplay *display);

Returns whether surfaces can reasonably be expected to have their alpha channel drawn correctly on the screen. Check gdk_display_is_rgba() for wether the display supports an alpha channel.

On X11 this function returns whether a compositing manager is compositing on display .

On modern displays, this value is always TRUE.

Parameters

display

a GdkDisplay

 

Returns

Whether surfaces with RGBA visuals can reasonably be expected to have their alpha channels drawn correctly on the screen.


gdk_display_get_default_group ()

GdkSurface *
gdk_display_get_default_group (GdkDisplay *display);

Returns the default group leader surface for all toplevel surfaces on display . This surface is implicitly created by GDK. See gdk_surface_set_group().

Parameters

display

a GdkDisplay

 

Returns

The default group leader surface for display .

[transfer none]


gdk_display_supports_shapes ()

gboolean
gdk_display_supports_shapes (GdkDisplay *display);

Returns TRUE if gdk_surface_shape_combine_mask() can be used to create shaped windows on display .

Parameters

display

a GdkDisplay

 

Returns

TRUE if shaped windows are supported


gdk_display_supports_input_shapes ()

gboolean
gdk_display_supports_input_shapes (GdkDisplay *display);

Returns TRUE if gdk_surface_input_shape_combine_mask() can be used to modify the input shape of surfaces on display .

Parameters

display

a GdkDisplay

 

Returns

TRUE if surfaces with modified input shape are supported


gdk_display_get_app_launch_context ()

GdkAppLaunchContext *
gdk_display_get_app_launch_context (GdkDisplay *display);

Returns a GdkAppLaunchContext suitable for launching applications on the given display.

Parameters

display

a GdkDisplay

 

Returns

a new GdkAppLaunchContext for display . Free with g_object_unref() when done.

[transfer full]


gdk_display_notify_startup_complete ()

void
gdk_display_notify_startup_complete (GdkDisplay *display,
                                     const gchar *startup_id);

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.

Parameters

display

a GdkDisplay

 

startup_id

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

 

gdk_display_get_default_seat ()

GdkSeat *
gdk_display_get_default_seat (GdkDisplay *display);

Returns the default GdkSeat for this display.

Parameters

display

a GdkDisplay

 

Returns

the default seat.

[transfer none]


gdk_display_list_seats ()

GList *
gdk_display_list_seats (GdkDisplay *display);

Returns the list of seats known to display .

Parameters

display

a GdkDisplay

 

Returns

the list of seats known to the GdkDisplay.

[transfer container][element-type GdkSeat]


gdk_display_get_n_monitors ()

int
gdk_display_get_n_monitors (GdkDisplay *display);

Gets the number of monitors that belong to display .

The returned number is valid until the next emission of the “monitor-added” or “monitor-removed” signal.

Parameters

display

a GdkDisplay

 

Returns

the number of monitors


gdk_display_get_monitor ()

GdkMonitor *
gdk_display_get_monitor (GdkDisplay *display,
                         int monitor_num);

Gets a monitor associated with this display.

Parameters

display

a GdkDisplay

 

monitor_num

number of the monitor

 

Returns

the GdkMonitor, or NULL if monitor_num is not a valid monitor number.

[nullable][transfer none]


gdk_display_get_primary_monitor ()

GdkMonitor *
gdk_display_get_primary_monitor (GdkDisplay *display);

Gets the primary monitor for the display.

The primary monitor is considered the monitor where the “main desktop” lives. While normal application surfaces typically allow the window manager to place the surfaces, specialized desktop applications such as panels should place themselves on the primary monitor.

If no monitor is the designated primary monitor, any monitor (usually the first) may be returned. To make sure there is a dedicated primary monitor, use gdk_monitor_is_primary() on the returned monitor.

Parameters

display

a GdkDisplay

 

Returns

the primary monitor, or any monitor if no primary monitor is configured by the user.

[transfer none]


gdk_display_get_monitor_at_point ()

GdkMonitor *
gdk_display_get_monitor_at_point (GdkDisplay *display,
                                  int x,
                                  int y);

Gets the monitor in which the point (x , y ) is located, or a nearby monitor if the point is not in any monitor.

Parameters

display

a GdkDisplay

 

x

the x coordinate of the point

 

y

the y coordinate of the point

 

Returns

the monitor containing the point.

[transfer none]


gdk_display_get_monitor_at_surface ()

GdkMonitor *
gdk_display_get_monitor_at_surface (GdkDisplay *display,
                                    GdkSurface *surface);

Gets the monitor in which the largest area of surface resides, or a monitor close to surface if it is outside of all monitors.

Parameters

display

a GdkDisplay

 

surface

a GdkSurface

 

Returns

the monitor with the largest overlap with surface .

[transfer none]


gdk_display_get_clipboard ()

GdkClipboard *
gdk_display_get_clipboard (GdkDisplay *display);

Gets the clipboard used for copy/paste operations.

Parameters

display

a GdkDisplay

 

Returns

the display's clipboard.

[transfer none]


gdk_display_get_primary_clipboard ()

GdkClipboard *
gdk_display_get_primary_clipboard (GdkDisplay *display);

Gets the clipboard used for the primary selection. On backends where the primary clipboard is not supported natively, GDK emulates this clipboard locally.

Parameters

display

a GdkDisplay

 

Returns

the primary clipboard.

[transfer none]


gdk_display_get_setting ()

gboolean
gdk_display_get_setting (GdkDisplay *display,
                         const char *name,
                         GValue *value);

Retrieves a desktop-wide setting such as double-click time for the display .

Parameters

display

a GdkDisplay

 

name

the name of the setting

 

value

location to store the value of the setting

 

Returns

TRUE if the setting existed and a value was stored in value , FALSE otherwise


gdk_display_get_keymap ()

GdkKeymap *
gdk_display_get_keymap (GdkDisplay *display);

Returns the GdkKeymap attached to display .

Parameters

display

the GdkDisplay

 

Returns

the GdkKeymap attached to display .

[transfer none]

Types and Values

GdkDisplay

typedef struct _GdkDisplay GdkDisplay;

The GdkDisplay struct contains only private fields and should not be accessed directly.

Property Details

The “composited” property

  “composited”               gboolean

TRUE if the display properly composits the alpha channel. See gdk_display_is_composited() for details.

Flags: Read

Default value: TRUE


The “rgba” property

  “rgba”                     gboolean

TRUE if the display supports an alpha channel. See gdk_display_is_rgba() for details.

Flags: Read

Default value: TRUE

Signal Details

The “closed” signal

void
user_function (GdkDisplay *display,
               gboolean    is_error,
               gpointer    user_data)

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

Parameters

display

the object on which the signal is emitted

 

is_error

TRUE if the display was closed due to an error

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “monitor-added” signal

void
user_function (GdkDisplay *display,
               GdkMonitor *monitor,
               gpointer    user_data)

The ::monitor-added signal is emitted whenever a monitor is added.

Parameters

display

the objedct on which the signal is emitted

 

monitor

the monitor that was just added

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “monitor-removed” signal

void
user_function (GdkDisplay *display,
               GdkMonitor *monitor,
               gpointer    user_data)

The ::monitor-removed signal is emitted whenever a monitor is removed.

Parameters

display

the object on which the signal is emitted

 

monitor

the monitor that was just removed

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “opened” signal

void
user_function (GdkDisplay *display,
               gpointer    user_data)

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

Parameters

display

the object on which the signal is emitted

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “seat-added” signal

void
user_function (GdkDisplay *display,
               GdkSeat    *seat,
               gpointer    user_data)

The ::seat-added signal is emitted whenever a new seat is made known to the windowing system.

Parameters

display

the object on which the signal is emitted

 

seat

the seat that was just added

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “seat-removed” signal

void
user_function (GdkDisplay *display,
               GdkSeat    *seat,
               gpointer    user_data)

The ::seat-removed signal is emitted whenever a seat is removed by the windowing system.

Parameters

display

the object on which the signal is emitted

 

seat

the seat that was just removed

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “setting-changed” signal

void
user_function (GdkDisplay *display,
               gchar      *setting,
               gpointer    user_data)

The ::setting-changed signal is emitted whenever a setting changes its value.

Parameters

display

the object on which the signal is emitted

 

setting

the name of the setting that changed

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last