mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
interactive: Make window snapping with mouse more intuitive
1. Prevent window snapping triggered by mouse from moving the window into the adjacent output. 2. Make the coordinates used to check whether window snapping is triggered relative to the output the cursor is at, not the output the view is belonging to. This allows users to grab a tiled window and move it into another output or tile it again in another output in a single drag.
This commit is contained in:
parent
29a228674b
commit
9a8a2905ad
4 changed files with 36 additions and 31 deletions
12
src/view.c
12
src/view.c
|
|
@ -1322,7 +1322,8 @@ view_edge_parse(const char *direction)
|
|||
}
|
||||
|
||||
void
|
||||
view_snap_to_edge(struct view *view, enum view_edge edge, bool store_natural_geometry)
|
||||
view_snap_to_edge(struct view *view, enum view_edge edge,
|
||||
bool across_outputs, bool store_natural_geometry)
|
||||
{
|
||||
assert(view);
|
||||
if (view->fullscreen) {
|
||||
|
|
@ -1334,7 +1335,7 @@ view_snap_to_edge(struct view *view, enum view_edge edge, bool store_natural_geo
|
|||
return;
|
||||
}
|
||||
|
||||
if (view->tiled == edge && view->maximized == VIEW_AXIS_NONE) {
|
||||
if (across_outputs && view->tiled == edge && view->maximized == VIEW_AXIS_NONE) {
|
||||
/* We are already tiled for this edge and thus should switch outputs */
|
||||
struct wlr_output *new_output = NULL;
|
||||
struct wlr_output *current_output = output->wlr_output;
|
||||
|
|
@ -1375,13 +1376,6 @@ view_snap_to_edge(struct view *view, enum view_edge edge, bool store_natural_geo
|
|||
* state because the window might have been moved away
|
||||
* (and thus got untiled) and then snapped back to the
|
||||
* original edge.
|
||||
*
|
||||
* TODO: The described pattern will cause another bug
|
||||
* in multi monitor setups: it will snap the
|
||||
* window to the inverted edge of the nearest
|
||||
* output. This is the desired behavior when
|
||||
* caused by a keybind but doesn't make sense
|
||||
* when caused by mouse movement.
|
||||
*/
|
||||
view_apply_tiled_geometry(view);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue