diff options
author | Rafael Antognolli <rafael.antognolli@intel.com> | 2013-11-01 11:38:05 -0200 |
---|---|---|
committer | Rafael Antognolli <rafael.antognolli@intel.com> | 2013-11-01 15:07:48 -0200 |
commit | 1c33a1a57b964d9080909c3e9e93f109d11c674f (patch) | |
tree | 156a5924b520c50a03b449ff06a95507e48dd894 /src/lib/ecore_wayland/ecore_wl_window.c | |
parent | a63c69cac5e49a122cb1fa1bcf8187cff1198dcf (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.
Diffstat (limited to '')
-rw-r--r-- | src/lib/ecore_wayland/ecore_wl_window.c | 34 |
1 files changed, 34 insertions, 0 deletions
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 */ | ||
691 | EAPI void | ||
692 | ecore_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 */ | ||
704 | EAPI void | ||
705 | ecore_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 */ |
684 | static void | 718 | static void |