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
Closes the connection to the windowing system for the given display, and cleans up associated resources.
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 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
This is supported on crate feature v3_20
only.
v3_20
only.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.
This is supported on crate feature v3_22
only.
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.
v3_22
only.This is supported on crate feature v3_22
only.
v3_22
only.This is supported on crate feature v3_22
only.
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.
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
This is supported on crate feature v3_20
only.
v3_20
only.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()
.
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 EventOwnerChange
events will be
sent when the owner of a selection changes.
Returns
whether EventOwnerChange
events will
be sent.
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.
pub fn connect_monitor_added<F: Fn(&Self, &Monitor) + 'static>(
&self,
f: F
) -> SignalHandlerId
This is supported on crate feature v3_22
only.
pub fn connect_monitor_added<F: Fn(&Self, &Monitor) + 'static>(
&self,
f: F
) -> SignalHandlerId
v3_22
only.The ::monitor-added signal is emitted whenever a monitor is added.
monitor
the monitor that was just added
pub fn connect_monitor_removed<F: Fn(&Self, &Monitor) + 'static>(
&self,
f: F
) -> SignalHandlerId
This is supported on crate feature v3_22
only.
pub fn connect_monitor_removed<F: Fn(&Self, &Monitor) + 'static>(
&self,
f: F
) -> SignalHandlerId
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.
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.
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
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
Returns the type identifier of Self
.
Auto Trait Implementations
impl RefUnwindSafe for Display
impl UnwindSafe for Display
Blanket Implementations
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 true
if the object is an instance of (can be cast to) T
.
pub fn set_properties_from_value(
&self,
property_values: &[(&str, Value)]
) -> Result<(), BoolError>
pub fn set_property<'a, N, V>(
&self,
property_name: N,
value: V
) -> Result<(), BoolError> where
N: Into<&'a str>,
V: ToValue,
pub fn set_property_from_value<'a, N>(
&self,
property_name: N,
value: &Value
) -> Result<(), BoolError> where
N: Into<&'a str>,
Safety Read more
Safety Read more
Safety Read more
Safety Read more
pub fn connect_notify<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId where
F: 'static + Fn(&T, &ParamSpec) + Send + Sync,
pub fn connect_notify_local<F>(
&self,
name: Option<&str>,
f: F
) -> SignalHandlerId where
F: 'static + Fn(&T, &ParamSpec),
pub unsafe fn connect_notify_unsafe<F>(
&self,
name: Option<&str>,
f: F
) -> SignalHandlerId where
F: Fn(&T, &ParamSpec),
pub fn has_property<'a, N>(&self, property_name: N, type_: Option<Type>) -> bool where
N: Into<&'a str>,
pub fn find_property<'a, N>(&self, property_name: N) -> Option<ParamSpec> where
N: Into<&'a str>,
pub fn connect<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: Fn(&[Value]) -> Option<Value> + Send + Sync + 'static,
N: Into<&'a str>,
Same as connect
but takes a SignalId
instead of a signal name.
pub fn connect_local<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: Fn(&[Value]) -> Option<Value> + 'static,
N: Into<&'a str>,
Same as connect_local
but takes a SignalId
instead of a signal name.
pub unsafe fn connect_unsafe<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: Fn(&[Value]) -> Option<Value>,
N: Into<&'a str>,
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.
pub fn bind_property<'a, O, N, M>(
&'a self,
source_property: N,
target: &'a O,
target_property: M
) -> BindingBuilder<'a> where
O: ObjectType,
M: Into<&'a str>,
N: Into<&'a str>,
Same as emit
but takes Value
for the arguments.
Same as emit_by_name
but takes Value
for the arguments.
Returns a SendValue
clone of self
.
impl<'a, T, C> FromValueOptional<'a> for T where
C: ValueTypeChecker<Error = ValueTypeMismatchOrNoneError>,
T: FromValue<'a, Checker = C>,