[libdazzle/libdazzle-3-30] shortcuts: special case ctrl+shift+d for inspector



commit 78c92e94eb61daf33371a10a7173cab3caa693d9
Author: Christian Hergert <chergert redhat com>
Date:   Sun Oct 14 12:55:49 2018 -0700

    shortcuts: special case ctrl+shift+d for inspector

 src/shortcuts/dzl-shortcut-manager.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
---
diff --git a/src/shortcuts/dzl-shortcut-manager.c b/src/shortcuts/dzl-shortcut-manager.c
index 797af46..eede32f 100644
--- a/src/shortcuts/dzl-shortcut-manager.c
+++ b/src/shortcuts/dzl-shortcut-manager.c
@@ -812,6 +812,7 @@ dzl_shortcut_manager_run_fallbacks (DzlShortcutManager     *self,
                                     const DzlShortcutChord *chord)
 {
   DzlShortcutManagerPrivate *priv = dzl_shortcut_manager_get_instance_private (self);
+  static DzlShortcutChord *inspector_chord;
 
   DZL_ENTRY;
 
@@ -865,6 +866,23 @@ dzl_shortcut_manager_run_fallbacks (DzlShortcutManager     *self,
             DZL_RETURN (TRUE);
         }
 
+      /*
+       * If we this is the ctrl+shift+d keybinding to activate the inspector,
+       * then try to see if we should handle that manually.
+       */
+      if G_UNLIKELY (inspector_chord == NULL)
+        inspector_chord = dzl_shortcut_chord_new_from_string ("<ctrl><shift>d");
+      if (dzl_shortcut_chord_equal (chord, inspector_chord))
+        {
+          g_autoptr(GSettings) settings = g_settings_new ("org.gtk.Settings.Debug");
+
+          if (g_settings_get_boolean (settings, "enable-inspector-keybinding"))
+            {
+              gtk_window_set_interactive_debugging (TRUE);
+              DZL_RETURN (TRUE);
+            }
+        }
+
       /*
        * Now fallback to trying to activate the action within GtkApplication
        * as the legacy Gtk bindings would do.


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