aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rootston/seat.c3
-rw-r--r--types/wlr_input_inhibitor.c5
-rw-r--r--types/wlr_primary_selection.c2
-rw-r--r--types/xdg_shell/wlr_xdg_popup.c3
-rw-r--r--types/xdg_shell/wlr_xdg_surface.c6
-rw-r--r--types/xdg_shell_v6/wlr_xdg_popup_v6.c3
-rw-r--r--types/xdg_shell_v6/wlr_xdg_surface_v6.c6
-rw-r--r--xwayland/xwm.c6
8 files changed, 29 insertions, 5 deletions
diff --git a/rootston/seat.c b/rootston/seat.c
index 91561567..d8910660 100644
--- a/rootston/seat.c
+++ b/rootston/seat.c
@@ -825,6 +825,9 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) {
view_activate(view, true);
seat->has_focus = true;
+ // An existing keyboard grab might try to deny setting focus, so cancel it
+ wlr_seat_keyboard_end_grab(seat->seat);
+
struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat->seat);
if (keyboard != NULL) {
wlr_seat_keyboard_notify_enter(seat->seat, view->wlr_surface,
diff --git a/types/wlr_input_inhibitor.c b/types/wlr_input_inhibitor.c
index fe1711fd..532ea5f4 100644
--- a/types/wlr_input_inhibitor.c
+++ b/types/wlr_input_inhibitor.c
@@ -4,6 +4,7 @@
#include <wayland-server.h>
#include "wlr/types/wlr_input_inhibitor.h"
#include "wlr-input-inhibitor-unstable-v1-protocol.h"
+#include "util/signal.h"
static const struct zwlr_input_inhibit_manager_v1_interface inhibit_manager_implementation;
static struct zwlr_input_inhibitor_v1_interface input_inhibitor_implementation;
@@ -26,7 +27,7 @@ static void input_inhibit_manager_deactivate(
}
manager->active_client = NULL;
manager->active_inhibitor = NULL;
- wl_signal_emit(&manager->events.deactivate, manager);
+ wlr_signal_emit_safe(&manager->events.deactivate, manager);
}
static void input_inhibitor_destroy(struct wl_client *client,
@@ -70,7 +71,7 @@ static void inhibit_manager_get_inhibitor(struct wl_client *client,
manager->active_client = client;
manager->active_inhibitor = wl_resource;
- wl_signal_emit(&manager->events.activate, manager);
+ wlr_signal_emit_safe(&manager->events.activate, manager);
}
static const struct zwlr_input_inhibit_manager_v1_interface inhibit_manager_implementation = {
diff --git a/types/wlr_primary_selection.c b/types/wlr_primary_selection.c
index b8f3094b..15452071 100644
--- a/types/wlr_primary_selection.c
+++ b/types/wlr_primary_selection.c
@@ -229,9 +229,9 @@ void wlr_seat_set_primary_selection(struct wlr_seat *seat,
}
if (seat->primary_selection_source) {
+ wl_list_remove(&seat->primary_selection_source_destroy.link);
seat->primary_selection_source->cancel(seat->primary_selection_source);
seat->primary_selection_source = NULL;
- wl_list_remove(&seat->primary_selection_source_destroy.link);
}
seat->primary_selection_source = source;
diff --git a/types/xdg_shell/wlr_xdg_popup.c b/types/xdg_shell/wlr_xdg_popup.c
index e7204def..284f36ad 100644
--- a/types/xdg_shell/wlr_xdg_popup.c
+++ b/types/xdg_shell/wlr_xdg_popup.c
@@ -13,6 +13,7 @@ static void xdg_pointer_grab_end(struct wlr_seat_pointer_grab *grab) {
}
wlr_seat_pointer_end_grab(grab->seat);
+ wlr_seat_keyboard_end_grab(grab->seat);
}
static void xdg_pointer_grab_enter(struct wlr_seat_pointer_grab *grab,
@@ -78,7 +79,7 @@ static void xdg_keyboard_grab_modifiers(struct wlr_seat_keyboard_grab *grab,
}
static void xdg_keyboard_grab_cancel(struct wlr_seat_keyboard_grab *grab) {
- wlr_seat_keyboard_end_grab(grab->seat);
+ wlr_seat_pointer_end_grab(grab->seat);
}
static const struct wlr_keyboard_grab_interface xdg_keyboard_grab_impl = {
diff --git a/types/xdg_shell/wlr_xdg_surface.c b/types/xdg_shell/wlr_xdg_surface.c
index c5d177b2..6931b92f 100644
--- a/types/xdg_shell/wlr_xdg_surface.c
+++ b/types/xdg_shell/wlr_xdg_surface.c
@@ -415,6 +415,12 @@ void destroy_xdg_surface(struct wlr_xdg_surface *surface) {
wlr_signal_emit_safe(&surface->events.destroy, surface);
+ struct wlr_xdg_popup *popup_state, *next;
+ wl_list_for_each_safe(popup_state, next, &surface->popups, link) {
+ xdg_popup_send_popup_done(popup_state->resource);
+ destroy_xdg_popup(popup_state->base);
+ }
+
switch (surface->role) {
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
destroy_xdg_toplevel(surface);
diff --git a/types/xdg_shell_v6/wlr_xdg_popup_v6.c b/types/xdg_shell_v6/wlr_xdg_popup_v6.c
index ff66e812..334519a5 100644
--- a/types/xdg_shell_v6/wlr_xdg_popup_v6.c
+++ b/types/xdg_shell_v6/wlr_xdg_popup_v6.c
@@ -23,6 +23,7 @@ static void xdg_pointer_grab_end(struct wlr_seat_pointer_grab *grab) {
}
wlr_seat_pointer_end_grab(grab->seat);
+ wlr_seat_keyboard_end_grab(grab->seat);
}
static void xdg_pointer_grab_enter(struct wlr_seat_pointer_grab *grab,
@@ -88,7 +89,7 @@ static void xdg_keyboard_grab_modifiers(struct wlr_seat_keyboard_grab *grab,
}
static void xdg_keyboard_grab_cancel(struct wlr_seat_keyboard_grab *grab) {
- wlr_seat_keyboard_end_grab(grab->seat);
+ wlr_seat_pointer_end_grab(grab->seat);
}
static const struct wlr_keyboard_grab_interface xdg_keyboard_grab_impl = {
diff --git a/types/xdg_shell_v6/wlr_xdg_surface_v6.c b/types/xdg_shell_v6/wlr_xdg_surface_v6.c
index e111adad..7343906f 100644
--- a/types/xdg_shell_v6/wlr_xdg_surface_v6.c
+++ b/types/xdg_shell_v6/wlr_xdg_surface_v6.c
@@ -100,6 +100,12 @@ void destroy_xdg_surface_v6(struct wlr_xdg_surface_v6 *surface) {
wlr_signal_emit_safe(&surface->events.destroy, surface);
+ struct wlr_xdg_popup_v6 *popup_state, *next;
+ wl_list_for_each_safe(popup_state, next, &surface->popups, link) {
+ zxdg_popup_v6_send_popup_done(popup_state->resource);
+ destroy_xdg_popup_v6(popup_state->base);
+ }
+
switch (surface->role) {
case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
destroy_xdg_toplevel_v6(surface);
diff --git a/xwayland/xwm.c b/xwayland/xwm.c
index b397b1e8..66a85d05 100644
--- a/xwayland/xwm.c
+++ b/xwayland/xwm.c
@@ -294,6 +294,12 @@ static void xwayland_surface_destroy(
wl_list_remove(&xsurface->link);
wl_list_remove(&xsurface->parent_link);
+ struct wlr_xwayland_surface *child, *next;
+ wl_list_for_each_safe(child, next, &xsurface->children, parent_link) {
+ wl_list_remove(&child->parent_link);
+ wl_list_init(&child->parent_link);
+ }
+
if (xsurface->surface_id) {
wl_list_remove(&xsurface->unpaired_link);
}