shell: Add tablet grabs
This commit is contained in:
parent
ca9dd27350
commit
6467f79025
18 changed files with 2262 additions and 391 deletions
|
|
@ -1,13 +1,13 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use crate::state::State;
|
||||
use crate::{shell::focus::target::PointerFocusTarget, state::State};
|
||||
use smithay::{
|
||||
backend::input::TabletToolDescriptor, input::pointer::CursorImageStatus,
|
||||
input::tablet::TabletSeatHandler, reexports::wayland_server::protocol::wl_surface,
|
||||
input::tablet::TabletSeatHandler,
|
||||
};
|
||||
|
||||
impl TabletSeatHandler for State {
|
||||
type ToolFocus = wl_surface::WlSurface;
|
||||
type ToolFocus = PointerFocusTarget;
|
||||
|
||||
fn tablet_tool_image(&mut self, _tool: &TabletToolDescriptor, _image: CursorImageStatus) {
|
||||
// TODO display cursor for each tablet tool
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use crate::{
|
||||
shell::{CosmicSurface, PendingWindow, focus::target::KeyboardFocusTarget, grabs::ReleaseMode},
|
||||
shell::{
|
||||
CosmicSurface, PendingWindow,
|
||||
focus::target::KeyboardFocusTarget,
|
||||
grabs::{GrabType, ReleaseMode},
|
||||
},
|
||||
utils::prelude::*,
|
||||
};
|
||||
use smithay::desktop::layer_map_for_output;
|
||||
use smithay::{
|
||||
backend::input::InputTime,
|
||||
desktop::{
|
||||
PopupGrab, PopupKeyboardGrab, PopupKind, PopupPointerGrab, PopupUngrabStrategy,
|
||||
WindowSurfaceType, find_popup_root_surface,
|
||||
|
|
@ -26,6 +30,7 @@ use smithay::{
|
|||
},
|
||||
},
|
||||
};
|
||||
use smithay::{desktop::layer_map_for_output, input::tablet::TabletSeatTrait};
|
||||
use std::cell::Cell;
|
||||
use tracing::warn;
|
||||
|
||||
|
|
@ -190,12 +195,17 @@ impl XdgShellHandler for State {
|
|||
true,
|
||||
) {
|
||||
std::mem::drop(shell);
|
||||
if grab.is_touch_grab() {
|
||||
seat.get_touch().unwrap().set_grab(self, grab, serial);
|
||||
} else {
|
||||
seat.get_pointer()
|
||||
match grab.grab_type() {
|
||||
GrabType::Touch => seat.get_touch().unwrap().set_grab(self, grab, serial),
|
||||
GrabType::Pointer => seat
|
||||
.get_pointer()
|
||||
.unwrap()
|
||||
.set_grab(self, grab, serial, focus)
|
||||
.set_grab(self, grab, serial, focus),
|
||||
GrabType::TabletTool => seat
|
||||
.tablet_seat()
|
||||
.get_tool(grab.tool().unwrap())
|
||||
.unwrap()
|
||||
.set_grab(self, grab, InputTime::now(), serial, focus),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -218,12 +228,17 @@ impl XdgShellHandler for State {
|
|||
true,
|
||||
) {
|
||||
std::mem::drop(shell);
|
||||
if grab.is_touch_grab() {
|
||||
seat.get_touch().unwrap().set_grab(self, grab, serial)
|
||||
} else {
|
||||
seat.get_pointer()
|
||||
match grab.grab_type() {
|
||||
GrabType::Touch => seat.get_touch().unwrap().set_grab(self, grab, serial),
|
||||
GrabType::Pointer => seat
|
||||
.get_pointer()
|
||||
.unwrap()
|
||||
.set_grab(self, grab, serial, focus)
|
||||
.set_grab(self, grab, serial, focus),
|
||||
GrabType::TabletTool => seat
|
||||
.tablet_seat()
|
||||
.get_tool(grab.tool().unwrap())
|
||||
.unwrap()
|
||||
.set_grab(self, grab, InputTime::now(), serial, focus),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue