mirror of
https://github.com/labwc/labwc.git
synced 2025-11-09 13:30:01 -05:00
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]">.
44 lines
957 B
C
44 lines
957 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
#include "common/direction.h"
|
|
#include <assert.h>
|
|
#include <wlr/types/wlr_output_layout.h>
|
|
#include "view.h"
|
|
|
|
bool
|
|
direction_from_view_edge(enum view_edge edge, enum wlr_direction *direction)
|
|
{
|
|
switch (edge) {
|
|
case VIEW_EDGE_LEFT:
|
|
*direction = WLR_DIRECTION_LEFT;
|
|
return true;
|
|
case VIEW_EDGE_RIGHT:
|
|
*direction = WLR_DIRECTION_RIGHT;
|
|
return true;
|
|
case VIEW_EDGE_UP:
|
|
*direction = WLR_DIRECTION_UP;
|
|
return true;
|
|
case VIEW_EDGE_DOWN:
|
|
*direction = WLR_DIRECTION_DOWN;
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
enum wlr_direction
|
|
direction_get_opposite(enum wlr_direction direction)
|
|
{
|
|
switch (direction) {
|
|
case WLR_DIRECTION_RIGHT:
|
|
return WLR_DIRECTION_LEFT;
|
|
case WLR_DIRECTION_LEFT:
|
|
return WLR_DIRECTION_RIGHT;
|
|
case WLR_DIRECTION_DOWN:
|
|
return WLR_DIRECTION_UP;
|
|
case WLR_DIRECTION_UP:
|
|
return WLR_DIRECTION_DOWN;
|
|
default:
|
|
assert(0); /* Unreachable */
|
|
return WLR_DIRECTION_UP;
|
|
}
|
|
}
|