diff --git a/src/window.rs b/src/window.rs index 35c97e43..dca95229 100644 --- a/src/window.rs +++ b/src/window.rs @@ -58,7 +58,7 @@ impl WidgetImpl for PanelWindowInner { fn show(&self, obj: &PanelWindow) { self.parent_show(obj); - if let Some((display, surface)) = x::get_window_x11(&obj.upcast_ref()) { + if let Some((display, surface)) = x::get_window_x11(obj) { unsafe { surface.set_skip_pager_hint(true); surface.set_skip_taskbar_hint(true); @@ -127,7 +127,7 @@ impl PanelWindow { return; }; - if let Some((display, surface)) = x::get_window_x11(self.upcast_ref()) { + if let Some((display, surface)) = x::get_window_x11(self) { let top_start_x = geometry.x as x::c_ulong; let top_end_x = top_start_x + geometry.width as x::c_ulong - 1; diff --git a/src/x.rs b/src/x.rs index 41c51315..774386a3 100644 --- a/src/x.rs +++ b/src/x.rs @@ -10,10 +10,14 @@ use std::{ pub use std::os::raw::{c_uchar, c_ulong, c_ushort}; -pub fn get_window_x11( - window: >k4::Window, +pub fn get_window_x11>( + window: &T, ) -> Option<(gdk4_x11::X11Display, gdk4_x11::X11Surface)> { - let surface = window.surface()?.downcast::().ok()?; + let surface = window + .upcast_ref() + .surface()? + .downcast::() + .ok()?; let display = surface.display()?.downcast::().ok()?; Some((display, surface)) }