overlay: add snap-to-edge overlay

...and unifies region overlay and snap-to-edge overlay into overlay.c.

Snap-to-edge overlay is delayed for 150ms to prevent flickering when
the view is dragged from an output to another (demo in discussion #1613).

This also fixes a bug that region overlay is not shown when a modifier
key is re-pressed.
This commit is contained in:
tokyo4j 2024-03-23 19:33:17 +09:00
parent d68376f2ac
commit 0b2d58ffc5
11 changed files with 260 additions and 150 deletions

View file

@ -47,6 +47,7 @@
#include "config/rcxml.h"
#include "input/cursor.h"
#include "input/ime.h"
#include "overlay.h"
#include "regions.h"
#include "session-lock.h"
#if HAVE_NLS
@ -159,9 +160,8 @@ struct seat {
struct wlr_scene_tree *icons;
} drag;
/* Private use by regions.c */
struct region *region_active;
struct region_overlay region_overlay;
/* Private use by overlay.c */
struct overlay overlay;
/* Used to prevent region snapping when starting a move with A-Left */
bool region_prevent_snap;
@ -479,6 +479,8 @@ void seat_output_layout_changed(struct seat *seat);
void interactive_begin(struct view *view, enum input_mode mode, uint32_t edges);
void interactive_finish(struct view *view);
void interactive_cancel(struct view *view);
/* Possibly returns VIEW_EDGE_CENTER if <topMaximize> is yes */
enum view_edge edge_from_cursor(struct seat *seat, struct output **dest_output);
void output_init(struct server *server);
void output_manager_init(struct server *server);