[gnome-chess/arnaudb/wip/gtk4: 32/51] The configure event is gone.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-chess/arnaudb/wip/gtk4: 32/51] The configure event is gone.
- Date: Tue, 15 Sep 2020 16:25:26 +0000 (UTC)
commit f2ced394e89c5084612fe68f8e818cd1c61e1e6c
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Thu Aug 13 16:17:26 2020 +0200
The configure event is gone.
src/chess-view.vala | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/chess-view.vala b/src/chess-view.vala
index cb19c05..a600b97 100644
--- a/src/chess-view.vala
+++ b/src/chess-view.vala
@@ -46,17 +46,23 @@ public class ChessView : Gtk.DrawingArea
set_draw_func (draw);
}
- public override bool configure_event (Gdk.EventConfigure event)
+ int old_width = 0;
+ int old_height = 0;
+ private inline void configure_size (int new_width, int new_height)
{
- int short_edge = int.min (get_allocated_width (), get_allocated_height ());
+ if (old_width == new_width
+ && old_height == new_height)
+ return;
+ old_width = new_width;
+ old_height = new_height;
+
+ int short_edge = int.min (new_width, new_height);
square_size = (int) Math.floor ((short_edge - 2 * border) / 9.0);
var extra = square_size * 0.1;
if (extra < 3)
extra = 3;
selected_square_size = square_size + 2 * (int) (extra + 0.5);
-
- return true;
}
private void render_piece (Cairo.Context c1, Cairo.Context c2, string name, int offset)
@@ -114,6 +120,7 @@ public class ChessView : Gtk.DrawingArea
private inline void draw (Gtk.DrawingArea _this, Cairo.Context c, int new_width, int new_height)
{
+ configure_size (new_width, new_height);
load_theme (c);
c.translate (new_width / 2, new_height / 2);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]