lib_LTLIBRARIES += libpepper.la
libpepper_la_CFLAGS = $(PEPPER_CFLAGS) -DMODULEDIR='"$(moduledir)"'
libpepper_la_LIBADD = $(PEPPER_LIBS)
-libpepper_la_SOURCES = pepper.h \
- pepper_internal.h \
- common.h \
- common.c \
- compositor.c \
- output.c \
- input.c \
- client.c \
- shell.c \
- surface.c
+libpepper_la_SOURCES = pepper.h \
+ pepper_internal.h \
+ common.h \
+ common.c \
+ compositor.c \
+ output.c \
+ input.c \
+ client.c \
+ shell.c \
+ surface.c \
+ debug_ch.c \
+ log.c
# input module library
module_LTLIBRARIES += input_libinput.la
#include "pepper_internal.h"
+#include "debug_ch.h"
+
+DECLARE_DEBUG_CHANNEL(compositor);
extern const struct wl_surface_interface surface_implementation;
pepper_compositor_t *compositor = wl_resource_get_user_data(resource);
pepper_surface_t *surface;
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
surface = (pepper_surface_t *)pepper_calloc(1, sizeof(pepper_surface_t));
if (!surface)
{
- PEPPER_ERROR("%s Surface memory allocation failed\n", __FUNCTION__);
+ ERR("Surface memory allocation failed\n");
wl_resource_post_no_memory(resource);
}
wl_resource_get_version(resource), id);
if (!surface->resource)
{
- PEPPER_ERROR("%s wl_resource_create failed\n", __FUNCTION__);
+ ERR("wl_resource_create failed\n");
pepper_free(surface);
wl_resource_post_no_memory(resource);
return ;
struct wl_resource *resource,
uint32_t id)
{
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
}
static const struct wl_compositor_interface compositor_interface =
pepper_compositor_t *compositor = (pepper_compositor_t *)data;
struct wl_resource *resource;
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
resource = wl_resource_create(client, &wl_compositor_interface, version, id);
if (!resource)
{
- PEPPER_ERROR("%s wl_resource_create failed\n", __FUNCTION__);
+ ERR("wl_resource_create failed\n");
wl_client_post_no_memory(client);
return;
}
- PEPPER_TRACE("%s wl_resource_create success\n", __FUNCTION__);
+ TRACE("wl_resource_create success\n");
wl_resource_set_implementation(resource, &compositor_interface, compositor, NULL);
}
{
pepper_compositor_t *compositor = NULL;
+
+ pepper_log_init(NULL); /* log filename, NULL is stderr */
+
compositor = (pepper_compositor_t *)pepper_calloc(1, sizeof (pepper_compositor_t));
if (!compositor)
if (!compositor->display)
{
- PEPPER_ERROR("Failed to create wayland display object.\n");
+ ERR("Failed to create wayland display object.\n");
goto error;
}
if (wl_display_add_socket(compositor->display, socket_name) != 0)
{
- PEPPER_ERROR("Failed to add socket display = %p socket_name = %s\n",
+ ERR("Failed to add socket display = %p socket_name = %s\n",
compositor->display, socket_name);
goto error;
}
--- /dev/null
+/**
+ * @file debug_ch.c
+ * @brief Management of the debugging channels
+ *
+ * @author
+ * @date
+ * @attention
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <assert.h>
+#include <unistd.h>
+#include <features.h>
+# include <sys/types.h>
+# include <sys/utsname.h>
+
+#include "debug_ch.h"
+
+#if defined(__thumb__) && !defined(__thumb2__)
+# define __ATOMIC_SWITCH_TO_ARM \
+ "adr r3, 5f\n" \
+ "bx r3\n" \
+ ".align\n" \
+ ".arm\n" \
+ "5:\n"
+/* note: the leading \n below is intentional */
+# define __ATOMIC_SWITCH_TO_THUMB \
+ "\n" \
+ "adr r3, 6f\n" \
+ "bx r3\n" \
+ ".thumb" \
+ "6:\n"
+
+# define __ATOMIC_CLOBBERS "r3" /* list of clobbered registers */
+
+# warning Rebuilding this source file in ARM mode is highly recommended for performance!!
+
+#else
+# define __ATOMIC_SWITCH_TO_ARM /* nothing */
+# define __ATOMIC_SWITCH_TO_THUMB /* nothing */
+# define __ATOMIC_CLOBBERS /* nothing */
+#endif
+
+
+static inline int
+interlocked_xchg_add( int *dest, int incr )
+{
+#if defined (__i386__) || defined (__x86_64__)
+ int ret;
+ __asm__ __volatile__( "lock; xaddl %0,(%1)"
+ : "=r" (ret)
+ : "r" (dest), "0" (incr)
+ : "memory" );
+ return ret;
+#elif defined (__arm__)
+ int ret, tmp, status;
+ do {
+ __asm__ __volatile__ (
+ __ATOMIC_SWITCH_TO_ARM
+ "ldrex %0, [%4]\n"
+ "add %1, %0, #1\n"
+ "strex %2, %1, [%4]"
+ __ATOMIC_SWITCH_TO_THUMB
+ : "=&r" (ret), "=&r" (tmp), "=&r" (status), "+m"(*dest)
+ : "r" (dest)
+ : __ATOMIC_CLOBBERS "cc");
+ } while (__builtin_expect(status != 0, 0));
+ return ret;
+#else
+# warning "unknown platform!!"
+#endif
+}
+
+
+static const char * const debug_classes[] = {"fixme", "err", "warn", "trace", "info"};
+
+#define MAX_DEBUG_OPTIONS 256
+
+/*
+static unsigned char default_flags = (1 << __DBCL_ERR) | (1 << __DBCL_FIXME) | (1 << __DBCL_INFO);
+*/
+static unsigned char default_flags = (1 << __DBCL_ERR) | (1 << __DBCL_INFO);
+static int nb_debug_options = -1;
+static struct _debug_channel debug_options[MAX_DEBUG_OPTIONS];
+
+static void
+debug_init(void);
+
+static int
+cmp_name(const void *p1, const void *p2)
+{
+ const char *name = p1;
+ const struct _debug_channel *chan = p2;
+ return strcmp( name, chan->name );
+}
+
+/* get the flags to use for a given channel, possibly setting them too in case of lazy init */
+unsigned char
+_dbg_get_channel_flags( struct _debug_channel *channel )
+{
+ if (nb_debug_options == -1)
+ debug_init();
+
+ if(nb_debug_options)
+ {
+ struct _debug_channel *opt;
+
+ /* first check for multi channel */
+ opt = bsearch( channel->multiname,
+ debug_options,
+ nb_debug_options,
+ sizeof(debug_options[0]), cmp_name );
+ if (opt)
+ return opt->flags;
+
+ opt = bsearch( channel->name,
+ debug_options,
+ nb_debug_options,
+ sizeof(debug_options[0]), cmp_name );
+ if (opt)
+ return opt->flags;
+ }
+
+ /* no option for this channel */
+ if (channel->flags & (1 << __DBCL_INIT))
+ channel->flags = default_flags;
+
+ return default_flags;
+}
+
+/* set the flags to use for a given channel; return 0 if the channel is not available to set */
+int
+_dbg_set_channel_flags(struct _debug_channel *channel,
+ unsigned char set,
+ unsigned char clear )
+{
+ if (nb_debug_options == -1)
+ debug_init();
+
+ if (nb_debug_options)
+ {
+ struct _debug_channel *opt;
+
+ /* first set for multi channel */
+ opt = bsearch( channel->multiname,
+ debug_options,
+ nb_debug_options,
+ sizeof(debug_options[0]), cmp_name );
+ if (opt)
+ {
+ opt->flags = (opt->flags & ~clear) | set;
+ return 1;
+ }
+
+ opt = bsearch( channel->name,
+ debug_options,
+ nb_debug_options,
+ sizeof(debug_options[0]), cmp_name );
+ if (opt)
+ {
+ opt->flags = (opt->flags & ~clear) | set;
+ return 1;
+ }
+ }
+ return 0;
+}
+
+/* add a new debug option at the end of the option list */
+static void
+add_option( const char *name, unsigned char set, unsigned char clear )
+{
+ int min = 0, max = nb_debug_options - 1, pos, res;
+
+ if (!name[0]) /* "all" option */
+ {
+ default_flags = (default_flags & ~clear) | set;
+ return;
+ }
+
+ if (strlen(name) >= sizeof(debug_options[0].name))
+ return;
+
+ while (min <= max)
+ {
+ pos = (min + max) / 2;
+ res = strcmp( name, debug_options[pos].name );
+ if (!res)
+ {
+ debug_options[pos].flags = (debug_options[pos].flags & ~clear) | set;
+ return;
+ }
+ if (res < 0)
+ max = pos - 1;
+ else
+ min = pos + 1;
+ }
+ if (nb_debug_options >= MAX_DEBUG_OPTIONS)
+ return;
+
+ pos = min;
+ if (pos < nb_debug_options)
+ {
+ memmove( &debug_options[pos + 1],
+ &debug_options[pos],
+ (nb_debug_options - pos) * sizeof(debug_options[0]) );
+ }
+
+ strcpy( debug_options[pos].name, name );
+ debug_options[pos].flags = (default_flags & ~clear) | set;
+ nb_debug_options++;
+}
+
+/* parse a set of debugging option specifications and add them to the option list */
+static void
+parse_options( const char *str )
+{
+ char *opt, *next, *options;
+ unsigned int i;
+
+ if (!(options = strdup(str)))
+ return;
+ for (opt = options; opt; opt = next)
+ {
+ const char *p;
+ unsigned char set = 0, clear = 0;
+
+ if ((next = strchr( opt, ',' )))
+ *next++ = 0;
+
+ p = opt + strcspn( opt, "+-" );
+ if (!p[0])
+ p = opt; /* assume it's a debug channel name */
+
+ if (p > opt)
+ {
+ for (i = 0; i < sizeof(debug_classes)/sizeof(debug_classes[0]); i++)
+ {
+ int len = strlen(debug_classes[i]);
+ if (len != (p - opt))
+ continue;
+ if (!memcmp( opt, debug_classes[i], len )) /* found it */
+ {
+ if (*p == '+')
+ set |= 1 << i;
+ else
+ clear |= 1 << i;
+ break;
+ }
+ }
+ if (i == sizeof(debug_classes)/sizeof(debug_classes[0])) /* bad class name, skip it */
+ continue;
+ }
+ else
+ {
+ if (*p == '-')
+ clear = ~0;
+ else
+ set = ~0;
+ }
+ if (*p == '+' || *p == '-')
+ p++;
+ if (!p[0])
+ continue;
+
+ if (!strcmp( p, "all" ))
+ default_flags = (default_flags & ~clear) | set;
+ else
+ add_option( p, set, clear );
+ }
+ free( options );
+}
+
+/* print the usage message */
+static void
+debug_usage(void)
+{
+ static const char usage[] =
+ "Syntax of the DEBUGCH variable:\n"
+ " DEBUGCH=[class]+xxx,[class]-yyy,...\n\n"
+ "Example: DEBUGCH=+all,warn-heap\n"
+ " turns on all messages except warning heap messages\n"
+ "Available message classes: err, warn, fixme, trace\n";
+ const int ret = write( 2, usage, sizeof(usage) - 1 );
+ assert(ret >= 0);
+ exit(1);
+}
+
+/* initialize all options at startup */
+static void
+debug_init(void)
+{
+ char *debug = NULL;
+ FILE *fp = NULL;
+ char *tmp = NULL;
+
+ if (nb_debug_options != -1)
+ return; /* already initialized */
+
+ nb_debug_options = 0;
+
+ fp= fopen("DEBUGCH", "r");
+ if( fp == NULL)
+ {
+ debug = getenv("DEBUGCH");
+ }
+ else
+ {
+ if ((tmp= (char *)malloc(1024 + 1)) == NULL)
+ {
+ fclose(fp);
+ return;
+ }
+
+ fseek(fp, 0, SEEK_SET);
+ const char* str = fgets(tmp, 1024, fp);
+ if (str)
+ {
+ tmp[strlen(tmp)-1] = 0;
+ debug = tmp;
+ }
+
+ fclose(fp);
+ }
+
+ if( debug != NULL )
+ {
+ if (!strcmp( debug, "help" ))
+ debug_usage();
+ parse_options( debug );
+ }
+
+ if( tmp != NULL )
+ {
+ free(tmp);
+ }
+}
+
+/* allocate some tmp string space */
+/* FIXME: this is not 100% thread-safe */
+char *
+get_dbg_temp_buffer( size_t size )
+{
+ static char *list[32];
+ static int pos;
+ char *ret;
+ int idx;
+
+ idx = interlocked_xchg_add( &pos, 1 ) % (sizeof(list)/sizeof(list[0]));
+
+ if ((ret = realloc( list[idx], size )))
+ list[idx] = ret;
+
+ return ret;
+}
+
+/* release unused part of the buffer */
+void
+release_dbg_temp_buffer( char *buffer, size_t size )
+{
+ /* don't bother doing anything */
+ (void)( buffer );
+ (void)( size );
+}
+
+/* jjh */
+static FILE* logfile = NULL;
+void
+dbg_set_logfile(const char* filename)
+{
+ if (filename)
+ logfile = fopen(filename, "a");
+
+ if (logfile == NULL)
+ logfile = stderr;
+ else
+ setvbuf(logfile, NULL, _IOLBF, 256); /* block buffered -> line buffered */
+}
+
+static int
+dbg_vprintf( const char *format, va_list args )
+{
+#if 0
+ int ret = vfprintf( stdout, format, args );
+ fflush(stdout);
+#else
+ int ret = vfprintf( logfile, format, args );
+ fflush(logfile);
+#endif
+ return ret;
+}
+
+int dbg_printf( const char *format, ... )
+{
+ int ret;
+ va_list valist;
+
+ /* lock */
+
+ va_start(valist, format);
+ ret = dbg_vprintf( format, valist );
+ va_end(valist);
+
+ /* unlock */
+
+ return ret;
+}
+
+int
+dbg_printf_nonewline( const char *format, ... )
+{
+ int ret;
+ va_list valist;
+
+ va_start(valist, format);
+ ret = dbg_vprintf( format, valist );
+ va_end(valist);
+
+ return ret;
+}
+
+/* printf with temp buffer allocation */
+const char *
+dbg_sprintf( const char *format, ... )
+{
+ static const int max_size = 200;
+ char *ret;
+ int len;
+ va_list valist;
+
+ va_start(valist, format);
+ ret = get_dbg_temp_buffer( max_size );
+ len = vsnprintf( ret, max_size, format, valist );
+ if (len == -1 || len >= max_size)
+ ret[max_size-1] = 0;
+ else
+ release_dbg_temp_buffer( ret, len + 1 );
+ va_end(valist);
+ return ret;
+}
+
+/* default implementation of dbg_vlog */
+static int
+dbg_vlog(enum _debug_class cls,
+ struct _debug_channel *channel,
+ const char *func,
+ const char *format,
+ va_list args )
+{
+ int ret = 0;
+
+ if (cls < sizeof(debug_classes)/sizeof(debug_classes[0]))
+ {
+ (void)(channel);
+ (void)(func);
+ /* to print debug class, channel */
+ ret += dbg_printf_nonewline("[%s:%s"
+ , debug_classes[cls] , channel->name);
+
+ if (*channel->multiname)
+ ret += dbg_printf_nonewline(":%s]", channel->multiname);
+ else
+ ret += dbg_printf_nonewline("]");
+ }
+ if (format)
+ {
+ ret += dbg_vprintf( format, args );
+ }
+ return ret;
+}
+
+int
+dbg_log(enum _debug_class cls,
+ struct _debug_channel *channel,
+ const char *func,
+ const char *format,
+ ... )
+{
+ int ret;
+ va_list valist;
+
+ if (!(_dbg_get_channel_flags( channel ) & (1 << cls)))
+ return -1;
+
+ va_start(valist, format);
+ ret = dbg_vlog( cls, channel, func, format, valist );
+ va_end(valist);
+
+ return ret;
+}
+
+void
+assert_fail(char *exp, const char *file, int line)
+{
+ fprintf(stderr, "[%s][%d] Assert(%s) failed \n"
+ , file, line, exp);
+ fprintf(stdout, "[%s][%d] Assert(%s) failed \n"
+ , file, line, exp);
+ exit(0);
+}
+
+/* end of debug_ch.c */
--- /dev/null
+/**
+ * @file debug_ch.h
+ * @brief Management of the debugging channels
+ *
+ * @author
+ * @date
+ * @attention
+ */
+
+#ifndef __DEBUGCHANNEL_H
+#define __DEBUGCHANNEL_H
+
+#include <sys/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum _debug_class
+{
+ __DBCL_FIXME,
+ __DBCL_ERR,
+ __DBCL_WARN,
+ __DBCL_TRACE,
+ __DBCL_INFO,
+
+ __DBCL_INIT = 7 /* lazy init flag */
+};
+
+struct _debug_channel
+{
+ unsigned char flags;
+ char name[15];
+ char multiname[15];
+};
+
+#ifndef NO_DEBUG
+#define __GET_DEBUGGING_FIXME(dbch) ((dbch)->flags & (1 << __DBCL_FIXME))
+#define __GET_DEBUGGING_ERR(dbch) ((dbch)->flags & (1 << __DBCL_ERR))
+#define __GET_DEBUGGING_WARN(dbch) ((dbch)->flags & (1 << __DBCL_WARN))
+#define __GET_DEBUGGING_TRACE(dbch) ((dbch)->flags & (1 << __DBCL_TRACE))
+#define __GET_DEBUGGING_INFO(dbch) ((dbch)->flags & (1 << __DBCL_INFO))
+#else
+#define __GET_DEBUGGING_FIXME(dbch) 0
+#define __GET_DEBUGGING_ERR(dbch) 0
+#define __GET_DEBUGGING_WARN(dbch) 0
+#define __GET_DEBUGGING_TRACE(dbch) 0
+#define __GET_DEBUGGING_INFO(dbch) 0
+#endif
+
+#define __GET_DEBUGGING(dbcl,dbch) __GET_DEBUGGING##dbcl(dbch)
+
+#define __IS_DEBUG_ON(dbcl,dbch) \
+ (__GET_DEBUGGING##dbcl(dbch) && \
+ (_dbg_get_channel_flags(dbch) & (1 << __DBCL##dbcl)))
+
+#define __DPRINTF(dbcl,dbch) \
+ (!__GET_DEBUGGING(dbcl,(dbch)) || \
+ (dbg_log(__DBCL##dbcl,(dbch),__FILE__, \
+ "[%s:%d] ", __FUNCTION__, __LINE__) == -1)) ? \
+(void)0 : (void)dbg_printf
+
+extern unsigned char
+_dbg_get_channel_flags( struct _debug_channel *channel );
+extern int
+_dbg_set_channel_flags( struct _debug_channel *channel,
+ unsigned char set,
+ unsigned char clear );
+
+extern const char *
+dbg_sprintf( const char *format, ... );
+
+extern int
+dbg_printf( const char *format, ... );
+
+extern int
+dbg_printf_nonewline( const char *format, ... );
+
+extern int
+dbg_log( enum _debug_class cls,
+ struct _debug_channel *ch,
+ const char *func,
+ const char *format,
+ ... );
+
+extern char *
+get_dbg_temp_buffer( size_t size );
+
+extern void
+release_dbg_temp_buffer( char *buffer, size_t size );
+
+#ifndef TRACE
+#define TRACE __DPRINTF(_TRACE,_dbch___default)
+#define TRACE_(ch) __DPRINTF(_TRACE,&_dbch_##ch)
+#endif
+#define TRACE_ON(ch) __IS_DEBUG_ON(_TRACE,&_dbch_##ch)
+
+#ifndef WARN
+#define WARN __DPRINTF(_WARN,_dbch___default)
+#define WARN_(ch) __DPRINTF(_WARN,&_dbch_##ch)
+#endif
+#define WARN_ON(ch) __IS_DEBUG_ON(_WARN,&_dbch_##ch)
+
+#ifndef FIXME
+#define FIXME __DPRINTF(_FIXME,_dbch___default)
+#define FIXME_(ch) __DPRINTF(_FIXME,&_dbch_##ch)
+#endif
+#define FIXME_ON(ch) __IS_DEBUG_ON(_FIXME,&_dbch_##ch)
+
+#define ERR __DPRINTF(_ERR,_dbch___default)
+#define ERR_(ch) __DPRINTF(_ERR,&_dbch_##ch)
+#define ERR_ON(ch) __IS_DEBUG_ON(_ERR,&_dbch_##ch)
+
+#ifndef INFO
+#define INFO __DPRINTF(_INFO,_dbch___default)
+#define INFO_(ch) __DPRINTF(_INFO,&_dbch_##ch)
+#endif
+#define INFO_ON(ch) __IS_DEBUG_ON(_INFO,&_dbch_##ch)
+
+#define DECLARE_DEBUG_CHANNEL(ch) \
+ static struct _debug_channel _dbch_##ch = { ~0, #ch, ""}; \
+static struct _debug_channel * const _dbch___default = &_dbch_##ch
+#define DEFAULT_DEBUG_CHANNEL(ch) \
+ static struct _debug_channel _dbch_##ch = { ~0, #ch, ""}; \
+static struct _debug_channel * const _dbch___default = &_dbch_##ch
+
+#define MULTI_DEBUG_CHANNEL(ch, chm) \
+ static struct _debug_channel _dbch_##ch = { ~0, #ch , #chm}; \
+static struct _debug_channel * const _dbch___default = &_dbch_##ch
+
+#define DPRINTF dbg_printf
+#define MESSAGE dbg_printf
+
+void assert_fail(char *exp, const char *file, int line);
+
+#define ASSERT(exp) if (exp) ; \
+ else assert_fail( (char *)#exp, __FILE__, __LINE__ )
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __DEBUGCHANNEL_H */
#include <dlfcn.h>
#include "pepper_internal.h"
+#include "debug_ch.h"
+
+DECLARE_DEBUG_CHANNEL(input);
#define PATH_MAX_LEN 128
int
seat = (pepper_seat_t *)pepper_calloc(1, sizeof(pepper_seat_t));
if (!seat)
{
- PEPPER_ERROR("%s Memory allocation failed\n", __FUNCTION__);
+ ERR("Memory allocation failed\n");
goto err;
}
pointer = (pepper_pointer_t *)pepper_calloc(1, sizeof(pepper_pointer_t));
if (!pointer)
{
- PEPPER_ERROR("%s Memory allocation failed\n", __FUNCTION__);
+ ERR("Memory allocation failed\n");
goto err;
}
keyboard = (pepper_keyboard_t *)pepper_calloc(1, sizeof(pepper_keyboard_t));
if (!keyboard)
{
- PEPPER_ERROR("%s Memory allocation failed\n", __FUNCTION__);
+ ERR("Memory allocation failed\n");
goto err;
}
touch = (pepper_touch_t *)pepper_calloc(1, sizeof(pepper_touch_t));
if (!touch)
{
- PEPPER_ERROR("%s Memory allocation failed\n", __FUNCTION__);
+ ERR("Memory allocation failed\n");
goto err;
}
pointer_set_cursor(struct wl_client *client, struct wl_resource *resource, uint32_t serial,
struct wl_resource *surface_resource, int32_t x, int32_t y)
{
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
/* TODO: */
}
static void
pointer_release(struct wl_client *client, struct wl_resource *resource)
{
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
wl_resource_destroy(resource);
}
static void
keyboard_release(struct wl_client *client, struct wl_resource *resource)
{
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
wl_resource_destroy(resource);
}
static void
touch_release(struct wl_client *client, struct wl_resource *resource)
{
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
wl_resource_destroy(resource);
}
pepper_seat_t *seat = wl_resource_get_user_data(resource);
pepper_pointer_t *pointer = seat->pointer;
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
pointer->resource = wl_resource_create(client, &wl_pointer_interface,
wl_resource_get_version(resource), id);
pepper_seat_t *seat = wl_resource_get_user_data(resource);
pepper_keyboard_t *keyboard = seat->keyboard;
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
keyboard->resource = wl_resource_create(client, &wl_keyboard_interface,
wl_resource_get_version(resource), id);
pepper_seat_t *seat = wl_resource_get_user_data(resource);
pepper_touch_t *touch = seat->touch;
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
touch->resource = wl_resource_create(client, &wl_touch_interface,
wl_resource_get_version(resource), id);
pepper_seat_t *seat = (pepper_seat_t *)data;
enum wl_seat_capability caps = 0;
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
seat->resource = wl_resource_create(client, &wl_seat_interface,
(version < 4) ? version : 4, id);
--- /dev/null
+#include <stdio.h>
+
+#include <wayland-util.h>
+#include "debug_ch.h"
+
+DECLARE_DEBUG_CHANNEL(libwayland);
+
+static void
+pepper_wayland_log_func(const char* format, va_list args)
+{
+#if 0
+ fprintf(stderr, "libwayland: ");
+ vfprintf(stderr, format, args);
+#else
+ ERR(format, args);
+#endif
+}
+
+void
+pepper_log_init(const char* filename)
+{
+ wl_log_set_handler_server(pepper_wayland_log_func);
+ dbg_set_logfile(filename);
+}
#include "common.h"
#include "pepper_internal.h"
+#include "debug_ch.h"
+
+DECLARE_DEBUG_CHANNEL(input);
static int
get_event_fd(void *data)
set_input_event_data_touch(event, li_event, type);
break;
default:
- PEPPER_ERROR("%s Undefined event type!!\n", __FUNCTION__);
+ ERR("Undefined event type!!\n");
return -1;
}
struct udev *udev;
struct libinput *li;
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
udev = udev_new();
if (!udev)
{
- PEPPER_ERROR("%s udev_new failed\n", __FUNCTION__);
+ ERR("udev_new failed\n");
goto err;
}
li = libinput_udev_create_context(&libinput_interface, NULL/* user_data */, udev);
if (!li)
{
- PEPPER_ERROR("%s libinput_udev_create_context failed\n", __FUNCTION__);
+ ERR("libinput_udev_create_context failed\n");
goto err;
}
#include "pepper_internal.h"
+#include "debug_ch.h"
+
+DECLARE_DEBUG_CHANNEL(shell);
/* shell surface interface */
static void
{
pepper_shell_surface_t *shsurface = wl_resource_get_user_data(resource);
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
}
static void
{
pepper_shell_surface_t *shsurface = wl_resource_get_user_data(resource);
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
}
static void
{
pepper_shell_surface_t *shsurface = wl_resource_get_user_data(resource);
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
}
static void
{
pepper_shell_surface_t *shsurface = wl_resource_get_user_data(resource);
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
}
{
pepper_shell_surface_t *shsurface = wl_resource_get_user_data(resource);
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
}
static void
{
pepper_shell_surface_t *shsurface = wl_resource_get_user_data(resource);
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
}
static void
{
pepper_shell_surface_t *shsurface = wl_resource_get_user_data(resource);
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
}
static void
{
pepper_shell_surface_t *shsurface = wl_resource_get_user_data(resource);
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
}
{
pepper_shell_surface_t *shsurface = wl_resource_get_user_data(resource);
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
}
static void
{
pepper_shell_surface_t *shsurface = wl_resource_get_user_data(resource);
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
}
static const struct wl_shell_surface_interface pepper_shell_surface_implementation =
pepper_surface_t *surface = wl_resource_get_user_data(surface_resource);
pepper_shell_surface_t *shsurface;
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
shsurface = (pepper_shell_surface_t *)pepper_calloc(1, sizeof(pepper_shell_surface_t));
if (!shsurface)
{
- PEPPER_ERROR("%s Shell surface memory allocation failed\n", __FUNCTION__);
+ ERR("Shell surface memory allocation failed\n");
wl_client_post_no_memory(client);
return ;
}
wl_resource_get_version(resource), id);
if (!shsurface->resource)
{
- PEPPER_ERROR("%s wl_resource_create failed\n", __FUNCTION__);
+ ERR("wl_resource_create failed\n");
pepper_free(shsurface);
wl_client_post_no_memory(client);
return ;
pepper_compositor_t *compositor = (pepper_compositor_t *)data;
struct wl_resource *resource;
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
resource = wl_resource_create(client, &wl_shell_interface, version, id);
if (!resource)
{
- PEPPER_ERROR("%s wl_resource_create failed\n", __FUNCTION__);
+ ERR("wl_resource_create failed\n");
wl_client_post_no_memory(client);
return;
#include "pepper_internal.h"
+#include "debug_ch.h"
+
+DECLARE_DEBUG_CHANNEL(surface);
void *
pepper_surface_get_buffer(pepper_surface_t *surface)
static void
surface_destroy(struct wl_client *client, struct wl_resource *resource)
{
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
wl_resource_destroy(resource);
}
{
pepper_surface_t *surface = wl_resource_get_user_data(resource);
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
}
static void
{
pepper_surface_t *surface = wl_resource_get_user_data(resource);
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
}
static void
{
pepper_surface_t *surface = wl_resource_get_user_data(resource);
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
}
static void
{
pepper_surface_t *surface = wl_resource_get_user_data(resource);
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
}
static void
{
pepper_surface_t *surface = wl_resource_get_user_data(resource);
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
}
static void
{
pepper_surface_t *surface = wl_resource_get_user_data(resource);
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
}
static void
{
pepper_surface_t *surface = wl_resource_get_user_data(resource);
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
}
static void
{
pepper_surface_t *surface = wl_resource_get_user_data(resource);
- PEPPER_TRACE("%s\n", __FUNCTION__);
+ TRACE("enter\n");
}
const struct wl_surface_interface surface_implementation =