diff options
author | U. Artie Eoff <ullysses.a.eoff@intel.com> | 2013-11-22 04:39:03 -0800 |
---|---|---|
committer | U. Artie Eoff <ullysses.a.eoff@intel.com> | 2013-11-22 05:09:53 -0800 |
commit | cfb121c8f8c3f286967a2b0840a46cc1b4cc3efc (patch) | |
tree | bceb9861053592f8b66a99107e6b7f1dbc747f4d /src/lib/ecore_wayland | |
parent | 58368ea63699291c535c78c9fcc6269c478ca511 (diff) |
ecore-wayland: test for subsurface protocol in wayland core
The subsurface protocol was moved into Wayland Core
around v1.3.90 (i.e. v1.4.0).
Test if subsurface protocol is part of wayland-client.h.
If not, we include our own copy of the protocol header.
Also, some whitespace cleanup in ecore_wl.c.
Tested with Wayland 1.3.0 and 1.3.90 (master:360dca5).
Fixes T529
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Diffstat (limited to 'src/lib/ecore_wayland')
-rw-r--r-- | src/lib/ecore_wayland/ecore_wl.c | 46 | ||||
-rw-r--r-- | src/lib/ecore_wayland/ecore_wl_subsurf.c | 12 |
2 files changed, 39 insertions, 19 deletions
diff --git a/src/lib/ecore_wayland/ecore_wl.c b/src/lib/ecore_wayland/ecore_wl.c index e1b525f8db..89a42e710e 100644 --- a/src/lib/ecore_wayland/ecore_wl.c +++ b/src/lib/ecore_wayland/ecore_wl.c | |||
@@ -4,7 +4,17 @@ | |||
4 | 4 | ||
5 | #include <fcntl.h> | 5 | #include <fcntl.h> |
6 | #include "ecore_wl_private.h" | 6 | #include "ecore_wl_private.h" |
7 | #include <subsurface-client-protocol.h> | 7 | |
8 | /* | ||
9 | * The subsurface protocol was moved into Wayland Core | ||
10 | * around v1.3.90 (i.e. v1.4.0). | ||
11 | * Test if subsurface protocol is part of wayland-client.h. | ||
12 | * If not, we include our own copy of the protocol header. | ||
13 | */ | ||
14 | #include <wayland-client.h> | ||
15 | #ifndef WL_SUBSURFACE_ERROR_ENUM | ||
16 | # include <subsurface-client-protocol.h> | ||
17 | #endif | ||
8 | 18 | ||
9 | /* local function prototypes */ | 19 | /* local function prototypes */ |
10 | static Eina_Bool _ecore_wl_shutdown(Eina_Bool close); | 20 | static Eina_Bool _ecore_wl_shutdown(Eina_Bool close); |
@@ -46,7 +56,7 @@ static const struct wl_callback_listener _ecore_wl_init_sync_listener = | |||
46 | _ecore_wl_init_callback | 56 | _ecore_wl_init_callback |
47 | }; | 57 | }; |
48 | 58 | ||
49 | static const struct wl_callback_listener _ecore_wl_anim_listener = | 59 | static const struct wl_callback_listener _ecore_wl_anim_listener = |
50 | { | 60 | { |
51 | _ecore_wl_animator_callback | 61 | _ecore_wl_animator_callback |
52 | }; | 62 | }; |
@@ -245,7 +255,7 @@ ecore_wl_shm_get(void) | |||
245 | EAPI struct wl_display * | 255 | EAPI struct wl_display * |
246 | ecore_wl_display_get(void) | 256 | ecore_wl_display_get(void) |
247 | { | 257 | { |
248 | if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display)) | 258 | if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display)) |
249 | return NULL; | 259 | return NULL; |
250 | return _ecore_wl_disp->wl.display; | 260 | return _ecore_wl_disp->wl.display; |
251 | } | 261 | } |
@@ -253,7 +263,7 @@ ecore_wl_display_get(void) | |||
253 | EAPI Eina_Inlist * | 263 | EAPI Eina_Inlist * |
254 | ecore_wl_globals_get(void) | 264 | ecore_wl_globals_get(void) |
255 | { | 265 | { |
256 | if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display)) | 266 | if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display)) |
257 | return NULL; | 267 | return NULL; |
258 | 268 | ||
259 | _ecore_wl_init_wait(); | 269 | _ecore_wl_init_wait(); |
@@ -264,7 +274,7 @@ ecore_wl_globals_get(void) | |||
264 | EAPI struct wl_registry * | 274 | EAPI struct wl_registry * |
265 | ecore_wl_registry_get(void) | 275 | ecore_wl_registry_get(void) |
266 | { | 276 | { |
267 | if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display)) | 277 | if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display)) |
268 | return NULL; | 278 | return NULL; |
269 | return _ecore_wl_disp->wl.registry; | 279 | return _ecore_wl_disp->wl.registry; |
270 | } | 280 | } |
@@ -358,7 +368,7 @@ ecore_wl_display_iterate(void) | |||
358 | } | 368 | } |
359 | 369 | ||
360 | /* @since 1.8 */ | 370 | /* @since 1.8 */ |
361 | EAPI Eina_Bool | 371 | EAPI Eina_Bool |
362 | ecore_wl_animator_source_set(Ecore_Animator_Source source) | 372 | ecore_wl_animator_source_set(Ecore_Animator_Source source) |
363 | { | 373 | { |
364 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | 374 | LOGFN(__FILE__, __LINE__, __FUNCTION__); |
@@ -398,7 +408,7 @@ ecore_wl_cursor_get(const char *cursor_name) | |||
398 | cursor_name); | 408 | cursor_name); |
399 | } | 409 | } |
400 | 410 | ||
401 | EAPI void | 411 | EAPI void |
402 | ecore_wl_server_mode_set(Eina_Bool on) | 412 | ecore_wl_server_mode_set(Eina_Bool on) |
403 | { | 413 | { |
404 | _ecore_wl_server_mode = on; | 414 | _ecore_wl_server_mode = on; |
@@ -490,7 +500,7 @@ _ecore_wl_cb_idle_enterer(void *data) | |||
490 | 500 | ||
491 | ret = wl_display_flush(ewd->wl.display); | 501 | ret = wl_display_flush(ewd->wl.display); |
492 | if ((ret < 0) && (errno == EAGAIN)) | 502 | if ((ret < 0) && (errno == EAGAIN)) |
493 | ecore_main_fd_handler_active_set(ewd->fd_hdl, | 503 | ecore_main_fd_handler_active_set(ewd->fd_hdl, |
494 | (ECORE_FD_READ | ECORE_FD_WRITE)); | 504 | (ECORE_FD_READ | ECORE_FD_WRITE)); |
495 | 505 | ||
496 | return ECORE_CALLBACK_RENEW; | 506 | return ECORE_CALLBACK_RENEW; |
@@ -616,7 +626,7 @@ _ecore_wl_cb_handle_global(void *data, struct wl_registry *registry, unsigned in | |||
616 | } | 626 | } |
617 | } | 627 | } |
618 | 628 | ||
619 | static void | 629 | static void |
620 | _ecore_wl_cb_handle_global_remove(void *data, struct wl_registry *registry EINA_UNUSED, unsigned int id) | 630 | _ecore_wl_cb_handle_global_remove(void *data, struct wl_registry *registry EINA_UNUSED, unsigned int id) |
621 | { | 631 | { |
622 | Ecore_Wl_Display *ewd; | 632 | Ecore_Wl_Display *ewd; |
@@ -677,7 +687,7 @@ _ecore_wl_sync_wait(Ecore_Wl_Display *ewd) | |||
677 | wl_callback_add_listener(callback, &_ecore_wl_sync_listener, ewd); | 687 | wl_callback_add_listener(callback, &_ecore_wl_sync_listener, ewd); |
678 | } | 688 | } |
679 | 689 | ||
680 | static void | 690 | static void |
681 | _ecore_wl_animator_tick_cb_begin(void *data EINA_UNUSED) | 691 | _ecore_wl_animator_tick_cb_begin(void *data EINA_UNUSED) |
682 | { | 692 | { |
683 | Eina_Hash *windows; | 693 | Eina_Hash *windows; |
@@ -688,13 +698,13 @@ _ecore_wl_animator_tick_cb_begin(void *data EINA_UNUSED) | |||
688 | eina_hash_foreach(windows, _ecore_wl_animator_window_add, NULL); | 698 | eina_hash_foreach(windows, _ecore_wl_animator_window_add, NULL); |
689 | } | 699 | } |
690 | 700 | ||
691 | static void | 701 | static void |
692 | _ecore_wl_animator_tick_cb_end(void *data EINA_UNUSED) | 702 | _ecore_wl_animator_tick_cb_end(void *data EINA_UNUSED) |
693 | { | 703 | { |
694 | _ecore_wl_animator_busy = EINA_FALSE; | 704 | _ecore_wl_animator_busy = EINA_FALSE; |
695 | } | 705 | } |
696 | 706 | ||
697 | static void | 707 | static void |
698 | _ecore_wl_animator_callback(void *data, struct wl_callback *callback, uint32_t serial EINA_UNUSED) | 708 | _ecore_wl_animator_callback(void *data, struct wl_callback *callback, uint32_t serial EINA_UNUSED) |
699 | { | 709 | { |
700 | Ecore_Wl_Window *win; | 710 | Ecore_Wl_Window *win; |
@@ -706,16 +716,16 @@ _ecore_wl_animator_callback(void *data, struct wl_callback *callback, uint32_t s | |||
706 | wl_callback_destroy(callback); | 716 | wl_callback_destroy(callback); |
707 | win->anim_callback = NULL; | 717 | win->anim_callback = NULL; |
708 | 718 | ||
709 | if (_ecore_wl_animator_busy) | 719 | if (_ecore_wl_animator_busy) |
710 | { | 720 | { |
711 | win->anim_callback = wl_surface_frame(win->surface); | 721 | win->anim_callback = wl_surface_frame(win->surface); |
712 | wl_callback_add_listener(win->anim_callback, | 722 | wl_callback_add_listener(win->anim_callback, |
713 | &_ecore_wl_anim_listener, win); | 723 | &_ecore_wl_anim_listener, win); |
714 | ecore_wl_window_commit(win); | 724 | ecore_wl_window_commit(win); |
715 | } | 725 | } |
716 | } | 726 | } |
717 | 727 | ||
718 | static Eina_Bool | 728 | static Eina_Bool |
719 | _ecore_wl_animator_window_add(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata EINA_UNUSED) | 729 | _ecore_wl_animator_window_add(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata EINA_UNUSED) |
720 | { | 730 | { |
721 | Ecore_Wl_Window *win; | 731 | Ecore_Wl_Window *win; |
@@ -731,7 +741,7 @@ _ecore_wl_animator_window_add(const Eina_Hash *hash EINA_UNUSED, const void *key | |||
731 | return EINA_TRUE; | 741 | return EINA_TRUE; |
732 | } | 742 | } |
733 | 743 | ||
734 | static void | 744 | static void |
735 | _ecore_wl_signal_exit(void) | 745 | _ecore_wl_signal_exit(void) |
736 | { | 746 | { |
737 | Ecore_Event_Signal_Exit *ev; | 747 | Ecore_Event_Signal_Exit *ev; |
@@ -740,11 +750,11 @@ _ecore_wl_signal_exit(void) | |||
740 | return; | 750 | return; |
741 | 751 | ||
742 | ev->quit = 1; | 752 | ev->quit = 1; |
743 | ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, ev, | 753 | ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, ev, |
744 | _ecore_wl_signal_exit_free, NULL); | 754 | _ecore_wl_signal_exit_free, NULL); |
745 | } | 755 | } |
746 | 756 | ||
747 | static void | 757 | static void |
748 | _ecore_wl_signal_exit_free(void *data EINA_UNUSED, void *event) | 758 | _ecore_wl_signal_exit_free(void *data EINA_UNUSED, void *event) |
749 | { | 759 | { |
750 | free(event); | 760 | free(event); |
diff --git a/src/lib/ecore_wayland/ecore_wl_subsurf.c b/src/lib/ecore_wayland/ecore_wl_subsurf.c index dd883ac230..f34febf08d 100644 --- a/src/lib/ecore_wayland/ecore_wl_subsurf.c +++ b/src/lib/ecore_wayland/ecore_wl_subsurf.c | |||
@@ -3,7 +3,17 @@ | |||
3 | #endif | 3 | #endif |
4 | 4 | ||
5 | #include "ecore_wl_private.h" | 5 | #include "ecore_wl_private.h" |
6 | #include <subsurface-client-protocol.h> | 6 | |
7 | /* | ||
8 | * The subsurface protocol was moved into Wayland Core | ||
9 | * around v1.3.90 (i.e. v1.4.0). | ||
10 | * Test if subsurface protocol is part of wayland-client.h. | ||
11 | * If not, we include our own copy of the protocol header. | ||
12 | */ | ||
13 | #include <wayland-client.h> | ||
14 | #ifndef WL_SUBSURFACE_ERROR_ENUM | ||
15 | # include <subsurface-client-protocol.h> | ||
16 | #endif | ||
7 | 17 | ||
8 | struct _Ecore_Wl_Subsurf | 18 | struct _Ecore_Wl_Subsurf |
9 | { | 19 | { |