gtkmm 4.16.0
|
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>
Public Member Functions | |
Display (Display && src) noexcept | |
Display & | operator= (Display && src) noexcept |
~Display () noexcept override | |
GdkDisplay * | gobj () |
Provides access to the underlying C GObject. | |
const GdkDisplay * | gobj () const |
Provides access to the underlying C GObject. | |
GdkDisplay * | gobj_copy () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. | |
Glib::ustring | get_name () const |
Gets the name of the display. | |
bool | device_is_grabbed (const Glib::RefPtr< const Gdk::Device > & device) const |
Returns true if there is an ongoing grab on device for display. | |
void | beep () |
Emits a short beep on display. | |
void | sync () |
Flushes any requests queued for the windowing system and waits until all requests have been handled. | |
void | close () |
Closes the connection to the windowing system for the given display. | |
bool | is_closed () const |
Finds out if the display has been closed. | |
bool | is_composited () const |
Returns whether surfaces can reasonably be expected to have their alpha channel drawn correctly on the screen. | |
bool | is_rgba () const |
Returns whether surfaces on this display are created with an alpha channel. | |
bool | supports_shadow_width () const |
Returns whether it's possible for a surface to draw outside of the window area. | |
void | put_event (const Glib::RefPtr< const Event > & event) |
Adds the given event to the event queue for display. | |
void | flush () |
Flushes any requests queued for the windowing system. | |
Glib::RefPtr< Clipboard > | get_clipboard () |
Gets the clipboard used for copy/paste operations. | |
Glib::RefPtr< const Clipboard > | get_clipboard () const |
Gets the clipboard used for copy/paste operations. | |
Glib::RefPtr< Clipboard > | get_primary_clipboard () |
Gets the clipboard used for the primary selection. | |
Glib::RefPtr< const Clipboard > | get_primary_clipboard () const |
Gets the clipboard used for the primary selection. | |
bool | supports_input_shapes () const |
Returns true if the display supports input shapes. | |
void | prepare_gl () |
Checks that OpenGL is available for this display and ensures that it is properly initialized. | |
Glib::RefPtr< GLContext > | create_gl_context () |
Creates a new Gdk::GLContext for the Gdk::Display . | |
void | notify_startup_complete (const Glib::ustring & startup_id) |
Indicates to the GUI environment that the application has finished loading, using a given identifier. | |
Glib::ustring | get_startup_notification_id () const |
Gets the startup notification ID for a Wayland display, or nullptr if no ID has been defined. | |
Glib::RefPtr< AppLaunchContext > | get_app_launch_context () |
Returns a Gdk::AppLaunchContext suitable for launching applications on the given display. | |
Glib::RefPtr< const AppLaunchContext > | get_app_launch_context () const |
Returns a Gdk::AppLaunchContext suitable for launching applications on the given display. | |
Glib::RefPtr< Seat > | get_default_seat () |
Returns the default Gdk::Seat for this display. | |
Glib::RefPtr< const Seat > | get_default_seat () const |
Returns the default Gdk::Seat for this display. | |
std::vector< Glib::RefPtr< Seat > > | list_seats () |
Returns the list of seats known to display. | |
std::vector< Glib::RefPtr< const Seat > > | list_seats () const |
Returns the list of seats known to display. | |
Glib::RefPtr< Gio::ListModel > | get_monitors () |
Gets the list of monitors associated with this display. | |
Glib::RefPtr< const Gio::ListModel > | get_monitors () const |
Gets the list of monitors associated with this display. | |
Glib::RefPtr< Monitor > | get_monitor_at_surface (const Glib::RefPtr< Surface > & surface) |
Gets the monitor in which the largest area of surface resides. | |
Glib::RefPtr< const Monitor > | get_monitor_at_surface (const Glib::RefPtr< Surface > & surface) const |
Gets the monitor in which the largest area of surface resides. | |
template<class ValueType > | |
bool | get_setting (const Glib::ustring & name, ValueType & value) const |
Glib::RefPtr< DmabufFormats > | get_dmabuf_formats () |
Returns the dma-buf formats that are supported on this display. | |
Glib::RefPtr< const DmabufFormats > | get_dmabuf_formats () const |
Returns the dma-buf formats that are supported on this display. | |
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. | |
Glib::PropertyProxy_ReadOnly< bool > | property_rgba () const |
true if the display supports an alpha channel. | |
Glib::PropertyProxy_ReadOnly< bool > | property_shadow_width () const |
true if the display supports extensible frames. | |
Glib::PropertyProxy_ReadOnly< bool > | property_input_shapes () const |
true if the display supports input shapes. | |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< DmabufFormats > > | property_dmabuf_formats () const |
The dma-buf formats that are supported on this display. | |
Static Public Member Functions | |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. | |
static Glib::RefPtr< Display > | open (const Glib::ustring & display_name) |
Opens a display. | |
static Glib::RefPtr< Display > | get_default () |
Gets the default Gdk::Display . | |
Protected Member Functions | |
Display () | |
Related Symbols | |
(Note that these are not member symbols.) | |
Glib::RefPtr< Gdk::Display > | wrap (GdkDisplay * object, bool take_copy=false) |
A Glib::wrap() method for this object. | |
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.
|
noexcept |
|
overridenoexcept |
|
protected |
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.
This cleans up associated resources.
Glib::RefPtr< GLContext > Gdk::Display::create_gl_context | ( | ) |
Creates a new Gdk::GLContext
for the Gdk::Display
.
The context is disconnected from any particular surface or surface and cannot be used to draw to any surface. It can only be used to draw to non-surface framebuffers like textures.
If the creation of the Gdk::GLContext
failed, error will be set. Before using the returned Gdk::GLContext
, you will need to call Gdk::GLContext::make_current() or Gdk::GLContext::realize().
Gdk::GLContext
.Glib::Error |
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.
device | A Gdk::Device . |
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.
Gdk::AppLaunchContext
for display. Glib::RefPtr< const AppLaunchContext > Gdk::Display::get_app_launch_context | ( | ) | const |
Returns a Gdk::AppLaunchContext
suitable for launching applications on the given display.
Gdk::AppLaunchContext
for display. Glib::RefPtr< Clipboard > Gdk::Display::get_clipboard | ( | ) |
Gets the clipboard used for copy/paste operations.
Glib::RefPtr< const Clipboard > Gdk::Display::get_clipboard | ( | ) | const |
Gets the clipboard used for copy/paste operations.
|
static |
Gets the default Gdk::Display
.
This is a convenience function for:
gdk_display_manager_get_default_display (Gdk::DisplayManager::get())
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
.
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
.
Glib::RefPtr< DmabufFormats > Gdk::Display::get_dmabuf_formats | ( | ) |
Returns the dma-buf formats that are supported on this display.
GTK may use OpenGL or Vulkan to support some formats. Calling this function will then initialize them if they aren't yet.
The formats returned by this function can be used for negotiating buffer formats with producers such as v4l, pipewire or GStreamer.
To learn more about dma-bufs, see Gdk::DmabufTextureBuilder.
Gdk::DmabufFormats
object. Glib::RefPtr< const DmabufFormats > Gdk::Display::get_dmabuf_formats | ( | ) | const |
Returns the dma-buf formats that are supported on this display.
GTK may use OpenGL or Vulkan to support some formats. Calling this function will then initialize them if they aren't yet.
The formats returned by this function can be used for negotiating buffer formats with producers such as v4l, pipewire or GStreamer.
To learn more about dma-bufs, see Gdk::DmabufTextureBuilder.
Gdk::DmabufFormats
object. 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.
surface | A Gdk::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.
surface | A Gdk::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.
Gio::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.
Gio::ListModel
of Gdk::Monitor
. Glib::ustring Gdk::Display::get_name | ( | ) | const |
Gets the name of the display.
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.
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.
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.
Deprecated: 4.10
|
static |
Get the GType for this class, for use with the underlying GObject type system.
|
inline |
Provides access to the underlying C GObject.
|
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.
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
.
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
.
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.
Gdk::Display
. std::vector< Glib::RefPtr< const Seat > > Gdk::Display::list_seats | ( | ) | const |
Returns the list of seats known to display.
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 GtkWindow with custom startup-notification identifier unless gtk_window_set_auto_startup_notification() is called to disable that feature.
Deprecated: 4.10: Using Gdk::Toplevel::set_startup_id() is sufficient
startup_id | A startup-notification identifier, for which notification process should be completed. |
|
static |
Opens a display.
If opening the display fails, nullptr
is returned.
display_name | The name of the display to open. |
Gdk::Display
. void Gdk::Display::prepare_gl | ( | ) |
Checks that OpenGL is available for this display and ensures that it is properly initialized.
When this fails, an exception will be thrown describing the error.
Note that even if this function succeeds, creating a Gdk::GLContext
may still fail.
This function is idempotent. Calling it multiple times will just return the same value or error.
You never need to call this function, GDK will call it automatically as needed. But you can use it as a check when setting up code that might make use of OpenGL.
Glib::Error |
Glib::PropertyProxy_ReadOnly< bool > Gdk::Display::property_composited | ( | ) | const |
true
if the display properly composites the alpha channel.
Default value: true
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< DmabufFormats > > Gdk::Display::property_dmabuf_formats | ( | ) | const |
The dma-buf formats that are supported on this display.
Glib::PropertyProxy_ReadOnly< bool > Gdk::Display::property_input_shapes | ( | ) | const |
true
if the display supports input shapes.
Default value: true
Glib::PropertyProxy_ReadOnly< bool > Gdk::Display::property_rgba | ( | ) | const |
true
if the display supports an alpha channel.
Default value: true
Glib::PropertyProxy_ReadOnly< bool > Gdk::Display::property_shadow_width | ( | ) | const |
true
if the display supports extensible frames.
Default value: true
void Gdk::Display::put_event | ( | const Glib::RefPtr< const Event > & | event | ) |
Adds the given event to the event queue for display.
Deprecated: 4.10: This function is only useful in very special situations and should not be used by applications.
event | A Gdk::Event . |
Glib::SignalProxy< void(bool)> Gdk::Display::signal_closed | ( | ) |
void on_my_closed(bool is_error)
Flags: Run Last
Emitted when the connection to the windowing system for display is closed.
is_error | true if the display was closed due to an error. |
Glib::SignalProxy< void()> Gdk::Display::signal_opened | ( | ) |
void on_my_opened()
Flags: Run Last
Emitted when the connection to the windowing system for display is opened.
Glib::SignalProxy< void(const Glib::RefPtr< Seat > &)> Gdk::Display::signal_seat_added | ( | ) |
void on_my_seat_added(const Glib::RefPtr<Seat>& seat)
Flags: Run Last
Emitted whenever a new seat is made known to the windowing system.
seat | The seat that was just added. |
Glib::SignalProxy< void(const Glib::RefPtr< Seat > &)> Gdk::Display::signal_seat_removed | ( | ) |
void on_my_seat_removed(const Glib::RefPtr<Seat>& seat)
Flags: Run Last
Emitted whenever a seat is removed by the windowing system.
seat | The seat that was just removed. |
Glib::SignalProxy< void(const Glib::ustring &)> Gdk::Display::signal_setting_changed | ( | ) |
void on_my_setting_changed(const Glib::ustring& setting)
Flags: Run Last
Emitted whenever a setting changes its value.
setting | The name of the setting that changed. |
bool Gdk::Display::supports_input_shapes | ( | ) | const |
Returns true
if the display supports input shapes.
This means that 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
.
true
if surfaces with modified input shape are supported. bool Gdk::Display::supports_shadow_width | ( | ) | const |
Returns whether it's possible for a surface to draw outside of the window area.
If true
is returned the application decides if it wants to draw shadows. If false
is returned, the compositor decides if it wants to draw shadows.
true
if surfaces can draw shadows or false
if the display does not support this functionality. 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 GdkX11::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.
|
related |
A Glib::wrap() method for this object.
object | The C instance. |
take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref. |