diff options
-rw-r--r-- | gtk/Makefile.am | 3 | ||||
-rw-r--r-- | gtk/channel-base.c | 2 | ||||
-rw-r--r-- | gtk/channel-cursor.c | 2 | ||||
-rw-r--r-- | gtk/channel-inputs.c | 6 | ||||
-rw-r--r-- | gtk/channel-main.c | 2 | ||||
-rw-r--r-- | gtk/channel-playback.c | 6 | ||||
-rw-r--r-- | gtk/channel-record.c | 2 | ||||
-rw-r--r-- | gtk/decode-glz.c | 3 | ||||
-rw-r--r-- | gtk/snappy.c | 2 | ||||
-rw-r--r-- | gtk/spice-channel-cache.h | 6 | ||||
-rw-r--r-- | gtk/spice-channel.c | 2 | ||||
-rw-r--r-- | gtk/spice-client-gtk.defs | 22 | ||||
-rw-r--r-- | gtk/spice-client-gtk.override | 1 | ||||
-rw-r--r-- | gtk/spice-common.h | 1 | ||||
-rw-r--r-- | gtk/spice-pulse.c | 4 | ||||
-rw-r--r-- | gtk/spice-util.c | 20 | ||||
-rw-r--r-- | gtk/spice-util.h | 20 | ||||
-rw-r--r-- | gtk/spice-widget.c | 30 | ||||
-rw-r--r-- | gtk/spicy.c | 26 | ||||
-rw-r--r-- | gtk/tcp.c | 23 | ||||
-rw-r--r-- | gtk/vncdisplaykeymap.c | 4 |
21 files changed, 129 insertions, 58 deletions
diff --git a/gtk/Makefile.am b/gtk/Makefile.am index a3af976..69fb57b 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -91,6 +91,8 @@ libspice_client_glib_la_LIBADD = \ libspice_client_glib_la_SOURCES = \ spice-client.h \ spice-common.h \ + spice-util.h \ + spice-util.c \ \ spice-session.c \ spice-session.h \ @@ -157,6 +159,7 @@ libspice_client_glibinclude_HEADERS = \ spice-session.h \ spice-channel.h \ spice-channel-enums.h \ + spice-util.h \ channel-main.h \ channel-display.h \ channel-cursor.h \ diff --git a/gtk/channel-base.c b/gtk/channel-base.c index ec82394..c78580b 100644 --- a/gtk/channel-base.c +++ b/gtk/channel-base.c @@ -52,7 +52,7 @@ void spice_channel_handle_notify(SpiceChannel *channel, spice_msg_in *in) message_str = (char*)notify->message; } - g_debug("%s: channel %s -- %s%s #%u%s%.*s", __FUNCTION__, + SPICE_DEBUG("%s: channel %s -- %s%s #%u%s%.*s", __FUNCTION__, c->name, severity, visibility, notify->what, message_str ? ": " : "", notify->message_len, message_str ? message_str : ""); diff --git a/gtk/channel-cursor.c b/gtk/channel-cursor.c index d00c63b..faf3a06 100644 --- a/gtk/channel-cursor.c +++ b/gtk/channel-cursor.c @@ -169,7 +169,7 @@ static display_cursor *set_cursor(SpiceChannel *channel, SpiceCursor *scursor) display_cursor *cursor; size_t size; - g_debug("%s: type %d, %" PRIx64 ", %dx%d, flags %d, size %d", + SPICE_DEBUG("%s: type %d, %" PRIx64 ", %dx%d, flags %d, size %d", __FUNCTION__, hdr->type, hdr->unique, hdr->width, hdr->height, scursor->flags, scursor->data_size); diff --git a/gtk/channel-inputs.c b/gtk/channel-inputs.c index 13b3bab..5a5a7d5 100644 --- a/gtk/channel-inputs.c +++ b/gtk/channel-inputs.c @@ -133,7 +133,7 @@ static void send_position(SpiceInputsChannel *channel) if (c->dpy == -1) return; - g_debug("%s: +%d+%d", __FUNCTION__, c->x, c->y); + SPICE_DEBUG("%s: +%d+%d", __FUNCTION__, c->x, c->y); position.buttons_state = c->bs; position.x = c->x; position.y = c->y; @@ -290,7 +290,7 @@ void spice_inputs_key_press(SpiceInputsChannel *channel, guint scancode) SpiceMsgcKeyDown down; spice_msg_out *msg; - g_debug("%s: scancode %d", __FUNCTION__, scancode); + SPICE_DEBUG("%s: scancode %d", __FUNCTION__, scancode); if (scancode < 0x100) { down.code = scancode; } else { @@ -309,7 +309,7 @@ void spice_inputs_key_release(SpiceInputsChannel *channel, guint scancode) SpiceMsgcKeyUp up; spice_msg_out *msg; - g_debug("%s: scancode %d", __FUNCTION__, scancode); + SPICE_DEBUG("%s: scancode %d", __FUNCTION__, scancode); if (scancode < 0x100) { up.code = scancode | 0x80; } else { diff --git a/gtk/channel-main.c b/gtk/channel-main.c index b86689a..5be8137 100644 --- a/gtk/channel-main.c +++ b/gtk/channel-main.c @@ -368,7 +368,7 @@ static void main_handle_init(SpiceChannel *channel, spice_msg_in *in) static void main_handle_mm_time(SpiceChannel *channel, spice_msg_in *in) { - g_debug("%s: TODO", __FUNCTION__); + SPICE_DEBUG("%s: TODO", __FUNCTION__); #if 0 set_mm_time(init->multi_media_time); #endif diff --git a/gtk/channel-playback.c b/gtk/channel-playback.c index 368ad70..d5d9b1f 100644 --- a/gtk/channel-playback.c +++ b/gtk/channel-playback.c @@ -91,7 +91,7 @@ static void playback_handle_data(SpiceChannel *channel, spice_msg_in *in) spice_playback_channel *c = SPICE_PLAYBACK_CHANNEL(channel)->priv; SpiceMsgPlaybackPacket *data = spice_msg_in_parsed(in); - g_debug("%s: time %d data %p size %d", __FUNCTION__, + SPICE_DEBUG("%s: time %d data %p size %d", __FUNCTION__, data->time, data->data, data->data_size); switch (c->mode) { @@ -110,7 +110,7 @@ static void playback_handle_mode(SpiceChannel *channel, spice_msg_in *in) spice_playback_channel *c = SPICE_PLAYBACK_CHANNEL(channel)->priv; SpiceMsgPlaybackMode *mode = spice_msg_in_parsed(in); - g_debug("%s: time %d mode %d data %p size %d", __FUNCTION__, + SPICE_DEBUG("%s: time %d mode %d data %p size %d", __FUNCTION__, mode->time, mode->mode, mode->data, mode->data_size); c->mode = mode->mode; @@ -128,7 +128,7 @@ static void playback_handle_start(SpiceChannel *channel, spice_msg_in *in) spice_playback_channel *c = SPICE_PLAYBACK_CHANNEL(channel)->priv; SpiceMsgPlaybackStart *start = spice_msg_in_parsed(in); - g_debug("%s: fmt %d channels %d freq %d time %d", __FUNCTION__, + SPICE_DEBUG("%s: fmt %d channels %d freq %d time %d", __FUNCTION__, start->format, start->channels, start->frequency, start->time); switch (c->mode) { diff --git a/gtk/channel-record.c b/gtk/channel-record.c index 4d3afa7..a70d996 100644 --- a/gtk/channel-record.c +++ b/gtk/channel-record.c @@ -79,7 +79,7 @@ static void record_handle_start(SpiceChannel *channel, spice_msg_in *in) spice_record_channel *c = SPICE_RECORD_CHANNEL(channel)->priv; SpiceMsgRecordStart *start = spice_msg_in_parsed(in); - g_debug("%s: fmt %d channels %d freq %d", __FUNCTION__, + SPICE_DEBUG("%s: fmt %d channels %d freq %d", __FUNCTION__, start->format, start->channels, start->frequency); switch (c->mode) { diff --git a/gtk/decode-glz.c b/gtk/decode-glz.c index 1370658..5c62617 100644 --- a/gtk/decode-glz.c +++ b/gtk/decode-glz.c @@ -4,6 +4,7 @@ #include <glib.h> +#include "spice-util.h" #include "decode.h" /* spice/common */ @@ -310,7 +311,7 @@ static void decode_header(GlibGlzDecoder *d) d->image.id = decode_64(d); d->image.win_head_dist = decode_32(d); - g_debug("%s: %dx%d, id %" PRId64 ", ref %" PRId64, + SPICE_DEBUG("%s: %dx%d, id %" PRId64 ", ref %" PRId64, __FUNCTION__, d->image.width, d->image.height, d->image.id, d->image.id - d->image.win_head_dist); diff --git a/gtk/snappy.c b/gtk/snappy.c index 0f0dcd1..0d7042c 100644 --- a/gtk/snappy.c +++ b/gtk/snappy.c @@ -19,7 +19,7 @@ static void primary_create(SpiceChannel *channel, gint format, gint width, gint height, gint stride, gint shmid, gpointer imgdata, gpointer data) { - g_debug("%s: %dx%d, format %d", __FUNCTION__, width, height, format); + SPICE_DEBUG("%s: %dx%d, format %d", __FUNCTION__, width, height, format); d_format = format; d_width = width; d_height = height; diff --git a/gtk/spice-channel-cache.h b/gtk/spice-channel-cache.h index 2c10c43..176b806 100644 --- a/gtk/spice-channel-cache.h +++ b/gtk/spice-channel-cache.h @@ -64,7 +64,7 @@ static inline display_cache_item *cache_find(display_cache *cache, uint64_t id) } } - g_debug("%s: %s %" PRIx64 " [not found]", __FUNCTION__, + SPICE_DEBUG("%s: %s %" PRIx64 " [not found]", __FUNCTION__, cache->name, id); return NULL; } @@ -80,14 +80,14 @@ static inline display_cache_item *cache_add(display_cache *cache, uint64_t id) ring_add(&cache->lru, &item->lru_link); cache->nitems++; - g_debug("%s: %s %" PRIx64 " (%d)", __FUNCTION__, + SPICE_DEBUG("%s: %s %" PRIx64 " (%d)", __FUNCTION__, cache->name, id, cache->nitems); return item; } static inline void cache_del(display_cache *cache, display_cache_item *item) { - g_debug("%s: %s %" PRIx64, __FUNCTION__, + SPICE_DEBUG("%s: %s %" PRIx64, __FUNCTION__, cache->name, item->id); ring_remove(&item->hash_link); ring_remove(&item->lru_link); diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c index ac15034..779a0ca 100644 --- a/gtk/spice-channel.c +++ b/gtk/spice-channel.c @@ -875,7 +875,7 @@ reconnect: c->tls = true; goto reconnect; } - g_debug("Connect error"); + SPICE_DEBUG("Connect error"); spice_channel_emit_event(channel, SPICE_CHANNEL_ERROR_CONNECT); return false; } diff --git a/gtk/spice-client-gtk.defs b/gtk/spice-client-gtk.defs index 8c0eb18..6f791c0 100644 --- a/gtk/spice-client-gtk.defs +++ b/gtk/spice-client-gtk.defs @@ -322,6 +322,28 @@ +;; From spice-util.h + +(define-function spice_util_set_debug + (c-name "spice_util_set_debug") + (return-type "none") + (parameters + '("gboolean" "enabled") + ) +) + +(define-function spice_util_get_debug + (c-name "spice_util_get_debug") + (return-type "gboolean") +) + +(define-function spice_util_get_version_string + (c-name "spice_util_get_version_string") + (return-type "const-gchar*") +) + + + ;; From channel-main.h (define-function spice_main_channel_get_type diff --git a/gtk/spice-client-gtk.override b/gtk/spice-client-gtk.override index 08f1d7b..303c06a 100644 --- a/gtk/spice-client-gtk.override +++ b/gtk/spice-client-gtk.override @@ -2,6 +2,7 @@ headers #include <Python.h> #include "pygobject.h" +#include "spice-common.h" #include "spice-widget.h" %% modulename spice_client_gtk diff --git a/gtk/spice-common.h b/gtk/spice-common.h index 9affd24..3e01d2a 100644 --- a/gtk/spice-common.h +++ b/gtk/spice-common.h @@ -12,3 +12,4 @@ #include "messages.h" #include "marshaller.h" +#include "spice-util.h" diff --git a/gtk/spice-pulse.c b/gtk/spice-pulse.c index e36335d..7ab791e 100644 --- a/gtk/spice-pulse.c +++ b/gtk/spice-pulse.c @@ -159,12 +159,12 @@ static void playback_stop(SpicePlaybackChannel *channel, gpointer data) static void record_start(SpicePlaybackChannel *channel, gint format, gint channels, gint frequency, gpointer data) { - g_debug("%s", __FUNCTION__); + SPICE_DEBUG("%s", __FUNCTION__); } static void record_stop(SpicePlaybackChannel *channel, gpointer data) { - g_debug("%s", __FUNCTION__); + SPICE_DEBUG("%s", __FUNCTION__); } static void channel_new(SpiceSession *s, SpiceChannel *channel, gpointer data) diff --git a/gtk/spice-util.c b/gtk/spice-util.c new file mode 100644 index 0000000..c8d959c --- /dev/null +++ b/gtk/spice-util.c @@ -0,0 +1,20 @@ +#include <config.h> + +#include "spice-util.h" + +static gboolean debugFlag = FALSE; + +void spice_util_set_debug(gboolean enabled) +{ + debugFlag = enabled; +} + +gboolean spice_util_get_debug(void) +{ + return debugFlag || g_getenv("SPICE_DEBUG") != NULL; +} + +const gchar *spice_util_get_version_string(void) +{ + return VERSION; +} diff --git a/gtk/spice-util.h b/gtk/spice-util.h new file mode 100644 index 0000000..aaf16c7 --- /dev/null +++ b/gtk/spice-util.h @@ -0,0 +1,20 @@ +#ifndef SPICE_UTIL_H +#define SPICE_UTIL_H + +#include <glib.h> + +G_BEGIN_DECLS + +void spice_util_set_debug(gboolean enabled); +gboolean spice_util_get_debug(void); +const gchar *spice_util_get_version_string(void); + +#define SPICE_DEBUG(fmt, ...) \ + do { \ + if (G_UNLIKELY(spice_util_get_debug())) \ + g_debug(__FILE__ " " fmt, ## __VA_ARGS__); \ + } while (0) + +G_END_DECLS + +#endif /* SPICE_UTIL_H */ diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c index 4024265..909cc07 100644 --- a/gtk/spice-widget.c +++ b/gtk/spice-widget.c @@ -234,7 +234,7 @@ static void spice_display_finalize(GObject *obj) SpiceDisplay *display = SPICE_DISPLAY(obj); spice_display *d = SPICE_DISPLAY_GET_PRIVATE(display); - g_debug("Finalize SpiceDisplay"); + SPICE_DEBUG("Finalize SpiceDisplay"); if (d->grabseq) { vnc_grab_sequence_free(d->grabseq); @@ -343,7 +343,7 @@ static void try_keyboard_grab(GtkWidget *widget) } #endif - g_debug("grab keyboard"); + SPICE_DEBUG("grab keyboard"); status = gdk_keyboard_grab(gtk_widget_get_window(widget), FALSE, GDK_CURRENT_TIME); @@ -365,7 +365,7 @@ static void try_keyboard_ungrab(GtkWidget *widget) if (!d->keyboard_grab_active) return; - g_debug("ungrab keyboard"); + SPICE_DEBUG("ungrab keyboard"); gdk_keyboard_ungrab(GDK_CURRENT_TIME); d->keyboard_grab_active = false; g_signal_emit(widget, signals[SPICE_DISPLAY_KEYBOARD_GRAB], 0, false); @@ -497,7 +497,7 @@ static void recalc_geometry(GtkWidget *widget) if (d->wh > d->height) d->my = (d->wh - d->height) / 2; - g_debug("%s: guest %dx%d, window %dx%d, offset +%d+%d", __FUNCTION__, + SPICE_DEBUG("%s: guest %dx%d, window %dx%d, offset +%d+%d", __FUNCTION__, d->width, d->height, d->ww, d->wh, d->mx, d->my); if (d->resize_guest_enable) { spice_main_set_display(d->main, d->channel_id, @@ -636,7 +636,7 @@ static gboolean expose_event(GtkWidget *widget, GdkEventExpose *expose) spice_display *d = SPICE_DISPLAY_GET_PRIVATE(display); GdkDrawable *window = gtk_widget_get_window(widget); - g_debug("%s: area %dx%d at %d,%d", __FUNCTION__, + SPICE_DEBUG("%s: area %dx%d at %d,%d", __FUNCTION__, expose->area.width, expose->area.height, expose->area.x, @@ -773,7 +773,7 @@ static gboolean key_event(GtkWidget *widget, GdkEventKey *key) spice_display *d = SPICE_DISPLAY_GET_PRIVATE(display); int scancode; - g_debug("%s %s: keycode: %d state: %d group %d", + SPICE_DEBUG("%s %s: keycode: %d state: %d group %d", __FUNCTION__, key->type == GDK_KEY_PRESS ? "press" : "release", key->hardware_keycode, key->state, key->group); @@ -833,7 +833,7 @@ void spice_display_send_keys(SpiceDisplay *display, const guint *keyvals, g_return_if_fail(display != NULL); g_return_if_fail(keyvals != NULL); - g_debug("%s", __FUNCTION__); + SPICE_DEBUG("%s", __FUNCTION__); if (kind & SPICE_DISPLAY_KEY_EVENT_PRESS) { for (i = 0 ; i < nkeyvals ; i++) @@ -851,7 +851,7 @@ static gboolean enter_event(GtkWidget *widget, GdkEventCrossing *crossing G_GNUC SpiceDisplay *display = SPICE_DISPLAY(widget); spice_display *d = SPICE_DISPLAY_GET_PRIVATE(display); - g_debug("%s", __FUNCTION__); + SPICE_DEBUG("%s", __FUNCTION__); d->mouse_have_pointer = true; try_keyboard_grab(widget); return true; @@ -862,7 +862,7 @@ static gboolean leave_event(GtkWidget *widget, GdkEventCrossing *crossing G_GNUC SpiceDisplay *display = SPICE_DISPLAY(widget); spice_display *d = SPICE_DISPLAY_GET_PRIVATE(display); - g_debug("%s", __FUNCTION__); + SPICE_DEBUG("%s", __FUNCTION__); d->mouse_have_pointer = false; try_keyboard_ungrab(widget); return true; @@ -873,7 +873,7 @@ static gboolean focus_in_event(GtkWidget *widget, GdkEventFocus *focus G_GNUC_UN SpiceDisplay *display = SPICE_DISPLAY(widget); spice_display *d = SPICE_DISPLAY_GET_PRIVATE(display); - g_debug("%s", __FUNCTION__); + SPICE_DEBUG("%s", __FUNCTION__); release_keys(display); d->keyboard_have_focus = true; try_keyboard_grab(widget); @@ -885,7 +885,7 @@ static gboolean focus_out_event(GtkWidget *widget, GdkEventFocus *focus G_GNUC_U SpiceDisplay *display = SPICE_DISPLAY(widget); spice_display *d = SPICE_DISPLAY_GET_PRIVATE(display); - g_debug("%s", __FUNCTION__); + SPICE_DEBUG("%s", __FUNCTION__); d->keyboard_have_focus = false; try_keyboard_ungrab(widget); return true; @@ -964,7 +964,7 @@ static gboolean button_event(GtkWidget *widget, GdkEventButton *button) SpiceDisplay *display = SPICE_DISPLAY(widget); spice_display *d = SPICE_DISPLAY_GET_PRIVATE(display); - g_debug("%s %s: button %d, state 0x%x", __FUNCTION__, + SPICE_DEBUG("%s %s: button %d, state 0x%x", __FUNCTION__, button->type == GDK_BUTTON_PRESS ? "press" : "release", button->button, button->state); @@ -1040,9 +1040,9 @@ static void clipboard_get_targets(GtkClipboard *clipboard, char *name; int a, m, t; - g_debug("%s:", __FUNCTION__); + SPICE_DEBUG("%s:", __FUNCTION__); for (a = 0; a < n_atoms; a++) { - g_debug(" \"%s\"", gdk_atom_name(atoms[a])); + SPICE_DEBUG(" \"%s\"", gdk_atom_name(atoms[a])); } memset(types, 0, sizeof(types)); @@ -1314,7 +1314,7 @@ static void cursor_move(SpiceCursorChannel *channel, gint x, gint y, gpointer da GdkScreen *screen = gdk_drawable_get_screen(drawable); int wx, wy; - g_debug("%s: +%d+%d", __FUNCTION__, x, y); + SPICE_DEBUG("%s: +%d+%d", __FUNCTION__, x, y); d->mouse_guest_x = x; d->mouse_guest_y = y; d->mouse_last_x = x; diff --git a/gtk/spicy.c b/gtk/spicy.c index e64a87e..e826b6a 100644 --- a/gtk/spicy.c +++ b/gtk/spicy.c @@ -136,7 +136,7 @@ static int connect_dialog(GtkWidget *parent, SpiceSession *session) we[i] = gtk_entry_new(); gtk_table_attach_defaults(table, we[i], 1, 2, i, i+1); g_object_get(session, entries[i].prop, &txt, NULL); - g_debug("%s: #%i [%s]: \"%s\"", + SPICE_DEBUG("%s: #%i [%s]: \"%s\"", __FUNCTION__, i, entries[i].prop, txt); if (txt) { gtk_entry_set_text(GTK_ENTRY(we[i]), txt); @@ -230,7 +230,7 @@ static void menu_cb_bool_prop(GtkToggleAction *action, gpointer data) struct spice_window *win = data; gboolean state = gtk_toggle_action_get_active(action); - g_debug("%s: %s = %s", __FUNCTION__, + SPICE_DEBUG("%s: %s = %s", __FUNCTION__, gtk_action_get_name(GTK_ACTION(action)), state ? "yes" : "no"); g_object_set(G_OBJECT(win->spice), gtk_action_get_name(GTK_ACTION(action)), state, @@ -552,7 +552,7 @@ static spice_window *create_spice_window(spice_connection *conn, int id) static void destroy_spice_window(spice_window *win) { - g_debug("destroy window (#%d)", win->id); + SPICE_DEBUG("destroy window (#%d)", win->id); gtk_widget_destroy(win->toplevel); #if 0 /* FIXME: triggers gobject warning */ g_object_unref(win->ag); @@ -577,7 +577,7 @@ static void recent_add(SpiceSession *session) char *host, *uri; g_object_get(session, "uri", &uri, "host", &host, NULL); - g_debug("%s: %s", __FUNCTION__, uri); + SPICE_DEBUG("%s: %s", __FUNCTION__, uri); snprintf(name, sizeof(name), "%s (spice)", host); recent = gtk_recent_manager_get_default(); @@ -684,7 +684,7 @@ static void channel_new(SpiceSession *s, SpiceChannel *channel, gpointer data) conn->channels++; if (SPICE_IS_MAIN_CHANNEL(channel)) { - g_debug("new main channel"); + SPICE_DEBUG("new main channel"); g_signal_connect(channel, "channel-event", G_CALLBACK(main_channel_event), conn); g_signal_connect(channel, "main-mouse-update", @@ -700,12 +700,12 @@ static void channel_new(SpiceSession *s, SpiceChannel *channel, gpointer data) return; if (conn->wins[id] != NULL) return; - g_debug("new display channel (#%d)", id); + SPICE_DEBUG("new display channel (#%d)", id); conn->wins[id] = create_spice_window(conn, id); } if (SPICE_IS_INPUTS_CHANNEL(channel)) { - g_debug("new inputs channel"); + SPICE_DEBUG("new inputs channel"); g_signal_connect(channel, "inputs-modifiers", G_CALLBACK(inputs_modifiers), conn); } @@ -713,7 +713,7 @@ static void channel_new(SpiceSession *s, SpiceChannel *channel, gpointer data) if (SPICE_IS_PLAYBACK_CHANNEL(channel)) { if (conn->audio != NULL) return; - g_debug("new audio channel"); + SPICE_DEBUG("new audio channel"); conn->audio = spice_audio_new(s, mainloop, "spice"); } } @@ -725,7 +725,7 @@ static void channel_destroy(SpiceSession *s, SpiceChannel *channel, gpointer dat g_object_get(channel, "channel-id", &id, NULL); if (SPICE_IS_MAIN_CHANNEL(channel)) { - g_debug("zap main channel"); + SPICE_DEBUG("zap main channel"); } if (SPICE_IS_DISPLAY_CHANNEL(channel)) { @@ -733,7 +733,7 @@ static void channel_destroy(SpiceSession *s, SpiceChannel *channel, gpointer dat return; if (conn->wins[id] == NULL) return; - g_debug("zap display channel (#%d)", id); + SPICE_DEBUG("zap display channel (#%d)", id); destroy_spice_window(conn->wins[id]); conn->wins[id] = NULL; } @@ -741,7 +741,7 @@ static void channel_destroy(SpiceSession *s, SpiceChannel *channel, gpointer dat if (SPICE_IS_PLAYBACK_CHANNEL(channel)) { if (conn->audio == NULL) return; - g_debug("zap audio channel"); + SPICE_DEBUG("zap audio channel"); /* TODO: zap audio */ } @@ -764,7 +764,7 @@ static spice_connection *connection_new(void) g_signal_connect(conn->session, "channel-destroy", G_CALLBACK(channel_destroy), conn); connections++; - g_debug("%s (%d)", __FUNCTION__, connections); + SPICE_DEBUG("%s (%d)", __FUNCTION__, connections); return conn; } @@ -788,7 +788,7 @@ static void connection_destroy(spice_connection *conn) free(conn); connections--; - g_debug("%s (%d)", __FUNCTION__, connections); + SPICE_DEBUG("%s (%d)", __FUNCTION__, connections); if (connections > 0) { return; } @@ -26,6 +26,7 @@ #include <fcntl.h> #include <glib.h> +#include "spice-util.h" #include "tcp.h" int tcp_verbose; @@ -58,7 +59,7 @@ int tcp_connect(struct addrinfo *ai, ai->ai_flags = AI_CANONNAME; if (0 != (rc = getaddrinfo(host, serv, ai, &res))) { if (tcp_verbose) - g_debug("getaddrinfo (peer): %s", gai_strerror(rc)); + SPICE_DEBUG("getaddrinfo (peer): %s", gai_strerror(rc)); return -1; } for (e = res; e != NULL; e = e->ai_next) { @@ -66,13 +67,13 @@ int tcp_connect(struct addrinfo *ai, uhost, INET6_ADDRSTRLEN, userv, 32, NI_NUMERICHOST | NI_NUMERICSERV)) { if (tcp_verbose) - g_debug("getnameinfo (peer): oops"); + SPICE_DEBUG("getnameinfo (peer): oops"); continue; } if (-1 == (sock = socket(e->ai_family, e->ai_socktype, e->ai_protocol))) { if (tcp_verbose) - g_debug("socket (%s): %s", + SPICE_DEBUG("socket (%s): %s", strfamily(e->ai_family), strerror(errno)); continue; } @@ -85,7 +86,7 @@ int tcp_connect(struct addrinfo *ai, ask.ai_socktype = e->ai_socktype; if (0 != (rc = getaddrinfo(addr, port, &ask, &lres))) { if (tcp_verbose) - g_debug("getaddrinfo (local): %s", + SPICE_DEBUG("getaddrinfo (local): %s", gai_strerror(rc)); continue; } @@ -94,12 +95,12 @@ int tcp_connect(struct addrinfo *ai, uaddr, INET6_ADDRSTRLEN, uport, 32, NI_NUMERICHOST | NI_NUMERICSERV)) { if (tcp_verbose) - g_debug("getnameinfo (local): oops"); + SPICE_DEBUG("getnameinfo (local): oops"); continue; } if (-1 == bind(sock, lres->ai_addr, lres->ai_addrlen)) { if (tcp_verbose) - g_debug("%s [%s] %s bind: %s", + SPICE_DEBUG("%s [%s] %s bind: %s", strfamily(lres->ai_family), uaddr, uport, strerror(errno)); continue; @@ -108,14 +109,14 @@ int tcp_connect(struct addrinfo *ai, /* connect to peer */ if (-1 == connect(sock, e->ai_addr, e->ai_addrlen)) { if (tcp_verbose) - g_debug("%s %s [%s] %s connect: %s", + SPICE_DEBUG("%s %s [%s] %s connect: %s", strfamily(e->ai_family), e->ai_canonname, uhost, userv, strerror(errno)); close(sock); continue; } if (tcp_verbose) - g_debug("%s %s [%s] %s open", + SPICE_DEBUG("%s %s [%s] %s open", strfamily(e->ai_family), e->ai_canonname, uhost, userv); fcntl(sock, F_SETFL, O_NONBLOCK); return sock; @@ -134,7 +135,7 @@ int tcp_listen(struct addrinfo *ai, char *addr, char *port) ai->ai_flags = AI_PASSIVE; if (0 != (rc = getaddrinfo(addr, port, ai, &res))) { if (tcp_verbose) - g_debug("getaddrinfo: %s", gai_strerror(rc)); + SPICE_DEBUG("getaddrinfo: %s", gai_strerror(rc)); exit(1); } @@ -146,7 +147,7 @@ int tcp_listen(struct addrinfo *ai, char *addr, char *port) if (-1 == (slisten = socket(e->ai_family, e->ai_socktype, e->ai_protocol))) { if (tcp_verbose) - g_debug("socket (%s): %s", + SPICE_DEBUG("socket (%s): %s", strfamily(e->ai_family), strerror(errno)); continue; } @@ -154,7 +155,7 @@ int tcp_listen(struct addrinfo *ai, char *addr, char *port) setsockopt(slisten, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)); if (-1 == bind(slisten, e->ai_addr, e->ai_addrlen)) { if (tcp_verbose) - g_debug("%s [%s] %s bind: %s", + SPICE_DEBUG("%s [%s] %s bind: %s", strfamily(e->ai_family), uaddr, uport, strerror(errno)); continue; diff --git a/gtk/vncdisplaykeymap.c b/gtk/vncdisplaykeymap.c index 32dddff..1fde6ca 100644 --- a/gtk/vncdisplaykeymap.c +++ b/gtk/vncdisplaykeymap.c @@ -12,9 +12,11 @@ #include <gdk/gdkkeysyms.h> #include "vncdisplaykeymap.h" +#include "spice-util.h" + #undef G_LOG_DOMAIN #define G_LOG_DOMAIN "vnc-keymap" -#define VNC_DEBUG(message) g_debug(message); +#define VNC_DEBUG(message) SPICE_DEBUG(message); /* * This table is taken from QEMU x_keymap.c, under the terms: |