server: Unmap popup on popup_done event
Seems some applications don't expect their popups to be unmapped without their consent, so they make act strangely, but at least it doesn't crash. Fixes #117
This commit is contained in:
parent
10cb041a80
commit
54a7ad9e13
6 changed files with 91 additions and 2 deletions
|
|
@ -29,6 +29,7 @@ pub trait XConnection: Sized + 'static {
|
|||
data: Self::ExtraData,
|
||||
);
|
||||
fn close_window(&mut self, window: x::Window, data: Self::ExtraData);
|
||||
fn unmap_window(&mut self, window: x::Window);
|
||||
fn raise_to_top(&mut self, window: x::Window);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ impl SurfaceData {
|
|||
}
|
||||
}
|
||||
|
||||
fn popup_event<C: XConnection>(&mut self, event: xdg_popup::Event, _: &mut ServerState<C>) {
|
||||
fn popup_event<C: XConnection>(&mut self, event: xdg_popup::Event, state: &mut ServerState<C>) {
|
||||
match event {
|
||||
xdg_popup::Event::Configure {
|
||||
x,
|
||||
|
|
@ -273,6 +273,13 @@ impl SurfaceData {
|
|||
});
|
||||
}
|
||||
xdg_popup::Event::Repositioned { .. } => {}
|
||||
xdg_popup::Event::PopupDone => {
|
||||
state
|
||||
.connection
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.unmap_window(self.window.unwrap());
|
||||
}
|
||||
other => todo!("{other:?}"),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -247,6 +247,10 @@ impl super::XConnection for FakeXConnection {
|
|||
"Unknown window: {window:?}"
|
||||
);
|
||||
}
|
||||
|
||||
fn unmap_window(&mut self, _: x::Window) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
type FakeServerState = ServerState<FakeXConnection>;
|
||||
|
|
|
|||
|
|
@ -1024,6 +1024,12 @@ impl XConnection for RealConnection {
|
|||
}
|
||||
}
|
||||
|
||||
fn unmap_window(&mut self, window: x::Window) {
|
||||
unwrap_or_skip_bad_window!(self
|
||||
.connection
|
||||
.send_and_check_request(&x::UnmapWindow { window }));
|
||||
}
|
||||
|
||||
fn raise_to_top(&mut self, window: x::Window) {
|
||||
unwrap_or_skip_bad_window!(self.connection.send_and_check_request(&x::ConfigureWindow {
|
||||
window,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue