[gnome-sudoku/arnaudb/wip/gtk4: 22/26] Make keyboard start to work.



commit 2b5c13d770b5344b2f71a93b27bd2537ac5fac99
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Fri Apr 17 22:42:34 2020 +0200

    Make keyboard start to work.

 src/sudoku-view.vala | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/sudoku-view.vala b/src/sudoku-view.vala
index c98d1b5..a411ff4 100644
--- a/src/sudoku-view.vala
+++ b/src/sudoku-view.vala
@@ -22,7 +22,7 @@
 using Gtk;
 using Gdk;
 
-private class SudokuCellView : DrawingArea
+private class SudokuCellView : Widget
 {
     private double size_ratio = 2;
 
@@ -95,10 +95,15 @@ private class SudokuCellView : DrawingArea
     private EventControllerKey key_controller;      // for keeping in memory
     private GestureClick click_controller;          // for keeping in memory
 
+    private DrawingArea drawing;
+
     construct
     {
         BinLayout layout = new BinLayout ();
         set_layout_manager (layout);
+
+        drawing = new DrawingArea ();
+        drawing.insert_after (this, /* insert first */ null);
     }
 
     public SudokuCellView (int row, int col, ref SudokuGame game)
@@ -109,14 +114,12 @@ private class SudokuCellView : DrawingArea
 
         init_mouse ();
         init_keyboard ();
-        set_draw_func (draw);
+        drawing.set_draw_func (draw);
 
         value = game.board [row, col];
 
         // background_color is set in the SudokuView, as it manages the color of the cells
 
-        can_focus = true;
-
         if (is_fixed && game.mode == GameMode.PLAY)
             return;
 


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