gdk: 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:39:05 -05:00
parent b1d691dbfd
commit 2801f3c843
2 changed files with 29 additions and 23 deletions

View File

@ -493,6 +493,8 @@ void
_gdk_frame_clock_debug_print_timings (GdkFrameClock *clock,
GdkFrameTimings *timings)
{
GString *str;
gint64 previous_frame_time = 0;
GdkFrameTimings *previous_timings = gdk_frame_clock_get_timings (clock,
timings->frame_counter - 1);
@ -500,25 +502,29 @@ _gdk_frame_clock_debug_print_timings (GdkFrameClock *clock,
if (previous_timings != NULL)
previous_frame_time = previous_timings->frame_time;
g_print ("%5" G_GINT64_FORMAT ":", timings->frame_counter);
str = g_string_new ("");
g_string_append_printf (str, "%5" G_GINT64_FORMAT ":", timings->frame_counter);
if (previous_frame_time != 0)
{
g_print (" interval=%-4.1f", (timings->frame_time - previous_frame_time) / 1000.);
g_print (timings->slept_before ? " (sleep)" : " ");
g_string_append_printf (str, " interval=%-4.1f", (timings->frame_time - previous_frame_time) / 1000.);
g_string_append_printf (str, timings->slept_before ? " (sleep)" : " ");
}
if (timings->layout_start_time != 0)
g_print (" layout_start=%-4.1f", (timings->layout_start_time - timings->frame_time) / 1000.);
g_string_append_printf (str, " layout_start=%-4.1f", (timings->layout_start_time - timings->frame_time) / 1000.);
if (timings->paint_start_time != 0)
g_print (" paint_start=%-4.1f", (timings->paint_start_time - timings->frame_time) / 1000.);
g_string_append_printf (str, " paint_start=%-4.1f", (timings->paint_start_time - timings->frame_time) / 1000.);
if (timings->frame_end_time != 0)
g_print (" frame_end=%-4.1f", (timings->frame_end_time - timings->frame_time) / 1000.);
g_string_append_printf (str, " frame_end=%-4.1f", (timings->frame_end_time - timings->frame_time) / 1000.);
if (timings->presentation_time != 0)
g_print (" present=%-4.1f", (timings->presentation_time - timings->frame_time) / 1000.);
g_string_append_printf (str, " present=%-4.1f", (timings->presentation_time - timings->frame_time) / 1000.);
if (timings->predicted_presentation_time != 0)
g_print (" predicted=%-4.1f", (timings->predicted_presentation_time - timings->frame_time) / 1000.);
g_string_append_printf (str, " predicted=%-4.1f", (timings->predicted_presentation_time - timings->frame_time) / 1000.);
if (timings->refresh_interval != 0)
g_print (" refresh_interval=%-4.1f", timings->refresh_interval / 1000.);
g_print ("\n");
g_string_append_printf (str, " refresh_interval=%-4.1f", timings->refresh_interval / 1000.);
g_message ("%s", str->str);
g_string_free (str, TRUE);
}
#endif /* G_ENABLE_DEBUG */

View File

@ -662,13 +662,13 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
g_warning ("GL implementation doesn't support any form of non-power-of-two textures");
GDK_NOTE (OPENGL,
g_print ("OpenGL version: %d.%d\n"
g_message ("OpenGL version: %d.%d\n"
"Extensions checked:\n"
" - GL_ARB_texture_non_power_of_two: %s\n"
" - GL_ARB_texture_rectangle: %s\n"
" - GL_EXT_framebuffer_blit: %s\n"
" - GL_GREMEDY_frame_terminator: %s\n"
"Using texture rectangle: %s\n",
"Using texture rectangle: %s",
priv->gl_version / 10, priv->gl_version % 10,
has_npot ? "yes" : "no",
has_texture_rectangle ? "yes" : "no",