[Spice-devel] [PATCH spice-gtk v3 3/4] gtk-session: move atom's debug

Victor Toso victortoso at redhat.com
Mon May 22 18:08:39 UTC 2017


From: Victor Toso <me at victortoso.com>

We already iterate in all n_atoms and get its name with
gdk_atom_name(), let's move the debug there too;

While at it, move the generic SPICE_DEBUG of the function to the top.
It should help us identify when the function was triggered but not
used due the early returns.

Signed-off-by: Victor Toso <victortoso at redhat.com>
Acked-by: Pavel Grunt <pgrunt at redhat.com>
Signed-off-by: Victor Toso <me at victortoso.com>
---
 src/spice-gtk-session.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index 5f052ed..a3b34db 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -604,6 +604,8 @@ static void clipboard_get_targets(GtkClipboard *clipboard,
 {
     SpiceGtkSession *self = free_weak_ref(user_data);
 
+    SPICE_DEBUG("%s:", __FUNCTION__);
+
     if (self == NULL)
         return;
 
@@ -627,15 +629,6 @@ static void clipboard_get_targets(GtkClipboard *clipboard,
     selection = get_selection_from_clipboard(s, clipboard);
     g_return_if_fail(selection != -1);
 
-    SPICE_DEBUG("%s:", __FUNCTION__);
-    if (spice_util_get_debug()) {
-        for (a = 0; a < n_atoms; a++) {
-            name = gdk_atom_name(atoms[a]);
-            SPICE_DEBUG(" \"%s\"", name);
-            g_free(name);
-        }
-    }
-
     if (s->clip_grabbed[selection]) {
         SPICE_DEBUG("Clipboard is already grabbed, ignoring %d atoms", n_atoms);
         return;
@@ -645,6 +638,9 @@ static void clipboard_get_targets(GtkClipboard *clipboard,
     num_types = 0;
     for (a = 0; a < n_atoms; a++) {
         name = gdk_atom_name(atoms[a]);
+
+        SPICE_DEBUG(" \"%s\"", name);
+
         for (m = 0; m < SPICE_N_ELEMENTS(atom2agent); m++) {
             if (strcasecmp(name, atom2agent[m].xatom) != 0) {
                 continue;
-- 
2.13.0



More information about the Spice-devel mailing list