shell: rename space_for_{window -> surface}

This commit is contained in:
Victoria Brekenfeld 2022-07-11 22:39:56 +02:00
parent 4de316cbce
commit 8ecc1345a6
6 changed files with 14 additions and 14 deletions

View file

@ -120,7 +120,7 @@ impl Shell {
) { ) {
// update FocusStack and notify layouts about new focus (if any window) // update FocusStack and notify layouts about new focus (if any window)
if let Some(surface) = surface { if let Some(surface) = surface {
if let Some(workspace) = self.space_for_surface_mut(surface) { if let Some(workspace) = self.space_for_window_mut(surface) {
if let Some(window) = workspace if let Some(window) = workspace
.space .space
.window_for_surface(surface, WindowSurfaceType::ALL) .window_for_surface(surface, WindowSurfaceType::ALL)

View file

@ -34,7 +34,7 @@ impl Shell {
) { ) {
// TODO touch grab // TODO touch grab
if let Some(pointer) = seat.get_pointer() { if let Some(pointer) = seat.get_pointer() {
let workspace = self.space_for_surface_mut(window.toplevel().wl_surface()).unwrap(); let workspace = self.space_for_window_mut(window.toplevel().wl_surface()).unwrap();
if workspace.fullscreen.values().any(|w| w == window) { if workspace.fullscreen.values().any(|w| w == window) {
return; return;
} }

View file

@ -458,7 +458,7 @@ impl Shell {
} }
} }
pub fn space_for_surface(&self, surface: &WlSurface) -> Option<&Workspace> { pub fn space_for_window(&self, surface: &WlSurface) -> Option<&Workspace> {
self.spaces.iter().find(|workspace| { self.spaces.iter().find(|workspace| {
workspace workspace
.space .space
@ -467,7 +467,7 @@ impl Shell {
}) })
} }
pub fn space_for_surface_mut(&mut self, surface: &WlSurface) -> Option<&mut Workspace> { pub fn space_for_window_mut(&mut self, surface: &WlSurface) -> Option<&mut Workspace> {
self.spaces.iter_mut().find(|workspace| { self.spaces.iter_mut().find(|workspace| {
workspace workspace
.space .space

View file

@ -162,7 +162,7 @@ impl CompositorHandler for State {
if let Some((space, window)) = if let Some((space, window)) =
self.common self.common
.shell .shell
.space_for_surface_mut(surface) .space_for_window_mut(surface)
.and_then(|workspace| { .and_then(|workspace| {
workspace workspace
.space .space

View file

@ -83,7 +83,7 @@ impl XdgShellHandler for State {
if let Some(window) = if let Some(window) =
self.common self.common
.shell .shell
.space_for_surface(&surface) .space_for_window(&surface)
.and_then(|workspace| { .and_then(|workspace| {
workspace workspace
.space .space
@ -173,7 +173,7 @@ impl XdgShellHandler for State {
let workspace = self let workspace = self
.common .common
.shell .shell
.space_for_surface_mut(surface.wl_surface()) .space_for_window_mut(surface.wl_surface())
.unwrap(); .unwrap();
let window = workspace let window = workspace
.space .space
@ -198,7 +198,7 @@ impl XdgShellHandler for State {
let workspace = self let workspace = self
.common .common
.shell .shell
.space_for_surface_mut(surface.wl_surface()) .space_for_window_mut(surface.wl_surface())
.unwrap(); .unwrap();
let window = workspace let window = workspace
.space .space
@ -215,7 +215,7 @@ impl XdgShellHandler for State {
let seat = &self.common.last_active_seat; let seat = &self.common.last_active_seat;
let output = active_output(seat, &self.common); let output = active_output(seat, &self.common);
if let Some(workspace) = self.common.shell.space_for_surface_mut(surface) { if let Some(workspace) = self.common.shell.space_for_window_mut(surface) {
let window = workspace let window = workspace
.space .space
.window_for_surface(surface, WindowSurfaceType::TOPLEVEL) .window_for_surface(surface, WindowSurfaceType::TOPLEVEL)
@ -228,7 +228,7 @@ impl XdgShellHandler for State {
fn unmaximize_request(&mut self, _dh: &DisplayHandle, surface: ToplevelSurface) { fn unmaximize_request(&mut self, _dh: &DisplayHandle, surface: ToplevelSurface) {
let surface = surface.wl_surface(); let surface = surface.wl_surface();
if let Some(workspace) = self.common.shell.space_for_surface_mut(surface) { if let Some(workspace) = self.common.shell.space_for_window_mut(surface) {
let window = workspace let window = workspace
.space .space
.window_for_surface(surface, WindowSurfaceType::TOPLEVEL) .window_for_surface(surface, WindowSurfaceType::TOPLEVEL)
@ -253,7 +253,7 @@ impl XdgShellHandler for State {
}); });
let surface = surface.wl_surface(); let surface = surface.wl_surface();
if let Some(workspace) = self.common.shell.space_for_surface_mut(surface) { if let Some(workspace) = self.common.shell.space_for_window_mut(surface) {
let window = workspace let window = workspace
.space .space
.window_for_surface(surface, WindowSurfaceType::TOPLEVEL) .window_for_surface(surface, WindowSurfaceType::TOPLEVEL)
@ -265,7 +265,7 @@ impl XdgShellHandler for State {
fn unfullscreen_request(&mut self, _dh: &DisplayHandle, surface: ToplevelSurface) { fn unfullscreen_request(&mut self, _dh: &DisplayHandle, surface: ToplevelSurface) {
let surface = surface.wl_surface(); let surface = surface.wl_surface();
if let Some(workspace) = self.common.shell.space_for_surface_mut(surface) { if let Some(workspace) = self.common.shell.space_for_window_mut(surface) {
let window = workspace let window = workspace
.space .space
.window_for_surface(surface, WindowSurfaceType::TOPLEVEL) .window_for_surface(surface, WindowSurfaceType::TOPLEVEL)

View file

@ -27,7 +27,7 @@ use std::sync::Mutex;
impl Shell { impl Shell {
pub fn unconstrain_popup(&self, surface: &PopupSurface, positioner: &PositionerState) { pub fn unconstrain_popup(&self, surface: &PopupSurface, positioner: &PositionerState) {
if let Some(parent) = get_popup_toplevel(&surface) { if let Some(parent) = get_popup_toplevel(&surface) {
if let Some(workspace) = self.space_for_surface(&parent) { if let Some(workspace) = self.space_for_window(&parent) {
let window = workspace let window = workspace
.space .space
.window_for_surface(&parent, WindowSurfaceType::ALL) .window_for_surface(&parent, WindowSurfaceType::ALL)
@ -44,7 +44,7 @@ impl Shell {
} }
pub fn update_reactive_popups(&self, window: &Window) { pub fn update_reactive_popups(&self, window: &Window) {
if let Some(workspace) = self.space_for_surface(window.toplevel().wl_surface()) { if let Some(workspace) = self.space_for_window(window.toplevel().wl_surface()) {
update_reactive_popups(&workspace.space, window); update_reactive_popups(&workspace.space, window);
} }
} }