[five-or-more/arnaudb/gtk3: 3/24] Revert "Fix keyboard."




commit 541a64bff69487ce207c8ef8e8a8b523c2895a4b
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Thu Oct 22 17:27:07 2020 +0200

    Revert "Fix keyboard."
    
    This reverts commit 24a9bf0b1d4bd69972b4ff6d748f7ac9df32be55.

 data/ui/five-or-more.ui | 5 +++++
 src/view.vala           | 9 ++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/data/ui/five-or-more.ui b/data/ui/five-or-more.ui
index e2c32d2..01bf5d9 100644
--- a/data/ui/five-or-more.ui
+++ b/data/ui/five-or-more.ui
@@ -105,6 +105,7 @@
     </section>
   </menu>
   <template class="GameWindow" parent="GtkApplicationWindow">
+    <property name="can_focus">False</property>
     <property name="default_width">320</property>
     <property name="default_height">400</property>
     <property name="icon_name">five-or-more</property>
@@ -113,14 +114,17 @@
     <property name="title" translatable="yes">Five or More</property>
     <child type="titlebar">
       <object class="GtkHeaderBar" id="headerbar">
+        <property name="can_focus">False</property>
         <property name="show_title_buttons">True</property>
         <child type="start">
           <object class="GtkBox" id="preview_hbox">
+            <property name="can_focus">False</property>
 <!--            <property name="border_width">12</property> FIXME -->
             <property name="orientation">horizontal</property>
             <child>
               <object class="GtkLabel" id="labelNext">
                 <property name="ellipsize">PANGO_ELLIPSIZE_END</property>
+                <property name="can_focus">False</property>
                 <!-- Translators: label displayed in the headerbar, introducing the next balls to be added 
to the board -->
                 <property name="label" translatable="yes">Next:</property>
                 <attributes>
@@ -132,6 +136,7 @@
         </child>
         <child type="end">
           <object class="GtkMenuButton">
+            <property name="can_focus">True</property>
             <property name="menu_model">primary-menu</property>
             <property name="icon_name">open-menu-symbolic</property>
 <!--            <accelerator key="F10" signal="activate"/> FIXME -->
diff --git a/src/view.vala b/src/view.vala
index e714fa7..2a24642 100644
--- a/src/view.vala
+++ b/src/view.vala
@@ -75,8 +75,6 @@ private class View : DrawingArea
         this.game = game;
         this.theme = theme;
 
-        focusable = true;
-
         init_keyboard ();
         init_mouse ();
         set_draw_func (draw);
@@ -101,6 +99,7 @@ private class View : DrawingArea
 
         game.board.grid_changed.connect (queue_draw);
 
+        set_can_focus (true);
         grab_focus ();
 
         game.current_path_cell_pos_changed.connect (queue_draw);
@@ -160,12 +159,12 @@ private class View : DrawingArea
 
     private void init_keyboard ()
     {
-        key_controller = new EventControllerKey ();
+        key_controller = new Gtk.EventControllerKey ();
         key_controller.key_pressed.connect (on_key_pressed);
         add_controller (key_controller);
     }
 
-    private inline bool on_key_pressed (EventControllerKey _key_controller, uint keyval, uint keycode, 
Gdk.ModifierType state)
+    private inline bool on_key_pressed (Gtk.EventControllerKey _key_controller, uint keyval, uint keycode, 
Gdk.ModifierType state)
     {
         switch (keyval)
         {
@@ -414,7 +413,7 @@ private class View : DrawingArea
         }
     }
 
-    private inline void draw (DrawingArea _this, Cairo.Context cr, int new_width, int new_height)
+    private inline void draw (Gtk.DrawingArea _this, Cairo.Context cr, int new_width, int new_height)
     {
         if (theme == null)
             return;


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