grabs: Snap Window Edges to Close Output Edges

This commit is contained in:
Daniel 2025-02-14 21:58:09 +11:00 committed by GitHub
parent 2678cf41b2
commit 2553810621
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 148 additions and 13 deletions

View file

@ -288,7 +288,12 @@ pub fn window_items(
let _ = handle.insert_idle(move |state| {
let mut shell = state.common.shell.write().unwrap();
let seat = shell.seats.last_active().clone();
let res = shell.menu_resize_request(&resize_clone, &seat, ResizeEdge::TOP);
let res = shell.menu_resize_request(
&resize_clone,
&seat,
ResizeEdge::TOP,
state.common.config.cosmic_conf.edge_snap_threshold,
);
std::mem::drop(shell);
if let Some(((target, loc), (grab, focus))) = res {
@ -318,7 +323,12 @@ pub fn window_items(
let _ = handle.insert_idle(move |state| {
let mut shell = state.common.shell.write().unwrap();
let seat = shell.seats.last_active().clone();
let res = shell.menu_resize_request(&resize_clone, &seat, ResizeEdge::LEFT);
let res = shell.menu_resize_request(
&resize_clone,
&seat,
ResizeEdge::LEFT,
state.common.config.cosmic_conf.edge_snap_threshold,
);
std::mem::drop(shell);
if let Some(((target, loc), (grab, focus))) = res {
@ -348,8 +358,12 @@ pub fn window_items(
let _ = handle.insert_idle(move |state| {
let mut shell = state.common.shell.write().unwrap();
let seat = shell.seats.last_active().clone();
let res =
shell.menu_resize_request(&resize_clone, &seat, ResizeEdge::RIGHT);
let res = shell.menu_resize_request(
&resize_clone,
&seat,
ResizeEdge::RIGHT,
state.common.config.cosmic_conf.edge_snap_threshold,
);
std::mem::drop(shell);
if let Some(((target, loc), (grab, focus))) = res {
@ -379,8 +393,12 @@ pub fn window_items(
let _ = handle.insert_idle(move |state| {
let mut shell = state.common.shell.write().unwrap();
let seat = shell.seats.last_active().clone();
let res =
shell.menu_resize_request(&resize_clone, &seat, ResizeEdge::BOTTOM);
let res = shell.menu_resize_request(
&resize_clone,
&seat,
ResizeEdge::BOTTOM,
state.common.config.cosmic_conf.edge_snap_threshold,
);
std::mem::drop(shell);
if let Some(((target, loc), (grab, focus))) = res {