[gtk/matthiasc/for-master: 8/16] Clean up debug flags code a bit




commit ff9ca2b68d552c9b312bd61b4883b981c0ee3237
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Sep 13 22:10:25 2020 -0400

    Clean up debug flags code a bit
    
    Use the GtkDebugFlags enum, since we have it.

 gtk/gtkdebug.h         |  6 +++---
 gtk/gtkmain.c          | 19 ++++++++++---------
 gtk/inspector/visual.c |  2 +-
 3 files changed, 14 insertions(+), 13 deletions(-)
---
diff --git a/gtk/gtkdebug.h b/gtk/gtkdebug.h
index 451420a603..ac85014d74 100644
--- a/gtk/gtkdebug.h
+++ b/gtk/gtkdebug.h
@@ -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
 
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 23c61cd270..4d549e1ea4 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -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);
 }
diff --git a/gtk/inspector/visual.c b/gtk/inspector/visual.c
index 7cc933ff2a..aa34b753b8 100644
--- a/gtk/inspector/visual.c
+++ b/gtk/inspector/visual.c
@@ -901,7 +901,7 @@ init_slowdown (GtkInspectorVisual *vis)
 static void
 update_touchscreen (GtkSwitch *sw)
 {
-  GtkDebugFlag flags;
+  GtkDebugFlags flags;
 
   flags = gtk_get_debug_flags ();
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]