mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2024-12-26 21:58:10 +01:00
Update smithay
WARNING: anything that uses pointer-constraints will probably crash the compositor on this commit, use the next one
This commit is contained in:
parent
a9d9a38e9d
commit
7d6c1a25a7
12 changed files with 189 additions and 103 deletions
120
Cargo.lock
generated
120
Cargo.lock
generated
|
@ -1171,18 +1171,42 @@ checksum = "98888c4bbd601524c11a7ed63f814b8825f420514f78e96f752c437ae9cbb5d1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.6.0",
|
"bitflags 2.6.0",
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"drm-ffi",
|
"drm-ffi 0.8.0",
|
||||||
"drm-fourcc",
|
"drm-fourcc",
|
||||||
"rustix",
|
"rustix",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "drm"
|
||||||
|
version = "0.14.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "80bc8c5c6c2941f70a55c15f8d9f00f9710ebda3ffda98075f996a0e6c92756f"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.6.0",
|
||||||
|
"bytemuck",
|
||||||
|
"drm-ffi 0.9.0",
|
||||||
|
"drm-fourcc",
|
||||||
|
"libc",
|
||||||
|
"rustix",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "drm-ffi"
|
name = "drm-ffi"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "97c98727e48b7ccb4f4aea8cfe881e5b07f702d17b7875991881b41af7278d53"
|
checksum = "97c98727e48b7ccb4f4aea8cfe881e5b07f702d17b7875991881b41af7278d53"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"drm-sys",
|
"drm-sys 0.7.0",
|
||||||
|
"rustix",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "drm-ffi"
|
||||||
|
version = "0.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d8e41459d99a9b529845f6d2c909eb9adf3b6d2f82635ae40be8de0601726e8b"
|
||||||
|
dependencies = [
|
||||||
|
"drm-sys 0.8.0",
|
||||||
"rustix",
|
"rustix",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1203,10 +1227,14 @@ dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "edid-rs"
|
name = "drm-sys"
|
||||||
version = "0.1.0"
|
version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2ab5fa33485cd85ac354df485819a63360fefa312fe04cffe65e6f175be1522c"
|
checksum = "bafb66c8dbc944d69e15cfcc661df7e703beffbaec8bd63151368b06c5f9858c"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"linux-raw-sys 0.6.5",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "either"
|
name = "either"
|
||||||
|
@ -1512,12 +1540,12 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gbm"
|
name = "gbm"
|
||||||
version = "0.15.0"
|
version = "0.18.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "45bf55ba6dd53ad0ac115046ff999c5324c283444ee6e0be82454c4e8eb2f36a"
|
checksum = "ce852e998d3ca5e4a97014fb31c940dc5ef344ec7d364984525fd11e8a547e6a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.6.0",
|
"bitflags 2.6.0",
|
||||||
"drm",
|
"drm 0.14.1",
|
||||||
"drm-fourcc",
|
"drm-fourcc",
|
||||||
"gbm-sys",
|
"gbm-sys",
|
||||||
"libc",
|
"libc",
|
||||||
|
@ -1527,9 +1555,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gbm-sys"
|
name = "gbm-sys"
|
||||||
version = "0.3.1"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a9cc2f64de9fa707b5c6b2d2f10d7a7e49e845018a9f5685891eb40d3bab2538"
|
checksum = "c13a5f2acc785d8fb6bf6b7ab6bfb0ef5dad4f4d97e8e70bb8e470722312f76f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
@ -2119,7 +2147,7 @@ dependencies = [
|
||||||
"bitflags 2.6.0",
|
"bitflags 2.6.0",
|
||||||
"input-sys",
|
"input-sys",
|
||||||
"libc",
|
"libc",
|
||||||
"udev 0.9.1",
|
"udev",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2265,6 +2293,36 @@ version = "0.2.168"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d"
|
checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libdisplay-info"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bb6dd47a677df2378a8bb88d08a593f51e8dddf4b61d2db5f2ceb35e67f9389d"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.6.0",
|
||||||
|
"libc",
|
||||||
|
"libdisplay-info-derive",
|
||||||
|
"libdisplay-info-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"thiserror 1.0.69",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libdisplay-info-derive"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ea1cd31036b732a546d845f9485c56b1b606b5e476b0821c680dd66c8cd6fcee"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.90",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libdisplay-info-sys"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ea8cec1fa7872b621f40c756bc1304b1a975461282e250b0e76737b037c0c236"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libdisplay-info-sys"
|
name = "libdisplay-info-sys"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
@ -3136,10 +3194,10 @@ dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"cliclack",
|
"cliclack",
|
||||||
"dircpy",
|
"dircpy",
|
||||||
"drm-sys",
|
"drm-sys 0.8.0",
|
||||||
"gag",
|
"gag",
|
||||||
"indexmap 2.7.0",
|
"indexmap 2.7.0",
|
||||||
"libdisplay-info-sys",
|
"libdisplay-info-sys 0.1.0 (git+https://github.com/Smithay/libdisplay-info-rs?rev=a482d0d)",
|
||||||
"pinnacle",
|
"pinnacle",
|
||||||
"pinnacle-api",
|
"pinnacle-api",
|
||||||
"pinnacle-api-defs",
|
"pinnacle-api-defs",
|
||||||
|
@ -3642,12 +3700,6 @@ dependencies = [
|
||||||
"winapi-util",
|
"winapi-util",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "scan_fmt"
|
|
||||||
version = "0.2.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0b53b0a5db882a8e2fdaae0a43f7b39e7e9082389e978398bdf223a55b581248"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "scoped-tls"
|
name = "scoped-tls"
|
||||||
version = "1.0.1"
|
version = "1.0.1"
|
||||||
|
@ -3819,7 +3871,7 @@ checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smithay"
|
name = "smithay"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "git+https://github.com/Smithay/smithay?rev=e7f0857#e7f08570bceab6107863267ae168d0afb018e8f5"
|
source = "git+https://github.com/Smithay/smithay?rev=0f32e8d#0f32e8d1f9e034c96f7c43a3373f1ce79a76553b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"appendlist",
|
"appendlist",
|
||||||
"bitflags 2.6.0",
|
"bitflags 2.6.0",
|
||||||
|
@ -3828,8 +3880,8 @@ dependencies = [
|
||||||
"cgmath",
|
"cgmath",
|
||||||
"cursor-icon",
|
"cursor-icon",
|
||||||
"downcast-rs",
|
"downcast-rs",
|
||||||
"drm",
|
"drm 0.14.1",
|
||||||
"drm-ffi",
|
"drm-ffi 0.9.0",
|
||||||
"drm-fourcc",
|
"drm-fourcc",
|
||||||
"encoding_rs",
|
"encoding_rs",
|
||||||
"errno",
|
"errno",
|
||||||
|
@ -3837,7 +3889,6 @@ dependencies = [
|
||||||
"gl_generator",
|
"gl_generator",
|
||||||
"indexmap 2.7.0",
|
"indexmap 2.7.0",
|
||||||
"input",
|
"input",
|
||||||
"lazy_static",
|
|
||||||
"libc",
|
"libc",
|
||||||
"libloading 0.8.6",
|
"libloading 0.8.6",
|
||||||
"libseat",
|
"libseat",
|
||||||
|
@ -3846,13 +3897,12 @@ dependencies = [
|
||||||
"profiling",
|
"profiling",
|
||||||
"rand",
|
"rand",
|
||||||
"rustix",
|
"rustix",
|
||||||
"scan_fmt",
|
|
||||||
"scopeguard",
|
"scopeguard",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"thiserror 1.0.69",
|
"thiserror 1.0.69",
|
||||||
"tracing",
|
"tracing",
|
||||||
"udev 0.8.0",
|
"udev",
|
||||||
"wayland-backend",
|
"wayland-backend",
|
||||||
"wayland-client",
|
"wayland-client",
|
||||||
"wayland-cursor",
|
"wayland-cursor",
|
||||||
|
@ -3934,10 +3984,10 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smithay-drm-extras"
|
name = "smithay-drm-extras"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/Smithay/smithay?rev=e7f0857#e7f08570bceab6107863267ae168d0afb018e8f5"
|
source = "git+https://github.com/Smithay/smithay?rev=0f32e8d#0f32e8d1f9e034c96f7c43a3373f1ce79a76553b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"drm",
|
"drm 0.14.1",
|
||||||
"edid-rs",
|
"libdisplay-info",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -4022,7 +4072,7 @@ dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"cfg_aliases 0.2.1",
|
"cfg_aliases 0.2.1",
|
||||||
"core-graphics 0.24.0",
|
"core-graphics 0.24.0",
|
||||||
"drm",
|
"drm 0.12.0",
|
||||||
"fastrand",
|
"fastrand",
|
||||||
"foreign-types",
|
"foreign-types",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
|
@ -4646,18 +4696,6 @@ version = "0.25.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31"
|
checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "udev"
|
|
||||||
version = "0.8.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "50051c6e22be28ee6f217d50014f3bc29e81c20dc66ff7ca0d5c5226e1dcc5a1"
|
|
||||||
dependencies = [
|
|
||||||
"io-lifetimes 1.0.11",
|
|
||||||
"libc",
|
|
||||||
"libudev-sys",
|
|
||||||
"pkg-config",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "udev"
|
name = "udev"
|
||||||
version = "0.9.1"
|
version = "0.9.1"
|
||||||
|
|
|
@ -51,7 +51,7 @@ tower = { version = "0.5.2", features = ["util"] }
|
||||||
|
|
||||||
[workspace.dependencies.smithay]
|
[workspace.dependencies.smithay]
|
||||||
git = "https://github.com/Smithay/smithay"
|
git = "https://github.com/Smithay/smithay"
|
||||||
rev = "e7f0857"
|
rev = "0f32e8d"
|
||||||
# path = "../../git/smithay"
|
# path = "../../git/smithay"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = [
|
features = [
|
||||||
|
@ -92,7 +92,7 @@ version = "0.0.1"
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
license = "GPL-3.0+"
|
license = "GPL-3.0+"
|
||||||
description = "A WIP Smithay-based Wayland compositor, inspired by AwesomeWM"
|
description = "A WIP Smithay-based Wayland compositor"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
keywords = ["wayland", "compositor", "smithay", "lua"]
|
keywords = ["wayland", "compositor", "smithay", "lua"]
|
||||||
|
@ -100,7 +100,7 @@ keywords = ["wayland", "compositor", "smithay", "lua"]
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# Smithay
|
# Smithay
|
||||||
smithay = { workspace = true }
|
smithay = { workspace = true }
|
||||||
smithay-drm-extras = { git = "https://github.com/Smithay/smithay", rev = "e7f0857" }
|
smithay-drm-extras = { git = "https://github.com/Smithay/smithay", rev = "0f32e8d" }
|
||||||
# Tracing
|
# Tracing
|
||||||
tracing = { workspace = true }
|
tracing = { workspace = true }
|
||||||
tracing-subscriber = { workspace = true }
|
tracing-subscriber = { workspace = true }
|
||||||
|
@ -135,7 +135,7 @@ chrono = "0.4.39"
|
||||||
bytemuck = "1.20.0"
|
bytemuck = "1.20.0"
|
||||||
pinnacle-api = { path = "./api/rust", default-features = false }
|
pinnacle-api = { path = "./api/rust", default-features = false }
|
||||||
gag = "1.0.0"
|
gag = "1.0.0"
|
||||||
drm-sys = "0.7.0" # TODO: remove and use libdisplay-info
|
drm-sys = "0.8.0" # TODO: remove and use libdisplay-info
|
||||||
libdisplay-info-sys = { git = "https://github.com/Smithay/libdisplay-info-rs", rev = "a482d0d" }
|
libdisplay-info-sys = { git = "https://github.com/Smithay/libdisplay-info-rs", rev = "a482d0d" }
|
||||||
indexmap = { workspace = true }
|
indexmap = { workspace = true }
|
||||||
snowcap = { path = "./snowcap", optional = true }
|
snowcap = { path = "./snowcap", optional = true }
|
||||||
|
|
|
@ -73,6 +73,7 @@ use smithay::{
|
||||||
utils::{DeviceFd, Point, Rectangle, Transform},
|
utils::{DeviceFd, Point, Rectangle, Transform},
|
||||||
wayland::{
|
wayland::{
|
||||||
dmabuf::{self, DmabufFeedback, DmabufFeedbackBuilder, DmabufGlobal, DmabufState},
|
dmabuf::{self, DmabufFeedback, DmabufFeedbackBuilder, DmabufGlobal, DmabufState},
|
||||||
|
presentation::Refresh,
|
||||||
shm::shm_format_to_fourcc,
|
shm::shm_format_to_fourcc,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1221,7 +1222,11 @@ impl Udev {
|
||||||
|
|
||||||
feedback.presented::<_, smithay::utils::Monotonic>(
|
feedback.presented::<_, smithay::utils::Monotonic>(
|
||||||
time,
|
time,
|
||||||
surface.frame_clock.refresh_interval().unwrap_or_default(),
|
surface
|
||||||
|
.frame_clock
|
||||||
|
.refresh_interval()
|
||||||
|
.map(Refresh::Fixed)
|
||||||
|
.unwrap_or(Refresh::Unknown),
|
||||||
seq,
|
seq,
|
||||||
flags,
|
flags,
|
||||||
);
|
);
|
||||||
|
|
|
@ -3,6 +3,8 @@ use std::{num::NonZeroU64, time::Duration};
|
||||||
use smithay::utils::{Clock, Monotonic};
|
use smithay::utils::{Clock, Monotonic};
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
|
||||||
|
// yo i gotta stop copying stuff from niri i don't remember what this is for
|
||||||
|
|
||||||
pub struct FrameClock {
|
pub struct FrameClock {
|
||||||
last_presentation_time: Option<Duration>,
|
last_presentation_time: Option<Duration>,
|
||||||
refresh_interval_ns: Option<NonZeroU64>,
|
refresh_interval_ns: Option<NonZeroU64>,
|
||||||
|
|
|
@ -30,7 +30,10 @@ use smithay::{
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
utils::{Point, Rectangle, Transform},
|
utils::{Point, Rectangle, Transform},
|
||||||
wayland::dmabuf::{self, DmabufFeedback, DmabufFeedbackBuilder, DmabufGlobal, DmabufState},
|
wayland::{
|
||||||
|
dmabuf::{self, DmabufFeedback, DmabufFeedbackBuilder, DmabufGlobal, DmabufState},
|
||||||
|
presentation::Refresh,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
use tracing::{debug, error, trace, warn};
|
use tracing::{debug, error, trace, warn};
|
||||||
|
|
||||||
|
@ -401,8 +404,12 @@ impl Winit {
|
||||||
now,
|
now,
|
||||||
self.output
|
self.output
|
||||||
.current_mode()
|
.current_mode()
|
||||||
.map(|mode| Duration::from_secs_f64(1000f64 / mode.refresh as f64))
|
.map(|mode| {
|
||||||
.unwrap_or_default(),
|
Refresh::Fixed(Duration::from_secs_f64(
|
||||||
|
1000f64 / mode.refresh as f64,
|
||||||
|
))
|
||||||
|
})
|
||||||
|
.unwrap_or(Refresh::Unknown),
|
||||||
0,
|
0,
|
||||||
wp_presentation_feedback::Kind::Vsync,
|
wp_presentation_feedback::Kind::Vsync,
|
||||||
);
|
);
|
||||||
|
|
|
@ -579,7 +579,7 @@ impl ClientDndGrabHandler for State {
|
||||||
self.pinnacle.dnd_icon = icon;
|
self.pinnacle.dnd_icon = icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dropped(&mut self, _seat: Seat<Self>) {
|
fn dropped(&mut self, _target: Option<WlSurface>, _validated: bool, _seat: Seat<Self>) {
|
||||||
self.pinnacle.dnd_icon = None;
|
self.pinnacle.dnd_icon = None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -907,6 +907,15 @@ impl PointerConstraintsHandler for State {
|
||||||
self.pinnacle
|
self.pinnacle
|
||||||
.maybe_activate_pointer_constraint(pointer.current_location());
|
.maybe_activate_pointer_constraint(pointer.current_location());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn cursor_position_hint(
|
||||||
|
&mut self,
|
||||||
|
surface: &WlSurface,
|
||||||
|
pointer: &PointerHandle<Self>,
|
||||||
|
location: Point<f64, Logical>,
|
||||||
|
) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
delegate_pointer_constraints!(State);
|
delegate_pointer_constraints!(State);
|
||||||
|
|
||||||
|
|
11
src/input.rs
11
src/input.rs
|
@ -513,7 +513,8 @@ impl State {
|
||||||
.pinnacle
|
.pinnacle
|
||||||
.input_state
|
.input_state
|
||||||
.no_release_keys
|
.no_release_keys
|
||||||
.contains(&event.key_code())
|
.contains(&event.key_code().into())
|
||||||
|
// TODO: check keycode -> u32
|
||||||
{
|
{
|
||||||
return FilterResult::Intercept(KeyAction::Suppress);
|
return FilterResult::Intercept(KeyAction::Suppress);
|
||||||
}
|
}
|
||||||
|
@ -521,7 +522,9 @@ impl State {
|
||||||
if press_state == KeyState::Pressed {
|
if press_state == KeyState::Pressed {
|
||||||
let mod_mask = ModifierMask::from(modifiers);
|
let mod_mask = ModifierMask::from(modifiers);
|
||||||
|
|
||||||
let raw_sym = keysym.raw_syms().iter().next();
|
// TODO: verify rawsyms are the right thing to do
|
||||||
|
let raw_syms = keysym.raw_syms();
|
||||||
|
let raw_sym = raw_syms.first();
|
||||||
let mod_sym = keysym.modified_sym();
|
let mod_sym = keysym.modified_sym();
|
||||||
|
|
||||||
if let mut vt @ keysyms::KEY_XF86Switch_VT_1..=keysyms::KEY_XF86Switch_VT_12 =
|
if let mut vt @ keysyms::KEY_XF86Switch_VT_1..=keysyms::KEY_XF86Switch_VT_12 =
|
||||||
|
@ -573,7 +576,7 @@ impl State {
|
||||||
self.pinnacle
|
self.pinnacle
|
||||||
.input_state
|
.input_state
|
||||||
.no_release_keys
|
.no_release_keys
|
||||||
.remove(&event.key_code());
|
.remove(&event.key_code().into()); // TODO: check keycode -> u32
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -581,7 +584,7 @@ impl State {
|
||||||
self.pinnacle
|
self.pinnacle
|
||||||
.input_state
|
.input_state
|
||||||
.no_release_keys
|
.no_release_keys
|
||||||
.insert(event.key_code());
|
.insert(event.key_code().into()); // TODO: check keycode -> u32
|
||||||
match action {
|
match action {
|
||||||
KeyAction::CallCallback(sender) => {
|
KeyAction::CallCallback(sender) => {
|
||||||
let _ = sender.send(Ok(SetKeybindResponse {}));
|
let _ = sender.send(Ok(SetKeybindResponse {}));
|
||||||
|
|
|
@ -20,8 +20,8 @@ use smithay::{
|
||||||
use crate::{
|
use crate::{
|
||||||
pinnacle_render_elements,
|
pinnacle_render_elements,
|
||||||
render::{
|
render::{
|
||||||
texture::CommonTextureRenderElement, util::snapshot::RenderSnapshot, AsGlesRenderer,
|
util::{snapshot::RenderSnapshot, surface::WlSurfaceTextureRenderElement},
|
||||||
PRenderer,
|
AsGlesRenderer, PRenderer,
|
||||||
},
|
},
|
||||||
state::{State, WithState},
|
state::{State, WithState},
|
||||||
window::WindowElement,
|
window::WindowElement,
|
||||||
|
@ -31,7 +31,7 @@ use crate::{
|
||||||
const TIMEOUT: Duration = Duration::from_millis(150);
|
const TIMEOUT: Duration = Duration::from_millis(150);
|
||||||
|
|
||||||
/// Type for window snapshots.
|
/// Type for window snapshots.
|
||||||
pub type LayoutSnapshot = RenderSnapshot<CommonTextureRenderElement>;
|
pub type LayoutSnapshot = RenderSnapshot<WlSurfaceTextureRenderElement>;
|
||||||
|
|
||||||
pinnacle_render_elements! {
|
pinnacle_render_elements! {
|
||||||
/// Render elements for an output snapshot
|
/// Render elements for an output snapshot
|
||||||
|
@ -40,7 +40,7 @@ pinnacle_render_elements! {
|
||||||
/// Draw the window itself.
|
/// Draw the window itself.
|
||||||
Window = WaylandSurfaceRenderElement<R>,
|
Window = WaylandSurfaceRenderElement<R>,
|
||||||
/// Draw a snapshot of the window.
|
/// Draw a snapshot of the window.
|
||||||
Snapshot = RescaleRenderElement<CommonTextureRenderElement>,
|
Snapshot = RescaleRenderElement<WlSurfaceTextureRenderElement>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ use smithay::{
|
||||||
utils::{Logical, Point, Scale},
|
utils::{Logical, Point, Scale},
|
||||||
wayland::shell::wlr_layer,
|
wayland::shell::wlr_layer,
|
||||||
};
|
};
|
||||||
|
use util::surface::WlSurfaceTextureRenderElement;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
backend::{udev::UdevRenderer, Backend},
|
backend::{udev::UdevRenderer, Backend},
|
||||||
|
@ -36,8 +37,7 @@ use crate::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use self::{
|
use self::{
|
||||||
pointer::PointerRenderElement, texture::CommonTextureRenderElement,
|
pointer::PointerRenderElement, util::surface::texture_render_elements_from_surface_tree,
|
||||||
util::surface::texture_render_elements_from_surface_tree,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const CLEAR_COLOR: [f32; 4] = [0.6, 0.6, 0.6, 1.0];
|
pub const CLEAR_COLOR: [f32; 4] = [0.6, 0.6, 0.6, 1.0];
|
||||||
|
@ -117,7 +117,7 @@ impl WindowElement {
|
||||||
location: Point<i32, Logical>,
|
location: Point<i32, Logical>,
|
||||||
scale: Scale<f64>,
|
scale: Scale<f64>,
|
||||||
alpha: f32,
|
alpha: f32,
|
||||||
) -> Vec<CommonTextureRenderElement> {
|
) -> Vec<WlSurfaceTextureRenderElement> {
|
||||||
let location = location - self.geometry().loc;
|
let location = location - self.geometry().loc;
|
||||||
let location = location.to_f64().to_physical_precise_round(scale);
|
let location = location.to_f64().to_physical_precise_round(scale);
|
||||||
|
|
||||||
|
@ -139,23 +139,15 @@ impl WindowElement {
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
render_elements.extend(
|
render_elements.extend(popup_render_elements);
|
||||||
popup_render_elements
|
|
||||||
.into_iter()
|
|
||||||
.map(CommonTextureRenderElement::new),
|
|
||||||
);
|
|
||||||
|
|
||||||
render_elements.extend(
|
render_elements.extend(texture_render_elements_from_surface_tree(
|
||||||
texture_render_elements_from_surface_tree(
|
renderer.as_gles_renderer(),
|
||||||
renderer.as_gles_renderer(),
|
surface,
|
||||||
surface,
|
location,
|
||||||
location,
|
scale,
|
||||||
scale,
|
alpha,
|
||||||
alpha,
|
));
|
||||||
)
|
|
||||||
.into_iter()
|
|
||||||
.map(CommonTextureRenderElement::new),
|
|
||||||
);
|
|
||||||
|
|
||||||
render_elements
|
render_elements
|
||||||
}
|
}
|
||||||
|
@ -168,9 +160,6 @@ impl WindowElement {
|
||||||
scale,
|
scale,
|
||||||
alpha,
|
alpha,
|
||||||
)
|
)
|
||||||
.into_iter()
|
|
||||||
.map(CommonTextureRenderElement::new)
|
|
||||||
.collect()
|
|
||||||
} else {
|
} else {
|
||||||
Vec::new()
|
Vec::new()
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,7 +134,7 @@ fn render_elements_to_bound_framebuffer(
|
||||||
.context("failed to start render")?;
|
.context("failed to start render")?;
|
||||||
|
|
||||||
frame
|
frame
|
||||||
.clear([0.0, 0.0, 0.0, 0.0], &[dst_rect])
|
.clear([0.0, 0.0, 0.0, 0.0].into(), &[dst_rect])
|
||||||
.context("failed to clear frame")?;
|
.context("failed to clear frame")?;
|
||||||
|
|
||||||
for elem in elements {
|
for elem in elements {
|
||||||
|
|
|
@ -25,6 +25,7 @@ use crate::render::{AsGlesRenderer, PRenderer};
|
||||||
use crate::state::{Pinnacle, State, WithState};
|
use crate::state::{Pinnacle, State, WithState};
|
||||||
use crate::window::WindowElement;
|
use crate::window::WindowElement;
|
||||||
|
|
||||||
|
use super::surface::WlSurfaceTextureRenderElement;
|
||||||
use super::{render_to_encompassing_texture, EncompassingTexture};
|
use super::{render_to_encompassing_texture, EncompassingTexture};
|
||||||
|
|
||||||
/// A snapshot of given elements that can be rendered at some point in the future.
|
/// A snapshot of given elements that can be rendered at some point in the future.
|
||||||
|
@ -119,7 +120,11 @@ impl<E: RenderElement<GlesRenderer>> RenderSnapshot<E> {
|
||||||
let scale = Scale::from((1.0 / scale.x, 1.0 / scale.y));
|
let scale = Scale::from((1.0 / scale.x, 1.0 / scale.y));
|
||||||
|
|
||||||
Some(SnapshotRenderElement::Snapshot(
|
Some(SnapshotRenderElement::Snapshot(
|
||||||
RescaleRenderElement::from_element(common, loc, scale),
|
RescaleRenderElement::from_element(
|
||||||
|
WlSurfaceTextureRenderElement::Texture(common),
|
||||||
|
loc,
|
||||||
|
scale,
|
||||||
|
),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,11 @@ use smithay::{
|
||||||
backend::renderer::{
|
backend::renderer::{
|
||||||
element::{
|
element::{
|
||||||
self,
|
self,
|
||||||
surface::WaylandSurfaceRenderElement,
|
solid::{SolidColorBuffer, SolidColorRenderElement},
|
||||||
|
surface::{WaylandSurfaceRenderElement, WaylandSurfaceTexture},
|
||||||
texture::{TextureBuffer, TextureRenderElement},
|
texture::{TextureBuffer, TextureRenderElement},
|
||||||
},
|
},
|
||||||
gles::{GlesRenderer, GlesTexture},
|
gles::GlesRenderer,
|
||||||
utils::RendererSurfaceStateUserData,
|
utils::RendererSurfaceStateUserData,
|
||||||
},
|
},
|
||||||
reexports::wayland_server::protocol::wl_surface::WlSurface,
|
reexports::wayland_server::protocol::wl_surface::WlSurface,
|
||||||
|
@ -16,7 +17,17 @@ use smithay::{
|
||||||
};
|
};
|
||||||
use tracing::warn;
|
use tracing::warn;
|
||||||
|
|
||||||
/// Render a surface tree as [TextureRenderElement]s instead of wayland ones.
|
use crate::{pinnacle_render_elements, render::texture::CommonTextureRenderElement};
|
||||||
|
|
||||||
|
pinnacle_render_elements! {
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum WlSurfaceTextureRenderElement {
|
||||||
|
Texture = CommonTextureRenderElement,
|
||||||
|
SolidColor = SolidColorRenderElement,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Render a surface tree as [`WlSurfaceTextureRenderElement`]s instead of wayland ones.
|
||||||
///
|
///
|
||||||
/// Needed to allow WaylandSurfaceRenderElements to be dropped to free shm buffers.
|
/// Needed to allow WaylandSurfaceRenderElements to be dropped to free shm buffers.
|
||||||
pub fn texture_render_elements_from_surface_tree(
|
pub fn texture_render_elements_from_surface_tree(
|
||||||
|
@ -25,10 +36,10 @@ pub fn texture_render_elements_from_surface_tree(
|
||||||
location: impl Into<Point<i32, Physical>>,
|
location: impl Into<Point<i32, Physical>>,
|
||||||
scale: impl Into<Scale<f64>>,
|
scale: impl Into<Scale<f64>>,
|
||||||
alpha: f32,
|
alpha: f32,
|
||||||
) -> Vec<TextureRenderElement<GlesTexture>> {
|
) -> Vec<WlSurfaceTextureRenderElement> {
|
||||||
let location = location.into().to_f64();
|
let location = location.into().to_f64();
|
||||||
let scale = scale.into();
|
let scale = scale.into();
|
||||||
let mut surfaces: Vec<TextureRenderElement<GlesTexture>> = Vec::new();
|
let mut surfaces: Vec<WlSurfaceTextureRenderElement> = Vec::new();
|
||||||
|
|
||||||
compositor::with_surface_tree_downward(
|
compositor::with_surface_tree_downward(
|
||||||
surface,
|
surface,
|
||||||
|
@ -80,24 +91,41 @@ pub fn texture_render_elements_from_surface_tree(
|
||||||
let data = data.lock().unwrap();
|
let data = data.lock().unwrap();
|
||||||
let view = data.view().unwrap();
|
let view = data.view().unwrap();
|
||||||
|
|
||||||
let texture_buffer = TextureBuffer::from_texture(
|
match surface.texture() {
|
||||||
renderer,
|
WaylandSurfaceTexture::Texture(texture) => {
|
||||||
surface.texture().clone(),
|
let texture_buffer = TextureBuffer::from_texture(
|
||||||
data.buffer_scale(),
|
renderer,
|
||||||
data.buffer_transform(),
|
texture.clone(),
|
||||||
None,
|
data.buffer_scale(),
|
||||||
);
|
data.buffer_transform(),
|
||||||
|
None,
|
||||||
|
);
|
||||||
|
|
||||||
let texture_elem = TextureRenderElement::from_texture_buffer(
|
let texture_elem = TextureRenderElement::from_texture_buffer(
|
||||||
location,
|
location,
|
||||||
&texture_buffer,
|
&texture_buffer,
|
||||||
Some(alpha),
|
Some(alpha),
|
||||||
Some(view.src),
|
Some(view.src),
|
||||||
Some(view.dst),
|
Some(view.dst),
|
||||||
element::Kind::Unspecified,
|
element::Kind::Unspecified,
|
||||||
);
|
);
|
||||||
|
|
||||||
surfaces.push(texture_elem);
|
surfaces
|
||||||
|
.push(CommonTextureRenderElement::new(texture_elem).into());
|
||||||
|
}
|
||||||
|
WaylandSurfaceTexture::SolidColor(color) => {
|
||||||
|
let solid_color_buffer =
|
||||||
|
SolidColorBuffer::new(view.dst, *color);
|
||||||
|
let solid_color_elem = SolidColorRenderElement::from_buffer(
|
||||||
|
&solid_color_buffer,
|
||||||
|
location.to_i32_round(), // INFO: is this the correct rounding
|
||||||
|
scale,
|
||||||
|
alpha,
|
||||||
|
element::Kind::Unspecified,
|
||||||
|
);
|
||||||
|
surfaces.push(solid_color_elem.into());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Ok(None) => {} // surface is not mapped
|
Ok(None) => {} // surface is not mapped
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
|
Loading…
Reference in a new issue