shell: Add tablet grabs
This commit is contained in:
parent
ca9dd27350
commit
6467f79025
18 changed files with 2262 additions and 391 deletions
|
|
@ -52,10 +52,11 @@ use smithay::{
|
|||
keyboard::KeyboardHandle,
|
||||
keyboard::{FilterResult, KeyboardSource, KeysymHandle, ModifiersState},
|
||||
pointer::{
|
||||
AxisFrame, ButtonEvent, GestureHoldBeginEvent, GestureHoldEndEvent,
|
||||
GesturePinchBeginEvent, GesturePinchEndEvent, GesturePinchUpdateEvent,
|
||||
GestureSwipeBeginEvent, GestureSwipeEndEvent, GestureSwipeUpdateEvent, MotionEvent,
|
||||
PointerGrab, PointerHandle, RelativeMotionEvent,
|
||||
AxisFrame, ButtonEvent as PointerButtonEvent, GestureHoldBeginEvent,
|
||||
GestureHoldEndEvent, GesturePinchBeginEvent, GesturePinchEndEvent,
|
||||
GesturePinchUpdateEvent, GestureSwipeBeginEvent, GestureSwipeEndEvent,
|
||||
GestureSwipeUpdateEvent, MotionEvent as PointerMotionEvent, PointerGrab, PointerHandle,
|
||||
RelativeMotionEvent,
|
||||
},
|
||||
tablet::{TabletDescriptor, TabletSeatTrait, tool},
|
||||
touch::{DownEvent, MotionEvent as TouchMotionEvent, UpEvent},
|
||||
|
|
@ -326,7 +327,7 @@ impl State {
|
|||
}
|
||||
|
||||
InputEvent::PointerMotion { event, .. } => {
|
||||
use smithay::backend::input::PointerMotionEvent;
|
||||
use smithay::backend::input::PointerMotionEvent as _;
|
||||
|
||||
let shell = self.common.shell.write();
|
||||
if let Some(seat) = shell
|
||||
|
|
@ -639,7 +640,7 @@ impl State {
|
|||
ptr.motion(
|
||||
self,
|
||||
under,
|
||||
&MotionEvent {
|
||||
&PointerMotionEvent {
|
||||
location: position.as_logical(),
|
||||
serial,
|
||||
time: event.time(),
|
||||
|
|
@ -754,7 +755,7 @@ impl State {
|
|||
ptr.motion(
|
||||
self,
|
||||
under,
|
||||
&MotionEvent {
|
||||
&PointerMotionEvent {
|
||||
location: position.as_logical(),
|
||||
serial,
|
||||
time: event.time(),
|
||||
|
|
@ -781,9 +782,8 @@ impl State {
|
|||
}
|
||||
}
|
||||
InputEvent::PointerButton { event, .. } => {
|
||||
use smithay::backend::input::{ButtonState, PointerButtonEvent};
|
||||
use smithay::backend::input::{ButtonState, PointerButtonEvent as _};
|
||||
|
||||
//
|
||||
let Some(seat) = self
|
||||
.common
|
||||
.shell
|
||||
|
|
@ -857,7 +857,7 @@ impl State {
|
|||
&& !shortcuts_inhibited
|
||||
{
|
||||
let seat_clone = seat.clone();
|
||||
let mouse_button = PointerButtonEvent::button(&event);
|
||||
let mouse_button = event.button();
|
||||
|
||||
let mut supress_button = || {
|
||||
// If the logo is held then the pointer event is
|
||||
|
|
@ -1017,7 +1017,7 @@ impl State {
|
|||
if pass_event {
|
||||
ptr.button(
|
||||
self,
|
||||
&ButtonEvent {
|
||||
&PointerButtonEvent {
|
||||
button,
|
||||
state: event.state(),
|
||||
serial,
|
||||
|
|
@ -1597,7 +1597,7 @@ impl State {
|
|||
pointer.motion(
|
||||
self,
|
||||
under.clone(),
|
||||
&MotionEvent {
|
||||
&PointerMotionEvent {
|
||||
location: position.as_logical(),
|
||||
serial: SERIAL_COUNTER.next_serial(),
|
||||
time: InputTime::now(),
|
||||
|
|
@ -1626,8 +1626,7 @@ impl State {
|
|||
|
||||
tool.motion(
|
||||
self,
|
||||
under
|
||||
.and_then(|(f, loc)| f.wl_surface().map(|s| (s.into_owned(), loc))),
|
||||
under,
|
||||
&tool::MotionEvent {
|
||||
location: position.as_logical(),
|
||||
serial: SERIAL_COUNTER.next_serial(),
|
||||
|
|
@ -1666,7 +1665,7 @@ impl State {
|
|||
pointer.motion(
|
||||
self,
|
||||
under.clone(),
|
||||
&MotionEvent {
|
||||
&PointerMotionEvent {
|
||||
location: position.as_logical(),
|
||||
serial: SERIAL_COUNTER.next_serial(),
|
||||
time: InputTime::now(),
|
||||
|
|
@ -1698,22 +1697,17 @@ impl State {
|
|||
};
|
||||
|
||||
match event.state() {
|
||||
ProximityState::In => {
|
||||
let under = under.and_then(|(f, loc)| {
|
||||
f.wl_surface().map(|s| (s.into_owned(), loc))
|
||||
});
|
||||
tool.proximity_in(
|
||||
self,
|
||||
under,
|
||||
tablet,
|
||||
&tool::ProximityInEvent {
|
||||
location: position.as_logical(),
|
||||
axis: Some(frame),
|
||||
serial: SERIAL_COUNTER.next_serial(),
|
||||
time: event.time(),
|
||||
},
|
||||
)
|
||||
}
|
||||
ProximityState::In => tool.proximity_in(
|
||||
self,
|
||||
under,
|
||||
tablet,
|
||||
&tool::ProximityInEvent {
|
||||
location: position.as_logical(),
|
||||
axis: Some(frame),
|
||||
serial: SERIAL_COUNTER.next_serial(),
|
||||
time: event.time(),
|
||||
},
|
||||
),
|
||||
ProximityState::Out => tool.proximity_out(
|
||||
self,
|
||||
&tool::ProximityOutEvent {
|
||||
|
|
@ -1728,6 +1722,18 @@ impl State {
|
|||
}
|
||||
}
|
||||
InputEvent::TabletToolTip { event, .. } => {
|
||||
{
|
||||
let mut shell = self.common.shell.write();
|
||||
if let Some(Trigger::Tool(desc, trigger)) =
|
||||
shell.overview_mode().0.active_trigger()
|
||||
&& event.tool() == *desc
|
||||
&& matches!(*trigger, tool::GrabTrigger::Tip)
|
||||
&& event.tip_state() == TabletToolTipState::Up
|
||||
{
|
||||
shell.set_overview_mode(None, self.common.event_loop_handle.clone());
|
||||
}
|
||||
}
|
||||
|
||||
let maybe_seat = self
|
||||
.common
|
||||
.shell
|
||||
|
|
@ -2968,7 +2974,7 @@ impl State {
|
|||
pointer.motion(
|
||||
self,
|
||||
under,
|
||||
&MotionEvent {
|
||||
&PointerMotionEvent {
|
||||
location: point.as_logical(),
|
||||
serial,
|
||||
time,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue