input: Rework PointerFocus to operate directly on WlSurface
This commit is contained in:
parent
4579cca6fa
commit
5459f52d5e
12 changed files with 619 additions and 1107 deletions
128
src/input/mod.rs
128
src/input/mod.rs
|
|
@ -5,7 +5,10 @@ use crate::{
|
||||||
config::{xkb_config_to_wl, Action, Config, KeyModifiers, KeyPattern},
|
config::{xkb_config_to_wl, Action, Config, KeyModifiers, KeyPattern},
|
||||||
input::gestures::{GestureState, SwipeAction},
|
input::gestures::{GestureState, SwipeAction},
|
||||||
shell::{
|
shell::{
|
||||||
focus::{target::PointerFocusTarget, FocusDirection},
|
focus::{
|
||||||
|
target::{KeyboardFocusTarget, PointerFocusTarget},
|
||||||
|
FocusDirection,
|
||||||
|
},
|
||||||
grabs::{ResizeEdge, SeatMenuGrabState, SeatMoveGrabState},
|
grabs::{ResizeEdge, SeatMenuGrabState, SeatMoveGrabState},
|
||||||
layout::{
|
layout::{
|
||||||
floating::ResizeGrabMarker,
|
floating::ResizeGrabMarker,
|
||||||
|
|
@ -32,7 +35,10 @@ use smithay::{
|
||||||
TabletToolEvent, TabletToolProximityEvent, TabletToolTipEvent, TabletToolTipState,
|
TabletToolEvent, TabletToolProximityEvent, TabletToolTipEvent, TabletToolTipState,
|
||||||
TouchEvent,
|
TouchEvent,
|
||||||
},
|
},
|
||||||
desktop::{layer_map_for_output, space::SpaceElement, WindowSurfaceType},
|
desktop::{
|
||||||
|
layer_map_for_output, space::SpaceElement, utils::under_from_surface_tree,
|
||||||
|
WindowSurfaceType,
|
||||||
|
},
|
||||||
input::{
|
input::{
|
||||||
keyboard::{FilterResult, KeysymHandle, LedState, XkbConfig},
|
keyboard::{FilterResult, KeysymHandle, LedState, XkbConfig},
|
||||||
pointer::{
|
pointer::{
|
||||||
|
|
@ -726,11 +732,15 @@ impl State {
|
||||||
ptr.frame(self);
|
ptr.frame(self);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if let PointerFocusTarget::Element(element) = surface {
|
if let PointerFocusTarget::WlSurface(surface) = surface {
|
||||||
//if !element.is_in_input_region(&(position.to_i32_round() - *surface_loc).to_f64()) {
|
if under_from_surface_tree(
|
||||||
if !element.is_in_input_region(
|
surface,
|
||||||
&(position.as_logical() - surface_loc.to_f64()),
|
position.as_logical() - surface_loc.to_f64(),
|
||||||
) {
|
(0, 0),
|
||||||
|
WindowSurfaceType::ALL,
|
||||||
|
)
|
||||||
|
.is_some()
|
||||||
|
{
|
||||||
ptr.frame(self);
|
ptr.frame(self);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -907,7 +917,7 @@ impl State {
|
||||||
|
|
||||||
let pos = seat.get_pointer().unwrap().current_location().as_global();
|
let pos = seat.get_pointer().unwrap().current_location().as_global();
|
||||||
let relative_pos = pos.to_local(&output);
|
let relative_pos = pos.to_local(&output);
|
||||||
let mut under = None;
|
let mut under: Option<KeyboardFocusTarget> = None;
|
||||||
|
|
||||||
if let Some(session_lock) = self.common.shell.session_lock.as_ref() {
|
if let Some(session_lock) = self.common.shell.session_lock.as_ref() {
|
||||||
under = session_lock
|
under = session_lock
|
||||||
|
|
@ -968,7 +978,7 @@ impl State {
|
||||||
if !done {
|
if !done {
|
||||||
// Don't check override redirect windows, because we don't set keyboard focus to them explicitly.
|
// Don't check override redirect windows, because we don't set keyboard focus to them explicitly.
|
||||||
// These cases are handled by the XwaylandKeyboardGrab.
|
// These cases are handled by the XwaylandKeyboardGrab.
|
||||||
if let Some((target, _)) =
|
if let Some(target) =
|
||||||
self.common.shell.element_under(pos, &output)
|
self.common.shell.element_under(pos, &output)
|
||||||
{
|
{
|
||||||
under = Some(target);
|
under = Some(target);
|
||||||
|
|
@ -1003,12 +1013,7 @@ impl State {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Common::set_focus(
|
Common::set_focus(self, under.as_ref(), &seat, Some(serial));
|
||||||
self,
|
|
||||||
under.and_then(|target| target.try_into().ok()).as_ref(),
|
|
||||||
&seat,
|
|
||||||
Some(serial),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if let OverviewMode::Started(Trigger::Pointer(action_button), _) =
|
if let OverviewMode::Started(Trigger::Pointer(action_button), _) =
|
||||||
|
|
@ -2291,7 +2296,7 @@ impl State {
|
||||||
if let Some(session_lock) = session_lock {
|
if let Some(session_lock) = session_lock {
|
||||||
return session_lock.surfaces.get(output).map(|surface| {
|
return session_lock.surfaces.get(output).map(|surface| {
|
||||||
(
|
(
|
||||||
PointerFocusTarget::LockSurface(surface.clone()),
|
PointerFocusTarget::WlSurface(surface.wl_surface().clone()),
|
||||||
output_geo.loc,
|
output_geo.loc,
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
@ -2301,24 +2306,33 @@ impl State {
|
||||||
let layers = layer_map_for_output(output);
|
let layers = layer_map_for_output(output);
|
||||||
if let Some(layer) = layers.layer_under(WlrLayer::Overlay, relative_pos.as_logical()) {
|
if let Some(layer) = layers.layer_under(WlrLayer::Overlay, relative_pos.as_logical()) {
|
||||||
let layer_loc = layers.layer_geometry(layer).unwrap().loc;
|
let layer_loc = layers.layer_geometry(layer).unwrap().loc;
|
||||||
if layer
|
if let Some((wl_surface, surface_loc)) = layer.surface_under(
|
||||||
.surface_under(
|
relative_pos.as_logical() - layer_loc.to_f64(),
|
||||||
relative_pos.as_logical() - layer_loc.to_f64(),
|
WindowSurfaceType::ALL,
|
||||||
WindowSurfaceType::ALL,
|
) {
|
||||||
)
|
return Some((
|
||||||
.is_some()
|
wl_surface.into(),
|
||||||
{
|
output_geo.loc + layer_loc.as_global() + surface_loc.as_global(),
|
||||||
return Some((layer.clone().into(), output_geo.loc + layer_loc.as_global()));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(or) = shell.override_redirect_windows.iter().find(|or| {
|
if let Some((surface, geo)) = shell
|
||||||
or.is_in_input_region(
|
.override_redirect_windows
|
||||||
&(global_pos.as_logical() - X11Surface::geometry(*or).loc.to_f64()),
|
.iter()
|
||||||
)
|
.find(|or| {
|
||||||
}) {
|
or.is_in_input_region(
|
||||||
return Some((or.clone().into(), X11Surface::geometry(or).loc.as_global()));
|
&(global_pos.as_logical() - X11Surface::geometry(*or).loc.to_f64()),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.and_then(|or| {
|
||||||
|
or.wl_surface()
|
||||||
|
.map(|surface| (surface, X11Surface::geometry(or).loc.as_global()))
|
||||||
|
})
|
||||||
|
{
|
||||||
|
return Some((surface.into(), geo));
|
||||||
}
|
}
|
||||||
Some((window.clone().into(), output_geo.loc))
|
PointerFocusTarget::under_surface(window, relative_pos.as_logical())
|
||||||
|
.map(|(target, surface_loc)| (target, output_geo.loc + surface_loc.as_global()))
|
||||||
} else {
|
} else {
|
||||||
{
|
{
|
||||||
let layers = layer_map_for_output(output);
|
let layers = layer_map_for_output(output);
|
||||||
|
|
@ -2327,28 +2341,33 @@ impl State {
|
||||||
.or_else(|| layers.layer_under(WlrLayer::Top, relative_pos.as_logical()))
|
.or_else(|| layers.layer_under(WlrLayer::Top, relative_pos.as_logical()))
|
||||||
{
|
{
|
||||||
let layer_loc = layers.layer_geometry(layer).unwrap().loc;
|
let layer_loc = layers.layer_geometry(layer).unwrap().loc;
|
||||||
if layer
|
if let Some((wl_surface, surface_loc)) = layer.surface_under(
|
||||||
.surface_under(
|
relative_pos.as_logical() - layer_loc.to_f64(),
|
||||||
relative_pos.as_logical() - layer_loc.to_f64(),
|
WindowSurfaceType::ALL,
|
||||||
WindowSurfaceType::ALL,
|
) {
|
||||||
)
|
|
||||||
.is_some()
|
|
||||||
{
|
|
||||||
return Some((
|
return Some((
|
||||||
layer.clone().into(),
|
wl_surface.into(),
|
||||||
output_geo.loc + layer_loc.as_global(),
|
output_geo.loc + layer_loc.as_global() + surface_loc.as_global(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(or) = shell.override_redirect_windows.iter().find(|or| {
|
if let Some((surface, geo)) = shell
|
||||||
or.is_in_input_region(
|
.override_redirect_windows
|
||||||
&(global_pos.as_logical() - X11Surface::geometry(*or).loc.to_f64()),
|
.iter()
|
||||||
)
|
.find(|or| {
|
||||||
}) {
|
or.is_in_input_region(
|
||||||
return Some((or.clone().into(), X11Surface::geometry(or).loc.as_global()));
|
&(global_pos.as_logical() - X11Surface::geometry(*or).loc.to_f64()),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.and_then(|or| {
|
||||||
|
or.wl_surface()
|
||||||
|
.map(|surface| (surface, X11Surface::geometry(or).loc.as_global()))
|
||||||
|
})
|
||||||
|
{
|
||||||
|
return Some((surface.into(), geo));
|
||||||
}
|
}
|
||||||
if let Some((target, loc)) = shell.element_under(global_pos, output) {
|
if let Some((target, loc)) = shell.surface_under(global_pos, output) {
|
||||||
return Some((target, loc));
|
return Some((target, loc));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
@ -2358,16 +2377,13 @@ impl State {
|
||||||
.or_else(|| layers.layer_under(WlrLayer::Background, relative_pos.as_logical()))
|
.or_else(|| layers.layer_under(WlrLayer::Background, relative_pos.as_logical()))
|
||||||
{
|
{
|
||||||
let layer_loc = layers.layer_geometry(layer).unwrap().loc;
|
let layer_loc = layers.layer_geometry(layer).unwrap().loc;
|
||||||
if layer
|
if let Some((wl_surface, surface_loc)) = layer.surface_under(
|
||||||
.surface_under(
|
relative_pos.as_logical() - layer_loc.to_f64(),
|
||||||
relative_pos.as_logical() - layer_loc.to_f64(),
|
WindowSurfaceType::ALL,
|
||||||
WindowSurfaceType::ALL,
|
) {
|
||||||
)
|
|
||||||
.is_some()
|
|
||||||
{
|
|
||||||
return Some((
|
return Some((
|
||||||
layer.clone().into(),
|
wl_surface.into(),
|
||||||
output_geo.loc + layer_loc.as_global(),
|
output_geo.loc + layer_loc.as_global() + surface_loc.as_global(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,6 @@ use smithay::{
|
||||||
desktop::{space::SpaceElement, PopupManager, WindowSurfaceType},
|
desktop::{space::SpaceElement, PopupManager, WindowSurfaceType},
|
||||||
input::{
|
input::{
|
||||||
keyboard::{KeyboardTarget, KeysymHandle, ModifiersState},
|
keyboard::{KeyboardTarget, KeysymHandle, ModifiersState},
|
||||||
pointer::{
|
|
||||||
AxisFrame, ButtonEvent, GestureHoldBeginEvent, GestureHoldEndEvent,
|
|
||||||
GesturePinchBeginEvent, GesturePinchEndEvent, GesturePinchUpdateEvent,
|
|
||||||
GestureSwipeBeginEvent, GestureSwipeEndEvent, GestureSwipeUpdateEvent, MotionEvent,
|
|
||||||
PointerTarget, RelativeMotionEvent,
|
|
||||||
},
|
|
||||||
Seat,
|
Seat,
|
||||||
},
|
},
|
||||||
output::Output,
|
output::Output,
|
||||||
|
|
@ -72,7 +66,7 @@ use smithay::backend::renderer::{element::texture::TextureRenderElement, gles::G
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
focus::FocusDirection,
|
focus::{target::PointerFocusTarget, FocusDirection},
|
||||||
layout::{
|
layout::{
|
||||||
floating::{ResizeState, TiledCorners},
|
floating::{ResizeState, TiledCorners},
|
||||||
tiling::NodeDesc,
|
tiling::NodeDesc,
|
||||||
|
|
@ -258,6 +252,20 @@ impl CosmicMapped {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Give the pointer target under a relative offset into this element.
|
||||||
|
///
|
||||||
|
/// Returns Target + Offset relative to the target
|
||||||
|
pub fn focus_under(
|
||||||
|
&self,
|
||||||
|
relative_pos: Point<f64, Logical>,
|
||||||
|
) -> Option<(PointerFocusTarget, Point<i32, Logical>)> {
|
||||||
|
match &self.element {
|
||||||
|
CosmicMappedInternal::Stack(stack) => stack.focus_under(relative_pos),
|
||||||
|
CosmicMappedInternal::Window(window) => window.focus_under(relative_pos),
|
||||||
|
_ => unreachable!(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn handle_move(&self, direction: Direction) -> MoveResult {
|
pub fn handle_move(&self, direction: Direction) -> MoveResult {
|
||||||
if let CosmicMappedInternal::Stack(stack) = &self.element {
|
if let CosmicMappedInternal::Stack(stack) = &self.element {
|
||||||
stack.handle_move(direction)
|
stack.handle_move(direction)
|
||||||
|
|
@ -918,188 +926,6 @@ impl KeyboardTarget<State> for CosmicMapped {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PointerTarget<State> for CosmicMapped {
|
|
||||||
fn enter(&self, seat: &Seat<State>, data: &mut State, event: &MotionEvent) {
|
|
||||||
self.last_cursor_position
|
|
||||||
.lock()
|
|
||||||
.unwrap()
|
|
||||||
.insert(seat.id(), event.location);
|
|
||||||
match &self.element {
|
|
||||||
CosmicMappedInternal::Stack(s) => PointerTarget::enter(s, seat, data, event),
|
|
||||||
CosmicMappedInternal::Window(w) => PointerTarget::enter(w, seat, data, event),
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn motion(&self, seat: &Seat<State>, data: &mut State, event: &MotionEvent) {
|
|
||||||
self.last_cursor_position
|
|
||||||
.lock()
|
|
||||||
.unwrap()
|
|
||||||
.insert(seat.id(), event.location);
|
|
||||||
match &self.element {
|
|
||||||
CosmicMappedInternal::Stack(s) => PointerTarget::motion(s, seat, data, event),
|
|
||||||
CosmicMappedInternal::Window(w) => PointerTarget::motion(w, seat, data, event),
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn relative_motion(&self, seat: &Seat<State>, data: &mut State, event: &RelativeMotionEvent) {
|
|
||||||
match &self.element {
|
|
||||||
CosmicMappedInternal::Stack(s) => PointerTarget::relative_motion(s, seat, data, event),
|
|
||||||
CosmicMappedInternal::Window(w) => PointerTarget::relative_motion(w, seat, data, event),
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn button(&self, seat: &Seat<State>, data: &mut State, event: &ButtonEvent) {
|
|
||||||
match &self.element {
|
|
||||||
CosmicMappedInternal::Stack(s) => PointerTarget::button(s, seat, data, event),
|
|
||||||
CosmicMappedInternal::Window(w) => PointerTarget::button(w, seat, data, event),
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn axis(&self, seat: &Seat<State>, data: &mut State, frame: AxisFrame) {
|
|
||||||
match &self.element {
|
|
||||||
CosmicMappedInternal::Stack(s) => PointerTarget::axis(s, seat, data, frame),
|
|
||||||
CosmicMappedInternal::Window(w) => PointerTarget::axis(w, seat, data, frame),
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn frame(&self, seat: &Seat<State>, data: &mut State) {
|
|
||||||
match &self.element {
|
|
||||||
CosmicMappedInternal::Stack(s) => PointerTarget::frame(s, seat, data),
|
|
||||||
CosmicMappedInternal::Window(w) => PointerTarget::frame(w, seat, data),
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn leave(&self, seat: &Seat<State>, data: &mut State, serial: Serial, time: u32) {
|
|
||||||
self.last_cursor_position.lock().unwrap().remove(&seat.id());
|
|
||||||
match &self.element {
|
|
||||||
CosmicMappedInternal::Stack(s) => PointerTarget::leave(s, seat, data, serial, time),
|
|
||||||
CosmicMappedInternal::Window(w) => PointerTarget::leave(w, seat, data, serial, time),
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn gesture_swipe_begin(
|
|
||||||
&self,
|
|
||||||
seat: &Seat<State>,
|
|
||||||
data: &mut State,
|
|
||||||
event: &GestureSwipeBeginEvent,
|
|
||||||
) {
|
|
||||||
match &self.element {
|
|
||||||
CosmicMappedInternal::Stack(s) => {
|
|
||||||
PointerTarget::gesture_swipe_begin(s, seat, data, event)
|
|
||||||
}
|
|
||||||
CosmicMappedInternal::Window(w) => {
|
|
||||||
PointerTarget::gesture_swipe_begin(w, seat, data, event)
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn gesture_swipe_update(
|
|
||||||
&self,
|
|
||||||
seat: &Seat<State>,
|
|
||||||
data: &mut State,
|
|
||||||
event: &GestureSwipeUpdateEvent,
|
|
||||||
) {
|
|
||||||
match &self.element {
|
|
||||||
CosmicMappedInternal::Stack(s) => {
|
|
||||||
PointerTarget::gesture_swipe_update(s, seat, data, event)
|
|
||||||
}
|
|
||||||
CosmicMappedInternal::Window(w) => {
|
|
||||||
PointerTarget::gesture_swipe_update(w, seat, data, event)
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn gesture_swipe_end(
|
|
||||||
&self,
|
|
||||||
seat: &Seat<State>,
|
|
||||||
data: &mut State,
|
|
||||||
event: &GestureSwipeEndEvent,
|
|
||||||
) {
|
|
||||||
match &self.element {
|
|
||||||
CosmicMappedInternal::Stack(s) => {
|
|
||||||
PointerTarget::gesture_swipe_end(s, seat, data, event)
|
|
||||||
}
|
|
||||||
CosmicMappedInternal::Window(w) => {
|
|
||||||
PointerTarget::gesture_swipe_end(w, seat, data, event)
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn gesture_pinch_begin(
|
|
||||||
&self,
|
|
||||||
seat: &Seat<State>,
|
|
||||||
data: &mut State,
|
|
||||||
event: &GesturePinchBeginEvent,
|
|
||||||
) {
|
|
||||||
match &self.element {
|
|
||||||
CosmicMappedInternal::Stack(s) => {
|
|
||||||
PointerTarget::gesture_pinch_begin(s, seat, data, event)
|
|
||||||
}
|
|
||||||
CosmicMappedInternal::Window(w) => {
|
|
||||||
PointerTarget::gesture_pinch_begin(w, seat, data, event)
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn gesture_pinch_update(
|
|
||||||
&self,
|
|
||||||
seat: &Seat<State>,
|
|
||||||
data: &mut State,
|
|
||||||
event: &GesturePinchUpdateEvent,
|
|
||||||
) {
|
|
||||||
match &self.element {
|
|
||||||
CosmicMappedInternal::Stack(s) => {
|
|
||||||
PointerTarget::gesture_pinch_update(s, seat, data, event)
|
|
||||||
}
|
|
||||||
CosmicMappedInternal::Window(w) => {
|
|
||||||
PointerTarget::gesture_pinch_update(w, seat, data, event)
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn gesture_pinch_end(
|
|
||||||
&self,
|
|
||||||
seat: &Seat<State>,
|
|
||||||
data: &mut State,
|
|
||||||
event: &GesturePinchEndEvent,
|
|
||||||
) {
|
|
||||||
match &self.element {
|
|
||||||
CosmicMappedInternal::Stack(s) => {
|
|
||||||
PointerTarget::gesture_pinch_end(s, seat, data, event)
|
|
||||||
}
|
|
||||||
CosmicMappedInternal::Window(w) => {
|
|
||||||
PointerTarget::gesture_pinch_end(w, seat, data, event)
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn gesture_hold_begin(
|
|
||||||
&self,
|
|
||||||
seat: &Seat<State>,
|
|
||||||
data: &mut State,
|
|
||||||
event: &GestureHoldBeginEvent,
|
|
||||||
) {
|
|
||||||
match &self.element {
|
|
||||||
CosmicMappedInternal::Stack(s) => {
|
|
||||||
PointerTarget::gesture_hold_begin(s, seat, data, event)
|
|
||||||
}
|
|
||||||
CosmicMappedInternal::Window(w) => {
|
|
||||||
PointerTarget::gesture_hold_begin(w, seat, data, event)
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn gesture_hold_end(&self, seat: &Seat<State>, data: &mut State, event: &GestureHoldEndEvent) {
|
|
||||||
match &self.element {
|
|
||||||
CosmicMappedInternal::Stack(s) => PointerTarget::gesture_hold_end(s, seat, data, event),
|
|
||||||
CosmicMappedInternal::Window(w) => {
|
|
||||||
PointerTarget::gesture_hold_end(w, seat, data, event)
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl WaylandFocus for CosmicMapped {
|
impl WaylandFocus for CosmicMapped {
|
||||||
fn wl_surface(&self) -> Option<WlSurface> {
|
fn wl_surface(&self) -> Option<WlSurface> {
|
||||||
match &self.element {
|
match &self.element {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use super::{surface::RESIZE_BORDER, CosmicSurface};
|
||||||
use crate::{
|
use crate::{
|
||||||
backend::render::cursor::{CursorShape, CursorState},
|
backend::render::cursor::{CursorShape, CursorState},
|
||||||
shell::{
|
shell::{
|
||||||
focus::FocusDirection,
|
focus::{target::PointerFocusTarget, FocusDirection},
|
||||||
grabs::{ReleaseMode, ResizeEdge},
|
grabs::{ReleaseMode, ResizeEdge},
|
||||||
layout::tiling::NodeDesc,
|
layout::tiling::NodeDesc,
|
||||||
Direction, Shell,
|
Direction, Shell,
|
||||||
|
|
@ -34,7 +34,7 @@ use smithay::{
|
||||||
ImportAll, ImportMem, Renderer,
|
ImportAll, ImportMem, Renderer,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
desktop::space::SpaceElement,
|
desktop::{space::SpaceElement, WindowSurfaceType},
|
||||||
input::{
|
input::{
|
||||||
keyboard::{KeyboardTarget, KeysymHandle, ModifiersState},
|
keyboard::{KeyboardTarget, KeysymHandle, ModifiersState},
|
||||||
pointer::{
|
pointer::{
|
||||||
|
|
@ -123,7 +123,6 @@ pub const TAB_HEIGHT: i32 = 24;
|
||||||
pub enum Focus {
|
pub enum Focus {
|
||||||
None,
|
None,
|
||||||
Header,
|
Header,
|
||||||
Window,
|
|
||||||
ResizeTop,
|
ResizeTop,
|
||||||
ResizeLeft,
|
ResizeLeft,
|
||||||
ResizeRight,
|
ResizeRight,
|
||||||
|
|
@ -422,6 +421,51 @@ impl CosmicStack {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn focus_under(
|
||||||
|
&self,
|
||||||
|
mut relative_pos: Point<f64, Logical>,
|
||||||
|
) -> Option<(PointerFocusTarget, Point<i32, Logical>)> {
|
||||||
|
self.0.with_program(|p| {
|
||||||
|
let mut stack_ui = None;
|
||||||
|
let geo = p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)].geometry();
|
||||||
|
|
||||||
|
let point_i32 = relative_pos.to_i32_round::<i32>();
|
||||||
|
if (point_i32.x - geo.loc.x >= -RESIZE_BORDER && point_i32.x - geo.loc.x < 0)
|
||||||
|
|| (point_i32.y - geo.loc.y >= -RESIZE_BORDER && point_i32.y - geo.loc.y < 0)
|
||||||
|
|| (point_i32.x - geo.loc.x >= geo.size.w
|
||||||
|
&& point_i32.x - geo.loc.x < geo.size.w + RESIZE_BORDER)
|
||||||
|
|| (point_i32.y - geo.loc.y >= geo.size.h
|
||||||
|
&& point_i32.y - geo.loc.y < geo.size.h + TAB_HEIGHT + RESIZE_BORDER)
|
||||||
|
{
|
||||||
|
stack_ui = Some((
|
||||||
|
PointerFocusTarget::StackUI(self.clone()),
|
||||||
|
Point::from((0, 0)),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
if point_i32.y - geo.loc.y < TAB_HEIGHT {
|
||||||
|
stack_ui = Some((
|
||||||
|
PointerFocusTarget::StackUI(self.clone()),
|
||||||
|
Point::from((0, 0)),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
relative_pos.y -= TAB_HEIGHT as f64;
|
||||||
|
|
||||||
|
let active_window = &p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)];
|
||||||
|
active_window
|
||||||
|
.0
|
||||||
|
.surface_under(relative_pos, WindowSurfaceType::ALL)
|
||||||
|
.map(|(surface, surface_offset)| {
|
||||||
|
(
|
||||||
|
PointerFocusTarget::WlSurface(surface),
|
||||||
|
surface_offset + Point::from((0, TAB_HEIGHT)),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.or(stack_ui)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
pub fn offset(&self) -> Point<i32, Logical> {
|
pub fn offset(&self) -> Point<i32, Logical> {
|
||||||
Point::from((0, TAB_HEIGHT))
|
Point::from((0, TAB_HEIGHT))
|
||||||
}
|
}
|
||||||
|
|
@ -941,33 +985,7 @@ impl SpaceElement for CosmicStack {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
fn is_in_input_region(&self, point: &Point<f64, Logical>) -> bool {
|
fn is_in_input_region(&self, point: &Point<f64, Logical>) -> bool {
|
||||||
let mut point = *point;
|
self.focus_under(*point).is_some()
|
||||||
let geo = self.0.with_program(|p| {
|
|
||||||
p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)].geometry()
|
|
||||||
});
|
|
||||||
|
|
||||||
let point_i32 = point.to_i32_round::<i32>();
|
|
||||||
if (point_i32.x - geo.loc.x >= -RESIZE_BORDER && point_i32.x - geo.loc.x < 0)
|
|
||||||
|| (point_i32.y - geo.loc.y >= -RESIZE_BORDER && point_i32.y - geo.loc.y < 0)
|
|
||||||
|| (point_i32.x - geo.loc.x >= geo.size.w
|
|
||||||
&& point_i32.x - geo.loc.x < geo.size.w + RESIZE_BORDER)
|
|
||||||
|| (point_i32.y - geo.loc.y >= geo.size.h
|
|
||||||
&& point_i32.y - geo.loc.y < geo.size.h + TAB_HEIGHT + RESIZE_BORDER)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (point_i32.y - geo.loc.y) < TAB_HEIGHT {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
point.y -= TAB_HEIGHT as f64;
|
|
||||||
self.0.with_program(|p| {
|
|
||||||
SpaceElement::is_in_input_region(
|
|
||||||
&p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)],
|
|
||||||
&point,
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
fn set_activate(&self, activated: bool) {
|
fn set_activate(&self, activated: bool) {
|
||||||
SpaceElement::set_activate(&self.0, activated);
|
SpaceElement::set_activate(&self.0, activated);
|
||||||
|
|
@ -1130,11 +1148,11 @@ impl KeyboardTarget<State> for CosmicStack {
|
||||||
impl PointerTarget<State> for CosmicStack {
|
impl PointerTarget<State> for CosmicStack {
|
||||||
fn enter(&self, seat: &Seat<State>, data: &mut State, event: &MotionEvent) {
|
fn enter(&self, seat: &Seat<State>, data: &mut State, event: &MotionEvent) {
|
||||||
let mut event = event.clone();
|
let mut event = event.clone();
|
||||||
if self.0.with_program(|p| {
|
self.0.with_program(|p| {
|
||||||
let active_window = &p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)];
|
let active_window = &p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)];
|
||||||
let geo = active_window.geometry();
|
let geo = active_window.geometry();
|
||||||
let loc = event.location.to_i32_round::<i32>();
|
let loc = event.location.to_i32_round::<i32>();
|
||||||
let (old_focus, shape) = if loc.y - geo.loc.y < 0 && loc.x - geo.loc.x < 0 {
|
let (_old_focus, shape) = if loc.y - geo.loc.y < 0 && loc.x - geo.loc.x < 0 {
|
||||||
(
|
(
|
||||||
p.swap_focus(Focus::ResizeTopLeft),
|
p.swap_focus(Focus::ResizeTopLeft),
|
||||||
CursorShape::NorthWestResize,
|
CursorShape::NorthWestResize,
|
||||||
|
|
@ -1167,43 +1185,9 @@ impl PointerTarget<State> for CosmicStack {
|
||||||
} else if loc.y - geo.loc.y < TAB_HEIGHT {
|
} else if loc.y - geo.loc.y < TAB_HEIGHT {
|
||||||
(p.swap_focus(Focus::Header), CursorShape::Default)
|
(p.swap_focus(Focus::Header), CursorShape::Default)
|
||||||
} else {
|
} else {
|
||||||
p.swap_focus(Focus::Window);
|
return;
|
||||||
|
|
||||||
event.location.y -= TAB_HEIGHT as f64;
|
|
||||||
*p.last_location.lock().unwrap() = Some((event.location, event.serial, event.time));
|
|
||||||
let active = p.active.load(Ordering::SeqCst);
|
|
||||||
p.previous_pointer.store(active, Ordering::SeqCst);
|
|
||||||
|
|
||||||
PointerTarget::enter(active_window, seat, data, &event);
|
|
||||||
|
|
||||||
for session in active_window.cursor_sessions() {
|
|
||||||
session.set_cursor_pos(Some(
|
|
||||||
event
|
|
||||||
.location
|
|
||||||
.to_buffer(1.0, Transform::Normal, &geo.size.to_f64())
|
|
||||||
.to_i32_round(),
|
|
||||||
));
|
|
||||||
if let Some((_, hotspot)) = seat.cursor_geometry(
|
|
||||||
(0.0, 0.0),
|
|
||||||
Duration::from_millis(event.time as u64).into(),
|
|
||||||
) {
|
|
||||||
session.set_cursor_hotspot(hotspot);
|
|
||||||
} else {
|
|
||||||
session.set_cursor_hotspot((0, 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if old_focus == Focus::Window {
|
|
||||||
PointerTarget::leave(active_window, seat, data, event.serial, event.time);
|
|
||||||
|
|
||||||
for session in active_window.cursor_sessions() {
|
|
||||||
session.set_cursor_pos(None);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let cursor_state = seat.user_data().get::<CursorState>().unwrap();
|
let cursor_state = seat.user_data().get::<CursorState>().unwrap();
|
||||||
cursor_state.set_shape(shape);
|
cursor_state.set_shape(shape);
|
||||||
let cursor_status = seat
|
let cursor_status = seat
|
||||||
|
|
@ -1211,16 +1195,15 @@ impl PointerTarget<State> for CosmicStack {
|
||||||
.get::<RefCell<CursorImageStatus>>()
|
.get::<RefCell<CursorImageStatus>>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
*cursor_status.borrow_mut() = CursorImageStatus::default_named();
|
*cursor_status.borrow_mut() = CursorImageStatus::default_named();
|
||||||
shape == CursorShape::Default
|
});
|
||||||
}) {
|
|
||||||
event.location -= self.0.with_program(|p| {
|
event.location -= self.0.with_program(|p| {
|
||||||
p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)]
|
p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)]
|
||||||
.geometry()
|
.geometry()
|
||||||
.loc
|
.loc
|
||||||
.to_f64()
|
.to_f64()
|
||||||
});
|
});
|
||||||
PointerTarget::enter(&self.0, seat, data, &event)
|
PointerTarget::enter(&self.0, seat, data, &event)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn motion(&self, seat: &Seat<State>, data: &mut State, event: &MotionEvent) {
|
fn motion(&self, seat: &Seat<State>, data: &mut State, event: &MotionEvent) {
|
||||||
|
|
@ -1228,7 +1211,7 @@ impl PointerTarget<State> for CosmicStack {
|
||||||
let active =
|
let active =
|
||||||
self.pointer_leave_if_previous(seat, data, event.serial, event.time, event.location);
|
self.pointer_leave_if_previous(seat, data, event.serial, event.time, event.location);
|
||||||
|
|
||||||
let (previous, next) = self.0.with_program(|p| {
|
self.0.with_program(|p| {
|
||||||
let active_window = &p.windows.lock().unwrap()[active];
|
let active_window = &p.windows.lock().unwrap()[active];
|
||||||
let geo = active_window.geometry();
|
let geo = active_window.geometry();
|
||||||
let loc = event.location.to_i32_round::<i32>();
|
let loc = event.location.to_i32_round::<i32>();
|
||||||
|
|
@ -1253,44 +1236,10 @@ impl PointerTarget<State> for CosmicStack {
|
||||||
} else if (loc.y - geo.loc.y) < TAB_HEIGHT {
|
} else if (loc.y - geo.loc.y) < TAB_HEIGHT {
|
||||||
(Focus::Header, CursorShape::Default)
|
(Focus::Header, CursorShape::Default)
|
||||||
} else {
|
} else {
|
||||||
event.location.y -= TAB_HEIGHT as f64;
|
return;
|
||||||
*p.last_location.lock().unwrap() = Some((event.location, event.serial, event.time));
|
|
||||||
|
|
||||||
let previous = p.swap_focus(Focus::Window);
|
|
||||||
if previous != Focus::Window {
|
|
||||||
PointerTarget::enter(active_window, seat, data, &event);
|
|
||||||
} else {
|
|
||||||
PointerTarget::motion(active_window, seat, data, &event);
|
|
||||||
}
|
|
||||||
|
|
||||||
for session in active_window.cursor_sessions() {
|
|
||||||
session.set_cursor_pos(Some(
|
|
||||||
event
|
|
||||||
.location
|
|
||||||
.to_buffer(1.0, Transform::Normal, &geo.size.to_f64())
|
|
||||||
.to_i32_round(),
|
|
||||||
));
|
|
||||||
if let Some((_, hotspot)) = seat.cursor_geometry(
|
|
||||||
(0.0, 0.0),
|
|
||||||
Duration::from_millis(event.time as u64).into(),
|
|
||||||
) {
|
|
||||||
session.set_cursor_hotspot(hotspot);
|
|
||||||
} else {
|
|
||||||
session.set_cursor_hotspot((0, 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (previous, Focus::Window);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let previous = p.swap_focus(next);
|
let _previous = p.swap_focus(next);
|
||||||
if previous == Focus::Window {
|
|
||||||
PointerTarget::leave(active_window, seat, data, event.serial, event.time);
|
|
||||||
|
|
||||||
for session in active_window.cursor_sessions() {
|
|
||||||
session.set_cursor_pos(None);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let cursor_state = seat.user_data().get::<CursorState>().unwrap();
|
let cursor_state = seat.user_data().get::<CursorState>().unwrap();
|
||||||
cursor_state.set_shape(shape);
|
cursor_state.set_shape(shape);
|
||||||
|
|
@ -1299,8 +1248,6 @@ impl PointerTarget<State> for CosmicStack {
|
||||||
.get::<RefCell<CursorImageStatus>>()
|
.get::<RefCell<CursorImageStatus>>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
*cursor_status.borrow_mut() = CursorImageStatus::default_named();
|
*cursor_status.borrow_mut() = CursorImageStatus::default_named();
|
||||||
|
|
||||||
(previous, next)
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let active_window_geo = self
|
let active_window_geo = self
|
||||||
|
|
@ -1308,80 +1255,46 @@ impl PointerTarget<State> for CosmicStack {
|
||||||
.with_program(|p| p.windows.lock().unwrap()[active].geometry());
|
.with_program(|p| p.windows.lock().unwrap()[active].geometry());
|
||||||
event.location -= active_window_geo.loc.to_f64();
|
event.location -= active_window_geo.loc.to_f64();
|
||||||
|
|
||||||
match (previous, next) {
|
PointerTarget::motion(&self.0, seat, data, &event);
|
||||||
(Focus::Header, Focus::Header) => {
|
if event.location.y < 0.0
|
||||||
PointerTarget::motion(&self.0, seat, data, &event);
|
|| event.location.y > TAB_HEIGHT as f64
|
||||||
if event.location.y < 0.0
|
|| event.location.x < 64.0
|
||||||
|| event.location.x < 64.0
|
|| event.location.x > (active_window_geo.size.w as f64 - 64.0)
|
||||||
|| event.location.x > (active_window_geo.size.w as f64 - 64.0)
|
{
|
||||||
{
|
if let Some(dragged_out) = self
|
||||||
if let Some(dragged_out) = self
|
.0
|
||||||
.0
|
.with_program(|p| p.potential_drag.lock().unwrap().take())
|
||||||
.with_program(|p| p.potential_drag.lock().unwrap().take())
|
{
|
||||||
{
|
if let Some(surface) = self
|
||||||
if let Some(surface) = self
|
|
||||||
.0
|
|
||||||
.with_program(|p| p.windows.lock().unwrap().get(dragged_out).cloned())
|
|
||||||
{
|
|
||||||
let seat = seat.clone();
|
|
||||||
surface.try_force_undecorated(false);
|
|
||||||
surface.send_configure();
|
|
||||||
if let Some(surface) = surface.wl_surface() {
|
|
||||||
let _ = data.common.event_loop_handle.insert_idle(move |state| {
|
|
||||||
Shell::move_request(
|
|
||||||
state,
|
|
||||||
&surface,
|
|
||||||
&seat,
|
|
||||||
None,
|
|
||||||
ReleaseMode::NoMouseButtons,
|
|
||||||
true,
|
|
||||||
)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
(_, Focus::Header) => PointerTarget::enter(&self.0, seat, data, &event),
|
|
||||||
(Focus::Header, _) => {
|
|
||||||
PointerTarget::leave(&self.0, seat, data, event.serial, event.time);
|
|
||||||
if let Some(dragged_out) = self
|
|
||||||
.0
|
.0
|
||||||
.with_program(|p| p.potential_drag.lock().unwrap().take())
|
.with_program(|p| p.windows.lock().unwrap().get(dragged_out).cloned())
|
||||||
{
|
{
|
||||||
if let Some(surface) = self
|
let seat = seat.clone();
|
||||||
.0
|
surface.try_force_undecorated(false);
|
||||||
.with_program(|p| p.windows.lock().unwrap().get(dragged_out).cloned())
|
surface.send_configure();
|
||||||
{
|
if let Some(surface) = surface.wl_surface() {
|
||||||
let seat = seat.clone();
|
let _ = data.common.event_loop_handle.insert_idle(move |state| {
|
||||||
surface.try_force_undecorated(false);
|
Shell::move_request(
|
||||||
surface.send_configure();
|
state,
|
||||||
if let Some(surface) = surface.wl_surface() {
|
&surface,
|
||||||
let _ = data.common.event_loop_handle.insert_idle(move |state| {
|
&seat,
|
||||||
Shell::move_request(
|
None,
|
||||||
state,
|
ReleaseMode::NoMouseButtons,
|
||||||
&surface,
|
true,
|
||||||
&seat,
|
)
|
||||||
None,
|
});
|
||||||
ReleaseMode::NoMouseButtons,
|
|
||||||
true,
|
|
||||||
)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn relative_motion(&self, seat: &Seat<State>, data: &mut State, event: &RelativeMotionEvent) {
|
fn relative_motion(
|
||||||
self.0.with_program(|p| {
|
&self,
|
||||||
if p.current_focus() == Focus::Window {
|
_seat: &Seat<State>,
|
||||||
let window = &p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)];
|
_data: &mut State,
|
||||||
window.relative_motion(seat, data, event)
|
_event: &RelativeMotionEvent,
|
||||||
}
|
) {
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn button(&self, seat: &Seat<State>, data: &mut State, event: &ButtonEvent) {
|
fn button(&self, seat: &Seat<State>, data: &mut State, event: &ButtonEvent) {
|
||||||
|
|
@ -1399,27 +1312,6 @@ impl PointerTarget<State> for CosmicStack {
|
||||||
});
|
});
|
||||||
PointerTarget::button(&self.0, seat, data, event)
|
PointerTarget::button(&self.0, seat, data, event)
|
||||||
}
|
}
|
||||||
Focus::Window => {
|
|
||||||
if self.0.with_program(|p| {
|
|
||||||
PointerTarget::button(
|
|
||||||
&p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)],
|
|
||||||
seat,
|
|
||||||
data,
|
|
||||||
event,
|
|
||||||
);
|
|
||||||
if p.group_focused.swap(false, Ordering::SeqCst) {
|
|
||||||
p.windows.lock().unwrap().iter().for_each(|w| {
|
|
||||||
SpaceElement::set_activate(w, true);
|
|
||||||
w.send_configure();
|
|
||||||
});
|
|
||||||
true
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}) {
|
|
||||||
self.0.force_redraw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Focus::None => {}
|
Focus::None => {}
|
||||||
x => {
|
x => {
|
||||||
let serial = event.serial;
|
let serial = event.serial;
|
||||||
|
|
@ -1445,7 +1337,7 @@ impl PointerTarget<State> for CosmicStack {
|
||||||
Focus::ResizeBottomRight => ResizeEdge::BOTTOM_RIGHT,
|
Focus::ResizeBottomRight => ResizeEdge::BOTTOM_RIGHT,
|
||||||
Focus::ResizeLeft => ResizeEdge::LEFT,
|
Focus::ResizeLeft => ResizeEdge::LEFT,
|
||||||
Focus::ResizeRight => ResizeEdge::RIGHT,
|
Focus::ResizeRight => ResizeEdge::RIGHT,
|
||||||
Focus::Header | Focus::Window | Focus::None => unreachable!(),
|
Focus::Header | Focus::None => unreachable!(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
@ -1463,14 +1355,6 @@ impl PointerTarget<State> for CosmicStack {
|
||||||
|
|
||||||
match self.0.with_program(|p| p.current_focus()) {
|
match self.0.with_program(|p| p.current_focus()) {
|
||||||
Focus::Header => PointerTarget::axis(&self.0, seat, data, frame),
|
Focus::Header => PointerTarget::axis(&self.0, seat, data, frame),
|
||||||
Focus::Window => self.0.with_program(|p| {
|
|
||||||
PointerTarget::axis(
|
|
||||||
&p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)],
|
|
||||||
seat,
|
|
||||||
data,
|
|
||||||
frame,
|
|
||||||
)
|
|
||||||
}),
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1485,13 +1369,6 @@ impl PointerTarget<State> for CosmicStack {
|
||||||
|
|
||||||
match self.0.with_program(|p| p.current_focus()) {
|
match self.0.with_program(|p| p.current_focus()) {
|
||||||
Focus::Header => PointerTarget::frame(&self.0, seat, data),
|
Focus::Header => PointerTarget::frame(&self.0, seat, data),
|
||||||
Focus::Window => self.0.with_program(|p| {
|
|
||||||
PointerTarget::frame(
|
|
||||||
&p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)],
|
|
||||||
seat,
|
|
||||||
data,
|
|
||||||
)
|
|
||||||
}),
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1504,138 +1381,103 @@ impl PointerTarget<State> for CosmicStack {
|
||||||
self.pointer_leave_if_previous(seat, data, serial, time, location);
|
self.pointer_leave_if_previous(seat, data, serial, time, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
let previous = self.0.with_program(|p| {
|
self.0.with_program(|p| {
|
||||||
for session in
|
|
||||||
p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)].cursor_sessions()
|
|
||||||
{
|
|
||||||
session.set_cursor_pos(None);
|
|
||||||
}
|
|
||||||
|
|
||||||
let cursor_state = seat.user_data().get::<CursorState>().unwrap();
|
let cursor_state = seat.user_data().get::<CursorState>().unwrap();
|
||||||
cursor_state.set_shape(CursorShape::Default);
|
cursor_state.set_shape(CursorShape::Default);
|
||||||
p.swap_focus(Focus::None)
|
let _previous = p.swap_focus(Focus::None);
|
||||||
});
|
});
|
||||||
|
|
||||||
match previous {
|
PointerTarget::leave(&self.0, seat, data, serial, time);
|
||||||
Focus::Header => PointerTarget::leave(&self.0, seat, data, serial, time),
|
|
||||||
Focus::Window => self.0.with_program(|p| {
|
if let Some(dragged_out) = self
|
||||||
PointerTarget::leave(
|
.0
|
||||||
&p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)],
|
.with_program(|p| p.potential_drag.lock().unwrap().take())
|
||||||
seat,
|
{
|
||||||
data,
|
if let Some(surface) = self
|
||||||
serial,
|
.0
|
||||||
time,
|
.with_program(|p| p.windows.lock().unwrap().get(dragged_out).cloned())
|
||||||
)
|
{
|
||||||
}),
|
let seat = seat.clone();
|
||||||
_ => {}
|
surface.try_force_undecorated(false);
|
||||||
|
surface.send_configure();
|
||||||
|
if let Some(surface) = surface.wl_surface() {
|
||||||
|
let _ = data.common.event_loop_handle.insert_idle(move |state| {
|
||||||
|
Shell::move_request(
|
||||||
|
state,
|
||||||
|
&surface,
|
||||||
|
&seat,
|
||||||
|
None,
|
||||||
|
ReleaseMode::NoMouseButtons,
|
||||||
|
true,
|
||||||
|
)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gesture_swipe_begin(
|
fn gesture_swipe_begin(
|
||||||
&self,
|
&self,
|
||||||
seat: &Seat<State>,
|
_seat: &Seat<State>,
|
||||||
data: &mut State,
|
_data: &mut State,
|
||||||
event: &GestureSwipeBeginEvent,
|
_event: &GestureSwipeBeginEvent,
|
||||||
) {
|
) {
|
||||||
self.0.with_program(|p| {
|
|
||||||
if p.current_focus() == Focus::Window {
|
|
||||||
let window = &p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)];
|
|
||||||
window.gesture_swipe_begin(seat, data, event)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gesture_swipe_update(
|
fn gesture_swipe_update(
|
||||||
&self,
|
&self,
|
||||||
seat: &Seat<State>,
|
_seat: &Seat<State>,
|
||||||
data: &mut State,
|
_data: &mut State,
|
||||||
event: &GestureSwipeUpdateEvent,
|
_event: &GestureSwipeUpdateEvent,
|
||||||
) {
|
) {
|
||||||
self.0.with_program(|p| {
|
|
||||||
if p.current_focus() == Focus::Window {
|
|
||||||
let window = &p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)];
|
|
||||||
window.gesture_swipe_update(seat, data, event)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gesture_swipe_end(
|
fn gesture_swipe_end(
|
||||||
&self,
|
&self,
|
||||||
seat: &Seat<State>,
|
_seat: &Seat<State>,
|
||||||
data: &mut State,
|
_data: &mut State,
|
||||||
event: &GestureSwipeEndEvent,
|
_event: &GestureSwipeEndEvent,
|
||||||
) {
|
) {
|
||||||
self.0.with_program(|p| {
|
|
||||||
if p.current_focus() == Focus::Window {
|
|
||||||
let window = &p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)];
|
|
||||||
window.gesture_swipe_end(seat, data, event)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gesture_pinch_begin(
|
fn gesture_pinch_begin(
|
||||||
&self,
|
&self,
|
||||||
seat: &Seat<State>,
|
_seat: &Seat<State>,
|
||||||
data: &mut State,
|
_data: &mut State,
|
||||||
event: &GesturePinchBeginEvent,
|
_event: &GesturePinchBeginEvent,
|
||||||
) {
|
) {
|
||||||
self.0.with_program(|p| {
|
|
||||||
if p.current_focus() == Focus::Window {
|
|
||||||
let window = &p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)];
|
|
||||||
window.gesture_pinch_begin(seat, data, event)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gesture_pinch_update(
|
fn gesture_pinch_update(
|
||||||
&self,
|
&self,
|
||||||
seat: &Seat<State>,
|
_seat: &Seat<State>,
|
||||||
data: &mut State,
|
_data: &mut State,
|
||||||
event: &GesturePinchUpdateEvent,
|
_event: &GesturePinchUpdateEvent,
|
||||||
) {
|
) {
|
||||||
self.0.with_program(|p| {
|
|
||||||
if p.current_focus() == Focus::Window {
|
|
||||||
let window = &p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)];
|
|
||||||
window.gesture_pinch_update(seat, data, event)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gesture_pinch_end(
|
fn gesture_pinch_end(
|
||||||
&self,
|
&self,
|
||||||
seat: &Seat<State>,
|
_seat: &Seat<State>,
|
||||||
data: &mut State,
|
_data: &mut State,
|
||||||
event: &GesturePinchEndEvent,
|
_event: &GesturePinchEndEvent,
|
||||||
) {
|
) {
|
||||||
self.0.with_program(|p| {
|
|
||||||
if p.current_focus() == Focus::Window {
|
|
||||||
let window = &p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)];
|
|
||||||
window.gesture_pinch_end(seat, data, event)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gesture_hold_begin(
|
fn gesture_hold_begin(
|
||||||
&self,
|
&self,
|
||||||
seat: &Seat<State>,
|
_seat: &Seat<State>,
|
||||||
data: &mut State,
|
_data: &mut State,
|
||||||
event: &GestureHoldBeginEvent,
|
_event: &GestureHoldBeginEvent,
|
||||||
) {
|
) {
|
||||||
self.0.with_program(|p| {
|
|
||||||
if p.current_focus() == Focus::Window {
|
|
||||||
let window = &p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)];
|
|
||||||
window.gesture_hold_begin(seat, data, event)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gesture_hold_end(&self, seat: &Seat<State>, data: &mut State, event: &GestureHoldEndEvent) {
|
fn gesture_hold_end(
|
||||||
self.0.with_program(|p| {
|
&self,
|
||||||
if p.current_focus() == Focus::Window {
|
_seat: &Seat<State>,
|
||||||
let window = &p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)];
|
_data: &mut State,
|
||||||
window.gesture_hold_end(seat, data, event)
|
_event: &GestureHoldEndEvent,
|
||||||
}
|
) {
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
backend::render::cursor::{CursorShape, CursorState},
|
backend::render::cursor::{CursorShape, CursorState},
|
||||||
shell::{
|
shell::{
|
||||||
|
focus::target::PointerFocusTarget,
|
||||||
grabs::{ReleaseMode, ResizeEdge},
|
grabs::{ReleaseMode, ResizeEdge},
|
||||||
Shell,
|
Shell,
|
||||||
},
|
},
|
||||||
|
|
@ -24,7 +25,7 @@ use smithay::{
|
||||||
ImportAll, ImportMem, Renderer,
|
ImportAll, ImportMem, Renderer,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
desktop::space::SpaceElement,
|
desktop::{space::SpaceElement, WindowSurfaceType},
|
||||||
input::{
|
input::{
|
||||||
keyboard::{KeyboardTarget, KeysymHandle, ModifiersState},
|
keyboard::{KeyboardTarget, KeysymHandle, ModifiersState},
|
||||||
pointer::{
|
pointer::{
|
||||||
|
|
@ -97,7 +98,6 @@ impl fmt::Debug for CosmicWindowInternal {
|
||||||
pub enum Focus {
|
pub enum Focus {
|
||||||
None,
|
None,
|
||||||
Header,
|
Header,
|
||||||
Window,
|
|
||||||
ResizeTop,
|
ResizeTop,
|
||||||
ResizeLeft,
|
ResizeLeft,
|
||||||
ResizeRight,
|
ResizeRight,
|
||||||
|
|
@ -181,6 +181,54 @@ impl CosmicWindow {
|
||||||
self.0.with_program(|p| p.window.clone())
|
self.0.with_program(|p| p.window.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn focus_under(
|
||||||
|
&self,
|
||||||
|
mut relative_pos: Point<f64, Logical>,
|
||||||
|
) -> Option<(PointerFocusTarget, Point<i32, Logical>)> {
|
||||||
|
self.0.with_program(|p| {
|
||||||
|
let mut offset = Point::from((0, 0));
|
||||||
|
let mut window_ui = None;
|
||||||
|
if p.has_ssd(false) {
|
||||||
|
let geo = p.window.geometry();
|
||||||
|
|
||||||
|
let point_i32 = relative_pos.to_i32_round::<i32>();
|
||||||
|
if (point_i32.x - geo.loc.x >= -RESIZE_BORDER && point_i32.x - geo.loc.x < 0)
|
||||||
|
|| (point_i32.y - geo.loc.y >= -RESIZE_BORDER && point_i32.y - geo.loc.y < 0)
|
||||||
|
|| (point_i32.x - geo.loc.x >= geo.size.w
|
||||||
|
&& point_i32.x - geo.loc.x < geo.size.w + RESIZE_BORDER)
|
||||||
|
|| (point_i32.y - geo.loc.y >= geo.size.h
|
||||||
|
&& point_i32.y - geo.loc.y < geo.size.h + SSD_HEIGHT + RESIZE_BORDER)
|
||||||
|
{
|
||||||
|
window_ui = Some((
|
||||||
|
PointerFocusTarget::WindowUI(self.clone()),
|
||||||
|
Point::from((0, 0)),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
if point_i32.y - geo.loc.y < SSD_HEIGHT {
|
||||||
|
window_ui = Some((
|
||||||
|
PointerFocusTarget::WindowUI(self.clone()),
|
||||||
|
Point::from((0, 0)),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
relative_pos.y -= SSD_HEIGHT as f64;
|
||||||
|
offset.y += SSD_HEIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
|
p.window
|
||||||
|
.0
|
||||||
|
.surface_under(relative_pos, WindowSurfaceType::ALL)
|
||||||
|
.map(|(surface, surface_offset)| {
|
||||||
|
(
|
||||||
|
PointerFocusTarget::WlSurface(surface),
|
||||||
|
offset + surface_offset,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.or(window_ui)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
pub fn contains_surface(&self, window: &CosmicSurface) -> bool {
|
pub fn contains_surface(&self, window: &CosmicSurface) -> bool {
|
||||||
self.0.with_program(|p| &p.window == window)
|
self.0.with_program(|p| &p.window == window)
|
||||||
}
|
}
|
||||||
|
|
@ -452,30 +500,7 @@ impl SpaceElement for CosmicWindow {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
fn is_in_input_region(&self, point: &Point<f64, Logical>) -> bool {
|
fn is_in_input_region(&self, point: &Point<f64, Logical>) -> bool {
|
||||||
let mut point = *point;
|
self.focus_under(*point).is_some()
|
||||||
self.0.with_program(|p| {
|
|
||||||
if p.has_ssd(false) {
|
|
||||||
let geo = p.window.geometry();
|
|
||||||
|
|
||||||
let point_i32 = point.to_i32_round::<i32>();
|
|
||||||
if (point_i32.x - geo.loc.x >= -RESIZE_BORDER && point_i32.x - geo.loc.x < 0)
|
|
||||||
|| (point_i32.y - geo.loc.y >= -RESIZE_BORDER && point_i32.y - geo.loc.y < 0)
|
|
||||||
|| (point_i32.x - geo.loc.x >= geo.size.w
|
|
||||||
&& point_i32.x - geo.loc.x < geo.size.w + RESIZE_BORDER)
|
|
||||||
|| (point_i32.y - geo.loc.y >= geo.size.h
|
|
||||||
&& point_i32.y - geo.loc.y < geo.size.h + SSD_HEIGHT + RESIZE_BORDER)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if point_i32.y - geo.loc.y < SSD_HEIGHT {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
point.y -= SSD_HEIGHT as f64;
|
|
||||||
}
|
|
||||||
SpaceElement::is_in_input_region(&p.window, &point)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
fn set_activate(&self, activated: bool) {
|
fn set_activate(&self, activated: bool) {
|
||||||
if self
|
if self
|
||||||
|
|
@ -575,7 +600,7 @@ impl KeyboardTarget<State> for CosmicWindow {
|
||||||
impl PointerTarget<State> for CosmicWindow {
|
impl PointerTarget<State> for CosmicWindow {
|
||||||
fn enter(&self, seat: &Seat<State>, data: &mut State, event: &MotionEvent) {
|
fn enter(&self, seat: &Seat<State>, data: &mut State, event: &MotionEvent) {
|
||||||
let mut event = event.clone();
|
let mut event = event.clone();
|
||||||
if self.0.with_program(|p| {
|
self.0.with_program(|p| {
|
||||||
if p.has_ssd(false) {
|
if p.has_ssd(false) {
|
||||||
let geo = p.window.geometry();
|
let geo = p.window.geometry();
|
||||||
let loc = event.location.to_i32_round::<i32>();
|
let loc = event.location.to_i32_round::<i32>();
|
||||||
|
|
@ -612,34 +637,7 @@ impl PointerTarget<State> for CosmicWindow {
|
||||||
} else if loc.y - geo.loc.y < SSD_HEIGHT {
|
} else if loc.y - geo.loc.y < SSD_HEIGHT {
|
||||||
(p.swap_focus(Focus::Header), CursorShape::Default)
|
(p.swap_focus(Focus::Header), CursorShape::Default)
|
||||||
} else {
|
} else {
|
||||||
let focus = p.swap_focus(Focus::Window);
|
return;
|
||||||
assert_eq!(focus, Focus::None);
|
|
||||||
|
|
||||||
let mut event = event.clone();
|
|
||||||
event.location.y -= SSD_HEIGHT as f64;
|
|
||||||
PointerTarget::enter(&p.window, seat, data, &event);
|
|
||||||
|
|
||||||
for session in p.window.cursor_sessions() {
|
|
||||||
session.set_cursor_pos(Some(
|
|
||||||
event
|
|
||||||
.location
|
|
||||||
.to_buffer(
|
|
||||||
1.0,
|
|
||||||
Transform::Normal,
|
|
||||||
&p.window.geometry().size.to_f64(),
|
|
||||||
)
|
|
||||||
.to_i32_round(),
|
|
||||||
));
|
|
||||||
if let Some((_, hotspot)) = seat.cursor_geometry(
|
|
||||||
(0.0, 0.0),
|
|
||||||
Duration::from_millis(event.time as u64).into(),
|
|
||||||
) {
|
|
||||||
session.set_cursor_hotspot(hotspot);
|
|
||||||
} else {
|
|
||||||
session.set_cursor_hotspot((0, 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
assert_eq!(old_focus, Focus::None);
|
assert_eq!(old_focus, Focus::None);
|
||||||
|
|
@ -651,37 +649,16 @@ impl PointerTarget<State> for CosmicWindow {
|
||||||
.get::<RefCell<CursorImageStatus>>()
|
.get::<RefCell<CursorImageStatus>>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
*cursor_status.borrow_mut() = CursorImageStatus::default_named();
|
*cursor_status.borrow_mut() = CursorImageStatus::default_named();
|
||||||
shape == CursorShape::Default
|
|
||||||
} else {
|
|
||||||
p.swap_focus(Focus::Window);
|
|
||||||
PointerTarget::enter(&p.window, seat, data, &event);
|
|
||||||
for session in p.window.cursor_sessions() {
|
|
||||||
session.set_cursor_pos(Some(
|
|
||||||
event
|
|
||||||
.location
|
|
||||||
.to_buffer(1.0, Transform::Normal, &p.window.geometry().size.to_f64())
|
|
||||||
.to_i32_round(),
|
|
||||||
));
|
|
||||||
if let Some((_, hotspot)) = seat.cursor_geometry(
|
|
||||||
(0.0, 0.0),
|
|
||||||
Duration::from_millis(event.time as u64).into(),
|
|
||||||
) {
|
|
||||||
session.set_cursor_hotspot(hotspot);
|
|
||||||
} else {
|
|
||||||
session.set_cursor_hotspot((0, 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
}
|
||||||
}) {
|
});
|
||||||
event.location -= self.0.with_program(|p| p.window.geometry().loc.to_f64());
|
|
||||||
PointerTarget::enter(&self.0, seat, data, &event)
|
event.location -= self.0.with_program(|p| p.window.geometry().loc.to_f64());
|
||||||
}
|
PointerTarget::enter(&self.0, seat, data, &event)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn motion(&self, seat: &Seat<State>, data: &mut State, event: &MotionEvent) {
|
fn motion(&self, seat: &Seat<State>, data: &mut State, event: &MotionEvent) {
|
||||||
let mut event = event.clone();
|
let mut event = event.clone();
|
||||||
if let Some((previous, next)) = self.0.with_program(|p| {
|
self.0.with_program(|p| {
|
||||||
if p.has_ssd(false) {
|
if p.has_ssd(false) {
|
||||||
let geo = p.window.geometry();
|
let geo = p.window.geometry();
|
||||||
let loc = event.location.to_i32_round::<i32>();
|
let loc = event.location.to_i32_round::<i32>();
|
||||||
|
|
@ -704,43 +681,10 @@ impl PointerTarget<State> for CosmicWindow {
|
||||||
} else if loc.y < SSD_HEIGHT {
|
} else if loc.y < SSD_HEIGHT {
|
||||||
(Focus::Header, CursorShape::Default)
|
(Focus::Header, CursorShape::Default)
|
||||||
} else {
|
} else {
|
||||||
event.location.y -= SSD_HEIGHT as f64;
|
return;
|
||||||
|
|
||||||
let previous = p.swap_focus(Focus::Window);
|
|
||||||
if previous != Focus::Window {
|
|
||||||
PointerTarget::enter(&p.window, seat, data, &event);
|
|
||||||
} else {
|
|
||||||
PointerTarget::motion(&p.window, seat, data, &event);
|
|
||||||
}
|
|
||||||
|
|
||||||
for session in p.window.cursor_sessions() {
|
|
||||||
session.set_cursor_pos(Some(
|
|
||||||
event
|
|
||||||
.location
|
|
||||||
.to_buffer(
|
|
||||||
1.0,
|
|
||||||
Transform::Normal,
|
|
||||||
&p.window.geometry().size.to_f64(),
|
|
||||||
)
|
|
||||||
.to_i32_round(),
|
|
||||||
));
|
|
||||||
if let Some((_, hotspot)) = seat.cursor_geometry(
|
|
||||||
(0.0, 0.0),
|
|
||||||
Duration::from_millis(event.time as u64).into(),
|
|
||||||
) {
|
|
||||||
session.set_cursor_hotspot(hotspot);
|
|
||||||
} else {
|
|
||||||
session.set_cursor_hotspot((0, 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Some((previous, Focus::Window));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let previous = p.swap_focus(next);
|
let _previous = p.swap_focus(next);
|
||||||
if previous == Focus::Window {
|
|
||||||
PointerTarget::leave(&p.window, seat, data, event.serial, event.time);
|
|
||||||
}
|
|
||||||
|
|
||||||
let cursor_state = seat.user_data().get::<CursorState>().unwrap();
|
let cursor_state = seat.user_data().get::<CursorState>().unwrap();
|
||||||
cursor_state.set_shape(shape);
|
cursor_state.set_shape(shape);
|
||||||
|
|
@ -749,52 +693,19 @@ impl PointerTarget<State> for CosmicWindow {
|
||||||
.get::<RefCell<CursorImageStatus>>()
|
.get::<RefCell<CursorImageStatus>>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
*cursor_status.borrow_mut() = CursorImageStatus::default_named();
|
*cursor_status.borrow_mut() = CursorImageStatus::default_named();
|
||||||
|
|
||||||
Some((previous, next))
|
|
||||||
} else {
|
|
||||||
p.swap_focus(Focus::Window);
|
|
||||||
PointerTarget::motion(&p.window, seat, data, &event);
|
|
||||||
|
|
||||||
for session in p.window.cursor_sessions() {
|
|
||||||
session.set_cursor_pos(Some(
|
|
||||||
event
|
|
||||||
.location
|
|
||||||
.to_buffer(1.0, Transform::Normal, &p.window.geometry().size.to_f64())
|
|
||||||
.to_i32_round(),
|
|
||||||
));
|
|
||||||
if let Some((_, hotspot)) = seat.cursor_geometry(
|
|
||||||
(0.0, 0.0),
|
|
||||||
Duration::from_millis(event.time as u64).into(),
|
|
||||||
) {
|
|
||||||
session.set_cursor_hotspot(hotspot);
|
|
||||||
} else {
|
|
||||||
session.set_cursor_hotspot((0, 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
None
|
|
||||||
}
|
}
|
||||||
}) {
|
});
|
||||||
event.location -= self.0.with_program(|p| p.window.geometry().loc.to_f64());
|
|
||||||
match (previous, next) {
|
event.location -= self.0.with_program(|p| p.window.geometry().loc.to_f64());
|
||||||
(Focus::Header, Focus::Header) => {
|
PointerTarget::motion(&self.0, seat, data, &event)
|
||||||
PointerTarget::motion(&self.0, seat, data, &event)
|
|
||||||
}
|
|
||||||
(_, Focus::Header) => PointerTarget::enter(&self.0, seat, data, &event),
|
|
||||||
(Focus::Header, _) => {
|
|
||||||
PointerTarget::leave(&self.0, seat, data, event.serial, event.time)
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn relative_motion(&self, seat: &Seat<State>, data: &mut State, event: &RelativeMotionEvent) {
|
fn relative_motion(
|
||||||
self.0.with_program(|p| {
|
&self,
|
||||||
if !p.has_ssd(false) || p.current_focus() == Focus::Window {
|
_seat: &Seat<State>,
|
||||||
PointerTarget::relative_motion(&p.window, seat, data, event)
|
_data: &mut State,
|
||||||
}
|
_event: &RelativeMotionEvent,
|
||||||
})
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn button(&self, seat: &Seat<State>, data: &mut State, event: &ButtonEvent) {
|
fn button(&self, seat: &Seat<State>, data: &mut State, event: &ButtonEvent) {
|
||||||
|
|
@ -805,9 +716,6 @@ impl PointerTarget<State> for CosmicWindow {
|
||||||
});
|
});
|
||||||
PointerTarget::button(&self.0, seat, data, event)
|
PointerTarget::button(&self.0, seat, data, event)
|
||||||
}
|
}
|
||||||
Focus::Window => self
|
|
||||||
.0
|
|
||||||
.with_program(|p| PointerTarget::button(&p.window, seat, data, event)),
|
|
||||||
Focus::None => {}
|
Focus::None => {}
|
||||||
x => {
|
x => {
|
||||||
let serial = event.serial;
|
let serial = event.serial;
|
||||||
|
|
@ -830,7 +738,7 @@ impl PointerTarget<State> for CosmicWindow {
|
||||||
Focus::ResizeBottomRight => ResizeEdge::BOTTOM_RIGHT,
|
Focus::ResizeBottomRight => ResizeEdge::BOTTOM_RIGHT,
|
||||||
Focus::ResizeLeft => ResizeEdge::LEFT,
|
Focus::ResizeLeft => ResizeEdge::LEFT,
|
||||||
Focus::ResizeRight => ResizeEdge::RIGHT,
|
Focus::ResizeRight => ResizeEdge::RIGHT,
|
||||||
Focus::Header | Focus::Window | Focus::None => unreachable!(),
|
Focus::Header | Focus::None => unreachable!(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
@ -841,9 +749,6 @@ impl PointerTarget<State> for CosmicWindow {
|
||||||
fn axis(&self, seat: &Seat<State>, data: &mut State, frame: AxisFrame) {
|
fn axis(&self, seat: &Seat<State>, data: &mut State, frame: AxisFrame) {
|
||||||
match self.0.with_program(|p| p.current_focus()) {
|
match self.0.with_program(|p| p.current_focus()) {
|
||||||
Focus::Header => PointerTarget::axis(&self.0, seat, data, frame),
|
Focus::Header => PointerTarget::axis(&self.0, seat, data, frame),
|
||||||
Focus::Window => self
|
|
||||||
.0
|
|
||||||
.with_program(|p| PointerTarget::axis(&p.window, seat, data, frame)),
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -851,129 +756,81 @@ impl PointerTarget<State> for CosmicWindow {
|
||||||
fn frame(&self, seat: &Seat<State>, data: &mut State) {
|
fn frame(&self, seat: &Seat<State>, data: &mut State) {
|
||||||
match self.0.with_program(|p| p.current_focus()) {
|
match self.0.with_program(|p| p.current_focus()) {
|
||||||
Focus::Header => PointerTarget::frame(&self.0, seat, data),
|
Focus::Header => PointerTarget::frame(&self.0, seat, data),
|
||||||
Focus::Window => self
|
|
||||||
.0
|
|
||||||
.with_program(|p| PointerTarget::frame(&p.window, seat, data)),
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn leave(&self, seat: &Seat<State>, data: &mut State, serial: Serial, time: u32) {
|
fn leave(&self, seat: &Seat<State>, data: &mut State, serial: Serial, time: u32) {
|
||||||
let previous = self.0.with_program(|p| {
|
self.0.with_program(|p| {
|
||||||
for session in p.window.cursor_sessions() {
|
|
||||||
session.set_cursor_pos(None);
|
|
||||||
}
|
|
||||||
|
|
||||||
let cursor_state = seat.user_data().get::<CursorState>().unwrap();
|
let cursor_state = seat.user_data().get::<CursorState>().unwrap();
|
||||||
cursor_state.set_shape(CursorShape::Default);
|
cursor_state.set_shape(CursorShape::Default);
|
||||||
p.swap_focus(Focus::None)
|
let _previous = p.swap_focus(Focus::None);
|
||||||
});
|
});
|
||||||
match previous {
|
PointerTarget::leave(&self.0, seat, data, serial, time)
|
||||||
Focus::Header => PointerTarget::leave(&self.0, seat, data, serial, time),
|
|
||||||
Focus::Window => self
|
|
||||||
.0
|
|
||||||
.with_program(|p| PointerTarget::leave(&p.window, seat, data, serial, time)),
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gesture_swipe_begin(
|
fn gesture_swipe_begin(
|
||||||
&self,
|
&self,
|
||||||
seat: &Seat<State>,
|
_seat: &Seat<State>,
|
||||||
data: &mut State,
|
_data: &mut State,
|
||||||
event: &GestureSwipeBeginEvent,
|
_event: &GestureSwipeBeginEvent,
|
||||||
) {
|
) {
|
||||||
self.0.with_program(|p| {
|
|
||||||
if !p.has_ssd(false) || p.current_focus() == Focus::Window {
|
|
||||||
PointerTarget::gesture_swipe_begin(&p.window, seat, data, event)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gesture_swipe_update(
|
fn gesture_swipe_update(
|
||||||
&self,
|
&self,
|
||||||
seat: &Seat<State>,
|
_seat: &Seat<State>,
|
||||||
data: &mut State,
|
_data: &mut State,
|
||||||
event: &GestureSwipeUpdateEvent,
|
_event: &GestureSwipeUpdateEvent,
|
||||||
) {
|
) {
|
||||||
self.0.with_program(|p| {
|
|
||||||
if !p.has_ssd(false) || p.current_focus() == Focus::Window {
|
|
||||||
PointerTarget::gesture_swipe_update(&p.window, seat, data, event)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gesture_swipe_end(
|
fn gesture_swipe_end(
|
||||||
&self,
|
&self,
|
||||||
seat: &Seat<State>,
|
_seat: &Seat<State>,
|
||||||
data: &mut State,
|
_data: &mut State,
|
||||||
event: &GestureSwipeEndEvent,
|
_event: &GestureSwipeEndEvent,
|
||||||
) {
|
) {
|
||||||
self.0.with_program(|p| {
|
|
||||||
if !p.has_ssd(false) || p.current_focus() == Focus::Window {
|
|
||||||
PointerTarget::gesture_swipe_end(&p.window, seat, data, event)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gesture_pinch_begin(
|
fn gesture_pinch_begin(
|
||||||
&self,
|
&self,
|
||||||
seat: &Seat<State>,
|
_seat: &Seat<State>,
|
||||||
data: &mut State,
|
_data: &mut State,
|
||||||
event: &GesturePinchBeginEvent,
|
_event: &GesturePinchBeginEvent,
|
||||||
) {
|
) {
|
||||||
self.0.with_program(|p| {
|
|
||||||
if !p.has_ssd(false) || p.current_focus() == Focus::Window {
|
|
||||||
PointerTarget::gesture_pinch_begin(&p.window, seat, data, event)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gesture_pinch_update(
|
fn gesture_pinch_update(
|
||||||
&self,
|
&self,
|
||||||
seat: &Seat<State>,
|
_seat: &Seat<State>,
|
||||||
data: &mut State,
|
_data: &mut State,
|
||||||
event: &GesturePinchUpdateEvent,
|
_event: &GesturePinchUpdateEvent,
|
||||||
) {
|
) {
|
||||||
self.0.with_program(|p| {
|
|
||||||
if !p.has_ssd(false) || p.current_focus() == Focus::Window {
|
|
||||||
PointerTarget::gesture_pinch_update(&p.window, seat, data, event)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gesture_pinch_end(
|
fn gesture_pinch_end(
|
||||||
&self,
|
&self,
|
||||||
seat: &Seat<State>,
|
_seat: &Seat<State>,
|
||||||
data: &mut State,
|
_data: &mut State,
|
||||||
event: &GesturePinchEndEvent,
|
_event: &GesturePinchEndEvent,
|
||||||
) {
|
) {
|
||||||
self.0.with_program(|p| {
|
|
||||||
if !p.has_ssd(false) || p.current_focus() == Focus::Window {
|
|
||||||
PointerTarget::gesture_pinch_end(&p.window, seat, data, event)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gesture_hold_begin(
|
fn gesture_hold_begin(
|
||||||
&self,
|
&self,
|
||||||
seat: &Seat<State>,
|
_seat: &Seat<State>,
|
||||||
data: &mut State,
|
_data: &mut State,
|
||||||
event: &GestureHoldBeginEvent,
|
_event: &GestureHoldBeginEvent,
|
||||||
) {
|
) {
|
||||||
self.0.with_program(|p| {
|
|
||||||
if !p.has_ssd(false) || p.current_focus() == Focus::Window {
|
|
||||||
PointerTarget::gesture_hold_begin(&p.window, seat, data, event)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gesture_hold_end(&self, seat: &Seat<State>, data: &mut State, event: &GestureHoldEndEvent) {
|
fn gesture_hold_end(
|
||||||
self.0.with_program(|p| {
|
&self,
|
||||||
if !p.has_ssd(false) || p.current_focus() == Focus::Window {
|
_seat: &Seat<State>,
|
||||||
PointerTarget::gesture_hold_end(&p.window, seat, data, event)
|
_data: &mut State,
|
||||||
}
|
_event: &GestureHoldEndEvent,
|
||||||
})
|
) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -266,21 +266,21 @@ impl Common {
|
||||||
.get::<PopupGrabData>()
|
.get::<PopupGrabData>()
|
||||||
.and_then(|x| x.take())
|
.and_then(|x| x.take())
|
||||||
{
|
{
|
||||||
if !popup_grab.has_ended() {
|
if !popup_grab.has_ended() {
|
||||||
if let Some(new) = popup_grab.current_grab() {
|
if let Some(new) = popup_grab.current_grab() {
|
||||||
trace!("restore focus to previous popup grab");
|
trace!("restore focus to previous popup grab");
|
||||||
if let Some(keyboard) = seat.get_keyboard() {
|
if let Some(keyboard) = seat.get_keyboard() {
|
||||||
keyboard.set_focus(
|
keyboard.set_focus(
|
||||||
state,
|
state,
|
||||||
Some(new.clone()),
|
Some(new.clone()),
|
||||||
SERIAL_COUNTER.next_serial(),
|
SERIAL_COUNTER.next_serial(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
ActiveFocus::set(&seat, Some(new));
|
ActiveFocus::set(&seat, Some(new));
|
||||||
seat.user_data()
|
seat.user_data()
|
||||||
.get_or_insert::<PopupGrabData, _>(PopupGrabData::default)
|
.get_or_insert::<PopupGrabData, _>(PopupGrabData::default)
|
||||||
.set(Some(popup_grab));
|
.set(Some(popup_grab));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,18 @@
|
||||||
use std::sync::Weak;
|
use std::sync::Weak;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
shell::{element::CosmicMapped, layout::tiling::ResizeForkTarget, CosmicSurface},
|
shell::{
|
||||||
|
element::{CosmicMapped, CosmicStack, CosmicWindow},
|
||||||
|
layout::tiling::ResizeForkTarget,
|
||||||
|
CosmicSurface,
|
||||||
|
},
|
||||||
utils::prelude::*,
|
utils::prelude::*,
|
||||||
wayland::handlers::xdg_shell::popup::get_popup_toplevel,
|
wayland::handlers::xdg_shell::popup::get_popup_toplevel,
|
||||||
};
|
};
|
||||||
use id_tree::NodeId;
|
use id_tree::NodeId;
|
||||||
use smithay::{
|
use smithay::{
|
||||||
backend::input::KeyState,
|
backend::input::KeyState,
|
||||||
desktop::{LayerSurface, PopupKind},
|
desktop::{LayerSurface, PopupKind, WindowSurface, WindowSurfaceType},
|
||||||
input::{
|
input::{
|
||||||
keyboard::{KeyboardTarget, KeysymHandle, ModifiersState},
|
keyboard::{KeyboardTarget, KeysymHandle, ModifiersState},
|
||||||
pointer::{
|
pointer::{
|
||||||
|
|
@ -20,20 +24,17 @@ use smithay::{
|
||||||
Seat,
|
Seat,
|
||||||
},
|
},
|
||||||
reexports::wayland_server::{backend::ObjectId, protocol::wl_surface::WlSurface, Resource},
|
reexports::wayland_server::{backend::ObjectId, protocol::wl_surface::WlSurface, Resource},
|
||||||
utils::{IsAlive, Serial},
|
utils::{IsAlive, Logical, Point, Serial},
|
||||||
wayland::{seat::WaylandFocus, session_lock::LockSurface},
|
wayland::{seat::WaylandFocus, session_lock::LockSurface},
|
||||||
xwayland::X11Surface,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// discuss: should contain WlSurface, IcedElement
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub enum PointerFocusTarget {
|
pub enum PointerFocusTarget {
|
||||||
Element(CosmicMapped),
|
WlSurface(WlSurface),
|
||||||
Fullscreen(CosmicSurface),
|
StackUI(CosmicStack),
|
||||||
LayerSurface(LayerSurface),
|
WindowUI(CosmicWindow),
|
||||||
Popup(PopupKind),
|
|
||||||
OverrideRedirect(X11Surface),
|
|
||||||
ResizeFork(ResizeForkTarget),
|
ResizeFork(ResizeForkTarget),
|
||||||
LockSurface(LockSurface),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
|
|
@ -50,16 +51,27 @@ pub enum KeyboardFocusTarget {
|
||||||
impl From<KeyboardFocusTarget> for PointerFocusTarget {
|
impl From<KeyboardFocusTarget> for PointerFocusTarget {
|
||||||
fn from(target: KeyboardFocusTarget) -> Self {
|
fn from(target: KeyboardFocusTarget) -> Self {
|
||||||
match target {
|
match target {
|
||||||
KeyboardFocusTarget::Element(elem) => PointerFocusTarget::Element(elem),
|
KeyboardFocusTarget::Element(elem) => {
|
||||||
KeyboardFocusTarget::Fullscreen(elem) => PointerFocusTarget::Fullscreen(elem),
|
PointerFocusTarget::WlSurface(elem.active_window().wl_surface().unwrap())
|
||||||
KeyboardFocusTarget::LayerSurface(layer) => PointerFocusTarget::LayerSurface(layer),
|
}
|
||||||
KeyboardFocusTarget::Popup(popup) => PointerFocusTarget::Popup(popup),
|
KeyboardFocusTarget::Fullscreen(elem) => {
|
||||||
KeyboardFocusTarget::LockSurface(lock) => PointerFocusTarget::LockSurface(lock),
|
PointerFocusTarget::WlSurface(elem.wl_surface().unwrap())
|
||||||
_ => unreachable!("A window grab cannot start a popup grab"),
|
}
|
||||||
|
KeyboardFocusTarget::LayerSurface(layer) => {
|
||||||
|
PointerFocusTarget::WlSurface(layer.wl_surface().clone())
|
||||||
|
}
|
||||||
|
KeyboardFocusTarget::Popup(popup) => {
|
||||||
|
PointerFocusTarget::WlSurface(popup.wl_surface().clone())
|
||||||
|
}
|
||||||
|
KeyboardFocusTarget::LockSurface(lock) => {
|
||||||
|
PointerFocusTarget::WlSurface(lock.wl_surface().clone())
|
||||||
|
}
|
||||||
|
_ => unreachable!("A group cannot start a popup grab"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
impl TryFrom<PointerFocusTarget> for KeyboardFocusTarget {
|
impl TryFrom<PointerFocusTarget> for KeyboardFocusTarget {
|
||||||
type Error = ();
|
type Error = ();
|
||||||
fn try_from(target: PointerFocusTarget) -> Result<Self, Self::Error> {
|
fn try_from(target: PointerFocusTarget) -> Result<Self, Self::Error> {
|
||||||
|
|
@ -73,6 +85,24 @@ impl TryFrom<PointerFocusTarget> for KeyboardFocusTarget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
impl PointerFocusTarget {
|
||||||
|
pub fn under_surface<P: Into<Point<f64, Logical>>>(
|
||||||
|
surface: &CosmicSurface,
|
||||||
|
point: P,
|
||||||
|
) -> Option<(Self, Point<i32, Logical>)> {
|
||||||
|
match surface.0.underlying_surface() {
|
||||||
|
WindowSurface::Wayland(_toplevel) => surface
|
||||||
|
.0
|
||||||
|
.surface_under(point, WindowSurfaceType::ALL)
|
||||||
|
.map(|(wl_surface, point)| (Self::WlSurface(wl_surface), point)),
|
||||||
|
WindowSurface::X11(surface) => {
|
||||||
|
Some((Self::WlSurface(surface.wl_surface()?), Point::default()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl KeyboardFocusTarget {
|
impl KeyboardFocusTarget {
|
||||||
pub fn toplevel(&self) -> Option<WlSurface> {
|
pub fn toplevel(&self) -> Option<WlSurface> {
|
||||||
|
|
@ -100,13 +130,11 @@ impl PartialEq for WindowGroup {
|
||||||
impl IsAlive for PointerFocusTarget {
|
impl IsAlive for PointerFocusTarget {
|
||||||
fn alive(&self) -> bool {
|
fn alive(&self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
PointerFocusTarget::Element(e) => e.alive(),
|
// XXX? does this change anything
|
||||||
PointerFocusTarget::Fullscreen(f) => f.alive(),
|
PointerFocusTarget::WlSurface(s) => s.alive(),
|
||||||
PointerFocusTarget::LayerSurface(l) => l.alive(),
|
PointerFocusTarget::StackUI(e) => e.alive(),
|
||||||
PointerFocusTarget::Popup(p) => p.alive(),
|
PointerFocusTarget::WindowUI(e) => e.alive(),
|
||||||
PointerFocusTarget::OverrideRedirect(s) => s.alive(),
|
|
||||||
PointerFocusTarget::ResizeFork(f) => f.alive(),
|
PointerFocusTarget::ResizeFork(f) => f.alive(),
|
||||||
PointerFocusTarget::LockSurface(l) => l.alive(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -127,111 +155,62 @@ impl IsAlive for KeyboardFocusTarget {
|
||||||
impl PointerTarget<State> for PointerFocusTarget {
|
impl PointerTarget<State> for PointerFocusTarget {
|
||||||
fn enter(&self, seat: &Seat<State>, data: &mut State, event: &MotionEvent) {
|
fn enter(&self, seat: &Seat<State>, data: &mut State, event: &MotionEvent) {
|
||||||
match self {
|
match self {
|
||||||
PointerFocusTarget::Element(w) => PointerTarget::enter(w, seat, data, event),
|
PointerFocusTarget::WlSurface(s) => PointerTarget::enter(s, seat, data, event),
|
||||||
PointerFocusTarget::Fullscreen(w) => PointerTarget::enter(w, seat, data, event),
|
PointerFocusTarget::StackUI(u) => PointerTarget::enter(u, seat, data, event),
|
||||||
PointerFocusTarget::LayerSurface(l) => PointerTarget::enter(l, seat, data, event),
|
PointerFocusTarget::WindowUI(u) => PointerTarget::enter(u, seat, data, event),
|
||||||
PointerFocusTarget::Popup(p) => PointerTarget::enter(p.wl_surface(), seat, data, event),
|
|
||||||
PointerFocusTarget::OverrideRedirect(s) => PointerTarget::enter(s, seat, data, event),
|
|
||||||
PointerFocusTarget::ResizeFork(f) => PointerTarget::enter(f, seat, data, event),
|
PointerFocusTarget::ResizeFork(f) => PointerTarget::enter(f, seat, data, event),
|
||||||
PointerFocusTarget::LockSurface(l) => {
|
|
||||||
PointerTarget::enter(l.wl_surface(), seat, data, event)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn motion(&self, seat: &Seat<State>, data: &mut State, event: &MotionEvent) {
|
fn motion(&self, seat: &Seat<State>, data: &mut State, event: &MotionEvent) {
|
||||||
match self {
|
match self {
|
||||||
PointerFocusTarget::Element(w) => PointerTarget::motion(w, seat, data, event),
|
PointerFocusTarget::WlSurface(s) => PointerTarget::motion(s, seat, data, event),
|
||||||
PointerFocusTarget::Fullscreen(w) => PointerTarget::motion(w, seat, data, event),
|
PointerFocusTarget::StackUI(u) => PointerTarget::motion(u, seat, data, event),
|
||||||
PointerFocusTarget::LayerSurface(l) => PointerTarget::motion(l, seat, data, event),
|
PointerFocusTarget::WindowUI(u) => PointerTarget::motion(u, seat, data, event),
|
||||||
PointerFocusTarget::Popup(p) => {
|
|
||||||
PointerTarget::motion(p.wl_surface(), seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::OverrideRedirect(s) => PointerTarget::motion(s, seat, data, event),
|
|
||||||
PointerFocusTarget::ResizeFork(f) => PointerTarget::motion(f, seat, data, event),
|
PointerFocusTarget::ResizeFork(f) => PointerTarget::motion(f, seat, data, event),
|
||||||
PointerFocusTarget::LockSurface(l) => {
|
|
||||||
PointerTarget::motion(l.wl_surface(), seat, data, event)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn relative_motion(&self, seat: &Seat<State>, data: &mut State, event: &RelativeMotionEvent) {
|
fn relative_motion(&self, seat: &Seat<State>, data: &mut State, event: &RelativeMotionEvent) {
|
||||||
match self {
|
match self {
|
||||||
PointerFocusTarget::Element(w) => PointerTarget::relative_motion(w, seat, data, event),
|
PointerFocusTarget::WlSurface(s) => {
|
||||||
PointerFocusTarget::Fullscreen(w) => {
|
|
||||||
PointerTarget::relative_motion(w, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::LayerSurface(l) => {
|
|
||||||
PointerTarget::relative_motion(l, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::Popup(p) => {
|
|
||||||
PointerTarget::relative_motion(p.wl_surface(), seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::OverrideRedirect(s) => {
|
|
||||||
PointerTarget::relative_motion(s, seat, data, event)
|
PointerTarget::relative_motion(s, seat, data, event)
|
||||||
}
|
}
|
||||||
|
PointerFocusTarget::StackUI(u) => PointerTarget::relative_motion(u, seat, data, event),
|
||||||
|
PointerFocusTarget::WindowUI(u) => PointerTarget::relative_motion(u, seat, data, event),
|
||||||
PointerFocusTarget::ResizeFork(f) => {
|
PointerFocusTarget::ResizeFork(f) => {
|
||||||
PointerTarget::relative_motion(f, seat, data, event)
|
PointerTarget::relative_motion(f, seat, data, event)
|
||||||
}
|
}
|
||||||
PointerFocusTarget::LockSurface(l) => {
|
|
||||||
PointerTarget::relative_motion(l.wl_surface(), seat, data, event)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn button(&self, seat: &Seat<State>, data: &mut State, event: &ButtonEvent) {
|
fn button(&self, seat: &Seat<State>, data: &mut State, event: &ButtonEvent) {
|
||||||
match self {
|
match self {
|
||||||
PointerFocusTarget::Element(w) => PointerTarget::button(w, seat, data, event),
|
PointerFocusTarget::WlSurface(s) => PointerTarget::button(s, seat, data, event),
|
||||||
PointerFocusTarget::Fullscreen(w) => PointerTarget::button(w, seat, data, event),
|
PointerFocusTarget::StackUI(u) => PointerTarget::button(u, seat, data, event),
|
||||||
PointerFocusTarget::LayerSurface(l) => PointerTarget::button(l, seat, data, event),
|
PointerFocusTarget::WindowUI(u) => PointerTarget::button(u, seat, data, event),
|
||||||
PointerFocusTarget::Popup(p) => {
|
|
||||||
PointerTarget::button(p.wl_surface(), seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::OverrideRedirect(s) => PointerTarget::button(s, seat, data, event),
|
|
||||||
PointerFocusTarget::ResizeFork(f) => PointerTarget::button(f, seat, data, event),
|
PointerFocusTarget::ResizeFork(f) => PointerTarget::button(f, seat, data, event),
|
||||||
PointerFocusTarget::LockSurface(l) => {
|
|
||||||
PointerTarget::button(l.wl_surface(), seat, data, event)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn axis(&self, seat: &Seat<State>, data: &mut State, frame: AxisFrame) {
|
fn axis(&self, seat: &Seat<State>, data: &mut State, frame: AxisFrame) {
|
||||||
match self {
|
match self {
|
||||||
PointerFocusTarget::Element(w) => PointerTarget::axis(w, seat, data, frame),
|
PointerFocusTarget::WlSurface(s) => PointerTarget::axis(s, seat, data, frame),
|
||||||
PointerFocusTarget::Fullscreen(w) => PointerTarget::axis(w, seat, data, frame),
|
PointerFocusTarget::StackUI(u) => PointerTarget::axis(u, seat, data, frame),
|
||||||
PointerFocusTarget::LayerSurface(l) => PointerTarget::axis(l, seat, data, frame),
|
PointerFocusTarget::WindowUI(u) => PointerTarget::axis(u, seat, data, frame),
|
||||||
PointerFocusTarget::Popup(p) => PointerTarget::axis(p.wl_surface(), seat, data, frame),
|
|
||||||
PointerFocusTarget::OverrideRedirect(s) => PointerTarget::axis(s, seat, data, frame),
|
|
||||||
PointerFocusTarget::ResizeFork(f) => PointerTarget::axis(f, seat, data, frame),
|
PointerFocusTarget::ResizeFork(f) => PointerTarget::axis(f, seat, data, frame),
|
||||||
PointerFocusTarget::LockSurface(l) => {
|
|
||||||
PointerTarget::axis(l.wl_surface(), seat, data, frame)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn frame(&self, seat: &Seat<State>, data: &mut State) {
|
fn frame(&self, seat: &Seat<State>, data: &mut State) {
|
||||||
match self {
|
match self {
|
||||||
PointerFocusTarget::Element(w) => PointerTarget::frame(w, seat, data),
|
PointerFocusTarget::WlSurface(s) => PointerTarget::frame(s, seat, data),
|
||||||
PointerFocusTarget::Fullscreen(w) => PointerTarget::frame(w, seat, data),
|
PointerFocusTarget::StackUI(u) => PointerTarget::frame(u, seat, data),
|
||||||
PointerFocusTarget::LayerSurface(l) => PointerTarget::frame(l, seat, data),
|
PointerFocusTarget::WindowUI(u) => PointerTarget::frame(u, seat, data),
|
||||||
PointerFocusTarget::Popup(p) => PointerTarget::frame(p.wl_surface(), seat, data),
|
|
||||||
PointerFocusTarget::OverrideRedirect(s) => PointerTarget::frame(s, seat, data),
|
|
||||||
PointerFocusTarget::ResizeFork(f) => PointerTarget::frame(f, seat, data),
|
PointerFocusTarget::ResizeFork(f) => PointerTarget::frame(f, seat, data),
|
||||||
PointerFocusTarget::LockSurface(l) => PointerTarget::frame(l.wl_surface(), seat, data),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn leave(&self, seat: &Seat<State>, data: &mut State, serial: Serial, time: u32) {
|
fn leave(&self, seat: &Seat<State>, data: &mut State, serial: Serial, time: u32) {
|
||||||
match self {
|
match self {
|
||||||
PointerFocusTarget::Element(w) => PointerTarget::leave(w, seat, data, serial, time),
|
PointerFocusTarget::WlSurface(s) => PointerTarget::leave(s, seat, data, serial, time),
|
||||||
PointerFocusTarget::Fullscreen(w) => PointerTarget::leave(w, seat, data, serial, time),
|
PointerFocusTarget::StackUI(u) => PointerTarget::leave(u, seat, data, serial, time),
|
||||||
PointerFocusTarget::LayerSurface(l) => {
|
PointerFocusTarget::WindowUI(u) => PointerTarget::leave(u, seat, data, serial, time),
|
||||||
PointerTarget::leave(l, seat, data, serial, time)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::Popup(p) => {
|
|
||||||
PointerTarget::leave(p.wl_surface(), seat, data, serial, time)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::OverrideRedirect(s) => {
|
|
||||||
PointerTarget::leave(s, seat, data, serial, time)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::ResizeFork(f) => PointerTarget::leave(f, seat, data, serial, time),
|
PointerFocusTarget::ResizeFork(f) => PointerTarget::leave(f, seat, data, serial, time),
|
||||||
PointerFocusTarget::LockSurface(l) => {
|
|
||||||
PointerTarget::leave(l.wl_surface(), seat, data, serial, time)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn gesture_swipe_begin(
|
fn gesture_swipe_begin(
|
||||||
|
|
@ -241,27 +220,18 @@ impl PointerTarget<State> for PointerFocusTarget {
|
||||||
event: &GestureSwipeBeginEvent,
|
event: &GestureSwipeBeginEvent,
|
||||||
) {
|
) {
|
||||||
match self {
|
match self {
|
||||||
PointerFocusTarget::Element(w) => {
|
PointerFocusTarget::WlSurface(s) => {
|
||||||
PointerTarget::gesture_swipe_begin(w, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::Fullscreen(w) => {
|
|
||||||
PointerTarget::gesture_swipe_begin(w, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::LayerSurface(l) => {
|
|
||||||
PointerTarget::gesture_swipe_begin(l, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::Popup(p) => {
|
|
||||||
PointerTarget::gesture_swipe_begin(p.wl_surface(), seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::OverrideRedirect(s) => {
|
|
||||||
PointerTarget::gesture_swipe_begin(s, seat, data, event)
|
PointerTarget::gesture_swipe_begin(s, seat, data, event)
|
||||||
}
|
}
|
||||||
|
PointerFocusTarget::StackUI(u) => {
|
||||||
|
PointerTarget::gesture_swipe_begin(u, seat, data, event)
|
||||||
|
}
|
||||||
|
PointerFocusTarget::WindowUI(u) => {
|
||||||
|
PointerTarget::gesture_swipe_begin(u, seat, data, event)
|
||||||
|
}
|
||||||
PointerFocusTarget::ResizeFork(f) => {
|
PointerFocusTarget::ResizeFork(f) => {
|
||||||
PointerTarget::gesture_swipe_begin(f, seat, data, event)
|
PointerTarget::gesture_swipe_begin(f, seat, data, event)
|
||||||
}
|
}
|
||||||
PointerFocusTarget::LockSurface(l) => {
|
|
||||||
PointerTarget::gesture_swipe_begin(l.wl_surface(), seat, data, event)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn gesture_swipe_update(
|
fn gesture_swipe_update(
|
||||||
|
|
@ -271,27 +241,18 @@ impl PointerTarget<State> for PointerFocusTarget {
|
||||||
event: &GestureSwipeUpdateEvent,
|
event: &GestureSwipeUpdateEvent,
|
||||||
) {
|
) {
|
||||||
match self {
|
match self {
|
||||||
PointerFocusTarget::Element(w) => {
|
PointerFocusTarget::WlSurface(s) => {
|
||||||
PointerTarget::gesture_swipe_update(w, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::Fullscreen(w) => {
|
|
||||||
PointerTarget::gesture_swipe_update(w, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::LayerSurface(l) => {
|
|
||||||
PointerTarget::gesture_swipe_update(l, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::Popup(p) => {
|
|
||||||
PointerTarget::gesture_swipe_update(p.wl_surface(), seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::OverrideRedirect(s) => {
|
|
||||||
PointerTarget::gesture_swipe_update(s, seat, data, event)
|
PointerTarget::gesture_swipe_update(s, seat, data, event)
|
||||||
}
|
}
|
||||||
|
PointerFocusTarget::StackUI(u) => {
|
||||||
|
PointerTarget::gesture_swipe_update(u, seat, data, event)
|
||||||
|
}
|
||||||
|
PointerFocusTarget::WindowUI(u) => {
|
||||||
|
PointerTarget::gesture_swipe_update(u, seat, data, event)
|
||||||
|
}
|
||||||
PointerFocusTarget::ResizeFork(f) => {
|
PointerFocusTarget::ResizeFork(f) => {
|
||||||
PointerTarget::gesture_swipe_update(f, seat, data, event)
|
PointerTarget::gesture_swipe_update(f, seat, data, event)
|
||||||
}
|
}
|
||||||
PointerFocusTarget::LockSurface(l) => {
|
|
||||||
PointerTarget::gesture_swipe_update(l.wl_surface(), seat, data, event)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn gesture_swipe_end(
|
fn gesture_swipe_end(
|
||||||
|
|
@ -301,27 +262,18 @@ impl PointerTarget<State> for PointerFocusTarget {
|
||||||
event: &GestureSwipeEndEvent,
|
event: &GestureSwipeEndEvent,
|
||||||
) {
|
) {
|
||||||
match self {
|
match self {
|
||||||
PointerFocusTarget::Element(w) => {
|
PointerFocusTarget::WlSurface(s) => {
|
||||||
PointerTarget::gesture_swipe_end(w, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::Fullscreen(w) => {
|
|
||||||
PointerTarget::gesture_swipe_end(w, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::LayerSurface(l) => {
|
|
||||||
PointerTarget::gesture_swipe_end(l, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::Popup(p) => {
|
|
||||||
PointerTarget::gesture_swipe_end(p.wl_surface(), seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::OverrideRedirect(s) => {
|
|
||||||
PointerTarget::gesture_swipe_end(s, seat, data, event)
|
PointerTarget::gesture_swipe_end(s, seat, data, event)
|
||||||
}
|
}
|
||||||
|
PointerFocusTarget::StackUI(u) => {
|
||||||
|
PointerTarget::gesture_swipe_end(u, seat, data, event)
|
||||||
|
}
|
||||||
|
PointerFocusTarget::WindowUI(u) => {
|
||||||
|
PointerTarget::gesture_swipe_end(u, seat, data, event)
|
||||||
|
}
|
||||||
PointerFocusTarget::ResizeFork(f) => {
|
PointerFocusTarget::ResizeFork(f) => {
|
||||||
PointerTarget::gesture_swipe_end(f, seat, data, event)
|
PointerTarget::gesture_swipe_end(f, seat, data, event)
|
||||||
}
|
}
|
||||||
PointerFocusTarget::LockSurface(l) => {
|
|
||||||
PointerTarget::gesture_swipe_end(l.wl_surface(), seat, data, event)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn gesture_pinch_begin(
|
fn gesture_pinch_begin(
|
||||||
|
|
@ -331,27 +283,18 @@ impl PointerTarget<State> for PointerFocusTarget {
|
||||||
event: &GesturePinchBeginEvent,
|
event: &GesturePinchBeginEvent,
|
||||||
) {
|
) {
|
||||||
match self {
|
match self {
|
||||||
PointerFocusTarget::Element(w) => {
|
PointerFocusTarget::WlSurface(s) => {
|
||||||
PointerTarget::gesture_pinch_begin(w, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::Fullscreen(w) => {
|
|
||||||
PointerTarget::gesture_pinch_begin(w, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::LayerSurface(l) => {
|
|
||||||
PointerTarget::gesture_pinch_begin(l, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::Popup(p) => {
|
|
||||||
PointerTarget::gesture_pinch_begin(p.wl_surface(), seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::OverrideRedirect(s) => {
|
|
||||||
PointerTarget::gesture_pinch_begin(s, seat, data, event)
|
PointerTarget::gesture_pinch_begin(s, seat, data, event)
|
||||||
}
|
}
|
||||||
|
PointerFocusTarget::StackUI(u) => {
|
||||||
|
PointerTarget::gesture_pinch_begin(u, seat, data, event)
|
||||||
|
}
|
||||||
|
PointerFocusTarget::WindowUI(u) => {
|
||||||
|
PointerTarget::gesture_pinch_begin(u, seat, data, event)
|
||||||
|
}
|
||||||
PointerFocusTarget::ResizeFork(f) => {
|
PointerFocusTarget::ResizeFork(f) => {
|
||||||
PointerTarget::gesture_pinch_begin(f, seat, data, event)
|
PointerTarget::gesture_pinch_begin(f, seat, data, event)
|
||||||
}
|
}
|
||||||
PointerFocusTarget::LockSurface(l) => {
|
|
||||||
PointerTarget::gesture_pinch_begin(l.wl_surface(), seat, data, event)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn gesture_pinch_update(
|
fn gesture_pinch_update(
|
||||||
|
|
@ -361,27 +304,18 @@ impl PointerTarget<State> for PointerFocusTarget {
|
||||||
event: &GesturePinchUpdateEvent,
|
event: &GesturePinchUpdateEvent,
|
||||||
) {
|
) {
|
||||||
match self {
|
match self {
|
||||||
PointerFocusTarget::Element(w) => {
|
PointerFocusTarget::WlSurface(s) => {
|
||||||
PointerTarget::gesture_pinch_update(w, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::Fullscreen(w) => {
|
|
||||||
PointerTarget::gesture_pinch_update(w, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::LayerSurface(l) => {
|
|
||||||
PointerTarget::gesture_pinch_update(l, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::Popup(p) => {
|
|
||||||
PointerTarget::gesture_pinch_update(p.wl_surface(), seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::OverrideRedirect(s) => {
|
|
||||||
PointerTarget::gesture_pinch_update(s, seat, data, event)
|
PointerTarget::gesture_pinch_update(s, seat, data, event)
|
||||||
}
|
}
|
||||||
|
PointerFocusTarget::StackUI(u) => {
|
||||||
|
PointerTarget::gesture_pinch_update(u, seat, data, event)
|
||||||
|
}
|
||||||
|
PointerFocusTarget::WindowUI(u) => {
|
||||||
|
PointerTarget::gesture_pinch_update(u, seat, data, event)
|
||||||
|
}
|
||||||
PointerFocusTarget::ResizeFork(f) => {
|
PointerFocusTarget::ResizeFork(f) => {
|
||||||
PointerTarget::gesture_pinch_update(f, seat, data, event)
|
PointerTarget::gesture_pinch_update(f, seat, data, event)
|
||||||
}
|
}
|
||||||
PointerFocusTarget::LockSurface(l) => {
|
|
||||||
PointerTarget::gesture_pinch_update(l.wl_surface(), seat, data, event)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn gesture_pinch_end(
|
fn gesture_pinch_end(
|
||||||
|
|
@ -391,27 +325,18 @@ impl PointerTarget<State> for PointerFocusTarget {
|
||||||
event: &GesturePinchEndEvent,
|
event: &GesturePinchEndEvent,
|
||||||
) {
|
) {
|
||||||
match self {
|
match self {
|
||||||
PointerFocusTarget::Element(w) => {
|
PointerFocusTarget::WlSurface(s) => {
|
||||||
PointerTarget::gesture_pinch_end(w, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::Fullscreen(w) => {
|
|
||||||
PointerTarget::gesture_pinch_end(w, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::LayerSurface(l) => {
|
|
||||||
PointerTarget::gesture_pinch_end(l, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::Popup(p) => {
|
|
||||||
PointerTarget::gesture_pinch_end(p.wl_surface(), seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::OverrideRedirect(s) => {
|
|
||||||
PointerTarget::gesture_pinch_end(s, seat, data, event)
|
PointerTarget::gesture_pinch_end(s, seat, data, event)
|
||||||
}
|
}
|
||||||
|
PointerFocusTarget::StackUI(u) => {
|
||||||
|
PointerTarget::gesture_pinch_end(u, seat, data, event)
|
||||||
|
}
|
||||||
|
PointerFocusTarget::WindowUI(u) => {
|
||||||
|
PointerTarget::gesture_pinch_end(u, seat, data, event)
|
||||||
|
}
|
||||||
PointerFocusTarget::ResizeFork(f) => {
|
PointerFocusTarget::ResizeFork(f) => {
|
||||||
PointerTarget::gesture_pinch_end(f, seat, data, event)
|
PointerTarget::gesture_pinch_end(f, seat, data, event)
|
||||||
}
|
}
|
||||||
PointerFocusTarget::LockSurface(l) => {
|
|
||||||
PointerTarget::gesture_pinch_end(l.wl_surface(), seat, data, event)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn gesture_hold_begin(
|
fn gesture_hold_begin(
|
||||||
|
|
@ -421,50 +346,32 @@ impl PointerTarget<State> for PointerFocusTarget {
|
||||||
event: &GestureHoldBeginEvent,
|
event: &GestureHoldBeginEvent,
|
||||||
) {
|
) {
|
||||||
match self {
|
match self {
|
||||||
PointerFocusTarget::Element(w) => {
|
PointerFocusTarget::WlSurface(s) => {
|
||||||
PointerTarget::gesture_hold_begin(w, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::Fullscreen(w) => {
|
|
||||||
PointerTarget::gesture_hold_begin(w, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::LayerSurface(l) => {
|
|
||||||
PointerTarget::gesture_hold_begin(l, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::Popup(p) => {
|
|
||||||
PointerTarget::gesture_hold_begin(p.wl_surface(), seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::OverrideRedirect(s) => {
|
|
||||||
PointerTarget::gesture_hold_begin(s, seat, data, event)
|
PointerTarget::gesture_hold_begin(s, seat, data, event)
|
||||||
}
|
}
|
||||||
|
PointerFocusTarget::StackUI(u) => {
|
||||||
|
PointerTarget::gesture_hold_begin(u, seat, data, event)
|
||||||
|
}
|
||||||
|
PointerFocusTarget::WindowUI(u) => {
|
||||||
|
PointerTarget::gesture_hold_begin(u, seat, data, event)
|
||||||
|
}
|
||||||
PointerFocusTarget::ResizeFork(f) => {
|
PointerFocusTarget::ResizeFork(f) => {
|
||||||
PointerTarget::gesture_hold_begin(f, seat, data, event)
|
PointerTarget::gesture_hold_begin(f, seat, data, event)
|
||||||
}
|
}
|
||||||
PointerFocusTarget::LockSurface(l) => {
|
|
||||||
PointerTarget::gesture_hold_begin(l.wl_surface(), seat, data, event)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn gesture_hold_end(&self, seat: &Seat<State>, data: &mut State, event: &GestureHoldEndEvent) {
|
fn gesture_hold_end(&self, seat: &Seat<State>, data: &mut State, event: &GestureHoldEndEvent) {
|
||||||
match self {
|
match self {
|
||||||
PointerFocusTarget::Element(w) => PointerTarget::gesture_hold_end(w, seat, data, event),
|
PointerFocusTarget::WlSurface(s) => {
|
||||||
PointerFocusTarget::Fullscreen(w) => {
|
|
||||||
PointerTarget::gesture_hold_end(w, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::LayerSurface(l) => {
|
|
||||||
PointerTarget::gesture_hold_end(l, seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::Popup(p) => {
|
|
||||||
PointerTarget::gesture_hold_end(p.wl_surface(), seat, data, event)
|
|
||||||
}
|
|
||||||
PointerFocusTarget::OverrideRedirect(s) => {
|
|
||||||
PointerTarget::gesture_hold_end(s, seat, data, event)
|
PointerTarget::gesture_hold_end(s, seat, data, event)
|
||||||
}
|
}
|
||||||
|
PointerFocusTarget::StackUI(u) => PointerTarget::gesture_hold_end(u, seat, data, event),
|
||||||
|
PointerFocusTarget::WindowUI(u) => {
|
||||||
|
PointerTarget::gesture_hold_end(u, seat, data, event)
|
||||||
|
}
|
||||||
PointerFocusTarget::ResizeFork(f) => {
|
PointerFocusTarget::ResizeFork(f) => {
|
||||||
PointerTarget::gesture_hold_end(f, seat, data, event)
|
PointerTarget::gesture_hold_end(f, seat, data, event)
|
||||||
}
|
}
|
||||||
PointerFocusTarget::LockSurface(l) => {
|
|
||||||
PointerTarget::gesture_hold_end(l.wl_surface(), seat, data, event)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -590,59 +497,40 @@ impl WaylandFocus for KeyboardFocusTarget {
|
||||||
impl WaylandFocus for PointerFocusTarget {
|
impl WaylandFocus for PointerFocusTarget {
|
||||||
fn wl_surface(&self) -> Option<WlSurface> {
|
fn wl_surface(&self) -> Option<WlSurface> {
|
||||||
Some(match self {
|
Some(match self {
|
||||||
PointerFocusTarget::Element(w) => WaylandFocus::wl_surface(w)?,
|
PointerFocusTarget::WlSurface(s) => s.clone(),
|
||||||
PointerFocusTarget::Fullscreen(w) => WaylandFocus::wl_surface(w)?,
|
PointerFocusTarget::ResizeFork(_)
|
||||||
PointerFocusTarget::LayerSurface(l) => l.wl_surface().clone(),
|
| PointerFocusTarget::StackUI(_)
|
||||||
PointerFocusTarget::Popup(p) => p.wl_surface().clone(),
|
| PointerFocusTarget::WindowUI(_) => {
|
||||||
PointerFocusTarget::OverrideRedirect(s) => {
|
|
||||||
return s.wl_surface();
|
|
||||||
}
|
|
||||||
PointerFocusTarget::ResizeFork(_) => {
|
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
PointerFocusTarget::LockSurface(l) => l.wl_surface().clone(),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
fn same_client_as(&self, object_id: &ObjectId) -> bool {
|
fn same_client_as(&self, object_id: &ObjectId) -> bool {
|
||||||
match self {
|
match self {
|
||||||
PointerFocusTarget::Element(w) => WaylandFocus::same_client_as(w, object_id),
|
PointerFocusTarget::WlSurface(s) => s.id().same_client_as(object_id),
|
||||||
PointerFocusTarget::Fullscreen(w) => WaylandFocus::same_client_as(w, object_id),
|
PointerFocusTarget::StackUI(stack) => stack
|
||||||
PointerFocusTarget::LayerSurface(l) => l.wl_surface().id().same_client_as(object_id),
|
.active()
|
||||||
PointerFocusTarget::Popup(p) => p.wl_surface().id().same_client_as(object_id),
|
.wl_surface()
|
||||||
PointerFocusTarget::OverrideRedirect(s) => WaylandFocus::same_client_as(s, object_id),
|
.map(|s| s.id().same_client_as(object_id))
|
||||||
|
.unwrap_or(false),
|
||||||
|
PointerFocusTarget::WindowUI(window) => window
|
||||||
|
.wl_surface()
|
||||||
|
.map(|s| s.id().same_client_as(object_id))
|
||||||
|
.unwrap_or(false),
|
||||||
PointerFocusTarget::ResizeFork(_) => false,
|
PointerFocusTarget::ResizeFork(_) => false,
|
||||||
PointerFocusTarget::LockSurface(l) => l.wl_surface().id().same_client_as(object_id),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<CosmicMapped> for PointerFocusTarget {
|
impl From<WlSurface> for PointerFocusTarget {
|
||||||
fn from(w: CosmicMapped) -> Self {
|
fn from(s: WlSurface) -> Self {
|
||||||
PointerFocusTarget::Element(w)
|
PointerFocusTarget::WlSurface(s)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<CosmicSurface> for PointerFocusTarget {
|
|
||||||
fn from(s: CosmicSurface) -> Self {
|
|
||||||
PointerFocusTarget::Fullscreen(s)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<LayerSurface> for PointerFocusTarget {
|
|
||||||
fn from(l: LayerSurface) -> Self {
|
|
||||||
PointerFocusTarget::LayerSurface(l)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<PopupKind> for PointerFocusTarget {
|
impl From<PopupKind> for PointerFocusTarget {
|
||||||
fn from(p: PopupKind) -> Self {
|
fn from(p: PopupKind) -> Self {
|
||||||
PointerFocusTarget::Popup(p)
|
PointerFocusTarget::WlSurface(p.wl_surface().clone())
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<X11Surface> for PointerFocusTarget {
|
|
||||||
fn from(s: X11Surface) -> Self {
|
|
||||||
PointerFocusTarget::OverrideRedirect(s)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -654,7 +542,7 @@ impl From<ResizeForkTarget> for PointerFocusTarget {
|
||||||
|
|
||||||
impl From<LockSurface> for PointerFocusTarget {
|
impl From<LockSurface> for PointerFocusTarget {
|
||||||
fn from(l: LockSurface) -> Self {
|
fn from(l: LockSurface) -> Self {
|
||||||
PointerFocusTarget::LockSurface(l)
|
PointerFocusTarget::WlSurface(l.wl_surface().clone())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -760,18 +760,24 @@ impl Drop for MoveGrab {
|
||||||
|
|
||||||
if let Some((mapped, position)) = position {
|
if let Some((mapped, position)) = position {
|
||||||
let serial = SERIAL_COUNTER.next_serial();
|
let serial = SERIAL_COUNTER.next_serial();
|
||||||
pointer.motion(
|
let current_location = pointer.current_location();
|
||||||
state,
|
|
||||||
Some((
|
if let Some((target, offset)) =
|
||||||
PointerFocusTarget::from(mapped.clone()),
|
mapped.focus_under(current_location - position.as_logical().to_f64())
|
||||||
position.as_logical() - window.geometry().loc,
|
{
|
||||||
)),
|
pointer.motion(
|
||||||
&MotionEvent {
|
state,
|
||||||
location: pointer.current_location(),
|
Some((
|
||||||
serial,
|
target,
|
||||||
time: 0,
|
position.as_logical() - window.geometry().loc + offset,
|
||||||
},
|
)),
|
||||||
);
|
&MotionEvent {
|
||||||
|
location: pointer.current_location(),
|
||||||
|
serial,
|
||||||
|
time: 0,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
Common::set_focus(
|
Common::set_focus(
|
||||||
state,
|
state,
|
||||||
Some(&KeyboardFocusTarget::from(mapped)),
|
Some(&KeyboardFocusTarget::from(mapped)),
|
||||||
|
|
|
||||||
|
|
@ -686,7 +686,13 @@ impl FloatingLayout {
|
||||||
self.space.element_geometry(elem).map(RectExt::as_local)
|
self.space.element_geometry(elem).map(RectExt::as_local)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn element_under(
|
pub fn element_under(&mut self, location: Point<f64, Local>) -> Option<KeyboardFocusTarget> {
|
||||||
|
self.space
|
||||||
|
.element_under(location.as_logical())
|
||||||
|
.map(|(mapped, _)| mapped.clone().into())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn surface_under(
|
||||||
&mut self,
|
&mut self,
|
||||||
location: Point<f64, Local>,
|
location: Point<f64, Local>,
|
||||||
) -> Option<(PointerFocusTarget, Point<i32, Local>)> {
|
) -> Option<(PointerFocusTarget, Point<i32, Local>)> {
|
||||||
|
|
@ -694,6 +700,7 @@ impl FloatingLayout {
|
||||||
.space
|
.space
|
||||||
.element_under(location.as_logical())
|
.element_under(location.as_logical())
|
||||||
.map(|(mapped, p)| (mapped.clone(), p.as_local()));
|
.map(|(mapped, p)| (mapped.clone(), p.as_local()));
|
||||||
|
|
||||||
if let Some((mapped, _)) = res.as_ref() {
|
if let Some((mapped, _)) = res.as_ref() {
|
||||||
let geometry = self.space.element_geometry(mapped).unwrap();
|
let geometry = self.space.element_geometry(mapped).unwrap();
|
||||||
let offset = location.y.round() as i32 - geometry.loc.y;
|
let offset = location.y.round() as i32 - geometry.loc.y;
|
||||||
|
|
@ -705,7 +712,16 @@ impl FloatingLayout {
|
||||||
} else {
|
} else {
|
||||||
self.hovered_stack.take();
|
self.hovered_stack.take();
|
||||||
}
|
}
|
||||||
res.map(|(m, p)| (m.into(), p))
|
|
||||||
|
res.and_then(|(element, space_offset)| {
|
||||||
|
let geometry = self.space.element_geometry(&element).unwrap().as_local();
|
||||||
|
let point = location - geometry.loc.to_f64();
|
||||||
|
element
|
||||||
|
.focus_under(point.as_logical())
|
||||||
|
.map(|(surface, surface_offset)| {
|
||||||
|
(surface, space_offset + surface_offset.as_local())
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn stacking_indicator(&self) -> Option<Rectangle<i32, Local>> {
|
pub fn stacking_indicator(&self) -> Option<Rectangle<i32, Local>> {
|
||||||
|
|
|
||||||
|
|
@ -3088,6 +3088,26 @@ impl TilingLayout {
|
||||||
pub fn element_under(
|
pub fn element_under(
|
||||||
&mut self,
|
&mut self,
|
||||||
location_f64: Point<f64, Local>,
|
location_f64: Point<f64, Local>,
|
||||||
|
) -> Option<KeyboardFocusTarget> {
|
||||||
|
let location = location_f64.to_i32_round();
|
||||||
|
|
||||||
|
for (mapped, geo) in self.mapped() {
|
||||||
|
if !mapped.bbox().contains((location - geo.loc).as_logical()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if mapped.is_in_input_region(
|
||||||
|
&((location_f64 - geo.loc.to_f64()).as_logical() + mapped.geometry().loc.to_f64()),
|
||||||
|
) {
|
||||||
|
return Some(mapped.clone().into());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn surface_under(
|
||||||
|
&mut self,
|
||||||
|
location_f64: Point<f64, Local>,
|
||||||
overview: OverviewMode,
|
overview: OverviewMode,
|
||||||
) -> Option<(PointerFocusTarget, Point<i32, Local>)> {
|
) -> Option<(PointerFocusTarget, Point<i32, Local>)> {
|
||||||
let gaps = self.gaps();
|
let gaps = self.gaps();
|
||||||
|
|
@ -3115,13 +3135,12 @@ impl TilingLayout {
|
||||||
if !mapped.bbox().contains((location - geo.loc).as_logical()) {
|
if !mapped.bbox().contains((location - geo.loc).as_logical()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if mapped.is_in_input_region(
|
if let Some((target, surface_offset)) = mapped.focus_under(
|
||||||
&((location_f64 - geo.loc.to_f64()).as_logical()
|
(location_f64 - geo.loc.to_f64()).as_logical() + mapped.geometry().loc.to_f64(),
|
||||||
+ mapped.geometry().loc.to_f64()),
|
|
||||||
) {
|
) {
|
||||||
return Some((
|
return Some((
|
||||||
mapped.clone().into(),
|
target,
|
||||||
geo.loc - mapped.geometry().loc.as_local(),
|
geo.loc - mapped.geometry().loc.as_local() + surface_offset.as_local(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3163,12 +3182,15 @@ impl TilingLayout {
|
||||||
let test_point = (location.to_f64() - last_geometry.loc.to_f64()
|
let test_point = (location.to_f64() - last_geometry.loc.to_f64()
|
||||||
+ mapped.geometry().loc.to_f64().as_local())
|
+ mapped.geometry().loc.to_f64().as_local())
|
||||||
.as_logical();
|
.as_logical();
|
||||||
mapped.is_in_input_region(&test_point).then(|| {
|
mapped
|
||||||
(
|
.focus_under(test_point)
|
||||||
mapped.clone().into(),
|
.map(|(surface, surface_offset)| {
|
||||||
last_geometry.loc - mapped.geometry().loc.as_local(),
|
(
|
||||||
)
|
surface,
|
||||||
})
|
last_geometry.loc - mapped.geometry().loc.as_local()
|
||||||
|
+ surface_offset.as_local(),
|
||||||
|
)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
Some((
|
Some((
|
||||||
id,
|
id,
|
||||||
|
|
|
||||||
|
|
@ -2057,14 +2057,45 @@ impl Shell {
|
||||||
&mut self,
|
&mut self,
|
||||||
location: Point<f64, Global>,
|
location: Point<f64, Global>,
|
||||||
output: &Output,
|
output: &Output,
|
||||||
|
) -> Option<KeyboardFocusTarget> {
|
||||||
|
self.workspaces.sets.get_mut(output).and_then(|set| {
|
||||||
|
set.sticky_layer
|
||||||
|
.space
|
||||||
|
.element_under(location.to_local(output).as_logical())
|
||||||
|
.map(|(mapped, _)| mapped.clone().into())
|
||||||
|
.or_else(|| set.workspaces[set.active].element_under(location))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
pub fn surface_under(
|
||||||
|
&mut self,
|
||||||
|
location: Point<f64, Global>,
|
||||||
|
output: &Output,
|
||||||
) -> Option<(PointerFocusTarget, Point<i32, Global>)> {
|
) -> Option<(PointerFocusTarget, Point<i32, Global>)> {
|
||||||
let overview = self.overview_mode.clone();
|
let overview = self.overview_mode.clone();
|
||||||
self.workspaces.sets.get_mut(output).and_then(|set| {
|
self.workspaces.sets.get_mut(output).and_then(|set| {
|
||||||
set.sticky_layer
|
set.sticky_layer
|
||||||
.space
|
.space
|
||||||
.element_under(location.to_local(output).as_logical())
|
.element_under(location.to_local(output).as_logical())
|
||||||
.map(|(mapped, p)| (mapped.clone().into(), p.as_local().to_global(output)))
|
.and_then(|(mapped, element_offset)| {
|
||||||
.or_else(|| set.workspaces[set.active].element_under(location, overview))
|
let geometry = set
|
||||||
|
.sticky_layer
|
||||||
|
.space
|
||||||
|
.element_geometry(mapped)
|
||||||
|
.unwrap()
|
||||||
|
.as_local();
|
||||||
|
let point = location.to_local(output) - geometry.loc.to_f64();
|
||||||
|
mapped
|
||||||
|
.focus_under(point.as_logical())
|
||||||
|
.map(|(surface, surface_offset)| {
|
||||||
|
(
|
||||||
|
surface,
|
||||||
|
(element_offset + surface_offset)
|
||||||
|
.as_local()
|
||||||
|
.to_global(output),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.or_else(|| set.workspaces[set.active].surface_under(location, overview))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2455,7 +2486,7 @@ impl Shell {
|
||||||
state.common.theme.clone(),
|
state.common.theme.clone(),
|
||||||
)
|
)
|
||||||
.into();
|
.into();
|
||||||
start_data.focus = Some((new_mapped.clone().into(), Point::from((0, 0))));
|
start_data.focus = new_mapped.focus_under((0., 0.).into());
|
||||||
new_mapped
|
new_mapped
|
||||||
} else {
|
} else {
|
||||||
old_mapped.clone()
|
old_mapped.clone()
|
||||||
|
|
@ -2843,8 +2874,10 @@ impl Shell {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
let focus = Some((mapped.clone().into(), (new_loc - geometry.loc).as_logical()));
|
let element_offset = (new_loc - geometry.loc).as_logical();
|
||||||
|
let focus = mapped
|
||||||
|
.focus_under(element_offset.to_f64())
|
||||||
|
.map(|(target, surface_offset)| (target, (surface_offset + element_offset)));
|
||||||
start_data.location = new_loc.as_logical().to_f64();
|
start_data.location = new_loc.as_logical().to_f64();
|
||||||
start_data.focus = focus.clone();
|
start_data.focus = focus.clone();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -490,15 +490,22 @@ impl Workspace {
|
||||||
.find(|e| e.windows().any(|(w, _)| &w == surface))
|
.find(|e| e.windows().any(|(w, _)| &w == surface))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn element_under(
|
pub fn element_under(&mut self, location: Point<f64, Global>) -> Option<KeyboardFocusTarget> {
|
||||||
|
let location = location.to_local(&self.output);
|
||||||
|
self.floating_layer
|
||||||
|
.element_under(location)
|
||||||
|
.or_else(|| self.tiling_layer.element_under(location))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn surface_under(
|
||||||
&mut self,
|
&mut self,
|
||||||
location: Point<f64, Global>,
|
location: Point<f64, Global>,
|
||||||
overview: OverviewMode,
|
overview: OverviewMode,
|
||||||
) -> Option<(PointerFocusTarget, Point<i32, Global>)> {
|
) -> Option<(PointerFocusTarget, Point<i32, Global>)> {
|
||||||
let location = location.to_local(&self.output);
|
let location = location.to_local(&self.output);
|
||||||
self.floating_layer
|
self.floating_layer
|
||||||
.element_under(location)
|
.surface_under(location)
|
||||||
.or_else(|| self.tiling_layer.element_under(location, overview))
|
.or_else(|| self.tiling_layer.surface_under(location, overview))
|
||||||
.map(|(m, p)| (m, p.to_global(&self.output)))
|
.map(|(m, p)| (m, p.to_global(&self.output)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,10 @@ use smithay::{
|
||||||
seat::WaylandFocus,
|
seat::WaylandFocus,
|
||||||
shell::xdg::{
|
shell::xdg::{
|
||||||
PopupSurface, PositionerState, SurfaceCachedState, ToplevelSurface,
|
PopupSurface, PositionerState, SurfaceCachedState, ToplevelSurface,
|
||||||
XdgPopupSurfaceRoleAttributes, XDG_POPUP_ROLE,
|
XdgPopupSurfaceData, XDG_POPUP_ROLE,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use std::sync::Mutex;
|
|
||||||
use tracing::{trace, warn};
|
use tracing::{trace, warn};
|
||||||
|
|
||||||
impl Shell {
|
impl Shell {
|
||||||
|
|
@ -96,7 +95,7 @@ pub fn update_reactive_popups<'a>(
|
||||||
let positioner = with_states(&surface.wl_surface(), |states| {
|
let positioner = with_states(&surface.wl_surface(), |states| {
|
||||||
let attributes = states
|
let attributes = states
|
||||||
.data_map
|
.data_map
|
||||||
.get::<Mutex<XdgPopupSurfaceRoleAttributes>>()
|
.get::<XdgPopupSurfaceData>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
@ -378,7 +377,7 @@ pub fn get_popup_toplevel(popup: &PopupSurface) -> Option<WlSurface> {
|
||||||
parent = with_states(&parent, |states| {
|
parent = with_states(&parent, |states| {
|
||||||
states
|
states
|
||||||
.data_map
|
.data_map
|
||||||
.get::<Mutex<XdgPopupSurfaceRoleAttributes>>()
|
.get::<XdgPopupSurfaceData>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -402,7 +401,7 @@ fn get_popup_toplevel_coords(popup: &PopupSurface) -> Point<i32, Logical> {
|
||||||
offset += with_states(&parent, |states| {
|
offset += with_states(&parent, |states| {
|
||||||
states
|
states
|
||||||
.data_map
|
.data_map
|
||||||
.get::<Mutex<XdgPopupSurfaceRoleAttributes>>()
|
.get::<XdgPopupSurfaceData>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -413,7 +412,7 @@ fn get_popup_toplevel_coords(popup: &PopupSurface) -> Point<i32, Logical> {
|
||||||
parent = with_states(&parent, |states| {
|
parent = with_states(&parent, |states| {
|
||||||
states
|
states
|
||||||
.data_map
|
.data_map
|
||||||
.get::<Mutex<XdgPopupSurfaceRoleAttributes>>()
|
.get::<XdgPopupSurfaceData>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue