summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Antognolli <rafael.antognolli@intel.com>2013-11-01 11:38:05 -0200
committerRafael Antognolli <rafael.antognolli@intel.com>2013-11-01 15:07:48 -0200
commit1c33a1a57b964d9080909c3e9e93f109d11c674f (patch)
tree156a5924b520c50a03b449ff06a95507e48dd894
parenta63c69cac5e49a122cb1fa1bcf8187cff1198dcf (diff)
ecore/wayland: Add title_set and class_name_set APIs.
These two APIs will save the title and class_name inside Ecore_Wl_Window, so if they are called before the shell surface is created, the stored names will be used later when the window is finally shown (shell surface is created). This way we are also hiding the shell surface from ecore_evas modules.
-rw-r--r--src/lib/ecore_wayland/Ecore_Wayland.h6
-rw-r--r--src/lib/ecore_wayland/ecore_wl_window.c34
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c10
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c7
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c7
5 files changed, 44 insertions, 20 deletions
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
127 int id, surface_id; 127 int id, surface_id;
128 int rotation; 128 int rotation;
129 129
130 const char *title;
131 const char *class_name;
132
130 Eina_Rectangle allocation; 133 Eina_Rectangle allocation;
131 134
132 struct 135 struct
@@ -627,7 +630,10 @@ EAPI void ecore_wl_window_cursor_from_name_set(Ecore_Wl_Window *win, const char
627EAPI void ecore_wl_window_cursor_default_restore(Ecore_Wl_Window *win); 630EAPI void ecore_wl_window_cursor_default_restore(Ecore_Wl_Window *win);
628EAPI void ecore_wl_window_parent_set(Ecore_Wl_Window *win, Ecore_Wl_Window *parent); 631EAPI void ecore_wl_window_parent_set(Ecore_Wl_Window *win, Ecore_Wl_Window *parent);
629 632
633
630EAPI int ecore_wl_window_id_get(Ecore_Wl_Window *win); 634EAPI int ecore_wl_window_id_get(Ecore_Wl_Window *win);
635EAPI void ecore_wl_window_title_set(Ecore_Wl_Window *win, const char *title);
636EAPI void ecore_wl_window_class_name_set(Ecore_Wl_Window *win, const char *class_name);
631 637
632/** 638/**
633 * Returns a wl_surface with no association to any wl_shell_surface. 639 * 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
86 win->opaque.w = w; 86 win->opaque.w = w;
87 win->opaque.h = h; 87 win->opaque.h = h;
88 88
89 win->title = NULL;
90 win->class_name = NULL;
91
89 eina_hash_add(_windows, _ecore_wl_window_id_str_get(win->id), win); 92 eina_hash_add(_windows, _ecore_wl_window_id_str_get(win->id), win);
90 return win; 93 return win;
91} 94}
@@ -121,6 +124,9 @@ ecore_wl_window_free(Ecore_Wl_Window *win)
121 if (win->surface) wl_surface_destroy(win->surface); 124 if (win->surface) wl_surface_destroy(win->surface);
122 win->surface = NULL; 125 win->surface = NULL;
123 126
127 if (win->title) eina_stringshare_del(win->title);
128 if (win->class_name) eina_stringshare_del(win->class_name);
129
124 /* HMMM, why was this disabled ? */ 130 /* HMMM, why was this disabled ? */
125 free(win); 131 free(win);
126} 132}
@@ -258,6 +264,8 @@ ecore_wl_window_show(Ecore_Wl_Window *win)
258 win->shell_surface = 264 win->shell_surface =
259 wl_shell_get_shell_surface(_ecore_wl_disp->wl.shell, 265 wl_shell_get_shell_surface(_ecore_wl_disp->wl.shell,
260 win->surface); 266 win->surface);
267 wl_shell_surface_set_title(win->shell_surface, win->title);
268 wl_shell_surface_set_class(win->shell_surface, win->class_name);
261 } 269 }
262 270
263 if (win->shell_surface) 271 if (win->shell_surface)
@@ -679,6 +687,32 @@ ecore_wl_window_id_get(Ecore_Wl_Window *win)
679 return win->id; 687 return win->id;
680} 688}
681 689
690/* @since 1.8 */
691EAPI void
692ecore_wl_window_title_set(Ecore_Wl_Window *win, const char *title)
693{
694 LOGFN(__FILE__, __LINE__, __FUNCTION__);
695
696 if (!win) return;
697 eina_stringshare_replace(&win->title, title);
698
699 if (win->shell_surface)
700 wl_shell_surface_set_title(win->shell_surface, win->title);
701}
702
703/* @since 1.8 */
704EAPI void
705ecore_wl_window_class_name_set(Ecore_Wl_Window *win, const char *class_name)
706{
707 LOGFN(__FILE__, __LINE__, __FUNCTION__);
708
709 if (!win) return;
710 eina_stringshare_replace(&win->class_name, class_name);
711
712 if (win->shell_surface)
713 wl_shell_surface_set_class(win->shell_surface, win->class_name);
714}
715
682 716
683/* local functions */ 717/* local functions */
684static void 718static 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)
920 evas_object_text_text_set(sd->text, ee->prop.title); 920 evas_object_text_text_set(sd->text, ee->prop.title);
921 } 921 }
922 922
923 if ((ee->prop.title) && (wdata->win->shell_surface)) 923 if (ee->prop.title)
924 wl_shell_surface_set_title(wdata->win->shell_surface, 924 ecore_wl_window_title_set(wdata->win, ee->prop.title);
925 ee->prop.title);
926} 925}
927 926
928void 927void
@@ -941,9 +940,8 @@ _ecore_evas_wl_common_name_class_set(Ecore_Evas *ee, const char *n, const char *
941 if (n) ee->prop.name = strdup(n); 940 if (n) ee->prop.name = strdup(n);
942 if (c) ee->prop.clas = strdup(c); 941 if (c) ee->prop.clas = strdup(c);
943 942
944 if ((ee->prop.clas) && (wdata->win->shell_surface)) 943 if (ee->prop.clas)
945 wl_shell_surface_set_class(wdata->win->shell_surface, 944 ecore_wl_window_class_name_set(wdata->win, ee->prop.clas);
946 ee->prop.clas);
947} 945}
948 946
949void 947void
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)
389 /* einfo->info.surface = ecore_wl_window_surface_get(wdata->win); */ 389 /* einfo->info.surface = ecore_wl_window_surface_get(wdata->win); */
390 /* evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); */ 390 /* evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); */
391 /* } */ 391 /* } */
392
393 if ((ee->prop.clas) && (wdata->win->shell_surface))
394 wl_shell_surface_set_class(wdata->win->shell_surface,
395 ee->prop.clas);
396 if ((ee->prop.title) && (wdata->win->shell_surface))
397 wl_shell_surface_set_title(wdata->win->shell_surface,
398 ee->prop.title);
399 } 392 }
400 393
401 if (wdata->frame) 394 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)
388 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); 388 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
389 } 389 }
390 } 390 }
391
392 if ((ee->prop.clas) && (wdata->win->shell_surface))
393 wl_shell_surface_set_class(wdata->win->shell_surface,
394 ee->prop.clas);
395 if ((ee->prop.title) && (wdata->win->shell_surface))
396 wl_shell_surface_set_title(wdata->win->shell_surface,
397 ee->prop.title);
398 } 391 }
399 392
400 if (wdata->frame) 393 if (wdata->frame)