chore: Rust 2024 edition
Set the formatting style to 2021 edition to avoid disrupting existing work. Remove when possible.
This commit is contained in:
parent
35d781dc1e
commit
7f7ab8bcbe
19 changed files with 494 additions and 506 deletions
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
|
|
@ -3,7 +3,7 @@ name: Continuous Integration
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- master
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
|
|
@ -67,6 +67,7 @@ jobs:
|
|||
meson -Dbuiltin=enabled -Dserver=disabled -Dexamples=disabled -Dman-pages=disabled build .
|
||||
ninja -C build
|
||||
sudo meson install -C build
|
||||
sudo ldconfig
|
||||
- name: Test features
|
||||
uses: actions-rs/cargo@v1
|
||||
env:
|
||||
|
|
|
|||
865
Cargo.lock
generated
865
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
authors = ["Victoria Brekenfeld"]
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
license = "GPL-3.0-only"
|
||||
name = "cosmic-comp"
|
||||
version = "0.1.0"
|
||||
|
|
@ -25,7 +25,7 @@ cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", rev = "
|
|||
"server",
|
||||
] }
|
||||
cosmic-settings-config = { git = "https://github.com/pop-os/cosmic-settings-daemon" }
|
||||
cosmic-settings-daemon-config = { git = "https://github.com/pop-os/cosmic-settings-daemon", branch = "greeter", features = [
|
||||
cosmic-settings-daemon-config = { git = "https://github.com/pop-os/cosmic-settings-daemon", features = [
|
||||
"greeter",
|
||||
] }
|
||||
cosmic-text = { git = "https://github.com/pop-os/cosmic-text.git", features = [
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
style_edition = "2021"
|
||||
|
|
@ -163,7 +163,7 @@ fn init_libinput(
|
|||
let libinput_backend = LibinputInputBackend::new(libinput_context.clone());
|
||||
|
||||
evlh.insert_source(libinput_backend, move |mut event, _, state| {
|
||||
if let InputEvent::DeviceAdded { ref mut device } = &mut event {
|
||||
if let InputEvent::DeviceAdded { device } = &mut event {
|
||||
state.common.config.read_device(device);
|
||||
state
|
||||
.backend
|
||||
|
|
|
|||
|
|
@ -1379,7 +1379,7 @@ where
|
|||
elements.truncate(old_len);
|
||||
}
|
||||
|
||||
if let (Some(ref damage), _) = &res {
|
||||
if let (Some(damage), _) = &res {
|
||||
let blit_to_buffer =
|
||||
|renderer: &mut R, blit_from: &mut R::Framebuffer<'_>| {
|
||||
if let Ok(dmabuf) = get_dmabuf(buffer) {
|
||||
|
|
|
|||
|
|
@ -10,13 +10,13 @@ use crate::{
|
|||
};
|
||||
use cosmic_config::{ConfigGet, CosmicConfigEntry};
|
||||
use cosmic_settings_config::window_rules::ApplicationException;
|
||||
use cosmic_settings_config::{Shortcuts, shortcuts, window_rules};
|
||||
use cosmic_settings_config::{shortcuts, window_rules, Shortcuts};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use smithay::utils::{Clock, Monotonic};
|
||||
use smithay::wayland::xdg_activation::XdgActivationState;
|
||||
pub use smithay::{
|
||||
backend::input::{self as smithay_input, KeyState},
|
||||
input::keyboard::{Keysym, ModifiersState, keysyms as KeySyms},
|
||||
input::keyboard::{keysyms as KeySyms, Keysym, ModifiersState},
|
||||
output::{Mode, Output},
|
||||
reexports::{
|
||||
calloop::LoopHandle,
|
||||
|
|
@ -25,7 +25,7 @@ pub use smithay::{
|
|||
TapButtonMap,
|
||||
},
|
||||
},
|
||||
utils::{Logical, Physical, Point, SERIAL_COUNTER, Size, Transform},
|
||||
utils::{Logical, Physical, Point, Size, Transform, SERIAL_COUNTER},
|
||||
};
|
||||
use std::{
|
||||
cell::RefCell,
|
||||
|
|
@ -33,7 +33,7 @@ use std::{
|
|||
fs::OpenOptions,
|
||||
io::Write,
|
||||
path::PathBuf,
|
||||
sync::{Arc, atomic::AtomicBool},
|
||||
sync::{atomic::AtomicBool, Arc},
|
||||
};
|
||||
use tracing::{error, warn};
|
||||
|
||||
|
|
@ -45,8 +45,8 @@ pub use self::types::*;
|
|||
use cosmic::config::CosmicTk;
|
||||
pub use cosmic_comp_config::output::EdidProduct;
|
||||
use cosmic_comp_config::{
|
||||
CosmicCompConfig, KeyboardConfig, TileBehavior, XkbConfig, XwaylandDescaling,
|
||||
XwaylandEavesdropping, ZoomConfig, input::InputConfig, workspace::WorkspaceConfig,
|
||||
input::InputConfig, workspace::WorkspaceConfig, CosmicCompConfig, KeyboardConfig, TileBehavior,
|
||||
XkbConfig, XwaylandDescaling, XwaylandEavesdropping, ZoomConfig,
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
|||
|
|
@ -2030,7 +2030,7 @@ impl State {
|
|||
Stage::SessionLock(lock_surface) => {
|
||||
return ControlFlow::Break(Ok(lock_surface
|
||||
.cloned()
|
||||
.map(KeyboardFocusTarget::LockSurface)))
|
||||
.map(KeyboardFocusTarget::LockSurface)));
|
||||
}
|
||||
Stage::LayerPopup {
|
||||
layer,
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ unsafe fn set_cloexec(fd: RawFd) -> rustix::io::Result<()> {
|
|||
if fd == -1 {
|
||||
return Err(rustix::io::Errno::BADF);
|
||||
}
|
||||
let fd = BorrowedFd::borrow_raw(fd);
|
||||
let fd = unsafe { BorrowedFd::borrow_raw(fd) };
|
||||
let flags = rustix::io::fcntl_getfd(fd)?;
|
||||
rustix::io::fcntl_setfd(fd, flags | rustix::io::FdFlags::CLOEXEC)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -667,8 +667,7 @@ impl CosmicMapped {
|
|||
WindowSurface::Wayland(_) => "Protocol: Wayland",
|
||||
WindowSurface::X11(_) => "Protocol: X11",
|
||||
});
|
||||
if let WindowSurface::X11(ref surf) =
|
||||
window.0.underlying_surface()
|
||||
if let WindowSurface::X11(surf) = window.0.underlying_surface()
|
||||
{
|
||||
let geo = surf.geometry();
|
||||
ui.label(format!(
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use super::{
|
||||
CosmicSurface,
|
||||
window::{Focus, RESIZE_BORDER},
|
||||
CosmicSurface,
|
||||
};
|
||||
use crate::{
|
||||
backend::render::cursor::CursorState,
|
||||
|
|
@ -17,12 +17,11 @@ use crate::{
|
|||
};
|
||||
use calloop::LoopHandle;
|
||||
use cosmic::{
|
||||
Apply, Element as CosmicElement, Theme,
|
||||
iced::{Alignment, id::Id, widget as iced_widget},
|
||||
iced_core::{Background, Border, Color, Length, border::Radius},
|
||||
iced::{id::Id, widget as iced_widget, Alignment},
|
||||
iced_core::{border::Radius, Background, Border, Color, Length},
|
||||
iced_runtime::Task,
|
||||
iced_widget::scrollable::AbsoluteOffset,
|
||||
theme, widget as cosmic_widget,
|
||||
theme, widget as cosmic_widget, Apply, Element as CosmicElement, Theme,
|
||||
};
|
||||
use cosmic_settings_config::shortcuts;
|
||||
use shortcuts::action::{Direction, FocusDirection};
|
||||
|
|
@ -30,16 +29,15 @@ use smithay::{
|
|||
backend::{
|
||||
input::KeyState,
|
||||
renderer::{
|
||||
ImportAll, ImportMem, Renderer,
|
||||
element::{
|
||||
AsRenderElements, memory::MemoryRenderBufferRenderElement,
|
||||
surface::WaylandSurfaceRenderElement,
|
||||
memory::MemoryRenderBufferRenderElement, surface::WaylandSurfaceRenderElement,
|
||||
AsRenderElements,
|
||||
},
|
||||
ImportAll, ImportMem, Renderer,
|
||||
},
|
||||
},
|
||||
desktop::{WindowSurfaceType, space::SpaceElement},
|
||||
desktop::{space::SpaceElement, WindowSurfaceType},
|
||||
input::{
|
||||
Seat,
|
||||
keyboard::{KeyboardTarget, KeysymHandle, ModifiersState},
|
||||
pointer::{
|
||||
AxisFrame, ButtonEvent, CursorImageStatus, GestureHoldBeginEvent, GestureHoldEndEvent,
|
||||
|
|
@ -51,6 +49,7 @@ use smithay::{
|
|||
DownEvent, MotionEvent as TouchMotionEvent, OrientationEvent, ShapeEvent, TouchTarget,
|
||||
UpEvent,
|
||||
},
|
||||
Seat,
|
||||
},
|
||||
output::Output,
|
||||
reexports::wayland_server::protocol::wl_surface::WlSurface,
|
||||
|
|
@ -63,8 +62,8 @@ use std::{
|
|||
fmt,
|
||||
hash::Hash,
|
||||
sync::{
|
||||
Arc, LazyLock, Mutex,
|
||||
atomic::{AtomicBool, AtomicU8, AtomicUsize, Ordering},
|
||||
Arc, LazyLock, Mutex,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -314,7 +313,11 @@ impl CosmicStack {
|
|||
if let Ok(old) =
|
||||
p.active
|
||||
.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |val| {
|
||||
if val < max - 1 { Some(val + 1) } else { None }
|
||||
if val < max - 1 {
|
||||
Some(val + 1)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
{
|
||||
p.previous_keyboard.store(old, Ordering::SeqCst);
|
||||
|
|
|
|||
|
|
@ -744,7 +744,7 @@ impl TilingLayout {
|
|||
}
|
||||
};
|
||||
|
||||
for (ref mut parent_id, _) in children.iter_mut() {
|
||||
for (parent_id, _) in children.iter_mut() {
|
||||
*parent_id = id.clone();
|
||||
}
|
||||
if let Data::Mapped { mapped, .. } = other_tree.get_mut(&id).unwrap().data_mut() {
|
||||
|
|
|
|||
|
|
@ -3267,22 +3267,29 @@ impl Shell {
|
|||
let is_stacked = mapped.is_stack();
|
||||
|
||||
if target_stack || !is_stacked {
|
||||
Box::new(window_items(
|
||||
&mapped,
|
||||
is_tiled,
|
||||
is_stacked,
|
||||
is_sticky,
|
||||
tiling_enabled,
|
||||
edge,
|
||||
config,
|
||||
)) as Box<dyn Iterator<Item = Item>>
|
||||
Box::new(
|
||||
window_items(
|
||||
&mapped,
|
||||
is_tiled,
|
||||
is_stacked,
|
||||
is_sticky,
|
||||
tiling_enabled,
|
||||
edge,
|
||||
config,
|
||||
)
|
||||
.collect::<Vec<Item>>()
|
||||
.into_iter(),
|
||||
) as Box<dyn Iterator<Item = Item>>
|
||||
} else {
|
||||
let (tab, _) = mapped
|
||||
.windows()
|
||||
.find(|(s, _)| s.wl_surface().as_deref() == Some(surface))
|
||||
.unwrap();
|
||||
Box::new(tab_items(&mapped, &tab, is_tiled, config))
|
||||
as Box<dyn Iterator<Item = Item>>
|
||||
Box::new(
|
||||
tab_items(&mapped, &tab, is_tiled, config)
|
||||
.collect::<Vec<Item>>()
|
||||
.into_iter(),
|
||||
) as Box<dyn Iterator<Item = Item>>
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -3292,7 +3299,7 @@ impl Shell {
|
|||
.mapped()
|
||||
.find_map(|m| {
|
||||
m.windows()
|
||||
.find(|(ref w, _)| w == surface)
|
||||
.find(|(w, _)| w == surface)
|
||||
.map(|(_, loc)| (m, loc))
|
||||
})
|
||||
.map(|(mapped, relative_loc)| (set, mapped, relative_loc))
|
||||
|
|
|
|||
10
src/state.rs
10
src/state.rs
|
|
@ -391,9 +391,9 @@ impl BackendData {
|
|||
|
||||
pub fn lock(&mut self) -> LockedBackend<'_> {
|
||||
match self {
|
||||
BackendData::Kms(ref mut state) => LockedBackend::Kms(state.lock_devices()),
|
||||
BackendData::X11(ref mut state) => LockedBackend::X11(state),
|
||||
BackendData::Winit(ref mut state) => LockedBackend::Winit(state),
|
||||
BackendData::Kms(state) => LockedBackend::Kms(state.lock_devices()),
|
||||
BackendData::X11(state) => LockedBackend::X11(state),
|
||||
BackendData::Winit(state) => LockedBackend::Winit(state),
|
||||
_ => unreachable!("Tried to lock unset backend"),
|
||||
}
|
||||
}
|
||||
|
|
@ -535,8 +535,8 @@ impl<'a> LockedBackend<'a> {
|
|||
LockedBackend::Winit(_) => {} // We cannot do this on the winit backend.
|
||||
// Winit has a very strict render-loop and skipping frames breaks atleast the wayland winit-backend.
|
||||
// Swapping with damage (which should be empty on these frames) is likely good enough anyway.
|
||||
LockedBackend::X11(ref mut state) => state.schedule_render(&output),
|
||||
LockedBackend::Kms(ref mut state) => state.schedule_render(&output),
|
||||
LockedBackend::X11(state) => state.schedule_render(&output),
|
||||
LockedBackend::Kms(state) => state.schedule_render(&output),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,11 @@ use std::{
|
|||
collections::{HashMap, HashSet},
|
||||
fmt,
|
||||
hash::{Hash, Hasher},
|
||||
sync::{Arc, LazyLock, Mutex, mpsc::Receiver},
|
||||
sync::{mpsc::Receiver, Arc, LazyLock, Mutex},
|
||||
};
|
||||
|
||||
use cosmic::{
|
||||
Theme,
|
||||
iced::{
|
||||
Limits, Point as IcedPoint, Size as IcedSize, Task,
|
||||
advanced::{graphics::text::font_system, widget::Tree},
|
||||
event::Event,
|
||||
futures::{FutureExt, StreamExt},
|
||||
|
|
@ -16,17 +14,19 @@ use cosmic::{
|
|||
mouse::{Button as MouseButton, Cursor, Event as MouseEvent, ScrollDelta},
|
||||
touch::{Event as TouchEvent, Finger},
|
||||
window::Event as WindowEvent,
|
||||
Limits, Point as IcedPoint, Size as IcedSize, Task,
|
||||
},
|
||||
iced_core::{Color, Length, Pixels, clipboard::Null as NullClipboard, id::Id, renderer::Style},
|
||||
iced_core::{clipboard::Null as NullClipboard, id::Id, renderer::Style, Color, Length, Pixels},
|
||||
iced_runtime::{
|
||||
Action, Debug,
|
||||
program::{Program as IcedProgram, State},
|
||||
task::into_stream,
|
||||
Action, Debug,
|
||||
},
|
||||
Theme,
|
||||
};
|
||||
use iced_tiny_skia::{
|
||||
graphics::{damage, Viewport},
|
||||
Layer,
|
||||
graphics::{Viewport, damage},
|
||||
};
|
||||
|
||||
use ordered_float::OrderedFloat;
|
||||
|
|
@ -35,16 +35,15 @@ use smithay::{
|
|||
allocator::Fourcc,
|
||||
input::{ButtonState, KeyState},
|
||||
renderer::{
|
||||
ImportMem, Renderer,
|
||||
element::{
|
||||
AsRenderElements, Kind,
|
||||
memory::{MemoryRenderBuffer, MemoryRenderBufferRenderElement},
|
||||
AsRenderElements, Kind,
|
||||
},
|
||||
ImportMem, Renderer,
|
||||
},
|
||||
},
|
||||
desktop::space::{RenderZindex, SpaceElement},
|
||||
input::{
|
||||
Seat,
|
||||
keyboard::{KeyboardTarget, KeysymHandle, ModifiersState},
|
||||
pointer::{
|
||||
AxisFrame, ButtonEvent, GestureHoldBeginEvent, GestureHoldEndEvent,
|
||||
|
|
@ -56,10 +55,11 @@ use smithay::{
|
|||
DownEvent, MotionEvent as TouchMotionEvent, OrientationEvent, ShapeEvent, TouchTarget,
|
||||
UpEvent,
|
||||
},
|
||||
Seat,
|
||||
},
|
||||
output::Output,
|
||||
reexports::calloop::RegistrationToken,
|
||||
reexports::calloop::{self, LoopHandle, futures::Scheduler},
|
||||
reexports::calloop::{self, futures::Scheduler, LoopHandle},
|
||||
utils::{
|
||||
Buffer as BufferCoords, IsAlive, Logical, Physical, Point, Rectangle, Scale, Serial, Size,
|
||||
Transform,
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ fn toplevel_ensure_initial_configure(
|
|||
}
|
||||
|
||||
fn xdg_popup_ensure_initial_configure(popup: &PopupKind) {
|
||||
if let PopupKind::Xdg(ref popup) = popup {
|
||||
if let PopupKind::Xdg(popup) = popup {
|
||||
let initial_configure_sent = with_states(popup.wl_surface(), |states| {
|
||||
states
|
||||
.data_map
|
||||
|
|
|
|||
|
|
@ -72,10 +72,7 @@ impl State {
|
|||
|
||||
if offset_x > 0 || offset_y > 0 {
|
||||
for (output, conf) in conf.iter_mut() {
|
||||
if let OutputConfiguration::Enabled {
|
||||
ref mut position, ..
|
||||
} = conf
|
||||
{
|
||||
if let OutputConfiguration::Enabled { position, .. } = conf {
|
||||
let current_config = output
|
||||
.user_data()
|
||||
.get::<RefCell<OutputConfig>>()
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ pub fn set_all_surfaces_dpms_on(state: &mut State) {
|
|||
}
|
||||
|
||||
fn kms_surfaces(state: &mut State) -> impl Iterator<Item = &mut Surface> {
|
||||
if let BackendData::Kms(ref mut kms_state) = &mut state.backend {
|
||||
if let BackendData::Kms(kms_state) = &mut state.backend {
|
||||
Some(
|
||||
kms_state
|
||||
.drm_devices
|
||||
|
|
|
|||
|
|
@ -209,7 +209,10 @@ where
|
|||
.push((obj.downgrade(), instance));
|
||||
} else {
|
||||
let _ = data_init.init(cosmic_toplevel, ToplevelHandleStateInner::empty());
|
||||
error!(?foreign_toplevel, "Toplevel for foreign-toplevel-list not registered for cosmic-toplevel-info.");
|
||||
error!(
|
||||
?foreign_toplevel,
|
||||
"Toplevel for foreign-toplevel-list not registered for cosmic-toplevel-info."
|
||||
);
|
||||
}
|
||||
}
|
||||
zcosmic_toplevel_info_v1::Request::Stop => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue