Struct gdk::Display

source · []
#[repr(transparent)]
pub struct Display { /* private fields */ }
Expand description

Display objects purpose are two fold:

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

  • To manage and provide information about the available GdkScreens

GdkDisplay objects are the GDK representation of an 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 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 DeviceManager object. Every display has a device manager, which you can obtain using device_manager().

Implements

DisplayExtManual

Implementations

Emits a short beep on self

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

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

device

a Device

Returns

true if there is a grab in effect for device.

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.

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

Returns

a new AppLaunchContext for self. Free with g_object_unref() when done

Returns the default size to use for cursors on self.

Returns

the default cursor size.

Returns the default group leader window for all toplevel windows on self. This window is implicitly created by GDK. See Window::set_group().

Returns

The default group leader window for self

Get the default Screen for self.

Returns

the default Screen object for self

Available on crate feature v3_20 only.

Returns the default Seat for this display.

Returns

the default seat.

Returns the DeviceManager associated to self.

Deprecated since 3.20

Use default_seat() and Seat operations.

Returns

A DeviceManager, or None. This memory is owned by GDK and must not be freed or unreferenced.

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

Returns

the next GdkEvent to be processed, or None if no events are pending. The returned GdkEvent should be freed with gdk_event_free().

Gets the maximal size to use for cursors on self.

Returns
width

the return location for the maximal cursor width

height

the return location for the maximal cursor height

Available on crate feature v3_22 only.

Gets a monitor associated with this display.

monitor_num

number of the monitor

Returns

the Monitor, or None if monitor_num is not a valid monitor number

Available on crate feature v3_22 only.

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

x

the x coordinate of the point

y

the y coordinate of the point

Returns

the monitor containing the point

Available on crate feature v3_22 only.

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

window

a Window

Returns

the monitor with the largest overlap with window

Available on crate feature v3_22 only.

Gets the number of monitors that belong to self.

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

Returns

the number of monitors

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.

Available on crate feature v3_22 only.

Gets the primary monitor for the display.

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

Returns

the primary monitor, or None if no primary monitor is configured by the user

Returns a screen object for one of the screens of the display.

Deprecated since 3.20

There is only one screen; use default_screen() to get it.

screen_num

the screen number

Returns

the Screen object

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

Returns

true if there are events ready to be processed.

Finds out if the display has been closed.

Returns

true if the display is closed.

Available on crate feature v3_20 only.

Returns the list of seats known to self.

Returns

the list of seats known to the Display

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.

startup_id

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

Gets a copy of the first GdkEvent in the self’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.)

Returns

a copy of the first GdkEvent on the event queue, or None if no events are in the queue. The returned GdkEvent should be freed with gdk_event_free().

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

event

a GdkEvent.

Request EventOwnerChange events for ownership changes of the selection named by the given atom.

selection

the Atom naming the selection for which ownership change notification is requested

Returns

whether EventOwnerChange events will be sent.

Sets the double click distance (two clicks within this distance count as a double click and result in a [EventType::_2buttonPress][crate::EventType::_2buttonPress] event). See also set_double_click_time(). Applications should not set this, it is a global user-configured setting.

distance

distance in pixels

Sets the double click time (two clicks within this time interval count as a double click and result in a [EventType::_2buttonPress][crate::EventType::_2buttonPress] event). Applications should not set this, it is a global user-configured setting.

msec

double click time in milliseconds (thousandths of a second)

Issues a request to the clipboard manager to store the clipboard data. On X11, this is a special program that works according to the FreeDesktop Clipboard Specification.

clipboard_window

a Window belonging to the clipboard owner

time_

a timestamp

targets

an array of targets that should be saved, or None if all available targets should be saved.

Returns whether the speicifed display supports clipboard persistance; i.e. if it’s possible to store the clipboard data after an application has quit. On X11 this checks if a clipboard daemon is running.

Returns

true if the display supports clipboard persistance.

Returns true if cursors can use an 8bit alpha channel on self. Otherwise, cursors are restricted to bilevel alpha (i.e. a mask).

Returns

whether cursors can have alpha channels.

Returns true if multicolored cursors are supported on self. Otherwise, cursors have only a forground and a background color.

Returns

whether cursors can have multiple colors.

Returns true if gdk_window_input_shape_combine_mask() can be used to modify the input shape of windows on self.

Returns

true if windows with modified input shape are supported

Returns whether EventOwnerChange events will be sent when the owner of a selection changes.

Returns

whether EventOwnerChange events will be sent.

Returns true if gdk_window_shape_combine_mask() can be used to create shaped windows on self.

Returns

true if shaped windows are supported

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 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.

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

Returns

a Display, or None if there is no default display.

Opens a display.

display_name

the name of the display to open

Returns

a Display, or None if the display could not be opened

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

is_error

true if the display was closed due to an error

Available on crate feature v3_22 only.

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

monitor

the monitor that was just added

Available on crate feature v3_22 only.

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

monitor

the monitor that was just removed

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

Available on crate feature v3_20 only.

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

seat

the seat that was just added

Available on crate feature v3_20 only.

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

seat

the seat that was just removed

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Returns the type identifier of Self.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Upcasts an object to a superclass or interface T. Read more

Upcasts an object to a reference of its superclass or interface T. Read more

Tries to downcast to a subclass or interface implementor T. Read more

Tries to downcast to a reference of its subclass or interface implementor T. Read more

Tries to cast to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more

Tries to cast to reference to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more

Casts to T unconditionally. Read more

Casts to &T unconditionally. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Returns true if the object is an instance of (can be cast to) T.

Returns the type of the object.

Returns the ObjectClass of the object. Read more

Returns the class of the object.

Returns the class of the object in the given type T. Read more

Returns the interface T of the object. Read more

Similar to Self::set_property but fails instead of panicking.

Sets the property property_name of the object to value value. Read more

Similar to Self::set_property but fails instead of panicking.

Sets the property property_name of the object to value value. Read more

Similar to Self::set_properties but fails instead of panicking.

Sets multiple properties of the object at once. Read more

Similar to Self::set_properties_from_value but fails instead of panicking.

Sets multiple properties of the object at once. Read more

Similar to Self::property but fails instead of panicking.

Gets the property property_name of the object and cast it to the type V. Read more

Similar to Self::property_value but fails instead of panicking.

Gets the property property_name of the object. Read more

Check if the object has a property property_name of the given type_. Read more

Get the type of the property property_name of this object. Read more

Get the ParamSpec of the property property_name of this object.

Return all ParamSpec of the properties of this object.

Freeze all property notifications until the return guard object is dropped. Read more

Set arbitrary data on this object with the given key. Read more

Return previously set arbitrary data of this object with the given key. Read more

Retrieve previously set arbitrary data of this object with the given key. Read more

Set arbitrary data on this object with the given key. Read more

Return previously set arbitrary data of this object with the given key. Read more

Retrieve previously set arbitrary data of this object with the given key. Read more

Block a given signal handler. Read more

Unblock a given signal handler.

Stop emission of the currently emitted signal.

Stop emission of the currently emitted signal by the (possibly detailed) signal name.

Similar to Self::connect but fails instead of panicking.

Connect to the signal signal_name on this object. Read more

Similar to Self::connect_id but fails instead of panicking.

Connect to the signal signal_id on this object. Read more

Similar to Self::connect_local but fails instead of panicking.

Connect to the signal signal_name on this object. Read more

Similar to Self::connect_local_id but fails instead of panicking.

Connect to the signal signal_id on this object. Read more

Similar to Self::connect_unsafe but fails instead of panicking.

Connect to the signal signal_name on this object. Read more

Similar to Self::connect_unsafe_id but fails instead of panicking.

Similar to Self::connect_closure but fails instead of panicking.

Connect a closure to the signal signal_name on this object. Read more

Similar to Self::connect_closure_id but fails instead of panicking.

Connect a closure to the signal signal_id on this object. Read more

Limits the lifetime of closure to the lifetime of the object. When the object’s reference count drops to zero, the closure will be invalidated. An invalidated closure will ignore any calls to Closure::invoke. Read more

Connect to the signal signal_id on this object. Read more

Similar to Self::emit but fails instead of panicking.

Emit signal by signal id. Read more

Similar to Self::emit_with_values but fails instead of panicking.

Same as Self::emit but takes Value for the arguments.

Similar to Self::emit_by_name but fails instead of panicking.

Emit signal by its name. Read more

Similar to Self::emit_by_name_with_values but fails instead of panicking.

Emit signal by its name. Read more

Similar to Self::emit_with_details but fails instead of panicking.

Emit signal by signal id with details. Read more

Similar to Self::emit_with_details_and_values but fails instead of panicking.

Emit signal by signal id with details. Read more

Disconnect a previously connected signal handler.

Connect to the notify signal of the object. Read more

Connect to the notify signal of the object. Read more

Connect to the notify signal of the object. Read more

Notify that the given property has changed its value. Read more

Notify that the given property has changed its value. Read more

Downgrade this object to a weak reference.

Bind property source_property on this object to the target_property on the target object. Read more

Returns the strong reference count of this object.

Ensures that the type has been registered with the type system.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.