summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorRafael Antognolli <rafael.antognolli@intel.com>2013-11-04 13:48:57 -0200
committerRafael Antognolli <rafael.antognolli@intel.com>2013-11-04 13:50:04 -0200
commit18ef47c173205e24a076e2d78ff3ade0efe6a5de (patch)
treebbf0e8832eabdece04493c5bc7573b5e85fd39eb /src/lib
parent5ec3ba041d49c4800d9a97db0770977661005e06 (diff)
ecore/wayland: Use eina_inlist instead of wl_list for globals.
Since we are allocating this list and returning it, let's make it more EFL-like.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/ecore_wayland/Ecore_Wayland.h4
-rw-r--r--src/lib/ecore_wayland/ecore_wl.c35
-rw-r--r--src/lib/ecore_wayland/ecore_wl_private.h2
3 files changed, 21 insertions, 20 deletions
diff --git a/src/lib/ecore_wayland/Ecore_Wayland.h b/src/lib/ecore_wayland/Ecore_Wayland.h
index bcb7141c38..9c371a0b2a 100644
--- a/src/lib/ecore_wayland/Ecore_Wayland.h
+++ b/src/lib/ecore_wayland/Ecore_Wayland.h
@@ -90,10 +90,10 @@ typedef enum _Ecore_Wl_Window_Buffer_Type Ecore_Wl_Window_Buffer_Type;
90/** @since 1.7.6 */ 90/** @since 1.7.6 */
91struct _Ecore_Wl_Global 91struct _Ecore_Wl_Global
92{ 92{
93 EINA_INLIST;
93 unsigned int id; 94 unsigned int id;
94 char *interface; 95 char *interface;
95 unsigned int version; 96 unsigned int version;
96 struct wl_list link;
97}; 97};
98 98
99struct _Ecore_Wl_Event_Mouse_In 99struct _Ecore_Wl_Event_Mouse_In
@@ -422,7 +422,7 @@ EAPI struct wl_list *ecore_wl_outputs_get(void);
422 * @ingroup Ecore_Wl_Display_Group 422 * @ingroup Ecore_Wl_Display_Group
423 * @since 1.7.6 423 * @since 1.7.6
424 */ 424 */
425EAPI struct wl_list *ecore_wl_globals_get(void); 425EAPI Eina_Inlist *ecore_wl_globals_get(void);
426 426
427/** 427/**
428 * Retrieves the Wayland Registry used for the current Wayland connection. 428 * Retrieves the Wayland Registry used for the current Wayland connection.
diff --git a/src/lib/ecore_wayland/ecore_wl.c b/src/lib/ecore_wayland/ecore_wl.c
index bb0c5fea54..2d5593ccb3 100644
--- a/src/lib/ecore_wayland/ecore_wl.c
+++ b/src/lib/ecore_wayland/ecore_wl.c
@@ -182,7 +182,6 @@ ecore_wl_init(const char *name)
182 182
183 wl_list_init(&_ecore_wl_disp->inputs); 183 wl_list_init(&_ecore_wl_disp->inputs);
184 wl_list_init(&_ecore_wl_disp->outputs); 184 wl_list_init(&_ecore_wl_disp->outputs);
185 wl_list_init(&_ecore_wl_disp->globals);
186 185
187 _ecore_wl_disp->wl.registry = 186 _ecore_wl_disp->wl.registry =
188 wl_display_get_registry(_ecore_wl_disp->wl.display); 187 wl_display_get_registry(_ecore_wl_disp->wl.display);
@@ -254,7 +253,7 @@ ecore_wl_display_get(void)
254 return _ecore_wl_disp->wl.display; 253 return _ecore_wl_disp->wl.display;
255} 254}
256 255
257EAPI struct wl_list * 256EAPI Eina_Inlist *
258ecore_wl_globals_get(void) 257ecore_wl_globals_get(void)
259{ 258{
260 if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display)) 259 if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display))
@@ -262,7 +261,7 @@ ecore_wl_globals_get(void)
262 261
263 _ecore_wl_init_wait(); 262 _ecore_wl_init_wait();
264 263
265 return &(_ecore_wl_disp->globals); 264 return _ecore_wl_disp->globals;
266} 265}
267 266
268EAPI struct wl_registry * 267EAPI struct wl_registry *
@@ -429,7 +428,8 @@ _ecore_wl_shutdown(Eina_Bool close)
429 { 428 {
430 Ecore_Wl_Output *out, *tout; 429 Ecore_Wl_Output *out, *tout;
431 Ecore_Wl_Input *in, *tin; 430 Ecore_Wl_Input *in, *tin;
432 Ecore_Wl_Global *global, *tglobal; 431 Ecore_Wl_Global *global;
432 Eina_Inlist *tmp;
433 433
434 wl_list_for_each_safe(out, tout, &_ecore_wl_disp->outputs, link) 434 wl_list_for_each_safe(out, tout, &_ecore_wl_disp->outputs, link)
435 _ecore_wl_output_del(out); 435 _ecore_wl_output_del(out);
@@ -437,12 +437,13 @@ _ecore_wl_shutdown(Eina_Bool close)
437 wl_list_for_each_safe(in, tin, &_ecore_wl_disp->inputs, link) 437 wl_list_for_each_safe(in, tin, &_ecore_wl_disp->inputs, link)
438 _ecore_wl_input_del(in); 438 _ecore_wl_input_del(in);
439 439
440 wl_list_for_each_safe(global, tglobal, &_ecore_wl_disp->globals, link) 440 EINA_INLIST_FOREACH_SAFE(_ecore_wl_disp->globals, tmp, global)
441 { 441 {
442 wl_list_remove(&global->link); 442 _ecore_wl_disp->globals = eina_inlist_remove
443 free(global->interface); 443 (_ecore_wl_disp->globals, EINA_INLIST_GET(global));
444 free(global); 444 free(global->interface);
445 } 445 free(global);
446 }
446 447
447 _ecore_wl_xkb_shutdown(_ecore_wl_disp); 448 _ecore_wl_xkb_shutdown(_ecore_wl_disp);
448 449
@@ -559,14 +560,12 @@ _ecore_wl_cb_handle_global(void *data, struct wl_registry *registry, unsigned in
559 560
560 ewd = data; 561 ewd = data;
561 562
562 global = malloc(sizeof(Ecore_Wl_Global)); 563 global = calloc(1, sizeof(Ecore_Wl_Global));
563
564 memset(global, 0, sizeof(Ecore_Wl_Global));
565 564
566 global->id = id; 565 global->id = id;
567 global->interface = strdup(interface); 566 global->interface = strdup(interface);
568 global->version = version; 567 global->version = version;
569 wl_list_insert(ewd->globals.prev, &global->link); 568 ewd->globals = eina_inlist_append(ewd->globals, EINA_INLIST_GET(global));
570 569
571 if (!strcmp(interface, "wl_compositor")) 570 if (!strcmp(interface, "wl_compositor"))
572 { 571 {
@@ -624,16 +623,18 @@ static void
624_ecore_wl_cb_handle_global_remove(void *data, struct wl_registry *registry EINA_UNUSED, unsigned int id) 623_ecore_wl_cb_handle_global_remove(void *data, struct wl_registry *registry EINA_UNUSED, unsigned int id)
625{ 624{
626 Ecore_Wl_Display *ewd; 625 Ecore_Wl_Display *ewd;
627 Ecore_Wl_Global *global, *tmp; 626 Ecore_Wl_Global *global;
627 Eina_Inlist *tmp;
628 628
629 LOGFN(__FILE__, __LINE__, __FUNCTION__); 629 LOGFN(__FILE__, __LINE__, __FUNCTION__);
630 630
631 ewd = data; 631 ewd = data;
632 632
633 wl_list_for_each_safe(global, tmp, &ewd->globals, link) 633 EINA_INLIST_FOREACH_SAFE(ewd->globals, tmp, global)
634 { 634 {
635 if (global->id != id) continue; 635 if (global->id != id) continue;
636 wl_list_remove(&global->link); 636 ewd->globals = eina_inlist_remove(ewd->globals,
637 EINA_INLIST_GET(global));
637 free(global->interface); 638 free(global->interface);
638 free(global); 639 free(global);
639 } 640 }
diff --git a/src/lib/ecore_wayland/ecore_wl_private.h b/src/lib/ecore_wayland/ecore_wl_private.h
index 69b2f95dcb..0127b448f8 100644
--- a/src/lib/ecore_wayland/ecore_wl_private.h
+++ b/src/lib/ecore_wayland/ecore_wl_private.h
@@ -74,7 +74,7 @@ struct _Ecore_Wl_Display
74 74
75 struct wl_list inputs; 75 struct wl_list inputs;
76 struct wl_list outputs; 76 struct wl_list outputs;
77 struct wl_list globals; /** @since 1.7.6 */ 77 Eina_Inlist *globals; /** @since 1.7.6 */
78 78
79 Eina_Bool init_done; 79 Eina_Bool init_done;
80 80