seat: allow dragging tiles in window management mode
This commit is contained in:
parent
25addc9bc2
commit
ee9bac3d7e
1 changed files with 42 additions and 9 deletions
|
|
@ -968,6 +968,14 @@ impl SimplePointerOwnerUsecase for WindowManagementUsecase {
|
||||||
tl,
|
tl,
|
||||||
usecase: MoveFullscreenToplevelGrabPointerOwner,
|
usecase: MoveFullscreenToplevelGrabPointerOwner,
|
||||||
})
|
})
|
||||||
|
} else if tl.tl_data().float.is_none() {
|
||||||
|
Rc::new(ToplevelGrabPointerOwner {
|
||||||
|
tl: tl.clone(),
|
||||||
|
usecase: TileDragUsecase {
|
||||||
|
tl,
|
||||||
|
destination: Default::default(),
|
||||||
|
},
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
Rc::new(ToplevelGrabPointerOwner {
|
Rc::new(ToplevelGrabPointerOwner {
|
||||||
tl,
|
tl,
|
||||||
|
|
@ -1082,6 +1090,9 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
fn grab_node_removed(&self, seat: &Rc<WlSeatGlobal>) {
|
fn grab_node_removed(&self, seat: &Rc<WlSeatGlobal>) {
|
||||||
|
if let Some(rect) = seat.ui_drag_highlight.take() {
|
||||||
|
seat.state.damage(rect);
|
||||||
|
}
|
||||||
seat.pointer_cursor.set_known(KnownCursor::Default);
|
seat.pointer_cursor.set_known(KnownCursor::Default);
|
||||||
seat.pointer_owner.owner.set(Rc::new(SimplePointerOwner {
|
seat.pointer_owner.owner.set(Rc::new(SimplePointerOwner {
|
||||||
usecase: WindowManagementUsecase,
|
usecase: WindowManagementUsecase,
|
||||||
|
|
@ -1242,15 +1253,7 @@ where
|
||||||
|
|
||||||
fn apply_changes(&self, seat: &Rc<WlSeatGlobal>) {
|
fn apply_changes(&self, seat: &Rc<WlSeatGlobal>) {
|
||||||
let new_highlight = self.usecase.apply_changes(seat);
|
let new_highlight = self.usecase.apply_changes(seat);
|
||||||
let prev_highlight = seat.ui_drag_highlight.replace(new_highlight);
|
handle_ui_drag_highlight(seat, new_highlight);
|
||||||
if prev_highlight != new_highlight {
|
|
||||||
if let Some(rect) = prev_highlight {
|
|
||||||
seat.state.damage(rect);
|
|
||||||
}
|
|
||||||
if let Some(rect) = new_highlight {
|
|
||||||
seat.state.damage(rect);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn revert_to_default(&self, seat: &Rc<WlSeatGlobal>) {
|
fn revert_to_default(&self, seat: &Rc<WlSeatGlobal>) {
|
||||||
|
|
@ -1258,6 +1261,18 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle_ui_drag_highlight(seat: &Rc<WlSeatGlobal>, new_highlight: Option<Rect>) {
|
||||||
|
let prev_highlight = seat.ui_drag_highlight.replace(new_highlight);
|
||||||
|
if prev_highlight != new_highlight {
|
||||||
|
if let Some(rect) = prev_highlight {
|
||||||
|
seat.state.damage(rect);
|
||||||
|
}
|
||||||
|
if let Some(rect) = new_highlight {
|
||||||
|
seat.state.damage(rect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct TileDragUsecase {
|
struct TileDragUsecase {
|
||||||
tl: Rc<dyn ToplevelNode>,
|
tl: Rc<dyn ToplevelNode>,
|
||||||
destination: Cell<Option<TddType>>,
|
destination: Cell<Option<TddType>>,
|
||||||
|
|
@ -1373,6 +1388,24 @@ impl UiDragUsecase for TileDragUsecase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WindowManagementGrabUsecase for TileDragUsecase {
|
||||||
|
const BUTTON: u32 = BTN_LEFT;
|
||||||
|
|
||||||
|
fn apply_changes(
|
||||||
|
&self,
|
||||||
|
seat: &Rc<WlSeatGlobal>,
|
||||||
|
_parent: Rc<dyn ContainingNode>,
|
||||||
|
_tl: &Rc<dyn ToplevelNode>,
|
||||||
|
) {
|
||||||
|
let dest = UiDragUsecase::apply_changes(self, seat);
|
||||||
|
handle_ui_drag_highlight(seat, dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_drop(&self, seat: &Rc<WlSeatGlobal>, _tl: &Rc<dyn ToplevelNode>) {
|
||||||
|
UiDragUsecase::left_button_up(self, seat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct WorkspaceDragUsecase {
|
struct WorkspaceDragUsecase {
|
||||||
ws: Rc<WorkspaceNode>,
|
ws: Rc<WorkspaceNode>,
|
||||||
destination: Cell<Option<WorkspaceDragDestination>>,
|
destination: Cell<Option<WorkspaceDragDestination>>,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue