remove x11rb as dependency
This commit is contained in:
parent
cc577b1367
commit
6ed9fdc9cd
6 changed files with 12 additions and 91 deletions
|
|
@ -1,10 +1,7 @@
|
|||
use std::rc::Rc;
|
||||
|
||||
use crate::app_grid::AppGrid;
|
||||
use crate::group_grid::GroupGrid;
|
||||
use cascade::cascade;
|
||||
use gdk4_x11::X11Display;
|
||||
use gdk4_x11::X11Surface;
|
||||
use glib::Object;
|
||||
use gtk4::prelude::*;
|
||||
use gtk4::subclass::prelude::*;
|
||||
|
|
@ -17,9 +14,6 @@ use gtk4::SearchEntry;
|
|||
use gtk4::Separator;
|
||||
use gtk4::{gio, glib};
|
||||
use libcosmic::x;
|
||||
use once_cell::sync::OnceCell;
|
||||
use x11rb::connection::Connection;
|
||||
use x11rb::protocol::xproto::*;
|
||||
|
||||
mod imp;
|
||||
|
||||
|
|
@ -147,10 +141,6 @@ impl AppLibraryWindow {
|
|||
|
||||
window.connect_realize(move |window| {
|
||||
if let Some((display, surface)) = x::get_window_x11(window) {
|
||||
let (conn, _screen_num) = x11rb::connect(None).expect("Failed to connect to X");
|
||||
let x11rb_conn = Rc::new(OnceCell::new());
|
||||
x11rb_conn.set(conn).unwrap();
|
||||
|
||||
// ignore all x11 errors...
|
||||
let xdisplay = display
|
||||
.clone()
|
||||
|
|
@ -166,8 +156,7 @@ impl AppLibraryWindow {
|
|||
&[x::Atom::new(&display, "_NET_WM_WINDOW_TYPE_DIALOG").unwrap()],
|
||||
);
|
||||
}
|
||||
let resize = glib::clone!(@weak window, @strong x11rb_conn => move || {
|
||||
let s = window.surface();
|
||||
let resize = glib::clone!(@weak window => move || {
|
||||
let height = window.height();
|
||||
let width = window.width();
|
||||
|
||||
|
|
@ -182,21 +171,9 @@ impl AppLibraryWindow {
|
|||
// dbg!(monitor_height);
|
||||
// dbg!(width);
|
||||
// dbg!(height);
|
||||
let w_conf = ConfigureWindowAux::default()
|
||||
.x(monitor_x + monitor_width / 2 - width / 2)
|
||||
.y(monitor_y + monitor_height / 2 - height / 2);
|
||||
|
||||
let x11surface = gdk4_x11::X11Surface::xid(
|
||||
&s.clone().downcast::<X11Surface>()
|
||||
.expect("Failed to downcast Surface to X11Surface"),
|
||||
);
|
||||
let conn = x11rb_conn.get().unwrap();
|
||||
conn.configure_window(
|
||||
x11surface.try_into().expect("Failed to convert XID"),
|
||||
&w_conf,
|
||||
)
|
||||
.expect("failed to configure window...");
|
||||
conn.flush().expect("failed to flush");
|
||||
unsafe { x::set_position(&display, &surface,
|
||||
monitor_x + monitor_width / 2 - width / 2,
|
||||
monitor_y + monitor_height / 2 - height / 2)};
|
||||
}
|
||||
});
|
||||
let s = window.surface();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue