interactive: allow snapping to corner edges

In addition to <snapping><range>, <snapping><cornerRange> configures the
distance from the screen corner to trigger quater window snapping.

Also, new values "up-left", "up-right", "down-left" and "down-right" are
allowed for <action name="(Toggle)SnapToEdge" direction="[value]"> and
<query tiled="[value]">.
This commit is contained in:
tokyo4j 2025-08-02 21:35:51 +09:00 committed by Johan Malm
parent b0ff2911b6
commit 2f183cdcb6
14 changed files with 147 additions and 89 deletions

View file

@ -4,22 +4,24 @@
#include <wlr/types/wlr_output_layout.h>
#include "view.h"
enum wlr_direction
direction_from_view_edge(enum view_edge edge)
bool
direction_from_view_edge(enum view_edge edge, enum wlr_direction *direction)
{
switch (edge) {
case VIEW_EDGE_LEFT:
return WLR_DIRECTION_LEFT;
*direction = WLR_DIRECTION_LEFT;
return true;
case VIEW_EDGE_RIGHT:
return WLR_DIRECTION_RIGHT;
*direction = WLR_DIRECTION_RIGHT;
return true;
case VIEW_EDGE_UP:
return WLR_DIRECTION_UP;
*direction = WLR_DIRECTION_UP;
return true;
case VIEW_EDGE_DOWN:
return WLR_DIRECTION_DOWN;
case VIEW_EDGE_CENTER:
case VIEW_EDGE_INVALID:
*direction = WLR_DIRECTION_DOWN;
return true;
default:
return WLR_DIRECTION_UP;
return false;
}
}