Update smithay

This commit is contained in:
Ian Douglas Scott 2023-10-19 12:03:45 -07:00 committed by Victoria Brekenfeld
parent d9e3d60a37
commit 8561ab672b
7 changed files with 49 additions and 55 deletions

35
Cargo.lock generated
View file

@ -376,7 +376,7 @@ dependencies = [
"bitflags 2.4.0",
"log",
"polling",
"rustix 0.38.17",
"rustix 0.38.20",
"slab",
"thiserror",
]
@ -536,6 +536,7 @@ dependencies = [
"indexmap 2.0.2",
"keyframe",
"lazy_static",
"libc",
"libcosmic",
"libsystemd",
"log-panics",
@ -1100,25 +1101,14 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "errno"
version = "0.3.4"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "add4f07d43996f76ef320709726a556a9d4f965d9410d8d0271132d2f8293480"
checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860"
dependencies = [
"errno-dragonfly",
"libc",
"windows-sys 0.48.0",
]
[[package]]
name = "errno-dragonfly"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "etagere"
version = "0.2.8"
@ -2235,9 +2225,9 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8"
[[package]]
name = "libc"
version = "0.2.148"
version = "0.2.149"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b"
checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b"
[[package]]
name = "libcosmic"
@ -2729,7 +2719,6 @@ dependencies = [
"bitflags 2.4.0",
"cfg-if",
"libc",
"memoffset 0.9.0",
]
[[package]]
@ -3245,7 +3234,7 @@ dependencies = [
"cfg-if",
"concurrent-queue",
"pin-project-lite",
"rustix 0.38.17",
"rustix 0.38.20",
"tracing",
"windows-sys 0.48.0",
]
@ -3696,9 +3685,9 @@ dependencies = [
[[package]]
name = "rustix"
version = "0.38.17"
version = "0.38.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f25469e9ae0f3d0047ca8b93fc56843f38e6774f0914a107ff8b41be8be8e0b7"
checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0"
dependencies = [
"bitflags 2.4.0",
"errno",
@ -3896,7 +3885,7 @@ checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a"
[[package]]
name = "smithay"
version = "0.3.0"
source = "git+https://github.com/smithay//smithay?rev=d60b1b83e#d60b1b83e71ae73aecad799025e3ea30e844c229"
source = "git+https://github.com/smithay//smithay?rev=988c94d7e#988c94d7e9db357350b3c43f7f727d5b4b523aa9"
dependencies = [
"appendlist",
"ash",
@ -3910,6 +3899,7 @@ dependencies = [
"drm-ffi",
"drm-fourcc",
"encoding_rs",
"errno",
"gbm",
"gl_generator",
"glow",
@ -3924,6 +3914,7 @@ dependencies = [
"pkg-config",
"profiling",
"rand",
"rustix 0.38.20",
"scan_fmt",
"scopeguard",
"smallvec",
@ -4143,7 +4134,7 @@ dependencies = [
"cfg-if",
"fastrand 2.0.1",
"redox_syscall 0.3.5",
"rustix 0.38.17",
"rustix 0.38.20",
"windows-sys 0.48.0",
]

View file

@ -53,6 +53,7 @@ once_cell = "1.18.0"
i18n-embed = { version = "0.14", features = ["fluent-system", "desktop-requester"] }
i18n-embed-fl = "0.7"
rust-embed = "8.0"
libc = "0.2.149"
[dependencies.id_tree]
git = "https://github.com/Drakulix/id-tree.git"
@ -87,7 +88,7 @@ debug = true
lto = "fat"
[patch."https://github.com/Smithay/smithay.git"]
smithay = { git = "https://github.com/smithay//smithay", rev = "d60b1b83e" }
smithay = { git = "https://github.com/smithay//smithay", rev = "988c94d7e" }
[patch.crates-io]
calloop = { git = "https://github.com/Smithay/calloop", rev = "71b6e633b1" }

View file

@ -16,6 +16,7 @@ use crate::{
use anyhow::{Context, Result};
use cosmic_protocols::screencopy::v1::server::zcosmic_screencopy_session_v1::FailureReason;
use libc::dev_t;
use smithay::{
backend::{
allocator::{
@ -58,7 +59,7 @@ use smithay::{
Device as _,
},
input::{self, Libinput},
nix::{fcntl::OFlag, sys::stat::dev_t},
rustix::fs::OFlags,
wayland_protocols::wp::{
linux_dmabuf::zv1::server::zwp_linux_dmabuf_feedback_v1,
presentation_time::server::wp_presentation_feedback,
@ -82,7 +83,6 @@ use std::{
collections::{HashMap, HashSet},
ffi::CStr,
fmt,
os::unix::io::FromRawFd,
path::PathBuf,
time::Duration,
};
@ -418,23 +418,21 @@ impl State {
return Ok(());
}
let fd = DrmDeviceFd::new(unsafe {
DeviceFd::from_raw_fd(
self.backend
.kms()
.session
.open(
&path,
OFlag::O_RDWR | OFlag::O_CLOEXEC | OFlag::O_NOCTTY | OFlag::O_NONBLOCK,
let fd = DrmDeviceFd::new(DeviceFd::from(
self.backend
.kms()
.session
.open(
&path,
OFlags::RDWR | OFlags::CLOEXEC | OFlags::NOCTTY | OFlags::NONBLOCK,
)
.with_context(|| {
format!(
"Failed to optain file descriptor for drm device: {}",
path.display()
)
.with_context(|| {
format!(
"Failed to optain file descriptor for drm device: {}",
path.display()
)
})?,
)
});
})?,
));
let (drm, notifier) = DrmDevice::new(fd.clone(), false)
.with_context(|| format!("Failed to initialize drm device for: {}", path.display()))?;
let drm_node = DrmNode::from_dev_id(dev)?;

View file

@ -2,7 +2,7 @@
use smithay::reexports::{
calloop::{generic::Generic, Interest, LoopHandle, Mode, PostAction},
nix::{fcntl, unistd},
rustix,
};
use anyhow::{anyhow, Context, Result};
@ -50,20 +50,24 @@ impl From<UnixStream> for StreamWrapper {
}
}
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 flags = rustix::io::fcntl_getfd(fd)?;
rustix::io::fcntl_setfd(fd, flags | rustix::io::FdFlags::CLOEXEC)
}
pub fn setup_socket(handle: LoopHandle<State>, state: &State) -> Result<()> {
if let Ok(fd_num) = std::env::var("COSMIC_SESSION_SOCK") {
if let Ok(fd) = fd_num.parse::<RawFd>() {
// set CLOEXEC
let flags = fcntl::fcntl(fd, fcntl::FcntlArg::F_GETFD);
let result = flags
.map(|f| fcntl::FdFlag::from_bits(f).unwrap() | fcntl::FdFlag::FD_CLOEXEC)
.and_then(|f| fcntl::fcntl(fd, fcntl::FcntlArg::F_SETFD(f)));
let mut session_socket = match result {
let mut session_socket = match unsafe { set_cloexec(fd) } {
// CLOEXEC worked and we can startup with session IPC
Ok(_) => unsafe { UnixStream::from_raw_fd(fd) },
// CLOEXEC didn't work, something is wrong with the fd, just close it
Err(err) => {
let _ = unistd::close(fd);
unsafe { rustix::io::close(fd) };
return Err(err).with_context(|| "Failed to setup session socket");
}
};

View file

@ -545,7 +545,7 @@ impl MoveGrab {
None
};
handle.unset_grab(state, serial, time);
handle.unset_grab(state, serial, time, true);
{
let cursor_state = self.seat.user_data().get::<CursorState>().unwrap();

View file

@ -58,7 +58,7 @@ impl PointerGrab<State> for ResizeSurfaceGrab {
// It is impossible to get `min_size` and `max_size` of dead toplevel, so we return early.
if !self.window.alive() {
handle.unset_grab(data, event.serial, event.time);
handle.unset_grab(data, event.serial, event.time, true);
return;
}
@ -129,7 +129,7 @@ impl PointerGrab<State> for ResizeSurfaceGrab {
handle.button(data, event);
if handle.current_pressed().is_empty() {
// No more buttons are pressed, release the grab.
handle.unset_grab(data, event.serial, event.time);
handle.unset_grab(data, event.serial, event.time, true);
// If toplevel is dead, we can't resize it, so we return early.
if !self.window.alive() {

View file

@ -155,7 +155,7 @@ impl PointerGrab<State> for ResizeForkGrab {
let first_elem = iter.next();
let second_elem = iter.next();
if first_elem.is_none() || second_elem.is_none() {
return handle.unset_grab(data, event.serial, event.time);
return handle.unset_grab(data, event.serial, event.time, true);
};
match tree.get_mut(&self.node).unwrap().data_mut() {
@ -196,7 +196,7 @@ impl PointerGrab<State> for ResizeForkGrab {
let blocker = TilingLayout::update_positions(&output, tree, gaps);
tiling_layer.pending_blockers.extend(blocker);
} else {
handle.unset_grab(data, event.serial, event.time);
handle.unset_grab(data, event.serial, event.time, true);
}
}
}
@ -221,7 +221,7 @@ impl PointerGrab<State> for ResizeForkGrab {
handle.button(data, event);
if handle.current_pressed().is_empty() {
// No more buttons are pressed, release the grab.
handle.unset_grab(data, event.serial, event.time);
handle.unset_grab(data, event.serial, event.time, true);
}
}