Add Window::set_theme (#2553)
* Add `Window::set_theme` * typo * fix linux build * fix wayland * review changes * update docs * update changelog * pin `image` dep * suppport falling back to system default * fix linux * default to dark on macOS and x11 * fix `setAppearance` definition * add macOS notes * update docs * Update CHANGELOG.md Co-authored-by: Markus Siglreithmaier <m.siglreith@gmail.com> * update doc * Revert "pin `image` dep" This reverts commit 7517f7c5065b4089ca146ce8799dab445ec32068. * Update theme example with Window::set_theme * Fix Window::theme getter on macOS Co-authored-by: Markus Siglreithmaier <m.siglreith@gmail.com> Co-authored-by: Mads Marquart <mads@marquart.dk>
This commit is contained in:
parent
9ae7498a8a
commit
28e34c2e1b
15 changed files with 127 additions and 65 deletions
|
|
@ -88,14 +88,6 @@ pub trait WindowExtWayland {
|
|||
///
|
||||
/// The pointer will become invalid when the [`Window`] is destroyed.
|
||||
fn wayland_display(&self) -> Option<*mut raw::c_void>;
|
||||
|
||||
/// Updates [`Theme`] of window decorations.
|
||||
///
|
||||
/// You can also use `WINIT_WAYLAND_CSD_THEME` env variable to set the theme.
|
||||
/// Possible values for env variable are: "dark" and light".
|
||||
///
|
||||
/// When unspecified a theme is automatically selected.
|
||||
fn wayland_set_csd_theme(&self, config: Theme);
|
||||
}
|
||||
|
||||
impl WindowExtWayland for Window {
|
||||
|
|
@ -116,16 +108,6 @@ impl WindowExtWayland for Window {
|
|||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn wayland_set_csd_theme(&self, theme: Theme) {
|
||||
#[allow(clippy::single_match)]
|
||||
match self.window {
|
||||
LinuxWindow::Wayland(ref w) => w.set_csd_theme(theme),
|
||||
#[cfg(feature = "x11")]
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Additional methods on [`WindowBuilder`] that are specific to Wayland.
|
||||
|
|
|
|||
|
|
@ -190,9 +190,6 @@ pub trait WindowBuilderExtX11 {
|
|||
/// Build window with `_NET_WM_WINDOW_TYPE` hints; defaults to `Normal`. Only relevant on X11.
|
||||
fn with_x11_window_type(self, x11_window_type: Vec<XWindowType>) -> Self;
|
||||
|
||||
/// 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) -> Self;
|
||||
|
||||
/// Build window with base size hint. Only implemented on X11.
|
||||
///
|
||||
/// ```
|
||||
|
|
@ -248,12 +245,6 @@ impl WindowBuilderExtX11 for WindowBuilder {
|
|||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn with_gtk_theme_variant(mut self, variant: String) -> Self {
|
||||
self.platform_specific.gtk_theme_variant = Some(variant);
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn with_base_size<S: Into<Size>>(mut self, base_size: S) -> Self {
|
||||
self.platform_specific.base_size = Some(base_size.into());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue