mirror of
https://github.com/labwc/labwc.git
synced 2026-04-12 08:21:13 -04:00
[fixup] add <snapping><previewTimeout> & remove interior/exterior edge checking
This commit is contained in:
parent
c4fb8f1879
commit
f6e1c95145
3 changed files with 8 additions and 35 deletions
|
|
@ -125,6 +125,7 @@ struct rcxml {
|
||||||
|
|
||||||
/* window snapping */
|
/* window snapping */
|
||||||
int snap_edge_range;
|
int snap_edge_range;
|
||||||
|
int snap_preview_timeout;
|
||||||
bool snap_top_maximize;
|
bool snap_top_maximize;
|
||||||
enum tiling_events_mode snap_tiling_events_mode;
|
enum tiling_events_mode snap_tiling_events_mode;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -906,6 +906,8 @@ entry(xmlNode *node, char *nodename, char *content)
|
||||||
rc.window_edge_strength = atoi(content);
|
rc.window_edge_strength = atoi(content);
|
||||||
} else if (!strcasecmp(nodename, "range.snapping")) {
|
} else if (!strcasecmp(nodename, "range.snapping")) {
|
||||||
rc.snap_edge_range = atoi(content);
|
rc.snap_edge_range = atoi(content);
|
||||||
|
} else if (!strcasecmp(nodename, "previewTimeout.snapping")) {
|
||||||
|
rc.snap_preview_timeout = atoi(content);
|
||||||
} else if (!strcasecmp(nodename, "topMaximize.snapping")) {
|
} else if (!strcasecmp(nodename, "topMaximize.snapping")) {
|
||||||
set_bool(content, &rc.snap_top_maximize);
|
set_bool(content, &rc.snap_top_maximize);
|
||||||
} else if (!strcasecmp(nodename, "notifyClient.snapping")) {
|
} else if (!strcasecmp(nodename, "notifyClient.snapping")) {
|
||||||
|
|
@ -1183,6 +1185,7 @@ rcxml_init(void)
|
||||||
rc.window_edge_strength = 20;
|
rc.window_edge_strength = 20;
|
||||||
|
|
||||||
rc.snap_edge_range = 1;
|
rc.snap_edge_range = 1;
|
||||||
|
rc.snap_preview_timeout = 400;
|
||||||
rc.snap_top_maximize = true;
|
rc.snap_top_maximize = true;
|
||||||
rc.snap_tiling_events_mode = LAB_TILING_EVENTS_ALWAYS;
|
rc.snap_tiling_events_mode = LAB_TILING_EVENTS_ALWAYS;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,35 +116,6 @@ handle_edge_overlay_timeout(void *data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum wlr_direction
|
|
||||||
get_wlr_direction(enum view_edge edge)
|
|
||||||
{
|
|
||||||
switch (edge) {
|
|
||||||
case VIEW_EDGE_LEFT:
|
|
||||||
return WLR_DIRECTION_LEFT;
|
|
||||||
case VIEW_EDGE_RIGHT:
|
|
||||||
return WLR_DIRECTION_RIGHT;
|
|
||||||
case VIEW_EDGE_UP:
|
|
||||||
case VIEW_EDGE_CENTER:
|
|
||||||
return WLR_DIRECTION_UP;
|
|
||||||
case VIEW_EDGE_DOWN:
|
|
||||||
return WLR_DIRECTION_DOWN;
|
|
||||||
default:
|
|
||||||
/* not reached */
|
|
||||||
assert(false);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool
|
|
||||||
edge_has_adjacent_output_from_cursor(struct seat *seat, struct output *output,
|
|
||||||
enum view_edge edge)
|
|
||||||
{
|
|
||||||
return wlr_output_layout_adjacent_output(
|
|
||||||
seat->server->output_layout, get_wlr_direction(edge),
|
|
||||||
output->wlr_output, seat->cursor->x, seat->cursor->y);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_edge_overlay(struct seat *seat, enum view_edge edge,
|
show_edge_overlay(struct seat *seat, enum view_edge edge,
|
||||||
struct output *output)
|
struct output *output)
|
||||||
|
|
@ -157,17 +128,15 @@ show_edge_overlay(struct seat *seat, enum view_edge edge,
|
||||||
seat->overlay.active.edge = edge;
|
seat->overlay.active.edge = edge;
|
||||||
seat->overlay.active.output = output;
|
seat->overlay.active.output = output;
|
||||||
|
|
||||||
if (edge_has_adjacent_output_from_cursor(seat, output, edge)) {
|
if (rc.snap_preview_timeout > 0) {
|
||||||
if (!seat->overlay.timer) {
|
if (!seat->overlay.timer) {
|
||||||
seat->overlay.timer = wl_event_loop_add_timer(
|
seat->overlay.timer = wl_event_loop_add_timer(
|
||||||
seat->server->wl_event_loop,
|
seat->server->wl_event_loop,
|
||||||
handle_edge_overlay_timeout, seat);
|
handle_edge_overlay_timeout, seat);
|
||||||
}
|
}
|
||||||
/*
|
/* Show overlay <previewTimeout>ms later */
|
||||||
* Delay overlay for 100ms to prevent flickering when dragging
|
wl_event_source_timer_update(seat->overlay.timer,
|
||||||
* view across output edges in multi-monitor setup.
|
rc.snap_preview_timeout);
|
||||||
*/
|
|
||||||
wl_event_source_timer_update(seat->overlay.timer, 100);
|
|
||||||
} else {
|
} else {
|
||||||
/* Show overlay now */
|
/* Show overlay now */
|
||||||
struct wlr_box box = get_edge_snap_box(seat->overlay.active.edge,
|
struct wlr_box box = get_edge_snap_box(seat->overlay.active.edge,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue