Clean up debug flags code a bit

Use the GtkDebugFlags enum, since we have it.
This commit is contained in:
Matthias Clasen 2020-09-13 22:10:25 -04:00
parent aa5207b349
commit ff9ca2b68d
3 changed files with 14 additions and 13 deletions

View File

@ -53,7 +53,7 @@ typedef enum {
GTK_DEBUG_CONSTRAINTS = 1 << 15,
GTK_DEBUG_BUILDER_OBJECTS = 1 << 16,
GTK_DEBUG_A11Y = 1 << 17,
} GtkDebugFlag;
} GtkDebugFlags;
#ifdef G_ENABLE_DEBUG
@ -71,9 +71,9 @@ typedef enum {
#endif /* G_ENABLE_DEBUG */
GDK_AVAILABLE_IN_ALL
guint gtk_get_debug_flags (void);
GtkDebugFlags gtk_get_debug_flags (void);
GDK_AVAILABLE_IN_ALL
void gtk_set_debug_flags (guint flags);
void gtk_set_debug_flags (GtkDebugFlags flags);
G_END_DECLS

View File

@ -342,7 +342,7 @@ check_setugid (void)
#ifndef G_OS_WIN32
uid_t ruid, euid, suid; /* Real, effective and saved user ID's */
gid_t rgid, egid, sgid; /* Real, effective and saved group ID's */
#ifdef HAVE_GETRESUID
if (getresuid (&ruid, &euid, &suid) != 0 ||
getresgid (&rgid, &egid, &sgid) != 0)
@ -387,7 +387,7 @@ gtk_disable_setlocale (void)
{
if (pre_initialized)
g_warning ("gtk_disable_setlocale() must be called before gtk_init()");
do_setlocale = FALSE;
}
@ -687,7 +687,7 @@ do_post_parse_initialization (void)
NULL);
}
guint
GtkDebugFlags
gtk_get_display_debug_flags (GdkDisplay *display)
{
int i;
@ -698,7 +698,7 @@ gtk_get_display_debug_flags (GdkDisplay *display)
for (i = 0; i < N_DEBUG_DISPLAYS; i++)
{
if (debug_flags[i].display == display)
return debug_flags[i].flags;
return (GtkDebugFlags)debug_flags[i].flags;
}
return 0;
@ -711,8 +711,8 @@ gtk_get_any_display_debug_flag_set (void)
}
void
gtk_set_display_debug_flags (GdkDisplay *display,
guint flags)
gtk_set_display_debug_flags (GdkDisplay *display,
GtkDebugFlags flags)
{
int i;
@ -735,14 +735,14 @@ gtk_set_display_debug_flags (GdkDisplay *display,
/**
* gtk_get_debug_flags:
*
* Returns the GTK debug flags.
* Returns the GTK debug flags that are currently active.
*
* This function is intended for GTK modules that want
* to adjust their debug output based on GTK debug flags.
*
* Returns: the GTK debug flags.
*/
guint
GtkDebugFlags
gtk_get_debug_flags (void)
{
if (gtk_get_any_display_debug_flag_set ())
@ -753,11 +753,12 @@ gtk_get_debug_flags (void)
/**
* gtk_set_debug_flags:
* @flags: the debug flags to set
*
* Sets the GTK debug flags.
*/
void
gtk_set_debug_flags (guint flags)
gtk_set_debug_flags (GtkDebugFlags flags)
{
gtk_set_display_debug_flags (gdk_display_get_default (), flags);
}

View File

@ -901,7 +901,7 @@ init_slowdown (GtkInspectorVisual *vis)
static void
update_touchscreen (GtkSwitch *sw)
{
GtkDebugFlag flags;
GtkDebugFlags flags;
flags = gtk_get_debug_flags ();