ecore-wl2: cache the registry

wl_get_registry() returns a new object that we must destroy, so
we should cache one at connect and never call that again.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
This commit is contained in:
Derek Foreman 2015-10-06 13:45:02 -05:00 committed by Chris Michael
parent b89c45dbf9
commit 497b9c045e
4 changed files with 8 additions and 10 deletions

View File

@ -309,7 +309,7 @@ _ecore_wl2_display_cleanup(Ecore_Wl2_Display *ewd)
if (ewd->wl.compositor) wl_compositor_destroy(ewd->wl.compositor);
if (ewd->wl.subcompositor) wl_subcompositor_destroy(ewd->wl.subcompositor);
wl_registry_destroy(wl_display_get_registry(ewd->wl.display));
if (ewd->wl.registry) wl_registry_destroy(ewd->wl.registry);
wl_display_flush(ewd->wl.display);
}
@ -411,9 +411,8 @@ ecore_wl2_display_connect(const char *name)
_cb_connect_data, ewd, NULL, NULL);
ewd->idle_enterer = ecore_idle_enterer_add(_cb_connect_idle, ewd);
wl_registry_add_listener(wl_display_get_registry(ewd->wl.display),
&_registry_listener, ewd);
ewd->wl.registry = wl_display_get_registry(ewd->wl.display);
wl_registry_add_listener(ewd->wl.registry, &_registry_listener, ewd);
ewd->xkb_context = xkb_context_new(0);
if (!ewd->xkb_context) goto context_err;
@ -432,7 +431,7 @@ ecore_wl2_display_connect(const char *name)
context_err:
ecore_main_fd_handler_del(ewd->fd_hdl);
wl_registry_destroy(wl_display_get_registry(ewd->wl.display));
wl_registry_destroy(ewd->wl.registry);
wl_display_disconnect(ewd->wl.display);
connect_err:
@ -560,5 +559,5 @@ ecore_wl2_display_registry_get(Ecore_Wl2_Display *display)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(display, NULL);
return wl_display_get_registry(display->wl.display);
return display->wl.registry;
}

View File

@ -1221,8 +1221,7 @@ _ecore_wl2_input_add(Ecore_Wl2_Display *display, unsigned int id)
_ecore_wl2_input_cursor_setup(input);
input->wl.seat =
wl_registry_bind(wl_display_get_registry(display->wl.display),
id, &wl_seat_interface, 1);
wl_registry_bind(display->wl.registry, id, &wl_seat_interface, 1);
display->inputs =
eina_inlist_append(display->inputs, EINA_INLIST_GET(input));

View File

@ -67,8 +67,7 @@ _ecore_wl2_output_add(Ecore_Wl2_Display *display, unsigned int id)
output->display = display;
output->wl_output =
wl_registry_bind(wl_display_get_registry(display->wl.display),
id, &wl_output_interface, 2);
wl_registry_bind(display->wl.registry, id, &wl_output_interface, 2);
display->outputs =
eina_inlist_append(display->outputs, EINA_INLIST_GET(output));

View File

@ -52,6 +52,7 @@ struct _Ecore_Wl2_Display
struct
{
struct wl_display *display;
struct wl_registry *registry;
struct wl_compositor *compositor;
struct wl_subcompositor *subcompositor;
struct wl_data_device_manager *data_device_manager;