aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2015-12-04 19:01:02 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2015-12-04 19:06:51 -0500
commitf50a434bd1a6ec4a28d538c750b38da9619574f2 (patch)
tree47a7b91e04ee683601435e2f2a70571ae2f515d1
parentecore-wl2: handle null global has in ecore_wl2_display_globals_get() (diff)
downloadefl-f50a434bd1a6ec4a28d538c750b38da9619574f2.tar.gz
ecore-wl2: apply same deferred shell surface creation as ecore-wayland
new wheel meets old wheel. ref 265ad8b5d0c46ad17de790e85ceaa593d7a5dd24
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_display.c4
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_private.h1
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_window.c97
3 files changed, 56 insertions, 46 deletions
diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c b/src/lib/ecore_wl2/ecore_wl2_display.c
index 1839341792..4f612b1d54 100644
--- a/src/lib/ecore_wl2/ecore_wl2_display.c
+++ b/src/lib/ecore_wl2/ecore_wl2_display.c
@@ -100,10 +100,14 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const
else if ((!strcmp(interface, "xdg_shell")) &&
(!getenv("EFL_WAYLAND_DONT_USE_XDG_SHELL")))
{
+ Ecore_Wl2_Window *window;
+
ewd->wl.xdg_shell =
wl_registry_bind(registry, id, &xdg_shell_interface, 1);
xdg_shell_use_unstable_version(ewd->wl.xdg_shell, XDG_VERSION);
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"))
_ecore_wl2_output_add(ewd, id);
diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h
index fee3649277..e33eaa2aac 100644
--- a/src/lib/ecore_wl2/ecore_wl2_private.h
+++ b/src/lib/ecore_wl2/ecore_wl2_private.h
@@ -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_window_shell_surface_init(Ecore_Wl2_Window *window);
#endif
diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c
index 590dc66422..3f6d0a314c 100644
--- a/src/lib/ecore_wl2/ecore_wl2_window.c
+++ b/src/lib/ecore_wl2/ecore_wl2_window.c
@@ -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 *
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
ecore_wl2_window_show(Ecore_Wl2_Window *window)
{
- Ecore_Wl2_Display *disp;
-
EINA_SAFETY_ON_NULL_RETURN(window);
- disp = window->display;
-
if (!window->surface)
{
window->surface =
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) ||
- (window->type == ECORE_WL2_WINDOW_TYPE_NONE))
- goto type_set;
-
- 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");
+ if ((window->type != ECORE_WL2_WINDOW_TYPE_DND) &&
+ (window->type != ECORE_WL2_WINDOW_TYPE_NONE))
+ _ecore_wl2_window_shell_surface_init(window);
}
EAPI void