shell: Handle maximize requests before commit
This commit is contained in:
parent
a3714b036e
commit
156f634944
5 changed files with 130 additions and 52 deletions
|
|
@ -277,11 +277,11 @@ impl State {
|
|||
fn send_initial_configure_and_map(&mut self, surface: &WlSurface) -> bool {
|
||||
let mut shell = self.common.shell.write().unwrap();
|
||||
|
||||
if let Some((window, _, _)) = shell
|
||||
if let Some(window) = shell
|
||||
.pending_windows
|
||||
.iter()
|
||||
.find(|(window, _, _)| window.wl_surface().as_deref() == Some(surface))
|
||||
.cloned()
|
||||
.find(|pending| pending.surface.wl_surface().as_deref() == Some(surface))
|
||||
.map(|pending| pending.surface.clone())
|
||||
{
|
||||
if let Some(toplevel) = window.0.toplevel() {
|
||||
if toplevel_ensure_initial_configure(&toplevel)
|
||||
|
|
@ -305,11 +305,11 @@ impl State {
|
|||
}
|
||||
}
|
||||
|
||||
if let Some((layer_surface, _, _)) = shell
|
||||
if let Some(layer_surface) = shell
|
||||
.pending_layers
|
||||
.iter()
|
||||
.find(|(layer_surface, _, _)| layer_surface.wl_surface() == surface)
|
||||
.cloned()
|
||||
.find(|pending| pending.surface.wl_surface() == surface)
|
||||
.map(|pending| pending.surface.clone())
|
||||
{
|
||||
if !layer_surface_check_inital_configure(&layer_surface) {
|
||||
// compute initial dimensions by mapping
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use crate::utils::prelude::*;
|
||||
use crate::{shell::PendingLayer, utils::prelude::*};
|
||||
use smithay::{
|
||||
delegate_layer_shell,
|
||||
desktop::{layer_map_for_output, LayerSurface, PopupKind, WindowSurfaceType},
|
||||
|
|
@ -32,9 +32,11 @@ impl WlrLayerShellHandler for State {
|
|||
.as_ref()
|
||||
.and_then(Output::from_resource)
|
||||
.unwrap_or_else(|| seat.active_output());
|
||||
shell
|
||||
.pending_layers
|
||||
.push((LayerSurface::new(surface, namespace), output, seat));
|
||||
shell.pending_layers.push(PendingLayer {
|
||||
surface: LayerSurface::new(surface, namespace),
|
||||
output,
|
||||
seat,
|
||||
});
|
||||
}
|
||||
|
||||
fn new_popup(&mut self, _parent: WlrLayerSurface, popup: PopupSurface) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use crate::{
|
||||
shell::{element::CosmicWindow, grabs::ReleaseMode, CosmicMapped, CosmicSurface, ManagedLayer},
|
||||
shell::{
|
||||
element::CosmicWindow, grabs::ReleaseMode, CosmicMapped, CosmicSurface, ManagedLayer,
|
||||
PendingWindow,
|
||||
},
|
||||
utils::prelude::*,
|
||||
wayland::protocols::toplevel_info::{toplevel_enter_output, toplevel_enter_workspace},
|
||||
};
|
||||
|
|
@ -45,7 +48,12 @@ impl XdgShellHandler for State {
|
|||
let mut shell = self.common.shell.write().unwrap();
|
||||
let seat = shell.seats.last_active().clone();
|
||||
let window = CosmicSurface::from(surface);
|
||||
shell.pending_windows.push((window, seat, None));
|
||||
shell.pending_windows.push(PendingWindow {
|
||||
surface: window,
|
||||
seat,
|
||||
fullscreen: None,
|
||||
maximized: false,
|
||||
});
|
||||
// We will position the window after the first commit, when we know its size hints
|
||||
}
|
||||
|
||||
|
|
@ -219,6 +227,12 @@ impl XdgShellHandler for State {
|
|||
if let Some(mapped) = shell.element_for_surface(surface.wl_surface()).cloned() {
|
||||
let seat = shell.seats.last_active().clone();
|
||||
shell.maximize_request(&mapped, &seat)
|
||||
} else if let Some(pending) = shell
|
||||
.pending_windows
|
||||
.iter_mut()
|
||||
.find(|pending| pending.surface.wl_surface().as_deref() == Some(surface.wl_surface()))
|
||||
{
|
||||
pending.maximized = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -226,6 +240,12 @@ impl XdgShellHandler for State {
|
|||
let mut shell = self.common.shell.write().unwrap();
|
||||
if let Some(mapped) = shell.element_for_surface(surface.wl_surface()).cloned() {
|
||||
shell.unmaximize_request(&mapped);
|
||||
} else if let Some(pending) = shell
|
||||
.pending_windows
|
||||
.iter_mut()
|
||||
.find(|pending| pending.surface.wl_surface().as_deref() == Some(surface.wl_surface()))
|
||||
{
|
||||
pending.maximized = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -339,15 +359,12 @@ impl XdgShellHandler for State {
|
|||
workspace.fullscreen_request(&window, None, from, &seat)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if let Some(o) = shell
|
||||
.pending_windows
|
||||
.iter_mut()
|
||||
.find(|(s, _, _)| s.wl_surface().as_deref() == Some(surface.wl_surface()))
|
||||
.map(|(_, _, o)| o)
|
||||
{
|
||||
*o = Some(output);
|
||||
}
|
||||
} else if let Some(pending) = shell
|
||||
.pending_windows
|
||||
.iter_mut()
|
||||
.find(|pending| pending.surface.wl_surface().as_deref() == Some(surface.wl_surface()))
|
||||
{
|
||||
pending.fullscreen = Some(output);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -376,6 +393,12 @@ impl XdgShellHandler for State {
|
|||
);
|
||||
}
|
||||
}
|
||||
} else if let Some(pending) = shell
|
||||
.pending_windows
|
||||
.iter_mut()
|
||||
.find(|pending| pending.surface.wl_surface().as_deref() == Some(surface.wl_surface()))
|
||||
{
|
||||
pending.fullscreen.take();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue