mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-08 09:40:10 +00:00
gdk: Beef up gdk_parse_debug_var
Add a docstring for the variable itself, and print it as part of the help message. Update all callers to provide a docstring.
This commit is contained in:
parent
29cfcbdc97
commit
26a2966a7b
15
gdk/gdk.c
15
gdk/gdk.c
@ -229,6 +229,7 @@ gdk_ensure_resources (void)
|
||||
|
||||
guint
|
||||
gdk_parse_debug_var (const char *variable,
|
||||
const char *docs,
|
||||
const GdkDebugKey *keys,
|
||||
guint nkeys)
|
||||
{
|
||||
@ -289,6 +290,7 @@ gdk_parse_debug_var (const char *variable,
|
||||
max_width = MAX (max_width, strlen (keys[i].key));
|
||||
max_width += 4;
|
||||
|
||||
fprintf (stderr, "%s\n", docs);
|
||||
fprintf (stderr, "Supported %s values:\n", variable);
|
||||
for (i = 0; i < nkeys; i++) {
|
||||
fprintf (stderr, " %s%*s%s\n", keys[i].key, (int)(max_width - strlen (keys[i].key)), " ", keys[i].help);
|
||||
@ -323,12 +325,17 @@ gdk_pre_parse (void)
|
||||
gdk_ensure_resources ();
|
||||
|
||||
_gdk_debug_flags = gdk_parse_debug_var ("GDK_DEBUG",
|
||||
gdk_debug_keys,
|
||||
G_N_ELEMENTS (gdk_debug_keys));
|
||||
"GDK_DEBUG can be set to values that make GDK print out different\n"
|
||||
"types of debugging information or change the behavior of GDK for\n"
|
||||
"debugging purposes.\n",
|
||||
gdk_debug_keys,
|
||||
G_N_ELEMENTS (gdk_debug_keys));
|
||||
|
||||
disabled_features = gdk_parse_debug_var ("GDK_DISABLE",
|
||||
gdk_feature_keys,
|
||||
G_N_ELEMENTS (gdk_feature_keys));
|
||||
"GDK_DISABLE can be set to values which cause GDK to disable\n"
|
||||
"certain features.\n",
|
||||
gdk_feature_keys,
|
||||
G_N_ELEMENTS (gdk_feature_keys));
|
||||
|
||||
gdk_features = GDK_ALL_FEATURES & ~disabled_features;
|
||||
|
||||
|
@ -115,6 +115,7 @@ typedef struct
|
||||
} GdkDebugKey;
|
||||
|
||||
guint gdk_parse_debug_var (const char *variable,
|
||||
const char *docs,
|
||||
const GdkDebugKey *keys,
|
||||
guint nkeys);
|
||||
|
||||
|
@ -1776,8 +1776,10 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
|
||||
|
||||
supported_features = gdk_gl_context_check_features (context);
|
||||
disabled_features = gdk_parse_debug_var ("GDK_GL_DISABLE",
|
||||
gdk_gl_feature_keys,
|
||||
G_N_ELEMENTS (gdk_gl_feature_keys));
|
||||
"GDK_GL_DISABLE can be set to values which cause GDK to disable\n"
|
||||
"certain OpenGL extensions.\n",
|
||||
gdk_gl_feature_keys,
|
||||
G_N_ELEMENTS (gdk_gl_feature_keys));
|
||||
|
||||
priv->features = supported_features & ~disabled_features;
|
||||
|
||||
|
@ -1406,8 +1406,9 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
||||
last = n_devices;
|
||||
|
||||
skip_features = gdk_parse_debug_var ("GDK_VULKAN_DISABLE",
|
||||
gsk_vulkan_feature_keys,
|
||||
G_N_ELEMENTS (gsk_vulkan_feature_keys));
|
||||
"GDK_VULKAN_DISABLE can be set to a list of Vulkan features to disable.\n",
|
||||
gsk_vulkan_feature_keys,
|
||||
G_N_ELEMENTS (gsk_vulkan_feature_keys));
|
||||
if (skip_features & GDK_VULKAN_FEATURE_YCBCR)
|
||||
skip_features |= GDK_VULKAN_FEATURE_DMABUF;
|
||||
|
||||
|
@ -494,8 +494,10 @@ gsk_gpu_renderer_class_init (GskGpuRendererClass *klass)
|
||||
|
||||
klass->optimizations = -1;
|
||||
klass->optimizations &= ~gdk_parse_debug_var ("GSK_GPU_DISABLE",
|
||||
gsk_gpu_optimization_keys,
|
||||
G_N_ELEMENTS (gsk_gpu_optimization_keys));
|
||||
"GSK_GPU_DISABLE can be set to of values which cause GSK to disable\n"
|
||||
"certain optimizations in the \'ngl\' and \'vulkan\' renderers.\n",
|
||||
gsk_gpu_optimization_keys,
|
||||
G_N_ELEMENTS (gsk_gpu_optimization_keys));
|
||||
klass->get_scale = gsk_gpu_renderer_real_get_scale;
|
||||
}
|
||||
|
||||
|
@ -27,8 +27,11 @@ init_debug_flags (void)
|
||||
if (g_once_init_enter (&gsk_debug_flags__set))
|
||||
{
|
||||
gsk_debug_flags = gdk_parse_debug_var ("GSK_DEBUG",
|
||||
gsk_debug_keys,
|
||||
G_N_ELEMENTS (gsk_debug_keys));
|
||||
"GSK_DEBUG can be set to values that make GSK print out different\n"
|
||||
"types of debugging information or change the behavior of GSK for\n"
|
||||
"debugging purposes.\n",
|
||||
gsk_debug_keys,
|
||||
G_N_ELEMENTS (gsk_debug_keys));
|
||||
|
||||
g_once_init_leave (&gsk_debug_flags__set, TRUE);
|
||||
}
|
||||
|
@ -483,8 +483,11 @@ do_pre_parse_initialization (void)
|
||||
gdk_pre_parse ();
|
||||
|
||||
debug_flags[0].flags = gdk_parse_debug_var ("GTK_DEBUG",
|
||||
gtk_debug_keys,
|
||||
G_N_ELEMENTS (gtk_debug_keys));
|
||||
"GTK_DEBUG can be set to values that make GTK print out different\n"
|
||||
"types of debugging information or change the behavior of GTK for\n"
|
||||
"debugging purposes.\n",
|
||||
gtk_debug_keys,
|
||||
G_N_ELEMENTS (gtk_debug_keys));
|
||||
any_display_debug_flags_set = debug_flags[0].flags > 0;
|
||||
|
||||
env_string = g_getenv ("GTK_SLOWDOWN");
|
||||
|
Loading…
Reference in New Issue
Block a user