remove x11rb as dependency

This commit is contained in:
Ashley Wulber 2022-01-19 13:56:20 -05:00
parent cc577b1367
commit 6ed9fdc9cd
6 changed files with 12 additions and 91 deletions

View file

@ -1,6 +1,5 @@
use cascade::cascade;
use gdk4_x11::X11Display;
use gdk4_x11::X11Surface;
use glib::Object;
use glib::Type;
use gtk4::prelude::*;
@ -15,15 +14,11 @@ use gtk4::Revealer;
use gtk4::RevealerTransitionType;
use gtk4::Separator;
use gtk4::{gio, glib};
use x11rb::connection::Connection;
use x11rb::protocol::xproto;
use x11rb::protocol::xproto::ConnectionExt;
use libcosmic::x;
use crate::dock_list::DockList;
use crate::dock_list::DockListType;
use crate::X11_CONN;
mod imp;
@ -139,7 +134,6 @@ impl Window {
);
}
let resize = glib::clone!(@weak window, @weak revealer => move || {
let s = window.surface();
let height = if revealer.reveals_child() { window.height() } else { 4 };
let width = window.width();
@ -156,23 +150,9 @@ impl Window {
// dbg!(monitor_height);
// dbg!(width);
// dbg!(height);
let w_conf = xproto::ConfigureWindowAux::default()
.x((monitor_x + monitor_width / 2 - width / 2).clamp(0, monitor_x + monitor_width - 1))
.y((monitor_y + monitor_height - height).clamp(0, monitor_y + monitor_height - 1));
let conn = X11_CONN.get().expect("Failed to get X11_CONN");
let x11surface = gdk4_x11::X11Surface::xid(
&s.clone().downcast::<X11Surface>()
.expect("Failed to downcast Surface to X11Surface"),
);
conn.configure_window(
x11surface.try_into().expect("Failed to convert XID"),
&w_conf,
)
.expect("failed to configure window...");
conn.flush().expect("failed to flush");
// fix (dock:294469): Gdk-CRITICAL **: 19:19:25.652: gdk_surface_request_layout: assertion 'frame_clock' failed
s.request_layout();
unsafe { x::set_position(&display, &surface,
(monitor_x + monitor_width / 2 - width / 2).clamp(0, monitor_x + monitor_width - 1),
(monitor_y + monitor_height - height).clamp(0, monitor_y + monitor_height - 1));}
}
});