diff options
Diffstat (limited to 'ivi-layermanagement-examples/simple-weston-client/src/simple-weston-client.c')
-rw-r--r-- | ivi-layermanagement-examples/simple-weston-client/src/simple-weston-client.c | 52 |
1 files changed, 23 insertions, 29 deletions
diff --git a/ivi-layermanagement-examples/simple-weston-client/src/simple-weston-client.c b/ivi-layermanagement-examples/simple-weston-client/src/simple-weston-client.c index 6b77f01..1434c31 100644 --- a/ivi-layermanagement-examples/simple-weston-client/src/simple-weston-client.c +++ b/ivi-layermanagement-examples/simple-weston-client/src/simple-weston-client.c @@ -36,17 +36,18 @@ #include <ivi-application-client-protocol.h> #ifdef LIBWESTON_DEBUG_PROTOCOL -#include "dlt_common.h" -#include "dlt_user.h" #include "weston-debug-client-protocol.h" +#define MAXSTRLEN 1024 +#endif + +#ifdef DLT +#include "dlt.h" #define WESTON_DLT_APP_DESC "messages from weston debug protocol" #define WESTON_DLT_CONTEXT_DESC "weston debug context" #define WESTON_DLT_APP "WESN" #define WESTON_DLT_CONTEXT "WESC" - -#define MAXSTRLEN 1024 #endif #ifndef MIN @@ -98,6 +99,8 @@ struct debug_stream { struct weston_debug_stream_v1 *obj; }; +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + static const char *left_ptrs[] = { "left_ptr", "default", @@ -270,12 +273,12 @@ static int create_cursors(WaylandContextStruct* wlcontext) { wlcontext->cursor = NULL; - for (j = 0; !wlcontext->cursor && j < 4; ++j) + for (j = 0; !wlcontext->cursor && j < ARRAY_SIZE(left_ptrs); ++j) wlcontext->cursor = wl_cursor_theme_get_cursor(wlcontext->cursor_theme, left_ptrs[j]); if (!wlcontext->cursor) { - fprintf(stderr, "could not load cursor '%s'\n", left_ptrs[j]); + fprintf(stderr, "could not load any cursor\n"); return -1; } @@ -700,19 +703,19 @@ static void * weston_dlt_thread_function(void *data) { WaylandContextStruct* wlcontext; + +#ifdef DLT + /*init dlt*/ char apid[DLT_ID_SIZE]; char ctid[DLT_ID_SIZE]; DLT_DECLARE_CONTEXT(weston_dlt_context) - - wlcontext = (WaylandContextStruct*)data; - - /*init dlt*/ dlt_set_id(apid, WESTON_DLT_APP); dlt_set_id(ctid, WESTON_DLT_CONTEXT); DLT_REGISTER_APP(apid, WESTON_DLT_APP_DESC); DLT_REGISTER_CONTEXT(weston_dlt_context, ctid, WESTON_DLT_CONTEXT_DESC); - +#endif + wlcontext = (WaylandContextStruct*)data; /*make the stdin as read end of the pipe*/ dup2(wlcontext->pipefd[0], STDIN_FILENO); @@ -730,12 +733,19 @@ weston_dlt_thread_function(void *data) if (strcmp(str,"")!=0) { +#ifdef DLT DLT_LOG(weston_dlt_context, DLT_LOG_INFO, DLT_STRING(str)); +#else + fprintf(stderr,"%s",str); +#endif } } +#ifdef DLT DLT_UNREGISTER_CONTEXT(weston_dlt_context); DLT_UNREGISTER_APP(); +#endif + pthread_exit(NULL); } #endif @@ -877,24 +887,8 @@ int main (int argc, const char * argv[]) Error: #ifdef LIBWESTON_DEBUG_PROTOCOL - weston_debug_v1_destroy(wlcontext->debug_iface); - - while (1) { - struct debug_stream *stream; - int empty = 1; - - wl_list_for_each(stream, &wlcontext->stream_list, link) - if (stream->obj) { - empty = 0; - break; - } - - if (empty) - break; - - if (wl_display_dispatch(wlcontext->wl_display) < 0) - break; - } + if(wlcontext->debug_iface) + weston_debug_v1_destroy(wlcontext->debug_iface); destroy_streams(wlcontext); wl_display_roundtrip(wlcontext->wl_display); |