gtkmm: Gdk::Display Class Reference

Gdk::Display object's purpose is two fold: To grab/ungrab keyboard focus and mouse pointer To manage and provide information about the Gdk::Monitor(s) available for this Gdk::Display. More...

#include <gdkmm/display.h>

Inheritance diagram for Gdk::Display:

Public Member Functions

 Display (Display&& src) noexcept
 
Displayoperator= (Display&& src) noexcept
 
 ~Display () noexcept override
 
GdkDisplay* gobj ()
 Provides access to the underlying C GObject. More...

 
const GdkDisplay* gobj () const
 Provides access to the underlying C GObject. More...

 
GdkDisplay* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...

 
Glib::ustring get_name () const
 Gets the name of the display. More...

 
bool device_is_grabbed (const Glib::RefPtr< const Gdk::Device >& device) const
 Returns true if there is an ongoing grab on device for display. More...

 
void beep ()
 Emits a short beep on display. More...

 
void sync ()
 Flushes any requests queued for the windowing system and waits until all requests have been handled. More...

 
void close ()
 Closes the connection to the windowing system for the given display, and cleans up associated resources. More...

 
bool is_closed () const
 Finds out if the display has been closed. More...

 
bool is_composited () const
 Returns whether surfaces can reasonably be expected to have their alpha channel drawn correctly on the screen. More...

 
bool is_rgba () const
 Returns whether surfaces on this display are created with an alpha channel. More...

 
void put_event (const Glib::RefPtr< const Event >& event)
 Appends the given event onto the front of the event queue for display. More...

 
void flush ()
 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. More...

 
Glib::RefPtr< Clipboardget_clipboard ()
 Gets the clipboard used for copy/paste operations. More...

 
Glib::RefPtr< const Clipboardget_clipboard () const
 Gets the clipboard used for copy/paste operations. More...

 
Glib::RefPtr< Clipboardget_primary_clipboard ()
 Gets the clipboard used for the primary selection. More...

 
Glib::RefPtr< const Clipboardget_primary_clipboard () const
 Gets the clipboard used for the primary selection. More...

 
bool supports_input_shapes () const
 Returns true if Gdk::Surface::set_input_region() can be used to modify the input shape of surfaces on display. More...

 
void notify_startup_complete (const Glib::ustring& startup_id)
 Indicates to the GUI environment that the application has finished loading, using a given identifier. More...

 
Glib::ustring get_startup_notification_id () const
 Gets the startup notification ID for a Wayland display, or nullptr if no ID has been defined. More...

 
Glib::RefPtr< AppLaunchContextget_app_launch_context ()
 Returns a Gdk::AppLaunchContext suitable for launching applications on the given display. More...

 
Glib::RefPtr< const AppLaunchContextget_app_launch_context () const
 Returns a Gdk::AppLaunchContext suitable for launching applications on the given display. More...

 
Glib::RefPtr< Seatget_default_seat ()
 Returns the default Gdk::Seat for this display. More...

 
Glib::RefPtr< const Seatget_default_seat () const
 Returns the default Gdk::Seat for this display. More...

 
std::vector< Glib::RefPtr< Seat > > list_seats ()
 Returns the list of seats known to display. More...

 
std::vector< Glib::RefPtr< const Seat > > list_seats () const
 Returns the list of seats known to display. More...

 
Glib::RefPtr< Gio::ListModelget_monitors ()
 Gets the list of monitors associated with this display. More...

 
Glib::RefPtr< const Gio::ListModelget_monitors () const
 Gets the list of monitors associated with this display. More...

 
Glib::RefPtr< Monitorget_monitor_at_surface (const Glib::RefPtr< Surface >& 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. More...

 
Glib::RefPtr< const Monitorget_monitor_at_surface (const Glib::RefPtr< Surface >& surface) const
 Gets the monitor in which the largest area of surface resides, or a monitor close to surface if it is outside of all monitors. More...

 
template<class ValueType >
bool get_setting (const Glib::ustring& name, ValueType& value) const
 
Glib::SignalProxy< void(bool)> signal_closed ()
 
Glib::SignalProxy< void()> signal_opened ()
 
Glib::SignalProxy< void(const Glib::RefPtr< Seat >&)> signal_seat_added ()
 
Glib::SignalProxy< void(const Glib::RefPtr< Seat >&)> signal_seat_removed ()
 
Glib::SignalProxy< void(const Glib::ustring&)> signal_setting_changed ()
 
Glib::PropertyProxy_ReadOnly< bool > property_composited () const
 true if the display properly composites the alpha channel. More...

 
Glib::PropertyProxy_ReadOnly< bool > property_rgba () const
 true if the display supports an alpha channel. More...

 
Glib::PropertyProxy_ReadOnly< bool > property_input_shapes () const
 true if the display supports input shapes. More...

 
- Public Member Functions inherited from Glib::Object
 Object (const Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&src) noexcept
 
Objectoperator= (Object &&src) noexcept
 
void * get_data (const QueryQuark &key)
 
void set_data (const Quark &key, void *data)
 
void set_data (const Quark &key, void *data, DestroyNotify notify)
 
void remove_data (const QueryQuark &quark)
 
void * steal_data (const QueryQuark &quark)
 
Glib::RefPtr< Glib::Objectwrap (GObject *object, bool take_copy=false)
 
- Public Member Functions inherited from Glib::ObjectBase
 ObjectBase (const ObjectBase &)=delete
 
ObjectBaseoperator= (const ObjectBase &)=delete
 
void set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
 
void get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
 
void set_property (const Glib::ustring &property_name, const PropertyType &value)
 
void get_property (const Glib::ustring &property_name, PropertyType &value) const
 
PropertyType get_property (const Glib::ustring &property_name) const
 
sigc::connection connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot)
 
sigc::connection connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot)
 
void freeze_notify ()
 
void thaw_notify ()
 
virtual void reference () const
 
virtual void unreference () const
 
GObject * gobj ()
 
const GObject * gobj () const
 
GObject * gobj_copy () const
 
- Public Member Functions inherited from sigc::trackable
 trackable () noexcept
 
 trackable (const trackable &src) noexcept
 
 trackable (trackable &&src) noexcept
 
 ~trackable ()
 
void add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
 
void notify_callbacks ()
 
trackableoperator= (const trackable &src)
 
trackableoperator= (trackable &&src) noexcept
 
void remove_destroy_notify_callback (notifiable *data) const
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...

 
static Glib::RefPtr< Displayopen (const Glib::ustring& display_name)
 Opens a display. More...

 
static Glib::RefPtr< Displayget_default ()
 Gets the default Gdk::Display. More...

 

Protected Member Functions

 Display ()
 
- Protected Member Functions inherited from Glib::Object
 Object ()
 
 Object (const Glib::ConstructParams &construct_params)
 
 Object (GObject *castitem)
 
 ~Object () noexcept override
 
- Protected Member Functions inherited from Glib::ObjectBase
 ObjectBase ()
 
 ObjectBase (const char *custom_type_name)
 
 ObjectBase (const std::type_info &custom_type_info)
 
 ObjectBase (ObjectBase &&src) noexcept
 
ObjectBaseoperator= (ObjectBase &&src) noexcept
 
virtual ~ObjectBase () noexcept=0
 
void initialize (GObject *castitem)
 
void initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gdk::Displaywrap (GdkDisplay* object, bool take_copy=false)
 A Glib::wrap() method for this object. More...

 

Additional Inherited Members

- Public Types inherited from Glib::Object
typedef void(*)(gpointer data DestroyNotify)
 
- Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify func_destroy_notify
 
- Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify func_destroy_notify
 

Detailed Description

Gdk::Display object's purpose is two fold: To grab/ungrab keyboard focus and mouse pointer To manage and provide information about the Gdk::Monitor(s) available for this Gdk::Display.

Gdk::Display objects are the GDK representation of the X Display which can be described as a workstation consisting of a keyboard a pointing device (such as a mouse) and one or more screens. It is used to open and keep track of various Gdk::Monitor objects currently instantiated by the application. It is also used to grab and release the keyboard and the mouse pointer.

Constructor & Destructor Documentation

Gdk::Display::Display ( Display&&  src)
noexcept
Gdk::Display::~Display ( )
overridenoexcept
Gdk::Display::Display ( )
protected

Member Function Documentation

void Gdk::Display::beep ( )

Emits a short beep on display.

void Gdk::Display::close ( )

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

bool Gdk::Display::device_is_grabbed ( const Glib::RefPtr< const Gdk::Device >&  device) const

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

Parameters
deviceA Gdk::Device.
Returns
true if there is a grab in effect for device.
void Gdk::Display::flush ( )

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.

Glib::RefPtr<AppLaunchContext> Gdk::Display::get_app_launch_context ( )

Returns a Gdk::AppLaunchContext suitable for launching applications on the given display.

Returns
A new Gdk::AppLaunchContext for display. Free with Glib::object_unref() when done.
Glib::RefPtr<const AppLaunchContext> Gdk::Display::get_app_launch_context ( ) const

Returns a Gdk::AppLaunchContext suitable for launching applications on the given display.

Returns
A new Gdk::AppLaunchContext for display. Free with Glib::object_unref() when done.
Glib::RefPtr<Clipboard> Gdk::Display::get_clipboard ( )

Gets the clipboard used for copy/paste operations.

Returns
The display's clipboard.
Glib::RefPtr<const Clipboard> Gdk::Display::get_clipboard ( ) const

Gets the clipboard used for copy/paste operations.

Returns
The display's clipboard.
static Glib::RefPtr<Display> Gdk::Display::get_default ( )
static

Gets the default Gdk::Display.

This is a convenience function for: gdk_display_manager_get_default_display (Gdk::DisplayManager::get()).

Returns
A Gdk::Display, or nullptr if there is no default display.
Glib::RefPtr<Seat> Gdk::Display::get_default_seat ( )

Returns the default Gdk::Seat for this display.

Note that a display may not have a seat. In this case, this function will return nullptr.

Returns
The default seat.
Glib::RefPtr<const Seat> Gdk::Display::get_default_seat ( ) const

Returns the default Gdk::Seat for this display.

Note that a display may not have a seat. In this case, this function will return nullptr.

Returns
The default seat.
Glib::RefPtr<Monitor> Gdk::Display::get_monitor_at_surface ( const Glib::RefPtr< Surface >&  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
surfaceA Gdk::Surface.
Returns
The monitor with the largest overlap with surface.
Glib::RefPtr<const Monitor> Gdk::Display::get_monitor_at_surface ( const Glib::RefPtr< Surface >&  surface) const

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
surfaceA Gdk::Surface.
Returns
The monitor with the largest overlap with surface.
Glib::RefPtr<Gio::ListModel> Gdk::Display::get_monitors ( )

Gets the list of monitors associated with this display.

Subsequent calls to this function will always return the same list for the same display.

You can listen to the GListModel::items-changed signal on this list to monitor changes to the monitor of this display.

Returns
A ListModel of Gdk::Monitor.
Glib::RefPtr<const Gio::ListModel> Gdk::Display::get_monitors ( ) const

Gets the list of monitors associated with this display.

Subsequent calls to this function will always return the same list for the same display.

You can listen to the GListModel::items-changed signal on this list to monitor changes to the monitor of this display.

Returns
A ListModel of Gdk::Monitor.
Glib::ustring Gdk::Display::get_name ( ) const

Gets the name of the display.

Returns
A string representing the display name. This string is owned by GDK and should not be modified or freed.
Glib::RefPtr<Clipboard> Gdk::Display::get_primary_clipboard ( )

Gets the clipboard used for the primary selection.

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

Returns
The primary clipboard.
Glib::RefPtr<const Clipboard> Gdk::Display::get_primary_clipboard ( ) const

Gets the clipboard used for the primary selection.

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

Returns
The primary clipboard.
template <class ValueType >
bool Gdk::Display::get_setting ( const Glib::ustring name,
ValueType &  value 
) const
Glib::ustring Gdk::Display::get_startup_notification_id ( ) const

Gets the startup notification ID for a Wayland display, or nullptr if no ID has been defined.

Returns
The startup notification ID for display, or nullptr.
static GType Gdk::Display::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

GdkDisplay* Gdk::Display::gobj ( )
inline

Provides access to the underlying C GObject.

const GdkDisplay* Gdk::Display::gobj ( ) const
inline

Provides access to the underlying C GObject.

GdkDisplay* Gdk::Display::gobj_copy ( )

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

bool Gdk::Display::is_closed ( ) const

Finds out if the display has been closed.

Returns
true if the display is closed.
bool Gdk::Display::is_composited ( ) const

Returns whether surfaces can reasonably be expected to have their alpha channel drawn correctly on the screen.

Check is_rgba() for whether 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.

Returns
Whether surfaces with RGBA visuals can reasonably be expected to have their alpha channels drawn correctly on the screen.
bool Gdk::Display::is_rgba ( ) const

Returns whether 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 is_composited() to check if that is the case.

On modern displays, this value is always true.

Returns
true if surfaces are created with an alpha channel or false if the display does not support this functionality.
std::vector<Glib::RefPtr<Seat> > Gdk::Display::list_seats ( )

Returns the list of seats known to display.

Returns
The list of seats known to the Gdk::Display.
std::vector<Glib::RefPtr<const Seat> > Gdk::Display::list_seats ( ) const

Returns the list of seats known to display.

Returns
The list of seats known to the Gdk::Display.
void Gdk::Display::notify_startup_complete ( const Glib::ustring startup_id)

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

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

Parameters
startup_idA startup-notification identifier, for which notification process should be completed.
static Glib::RefPtr<Display> Gdk::Display::open ( const Glib::ustring display_name)
static

Opens a display.

Parameters
display_nameThe name of the display to open.
Returns
A Gdk::Display, or nullptr if the display could not be opened.
Display& Gdk::Display::operator= ( Display&&  src)
noexcept
Glib::PropertyProxy_ReadOnly< bool > Gdk::Display::property_composited ( ) const

true if the display properly composites the alpha channel.

See Gdk::Display::is_composited() for details.

Default value: true

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< bool > Gdk::Display::property_input_shapes ( ) const

true if the display supports input shapes.

See Gdk::Display::supports_input_shapes() for details.

Default value: true

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< bool > Gdk::Display::property_rgba ( ) const

true if the display supports an alpha channel.

See Gdk::Display::is_rgba() for details.

Default value: true

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
void Gdk::Display::put_event ( const Glib::RefPtr< const Event >&  event)

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

This function is only useful in very special situations and should not be used by applications.

Parameters
eventA Gdk::Event.
Glib::SignalProxy<void(bool)> Gdk::Display::signal_closed ( )
Slot Prototype:
void on_my_closed(bool is_error)

Flags: Run Last

The signal_closed() signal is emitted when the connection to the windowing system for display is closed.

Parameters
is_errortrue if the display was closed due to an error.
Glib::SignalProxy<void()> Gdk::Display::signal_opened ( )
Slot Prototype:
void on_my_opened()

Flags: Run Last

The signal_opened() signal is emitted when the connection to the windowing system for display is opened.

Glib::SignalProxy<void(const Glib::RefPtr<Seat>&)> Gdk::Display::signal_seat_added ( )
Slot Prototype:
void on_my_seat_added(const Glib::RefPtr<Seat>& seat)

Flags: Run Last

The signal_seat_added() signal is emitted whenever a new seat is made known to the windowing system.

Parameters
seatThe seat that was just added.
Glib::SignalProxy<void(const Glib::RefPtr<Seat>&)> Gdk::Display::signal_seat_removed ( )
Slot Prototype:
void on_my_seat_removed(const Glib::RefPtr<Seat>& seat)

Flags: Run Last

The signal_seat_removed() signal is emitted whenever a seat is removed by the windowing system.

Parameters
seatThe seat that was just removed.
Glib::SignalProxy<void(const Glib::ustring&)> Gdk::Display::signal_setting_changed ( )
Slot Prototype:
void on_my_setting_changed(const Glib::ustring& setting)

Flags: Run Last

The signal_setting_changed() signal is emitted whenever a setting changes its value.

Parameters
settingThe name of the setting that changed.
bool Gdk::Display::supports_input_shapes ( ) const

Returns true if Gdk::Surface::set_input_region() can be used to modify the input shape of surfaces on display.

On modern displays, this value is always true.

Returns
true if surfaces with modified input shape are supported.
void Gdk::Display::sync ( )

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 sync() before gdk_x11_display_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.

Friends And Related Function Documentation

Glib::RefPtr< Gdk::Display > wrap ( GdkDisplay *  object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.