[gtk/shortcuts-rebased-again: 143/145] flowbox: Avoid warnings in class init



commit b49478b6792bd8c578742a115d99f22b941ddcfb
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jun 23 00:00:54 2019 +0000

    flowbox: Avoid warnings in class init
    
    We can't assume that we have a display here,
    so deal with its absence without spewing criticals.

 gtk/gtkflowbox.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c
index 5479009692..15d489141d 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -2997,10 +2997,18 @@ gtk_flow_box_add_move_binding (GtkWidgetClass  *widget_class,
   GdkModifierType modify_mod_mask = GDK_CONTROL_MASK;
 
   display = gdk_display_get_default ();
-  extend_mod_mask = gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
-                                                  GDK_MODIFIER_INTENT_EXTEND_SELECTION);
-  modify_mod_mask = gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
-                                                  GDK_MODIFIER_INTENT_MODIFY_SELECTION);
+  if (display)
+    {
+      extend_mod_mask = gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
+                                                      GDK_MODIFIER_INTENT_EXTEND_SELECTION);
+      modify_mod_mask = gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
+                                                      GDK_MODIFIER_INTENT_MODIFY_SELECTION);
+    }
+  else
+    {
+      extend_mod_mask = GDK_SHIFT_MASK;
+      modify_mod_mask = GDK_CONTROL_MASK;
+    }
 
   gtk_widget_class_add_binding_signal (widget_class,
                                        keyval, modmask,


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