[gnome-sudoku/arnaudb/wip/gtk4: 24/25] Make things work.



commit b0b61297742d82b1effc95390e79314d5c75365a
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Fri Apr 17 23:18:38 2020 +0200

    Make things work.

 src/sudoku-view.vala | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/src/sudoku-view.vala b/src/sudoku-view.vala
index 0a1df70..7d8cc7f 100644
--- a/src/sudoku-view.vala
+++ b/src/sudoku-view.vala
@@ -140,6 +140,12 @@ private class SudokuCellView : Widget
         game.cell_changed.connect (cell_changed_cb);
     }
 
+    protected override void snapshot (Gtk.Snapshot snap)
+    {
+        drawing.queue_draw ();
+        base.snapshot (snap);
+    }
+
     private inline void init_mouse ()  // called on construct
     {
         click_controller = new Gtk.GestureClick ();
@@ -497,6 +503,15 @@ public class SudokuView : Widget
         cells[selected_row, selected_col].selected = true;
     }
 
+    protected override void snapshot (Gtk.Snapshot snap)
+    {
+        drawing.queue_draw ();
+        for (uint8 i = 0; i < game.board.cols; i++)
+            for (uint8 j = 0; j < game.board.rows; j++)
+                cells[i, j].queue_draw ();
+        base.snapshot (snap);
+    }
+
     public SudokuView (SudokuGame game)
     {
         BinLayout layout = new BinLayout ();
@@ -567,6 +582,7 @@ public class SudokuView : Widget
 
                     cells[cell_row, cell_col].background_color = selected_bg_color;
 
+                    // Redraw the board
                     queue_draw ();
                 });
 
@@ -575,7 +591,7 @@ public class SudokuView : Widget
                         previous_board_broken_state = game.board.broken;
 
                     // Redraw the board
-                    this.queue_draw ();
+                    queue_draw ();
                 });
 
                 cells[row, col] = cell;


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