Add X11-specific with_gtk_theme_variant option (#659)
This commit is contained in:
parent
1edbca1775
commit
bc03ffb317
4 changed files with 27 additions and 0 deletions
|
|
@ -45,6 +45,7 @@ pub struct PlatformSpecificWindowBuilderAttributes {
|
|||
pub class: Option<(String, String)>,
|
||||
pub override_redirect: bool,
|
||||
pub x11_window_type: x11::util::WindowType,
|
||||
pub gtk_theme_variant: Option<String>,
|
||||
}
|
||||
|
||||
lazy_static!(
|
||||
|
|
|
|||
|
|
@ -272,6 +272,10 @@ impl UnownedWindow {
|
|||
window.set_window_type(pl_attribs.x11_window_type).queue();
|
||||
}
|
||||
|
||||
if let Some(variant) = pl_attribs.gtk_theme_variant {
|
||||
window.set_gtk_theme_variant(variant).queue();
|
||||
}
|
||||
|
||||
// set size hints
|
||||
{
|
||||
let mut min_dimensions = window_attrs.min_dimensions;
|
||||
|
|
@ -457,6 +461,19 @@ impl UnownedWindow {
|
|||
)
|
||||
}
|
||||
|
||||
fn set_gtk_theme_variant(&self, variant: String) -> util::Flusher {
|
||||
let hint_atom = unsafe { self.xconn.get_atom_unchecked(b"_GTK_THEME_VARIANT\0") };
|
||||
let utf8_atom = unsafe { self.xconn.get_atom_unchecked(b"UTF8_STRING\0") };
|
||||
let variant = CString::new(variant).expect("`_GTK_THEME_VARIANT` contained null byte");
|
||||
self.xconn.change_property(
|
||||
self.xwindow,
|
||||
hint_atom,
|
||||
utf8_atom,
|
||||
util::PropMode::Replace,
|
||||
variant.as_bytes(),
|
||||
)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set_urgent(&self, is_urgent: bool) {
|
||||
let mut wm_hints = self.xconn.get_wm_hints(self.xwindow).expect("`XGetWMHints` failed");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue