Skip to content

Commit

Permalink
Merge pull request #186 from pop-os/update-smithay_jammy
Browse files Browse the repository at this point in the history
chore: Update deps
  • Loading branch information
Drakulix authored Oct 2, 2023
2 parents 4f3a682 + 2a0b1cf commit a149b42
Show file tree
Hide file tree
Showing 42 changed files with 1,324 additions and 1,118 deletions.
1,327 changes: 801 additions & 526 deletions Cargo.lock

Large diffs are not rendered by default.

27 changes: 13 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ members = [
]

[dependencies]
apply = "0.3.0"
anyhow = { version = "1.0.51", features = ["backtrace"] }
bitflags = "1.3.2"
bitflags = "2.4"
bytemuck = "1.12"
calloop = { version = "0.10.1", features = ["executor"] }
calloop = { version = "0.12.2", features = ["executor"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
sendfd = "0.4.1"
Expand All @@ -28,19 +27,19 @@ log-panics = { version = "2", features = ["with-backtrace"] }
thiserror = "1.0.26"
regex = "1"
xcursor = "0.3.3"
xkbcommon = "0.4"
indexmap = "1.8.0"
xkbcommon = "0.6"
indexmap = "2.0"
xdg = "^2.1"
ron = "0.7"
libsystemd = { version = "0.5", optional = true }
wayland-backend = "0.1.0"
wayland-scanner = "0.30.0"
wayland-backend = "0.3.0"
wayland-scanner = "0.31.0"
cosmic-comp-config = { path = "cosmic-comp-config" }
cosmic-config = { git = "https://github.com/pop-os/libcosmic/", rev = "4895b0c", features = ["calloop"] }
cosmic-config = { git = "https://github.com/pop-os/libcosmic/", rev = "f91287d", features = ["calloop"] }
cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", branch = "main", default-features = false, features = ["server"] }
libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "4895b0c", default-features = false }
iced_tiny_skia = { git = "https://github.com/pop-os/libcosmic/", rev = "4895b0c" }
tiny-skia = "0.9"
libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "f91287d", default-features = false }
iced_tiny_skia = { git = "https://github.com/pop-os/libcosmic/", rev = "f91287d" }
tiny-skia = "0.10"
ordered-float = "3.0"
glow = "0.11.2"
tracing-subscriber = { version = "0.3.16", features = ["env-filter", "tracing-log"] }
Expand All @@ -61,13 +60,13 @@ branch = "feature/copy_clone"
[dependencies.smithay]
version = "0.3"
git = "https://github.com/smithay/smithay.git"
rev = "58d5bdc"
rev = "74ef59a3f"
default-features = false
features = ["backend_drm", "backend_gbm", "backend_egl", "backend_libinput", "backend_session_libseat", "backend_udev", "backend_winit", "backend_vulkan", "backend_x11", "desktop", "use_system_lib", "renderer_glow", "renderer_multi", "wayland_frontend", "xwayland"]

[dependencies.smithay-egui]
git = "https://github.com/Smithay/smithay-egui.git"
rev = "dab5c1b"
rev = "114d8db6"
features = ["svg"]
optional = true

Expand All @@ -87,4 +86,4 @@ debug = true
lto = "fat"

[patch."https://github.com/Smithay/smithay.git"]
smithay = { git = "https://github.com/smithay//smithay", rev = "d3e1ef9" }
smithay = { git = "https://github.com/smithay//smithay", rev = "74ef59a3f" }
121 changes: 57 additions & 64 deletions src/backend/kms/mod.rs

Large diffs are not rendered by default.

11 changes: 4 additions & 7 deletions src/backend/kms/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ use smithay::{
use std::sync::Arc;
use tracing::{info, warn};

use crate::{
state::{ClientState, Data},
utils::prelude::*,
};
use crate::state::{ClientState, State};

#[derive(Debug)]
pub struct Socket {
Expand Down Expand Up @@ -96,10 +93,10 @@ impl State {
let token = self
.common
.event_loop_handle
.insert_source(listener, move |client_stream, _, data: &mut Data| {
if let Err(err) = data.display.handle().insert_client(
.insert_source(listener, move |client_stream, _, state: &mut State| {
if let Err(err) = state.common.display_handle.insert_client(
client_stream,
Arc::new(data.state.new_client_state_with_node(render_node)),
Arc::new(state.new_client_state_with_node(render_node)),
) {
warn!(
socket_name = socket_name_clone,
Expand Down
4 changes: 2 additions & 2 deletions src/backend/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only

use crate::state::{Data, State};
use crate::state::State;
use anyhow::{Context, Result};
use smithay::reexports::{calloop::EventLoop, wayland_server::DisplayHandle};
use tracing::{info, warn};
Expand All @@ -15,7 +15,7 @@ pub mod x11;

pub fn init_backend_auto(
dh: &DisplayHandle,
event_loop: &mut EventLoop<'static, Data>,
event_loop: &mut EventLoop<'static, State>,
state: &mut State,
) -> Result<()> {
let res = match std::env::var("COSMIC_BACKEND") {
Expand Down
30 changes: 11 additions & 19 deletions src/backend/winit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
backend::render,
config::OutputConfig,
input::Devices,
state::{BackendData, Common, Data},
state::{BackendData, Common},
utils::prelude::*,
wayland::protocols::screencopy::{BufferParams, Session as ScreencopySession},
};
Expand Down Expand Up @@ -147,7 +147,7 @@ impl WinitState {

pub fn init_backend(
dh: &DisplayHandle,
event_loop: &mut EventLoop<Data>,
event_loop: &mut EventLoop<State>,
state: &mut State,
) -> Result<()> {
let (mut backend, mut input) =
Expand Down Expand Up @@ -197,13 +197,8 @@ pub fn init_backend(
let mut token = Some(
event_loop
.handle()
.insert_source(render_source, move |_, _, data| {
if let Err(err) = data
.state
.backend
.winit()
.render_output(&mut data.state.common)
{
.insert_source(render_source, move |_, _, state| {
if let Err(err) = state.backend.winit().render_output(&mut state.common) {
error!(?err, "Failed to render frame.");
render_ping.ping();
}
Expand All @@ -213,21 +208,18 @@ pub fn init_backend(
let event_loop_handle = event_loop.handle();
event_loop
.handle()
.insert_source(event_source, move |_, _, data| {
match input.dispatch_new_events(|event| {
data.state.process_winit_event(event, &render_ping_handle)
}) {
.insert_source(event_source, move |_, _, state| {
match input
.dispatch_new_events(|event| state.process_winit_event(event, &render_ping_handle))
{
Ok(_) => {
event_ping_handle.ping();
render_ping_handle.ping();
}
Err(winit::WinitError::WindowClosed) => {
let output = data.state.backend.winit().output.clone();
let seats = data.state.common.seats().cloned().collect::<Vec<_>>();
data.state
.common
.shell
.remove_output(&output, seats.into_iter());
let output = state.backend.winit().output.clone();
let seats = state.common.seats().cloned().collect::<Vec<_>>();
state.common.shell.remove_output(&output, seats.into_iter());
if let Some(token) = token.take() {
event_loop_handle.remove(token);
}
Expand Down
33 changes: 15 additions & 18 deletions src/backend/x11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
backend::render,
config::OutputConfig,
input::Devices,
state::{BackendData, Common, Data},
state::{BackendData, Common},
utils::prelude::*,
wayland::protocols::screencopy::{BufferParams, Session as ScreencopySession},
};
Expand Down Expand Up @@ -63,7 +63,7 @@ pub struct X11State {
}

impl X11State {
pub fn add_window(&mut self, handle: LoopHandle<'_, Data>) -> Result<Output> {
pub fn add_window(&mut self, handle: LoopHandle<'_, State>) -> Result<Output> {
let window = WindowBuilder::new()
.title("COSMIC")
.build(&self.handle)
Expand Down Expand Up @@ -124,15 +124,15 @@ impl X11State {
let (ping, source) =
ping::make_ping().with_context(|| "Failed to create output event loop source")?;
let _token = handle
.insert_source(source, move |_, _, data| {
let x11_state = data.state.backend.x11();
.insert_source(source, move |_, _, state| {
let x11_state = state.backend.x11();
if let Some(surface) = x11_state
.surfaces
.iter_mut()
.find(|s| s.output == output_ref)
{
if let Err(err) =
surface.render_output(&mut x11_state.renderer, &mut data.state.common)
surface.render_output(&mut x11_state.renderer, &mut state.common)
{
error!(?err, "Error rendering.");
}
Expand Down Expand Up @@ -333,7 +333,7 @@ fn try_gbm_allocator(fd: OwnedFd) -> Option<Allocator> {

pub fn init_backend(
dh: &DisplayHandle,
event_loop: &mut EventLoop<Data>,
event_loop: &mut EventLoop<State>,
state: &mut State,
) -> Result<()> {
let backend = X11Backend::new().with_context(|| "Failed to initilize X11 backend")?;
Expand Down Expand Up @@ -391,12 +391,11 @@ pub fn init_backend(

event_loop
.handle()
.insert_source(backend, move |event, _, data| match event {
.insert_source(backend, move |event, _, state| match event {
X11Event::CloseRequested { window_id } => {
// TODO: drain_filter
let mut outputs_removed = Vec::new();
for surface in data
.state
for surface in state
.backend
.x11()
.surfaces
Expand All @@ -406,13 +405,13 @@ pub fn init_backend(
surface.window.unmap();
outputs_removed.push(surface.output.clone());
}
data.state
state
.backend
.x11()
.surfaces
.retain(|s| s.window.id() != window_id);
for output in outputs_removed.into_iter() {
data.state
state
.common
.shell
.remove_output(&output, seats.iter().cloned());
Expand All @@ -427,8 +426,7 @@ pub fn init_backend(
size,
refresh: 60_000,
};
if let Some(surface) = data
.state
if let Some(surface) = state
.backend
.x11()
.surfaces
Expand All @@ -449,17 +447,16 @@ pub fn init_backend(
output.change_current_state(Some(mode), None, None, None);
output.set_preferred(mode);
layer_map_for_output(output).arrange();
data.state.common.output_configuration_state.update();
data.state.common.shell.refresh_outputs();
state.common.output_configuration_state.update();
state.common.shell.refresh_outputs();
surface.dirty = true;
if !surface.pending {
surface.render.ping();
}
}
}
X11Event::Refresh { window_id } | X11Event::PresentCompleted { window_id } => {
if let Some(surface) = data
.state
if let Some(surface) = state
.backend
.x11()
.surfaces
Expand All @@ -473,7 +470,7 @@ pub fn init_backend(
}
}
}
X11Event::Input(event) => data.state.process_x11_event(event),
X11Event::Input(event) => state.process_x11_event(event),
})
.map_err(|_| anyhow::anyhow!("Failed to insert X11 Backend into event loop"))?;

Expand Down
24 changes: 12 additions & 12 deletions src/config/key_bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::shell::{focus::FocusDirection, grabs::ResizeEdge, Direction, ResizeDi
use serde::Deserialize;
use smithay::{
backend::input::KeyState,
input::keyboard::{keysyms as KeySyms, xkb::keysym_get_name, ModifiersState},
input::keyboard::{xkb::keysym_get_name, ModifiersState},
};
use std::collections::HashMap;

Expand Down Expand Up @@ -90,11 +90,11 @@ pub struct KeyPattern {
pub modifiers: KeyModifiers,
/// The actual key, that was pressed
#[serde(deserialize_with = "deserialize_Keysym", default)]
pub key: Option<u32>,
pub key: Option<Keysym>,
}

impl KeyPattern {
pub fn new(modifiers: impl Into<KeyModifiers>, key: Option<u32>) -> KeyPattern {
pub fn new(modifiers: impl Into<KeyModifiers>, key: Option<Keysym>) -> KeyPattern {
KeyPattern {
modifiers: modifiers.into(),
key,
Expand Down Expand Up @@ -174,7 +174,7 @@ pub enum Action {
fn insert_binding(
key_bindings: &mut HashMap<KeyPattern, Action>,
modifiers: KeyModifiers,
keys: impl Iterator<Item = u32>,
keys: impl Iterator<Item = Keysym>,
action: Action,
) {
if !key_bindings.values().any(|a| a == &action) {
Expand All @@ -197,16 +197,16 @@ pub fn add_default_bindings(
let (workspace_previous, workspace_next, output_previous, output_next) = match workspace_layout
{
WorkspaceLayout::Horizontal => (
[KeySyms::KEY_Left, KeySyms::KEY_h],
[KeySyms::KEY_Right, KeySyms::KEY_l],
[KeySyms::KEY_Up, KeySyms::KEY_k],
[KeySyms::KEY_Down, KeySyms::KEY_j],
[Keysym::Left, Keysym::h],
[Keysym::Right, Keysym::l],
[Keysym::Up, Keysym::k],
[Keysym::Down, Keysym::j],
),
WorkspaceLayout::Vertical => (
[KeySyms::KEY_Up, KeySyms::KEY_k],
[KeySyms::KEY_Down, KeySyms::KEY_j],
[KeySyms::KEY_Left, KeySyms::KEY_h],
[KeySyms::KEY_Right, KeySyms::KEY_l],
[Keysym::Up, Keysym::k],
[Keysym::Down, Keysym::j],
[Keysym::Left, Keysym::h],
[Keysym::Right, Keysym::l],
),
};

Expand Down
10 changes: 5 additions & 5 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use crate::{
shell::{Shell, WorkspaceAmount},
state::{BackendData, Data, State},
state::{BackendData, State},
wayland::protocols::output_configuration::OutputConfigurationState,
};
use cosmic_config::ConfigGet;
Expand Down Expand Up @@ -158,12 +158,12 @@ impl OutputConfig {
}

impl Config {
pub fn load(loop_handle: &LoopHandle<'_, Data>) -> Config {
pub fn load(loop_handle: &LoopHandle<'_, State>) -> Config {
let config = cosmic_config::Config::new("com.system76.CosmicComp", 1).unwrap();
let source = cosmic_config::calloop::ConfigWatchSource::new(&config).unwrap();
loop_handle
.insert_source(source, |(config, keys), (), shared_data| {
config_changed(config, keys, &mut shared_data.state);
.insert_source(source, |(config, keys), (), state| {
config_changed(config, keys, state);
})
.expect("Failed to add cosmic-config to the event loop");
let xdg = xdg::BaseDirectories::new().ok();
Expand Down Expand Up @@ -260,7 +260,7 @@ impl Config {
backend: &mut BackendData,
shell: &mut Shell,
seats: impl Iterator<Item = Seat<State>>,
loop_handle: &LoopHandle<'_, Data>,
loop_handle: &LoopHandle<'_, State>,
) {
let seats = seats.collect::<Vec<_>>();
let outputs = output_state.outputs().collect::<Vec<_>>();
Expand Down
Loading

0 comments on commit a149b42

Please sign in to comment.