ecore-wl2: Unify surface creation code
As we call the same code during ecore_wl2_window_surface_get and ecore_wl2_window_show functions that basically create the wl_surface for a given window we can unify that code into one function that can be called from various places. This also fixes an issue inside ecore_wl2_window_show where the window surface_id may not have been getting filled properly. @fix Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
parent
36e55d64df
commit
f3240f630b
|
@ -335,6 +335,29 @@ surf_err:
|
||||||
ERR("Failed to create surface for window");
|
ERR("Failed to create surface for window");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ecore_wl2_window_surface_create(Ecore_Wl2_Window *window)
|
||||||
|
{
|
||||||
|
if (window->surface) return;
|
||||||
|
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN(window->display->wl.compositor);
|
||||||
|
|
||||||
|
window->surface =
|
||||||
|
wl_compositor_create_surface(window->display->wl.compositor);
|
||||||
|
if (!window->surface)
|
||||||
|
{
|
||||||
|
ERR("Failed to create surface for window");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window->surface_id =
|
||||||
|
wl_proxy_get_id((struct wl_proxy *)window->surface);
|
||||||
|
|
||||||
|
if (window->display->wl.session_recovery)
|
||||||
|
zwp_e_session_recovery_add_listener(window->display->wl.session_recovery,
|
||||||
|
&_session_listener, window);
|
||||||
|
}
|
||||||
|
|
||||||
EAPI Ecore_Wl2_Window *
|
EAPI Ecore_Wl2_Window *
|
||||||
ecore_wl2_window_new(Ecore_Wl2_Display *display, Ecore_Wl2_Window *parent, int x, int y, int w, int h)
|
ecore_wl2_window_new(Ecore_Wl2_Display *display, Ecore_Wl2_Window *parent, int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
|
@ -381,20 +404,7 @@ ecore_wl2_window_surface_get(Ecore_Wl2_Window *window)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL);
|
||||||
|
|
||||||
if (!window->surface)
|
_ecore_wl2_window_surface_create(window);
|
||||||
{
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(window->display->wl.compositor, NULL);
|
|
||||||
|
|
||||||
window->surface =
|
|
||||||
wl_compositor_create_surface(window->display->wl.compositor);
|
|
||||||
|
|
||||||
window->surface_id =
|
|
||||||
wl_proxy_get_id((struct wl_proxy *)window->surface);
|
|
||||||
|
|
||||||
if (window->display->wl.session_recovery)
|
|
||||||
zwp_e_session_recovery_add_listener(window->display->wl.session_recovery,
|
|
||||||
&_session_listener, window);
|
|
||||||
}
|
|
||||||
|
|
||||||
return window->surface;
|
return window->surface;
|
||||||
}
|
}
|
||||||
|
@ -411,16 +421,7 @@ ecore_wl2_window_show(Ecore_Wl2_Window *window)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||||
|
|
||||||
if (!window->surface)
|
_ecore_wl2_window_surface_create(window);
|
||||||
{
|
|
||||||
window->surface =
|
|
||||||
wl_compositor_create_surface(window->display->wl.compositor);
|
|
||||||
if (!window->surface)
|
|
||||||
{
|
|
||||||
ERR("Failed to create surface for window");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (window->input_set)
|
if (window->input_set)
|
||||||
ecore_wl2_window_input_region_set(window, window->input_rect.x, window->input_rect.y,
|
ecore_wl2_window_input_region_set(window, window->input_rect.x, window->input_rect.y,
|
||||||
|
@ -470,6 +471,8 @@ ecore_wl2_window_hide(Ecore_Wl2_Window *window)
|
||||||
|
|
||||||
window->configure_serial = 0;
|
window->configure_serial = 0;
|
||||||
window->configure_ack = NULL;
|
window->configure_ack = NULL;
|
||||||
|
|
||||||
|
window->surface_id = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
|
|
Loading…
Reference in New Issue