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,
|
compositor::with_states,
|
||||||
input_method::InputMethodSeat,
|
input_method::InputMethodSeat,
|
||||||
keyboard_shortcuts_inhibit::KeyboardShortcutsInhibitorSeat,
|
keyboard_shortcuts_inhibit::KeyboardShortcutsInhibitorSeat,
|
||||||
shell::{
|
shell::wlr_layer::{KeyboardInteractivity, Layer as WlrLayer, LayerSurfaceCachedState},
|
||||||
wlr_layer::{KeyboardInteractivity, Layer as WlrLayer, LayerSurfaceCachedState},
|
|
||||||
xdg::XdgToplevelSurfaceData,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -122,16 +119,8 @@ impl<BackendData: Backend> AnvilState<BackendData> {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let initial_configure_sent = with_states(toplevel.wl_surface(), |states| {
|
|
||||||
states
|
if mode_changed && toplevel.is_initial_configure_sent() {
|
||||||
.data_map
|
|
||||||
.get::<XdgToplevelSurfaceData>()
|
|
||||||
.unwrap()
|
|
||||||
.lock()
|
|
||||||
.unwrap()
|
|
||||||
.initial_configure_sent
|
|
||||||
});
|
|
||||||
if mode_changed && initial_configure_sent {
|
|
||||||
toplevel.send_pending_configure();
|
toplevel.send_pending_configure();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ use smithay::{
|
||||||
Layer, LayerSurface as WlrLayerSurface, LayerSurfaceData, WlrLayerShellHandler,
|
Layer, LayerSurface as WlrLayerSurface, LayerSurfaceData, WlrLayerShellHandler,
|
||||||
WlrLayerShellState,
|
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| {
|
if !popup.is_initial_configure_sent() {
|
||||||
states
|
|
||||||
.data_map
|
|
||||||
.get::<XdgPopupSurfaceData>()
|
|
||||||
.unwrap()
|
|
||||||
.lock()
|
|
||||||
.unwrap()
|
|
||||||
.initial_configure_sent
|
|
||||||
});
|
|
||||||
if !initial_configure_sent {
|
|
||||||
// NOTE: This should never fail as the initial configure is always
|
// NOTE: This should never fail as the initial configure is always
|
||||||
// allowed.
|
// allowed.
|
||||||
popup.send_configure().expect("initial configure failed");
|
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,
|
// The protocol demands us to always reply with a configure,
|
||||||
// regardless of we fulfilled the request or not
|
// 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) {
|
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,
|
// The protocol demands us to always reply with a configure,
|
||||||
// regardless of we fulfilled the request or not
|
// 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) {
|
fn unmaximize_request(&mut self, surface: ToplevelSurface) {
|
||||||
|
|
|
@ -75,7 +75,7 @@ use smithay::{
|
||||||
wlr_layer::WlrLayerShellState,
|
wlr_layer::WlrLayerShellState,
|
||||||
xdg::{
|
xdg::{
|
||||||
decoration::{XdgDecorationHandler, XdgDecorationState},
|
decoration::{XdgDecorationHandler, XdgDecorationState},
|
||||||
ToplevelSurface, XdgShellState, XdgToplevelSurfaceData,
|
ToplevelSurface, XdgShellState,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
shm::{ShmHandler, ShmState},
|
shm::{ShmHandler, ShmState},
|
||||||
|
@ -427,16 +427,7 @@ impl<BackendData: Backend> XdgDecorationHandler for AnvilState<BackendData> {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
let initial_configure_sent = with_states(toplevel.wl_surface(), |states| {
|
if toplevel.is_initial_configure_sent() {
|
||||||
states
|
|
||||||
.data_map
|
|
||||||
.get::<XdgToplevelSurfaceData>()
|
|
||||||
.unwrap()
|
|
||||||
.lock()
|
|
||||||
.unwrap()
|
|
||||||
.initial_configure_sent
|
|
||||||
});
|
|
||||||
if initial_configure_sent {
|
|
||||||
toplevel.send_pending_configure();
|
toplevel.send_pending_configure();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -445,16 +436,8 @@ impl<BackendData: Backend> XdgDecorationHandler for AnvilState<BackendData> {
|
||||||
toplevel.with_pending_state(|state| {
|
toplevel.with_pending_state(|state| {
|
||||||
state.decoration_mode = Some(Mode::ClientSide);
|
state.decoration_mode = Some(Mode::ClientSide);
|
||||||
});
|
});
|
||||||
let initial_configure_sent = with_states(toplevel.wl_surface(), |states| {
|
|
||||||
states
|
if toplevel.is_initial_configure_sent() {
|
||||||
.data_map
|
|
||||||
.get::<XdgToplevelSurfaceData>()
|
|
||||||
.unwrap()
|
|
||||||
.lock()
|
|
||||||
.unwrap()
|
|
||||||
.initial_configure_sent
|
|
||||||
});
|
|
||||||
if initial_configure_sent {
|
|
||||||
toplevel.send_pending_configure();
|
toplevel.send_pending_configure();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,8 @@ use smithay::{
|
||||||
wayland::{
|
wayland::{
|
||||||
compositor::with_states,
|
compositor::with_states,
|
||||||
shell::xdg::{
|
shell::xdg::{
|
||||||
PopupSurface, PositionerState, ToplevelSurface, XdgPopupSurfaceData, XdgShellHandler,
|
PopupSurface, PositionerState, ToplevelSurface, XdgShellHandler, XdgShellState,
|
||||||
XdgShellState, XdgToplevelSurfaceData,
|
XdgToplevelSurfaceData,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -177,16 +177,7 @@ pub fn handle_commit(popups: &mut PopupManager, space: &Space<Window>, surface:
|
||||||
if let Some(popup) = popups.find_popup(surface) {
|
if let Some(popup) = popups.find_popup(surface) {
|
||||||
match popup {
|
match popup {
|
||||||
PopupKind::Xdg(ref xdg) => {
|
PopupKind::Xdg(ref xdg) => {
|
||||||
let initial_configure_sent = with_states(surface, |states| {
|
if !xdg.is_initial_configure_sent() {
|
||||||
states
|
|
||||||
.data_map
|
|
||||||
.get::<XdgPopupSurfaceData>()
|
|
||||||
.unwrap()
|
|
||||||
.lock()
|
|
||||||
.unwrap()
|
|
||||||
.initial_configure_sent
|
|
||||||
});
|
|
||||||
if !initial_configure_sent {
|
|
||||||
// NOTE: This should never fail as the initial configure is always
|
// NOTE: This should never fail as the initial configure is always
|
||||||
// allowed.
|
// allowed.
|
||||||
xdg.send_configure().expect("initial configure failed");
|
xdg.send_configure().expect("initial configure failed");
|
||||||
|
|
|
@ -1526,6 +1526,22 @@ impl ToplevelSurface {
|
||||||
serial
|
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
|
/// Handles the role specific commit logic
|
||||||
///
|
///
|
||||||
/// This should be called when the underlying WlSurface
|
/// This should be called when the underlying WlSurface
|
||||||
|
@ -1842,6 +1858,22 @@ impl PopupSurface {
|
||||||
Ok(serial)
|
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
|
/// Send a configure event, including the `repositioned` event to the client
|
||||||
/// in response to a `reposition` request.
|
/// in response to a `reposition` request.
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in a new issue