wayland: always flush client display when protocol sends are pending

in the case where a connection was not actively rendering, there was nothing
which would trigger a display flush, leading to applications potentially
deadlocking

@fix
This commit is contained in:
Mike Blumenkrantz 2018-01-17 17:33:57 -05:00
parent 4fb807dd20
commit b48781aa6c
6 changed files with 40 additions and 6 deletions

View File

@ -59,9 +59,10 @@ static const struct zwp_linux_dmabuf_v1_listener _dmabuf_listener =
};
static void
_xdg_shell_cb_ping(void *data EINA_UNUSED, struct xdg_wm_base *shell, uint32_t serial)
_xdg_shell_cb_ping(void *data, struct xdg_wm_base *shell, uint32_t serial)
{
xdg_wm_base_pong(shell, serial);
ecore_wl2_display_flush(data);
}
static const struct xdg_wm_base_listener _xdg_shell_listener =
@ -70,9 +71,10 @@ static const struct xdg_wm_base_listener _xdg_shell_listener =
};
static void
_zxdg_shell_cb_ping(void *data EINA_UNUSED, struct zxdg_shell_v6 *shell, uint32_t serial)
_zxdg_shell_cb_ping(void *data, struct zxdg_shell_v6 *shell, uint32_t serial)
{
zxdg_shell_v6_pong(shell, serial);
ecore_wl2_display_flush(data);
}
static const struct zxdg_shell_v6_listener _zxdg_shell_listener =
@ -357,6 +359,7 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const
window->xdg_surface, window->weight.w, window->weight.h);
}
}
ecore_wl2_display_flush(ewd);
event:
/* allocate space for event structure */
@ -648,7 +651,7 @@ _ecore_wl2_shell_bind(Ecore_Wl2_Display *ewd)
wl_registry_bind(ewd->wl.registry, global->id,
&xdg_wm_base_interface, 1);
xdg_wm_base_add_listener(ewd->wl.xdg_wm_base,
&_xdg_shell_listener, NULL);
&_xdg_shell_listener, ewd);
ewd->shell_done = EINA_TRUE;
}
else if (!strcmp(global->interface, "zxdg_shell_v6"))
@ -657,9 +660,10 @@ _ecore_wl2_shell_bind(Ecore_Wl2_Display *ewd)
wl_registry_bind(ewd->wl.registry, global->id,
&zxdg_shell_v6_interface, 1);
zxdg_shell_v6_add_listener(ewd->wl.zxdg_shell,
&_zxdg_shell_listener, NULL);
&_zxdg_shell_listener, ewd);
ewd->shell_done = EINA_TRUE;
}
ecore_wl2_display_flush(ewd);
}
static void
@ -744,7 +748,6 @@ _ecore_wl2_display_connect(Ecore_Wl2_Display *ewd, Eina_Bool sync)
ewd->idle_enterer = ecore_idle_enterer_add(_cb_connect_idle, ewd);
_ecore_wl2_display_event(ewd, ECORE_WL2_EVENT_CONNECT);
ecore_wl2_display_flush(ewd);
return EINA_TRUE;
}

View File

@ -1433,6 +1433,7 @@ _seat_cb_capabilities(void *data, struct wl_seat *seat, enum wl_seat_capability
wl_touch_destroy(input->wl.touch);
input->wl.touch = NULL;
}
ecore_wl2_display_flush(input->display);
ev = calloc(1, sizeof(Ecore_Wl2_Event_Seat_Capabilities));
EINA_SAFETY_ON_NULL_RETURN(ev);
@ -1511,6 +1512,7 @@ _ecore_wl2_input_cursor_update(void *data)
wl_pointer_set_cursor(input->wl.pointer, input->pointer.enter_serial,
input->cursor.surface,
input->cursor.hot_x, input->cursor.hot_y);
ecore_wl2_display_flush(input->display);
return ECORE_CALLBACK_RENEW;
}
@ -1650,6 +1652,7 @@ _ecore_wl2_input_add(Ecore_Wl2_Display *display, unsigned int id, unsigned int v
wl_data_device_manager_get_data_device(display->wl.data_device_manager,
input->wl.seat);
wl_data_device_add_listener(input->data.device, &_data_listener, input);
ecore_wl2_display_flush(input->display);
}
void

View File

@ -96,6 +96,7 @@ _ecore_wl2_output_add(Ecore_Wl2_Display *display, unsigned int id)
eina_inlist_append(display->outputs, EINA_INLIST_GET(output));
wl_output_add_listener(output->wl_output, &_output_listener, output);
ecore_wl2_display_flush(display);
}
void

View File

@ -106,6 +106,7 @@ ecore_wl2_subsurface_position_set(Ecore_Wl2_Subsurface *subsurface, int x, int y
subsurface->y = y;
wl_subsurface_set_position(subsurface->wl.subsurface, x, y);
ecore_wl2_display_flush(subsurface->parent->display);
}
EAPI void
@ -124,6 +125,7 @@ ecore_wl2_subsurface_place_above(Ecore_Wl2_Subsurface *subsurface, struct wl_sur
EINA_SAFETY_ON_NULL_RETURN(surface);
wl_subsurface_place_above(subsurface->wl.subsurface, surface);
ecore_wl2_display_flush(subsurface->parent->display);
}
EAPI void
@ -133,6 +135,7 @@ ecore_wl2_subsurface_place_below(Ecore_Wl2_Subsurface *subsurface, struct wl_sur
EINA_SAFETY_ON_NULL_RETURN(surface);
wl_subsurface_place_below(subsurface->wl.subsurface, surface);
ecore_wl2_display_flush(subsurface->parent->display);
}
EAPI void
@ -150,6 +153,7 @@ ecore_wl2_subsurface_sync_set(Ecore_Wl2_Subsurface *subsurface, Eina_Bool sync)
wl_subsurface_set_sync(subsurface->wl.subsurface);
else
wl_subsurface_set_desync(subsurface->wl.subsurface);
ecore_wl2_display_flush(subsurface->parent->display);
}
EAPI void
@ -182,4 +186,5 @@ ecore_wl2_subsurface_opaque_region_set(Ecore_Wl2_Subsurface *subsurface, int x,
}
else
wl_surface_set_opaque_region(subsurface->wl.surface, NULL);
ecore_wl2_display_flush(subsurface->parent->display);
}

View File

@ -414,6 +414,7 @@ _ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window)
}
else
zwp_e_session_recovery_get_uuid(window->display->wl.session_recovery, window->surface);
ecore_wl2_display_flush(window->display);
}
}
@ -561,6 +562,7 @@ ecore_wl2_window_show(Ecore_Wl2_Window *window)
}
else
_configure_complete(window);
ecore_wl2_display_flush(window->display);
}
EAPI void
@ -668,6 +670,7 @@ ecore_wl2_window_move(Ecore_Wl2_Window *window, Ecore_Wl2_Input *input)
if (window->zxdg_toplevel)
zxdg_toplevel_v6_move(window->zxdg_toplevel, input->wl.seat,
window->display->serial);
ecore_wl2_display_flush(window->display);
}
EAPI void
@ -685,6 +688,7 @@ ecore_wl2_window_resize(Ecore_Wl2_Window *window, Ecore_Wl2_Input *input, int lo
if (window->zxdg_toplevel)
zxdg_toplevel_v6_resize(window->zxdg_toplevel, input->wl.seat,
window->display->serial, location);
ecore_wl2_display_flush(window->display);
}
EAPI void
@ -704,6 +708,7 @@ ecore_wl2_window_raise(Ecore_Wl2_Window *window)
window->set_config.geometry.w,
window->set_config.geometry.h, &states);
wl_array_release(&states);
ecore_wl2_display_flush(window->display);
}
}
@ -730,6 +735,7 @@ ecore_wl2_window_alpha_set(Ecore_Wl2_Window *window, Eina_Bool alpha)
window->opaque.h);
else
ecore_wl2_window_opaque_region_set(window, 0, 0, 0, 0);
ecore_wl2_display_flush(window->display);
}
EAPI void
@ -747,6 +753,7 @@ ecore_wl2_window_transparent_set(Ecore_Wl2_Window *window, Eina_Bool transparent
window->opaque.h);
else
ecore_wl2_window_opaque_region_set(window, 0, 0, 0, 0);
ecore_wl2_display_flush(window->display);
}
EAPI void
@ -967,6 +974,7 @@ ecore_wl2_window_title_set(Ecore_Wl2_Window *window, const char *title)
xdg_toplevel_set_title(window->xdg_toplevel, window->title);
if (window->zxdg_toplevel)
zxdg_toplevel_v6_set_title(window->zxdg_toplevel, window->title);
ecore_wl2_display_flush(window->display);
}
EAPI void
@ -981,6 +989,7 @@ ecore_wl2_window_class_set(Ecore_Wl2_Window *window, const char *clas)
xdg_toplevel_set_app_id(window->xdg_toplevel, window->class);
if (window->zxdg_toplevel)
zxdg_toplevel_v6_set_app_id(window->zxdg_toplevel, window->class);
ecore_wl2_display_flush(window->display);
}
EAPI void
@ -1069,6 +1078,7 @@ ecore_wl2_window_iconified_set(Ecore_Wl2_Window *window, Eina_Bool iconified)
wl_array_release(&states);
}
}
ecore_wl2_display_flush(window->display);
}
EAPI void
@ -1159,6 +1169,7 @@ ecore_wl2_window_buffer_transform_set(Ecore_Wl2_Window *window, int transform)
EINA_SAFETY_ON_NULL_RETURN(window);
wl_surface_set_buffer_transform(window->surface, transform);
ecore_wl2_display_flush(window->display);
}
EAPI void
@ -1341,6 +1352,7 @@ ecore_wl2_window_aux_hint_add(Ecore_Wl2_Window *win, int id, const char *hint, c
if (!win) return;
if ((win->surface) && (win->display->wl.efl_aux_hints))
efl_aux_hints_add_aux_hint(win->display->wl.efl_aux_hints, win->surface, id, hint, val);
ecore_wl2_display_flush(win->display);
}
EAPI void
@ -1349,6 +1361,7 @@ ecore_wl2_window_aux_hint_change(Ecore_Wl2_Window *win, int id, const char *val)
if (!win) return;
if ((win->surface) && (win->display->wl.efl_aux_hints))
efl_aux_hints_change_aux_hint(win->display->wl.efl_aux_hints, win->surface, id, val);
ecore_wl2_display_flush(win->display);
}
EAPI void
@ -1357,6 +1370,7 @@ ecore_wl2_window_aux_hint_del(Ecore_Wl2_Window *win, int id)
if (!win) return;
if ((win->surface) && (win->display->wl.efl_aux_hints))
efl_aux_hints_del_aux_hint(win->display->wl.efl_aux_hints, win->surface, id);
ecore_wl2_display_flush(win->display);
}
EAPI void
@ -1413,6 +1427,7 @@ ecore_wl2_window_aspect_set(Ecore_Wl2_Window *window, int w, int h, unsigned int
if (window->xdg_surface)
efl_hints_set_aspect(window->display->wl.efl_hints,
window->xdg_surface, w, h, aspect);
ecore_wl2_display_flush(window->display);
}
EAPI void
@ -1434,6 +1449,7 @@ ecore_wl2_window_weight_set(Ecore_Wl2_Window *window, double w, double h)
if (window->xdg_surface)
efl_hints_set_weight(window->display->wl.efl_hints,
window->xdg_surface, ww, hh);
ecore_wl2_display_flush(window->display);
}
static void
@ -1476,6 +1492,7 @@ _maximized_set(Ecore_Wl2_Window *window)
if (window->zxdg_toplevel)
zxdg_toplevel_v6_unset_maximized(window->zxdg_toplevel);
}
ecore_wl2_display_flush(window->display);
}
static void
@ -1498,6 +1515,7 @@ _fullscreen_set(Ecore_Wl2_Window *window)
if (window->zxdg_toplevel)
zxdg_toplevel_v6_unset_fullscreen(window->zxdg_toplevel);
}
ecore_wl2_display_flush(window->display);
}
static void
@ -1524,6 +1542,7 @@ _input_set(Ecore_Wl2_Window *window)
window->input_rect.w, window->input_rect.h);
wl_surface_set_input_region(window->surface, region);
wl_region_destroy(region);
ecore_wl2_display_flush(window->display);
}
static void
@ -1548,6 +1567,7 @@ _opaque_set(Ecore_Wl2_Window *window)
window->opaque.w, window->opaque.h);
wl_surface_set_opaque_region(window->surface, region);
wl_region_destroy(region);
ecore_wl2_display_flush(window->display);
}
EAPI void

View File

@ -4172,7 +4172,9 @@ _elm_win_frame_cb_menu(void *data,
{
Eina_Iterator *it;
it = ecore_wl2_display_inputs_get(ecore_wl2_window_display_get(sd->wl.win));
Ecore_Wl2_Display *display = ecore_wl2_window_display_get(sd->wl.win);
it = ecore_wl2_display_inputs_get(display);
ecore_wl2_display_flush(input->display);
EINA_ITERATOR_FOREACH(it, input) break;
eina_iterator_free(it);
}