fix: gdk layout crash
This commit is contained in:
parent
fb95442a0b
commit
253b0a518e
1 changed files with 37 additions and 41 deletions
|
|
@ -213,7 +213,7 @@ impl Window {
|
||||||
let resize = glib::clone!(@weak window => move || {
|
let resize = glib::clone!(@weak window => move || {
|
||||||
let s = window.surface().expect("Failed to get Surface for Window");
|
let s = window.surface().expect("Failed to get Surface for Window");
|
||||||
revealer.set_reveal_child(true);
|
revealer.set_reveal_child(true);
|
||||||
let height = s.height() * s.scale_factor();
|
let height = window.height();
|
||||||
|
|
||||||
if let Some((display, _surface)) = x::get_window_x11(&window) {
|
if let Some((display, _surface)) = x::get_window_x11(&window) {
|
||||||
let monitor = display
|
let monitor = display
|
||||||
|
|
@ -228,7 +228,7 @@ impl Window {
|
||||||
// dbg!(monitor_width);
|
// dbg!(monitor_width);
|
||||||
// dbg!(monitor_height);
|
// dbg!(monitor_height);
|
||||||
// dbg!(width);
|
// dbg!(width);
|
||||||
// dbg!(height);
|
dbg!(height);
|
||||||
let w_conf = xproto::ConfigureWindowAux::default()
|
let w_conf = xproto::ConfigureWindowAux::default()
|
||||||
.y((monitor_y + monitor_height - height).clamp(0, monitor_y + monitor_height - 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 conn = X11_CONN.get().expect("Failed to get X11_CONN");
|
||||||
|
|
@ -242,9 +242,8 @@ impl Window {
|
||||||
&w_conf,
|
&w_conf,
|
||||||
)
|
)
|
||||||
.expect("failed to configure window...");
|
.expect("failed to configure window...");
|
||||||
conn.flush().expect("failed to flush");let frame_clock = s.frame_clock().unwrap();
|
conn.flush().expect("failed to flush");
|
||||||
frame_clock.request_phase(gdk4::FrameClockPhase::FLUSH_EVENTS); } else {
|
s.request_layout();
|
||||||
println!("failed to get X11 window");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
glib::source::idle_add_local_once(resize);
|
glib::source::idle_add_local_once(resize);
|
||||||
|
|
@ -270,7 +269,7 @@ impl Window {
|
||||||
// dbg!(monitor_width);
|
// dbg!(monitor_width);
|
||||||
// dbg!(monitor_height);
|
// dbg!(monitor_height);
|
||||||
// dbg!(width);
|
// dbg!(width);
|
||||||
// dbg!(height);
|
dbg!(height);
|
||||||
let w_conf = xproto::ConfigureWindowAux::default()
|
let w_conf = xproto::ConfigureWindowAux::default()
|
||||||
.y((monitor_y + monitor_height - height).clamp(0, monitor_y + monitor_height - 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 conn = X11_CONN.get().expect("Failed to get X11_CONN");
|
||||||
|
|
@ -285,9 +284,7 @@ impl Window {
|
||||||
)
|
)
|
||||||
.expect("failed to configure window...");
|
.expect("failed to configure window...");
|
||||||
conn.flush().expect("failed to flush");
|
conn.flush().expect("failed to flush");
|
||||||
s.queue_render();
|
s.request_layout();
|
||||||
let frame_clock = s.frame_clock().unwrap();
|
|
||||||
frame_clock.request_phase(gdk4::FrameClockPhase::FLUSH_EVENTS);
|
|
||||||
} else {
|
} else {
|
||||||
println!("failed to get X11 window");
|
println!("failed to get X11 window");
|
||||||
}
|
}
|
||||||
|
|
@ -300,7 +297,7 @@ impl Window {
|
||||||
let surface_resize_handler = glib::clone!(@weak window => move |s: &Surface| {
|
let surface_resize_handler = glib::clone!(@weak window => move |s: &Surface| {
|
||||||
let resize = glib::clone!(@weak s => move || {
|
let resize = glib::clone!(@weak s => move || {
|
||||||
if let Some((display, _surface)) = x::get_window_x11(&window) {
|
if let Some((display, _surface)) = x::get_window_x11(&window) {
|
||||||
let width = s.width() * s.scale_factor();
|
let width = window.width();
|
||||||
// let height = s.height() * s.scale_factor();
|
// let height = s.height() * s.scale_factor();
|
||||||
// hide by default
|
// hide by default
|
||||||
let height = 4;
|
let height = 4;
|
||||||
|
|
@ -332,8 +329,7 @@ impl Window {
|
||||||
)
|
)
|
||||||
.expect("failed to configure window...");
|
.expect("failed to configure window...");
|
||||||
conn.flush().expect("failed to flush");
|
conn.flush().expect("failed to flush");
|
||||||
let frame_clock = s.frame_clock().unwrap();
|
s.request_layout();
|
||||||
frame_clock.request_phase(gdk4::FrameClockPhase::FLUSH_EVENTS);
|
|
||||||
} else {
|
} else {
|
||||||
println!("failed to get X11 window");
|
println!("failed to get X11 window");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue