pub trait DisplayExt: IsA<Display> + 'static {
Show 34 methods
// Provided methods
fn beep(&self) { ... }
fn close(&self) { ... }
fn create_gl_context(&self) -> Result<GLContext, Error> { ... }
fn device_is_grabbed(&self, device: &impl IsA<Device>) -> bool { ... }
fn flush(&self) { ... }
fn app_launch_context(&self) -> AppLaunchContext { ... }
fn clipboard(&self) -> Clipboard { ... }
fn default_seat(&self) -> Option<Seat> { ... }
fn dmabuf_formats(&self) -> DmabufFormats { ... }
fn monitor_at_surface(&self, surface: &impl IsA<Surface>) -> Option<Monitor> { ... }
fn monitors(&self) -> ListModel { ... }
fn name(&self) -> GString { ... }
fn primary_clipboard(&self) -> Clipboard { ... }
fn startup_notification_id(&self) -> Option<GString> { ... }
fn is_closed(&self) -> bool { ... }
fn is_composited(&self) -> bool { ... }
fn is_rgba(&self) -> bool { ... }
fn list_seats(&self) -> Vec<Seat> { ... }
fn notify_startup_complete(&self, startup_id: &str) { ... }
fn prepare_gl(&self) -> Result<(), Error> { ... }
fn put_event(&self, event: impl AsRef<Event>) { ... }
fn supports_input_shapes(&self) -> bool { ... }
fn supports_shadow_width(&self) -> bool { ... }
fn sync(&self) { ... }
fn connect_closed<F: Fn(&Self, bool) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_opened<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { ... }
fn connect_seat_added<F: Fn(&Self, &Seat) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_seat_removed<F: Fn(&Self, &Seat) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_setting_changed<F: Fn(&Self, &str) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_composited_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_dmabuf_formats_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_input_shapes_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_rgba_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_shadow_width_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
}
Provided Methods§
Sourcefn close(&self)
fn close(&self)
Closes the connection to the windowing system for the given display.
This cleans up associated resources.
Sourcefn create_gl_context(&self) -> Result<GLContext, Error>
Available on crate feature v4_6
only.
fn create_gl_context(&self) -> Result<GLContext, Error>
v4_6
only.Creates a new GLContext
for the 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 GLContext
failed, @error will be set.
Before using the returned GLContext
, you will need to
call GLContextExt::make_current()
or GLContextExt::realize()
.
§Returns
the newly created GLContext
Sourcefn device_is_grabbed(&self, device: &impl IsA<Device>) -> bool
fn device_is_grabbed(&self, device: &impl IsA<Device>) -> bool
Sourcefn flush(&self)
fn flush(&self)
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.
Sourcefn app_launch_context(&self) -> AppLaunchContext
fn app_launch_context(&self) -> AppLaunchContext
Returns a AppLaunchContext
suitable for launching
applications on the given display.
§Returns
a new AppLaunchContext
for @self
Sourcefn default_seat(&self) -> Option<Seat>
fn default_seat(&self) -> Option<Seat>
Sourcefn dmabuf_formats(&self) -> DmabufFormats
Available on crate feature v4_14
only.
fn dmabuf_formats(&self) -> DmabufFormats
v4_14
only.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 DmabufTextureBuilder
.
§Returns
a DmabufFormats
object
Sourcefn name(&self) -> GString
fn name(&self) -> GString
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.
Sourcefn primary_clipboard(&self) -> Clipboard
fn primary_clipboard(&self) -> 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
Sourcefn startup_notification_id(&self) -> Option<GString>
👎Deprecated: Since 4.10
fn startup_notification_id(&self) -> Option<GString>
Sourcefn is_composited(&self) -> bool
fn is_composited(&self) -> bool
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 @self.
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.
Sourcefn is_rgba(&self) -> bool
fn is_rgba(&self) -> bool
Returns whether surfaces on this @self 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.
Sourcefn list_seats(&self) -> Vec<Seat>
fn list_seats(&self) -> Vec<Seat>
Sourcefn notify_startup_complete(&self, startup_id: &str)
👎Deprecated: Since 4.10
fn notify_startup_complete(&self, startup_id: &str)
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 since 4.10
Using ToplevelExt::set_startup_id()
is sufficient
§startup_id
a startup-notification identifier, for which notification process should be completed
Sourcefn prepare_gl(&self) -> Result<(), Error>
Available on crate feature v4_4
only.
fn prepare_gl(&self) -> Result<(), Error>
v4_4
only.Checks that OpenGL is available for @self and ensures that it is
properly initialized.
When this fails, an @error will be set describing the error and this
function returns false
.
Note that even if this function succeeds, creating a 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.
§Returns
true
if the display supports OpenGL
Sourcefn supports_input_shapes(&self) -> bool
fn supports_input_shapes(&self) -> bool
Returns true
if the display supports input shapes.
This means that SurfaceExt::set_input_region()
can
be used to modify the input shape of surfaces on @self.
On modern displays, this value is always true
.
§Returns
true
if surfaces with modified input shape are supported
Sourcefn supports_shadow_width(&self) -> bool
Available on crate feature v4_14
only.
fn supports_shadow_width(&self) -> bool
v4_14
only.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.
§Returns
true
if surfaces can draw shadows or
false
if the display does not support this functionality.
Sourcefn sync(&self)
fn sync(&self)
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.
Sourcefn connect_closed<F: Fn(&Self, bool) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_closed<F: Fn(&Self, bool) + 'static>(&self, f: F) -> SignalHandlerId
Sourcefn connect_opened<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_opened<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Emitted when the connection to the windowing system for @display is opened.
Sourcefn connect_seat_added<F: Fn(&Self, &Seat) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_seat_added<F: Fn(&Self, &Seat) + 'static>( &self, f: F, ) -> SignalHandlerId
Emitted whenever a new seat is made known to the windowing system.
§seat
the seat that was just added
Sourcefn connect_seat_removed<F: Fn(&Self, &Seat) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_seat_removed<F: Fn(&Self, &Seat) + 'static>( &self, f: F, ) -> SignalHandlerId
Sourcefn connect_setting_changed<F: Fn(&Self, &str) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_setting_changed<F: Fn(&Self, &str) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_composited_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_dmabuf_formats_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
v4_14
only.fn connect_input_shapes_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_rgba_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_shadow_width_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
v4_14
only.Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.