GdkWin32: Sort settings alphabetically
authorLuca Bacci <luca.bacci982@gmail.com>
Fri, 4 Nov 2022 14:30:12 +0000 (15:30 +0100)
committerLuca Bacci <luca.bacci982@gmail.com>
Fri, 4 Nov 2022 14:30:12 +0000 (15:30 +0100)
gdk/win32/gdkproperty-win32.c

index b8197495f23b754436ec6b93acca114d26bda217..5e0b8e5783f8800af7860583d12e3767ff399d9e 100644 (file)
@@ -106,9 +106,21 @@ _gdk_win32_get_setting (const char *name,
    * XXX : if these values get changed through the Windoze UI the
    *       respective gdk_events are not generated yet.
    */
-  if (strcmp ("gtk-double-click-time", name) == 0)
+  if (strcmp ("gtk-alternative-button-order", name) == 0)
     {
-      int i = GetDoubleClickTime ();
+      GDK_NOTE(MISC, g_print("gdk_display_get_setting(\"%s\") : TRUE\n", name));
+      g_value_set_boolean (value, TRUE);
+      return TRUE;
+    }
+  else if (strcmp ("gtk-alternative-sort-arrows", name) == 0)
+    {
+      GDK_NOTE(MISC, g_print("gdk_display_get_setting(\"%s\") : TRUE\n", name));
+      g_value_set_boolean (value, TRUE);
+      return TRUE;
+    }
+  else if (strcmp ("gtk-dnd-drag-threshold", name) == 0)
+    {
+      int i = MAX(GetSystemMetrics (SM_CXDRAG), GetSystemMetrics (SM_CYDRAG));
       GDK_NOTE(MISC, g_print("gdk_display_get_setting(\"%s\") : %d\n", name, i));
       g_value_set_int (value, i);
       return TRUE;
@@ -120,30 +132,59 @@ _gdk_win32_get_setting (const char *name,
       g_value_set_int (value, i);
       return TRUE;
     }
-  else if (strcmp ("gtk-dnd-drag-threshold", name) == 0)
+  else if (strcmp ("gtk-double-click-time", name) == 0)
     {
-      int i = MAX(GetSystemMetrics (SM_CXDRAG), GetSystemMetrics (SM_CYDRAG));
+      int i = GetDoubleClickTime ();
       GDK_NOTE(MISC, g_print("gdk_display_get_setting(\"%s\") : %d\n", name, i));
       g_value_set_int (value, i);
       return TRUE;
     }
-  else if (strcmp ("gtk-split-cursor", name) == 0)
+  else if (strcmp ("gtk-font-name", name) == 0)
     {
-      GDK_NOTE(MISC, g_print("gdk_display_get_setting(\"%s\") : FALSE\n", name));
-      g_value_set_boolean (value, FALSE);
-      return TRUE;
+      char *font_name = _get_system_font_name (_gdk_display_hdc);
+
+      if (font_name)
+        {
+          /* The pango font fallback list got fixed during 1.43, before that
+           * using anything but "Segoe UI" would lead to a poor glyph coverage */
+          if (pango_version_check (1, 43, 0) != NULL &&
+              g_ascii_strncasecmp (font_name, "Segoe UI", strlen ("Segoe UI")) != 0)
+            {
+              g_free (font_name);
+              return FALSE;
+            }
+
+          GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : %s\n", name, font_name));
+          g_value_take_string (value, font_name);
+          return TRUE;
+        }
+      else
+        {
+          g_warning ("gdk_screen_get_setting: Detecting the system font failed");
+          return FALSE;
+        }
     }
-  else if (strcmp ("gtk-alternative-button-order", name) == 0)
+  else if (strcmp ("gtk-im-module", name) == 0)
     {
-      GDK_NOTE(MISC, g_print("gdk_display_get_setting(\"%s\") : TRUE\n", name));
-      g_value_set_boolean (value, TRUE);
+      if (_gdk_input_locale_is_ime)
+        g_value_set_static_string (value, "ime");
+      else
+        g_value_set_static_string (value, "");
+
       return TRUE;
     }
-  else if (strcmp ("gtk-alternative-sort-arrows", name) == 0)
+  else if (strcmp ("gtk-overlay-scrolling", name) == 0)
     {
-      GDK_NOTE(MISC, g_print("gdk_display_get_setting(\"%s\") : TRUE\n", name));
-      g_value_set_boolean (value, TRUE);
-      return TRUE;
+      DWORD val = 0;
+      DWORD sz = sizeof (val);
+      LSTATUS ret = 0;
+
+      ret = RegGetValueW (HKEY_CURRENT_USER, L"Control Panel\\Accessibility", L"DynamicScrollbars", RRF_RT_DWORD, NULL, &val, &sz);
+      if (ret == ERROR_SUCCESS)
+        {
+          g_value_set_boolean (value, val != 0);
+          return TRUE;
+        }
     }
   else if (strcmp ("gtk-shell-shows-desktop", name) == 0)
     {
@@ -151,10 +192,10 @@ _gdk_win32_get_setting (const char *name,
       g_value_set_boolean (value, TRUE);
       return TRUE;
     }
-  else if (strcmp ("gtk-xft-hinting", name) == 0)
+  else if (strcmp ("gtk-split-cursor", name) == 0)
     {
-      GDK_NOTE(MISC, g_print ("gdk_screen_get_setting(\"%s\") : 1\n", name));
-      g_value_set_int (value, 1);
+      GDK_NOTE(MISC, g_print("gdk_display_get_setting(\"%s\") : FALSE\n", name));
+      g_value_set_boolean (value, FALSE);
       return TRUE;
     }
   else if (strcmp ("gtk-xft-antialias", name) == 0)
@@ -182,6 +223,12 @@ _gdk_win32_get_setting (const char *name,
 
       return FALSE;
     }
+  else if (strcmp ("gtk-xft-hinting", name) == 0)
+    {
+      GDK_NOTE(MISC, g_print ("gdk_screen_get_setting(\"%s\") : 1\n", name));
+      g_value_set_int (value, 1);
+      return TRUE;
+    }
   else if (strcmp ("gtk-xft-hintstyle", name) == 0)
     {
       g_value_set_static_string (value, "hintfull");
@@ -206,53 +253,6 @@ _gdk_win32_get_setting (const char *name,
       GDK_NOTE(MISC, g_print ("gdk_screen_get_setting(\"%s\") : %s\n", name, g_value_get_string (value)));
       return TRUE;
     }
-  else if (strcmp ("gtk-font-name", name) == 0)
-    {
-      char *font_name = _get_system_font_name (_gdk_display_hdc);
-
-      if (font_name)
-        {
-          /* The pango font fallback list got fixed during 1.43, before that
-           * using anything but "Segoe UI" would lead to a poor glyph coverage */
-          if (pango_version_check (1, 43, 0) != NULL &&
-              g_ascii_strncasecmp (font_name, "Segoe UI", strlen ("Segoe UI")) != 0)
-            {
-              g_free (font_name);
-              return FALSE;
-            }
-
-          GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : %s\n", name, font_name));
-          g_value_take_string (value, font_name);
-          return TRUE;
-        }
-      else
-        {
-          g_warning ("gdk_screen_get_setting: Detecting the system font failed");
-          return FALSE;
-        }
-    }
-  else if (strcmp ("gtk-im-module", name) == 0)
-    {
-      if (_gdk_input_locale_is_ime)
-        g_value_set_static_string (value, "ime");
-      else
-        g_value_set_static_string (value, "");
-
-      return TRUE;
-    }
-  else if (strcmp ("gtk-overlay-scrolling", name) == 0)
-    {
-      DWORD val = 0;
-      DWORD sz = sizeof (val);
-      LSTATUS ret = 0;
-
-      ret = RegGetValueW (HKEY_CURRENT_USER, L"Control Panel\\Accessibility", L"DynamicScrollbars", RRF_RT_DWORD, NULL, &val, &sz);
-      if (ret == ERROR_SUCCESS)
-        {
-          g_value_set_boolean (value, val != 0);
-          return TRUE;
-        }
-    }
 
   return FALSE;
 }