mirror of
https://github.com/cage-kiosk/cage.git
synced 2026-02-05 04:06:24 -05:00
Make dialogs modal
That is, do not allow another view to get focus upon clicking a pointer button.
This commit is contained in:
parent
e68d76f403
commit
11e71dbfb5
1 changed files with 12 additions and 2 deletions
14
cage.c
14
cage.c
|
|
@ -85,6 +85,15 @@ is_fullscreen_view(struct cg_view *view)
|
|||
return parent == NULL; /*&& role == WLR_XDG_SURFACE_ROLE_TOPLEVEL */
|
||||
}
|
||||
|
||||
static inline bool
|
||||
have_dialogs_open(struct cg_server *server)
|
||||
{
|
||||
/* We only need to test if there is more than a single
|
||||
element. We don't need to know the entire length of the
|
||||
list. */
|
||||
return server->views.next != server->views.prev;
|
||||
}
|
||||
|
||||
static void
|
||||
maximize_view(struct cg_view *view)
|
||||
{
|
||||
|
|
@ -415,8 +424,9 @@ server_cursor_button(struct wl_listener *listener, void *data)
|
|||
|
||||
wlr_seat_pointer_notify_button(server->seat,
|
||||
event->time_msec, event->button, event->state);
|
||||
if (event->state == WLR_BUTTON_PRESSED) {
|
||||
/* Focus that client if the button was pressed. */
|
||||
if (event->state == WLR_BUTTON_PRESSED && !have_dialogs_open(server)) {
|
||||
/* Focus that client if the button was pressed and
|
||||
there are no open dialogs. */
|
||||
double sx, sy;
|
||||
struct wlr_surface *surface;
|
||||
struct cg_view *view = desktop_view_at(server,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue