Update smithay with tablet API changes
For now, only `WlSurface` receives tablet focus, as was previously the case. Also updates `reis` to latest bugfix release.
This commit is contained in:
parent
0cf70521ff
commit
18ae082615
4 changed files with 119 additions and 63 deletions
41
Cargo.lock
generated
41
Cargo.lock
generated
|
|
@ -1275,7 +1275,7 @@ checksum = "80bc8c5c6c2941f70a55c15f8d9f00f9710ebda3ffda98075f996a0e6c92756f"
|
|||
dependencies = [
|
||||
"bitflags 2.11.0",
|
||||
"bytemuck",
|
||||
"drm-ffi 0.9.0",
|
||||
"drm-ffi 0.9.1",
|
||||
"drm-fourcc",
|
||||
"libc",
|
||||
"rustix 0.38.44",
|
||||
|
|
@ -1293,12 +1293,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "drm-ffi"
|
||||
version = "0.9.0"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d8e41459d99a9b529845f6d2c909eb9adf3b6d2f82635ae40be8de0601726e8b"
|
||||
checksum = "51a91c9b32ac4e8105dec255e849e0d66e27d7c34d184364fb93e469db08f690"
|
||||
dependencies = [
|
||||
"drm-sys 0.8.0",
|
||||
"rustix 0.38.44",
|
||||
"drm-sys 0.8.1",
|
||||
"rustix 1.1.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1319,12 +1319,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "drm-sys"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bafb66c8dbc944d69e15cfcc661df7e703beffbaec8bd63151368b06c5f9858c"
|
||||
checksum = "ecc8e1361066d91f5ffccff060a3c3be9c3ecde15be2959c1937595f7a82a9f8"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"linux-raw-sys 0.6.5",
|
||||
"linux-raw-sys 0.9.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1502,7 +1502,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -2689,7 +2689,7 @@ dependencies = [
|
|||
"portable-atomic",
|
||||
"portable-atomic-util",
|
||||
"serde_core",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3060,6 +3060,12 @@ version = "0.6.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2a385b1be4e5c3e362ad2ffa73c392e53f031eaa5b7d648e64cd87f27f6063d7"
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12"
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.12.1"
|
||||
|
|
@ -4348,9 +4354,9 @@ checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a"
|
|||
|
||||
[[package]]
|
||||
name = "reis"
|
||||
version = "0.7.0"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81f3fedd2777cde52c1be5e572efbec485eac7b801c47820eda388d4f13b9c4b"
|
||||
checksum = "4b967ec6489a42067a20724f11987bb96178ea796873cbe1afd25fb93ee6f85f"
|
||||
dependencies = [
|
||||
"calloop",
|
||||
"enumflags2",
|
||||
|
|
@ -4518,7 +4524,7 @@ dependencies = [
|
|||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys 0.12.1",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -4813,7 +4819,7 @@ checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
|
|||
[[package]]
|
||||
name = "smithay"
|
||||
version = "0.7.0"
|
||||
source = "git+https://github.com/smithay/smithay.git?rev=cdc03f7#cdc03f73ce57d3352c0c57a69971e3e16544051c"
|
||||
source = "git+https://github.com/smithay/smithay.git?rev=5fb12b8#5fb12b87407b3680135c45d94214c5f1b1d0fbea"
|
||||
dependencies = [
|
||||
"aliasable",
|
||||
"appendlist",
|
||||
|
|
@ -4824,8 +4830,9 @@ dependencies = [
|
|||
"cursor-icon",
|
||||
"downcast-rs",
|
||||
"drm 0.14.1",
|
||||
"drm-ffi 0.9.0",
|
||||
"drm-ffi 0.9.1",
|
||||
"drm-fourcc",
|
||||
"drm-sys 0.8.1",
|
||||
"encoding_rs",
|
||||
"errno",
|
||||
"gbm",
|
||||
|
|
@ -5107,7 +5114,7 @@ dependencies = [
|
|||
"getrandom 0.4.1",
|
||||
"once_cell",
|
||||
"rustix 1.1.4",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -5406,7 +5413,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "c5f7c95348f20c1c913d72157b3c6dee6ea3e30b3d19502c5a7f6d3f160dacbf"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"windows-targets 0.52.6",
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
|||
|
|
@ -144,4 +144,4 @@ lto = "fat"
|
|||
cosmic-protocols = { git = "https://github.com/pop-os//cosmic-protocols", branch = "main" }
|
||||
|
||||
[patch.crates-io]
|
||||
smithay = { git = "https://github.com/smithay/smithay.git", rev = "cdc03f7" }
|
||||
smithay = { git = "https://github.com/smithay/smithay.git", rev = "5fb12b8" }
|
||||
|
|
|
|||
135
src/input/mod.rs
135
src/input/mod.rs
|
|
@ -56,6 +56,7 @@ use smithay::{
|
|||
GestureSwipeBeginEvent, GestureSwipeEndEvent, GestureSwipeUpdateEvent, MotionEvent,
|
||||
PointerGrab, PointerHandle, RelativeMotionEvent,
|
||||
},
|
||||
tablet::{TabletDescriptor, TabletSeatTrait, tool},
|
||||
touch::{DownEvent, MotionEvent as TouchMotionEvent, UpEvent},
|
||||
},
|
||||
output::Output,
|
||||
|
|
@ -70,7 +71,6 @@ use smithay::{
|
|||
keyboard_shortcuts_inhibit::KeyboardShortcutsInhibitorSeat,
|
||||
pointer_constraints::{PointerConstraint, with_pointer_constraint},
|
||||
seat::WaylandFocus,
|
||||
tablet_manager::{TabletDescriptor, TabletSeatTrait},
|
||||
},
|
||||
};
|
||||
use tracing::{error, trace};
|
||||
|
|
@ -179,7 +179,7 @@ impl State {
|
|||
let led_state = seat.get_keyboard().unwrap().led_state();
|
||||
seat.devices().add_device(&device, led_state);
|
||||
if device.has_capability(DeviceCapability::TabletTool) {
|
||||
seat.tablet_seat().add_tablet::<Self>(
|
||||
seat.tablet_seat().add_wp_tablet(
|
||||
&self.common.display_handle,
|
||||
&TabletDescriptor::from(&device),
|
||||
);
|
||||
|
|
@ -1441,37 +1441,36 @@ impl State {
|
|||
|
||||
let tablet_seat = seat.tablet_seat();
|
||||
|
||||
let tablet = tablet_seat.get_tablet(&TabletDescriptor::from(&event.device()));
|
||||
let tool = tablet_seat.get_tool(&event.tool());
|
||||
|
||||
if let (Some(tablet), Some(tool)) = (tablet, tool) {
|
||||
if event.pressure_has_changed() {
|
||||
tool.pressure(event.pressure());
|
||||
}
|
||||
if event.distance_has_changed() {
|
||||
tool.distance(event.distance());
|
||||
}
|
||||
if event.tilt_has_changed() {
|
||||
tool.tilt(event.tilt());
|
||||
}
|
||||
if event.slider_has_changed() {
|
||||
tool.slider_position(event.slider_position());
|
||||
}
|
||||
if event.rotation_has_changed() {
|
||||
tool.rotation(event.rotation());
|
||||
}
|
||||
if event.wheel_has_changed() {
|
||||
tool.wheel(event.wheel_delta(), event.wheel_delta_discrete());
|
||||
}
|
||||
if let Some(tool) = tool {
|
||||
let frame = tool::AxisFrame {
|
||||
pressure: event.pressure_has_changed().then(|| event.pressure()),
|
||||
distance: event.distance_has_changed().then(|| event.distance()),
|
||||
|
||||
tilt: event.tilt_has_changed().then(|| event.tilt()),
|
||||
rotation: event.rotation_has_changed().then(|| event.rotation()),
|
||||
|
||||
slider: event.slider_has_changed().then(|| event.slider_position()),
|
||||
wheel: event
|
||||
.wheel_has_changed()
|
||||
.then(|| (event.wheel_delta(), event.wheel_delta_discrete())),
|
||||
};
|
||||
|
||||
tool.axis(self, frame);
|
||||
|
||||
tool.motion(
|
||||
position.as_logical(),
|
||||
self,
|
||||
under
|
||||
.and_then(|(f, loc)| f.wl_surface().map(|s| (s.into_owned(), loc))),
|
||||
&tablet,
|
||||
SERIAL_COUNTER.next_serial(),
|
||||
event.time_msec(),
|
||||
&tool::MotionEvent {
|
||||
location: position.as_logical(),
|
||||
serial: SERIAL_COUNTER.next_serial(),
|
||||
time: event.time_msec(),
|
||||
},
|
||||
);
|
||||
|
||||
tool.frame(self, event.time_msec());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1509,25 +1508,53 @@ impl State {
|
|||
|
||||
let tablet = tablet_seat.get_tablet(&TabletDescriptor::from(&event.device()));
|
||||
let dh = self.common.display_handle.clone();
|
||||
let tool = tablet_seat.add_tool::<Self>(self, &dh, &event.tool());
|
||||
let tool = tablet_seat
|
||||
.get_tool(&event.tool())
|
||||
.unwrap_or_else(|| tablet_seat.add_wp_tool(self, &dh, &event.tool()));
|
||||
|
||||
if let Some(tablet) = tablet {
|
||||
let serial = SERIAL_COUNTER.next_serial();
|
||||
|
||||
let frame = tool::AxisFrame {
|
||||
pressure: event.pressure_has_changed().then(|| event.pressure()),
|
||||
distance: event.distance_has_changed().then(|| event.distance()),
|
||||
|
||||
tilt: event.tilt_has_changed().then(|| event.tilt()),
|
||||
rotation: event.rotation_has_changed().then(|| event.rotation()),
|
||||
|
||||
slider: event.slider_has_changed().then(|| event.slider_position()),
|
||||
wheel: event
|
||||
.wheel_has_changed()
|
||||
.then(|| (event.wheel_delta(), event.wheel_delta_discrete())),
|
||||
};
|
||||
|
||||
match event.state() {
|
||||
ProximityState::In => {
|
||||
if let Some(under) = under.and_then(|(f, loc)| {
|
||||
let under = under.and_then(|(f, loc)| {
|
||||
f.wl_surface().map(|s| (s.into_owned(), loc))
|
||||
}) {
|
||||
tool.proximity_in(
|
||||
position.as_logical(),
|
||||
under,
|
||||
&tablet,
|
||||
SERIAL_COUNTER.next_serial(),
|
||||
event.time_msec(),
|
||||
)
|
||||
}
|
||||
});
|
||||
tool.proximity_in(
|
||||
self,
|
||||
under,
|
||||
tablet,
|
||||
&tool::ProximityInEvent {
|
||||
location: position.as_logical(),
|
||||
axis: Some(frame),
|
||||
serial: SERIAL_COUNTER.next_serial(),
|
||||
time: event.time_msec(),
|
||||
},
|
||||
)
|
||||
}
|
||||
ProximityState::Out => tool.proximity_out(event.time_msec()),
|
||||
ProximityState::Out => tool.proximity_out(
|
||||
self,
|
||||
&tool::ProximityOutEvent {
|
||||
serial,
|
||||
time: event.time_msec(),
|
||||
},
|
||||
),
|
||||
}
|
||||
|
||||
tool.frame(self, event.time_msec());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1543,14 +1570,29 @@ impl State {
|
|||
self.common.idle_notifier_state.notify_activity(&seat);
|
||||
notify_cursor_activity(self, &seat);
|
||||
if let Some(tool) = seat.tablet_seat().get_tool(&event.tool()) {
|
||||
let serial = SERIAL_COUNTER.next_serial();
|
||||
match event.tip_state() {
|
||||
TabletToolTipState::Down => {
|
||||
tool.tip_down(SERIAL_COUNTER.next_serial(), event.time_msec());
|
||||
tool.down(
|
||||
self,
|
||||
&tool::DownEvent {
|
||||
serial,
|
||||
time: event.time_msec(),
|
||||
},
|
||||
);
|
||||
}
|
||||
TabletToolTipState::Up => {
|
||||
tool.tip_up(event.time_msec());
|
||||
tool.up(
|
||||
self,
|
||||
&tool::UpEvent {
|
||||
serial,
|
||||
time: event.time_msec(),
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
tool.frame(self, event.time_msec());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1567,11 +1609,16 @@ impl State {
|
|||
notify_cursor_activity(self, &seat);
|
||||
if let Some(tool) = seat.tablet_seat().get_tool(&event.tool()) {
|
||||
tool.button(
|
||||
event.button(),
|
||||
event.button_state(),
|
||||
SERIAL_COUNTER.next_serial(),
|
||||
event.time_msec(),
|
||||
self,
|
||||
&tool::ButtonEvent {
|
||||
button: event.button(),
|
||||
state: event.button_state(),
|
||||
serial: SERIAL_COUNTER.next_serial(),
|
||||
time: event.time_msec(),
|
||||
},
|
||||
);
|
||||
|
||||
tool.frame(self, event.time_msec());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,12 @@
|
|||
use crate::state::State;
|
||||
use smithay::{
|
||||
backend::input::TabletToolDescriptor, input::pointer::CursorImageStatus,
|
||||
wayland::tablet_manager::TabletSeatHandler,
|
||||
input::tablet::TabletSeatHandler, reexports::wayland_server::protocol::wl_surface,
|
||||
};
|
||||
|
||||
impl TabletSeatHandler for State {
|
||||
type ToolFocus = wl_surface::WlSurface;
|
||||
|
||||
fn tablet_tool_image(&mut self, _tool: &TabletToolDescriptor, _image: CursorImageStatus) {
|
||||
// TODO display cursor for each tablet tool
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue