Map window if pending state isn't different

This commit is contained in:
Ottatop 2023-09-04 02:12:42 -05:00
parent 088a1f7fac
commit 8a75769ca3
2 changed files with 13 additions and 18 deletions

View file

@ -1,11 +1,8 @@
use std::time::Duration;
use smithay::{
delegate_xdg_shell,
desktop::{
find_popup_root_surface, layer_map_for_output, utils::surface_primary_scanout_output,
PopupKeyboardGrab, PopupKind, PopupPointerGrab, PopupUngrabStrategy, Window,
WindowSurfaceType,
find_popup_root_surface, layer_map_for_output, PopupKeyboardGrab, PopupKind,
PopupPointerGrab, PopupUngrabStrategy, Window, WindowSurfaceType,
},
input::{pointer::Focus, Seat},
output::Output,
@ -287,16 +284,6 @@ impl XdgShellHandler for State {
// tracing::debug!("acked configure, new loc is {:?}", new_loc);
state.loc_request_state =
LocationRequestState::Acknowledged(new_loc);
if let Some(focused_output) =
self.focus_state.focused_output.clone()
{
window.send_frame(
&focused_output,
self.clock.now(),
Some(Duration::ZERO),
surface_primary_scanout_output,
);
}
}
}
Configure::Popup(_) => todo!(),

View file

@ -114,9 +114,17 @@ impl State {
window.with_state(|state| {
if let LocationRequestState::Sent(loc) = state.loc_request_state {
match &window {
WindowElement::Wayland(window) => {
let serial = window.toplevel().send_configure();
state.loc_request_state = LocationRequestState::Requested(serial, loc);
WindowElement::Wayland(win) => {
// If the above didn't cause any change to size or other state, simply
// map the window.
if !win.toplevel().has_pending_changes() {
state.loc_request_state = LocationRequestState::Idle;
self.space.map_element(window.clone(), loc, false);
} else {
let serial = win.toplevel().send_configure();
state.loc_request_state =
LocationRequestState::Requested(serial, loc);
}
}
WindowElement::X11(surface) => {
// already configured, just need to map