forked from enlightenment/efl
ecore-wl2: apply same deferred shell surface creation as ecore-wayland
new wheel meets old wheel.
ref 265ad8b5d0
This commit is contained in:
parent
022dda2f68
commit
f50a434bd1
|
@ -100,10 +100,14 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const
|
||||||
else if ((!strcmp(interface, "xdg_shell")) &&
|
else if ((!strcmp(interface, "xdg_shell")) &&
|
||||||
(!getenv("EFL_WAYLAND_DONT_USE_XDG_SHELL")))
|
(!getenv("EFL_WAYLAND_DONT_USE_XDG_SHELL")))
|
||||||
{
|
{
|
||||||
|
Ecore_Wl2_Window *window;
|
||||||
|
|
||||||
ewd->wl.xdg_shell =
|
ewd->wl.xdg_shell =
|
||||||
wl_registry_bind(registry, id, &xdg_shell_interface, 1);
|
wl_registry_bind(registry, id, &xdg_shell_interface, 1);
|
||||||
xdg_shell_use_unstable_version(ewd->wl.xdg_shell, XDG_VERSION);
|
xdg_shell_use_unstable_version(ewd->wl.xdg_shell, XDG_VERSION);
|
||||||
xdg_shell_add_listener(ewd->wl.xdg_shell, &_xdg_shell_listener, NULL);
|
xdg_shell_add_listener(ewd->wl.xdg_shell, &_xdg_shell_listener, NULL);
|
||||||
|
EINA_INLIST_FOREACH(ewd->windows, window)
|
||||||
|
_ecore_wl2_window_shell_surface_init(window);
|
||||||
}
|
}
|
||||||
else if (!strcmp(interface, "wl_output"))
|
else if (!strcmp(interface, "wl_output"))
|
||||||
_ecore_wl2_output_add(ewd, id);
|
_ecore_wl2_output_add(ewd, id);
|
||||||
|
|
|
@ -403,4 +403,5 @@ void _ecore_wl2_dnd_del(Ecore_Wl2_Dnd_Source *source);
|
||||||
|
|
||||||
void _ecore_wl2_subsurf_free(Ecore_Wl2_Subsurface *subsurf);
|
void _ecore_wl2_subsurf_free(Ecore_Wl2_Subsurface *subsurf);
|
||||||
|
|
||||||
|
void _ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -214,6 +214,49 @@ _ecore_wl2_window_type_set(Ecore_Wl2_Window *win)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window)
|
||||||
|
{
|
||||||
|
if (!window->surface) return;
|
||||||
|
if ((window->display->wl.xdg_shell) && (!window->xdg_surface))
|
||||||
|
{
|
||||||
|
window->xdg_surface =
|
||||||
|
xdg_shell_get_xdg_surface(window->display->wl.xdg_shell, window->surface);
|
||||||
|
if (!window->xdg_surface) goto surf_err;
|
||||||
|
|
||||||
|
if (window->title)
|
||||||
|
xdg_surface_set_title(window->xdg_surface, window->title);
|
||||||
|
if (window->class)
|
||||||
|
xdg_surface_set_app_id(window->xdg_surface, window->class);
|
||||||
|
|
||||||
|
|
||||||
|
xdg_surface_set_user_data(window->xdg_surface, window);
|
||||||
|
xdg_surface_add_listener(window->xdg_surface,
|
||||||
|
&_xdg_surface_listener, window);
|
||||||
|
|
||||||
|
window->configure_ack = xdg_surface_ack_configure;
|
||||||
|
_ecore_wl2_window_type_set(window);
|
||||||
|
}
|
||||||
|
else if ((window->display->wl.wl_shell) && (!window->wl_shell_surface))
|
||||||
|
{
|
||||||
|
window->wl_shell_surface =
|
||||||
|
wl_shell_get_shell_surface(window->display->wl.wl_shell, window->surface);
|
||||||
|
if (!window->wl_shell_surface) goto surf_err;
|
||||||
|
|
||||||
|
if (window->title)
|
||||||
|
wl_shell_surface_set_title(window->wl_shell_surface, window->title);
|
||||||
|
if (window->class)
|
||||||
|
wl_shell_surface_set_class(window->wl_shell_surface, window->class);
|
||||||
|
|
||||||
|
wl_shell_surface_add_listener(window->wl_shell_surface,
|
||||||
|
&_wl_shell_surface_listener, window);
|
||||||
|
_ecore_wl2_window_type_set(window);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
surf_err:
|
||||||
|
ERR("Failed to create surface for window: %m");
|
||||||
|
}
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
@ -284,60 +327,22 @@ ecore_wl2_window_surface_id_get(Ecore_Wl2_Window *window)
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_wl2_window_show(Ecore_Wl2_Window *window)
|
ecore_wl2_window_show(Ecore_Wl2_Window *window)
|
||||||
{
|
{
|
||||||
Ecore_Wl2_Display *disp;
|
|
||||||
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||||
|
|
||||||
disp = window->display;
|
|
||||||
|
|
||||||
if (!window->surface)
|
if (!window->surface)
|
||||||
{
|
{
|
||||||
window->surface =
|
window->surface =
|
||||||
wl_compositor_create_surface(window->display->wl.compositor);
|
wl_compositor_create_surface(window->display->wl.compositor);
|
||||||
|
if (!window->surface)
|
||||||
|
{
|
||||||
|
ERR("Failed to create surface for window: %m");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((window->type == ECORE_WL2_WINDOW_TYPE_DND) ||
|
if ((window->type != ECORE_WL2_WINDOW_TYPE_DND) &&
|
||||||
(window->type == ECORE_WL2_WINDOW_TYPE_NONE))
|
(window->type != ECORE_WL2_WINDOW_TYPE_NONE))
|
||||||
goto type_set;
|
_ecore_wl2_window_shell_surface_init(window);
|
||||||
|
|
||||||
if ((disp->wl.xdg_shell) && (!window->xdg_surface))
|
|
||||||
{
|
|
||||||
window->xdg_surface =
|
|
||||||
xdg_shell_get_xdg_surface(disp->wl.xdg_shell, window->surface);
|
|
||||||
if (!window->xdg_surface) goto surf_err;
|
|
||||||
|
|
||||||
if (window->title)
|
|
||||||
xdg_surface_set_title(window->xdg_surface, window->title);
|
|
||||||
if (window->class)
|
|
||||||
xdg_surface_set_app_id(window->xdg_surface, window->class);
|
|
||||||
|
|
||||||
xdg_surface_set_user_data(window->xdg_surface, window);
|
|
||||||
xdg_surface_add_listener(window->xdg_surface,
|
|
||||||
&_xdg_surface_listener, window);
|
|
||||||
|
|
||||||
window->configure_ack = xdg_surface_ack_configure;
|
|
||||||
}
|
|
||||||
else if ((disp->wl.wl_shell) && (!window->wl_shell_surface))
|
|
||||||
{
|
|
||||||
window->wl_shell_surface =
|
|
||||||
wl_shell_get_shell_surface(disp->wl.wl_shell, window->surface);
|
|
||||||
if (!window->wl_shell_surface) goto surf_err;
|
|
||||||
|
|
||||||
if (window->title)
|
|
||||||
wl_shell_surface_set_title(window->wl_shell_surface, window->title);
|
|
||||||
if (window->class)
|
|
||||||
wl_shell_surface_set_class(window->wl_shell_surface, window->class);
|
|
||||||
|
|
||||||
wl_shell_surface_add_listener(window->wl_shell_surface,
|
|
||||||
&_wl_shell_surface_listener, window);
|
|
||||||
}
|
|
||||||
|
|
||||||
type_set:
|
|
||||||
_ecore_wl2_window_type_set(window);
|
|
||||||
return;
|
|
||||||
|
|
||||||
surf_err:
|
|
||||||
ERR("Failed to create surface for window: %m");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
|
|
Loading…
Reference in New Issue