deps: Update smithay

Fixes misbehaving floating windows
This commit is contained in:
Victoria Brekenfeld 2022-07-07 19:45:04 +02:00
parent 397ddaab1e
commit 1fb49824f9
10 changed files with 87 additions and 23 deletions

45
Cargo.lock generated
View file

@ -44,6 +44,15 @@ dependencies = [
"version_check", "version_check",
] ]
[[package]]
name = "aho-corasick"
version = "0.7.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
dependencies = [
"memchr",
]
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.58" version = "1.0.58"
@ -329,7 +338,9 @@ dependencies = [
"indexmap", "indexmap",
"lazy_static", "lazy_static",
"libsystemd", "libsystemd",
"regex",
"ron", "ron",
"sendfd",
"serde", "serde",
"serde_json", "serde_json",
"slog", "slog",
@ -1145,9 +1156,9 @@ dependencies = [
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.12.1" version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac8b1a9b2518dc799a2271eff1688707eb315f0d4697aa6b0871369ca4c4da55" checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1"
[[package]] [[package]]
name = "owned_ttf_parser" name = "owned_ttf_parser"
@ -1311,6 +1322,23 @@ dependencies = [
"thiserror", "thiserror",
] ]
[[package]]
name = "regex"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.6.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
[[package]] [[package]]
name = "remove_dir_all" name = "remove_dir_all"
version = "0.5.3" version = "0.5.3"
@ -1367,6 +1395,15 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "sendfd"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "604b71b8fc267e13bb3023a2c901126c8f349393666a6d98ac1ae5729b701798"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.138" version = "1.0.138"
@ -1480,7 +1517,7 @@ checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1"
[[package]] [[package]]
name = "smithay" name = "smithay"
version = "0.3.0" version = "0.3.0"
source = "git+https://github.com/Smithay/smithay.git?rev=11d48a76#11d48a76082a1efddb7dbfeef2aa1d7c13f8f67d" source = "git+https://github.com/pop-os/smithay?branch=main#bb4bdc613ff91e06b2205d4021d8c2003e9ef660"
dependencies = [ dependencies = [
"appendlist", "appendlist",
"bitflags", "bitflags",
@ -1540,7 +1577,7 @@ dependencies = [
[[package]] [[package]]
name = "smithay-egui" name = "smithay-egui"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/Smithay/smithay-egui.git?rev=1969c96d#1969c96d21743134bb11eadde4866245ae7c0478" source = "git+https://github.com/Smithay/smithay-egui.git?rev=9bba86a7#9bba86a743b8bc1c30f236d2407525fde8bcad50"
dependencies = [ dependencies = [
"cgmath", "cgmath",
"egui", "egui",

View file

@ -36,13 +36,13 @@ cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", branch
[dependencies.smithay] [dependencies.smithay]
version = "0.3" version = "0.3"
git = "https://github.com/Smithay/smithay.git" git = "https://github.com/Smithay/smithay.git"
rev = "11d48a76" rev = "e9599b80"
default-features = false default-features = false
features = ["backend_drm", "backend_gbm", "backend_egl", "backend_libinput", "backend_session_libseat", "backend_udev", "backend_winit", "backend_x11", "desktop", "use_system_lib", "renderer_gl", "renderer_multi", "wayland_frontend", "slog-stdlog"] features = ["backend_drm", "backend_gbm", "backend_egl", "backend_libinput", "backend_session_libseat", "backend_udev", "backend_winit", "backend_x11", "desktop", "use_system_lib", "renderer_gl", "renderer_multi", "wayland_frontend", "slog-stdlog"]
[dependencies.smithay-egui] [dependencies.smithay-egui]
git = "https://github.com/Smithay/smithay-egui.git" git = "https://github.com/Smithay/smithay-egui.git"
rev = "1969c96d" rev = "9bba86a7"
optional = true optional = true
[features] [features]
@ -60,5 +60,5 @@ debug = true
[profile.release] [profile.release]
lto = "fat" lto = "fat"
#[patch."https://github.com/Smithay/smithay.git"] [patch."https://github.com/Smithay/smithay.git"]
#smithay = { git = "https://github.com/pop-os/smithay", branch = "main" } smithay = { git = "https://github.com/pop-os/smithay", branch = "main" }

View file

@ -215,6 +215,13 @@ where
} }
} }
fn opaque_regions(
&self,
_scale: impl Into<Scale<f64>>,
) -> Option<Vec<Rectangle<i32, Physical>>> {
None
}
fn draw( fn draw(
&self, &self,
_renderer: &mut R, _renderer: &mut R,

View file

@ -70,6 +70,13 @@ impl RenderElement<GlMultiRenderer<'_>> for CustomElem {
RenderElement::<Gles2Renderer>::accumulated_damage(self, scale, for_values) RenderElement::<Gles2Renderer>::accumulated_damage(self, scale, for_values)
} }
fn opaque_regions(
&self,
scale: impl Into<Scale<f64>>,
) -> Option<Vec<Rectangle<i32, Physical>>> {
RenderElement::<Gles2Renderer>::opaque_regions(self, scale)
}
fn draw( fn draw(
&self, &self,
renderer: &mut GlMultiRenderer<'_>, renderer: &mut GlMultiRenderer<'_>,

View file

@ -44,7 +44,9 @@ impl PointerGrab<State> for MoveSurfaceGrab {
.space_for_surface_mut(self.window.toplevel().wl_surface()) .space_for_surface_mut(self.window.toplevel().wl_surface())
{ {
let new_location = (self.initial_window_location.to_f64() + self.delta).to_i32_round(); let new_location = (self.initial_window_location.to_f64() + self.delta).to_i32_round();
workspace.space.map_window(&self.window, new_location, true); workspace
.space
.map_window(&self.window, new_location, super::FLOATING_INDEX, true);
} }
} }

View file

@ -9,7 +9,7 @@ use smithay::{
wayland::{ wayland::{
compositor::with_states, compositor::with_states,
output::Output, output::Output,
seat::{PointerGrabStartData, Seat}, seat::{Focus, PointerGrabStartData, Seat},
shell::xdg::XdgToplevelSurfaceRoleAttributes, shell::xdg::XdgToplevelSurfaceRoleAttributes,
Serial, Serial,
}, },
@ -21,6 +21,8 @@ use crate::state::State;
mod grabs; mod grabs;
pub use self::grabs::*; pub use self::grabs::*;
pub const FLOATING_INDEX: u8 = RenderZindex::Shell as u8 + 1;
#[derive(Debug, Default)] #[derive(Debug, Default)]
pub struct FloatingLayout { pub struct FloatingLayout {
pending_windows: Vec<Window>, pending_windows: Vec<Window>,
@ -117,13 +119,11 @@ impl FloatingLayout {
xdg.send_configure(); xdg.send_configure();
} }
window.override_z_index(RenderZindex::Shell as u8 + 1); space.map_window(&window, position, FLOATING_INDEX, false);
space.map_window(&window, position, false);
self.windows.insert(window); self.windows.insert(window);
} }
pub fn unmap_window(&mut self, space: &mut Space, window: &Window) { pub fn unmap_window(&mut self, space: &mut Space, window: &Window) {
window.clear_z_index();
space.unmap_window(window); space.unmap_window(window);
self.pending_windows.retain(|w| w != window); self.pending_windows.retain(|w| w != window);
self.windows.remove(window); self.windows.remove(window);
@ -133,7 +133,12 @@ impl FloatingLayout {
let layers = layer_map_for_output(&output); let layers = layer_map_for_output(&output);
let geometry = layers.non_exclusive_zone(); let geometry = layers.non_exclusive_zone();
space.map_window(&window, (geometry.loc.x, geometry.loc.y), true); space.map_window(
&window,
(geometry.loc.x, geometry.loc.y),
FLOATING_INDEX,
true,
);
#[allow(irrefutable_let_patterns)] #[allow(irrefutable_let_patterns)]
if let Kind::Xdg(surface) = &window.toplevel() { if let Kind::Xdg(surface) = &window.toplevel() {
surface.with_pending_state(|state| { surface.with_pending_state(|state| {
@ -183,7 +188,7 @@ impl FloatingLayout {
let grab = MoveSurfaceGrab::new(start_data, window.clone(), initial_window_location); let grab = MoveSurfaceGrab::new(start_data, window.clone(), initial_window_location);
pointer.set_grab(grab, serial, 0); pointer.set_grab(grab, serial, Focus::Clear);
} }
} }
@ -203,7 +208,7 @@ impl FloatingLayout {
let grab = let grab =
grabs::ResizeSurfaceGrab::new(start_data, window.clone(), edges, location, size); grabs::ResizeSurfaceGrab::new(start_data, window.clone(), edges, location, size);
pointer.set_grab(grab, serial, 0); pointer.set_grab(grab, serial, Focus::Clear);
} }
} }
} }

View file

@ -14,7 +14,7 @@ use smithay::{
}, },
utils::{IsAlive, Rectangle}, utils::{IsAlive, Rectangle},
wayland::{ wayland::{
seat::{PointerGrabStartData, Seat}, seat::{Focus, PointerGrabStartData, Seat},
Serial, Serial,
}, },
}; };
@ -272,7 +272,7 @@ impl TilingLayout {
ratio: ratio.clone(), ratio: ratio.clone(),
}; };
pointer.set_grab(grab, serial, 0); pointer.set_grab(grab, serial, Focus::Clear);
} }
return; return;
} }
@ -590,6 +590,7 @@ impl TilingLayout {
space.map_window( space.map_window(
&window, &window,
(geo.loc.x + inner, geo.loc.y + inner), (geo.loc.x + inner, geo.loc.y + inner),
None,
false, false,
); );
} }

View file

@ -523,7 +523,7 @@ impl Shell {
state.add_workspace_state(&workspace.handle, WState::Hidden); state.add_workspace_state(&workspace.handle, WState::Hidden);
} }
let mut map = layer_map_for_output(output); let mut map = layer_map_for_output(output);
map.cleanup(); map.cleanup(dh);
} }
std::mem::drop(state); std::mem::drop(state);
self.toplevel_info_state self.toplevel_info_state

View file

@ -2,7 +2,7 @@
use crate::{state::BackendData, utils::prelude::*}; use crate::{state::BackendData, utils::prelude::*};
use smithay::{ use smithay::{
backend::renderer::utils::on_commit_buffer_handler, backend::renderer::utils::{on_commit_buffer_handler, with_renderer_surface_state},
delegate_compositor, delegate_compositor,
desktop::{layer_map_for_output, Kind, LayerSurface, PopupKind, WindowSurfaceType}, desktop::{layer_map_for_output, Kind, LayerSurface, PopupKind, WindowSurfaceType},
reexports::wayland_server::{protocol::wl_surface::WlSurface, DisplayHandle}, reexports::wayland_server::{protocol::wl_surface::WlSurface, DisplayHandle},
@ -178,7 +178,12 @@ impl CompositorHandler for State {
window.geometry().size, window.geometry().size,
); );
if let Some(location) = new_location { if let Some(location) = new_location {
space.map_window(&window, location, true); space.map_window(
&window,
location,
crate::shell::layout::floating::FLOATING_INDEX,
true,
);
for window in space.windows() { for window in space.windows() {
update_reactive_popups(space, window); update_reactive_popups(space, window);
} }

View file

@ -16,7 +16,7 @@ use smithay::{
}, },
wayland::{ wayland::{
output::Output, output::Output,
seat::{PointerGrabStartData, Seat}, seat::{Focus, PointerGrabStartData, Seat},
shell::xdg::{ shell::xdg::{
Configure, PopupSurface, PositionerState, ToplevelSurface, XdgShellHandler, Configure, PopupSurface, PositionerState, ToplevelSurface, XdgShellHandler,
XdgShellState, XdgShellState,
@ -123,7 +123,7 @@ impl XdgShellHandler for State {
grab.ungrab(dh, PopupUngrabStrategy::All); grab.ungrab(dh, PopupUngrabStrategy::All);
return; return;
} }
pointer.set_grab(PopupPointerGrab::new(&grab), serial, 0); pointer.set_grab(PopupPointerGrab::new(&grab), serial, Focus::Keep);
} }
seat.user_data() seat.user_data()