diff --git a/src/lib/ecore_wayland/Ecore_Wayland.h b/src/lib/ecore_wayland/Ecore_Wayland.h index 424e3db4ec..387c9f2cde 100644 --- a/src/lib/ecore_wayland/Ecore_Wayland.h +++ b/src/lib/ecore_wayland/Ecore_Wayland.h @@ -127,6 +127,9 @@ struct _Ecore_Wl_Window int id, surface_id; int rotation; + const char *title; + const char *class_name; + Eina_Rectangle allocation; struct @@ -627,7 +630,10 @@ EAPI void ecore_wl_window_cursor_from_name_set(Ecore_Wl_Window *win, const char EAPI void ecore_wl_window_cursor_default_restore(Ecore_Wl_Window *win); EAPI void ecore_wl_window_parent_set(Ecore_Wl_Window *win, Ecore_Wl_Window *parent); + EAPI int ecore_wl_window_id_get(Ecore_Wl_Window *win); +EAPI void ecore_wl_window_title_set(Ecore_Wl_Window *win, const char *title); +EAPI void ecore_wl_window_class_name_set(Ecore_Wl_Window *win, const char *class_name); /** * Returns a wl_surface with no association to any wl_shell_surface. diff --git a/src/lib/ecore_wayland/ecore_wl_window.c b/src/lib/ecore_wayland/ecore_wl_window.c index 4c40a62cd9..8059f44cbc 100644 --- a/src/lib/ecore_wayland/ecore_wl_window.c +++ b/src/lib/ecore_wayland/ecore_wl_window.c @@ -86,6 +86,9 @@ ecore_wl_window_new(Ecore_Wl_Window *parent, int x, int y, int w, int h, int buf win->opaque.w = w; win->opaque.h = h; + win->title = NULL; + win->class_name = NULL; + eina_hash_add(_windows, _ecore_wl_window_id_str_get(win->id), win); return win; } @@ -121,6 +124,9 @@ ecore_wl_window_free(Ecore_Wl_Window *win) if (win->surface) wl_surface_destroy(win->surface); win->surface = NULL; + if (win->title) eina_stringshare_del(win->title); + if (win->class_name) eina_stringshare_del(win->class_name); + /* HMMM, why was this disabled ? */ free(win); } @@ -258,6 +264,8 @@ ecore_wl_window_show(Ecore_Wl_Window *win) win->shell_surface = wl_shell_get_shell_surface(_ecore_wl_disp->wl.shell, win->surface); + wl_shell_surface_set_title(win->shell_surface, win->title); + wl_shell_surface_set_class(win->shell_surface, win->class_name); } if (win->shell_surface) @@ -679,6 +687,32 @@ ecore_wl_window_id_get(Ecore_Wl_Window *win) return win->id; } +/* @since 1.8 */ +EAPI void +ecore_wl_window_title_set(Ecore_Wl_Window *win, const char *title) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!win) return; + eina_stringshare_replace(&win->title, title); + + if (win->shell_surface) + wl_shell_surface_set_title(win->shell_surface, win->title); +} + +/* @since 1.8 */ +EAPI void +ecore_wl_window_class_name_set(Ecore_Wl_Window *win, const char *class_name) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!win) return; + eina_stringshare_replace(&win->class_name, class_name); + + if (win->shell_surface) + wl_shell_surface_set_class(win->shell_surface, win->class_name); +} + /* local functions */ static void diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c index 4a1628e4b8..705d5883e8 100644 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c @@ -920,9 +920,8 @@ _ecore_evas_wl_common_title_set(Ecore_Evas *ee, const char *title) evas_object_text_text_set(sd->text, ee->prop.title); } - if ((ee->prop.title) && (wdata->win->shell_surface)) - wl_shell_surface_set_title(wdata->win->shell_surface, - ee->prop.title); + if (ee->prop.title) + ecore_wl_window_title_set(wdata->win, ee->prop.title); } void @@ -941,9 +940,8 @@ _ecore_evas_wl_common_name_class_set(Ecore_Evas *ee, const char *n, const char * if (n) ee->prop.name = strdup(n); if (c) ee->prop.clas = strdup(c); - if ((ee->prop.clas) && (wdata->win->shell_surface)) - wl_shell_surface_set_class(wdata->win->shell_surface, - ee->prop.clas); + if (ee->prop.clas) + ecore_wl_window_class_name_set(wdata->win, ee->prop.clas); } void diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c index e0bb74319d..4e32009bf9 100644 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c @@ -389,13 +389,6 @@ _ecore_evas_wl_show(Ecore_Evas *ee) /* einfo->info.surface = ecore_wl_window_surface_get(wdata->win); */ /* evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); */ /* } */ - - if ((ee->prop.clas) && (wdata->win->shell_surface)) - wl_shell_surface_set_class(wdata->win->shell_surface, - ee->prop.clas); - if ((ee->prop.title) && (wdata->win->shell_surface)) - wl_shell_surface_set_title(wdata->win->shell_surface, - ee->prop.title); } if (wdata->frame) diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c index 55421736d4..2e3a352780 100644 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c @@ -388,13 +388,6 @@ _ecore_evas_wl_show(Ecore_Evas *ee) evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); } } - - if ((ee->prop.clas) && (wdata->win->shell_surface)) - wl_shell_surface_set_class(wdata->win->shell_surface, - ee->prop.clas); - if ((ee->prop.title) && (wdata->win->shell_surface)) - wl_shell_surface_set_title(wdata->win->shell_surface, - ee->prop.title); } if (wdata->frame)