update dependencies and adjust for smithay changes

This commit is contained in:
Vladislav Nepogodin 2023-12-19 15:08:52 +04:00
parent 85a0a8d677
commit 3fb0a744a2
No known key found for this signature in database
GPG key ID: B62C3D10C54D5DA9
10 changed files with 652 additions and 379 deletions

923
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -13,28 +13,28 @@ keywords = ["wayland", "compositor", "smithay", "lua"]
tracing = { git = "https://github.com/tokio-rs/tracing", rev = "84f0a60" }
tracing-subscriber = { git = "https://github.com/tokio-rs/tracing", rev = "84f0a60", features = ["env-filter"] }
tracing-appender = { git = "https://github.com/tokio-rs/tracing", rev = "84f0a60" }
smithay = { git = "https://github.com/Smithay/smithay", rev = "4e41ab0" }
smithay-drm-extras = { git = "https://github.com/Smithay/smithay", rev = "4e41ab0", optional = true }
thiserror = "1.0.48"
xcursor = { version = "0.3.4", optional = true }
image = { version = "0.24.7", default-features = false, optional = true }
serde = { version = "1.0.188", features = ["derive"] }
smithay = { git = "https://github.com/Smithay/smithay", rev = "56b6441a14600593d13229b9584058ec19e3e18b", default-features = false, features = ["desktop", "wayland_frontend"] }
smithay-drm-extras = { git = "https://github.com/Smithay/smithay", rev = "56b6441a14600593d13229b9584058ec19e3e18b", optional = true }
thiserror = "1"
xcursor = { version = "0.3", optional = true }
image = { version = "0.24", default-features = false, optional = true }
serde = { version = "1.0", features = ["derive"] }
rmp = { version = "0.8.12" }
rmp-serde = { version = "1.1.2" }
calloop = { version = "0.12.2", features = ["executor", "futures-io"] }
futures-lite = { version = "1.13.0" }
async-process = { version = "1.7.0" }
async-channel = "1.9.0"
x11rb = { version = "0.12.0", default-features = false, features = ["composite"], optional = true }
futures-lite = { version = "2" }
async-process = { version = "2" }
async-channel = "2"
x11rb = { version = "0.13", default-features = false, features = ["composite"], optional = true }
shellexpand = "3.1.0"
toml = "0.8.2"
toml = "0.8"
anyhow = { version = "1.0.75", features = ["backtrace"] }
clap = { version = "4.4.2", features = ["derive"] }
xkbcommon = "0.6.0"
clap = { version = "4.4", features = ["derive"] }
xkbcommon = "0.7"
xdg = "2.5.2"
lazy_static = "1.4.0"
sysinfo = "0.29.10"
nix = { version = "0.27.1", features = ["user", "resource"] }
lazy_static = "1.4"
sysinfo = "0.29"
nix = { version = "0.27", features = ["user", "resource"] }
[features]
default = ["egl", "winit", "udev", "xwayland"]

View file

@ -22,7 +22,7 @@ use smithay::{
output::Output,
reexports::wayland_server::protocol::wl_surface::WlSurface,
wayland::{
dmabuf::{DmabufGlobal, DmabufHandler, DmabufState, ImportError},
dmabuf::{DmabufGlobal, DmabufHandler, DmabufState, ImportNotifier},
fractional_scale::with_fractional_scale,
},
};
@ -187,21 +187,29 @@ impl DmabufHandler for State {
&mut self,
_global: &DmabufGlobal,
dmabuf: Dmabuf,
) -> Result<(), ImportError> {
match &mut self.backend {
notifier: ImportNotifier
) {
let res = match &mut self.backend {
Backend::Winit(winit) => winit
.backend
.renderer()
.import_dmabuf(&dmabuf, None)
.map(|_| ())
.map_err(|_| ImportError::Failed),
.map_err(|_| ()),
Backend::Udev(udev) => udev
.gpu_manager
.single_renderer(&udev.primary_gpu)
.and_then(|mut renderer| renderer.import_dmabuf(&dmabuf, None))
.map(|_| ())
.map_err(|_| ImportError::Failed),
.map_err(|_| ()),
};
if let Ok(_) = res {
let _ = notifier.successful::<State>();
} else {
notifier.failed();
}
}
}
delegate_dmabuf!(State);

View file

@ -55,14 +55,13 @@ use smithay::{
Device,
},
input::Libinput,
nix::fcntl::OFlag,
wayland_protocols::wp::{
linux_dmabuf::zv1::server::zwp_linux_dmabuf_feedback_v1,
presentation_time::server::wp_presentation_feedback,
},
wayland_server::{
backend::GlobalId, protocol::wl_surface::WlSurface, Display, DisplayHandle,
},
}, rustix::fs::OFlags,
},
utils::{Clock, DeviceFd, IsAlive, Logical, Monotonic, Point, Transform},
wayland::dmabuf::{DmabufFeedback, DmabufFeedbackBuilder, DmabufGlobal, DmabufState},
@ -729,11 +728,11 @@ impl State {
.session
.open(
path,
OFlag::O_RDWR | OFlag::O_CLOEXEC | OFlag::O_NOCTTY | OFlag::O_NONBLOCK,
OFlags::RDWR | OFlags::CLOEXEC | OFlags::NOCTTY | OFlags::NONBLOCK,
)
.map_err(DeviceAddError::DeviceOpen)?;
let fd = DrmDeviceFd::new(unsafe { DeviceFd::from_raw_fd(fd) });
let fd = DrmDeviceFd::new(DeviceFd::from(fd));
let (drm, notifier) =
DrmDevice::new(fd.clone(), true).map_err(DeviceAddError::DrmDevice)?;

View file

@ -10,7 +10,7 @@ use smithay::{
gles::{GlesRenderer, GlesTexture},
ImportDma, ImportEgl, ImportMemWl,
},
winit::{WinitError, WinitEvent, WinitGraphicsBackend},
winit::{WinitEvent, WinitGraphicsBackend},
},
desktop::{
layer_map_for_output,
@ -27,7 +27,7 @@ use smithay::{
wp::presentation_time::server::wp_presentation_feedback,
xdg::shell::server::xdg_toplevel,
},
wayland_server::{protocol::wl_surface::WlSurface, Display},
wayland_server::{protocol::wl_surface::WlSurface, Display}, winit::platform::pump_events::PumpStatus,
},
utils::{IsAlive, Transform},
wayland::dmabuf::{DmabufFeedback, DmabufFeedbackBuilder, DmabufGlobal, DmabufState},
@ -83,7 +83,7 @@ pub fn run_winit() -> anyhow::Result<()> {
};
let mode = smithay::output::Mode {
size: winit_backend.window_size().physical_size,
size: winit_backend.window_size(),
refresh: 144_000,
};
@ -199,7 +199,7 @@ pub fn run_winit() -> anyhow::Result<()> {
.insert_source(Timer::immediate(), move |_instant, _metadata, data| {
let state = &mut data.state;
let result = winit_evt_loop.dispatch_new_events(|event| match event {
let status = winit_evt_loop.dispatch_new_events(|event| match event {
WinitEvent::Resized {
size,
scale_factor: _,
@ -221,17 +221,17 @@ pub fn run_winit() -> anyhow::Result<()> {
WinitEvent::Input(input_evt) => {
state.process_input_event(input_evt);
}
WinitEvent::Refresh => {
WinitEvent::Redraw => {
state.render_winit_window(&output);
}
WinitEvent::CloseRequested => {
state.loop_signal.stop();
},
});
match result {
Ok(_) => {}
Err(WinitError::WindowClosed) => {
state.loop_signal.stop();
}
};
if let PumpStatus::Exit(_) = status {
state.loop_signal.stop();
}
state.render_winit_window(&output);

View file

@ -49,7 +49,7 @@ impl PointerGrab<State> for MoveSurfaceGrab {
handle.motion(state, None, event);
if !self.window.alive() {
handle.unset_grab(state, event.serial, event.time);
handle.unset_grab(state, event.serial, event.time, true);
return;
}
@ -168,7 +168,7 @@ impl PointerGrab<State> for MoveSurfaceGrab {
handle.button(data, event);
if !handle.current_pressed().contains(&self.button_used) {
handle.unset_grab(data, event.serial, event.time);
handle.unset_grab(data, event.serial, event.time, true);
}
}

View file

@ -97,7 +97,7 @@ impl PointerGrab<State> for ResizeSurfaceGrab {
handle.motion(data, None, event);
if !self.window.alive() {
handle.unset_grab(data, event.serial, event.time);
handle.unset_grab(data, event.serial, event.time, true);
return;
}
@ -201,7 +201,7 @@ impl PointerGrab<State> for ResizeSurfaceGrab {
handle.button(data, event);
if !handle.current_pressed().contains(&self.button_used) {
handle.unset_grab(data, event.serial, event.time);
handle.unset_grab(data, event.serial, event.time, true);
if !self.window.alive() {
return;

View file

@ -365,21 +365,21 @@ impl State {
let horizontal_amount = event
.amount(Axis::Horizontal)
.unwrap_or_else(|| event.amount_discrete(Axis::Horizontal).unwrap_or(0.0) * 3.0);
.unwrap_or_else(|| event.amount_v120(Axis::Horizontal).unwrap_or(0.0) * 3.0 / 120.);
let vertical_amount = event
.amount(Axis::Vertical)
.unwrap_or_else(|| event.amount_discrete(Axis::Vertical).unwrap_or(0.0) * 3.0);
.unwrap_or_else(|| event.amount_v120(Axis::Vertical).unwrap_or(0.0) * 3.0 / 120.);
let horizontal_amount_discrete = event.amount_discrete(Axis::Horizontal);
let vertical_amount_discrete = event.amount_discrete(Axis::Vertical);
let horizontal_amount_discrete = event.amount_v120(Axis::Horizontal);
let vertical_amount_discrete = event.amount_v120(Axis::Vertical);
let mut frame = AxisFrame::new(event.time_msec()).source(source);
if horizontal_amount != 0.0 {
frame = frame.value(Axis::Horizontal, horizontal_amount);
if let Some(discrete) = horizontal_amount_discrete {
frame = frame.discrete(Axis::Horizontal, discrete as i32);
frame = frame.v120(Axis::Horizontal, discrete as i32);
}
} else if source == AxisSource::Finger {
frame = frame.stop(Axis::Horizontal);
@ -388,7 +388,7 @@ impl State {
if vertical_amount != 0.0 {
frame = frame.value(Axis::Vertical, vertical_amount);
if let Some(discrete) = vertical_amount_discrete {
frame = frame.discrete(Axis::Vertical, discrete as i32);
frame = frame.v120(Axis::Vertical, discrete as i32);
}
} else if source == AxisSource::Finger {
frame = frame.stop(Axis::Vertical);

View file

@ -15,6 +15,7 @@ use clap::Parser;
use tracing_appender::rolling::Rotation;
use tracing_subscriber::{fmt::writer::MakeWriterExt, EnvFilter};
use xdg::BaseDirectories;
use nix::unistd::Uid;
mod api;
mod backend;
@ -83,7 +84,7 @@ fn main() -> anyhow::Result<()> {
let args = Args::parse();
if smithay::reexports::nix::unistd::Uid::effective().is_root() && !args.allow_root {
if Uid::effective().is_root() && !args.allow_root {
println!("You are trying to run Pinnacle as root.\nThis is NOT recommended.\nTo run Pinnacle as root, pass in the --allow-root flag. Again, this is NOT recommended.");
return Ok(());
}

View file

@ -124,8 +124,8 @@ impl State {
// To fix this, I just set the limit to be higher. As Pinnacle is the whole graphical
// environment, I *think* this is ok.
tracing::info!("Trying to raise file descriptor limit...");
if let Err(err) = smithay::reexports::nix::sys::resource::setrlimit(
smithay::reexports::nix::sys::resource::Resource::RLIMIT_NOFILE,
if let Err(err) = nix::sys::resource::setrlimit(
nix::sys::resource::Resource::RLIMIT_NOFILE,
65536,
65536 * 2,
) {
@ -237,7 +237,7 @@ impl State {
loop_signal,
loop_handle,
display_handle: display_handle.clone(),
clock: Clock::<Monotonic>::new()?,
clock: Clock::<Monotonic>::new(),
compositor_state: CompositorState::new::<Self>(&display_handle),
data_device_state: DataDeviceState::new::<Self>(&display_handle),
seat_state,