summaryrefslogtreecommitdiff
path: root/src/lib
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 /src/lib
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.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/ecore_wayland/Ecore_Wayland.h6
-rw-r--r--src/lib/ecore_wayland/ecore_wl_window.c34
2 files changed, 40 insertions, 0 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