Struct gdk::Display[][src]

pub struct Display(_);
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().

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

This is supported 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

This is supported 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

This is supported 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

This is supported 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

This is supported 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.

This is supported 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.

This is supported 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

This is supported on crate feature v3_22 only.

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

monitor

the monitor that was just added

This is supported 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.

This is supported 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

This is supported 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

Performs the conversion.

Performs the conversion.

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

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Same as connect but takes a SignalId instead of a signal name.

Same as connect_local but takes a SignalId instead of a signal name.

Same as connect_unsafe but takes a SignalId instead of a signal name.

Emit signal by signal id.

Emit signal with details by signal id.

Emit signal by it’s name.

Same as emit but takes Value for the arguments.

Same as emit_by_name but takes Value for the arguments.

Same as emit_with_details but takes Value for the arguments.

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)

recently added

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

Returns a SendValue clone of self.

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.