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

25
include/overlay.h Normal file
View file

@ -0,0 +1,25 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef LABWC_OVERLAY_H
#define LABWC_OVERLAY_H
#include <wlr/util/box.h>
#include "common/graphic-helpers.h"
struct overlay {
struct wlr_scene_tree *tree;
union {
struct wlr_scene_rect *rect;
struct multi_rect *pixman_rect;
};
/* For delayed overlay */
struct view *view;
struct wlr_box box;
struct wl_event_source *timer;
};
/* Calls overlay_hide() internally if the view is not to be snapped */
void overlay_show(struct seat *seat, struct view *view);
void overlay_hide(struct seat *seat);
#endif