[five-or-more/arnaudb/wip/gtk4: 6/19] Adapt to DrawingArea API.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [five-or-more/arnaudb/wip/gtk4: 6/19] Adapt to DrawingArea API.
- Date: Sun, 12 Apr 2020 11:09:00 +0000 (UTC)
commit fb2782f4dfd9897259a1d3abe2004549c51ca888
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Fri Mar 13 10:16:00 2020 +0100
Adapt to DrawingArea API.
src/next-pieces-widget.vala | 8 ++++----
src/view.vala | 7 +++----
2 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/src/next-pieces-widget.vala b/src/next-pieces-widget.vala
index b891676..4b40349 100644
--- a/src/next-pieces-widget.vala
+++ b/src/next-pieces-widget.vala
@@ -36,6 +36,8 @@ private class NextPiecesWidget : Gtk.DrawingArea
this.game = game;
this.theme = theme;
+ set_draw_func (draw);
+
set_queue_size ();
settings.changed[FiveOrMoreApp.KEY_SIZE].connect (() => {
set_queue_size ();
@@ -59,10 +61,10 @@ private class NextPiecesWidget : Gtk.DrawingArea
queue_draw ();
}
- protected override bool draw (Cairo.Context cr)
+ private void draw (Gtk.DrawingArea _this, Cairo.Context cr, int new_width, int new_height)
{
if (theme == null)
- return false;
+ return;
if (widget_height == -1)
{
@@ -86,7 +88,5 @@ private class NextPiecesWidget : Gtk.DrawingArea
}
cr.stroke ();
-
- return true;
}
}
diff --git a/src/view.vala b/src/view.vala
index c216a50..f751f98 100644
--- a/src/view.vala
+++ b/src/view.vala
@@ -62,6 +62,7 @@ private class View : DrawingArea
init_keyboard ();
init_mouse ();
+ set_draw_func (draw);
size_allocate.connect (on_size_allocate);
cs = get_style_context ();
@@ -420,17 +421,15 @@ private class View : DrawingArea
}
}
- protected override bool draw (Cairo.Context cr)
+ private inline void draw (Gtk.DrawingArea _this, Cairo.Context cr, int new_width, int new_height)
{
if (theme == null)
- return false;
+ return;
fill_background (cr);
draw_gridlines (cr);
draw_shapes (cr);
draw_cursor_box (cr);
draw_path (cr);
-
- return true;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]