mirror of
https://github.com/labwc/labwc.git
synced 2026-02-15 22:05:25 -05:00
snapping: replace <snapping><range> with <snapping><range inner="" outer=""> (#3241)
Some checks failed
labwc.github.io / notify (push) Has been cancelled
Some checks failed
labwc.github.io / notify (push) Has been cancelled
<inner>/<outer> configure the size of snapping area on output edges with/without adjacent outputs.
This commit is contained in:
parent
4d47b68aae
commit
94d33f9119
5 changed files with 51 additions and 17 deletions
|
|
@ -186,7 +186,7 @@ edge_from_cursor(struct seat *seat, struct output **dest_output,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (rc.snap_edge_range == 0) {
|
||||
if (rc.snap_edge_range_inner == 0 && rc.snap_edge_range_outer == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -197,9 +197,31 @@ edge_from_cursor(struct seat *seat, struct output **dest_output,
|
|||
}
|
||||
*dest_output = output;
|
||||
|
||||
/* Translate into output local coordinates */
|
||||
double cursor_x = seat->cursor->x;
|
||||
double cursor_y = seat->cursor->y;
|
||||
|
||||
int top_range = rc.snap_edge_range_outer;
|
||||
int bottom_range = rc.snap_edge_range_outer;
|
||||
int left_range = rc.snap_edge_range_outer;
|
||||
int right_range = rc.snap_edge_range_outer;
|
||||
if (wlr_output_layout_adjacent_output(seat->server->output_layout, WLR_DIRECTION_UP,
|
||||
output->wlr_output, cursor_x, cursor_y)) {
|
||||
top_range = rc.snap_edge_range_inner;
|
||||
}
|
||||
if (wlr_output_layout_adjacent_output(seat->server->output_layout, WLR_DIRECTION_DOWN,
|
||||
output->wlr_output, cursor_x, cursor_y)) {
|
||||
bottom_range = rc.snap_edge_range_inner;
|
||||
}
|
||||
if (wlr_output_layout_adjacent_output(seat->server->output_layout, WLR_DIRECTION_LEFT,
|
||||
output->wlr_output, cursor_x, cursor_y)) {
|
||||
left_range = rc.snap_edge_range_inner;
|
||||
}
|
||||
if (wlr_output_layout_adjacent_output(seat->server->output_layout, WLR_DIRECTION_RIGHT,
|
||||
output->wlr_output, cursor_x, cursor_y)) {
|
||||
right_range = rc.snap_edge_range_inner;
|
||||
}
|
||||
|
||||
/* Translate into output local coordinates */
|
||||
wlr_output_layout_output_coords(seat->server->output_layout,
|
||||
output->wlr_output, &cursor_x, &cursor_y);
|
||||
|
||||
|
|
@ -210,13 +232,13 @@ edge_from_cursor(struct seat *seat, struct output **dest_output,
|
|||
int left = cursor_x - area->x;
|
||||
int right = area->x + area->width - cursor_x;
|
||||
|
||||
if (top < rc.snap_edge_range) {
|
||||
if (top < top_range) {
|
||||
*edge1 = LAB_EDGE_TOP;
|
||||
} else if (bottom < rc.snap_edge_range) {
|
||||
} else if (bottom < bottom_range) {
|
||||
*edge1 = LAB_EDGE_BOTTOM;
|
||||
} else if (left < rc.snap_edge_range) {
|
||||
} else if (left < left_range) {
|
||||
*edge1 = LAB_EDGE_LEFT;
|
||||
} else if (right < rc.snap_edge_range) {
|
||||
} else if (right < right_range) {
|
||||
*edge1 = LAB_EDGE_RIGHT;
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue