[WaylandWindow] Unmap surface before sending activation request

Fixes lbonn/rofi#117
This commit is contained in:
Aleksei Bavshin 2024-02-25 20:01:41 -08:00 committed by lbonn
parent a4c8135533
commit cb6fd22118
3 changed files with 22 additions and 9 deletions

View file

@ -412,6 +412,7 @@ static ModeMode wayland_window_mode_result(Mode *sw, int mretv,
} else if (mretv & MENU_QUICK_SWITCH) {
retv = (ModeMode)(mretv & MENU_LOWER_MASK);
} else if ((mretv & MENU_OK)) {
rofi_view_hide();
ForeignToplevelHandle *toplevel =
(ForeignToplevelHandle *)g_list_nth_data(pd->toplevels, selected_line);
foreign_toplevel_handle_activate(toplevel, pd->wayland->last_seat->seat);

View file

@ -1402,14 +1402,23 @@ static void wayland_layer_shell_surface_configure(
zwlr_layer_surface_v1_ack_configure(surface, serial);
}
static void wayland_surface_destroy(void) {
if (wayland->wlr_surface != NULL) {
zwlr_layer_surface_v1_destroy(wayland->wlr_surface);
wayland->wlr_surface = NULL;
}
if (wayland->surface != NULL) {
wl_surface_destroy(wayland->surface);
wayland->surface = NULL;
}
}
static void
wayland_layer_shell_surface_closed(void *data,
struct zwlr_layer_surface_v1 *surface) {
g_debug("Layer shell surface closed");
zwlr_layer_surface_v1_destroy(surface);
wl_surface_destroy(wayland->surface);
wayland->surface = NULL;
wayland_surface_destroy();
// In this case, we recreate the layer shell surface the best we can and
// re-initialize everything:
@ -1626,15 +1635,18 @@ void display_set_surface_dimensions(int width, int height, int x_margin,
-y_margin, x_margin);
}
static void wayland_display_early_cleanup(void) {}
static void wayland_display_cleanup(void) {
static void wayland_display_early_cleanup(void) {
if (wayland->main_loop_source == NULL) {
return;
}
if (wayland->surface != NULL) {
wl_surface_destroy(wayland->surface);
wayland_surface_destroy();
wl_display_flush(wayland->display);
}
static void wayland_display_cleanup(void) {
if (wayland->main_loop_source == NULL) {
return;
}
nk_bindings_seat_free(wayland->bindings_seat);

View file

@ -423,7 +423,7 @@ static int wayland_rofi_view_calculate_window_height(RofiViewState *state) {
return widget_get_desired_height(main_window, state->width);
}
static void wayland_rofi_view_hide(void) {}
static void wayland_rofi_view_hide(void) { display_early_cleanup(); }
static void wayland_rofi_view_cleanup() {
g_debug("Cleanup.");