Merge branch 'master_jammy' into applet-host-config
This commit is contained in:
commit
72d7887283
6 changed files with 91 additions and 62 deletions
26
Cargo.lock
generated
26
Cargo.lock
generated
|
|
@ -114,9 +114,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
|||
|
||||
[[package]]
|
||||
name = "backtrace"
|
||||
version = "0.3.65"
|
||||
version = "0.3.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "11a17d453482a265fd5f8479f2a3f405566e6ca627837aaddb85af8b1ab8ef61"
|
||||
checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7"
|
||||
dependencies = [
|
||||
"addr2line",
|
||||
"cc",
|
||||
|
|
@ -402,9 +402,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5999502d32b9c48d492abe66392408144895020ec4709e549e840799f3bb74c0"
|
||||
checksum = "2ccfd8c0ee4cce11e45b3fd6f9d5e69e0cc62912aa6a0cb1bf4617b0eba5a12f"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
"typenum",
|
||||
|
|
@ -736,9 +736,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.1"
|
||||
version = "0.12.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3"
|
||||
checksum = "607c8a29735385251a339424dd462993c0fed8fa09d378f259377df08c126022"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
|
|
@ -1147,9 +1147,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.28.4"
|
||||
version = "0.29.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424"
|
||||
checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
|
@ -1406,18 +1406,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.138"
|
||||
version = "1.0.139"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1578c6245786b9d168c5447eeacfb96856573ca56c9d68fdcf394be134882a47"
|
||||
checksum = "0171ebb889e45aa68b44aee0859b3eede84c6f5f5c228e6f140c0b2a0a46cad6"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.138"
|
||||
version = "1.0.139"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "023e9b1467aef8a10fb88f25611870ada9800ef7e22afce356bb0d2387b6f27c"
|
||||
checksum = "dc1d3230c1de7932af58ad8ffbe1d784bd55efd5a9d84ac24f69c72d83543dfb"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
@ -1517,7 +1517,7 @@ checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1"
|
|||
[[package]]
|
||||
name = "smithay"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/pop-os/smithay?branch=main#bb4bdc613ff91e06b2205d4021d8c2003e9ef660"
|
||||
source = "git+https://github.com/pop-os/smithay?branch=main#2a2c55b8cede75d988599e2320c53510dd9fabf6"
|
||||
dependencies = [
|
||||
"appendlist",
|
||||
"bitflags",
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ xdg = "^2.1"
|
|||
ron = "0.7"
|
||||
atomic_float = "0.1"
|
||||
libsystemd = "0.5"
|
||||
wayland-backend = "0.1.0-beta.7"
|
||||
wayland-scanner = "0.30.0-beta.7"
|
||||
wayland-backend = "=0.1.0-beta.7"
|
||||
wayland-scanner = "=0.30.0-beta.7"
|
||||
cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", branch = "main" }
|
||||
|
||||
[dependencies.smithay]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use crate::state::{Data, State};
|
||||
use anyhow::Result;
|
||||
use anyhow::{Context, Result};
|
||||
use smithay::reexports::{calloop::EventLoop, wayland_server::DisplayHandle};
|
||||
|
||||
pub mod render;
|
||||
|
|
@ -17,7 +17,7 @@ pub fn init_backend_auto(
|
|||
event_loop: &mut EventLoop<'static, Data>,
|
||||
state: &mut State,
|
||||
) -> Result<()> {
|
||||
match std::env::var("COSMIC_BACKEND") {
|
||||
let res = match std::env::var("COSMIC_BACKEND") {
|
||||
Ok(x) if x == "x11" => x11::init_backend(dh, event_loop, state),
|
||||
Ok(x) if x == "winit" => winit::init_backend(dh, event_loop, state),
|
||||
Ok(x) if x == "kms" => kms::init_backend(dh, event_loop, state),
|
||||
|
|
@ -38,5 +38,19 @@ pub fn init_backend_auto(
|
|||
kms::init_backend(dh, event_loop, state)
|
||||
}
|
||||
}
|
||||
};
|
||||
if res.is_ok() {
|
||||
for seat in &state.common.seats {
|
||||
let output = state
|
||||
.common
|
||||
.shell
|
||||
.outputs()
|
||||
.next()
|
||||
.with_context(|| "Backend initialized without output")?
|
||||
.clone();
|
||||
seat.user_data()
|
||||
.insert_if_missing(|| crate::input::ActiveOutput(std::cell::RefCell::new(output)));
|
||||
}
|
||||
}
|
||||
res
|
||||
}
|
||||
|
|
|
|||
24
src/debug.rs
24
src/debug.rs
|
|
@ -3,7 +3,9 @@
|
|||
use crate::state::{Common, Fps};
|
||||
use smithay::{
|
||||
backend::drm::DrmNode,
|
||||
utils::{Physical, Rectangle},
|
||||
desktop::layer_map_for_output,
|
||||
reexports::wayland_server::Resource,
|
||||
utils::{Physical, Rectangle, IsAlive},
|
||||
};
|
||||
pub use smithay_egui::EguiFrame;
|
||||
|
||||
|
|
@ -228,7 +230,9 @@ pub fn debug_ui(
|
|||
{
|
||||
ui.separator();
|
||||
ui.collapsing(output.name(), |ui| {
|
||||
ui.label(format!("Output: {:#?}", output));
|
||||
ui.label(format!("Mode: {:#?}", output.current_mode()));
|
||||
ui.label(format!("Scale: {:#?}", output.current_scale()));
|
||||
ui.label(format!("Transform: {:#?}", output.current_transform()));
|
||||
ui.label(format!("Geometry: {:?}", output.geometry()));
|
||||
ui.label(format!(
|
||||
"Local Geometry: {:?}",
|
||||
|
|
@ -244,6 +248,22 @@ pub fn debug_ui(
|
|||
.shell
|
||||
.space_relative_output_geometry((0i32, 0i32), &output)
|
||||
));
|
||||
ui.separator();
|
||||
ui.collapsing("Layers:", |ui| {
|
||||
let map = layer_map_for_output(&output);
|
||||
for layer in map.layers() {
|
||||
ui.collapsing(format!("{}/{:?}", layer.wl_surface().id(), layer.wl_surface().client_id()), |ui| {
|
||||
ui.label(format!("Alive: {:?} {:?} {:?}", layer.alive(), layer.layer_surface().alive(), layer.wl_surface().alive()));
|
||||
ui.label(format!("Layer: {:?}", layer.layer()));
|
||||
ui.label(format!("Namespace: {:?}", layer.namespace()));
|
||||
ui.label(format!("Geometry: {:?}", layer.bbox()));
|
||||
ui.label(format!("Anchor: {:?}", layer.cached_state().anchor));
|
||||
ui.label(format!("Margin: {:?}", layer.cached_state().margin));
|
||||
ui.label(format!("Exclusive: {:?}", layer.cached_state().exclusive_zone));
|
||||
});
|
||||
}
|
||||
ui.label(format!("{:?}", map));
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -99,13 +99,46 @@ impl Devices {
|
|||
}
|
||||
|
||||
pub fn add_seat(dh: &DisplayHandle, name: String) -> Seat<State> {
|
||||
let seat = Seat::<State>::new(dh, name, None);
|
||||
let mut seat = Seat::<State>::new(dh, name, None);
|
||||
let userdata = seat.user_data();
|
||||
userdata.insert_if_missing(SeatId::default);
|
||||
userdata.insert_if_missing(Devices::default);
|
||||
userdata.insert_if_missing(SupressedKeys::default);
|
||||
userdata.insert_if_missing(SeatMoveGrabState::default);
|
||||
userdata.insert_if_missing(|| RefCell::new(CursorImageStatus::Default));
|
||||
|
||||
// A lot of clients bind keyboard and pointer unconditionally once on launch..
|
||||
// Initial clients might race the compositor on adding periheral and
|
||||
// end up in a state, where they are not able to receive input.
|
||||
// Additionally a lot of clients don't handle keyboards/pointer objects being
|
||||
// removed very well either and we don't want to crash applications, because the
|
||||
// user is replugging their keyboard or mouse.
|
||||
//
|
||||
// So instead of doing the right thing (and initialize these capabilities as matching
|
||||
// devices appear), we have to surrender to reality and just always expose a keyboard and pointer.
|
||||
let dh_clone = dh.clone();
|
||||
let _ = seat.add_keyboard(
|
||||
XkbConfig::default(),
|
||||
200,
|
||||
25,
|
||||
move |seat, focus| {
|
||||
if let Some(client) =
|
||||
focus.and_then(|s| dh_clone.get_client(s.id()).ok())
|
||||
{
|
||||
set_data_device_focus(&dh_clone, seat, Some(client));
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
let owned_seat = seat.clone();
|
||||
seat.add_pointer(move |status| {
|
||||
*owned_seat
|
||||
.user_data()
|
||||
.get::<RefCell<CursorImageStatus>>()
|
||||
.unwrap()
|
||||
.borrow_mut() = status;
|
||||
});
|
||||
|
||||
seat
|
||||
}
|
||||
|
||||
|
|
@ -124,40 +157,7 @@ impl State {
|
|||
let devices = userdata.get::<Devices>().unwrap();
|
||||
for cap in devices.add_device(&device) {
|
||||
match cap {
|
||||
DeviceCapability::Keyboard => {
|
||||
let dh_clone = dh.clone();
|
||||
let _ = seat.add_keyboard(
|
||||
XkbConfig::default(),
|
||||
200,
|
||||
25,
|
||||
move |seat, focus| {
|
||||
if let Some(client) =
|
||||
focus.and_then(|s| dh_clone.get_client(s.id()).ok())
|
||||
{
|
||||
set_data_device_focus(&dh_clone, seat, Some(client))
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
DeviceCapability::Pointer => {
|
||||
let output = self
|
||||
.common
|
||||
.shell
|
||||
.outputs()
|
||||
.next()
|
||||
.expect("Backend initialized without output")
|
||||
.clone();
|
||||
seat.user_data()
|
||||
.insert_if_missing(|| ActiveOutput(RefCell::new(output)));
|
||||
let owned_seat = seat.clone();
|
||||
seat.add_pointer(move |status| {
|
||||
*owned_seat
|
||||
.user_data()
|
||||
.get::<RefCell<CursorImageStatus>>()
|
||||
.unwrap()
|
||||
.borrow_mut() = status;
|
||||
});
|
||||
}
|
||||
// TODO: Handle touch, tablet
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
@ -174,13 +174,8 @@ impl State {
|
|||
if devices.has_device(&device) {
|
||||
for cap in devices.remove_device(&device) {
|
||||
match cap {
|
||||
DeviceCapability::Keyboard => {
|
||||
seat.remove_keyboard();
|
||||
}
|
||||
DeviceCapability::Pointer => {
|
||||
seat.remove_pointer();
|
||||
}
|
||||
_ => {}
|
||||
// TODO: Handle touch, tablet
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -608,7 +608,7 @@ impl Shell {
|
|||
with_states(surface, |states| {
|
||||
let state = states.cached_state.current::<LayerSurfaceCachedState>();
|
||||
matches!(state.layer, Layer::Top | Layer::Overlay)
|
||||
&& dbg!(state.keyboard_interactivity) != KeyboardInteractivity::None
|
||||
&& state.keyboard_interactivity != KeyboardInteractivity::None
|
||||
})
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue