SnapToRegion: Add dynamic overlay

Either uses a half transparent single rect if running
hardware accelerated or uses a solid struct multirect
outline if not.
This commit is contained in:
Consolatis 2022-09-13 08:15:33 +02:00
parent 4edd67de17
commit eb5c8cfdad
10 changed files with 88 additions and 45 deletions

View file

@ -2,14 +2,13 @@
#ifndef __LABWC_REGIONS_H
#define __LABWC_REGIONS_H
//FIXME: ignore that there could be more than a single seat
struct seat;
struct view;
struct server;
struct output;
struct wl_list;
struct wlr_box;
struct multi_rect;
/* Double use: rcxml.c for config and output.c for usage */
struct region {
@ -23,17 +22,24 @@ struct region {
} center;
};
struct region_overlay {
struct wlr_scene_tree *tree;
union {
struct wlr_scene_rect *overlay;
struct multi_rect *pixman_overlay;
};
};
/* Can be used as a cheap check to detect if there are any regions configured */
bool regions_available(void);
void regions_init(struct server *server, struct seat *seat);
void regions_update(struct output *output);
void regions_evacuate_output(struct output *output);
void regions_destroy(struct wl_list *regions);
void regions_destroy(struct seat *seat, struct wl_list *regions);
struct region *regions_from_cursor(struct server *server);
struct region *regions_from_name(const char *region_name, struct output *output);
void regions_show_overlay(struct view *view, struct seat *seat, struct region *region);
void regions_hide_overlay(struct server *server, struct seat *seat);
void regions_hide_overlay(struct seat *seat);
#endif /* __LABWC_REGIONS_H */