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::{ use smithay::{
delegate_xdg_shell, delegate_xdg_shell,
desktop::{ desktop::{
find_popup_root_surface, layer_map_for_output, utils::surface_primary_scanout_output, find_popup_root_surface, layer_map_for_output, PopupKeyboardGrab, PopupKind,
PopupKeyboardGrab, PopupKind, PopupPointerGrab, PopupUngrabStrategy, Window, PopupPointerGrab, PopupUngrabStrategy, Window, WindowSurfaceType,
WindowSurfaceType,
}, },
input::{pointer::Focus, Seat}, input::{pointer::Focus, Seat},
output::Output, output::Output,
@ -287,16 +284,6 @@ impl XdgShellHandler for State {
// tracing::debug!("acked configure, new loc is {:?}", new_loc); // tracing::debug!("acked configure, new loc is {:?}", new_loc);
state.loc_request_state = state.loc_request_state =
LocationRequestState::Acknowledged(new_loc); 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!(), Configure::Popup(_) => todo!(),

View file

@ -114,9 +114,17 @@ impl State {
window.with_state(|state| { window.with_state(|state| {
if let LocationRequestState::Sent(loc) = state.loc_request_state { if let LocationRequestState::Sent(loc) = state.loc_request_state {
match &window { match &window {
WindowElement::Wayland(window) => { WindowElement::Wayland(win) => {
let serial = window.toplevel().send_configure(); // If the above didn't cause any change to size or other state, simply
state.loc_request_state = LocationRequestState::Requested(serial, loc); // 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) => { WindowElement::X11(surface) => {
// already configured, just need to map // already configured, just need to map