mirror of
https://github.com/Smithay/smithay.git
synced 2024-09-28 03:21:14 +02:00
xdg-shell: is_initial_configure_sent
getter
This commit is contained in:
parent
fa62df741d
commit
2c0076e06f
6 changed files with 54 additions and 60 deletions
|
@ -27,10 +27,7 @@ use smithay::{
|
|||
compositor::with_states,
|
||||
input_method::InputMethodSeat,
|
||||
keyboard_shortcuts_inhibit::KeyboardShortcutsInhibitorSeat,
|
||||
shell::{
|
||||
wlr_layer::{KeyboardInteractivity, Layer as WlrLayer, LayerSurfaceCachedState},
|
||||
xdg::XdgToplevelSurfaceData,
|
||||
},
|
||||
shell::wlr_layer::{KeyboardInteractivity, Layer as WlrLayer, LayerSurfaceCachedState},
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -122,16 +119,8 @@ impl<BackendData: Backend> AnvilState<BackendData> {
|
|||
false
|
||||
}
|
||||
});
|
||||
let initial_configure_sent = with_states(toplevel.wl_surface(), |states| {
|
||||
states
|
||||
.data_map
|
||||
.get::<XdgToplevelSurfaceData>()
|
||||
.unwrap()
|
||||
.lock()
|
||||
.unwrap()
|
||||
.initial_configure_sent
|
||||
});
|
||||
if mode_changed && initial_configure_sent {
|
||||
|
||||
if mode_changed && toplevel.is_initial_configure_sent() {
|
||||
toplevel.send_pending_configure();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ use smithay::{
|
|||
Layer, LayerSurface as WlrLayerSurface, LayerSurfaceData, WlrLayerShellHandler,
|
||||
WlrLayerShellState,
|
||||
},
|
||||
xdg::{XdgPopupSurfaceData, XdgToplevelSurfaceData},
|
||||
xdg::XdgToplevelSurfaceData,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -322,16 +322,7 @@ fn ensure_initial_configure(surface: &WlSurface, space: &Space<WindowElement>, p
|
|||
}
|
||||
};
|
||||
|
||||
let initial_configure_sent = with_states(surface, |states| {
|
||||
states
|
||||
.data_map
|
||||
.get::<XdgPopupSurfaceData>()
|
||||
.unwrap()
|
||||
.lock()
|
||||
.unwrap()
|
||||
.initial_configure_sent
|
||||
});
|
||||
if !initial_configure_sent {
|
||||
if !popup.is_initial_configure_sent() {
|
||||
// NOTE: This should never fail as the initial configure is always
|
||||
// allowed.
|
||||
popup.send_configure().expect("initial configure failed");
|
||||
|
|
|
@ -311,7 +311,11 @@ impl<BackendData: Backend> XdgShellHandler for AnvilState<BackendData> {
|
|||
|
||||
// The protocol demands us to always reply with a configure,
|
||||
// regardless of we fulfilled the request or not
|
||||
surface.send_configure();
|
||||
if surface.is_initial_configure_sent() {
|
||||
surface.send_configure();
|
||||
} else {
|
||||
// Will be sent during initial configure
|
||||
}
|
||||
}
|
||||
|
||||
fn unfullscreen_request(&mut self, surface: ToplevelSurface) {
|
||||
|
@ -367,7 +371,11 @@ impl<BackendData: Backend> XdgShellHandler for AnvilState<BackendData> {
|
|||
|
||||
// The protocol demands us to always reply with a configure,
|
||||
// regardless of we fulfilled the request or not
|
||||
surface.send_configure();
|
||||
if surface.is_initial_configure_sent() {
|
||||
surface.send_configure();
|
||||
} else {
|
||||
// Will be sent during initial configure
|
||||
}
|
||||
}
|
||||
|
||||
fn unmaximize_request(&mut self, surface: ToplevelSurface) {
|
||||
|
|
|
@ -75,7 +75,7 @@ use smithay::{
|
|||
wlr_layer::WlrLayerShellState,
|
||||
xdg::{
|
||||
decoration::{XdgDecorationHandler, XdgDecorationState},
|
||||
ToplevelSurface, XdgShellState, XdgToplevelSurfaceData,
|
||||
ToplevelSurface, XdgShellState,
|
||||
},
|
||||
},
|
||||
shm::{ShmHandler, ShmState},
|
||||
|
@ -427,16 +427,7 @@ impl<BackendData: Backend> XdgDecorationHandler for AnvilState<BackendData> {
|
|||
});
|
||||
});
|
||||
|
||||
let initial_configure_sent = with_states(toplevel.wl_surface(), |states| {
|
||||
states
|
||||
.data_map
|
||||
.get::<XdgToplevelSurfaceData>()
|
||||
.unwrap()
|
||||
.lock()
|
||||
.unwrap()
|
||||
.initial_configure_sent
|
||||
});
|
||||
if initial_configure_sent {
|
||||
if toplevel.is_initial_configure_sent() {
|
||||
toplevel.send_pending_configure();
|
||||
}
|
||||
}
|
||||
|
@ -445,16 +436,8 @@ impl<BackendData: Backend> XdgDecorationHandler for AnvilState<BackendData> {
|
|||
toplevel.with_pending_state(|state| {
|
||||
state.decoration_mode = Some(Mode::ClientSide);
|
||||
});
|
||||
let initial_configure_sent = with_states(toplevel.wl_surface(), |states| {
|
||||
states
|
||||
.data_map
|
||||
.get::<XdgToplevelSurfaceData>()
|
||||
.unwrap()
|
||||
.lock()
|
||||
.unwrap()
|
||||
.initial_configure_sent
|
||||
});
|
||||
if initial_configure_sent {
|
||||
|
||||
if toplevel.is_initial_configure_sent() {
|
||||
toplevel.send_pending_configure();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ use smithay::{
|
|||
wayland::{
|
||||
compositor::with_states,
|
||||
shell::xdg::{
|
||||
PopupSurface, PositionerState, ToplevelSurface, XdgPopupSurfaceData, XdgShellHandler,
|
||||
XdgShellState, XdgToplevelSurfaceData,
|
||||
PopupSurface, PositionerState, ToplevelSurface, XdgShellHandler, XdgShellState,
|
||||
XdgToplevelSurfaceData,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -177,16 +177,7 @@ pub fn handle_commit(popups: &mut PopupManager, space: &Space<Window>, surface:
|
|||
if let Some(popup) = popups.find_popup(surface) {
|
||||
match popup {
|
||||
PopupKind::Xdg(ref xdg) => {
|
||||
let initial_configure_sent = with_states(surface, |states| {
|
||||
states
|
||||
.data_map
|
||||
.get::<XdgPopupSurfaceData>()
|
||||
.unwrap()
|
||||
.lock()
|
||||
.unwrap()
|
||||
.initial_configure_sent
|
||||
});
|
||||
if !initial_configure_sent {
|
||||
if !xdg.is_initial_configure_sent() {
|
||||
// NOTE: This should never fail as the initial configure is always
|
||||
// allowed.
|
||||
xdg.send_configure().expect("initial configure failed");
|
||||
|
|
|
@ -1526,6 +1526,22 @@ impl ToplevelSurface {
|
|||
serial
|
||||
}
|
||||
|
||||
/// Did the surface sent the initial
|
||||
/// configure event to the client.
|
||||
///
|
||||
/// Calls [`compositor::with_states`] internally.
|
||||
pub fn is_initial_configure_sent(&self) -> bool {
|
||||
compositor::with_states(&self.wl_surface, |states| {
|
||||
states
|
||||
.data_map
|
||||
.get::<XdgToplevelSurfaceData>()
|
||||
.unwrap()
|
||||
.lock()
|
||||
.unwrap()
|
||||
.initial_configure_sent
|
||||
})
|
||||
}
|
||||
|
||||
/// Handles the role specific commit logic
|
||||
///
|
||||
/// This should be called when the underlying WlSurface
|
||||
|
@ -1842,6 +1858,22 @@ impl PopupSurface {
|
|||
Ok(serial)
|
||||
}
|
||||
|
||||
/// Did the surface sent the initial
|
||||
/// configure event to the client.
|
||||
///
|
||||
/// Calls [`compositor::with_states`] internally.
|
||||
pub fn is_initial_configure_sent(&self) -> bool {
|
||||
compositor::with_states(&self.wl_surface, |states| {
|
||||
states
|
||||
.data_map
|
||||
.get::<XdgPopupSurfaceData>()
|
||||
.unwrap()
|
||||
.lock()
|
||||
.unwrap()
|
||||
.initial_configure_sent
|
||||
})
|
||||
}
|
||||
|
||||
/// Send a configure event, including the `repositioned` event to the client
|
||||
/// in response to a `reposition` request.
|
||||
///
|
||||
|
|
Loading…
Reference in a new issue