2018-07-17 00:25:27 +10:00
|
|
|
#![cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))]
|
2015-09-26 02:04:55 +10:00
|
|
|
|
2017-12-17 20:17:26 +11:00
|
|
|
use std::os::raw;
|
2017-01-07 07:59:35 +11:00
|
|
|
use std::ptr;
|
2018-06-15 09:42:18 +10:00
|
|
|
use std::sync::Arc;
|
|
|
|
|
2019-01-29 21:04:15 +11:00
|
|
|
use sctk::window::{ButtonState, Theme};
|
|
|
|
|
2019-02-21 20:51:43 +11:00
|
|
|
use dpi::LogicalSize;
|
|
|
|
use event_loop::EventLoop;
|
|
|
|
use monitor::MonitorHandle;
|
|
|
|
use window::{Window, WindowBuilder};
|
|
|
|
|
2019-02-06 02:30:33 +11:00
|
|
|
use platform_impl::{
|
|
|
|
EventLoop as LinuxEventLoop,
|
2018-06-15 09:42:18 +10:00
|
|
|
Window as LinuxWindow,
|
|
|
|
};
|
2019-04-28 02:06:51 +10:00
|
|
|
use platform_impl::x11::XConnection;
|
|
|
|
use platform_impl::x11::ffi::XVisualInfo;
|
|
|
|
|
2017-09-23 17:36:30 +10:00
|
|
|
// TODO: stupid hack so that glutin can do its work
|
2019-04-28 02:06:51 +10:00
|
|
|
#[doc(hidden)]
|
|
|
|
pub use platform_impl::x11;
|
|
|
|
|
|
|
|
pub use platform_impl::XNotSupported;
|
|
|
|
pub use platform_impl::x11::util::WindowType as XWindowType;
|
2017-03-15 20:11:43 +11:00
|
|
|
|
2019-01-29 21:04:15 +11:00
|
|
|
/// Theme for wayland client side decorations
|
|
|
|
///
|
|
|
|
/// Colors must be in ARGB8888 format
|
|
|
|
pub struct WaylandTheme {
|
|
|
|
/// Primary color when the window is focused
|
|
|
|
pub primary_active: [u8; 4],
|
|
|
|
/// Primary color when the window is unfocused
|
|
|
|
pub primary_inactive: [u8; 4],
|
|
|
|
/// Secondary color when the window is focused
|
|
|
|
pub secondary_active: [u8; 4],
|
|
|
|
/// Secondary color when the window is unfocused
|
|
|
|
pub secondary_inactive: [u8; 4],
|
|
|
|
/// Close button color when hovered over
|
|
|
|
pub close_button_hovered: [u8; 4],
|
|
|
|
/// Close button color
|
|
|
|
pub close_button: [u8; 4],
|
|
|
|
/// Close button color when hovered over
|
|
|
|
pub maximize_button_hovered: [u8; 4],
|
|
|
|
/// Maximize button color
|
|
|
|
pub maximize_button: [u8; 4],
|
|
|
|
/// Minimize button color when hovered over
|
|
|
|
pub minimize_button_hovered: [u8; 4],
|
|
|
|
/// Minimize button color
|
|
|
|
pub minimize_button: [u8; 4],
|
|
|
|
}
|
|
|
|
|
|
|
|
struct WaylandThemeObject(WaylandTheme);
|
|
|
|
|
|
|
|
impl Theme for WaylandThemeObject {
|
|
|
|
fn get_primary_color(&self, active: bool) -> [u8; 4] {
|
|
|
|
if active {
|
|
|
|
self.0.primary_active
|
|
|
|
} else {
|
|
|
|
self.0.primary_inactive
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Used for division line
|
|
|
|
fn get_secondary_color(&self, active: bool) -> [u8; 4] {
|
|
|
|
if active {
|
|
|
|
self.0.secondary_active
|
|
|
|
} else {
|
|
|
|
self.0.secondary_inactive
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn get_close_button_color(&self, state: ButtonState) -> [u8; 4] {
|
|
|
|
match state {
|
|
|
|
ButtonState::Hovered => self.0.close_button_hovered,
|
|
|
|
_ => self.0.close_button,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn get_maximize_button_color(&self, state: ButtonState) -> [u8; 4] {
|
|
|
|
match state {
|
|
|
|
ButtonState::Hovered => self.0.maximize_button_hovered,
|
|
|
|
_ => self.0.maximize_button,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn get_minimize_button_color(&self, state: ButtonState) -> [u8; 4] {
|
|
|
|
match state {
|
|
|
|
ButtonState::Hovered => self.0.minimize_button_hovered,
|
|
|
|
_ => self.0.minimize_button,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-06 02:30:33 +11:00
|
|
|
/// Additional methods on `EventLoop` that are specific to Unix.
|
|
|
|
pub trait EventLoopExtUnix {
|
2019-02-21 20:51:43 +11:00
|
|
|
/// Builds a new `EventLoops` that is forced to use X11.
|
2019-04-28 02:06:51 +10:00
|
|
|
fn new_x11() -> Result<Self, XNotSupported>
|
|
|
|
where Self: Sized;
|
2017-09-01 19:04:57 +10:00
|
|
|
|
2019-02-06 02:30:33 +11:00
|
|
|
/// Builds a new `EventLoop` that is forced to use Wayland.
|
2017-09-01 19:04:57 +10:00
|
|
|
fn new_wayland() -> Self
|
|
|
|
where Self: Sized;
|
2017-09-23 17:36:30 +10:00
|
|
|
|
2019-02-06 02:30:33 +11:00
|
|
|
/// True if the `EventLoop` uses Wayland.
|
2017-09-23 17:36:30 +10:00
|
|
|
fn is_wayland(&self) -> bool;
|
|
|
|
|
2019-02-06 02:30:33 +11:00
|
|
|
/// True if the `EventLoop` uses X11.
|
2017-09-23 17:36:30 +10:00
|
|
|
fn is_x11(&self) -> bool;
|
|
|
|
|
2019-04-28 02:06:51 +10:00
|
|
|
#[doc(hidden)]
|
|
|
|
fn get_xlib_xconnection(&self) -> Option<Arc<XConnection>>;
|
2019-04-08 15:07:47 +10:00
|
|
|
|
2019-05-02 09:03:30 +10:00
|
|
|
/// Returns a pointer to the `wl_display` object of wayland that is used by this `EventLoop`.
|
2019-04-08 15:07:47 +10:00
|
|
|
///
|
2019-05-02 09:03:30 +10:00
|
|
|
/// Returns `None` if the `EventLoop` doesn't use wayland (if it uses xlib for example).
|
2019-04-08 15:07:47 +10:00
|
|
|
///
|
2019-05-02 09:03:30 +10:00
|
|
|
/// The pointer will become invalid when the glutin `EventLoop` is destroyed.
|
2019-04-08 15:07:47 +10:00
|
|
|
fn get_wayland_display(&self) -> Option<*mut raw::c_void>;
|
2017-09-01 19:04:57 +10:00
|
|
|
}
|
|
|
|
|
2019-02-21 20:51:43 +11:00
|
|
|
impl<T> EventLoopExtUnix for EventLoop<T> {
|
2019-04-28 02:06:51 +10:00
|
|
|
#[inline]
|
|
|
|
fn new_x11() -> Result<Self, XNotSupported> {
|
|
|
|
LinuxEventLoop::new_x11().map(|ev|
|
|
|
|
EventLoop {
|
|
|
|
event_loop: ev,
|
|
|
|
_marker: ::std::marker::PhantomData,
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
2017-09-01 19:04:57 +10:00
|
|
|
|
|
|
|
#[inline]
|
|
|
|
fn new_wayland() -> Self {
|
2019-02-06 02:30:33 +11:00
|
|
|
EventLoop {
|
|
|
|
event_loop: match LinuxEventLoop::new_wayland() {
|
2017-09-01 19:04:57 +10:00
|
|
|
Ok(e) => e,
|
|
|
|
Err(_) => panic!() // TODO: propagate
|
2017-10-19 05:40:21 +11:00
|
|
|
},
|
|
|
|
_marker: ::std::marker::PhantomData,
|
2017-09-01 19:04:57 +10:00
|
|
|
}
|
2017-01-08 00:34:38 +11:00
|
|
|
}
|
2017-09-23 17:36:30 +10:00
|
|
|
|
|
|
|
#[inline]
|
|
|
|
fn is_wayland(&self) -> bool {
|
2019-02-06 02:30:33 +11:00
|
|
|
self.event_loop.is_wayland()
|
2017-09-23 17:36:30 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
fn is_x11(&self) -> bool {
|
2019-02-06 02:30:33 +11:00
|
|
|
!self.event_loop.is_wayland()
|
2017-09-23 17:36:30 +10:00
|
|
|
}
|
|
|
|
|
2019-04-28 02:06:51 +10:00
|
|
|
#[inline]
|
|
|
|
#[doc(hidden)]
|
|
|
|
fn get_xlib_xconnection(&self) -> Option<Arc<XConnection>> {
|
|
|
|
match self.event_loop {
|
|
|
|
LinuxEventLoop::X(ref e) => Some(e.x_connection().clone()),
|
|
|
|
_ => None
|
|
|
|
}
|
|
|
|
}
|
2019-04-08 15:07:47 +10:00
|
|
|
|
|
|
|
#[inline]
|
|
|
|
fn get_wayland_display(&self) -> Option<*mut raw::c_void> {
|
2019-04-28 02:06:51 +10:00
|
|
|
match self.event_loop {
|
|
|
|
LinuxEventLoop::Wayland(ref e) => Some(e.get_display().get_display_ptr() as *mut _),
|
2019-04-08 15:07:47 +10:00
|
|
|
_ => None
|
|
|
|
}
|
|
|
|
}
|
2017-01-08 00:34:38 +11:00
|
|
|
}
|
|
|
|
|
2016-01-08 02:01:18 +11:00
|
|
|
/// Additional methods on `Window` that are specific to Unix.
|
2019-02-06 02:30:33 +11:00
|
|
|
pub trait WindowExtUnix {
|
2017-12-17 20:17:26 +11:00
|
|
|
/// Returns the ID of the `Window` xlib object that is used by this window.
|
2015-09-26 02:04:55 +10:00
|
|
|
///
|
|
|
|
/// Returns `None` if the window doesn't use xlib (if it uses wayland for example).
|
2017-12-17 20:17:26 +11:00
|
|
|
fn get_xlib_window(&self) -> Option<raw::c_ulong>;
|
2015-09-26 02:04:55 +10:00
|
|
|
|
|
|
|
/// Returns a pointer to the `Display` object of xlib that is used by this window.
|
|
|
|
///
|
|
|
|
/// Returns `None` if the window doesn't use xlib (if it uses wayland for example).
|
|
|
|
///
|
|
|
|
/// The pointer will become invalid when the glutin `Window` is destroyed.
|
2017-12-17 20:17:26 +11:00
|
|
|
fn get_xlib_display(&self) -> Option<*mut raw::c_void>;
|
2016-10-20 03:11:02 +11:00
|
|
|
|
2017-12-17 20:17:26 +11:00
|
|
|
fn get_xlib_screen_id(&self) -> Option<raw::c_int>;
|
2016-10-20 03:11:02 +11:00
|
|
|
|
2019-04-28 02:06:51 +10:00
|
|
|
#[doc(hidden)]
|
|
|
|
fn get_xlib_xconnection(&self) -> Option<Arc<XConnection>>;
|
2017-07-12 14:00:51 +10:00
|
|
|
|
2018-05-21 00:47:22 +10:00
|
|
|
/// Set window urgency hint (`XUrgencyHint`). Only relevant on X.
|
|
|
|
fn set_urgent(&self, is_urgent: bool);
|
|
|
|
|
2016-07-31 07:58:28 +10:00
|
|
|
/// This function returns the underlying `xcb_connection_t` of an xlib `Display`.
|
|
|
|
///
|
|
|
|
/// Returns `None` if the window doesn't use xlib (if it uses wayland for example).
|
|
|
|
///
|
|
|
|
/// The pointer will become invalid when the glutin `Window` is destroyed.
|
2017-12-17 20:17:26 +11:00
|
|
|
fn get_xcb_connection(&self) -> Option<*mut raw::c_void>;
|
2016-05-08 17:28:54 +10:00
|
|
|
|
2016-10-10 17:01:58 +11:00
|
|
|
/// Returns a pointer to the `wl_surface` object of wayland that is used by this window.
|
|
|
|
///
|
|
|
|
/// Returns `None` if the window doesn't use wayland (if it uses xlib for example).
|
|
|
|
///
|
|
|
|
/// The pointer will become invalid when the glutin `Window` is destroyed.
|
2017-12-17 20:17:26 +11:00
|
|
|
fn get_wayland_surface(&self) -> Option<*mut raw::c_void>;
|
2016-10-10 17:01:58 +11:00
|
|
|
|
|
|
|
/// Returns a pointer to the `wl_display` object of wayland that is used by this window.
|
|
|
|
///
|
|
|
|
/// Returns `None` if the window doesn't use wayland (if it uses xlib for example).
|
|
|
|
///
|
|
|
|
/// The pointer will become invalid when the glutin `Window` is destroyed.
|
2017-12-17 20:17:26 +11:00
|
|
|
fn get_wayland_display(&self) -> Option<*mut raw::c_void>;
|
2017-09-28 00:31:46 +10:00
|
|
|
|
2019-01-29 21:04:15 +11:00
|
|
|
/// Sets the color theme of the client side window decorations on wayland
|
|
|
|
fn set_wayland_theme(&self, theme: WaylandTheme);
|
|
|
|
|
2017-09-28 00:31:46 +10:00
|
|
|
/// Check if the window is ready for drawing
|
|
|
|
///
|
2017-11-04 03:35:29 +11:00
|
|
|
/// It is a remnant of a previous implementation detail for the
|
|
|
|
/// wayland backend, and is no longer relevant.
|
2017-09-28 00:31:46 +10:00
|
|
|
///
|
2017-11-04 03:35:29 +11:00
|
|
|
/// Always return true.
|
|
|
|
#[deprecated]
|
2017-09-28 00:31:46 +10:00
|
|
|
fn is_ready(&self) -> bool;
|
2015-09-26 02:04:55 +10:00
|
|
|
}
|
|
|
|
|
2019-02-06 02:30:33 +11:00
|
|
|
impl WindowExtUnix for Window {
|
2015-09-26 02:04:55 +10:00
|
|
|
#[inline]
|
2017-12-17 20:17:26 +11:00
|
|
|
fn get_xlib_window(&self) -> Option<raw::c_ulong> {
|
2017-03-04 07:41:51 +11:00
|
|
|
match self.window {
|
2019-04-28 02:06:51 +10:00
|
|
|
LinuxWindow::X(ref w) => Some(w.get_xlib_window()),
|
2015-09-26 02:04:55 +10:00
|
|
|
_ => None
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2017-12-17 20:17:26 +11:00
|
|
|
fn get_xlib_display(&self) -> Option<*mut raw::c_void> {
|
2017-03-04 07:41:51 +11:00
|
|
|
match self.window {
|
2019-04-28 02:06:51 +10:00
|
|
|
LinuxWindow::X(ref w) => Some(w.get_xlib_display()),
|
2015-09-26 02:04:55 +10:00
|
|
|
_ => None
|
|
|
|
}
|
|
|
|
}
|
2016-05-08 17:28:54 +10:00
|
|
|
|
2018-05-21 00:47:22 +10:00
|
|
|
#[inline]
|
2017-12-17 20:17:26 +11:00
|
|
|
fn get_xlib_screen_id(&self) -> Option<raw::c_int> {
|
2017-03-04 07:41:51 +11:00
|
|
|
match self.window {
|
2019-04-28 02:06:51 +10:00
|
|
|
LinuxWindow::X(ref w) => Some(w.get_xlib_screen_id()),
|
2016-10-20 03:11:02 +11:00
|
|
|
_ => None
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-28 02:06:51 +10:00
|
|
|
#[inline]
|
|
|
|
#[doc(hidden)]
|
|
|
|
fn get_xlib_xconnection(&self) -> Option<Arc<XConnection>> {
|
|
|
|
match self.window {
|
|
|
|
LinuxWindow::X(ref w) => Some(w.get_xlib_xconnection()),
|
|
|
|
_ => None
|
|
|
|
}
|
|
|
|
}
|
2016-10-20 03:11:02 +11:00
|
|
|
|
2018-05-21 00:47:22 +10:00
|
|
|
#[inline]
|
2017-12-17 20:17:26 +11:00
|
|
|
fn get_xcb_connection(&self) -> Option<*mut raw::c_void> {
|
2017-03-04 07:41:51 +11:00
|
|
|
match self.window {
|
2019-04-28 02:06:51 +10:00
|
|
|
LinuxWindow::X(ref w) => Some(w.get_xcb_connection()),
|
2016-07-31 07:58:28 +10:00
|
|
|
_ => None
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-21 00:47:22 +10:00
|
|
|
#[inline]
|
|
|
|
fn set_urgent(&self, is_urgent: bool) {
|
2019-04-28 02:06:51 +10:00
|
|
|
if let LinuxWindow::X(ref w) = self.window {
|
|
|
|
w.set_urgent(is_urgent);
|
|
|
|
}
|
2018-05-21 00:47:22 +10:00
|
|
|
}
|
|
|
|
|
2016-05-08 17:28:54 +10:00
|
|
|
#[inline]
|
2017-12-17 20:17:26 +11:00
|
|
|
fn get_wayland_surface(&self) -> Option<*mut raw::c_void> {
|
2017-03-04 07:41:51 +11:00
|
|
|
match self.window {
|
2019-02-21 20:51:43 +11:00
|
|
|
LinuxWindow::Wayland(ref w) => Some(w.get_surface().as_ref().c_ptr() as *mut _),
|
2016-05-08 17:28:54 +10:00
|
|
|
_ => None
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2017-12-17 20:17:26 +11:00
|
|
|
fn get_wayland_display(&self) -> Option<*mut raw::c_void> {
|
2017-03-04 07:41:51 +11:00
|
|
|
match self.window {
|
2019-02-21 20:51:43 +11:00
|
|
|
LinuxWindow::Wayland(ref w) => Some(w.get_display().as_ref().c_ptr() as *mut _),
|
2016-05-08 17:28:54 +10:00
|
|
|
_ => None
|
|
|
|
}
|
|
|
|
}
|
2017-09-28 00:31:46 +10:00
|
|
|
|
2019-01-29 21:04:15 +11:00
|
|
|
#[inline]
|
|
|
|
fn set_wayland_theme(&self, theme: WaylandTheme) {
|
|
|
|
match self.window {
|
|
|
|
LinuxWindow::Wayland(ref w) => w.set_theme(WaylandThemeObject(theme)),
|
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-28 00:31:46 +10:00
|
|
|
#[inline]
|
|
|
|
fn is_ready(&self) -> bool {
|
2017-11-04 03:35:29 +11:00
|
|
|
true
|
2017-09-28 00:31:46 +10:00
|
|
|
}
|
2015-09-26 02:04:55 +10:00
|
|
|
}
|
2016-01-08 02:01:18 +11:00
|
|
|
|
|
|
|
/// Additional methods on `WindowBuilder` that are specific to Unix.
|
2019-02-06 02:30:33 +11:00
|
|
|
pub trait WindowBuilderExtUnix {
|
2017-01-08 00:34:38 +11:00
|
|
|
fn with_x11_visual<T>(self, visual_infos: *const T) -> WindowBuilder;
|
|
|
|
fn with_x11_screen(self, screen_id: i32) -> WindowBuilder;
|
2018-05-03 23:41:11 +10:00
|
|
|
|
2018-05-21 00:47:22 +10:00
|
|
|
/// Build window with `WM_CLASS` hint; defaults to the name of the binary. Only relevant on X11.
|
|
|
|
fn with_class(self, class: String, instance: String) -> WindowBuilder;
|
|
|
|
/// Build window with override-redirect flag; defaults to false. Only relevant on X11.
|
|
|
|
fn with_override_redirect(self, override_redirect: bool) -> WindowBuilder;
|
|
|
|
/// Build window with `_NET_WM_WINDOW_TYPE` hint; defaults to `Normal`. Only relevant on X11.
|
2019-04-28 02:06:51 +10:00
|
|
|
fn with_x11_window_type(self, x11_window_type: XWindowType) -> WindowBuilder;
|
2018-09-21 07:00:04 +10:00
|
|
|
/// Build window with `_GTK_THEME_VARIANT` hint set to the specified value. Currently only relevant on X11.
|
|
|
|
fn with_gtk_theme_variant(self, variant: String) -> WindowBuilder;
|
2018-05-03 23:41:11 +10:00
|
|
|
/// Build window with resize increment hint. Only implemented on X11.
|
2018-06-15 09:42:18 +10:00
|
|
|
fn with_resize_increments(self, increments: LogicalSize) -> WindowBuilder;
|
2018-05-03 23:41:11 +10:00
|
|
|
/// Build window with base size hint. Only implemented on X11.
|
2018-06-15 09:42:18 +10:00
|
|
|
fn with_base_size(self, base_size: LogicalSize) -> WindowBuilder;
|
2018-11-16 08:59:56 +11:00
|
|
|
|
|
|
|
/// Build window with a given application ID. It should match the `.desktop` file distributed with
|
|
|
|
/// your program. Only relevant on Wayland.
|
|
|
|
///
|
|
|
|
/// For details about application ID conventions, see the
|
|
|
|
/// [Desktop Entry Spec](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#desktop-file-id)
|
|
|
|
fn with_app_id(self, app_id: String) -> WindowBuilder;
|
2016-01-08 02:01:18 +11:00
|
|
|
}
|
|
|
|
|
2019-02-06 02:30:33 +11:00
|
|
|
impl WindowBuilderExtUnix for WindowBuilder {
|
2017-01-07 07:59:35 +11:00
|
|
|
#[inline]
|
2017-01-08 00:34:38 +11:00
|
|
|
fn with_x11_visual<T>(mut self, visual_infos: *const T) -> WindowBuilder {
|
2019-04-28 02:06:51 +10:00
|
|
|
self.platform_specific.visual_infos = Some(
|
|
|
|
unsafe { ptr::read(visual_infos as *const XVisualInfo) }
|
|
|
|
);
|
2017-01-07 07:59:35 +11:00
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2017-01-08 00:34:38 +11:00
|
|
|
fn with_x11_screen(mut self, screen_id: i32) -> WindowBuilder {
|
2017-01-07 07:59:35 +11:00
|
|
|
self.platform_specific.screen_id = Some(screen_id);
|
|
|
|
self
|
|
|
|
}
|
2018-05-03 23:41:11 +10:00
|
|
|
|
2018-05-21 00:47:22 +10:00
|
|
|
#[inline]
|
|
|
|
fn with_class(mut self, instance: String, class: String) -> WindowBuilder {
|
|
|
|
self.platform_specific.class = Some((instance, class));
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
fn with_override_redirect(mut self, override_redirect: bool) -> WindowBuilder {
|
|
|
|
self.platform_specific.override_redirect = override_redirect;
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
2019-04-28 02:06:51 +10:00
|
|
|
#[inline]
|
|
|
|
fn with_x11_window_type(mut self, x11_window_type: XWindowType) -> WindowBuilder {
|
|
|
|
self.platform_specific.x11_window_type = x11_window_type;
|
|
|
|
self
|
|
|
|
}
|
2018-05-21 00:47:22 +10:00
|
|
|
|
2018-05-03 23:41:11 +10:00
|
|
|
#[inline]
|
2018-06-15 09:42:18 +10:00
|
|
|
fn with_resize_increments(mut self, increments: LogicalSize) -> WindowBuilder {
|
|
|
|
self.platform_specific.resize_increments = Some(increments.into());
|
2018-05-03 23:41:11 +10:00
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2018-06-15 09:42:18 +10:00
|
|
|
fn with_base_size(mut self, base_size: LogicalSize) -> WindowBuilder {
|
|
|
|
self.platform_specific.base_size = Some(base_size.into());
|
2018-05-03 23:41:11 +10:00
|
|
|
self
|
|
|
|
}
|
2018-09-21 07:00:04 +10:00
|
|
|
|
|
|
|
#[inline]
|
|
|
|
fn with_gtk_theme_variant(mut self, variant: String) -> WindowBuilder {
|
|
|
|
self.platform_specific.gtk_theme_variant = Some(variant);
|
|
|
|
self
|
|
|
|
}
|
2018-11-16 08:59:56 +11:00
|
|
|
|
|
|
|
#[inline]
|
|
|
|
fn with_app_id(mut self, app_id: String) -> WindowBuilder {
|
|
|
|
self.platform_specific.app_id = Some(app_id);
|
|
|
|
self
|
|
|
|
}
|
2016-01-08 02:01:18 +11:00
|
|
|
}
|
2017-08-30 16:49:18 +10:00
|
|
|
|
2019-02-06 02:30:33 +11:00
|
|
|
/// Additional methods on `MonitorHandle` that are specific to Linux.
|
|
|
|
pub trait MonitorHandleExtUnix {
|
2017-08-30 16:49:18 +10:00
|
|
|
/// Returns the inner identifier of the monitor.
|
|
|
|
fn native_id(&self) -> u32;
|
|
|
|
}
|
|
|
|
|
2019-02-06 02:30:33 +11:00
|
|
|
impl MonitorHandleExtUnix for MonitorHandle {
|
2017-08-30 16:49:18 +10:00
|
|
|
#[inline]
|
|
|
|
fn native_id(&self) -> u32 {
|
|
|
|
self.inner.get_native_identifier()
|
|
|
|
}
|
|
|
|
}
|