Don't use g_print for debug output

The g_print documentation explicitly says not to do this, since
g_print is meant to be redirected by applications. Instead use
g_message for logging that can be triggered via GTK_DEBUG.
This commit is contained in:
Matthias Clasen 2016-02-28 15:33:18 -05:00
parent 0ac71e81cf
commit 2ee7fb1818
11 changed files with 154 additions and 132 deletions

View File

@ -715,7 +715,7 @@ gtk_tray_icon_manager_filter (GdkXEvent *xevent,
xev->xclient.data.l[1] == icon->priv->selection_atom)
{
GTK_NOTE (PLUGSOCKET,
g_print ("GtkStatusIcon %p: tray manager appeared\n", icon));
g_message ("GtkStatusIcon %p: tray manager appeared", icon));
gtk_tray_icon_update_manager_window (icon);
}
@ -725,7 +725,7 @@ gtk_tray_icon_manager_filter (GdkXEvent *xevent,
xev->xproperty.atom == icon->priv->orientation_atom)
{
GTK_NOTE (PLUGSOCKET,
g_print ("GtkStatusIcon %p: got PropertyNotify on manager window for orientation atom\n", icon));
g_message ("GtkStatusIcon %p: got PropertyNotify on manager window for orientation atom", icon));
gtk_tray_icon_get_orientation_property (icon);
}
@ -733,7 +733,7 @@ gtk_tray_icon_manager_filter (GdkXEvent *xevent,
xev->xproperty.atom == icon->priv->colors_atom)
{
GTK_NOTE (PLUGSOCKET,
g_print ("GtkStatusIcon %p: got PropertyNotify on manager window for colors atom\n", icon));
g_message ("GtkStatusIcon %p: got PropertyNotify on manager window for colors atom", icon));
gtk_tray_icon_get_colors_property (icon);
}
@ -750,14 +750,14 @@ gtk_tray_icon_manager_filter (GdkXEvent *xevent,
else if (xev->xany.type == DestroyNotify)
{
GTK_NOTE (PLUGSOCKET,
g_print ("GtkStatusIcon %p: got DestroyNotify for manager window\n", icon));
g_message ("GtkStatusIcon %p: got DestroyNotify for manager window", icon));
gtk_tray_icon_manager_window_destroyed (icon);
}
else
{
GTK_NOTE (PLUGSOCKET,
g_print ("GtkStatusIcon %p: got other message on manager window\n", icon));
g_message ("GtkStatusIcon %p: got other message on manager window", icon));
}
}
@ -801,8 +801,8 @@ static void
gtk_tray_icon_send_dock_request (GtkTrayIcon *icon)
{
GTK_NOTE (PLUGSOCKET,
g_print ("GtkStatusIcon %p: sending dock request to manager window %lx\n",
icon, (gulong) icon->priv->manager_window));
g_message ("GtkStatusIcon %p: sending dock request to manager window %lx",
icon, (gulong) icon->priv->manager_window));
gtk_tray_icon_send_manager_message (icon,
SYSTEM_TRAY_REQUEST_DOCK,
@ -820,14 +820,14 @@ gtk_tray_icon_update_manager_window (GtkTrayIcon *icon)
Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
GTK_NOTE (PLUGSOCKET,
g_print ("GtkStatusIcon %p: updating tray icon manager window, current manager window: %lx\n",
icon, (gulong) icon->priv->manager_window));
g_message ("GtkStatusIcon %p: updating tray icon manager window, current manager window: %lx",
icon, (gulong) icon->priv->manager_window));
if (icon->priv->manager_window != None)
return;
GTK_NOTE (PLUGSOCKET,
g_print ("GtkStatusIcon %p: trying to find manager window\n", icon));
g_message ("GtkStatusIcon %p: trying to find manager window", icon));
XGrabServer (xdisplay);
@ -846,8 +846,8 @@ gtk_tray_icon_update_manager_window (GtkTrayIcon *icon)
GdkWindow *gdkwin;
GTK_NOTE (PLUGSOCKET,
g_print ("GtkStatusIcon %p: is being managed by window %lx\n",
icon, (gulong) icon->priv->manager_window));
g_message ("GtkStatusIcon %p: is being managed by window %lx",
icon, (gulong) icon->priv->manager_window));
gdkwin = gdk_x11_window_lookup_for_display (display,
icon->priv->manager_window);
@ -883,7 +883,7 @@ gtk_tray_icon_update_manager_window (GtkTrayIcon *icon)
else
{
GTK_NOTE (PLUGSOCKET,
g_print ("GtkStatusIcon %p: no tray manager found\n", icon));
g_message ("GtkStatusIcon %p: no tray manager found", icon));
}
}
@ -893,7 +893,7 @@ gtk_tray_icon_manager_window_destroyed (GtkTrayIcon *icon)
g_return_if_fail (icon->priv->manager_window != None);
GTK_NOTE (PLUGSOCKET,
g_print ("GtkStatusIcon %p: tray manager window destroyed\n", icon));
g_message ("GtkStatusIcon %p: tray manager window destroyed", icon));
gtk_tray_icon_clear_manager_window (icon);
}
@ -902,13 +902,9 @@ static gboolean
gtk_tray_icon_delete (GtkWidget *widget,
GdkEventAny *event)
{
#ifdef G_ENABLE_DEBUG
GtkTrayIcon *icon = GTK_TRAY_ICON (widget);
#endif
GTK_NOTE (PLUGSOCKET,
g_print ("GtkStatusIcon %p: delete notify, tray manager window %lx\n",
icon, (gulong) icon->priv->manager_window));
g_message ("GtkStatusIcon %p: delete notify, tray manager window %lx",
widget, (gulong) GTK_TRAY_ICON (widget)->priv->manager_window));
/* A bug in X server versions up to x.org 1.5.0 means that:
* XFixesChangeSaveSet(...., SaveSetRoot, SaveSetUnmap) doesn't work properly
@ -966,11 +962,12 @@ gtk_tray_icon_realize (GtkWidget *widget)
}
GTK_NOTE (PLUGSOCKET,
g_print ("GtkStatusIcon %p: realized, window: %lx, socket window: %lx\n",
widget,
(gulong) GDK_WINDOW_XID (window),
gtk_plug_get_socket_window (GTK_PLUG (icon)) ?
(gulong) GDK_WINDOW_XID (gtk_plug_get_socket_window (GTK_PLUG (icon))) : 0UL));
g_message ("GtkStatusIcon %p: realized, window: %lx, socket window: %lx",
widget,
(gulong) GDK_WINDOW_XID (window),
gtk_plug_get_socket_window (GTK_PLUG (icon))
? (gulong) GDK_WINDOW_XID (gtk_plug_get_socket_window (GTK_PLUG (icon)))
: 0UL));
if (icon->priv->manager_window != None)
gtk_tray_icon_send_dock_request (icon);

View File

@ -568,9 +568,8 @@ gtk_builder_get_internal_child (GtkBuilder *builder,
break;
GTK_NOTE (BUILDER,
g_print ("Trying to get internal child %s from %s\n",
childname,
object_get_name (info->object)));
g_message ("Trying to get internal child %s from %s",
childname, object_get_name (info->object)));
if (GTK_IS_BUILDABLE (info->object))
obj = gtk_buildable_get_internal_child (GTK_BUILDABLE (info->object),
@ -731,7 +730,7 @@ _gtk_builder_construct (GtkBuilder *builder,
g_object_ref_sink (obj);
GTK_NOTE (BUILDER,
g_print ("created %s of type %s\n", info->id, g_type_name (info->type)));
g_message ("created %s of type %s", info->id, g_type_name (info->type)));
for (i = 0; i < construct_parameters->len; i++)
{
@ -765,7 +764,7 @@ _gtk_builder_construct (GtkBuilder *builder,
if (GTK_DEBUG_CHECK (BUILDER))
{
gchar *str = g_strdup_value_contents ((const GValue*)&param->value);
g_print ("set %s: %s = %s\n", info->id, param->name, str);
g_message ("set %s: %s = %s", info->id, param->name, str);
g_free (str);
}
#endif
@ -829,7 +828,7 @@ _gtk_builder_apply_properties (GtkBuilder *builder,
if (GTK_DEBUG_CHECK (BUILDER))
{
gchar *str = g_strdup_value_contents ((const GValue*)&param->value);
g_print ("set %s: %s = %s\n", info->id, param->name, str);
g_message ("set %s: %s = %s", info->id, param->name, str);
g_free (str);
}
#endif
@ -869,7 +868,7 @@ _gtk_builder_add (GtkBuilder *builder,
g_assert (GTK_IS_BUILDABLE (parent));
GTK_NOTE (BUILDER,
g_print ("adding %s to %s\n", object_get_name (object), object_get_name (parent)));
g_message ("adding %s to %s", object_get_name (object), object_get_name (parent)));
gtk_buildable_add_child (GTK_BUILDABLE (parent), builder, object,
child_info->type);

View File

@ -318,8 +318,9 @@ parse_object (GMarkupParseContext *context,
{
data->requested_object_level = data->cur_object_level;
GTK_NOTE (BUILDER, g_print ("requested object \"%s\" found at level %d\n",
object_id, data->requested_object_level));
GTK_NOTE (BUILDER,
g_message ("requested object \"%s\" found at level %d",
object_id, data->requested_object_level));
data->inside_requested_object = TRUE;
}
@ -937,7 +938,7 @@ start_element (GMarkupParseContext *context,
g_string_insert_c (tags, 0, ' ');
g_string_truncate (tags, tags->len - 1);
}
g_print ("<%s%s>\n", element_name, tags->str);
g_message ("<%s%s>", element_name, tags->str);
g_string_free (tags, TRUE);
}
#endif
@ -1008,7 +1009,7 @@ end_element (GMarkupParseContext *context,
{
ParserData *data = (ParserData*)user_data;
GTK_NOTE (BUILDER, g_print ("</%s>\n", element_name));
GTK_NOTE (BUILDER, g_message ("</%s>", element_name));
if (data->subparser && data->subparser->start)
{
@ -1060,8 +1061,9 @@ end_element (GMarkupParseContext *context,
if (data->requested_objects && data->inside_requested_object &&
(data->cur_object_level == data->requested_object_level))
{
GTK_NOTE (BUILDER, g_print ("requested object end found at level %d\n",
data->requested_object_level));
GTK_NOTE (BUILDER,
g_message ("requested object end found at level %d",
data->requested_object_level));
data->inside_requested_object = FALSE;
}

View File

@ -691,8 +691,8 @@ gtk_gl_area_draw (GtkWidget *widget,
w = gtk_widget_get_allocated_width (widget) * scale;
h = gtk_widget_get_allocated_height (widget) * scale;
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
if (status == GL_FRAMEBUFFER_COMPLETE_EXT)
status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
if (status == GL_FRAMEBUFFER_COMPLETE_EXT)
{
if (priv->needs_render || priv->auto_render)
{
@ -716,7 +716,7 @@ gtk_gl_area_draw (GtkWidget *widget,
}
else
{
g_print ("fb setup not supported\n");
g_warning ("fb setup not supported");
}
return TRUE;

View File

@ -70,8 +70,7 @@ _gtk_icon_cache_unref (GtkIconCache *cache)
if (cache->ref_count == 0)
{
GTK_NOTE (ICONTHEME,
g_print ("unmapping icon cache\n"));
GTK_NOTE (ICONTHEME, g_message ("unmapping icon cache"));
if (cache->map)
g_mapped_file_unref (cache->map);
@ -93,8 +92,7 @@ _gtk_icon_cache_new_for_path (const gchar *path)
/* Check if we have a cache file */
cache_filename = g_build_filename (path, "icon-theme.cache", NULL);
GTK_NOTE (ICONTHEME,
g_print ("look for cache in %s\n", path));
GTK_NOTE (ICONTHEME, g_message ("look for icon cache in %s", path));
if (g_stat (path, &path_st) < 0)
goto done;
@ -122,7 +120,7 @@ _gtk_icon_cache_new_for_path (const gchar *path)
/* Verify cache is uptodate */
if (st.st_mtime < path_st.st_mtime)
{
GTK_NOTE (ICONTHEME, g_print ("cache outdated\n"));
GTK_NOTE (ICONTHEME, g_message ("icon cache outdated"));
goto done;
}
@ -151,7 +149,7 @@ _gtk_icon_cache_new_for_path (const gchar *path)
}
#endif
GTK_NOTE (ICONTHEME, g_print ("found cache for %s\n", path));
GTK_NOTE (ICONTHEME, g_message ("found icon cache for %s", path));
cache = g_new0 (GtkIconCache, 1);
cache->ref_count = 1;
@ -502,8 +500,7 @@ _gtk_icon_cache_get_icon (GtkIconCache *cache,
if (type != 0)
{
GTK_NOTE (ICONTHEME,
g_print ("invalid pixel data type %u\n", type));
GTK_NOTE (ICONTHEME, g_message ("invalid pixel data type %u", type));
return NULL;
}
@ -514,8 +511,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
(guchar *)(cache->buffer + pixel_data_offset + 8),
&error))
{
GTK_NOTE (ICONTHEME,
g_print ("could not deserialize data: %s\n", error->message));
GTK_NOTE (ICONTHEME, g_message ("could not deserialize data: %s", error->message));
g_error_free (error);
return NULL;
@ -529,8 +525,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
cache);
if (!pixbuf)
{
GTK_NOTE (ICONTHEME,
g_print ("could not convert pixdata to pixbuf: %s\n", error->message));
GTK_NOTE (ICONTHEME, g_message ("could not convert pixdata to pixbuf: %s", error->message));
g_error_free (error);
return NULL;

View File

@ -26,7 +26,7 @@
#define check(name,condition) \
if (!(condition)) \
{ \
VERBOSE(g_print ("bad %s\n", (name))); \
VERBOSE(g_message ("bad %s", (name))); \
return FALSE; \
}

View File

@ -805,8 +805,8 @@ do_theme_change (GtkIconTheme *icon_theme)
if (!priv->themes_valid)
return;
GTK_NOTE (ICONTHEME,
g_print ("change to icon theme \"%s\"\n", priv->current_theme));
GTK_NOTE (ICONTHEME,
g_message ("change to icon theme \"%s\"", priv->current_theme));
blow_themes (icon_theme);
queue_theme_changed (icon_theme);
@ -1423,13 +1423,16 @@ load_themes (GtkIconTheme *icon_theme)
GTK_NOTE (ICONTHEME, {
GList *l;
g_print ("Current icon themes ");
GString *s;
s = g_string_new ("Current icon themes ");
for (l = icon_theme->priv->themes; l; l = l->next)
{
IconTheme *theme = l->data;
g_print ("%s ", theme->name);
g_string_append (s, theme->name);
g_string_append_c (s, ' ');
}
g_print ("\n");
g_message ("%s", s->str);
g_string_free (s, TRUE);
});
}
@ -1706,7 +1709,7 @@ real_choose_icon (GtkIconTheme *icon_theme,
/* This is used in the icontheme unit test */
GTK_NOTE (ICONTHEME,
for (i = 0; icon_names[i]; i++)
g_print ("\tlookup name: %s\n", icon_names[i]));
g_message ("\tlookup name: %s", icon_names[i]));
/* For symbolic icons, do a search in all registered themes first;
* a theme that inherits them from a parent theme might provide
@ -2023,8 +2026,7 @@ gtk_icon_theme_lookup_icon (GtkIconTheme *icon_theme,
g_return_val_if_fail ((flags & GTK_ICON_LOOKUP_NO_SVG) == 0 ||
(flags & GTK_ICON_LOOKUP_FORCE_SVG) == 0, NULL);
GTK_NOTE (ICONTHEME,
g_print ("gtk_icon_theme_lookup_icon %s\n", icon_name));
GTK_NOTE (ICONTHEME, g_message ("looking up icon %s", icon_name));
return gtk_icon_theme_lookup_icon_for_scale (icon_theme, icon_name,
size, 1, flags);
@ -2065,8 +2067,7 @@ gtk_icon_theme_lookup_icon_for_scale (GtkIconTheme *icon_theme,
(flags & GTK_ICON_LOOKUP_FORCE_SVG) == 0, NULL);
g_return_val_if_fail (scale >= 1, NULL);
GTK_NOTE (ICONTHEME,
g_print ("gtk_icon_theme_lookup_icon %s\n", icon_name));
GTK_NOTE (ICONTHEME, g_message ("looking up icon %s for scale %d", icon_name, scale));
if (flags & GTK_ICON_LOOKUP_GENERIC_FALLBACK)
{
@ -2931,8 +2932,7 @@ theme_dir_get_icon_suffix (IconThemeDir *dir,
else
suffix = GPOINTER_TO_UINT (g_hash_table_lookup (dir->icons, icon_name));
GTK_NOTE (ICONTHEME,
g_print ("get_icon_suffix%s %u\n", dir->cache ? " (cached)" : "", suffix));
GTK_NOTE (ICONTHEME, g_message ("get icon suffix%s: %u", dir->cache ? " (cached)" : "", suffix));
return suffix;
}
@ -3040,8 +3040,7 @@ theme_lookup_icon (IconTheme *theme,
{
dir = l->data;
GTK_NOTE (ICONTHEME,
g_print ("theme_lookup_icon dir %s\n", dir->dir));
GTK_NOTE (ICONTHEME, g_message ("look up icon dir %s", dir->dir));
suffix = theme_dir_get_icon_suffix (dir, icon_name, NULL);
if (best_suffix (suffix, allow_svg) != ICON_SUFFIX_NONE)
{
@ -3188,7 +3187,7 @@ scan_directory (GtkIconThemePrivate *icon_theme,
GDir *gdir;
const gchar *name;
GTK_NOTE (ICONTHEME, g_print ("scanning directory %s\n", full_dir));
GTK_NOTE (ICONTHEME, g_message ("scanning directory %s", full_dir));
gdir = g_dir_open (full_dir, 0, NULL);
@ -3226,7 +3225,7 @@ scan_resources (GtkIconThemePrivate *icon_theme,
gint i;
gchar **children;
GTK_NOTE (ICONTHEME, g_print ("scanning resources %s\n", full_dir));
GTK_NOTE (ICONTHEME, g_message ("scanning resources %s", full_dir));
children = g_resources_enumerate_children (full_dir, 0, NULL);
if (!children)
@ -4491,13 +4490,13 @@ gtk_icon_info_load_symbolic_svg (GtkIconInfo *icon_info,
GTK_NOTE (ICONTHEME,
if (icon_info->dir_type == ICON_THEME_DIR_UNTHEMED)
g_print ("Symbolic icon %s is not in an icon theme directory",
icon_info->key.icon_names ? icon_info->key.icon_names[0] : icon_info->filename);
g_message ("Symbolic icon %s is not in an icon theme directory",
icon_info->key.icon_names ? icon_info->key.icon_names[0] : icon_info->filename);
else if (icon_info->dir_size * icon_info->dir_scale != symbolic_size)
g_print ("Symbolic icon %s of size %d is in an icon theme directory of size %d",
icon_info->key.icon_names ? icon_info->key.icon_names[0] : icon_info->filename,
symbolic_size,
icon_info->dir_size * icon_info->dir_scale)
g_message ("Symbolic icon %s of size %d is in an icon theme directory of size %d",
icon_info->key.icon_names ? icon_info->key.icon_names[0] : icon_info->filename,
symbolic_size,
icon_info->dir_size * icon_info->dir_scale)
);
width = g_strdup_printf ("%d", icon_info->symbolic_width);

View File

@ -356,7 +356,7 @@ load_module (GSList *module_list,
}
else
{
GTK_NOTE (MODULES, g_print ("Module already loaded, ignoring: %s\n", name));
GTK_NOTE (MODULES, g_message ("Module already loaded, ignoring: %s", name));
info->names = g_slist_prepend (info->names, g_strdup (name));
info->ref_count++;
/* remove new reference count on module, we already have one */
@ -396,10 +396,10 @@ gtk_module_info_unref (GtkModuleInfo *info)
info->ref_count--;
if (info->ref_count == 0)
if (info->ref_count == 0)
{
GTK_NOTE (MODULES,
g_print ("Unloading module: %s\n", g_module_name (info->module)));
GTK_NOTE (MODULES,
g_message ("Unloading module: %s", g_module_name (info->module)));
gtk_modules = g_slist_remove (gtk_modules, info);
g_module_close (info->module);
@ -417,7 +417,7 @@ load_modules (const char *module_str)
GSList *module_list = NULL;
gint i;
GTK_NOTE (MODULES, g_print ("Loading module list: %s\n", module_str));
GTK_NOTE (MODULES, g_message ("Loading module list: %s", module_str));
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
module_names = pango_split_file_list (module_str);
@ -567,7 +567,7 @@ _gtk_modules_settings_changed (GtkSettings *settings,
{
GSList *new_modules = NULL;
GTK_NOTE (MODULES, g_print ("gtk-modules setting changed to: %s\n", modules));
GTK_NOTE (MODULES, g_message ("gtk-modules setting changed to: %s", modules));
/* load/ref before unreffing existing */
if (modules && modules[0])

View File

@ -38,7 +38,8 @@ static inline void _fixup_total_count (GtkRBTree *tree,
#ifdef G_ENABLE_DEBUG
static void _gtk_rbtree_test (const gchar *where,
GtkRBTree *tree);
static void _gtk_rbtree_debug_spew (GtkRBTree *tree);
static void _gtk_rbtree_debug_spew (GtkRBTree *tree,
GString *s);
#endif
static const GtkRBNode nil = {
@ -433,8 +434,13 @@ _gtk_rbtree_insert_after (GtkRBTree *tree,
#ifdef G_ENABLE_DEBUG
if (GTK_DEBUG_CHECK (TREE))
{
g_print ("\n\n_gtk_rbtree_insert_after: %p\n", current);
_gtk_rbtree_debug_spew (tree);
GString *s;
s = g_string_new ("");
g_string_append_printf (s, "_gtk_rbtree_insert_after: %p\n", current);
_gtk_rbtree_debug_spew (tree, s);
g_message ("%s", s->str);
g_string_free (s, TRUE);
_gtk_rbtree_test (G_STRLOC, tree);
}
#endif
@ -478,9 +484,12 @@ _gtk_rbtree_insert_after (GtkRBTree *tree,
#ifdef G_ENABLE_DEBUG
if (GTK_DEBUG_CHECK (TREE))
{
g_print ("_gtk_rbtree_insert_after finished...\n");
_gtk_rbtree_debug_spew (tree);
g_print ("\n\n");
GString *s;
s = g_string_new ("_gtk_rbtree_insert_after finished...\n");
_gtk_rbtree_debug_spew (tree, s);
g_message ("%s", s->str);
g_string_free (s, TRUE);
_gtk_rbtree_test (G_STRLOC, tree);
}
#endif
@ -500,8 +509,13 @@ _gtk_rbtree_insert_before (GtkRBTree *tree,
#ifdef G_ENABLE_DEBUG
if (GTK_DEBUG_CHECK (TREE))
{
g_print ("\n\n_gtk_rbtree_insert_before: %p\n", current);
_gtk_rbtree_debug_spew (tree);
GString *s;
s = g_string_new ("");
g_string_append_printf (s, "_gtk_rbtree_insert_before: %p\n", current);
_gtk_rbtree_debug_spew (tree, s);
g_message ("%s", s->str);
g_string_free (s, TRUE);
_gtk_rbtree_test (G_STRLOC, tree);
}
#endif
@ -546,9 +560,12 @@ _gtk_rbtree_insert_before (GtkRBTree *tree,
#ifdef G_ENABLE_DEBUG
if (GTK_DEBUG_CHECK (TREE))
{
g_print ("_gtk_rbtree_insert_before finished...\n");
_gtk_rbtree_debug_spew (tree);
g_print ("\n\n");
GString *s;
s = g_string_new ("_gtk_rbtree_insert_before finished...\n");
_gtk_rbtree_debug_spew (tree, s);
g_message ("%s", s->str);
g_string_free (s, TRUE);
_gtk_rbtree_test (G_STRLOC, tree);
}
#endif
@ -1119,8 +1136,13 @@ _gtk_rbtree_remove_node (GtkRBTree *tree,
#ifdef G_ENABLE_DEBUG
if (GTK_DEBUG_CHECK (TREE))
{
g_print ("\n\n_gtk_rbtree_remove_node: %p\n", node);
_gtk_rbtree_debug_spew (tree);
GString *s;
s = g_string_new ("");
g_string_append_printf (s, "_gtk_rbtree_remove_node: %p\n", node);
_gtk_rbtree_debug_spew (tree, s);
g_message ("%s", s->str);
g_string_free (s, TRUE);
_gtk_rbtree_test (G_STRLOC, tree);
}
#endif
@ -1229,9 +1251,12 @@ _gtk_rbtree_remove_node (GtkRBTree *tree,
#ifdef G_ENABLE_DEBUG
if (GTK_DEBUG_CHECK (TREE))
{
g_print ("_gtk_rbtree_remove_node finished...\n");
_gtk_rbtree_debug_spew (tree);
g_print ("\n\n");
GString *s;
s = g_string_new ("_gtk_rbtree_remove_node finished...\n");
_gtk_rbtree_debug_spew (tree, s);
g_message ("%s", s->str);
g_string_free (s, TRUE);
_gtk_rbtree_test (G_STRLOC, tree);
}
#endif
@ -1505,7 +1530,7 @@ count_total (GtkRBTree *tree,
(node->children ? count_total (node->children, node->children->root) : 0);
if (res != node->total_count)
g_print ("total count incorrect for node\n");
g_error ("total count incorrect for node");
if (get_total_count (node) != node->total_count)
g_error ("Node has incorrect total count %u, should be %u", node->total_count, get_total_count (node));
@ -1528,7 +1553,7 @@ _count_nodes (GtkRBTree *tree,
_count_nodes (tree, node->right) + 1);
if (res != node->count)
g_print ("Tree failed\n");
g_error ("Tree failed");
return res;
}
@ -1669,13 +1694,14 @@ _gtk_rbtree_test (const gchar *where,
static void
_gtk_rbtree_debug_spew_helper (GtkRBTree *tree,
GtkRBNode *node,
GString *s,
gint depth)
{
gint i;
for (i = 0; i < depth; i++)
g_print ("\t");
g_string_append (s, "\t");
g_print ("(%p - %s) (Offset %d) (Parity %d) (Validity %d%d%d)\n",
g_string_append_printf (s, "(%p - %s) (Offset %d) (Parity %d) (Validity %d%d%d)\n",
node,
(GTK_RBNODE_GET_COLOR (node) == GTK_RBNODE_BLACK)?"BLACK":" RED ",
node->offset,
@ -1685,28 +1711,28 @@ _gtk_rbtree_debug_spew_helper (GtkRBTree *tree,
(GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_COLUMN_INVALID))?1:0);
if (node->children != NULL)
{
g_print ("Looking at child.\n");
_gtk_rbtree_debug_spew (node->children);
g_print ("Done looking at child.\n");
g_string_append (s, "Looking at child.\n");
_gtk_rbtree_debug_spew (node->children, s);
g_string_append (s, "Done looking at child.\n");
}
if (!_gtk_rbtree_is_nil (node->left))
{
_gtk_rbtree_debug_spew_helper (tree, node->left, depth+1);
_gtk_rbtree_debug_spew_helper (tree, node->left, s, depth + 1);
}
if (!_gtk_rbtree_is_nil (node->right))
{
_gtk_rbtree_debug_spew_helper (tree, node->right, depth+1);
_gtk_rbtree_debug_spew_helper (tree, node->right, s, depth + 1);
}
}
static void
_gtk_rbtree_debug_spew (GtkRBTree *tree)
_gtk_rbtree_debug_spew (GtkRBTree *tree, GString *s)
{
g_return_if_fail (tree != NULL);
if (_gtk_rbtree_is_nil (tree->root))
g_print ("Empty tree...\n");
g_string_append (s, "Empty tree...");
else
_gtk_rbtree_debug_spew_helper (tree, tree->root, 0);
_gtk_rbtree_debug_spew_helper (tree, tree->root, s, 0);
}
#endif /* G_ENABLE_DEBUG */

View File

@ -340,18 +340,24 @@ gtk_widget_query_size_for_orientation (GtkWidget *widget,
g_assert (min_size <= nat_size);
GTK_NOTE (SIZE_REQUEST,
g_print ("[%p] %s\t%s: %d is minimum %d and natural: %d",
widget, G_OBJECT_TYPE_NAME (widget),
orientation == GTK_ORIENTATION_HORIZONTAL ?
"width for height" : "height for width" ,
for_size, min_size, nat_size);
GTK_NOTE (SIZE_REQUEST, {
GString *s;
s = g_string_new ("");
g_string_append_printf (s, "[%p] %s\t%s: %d is minimum %d and natural: %d",
widget, G_OBJECT_TYPE_NAME (widget),
orientation == GTK_ORIENTATION_HORIZONTAL
? "width for height"
: "height for width",
for_size, min_size, nat_size);
if (min_baseline != -1 || nat_baseline != -1)
g_print (", baseline %d/%d",
min_baseline, nat_baseline);
g_print (" (hit cache: %s)\n",
found_in_cache ? "yes" : "no")
);
g_string_append_printf (s, ", baseline %d/%d",
min_baseline, nat_baseline);
g_string_append_printf (s, " (hit cache: %s)\n",
found_in_cache ? "yes" : "no");
g_message ("%s", s->str);
g_string_free (s, TRUE);
});
}
/* This is the main function that checks for a cached size and

View File

@ -5984,13 +5984,11 @@ gtk_widget_size_allocate_with_baseline (GtkWidget *widget,
}
name = g_type_name (G_OBJECT_TYPE (G_OBJECT (widget)));
g_print ("gtk_widget_size_allocate: %*s%s %d %d %d %d",
2 * depth, " ", name,
allocation->x, allocation->y,
allocation->width, allocation->height);
if (baseline != -1)
g_print (" baseline: %d", baseline);
g_print ("\n");
g_message ("gtk_widget_size_allocate: %*s%s %d %d %d %d, baseline %d",
2 * depth, " ", name,
allocation->x, allocation->y,
allocation->width, allocation->height,
baseline);
}
#endif /* G_ENABLE_DEBUG */
@ -15514,10 +15512,10 @@ gtk_widget_set_clip (GtkWidget *widget,
}
name = g_type_name (G_OBJECT_TYPE (G_OBJECT (widget)));
g_print ("gtk_widget_set_clip: %*s%s %d %d %d %d\n",
2 * depth, " ", name,
clip->x, clip->y,
clip->width, clip->height);
g_message ("gtk_widget_set_clip: %*s%s %d %d %d %d",
2 * depth, " ", name,
clip->x, clip->y,
clip->width, clip->height);
}
#endif /* G_ENABLE_DEBUG */