[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Fix gtk3 deprecations in gtkboard.board_drag()
From: |
Nikolas Nyby |
Subject: |
[PATCH] Fix gtk3 deprecations in gtkboard.board_drag() |
Date: |
Sun, 12 May 2024 08:44:01 -0400 |
---
gtkboard.c | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/gtkboard.c b/gtkboard.c
index 51098a45..1438ffa9 100644
--- a/gtkboard.c
+++ b/gtkboard.c
@@ -973,10 +973,13 @@ static void
board_drag(GtkWidget * UNUSED(widget), BoardData * bd, int x, int y)
#endif
{
-
cairo_t *cr;
unsigned char *puch, *puchNew, *puchChequer;
int s = bd->rd->nSize;
+ GdkWindow *window = gtk_widget_get_window(bd->drawing_area);
+#if GTK_CHECK_VERSION(3,22,0)
+ GdkDrawingContext *context;
+#endif
#if defined(USE_BOARD3D)
if (display_is_3d(bd->rd)) {
@@ -987,7 +990,7 @@ board_drag(GtkWidget * UNUSED(widget), BoardData * bd, int
x, int y)
#endif
#if !GTK_CHECK_VERSION(3,22,0)
- gdk_window_process_updates(gtk_widget_get_window(bd->drawing_area), FALSE);
+ gdk_window_process_updates(window, FALSE);
#endif
if (s == 0)
@@ -1018,17 +1021,31 @@ board_drag(GtkWidget * UNUSED(widget), BoardData * bd,
int x, int y)
r.y = y - 3 * s;
gtk_locdef_union_rectangle(pr, &r);
- gdk_window_begin_paint_region(gtk_widget_get_window(bd->drawing_area),
pr);
+#if GTK_CHECK_VERSION(3,22,0)
+ context = gdk_window_begin_draw_frame(window, pr);
+#else
+ gdk_window_begin_paint_region(window, pr);
+#endif
gtk_locdef_region_destroy(pr);
}
- cr = gdk_cairo_create(gtk_widget_get_window(bd->drawing_area));
+#if GTK_CHECK_VERSION(3,22,0)
+ cr = gdk_drawing_context_get_cairo_context(context);
+#else
+ cr = gdk_cairo_create(window);
+#endif
+
draw_rgb_image(cr, puch, bd->x_drag - 3 * s, bd->y_drag - 3 * s, 6 * s, 6
* s);
draw_rgb_image(cr, puchChequer, x - 3 * s, y - 3 * s, 6 * s, 6 * s);
+
+#if GTK_CHECK_VERSION(3,22,0)
+ gdk_window_end_draw_frame(window, context);
+#else
cairo_destroy(cr);
+ gdk_window_end_paint(window);
+#endif
- gdk_window_end_paint(gtk_widget_get_window(bd->drawing_area));
bd->x_drag = x;
bd->y_drag = y;
}
--
2.34.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Fix gtk3 deprecations in gtkboard.board_drag(),
Nikolas Nyby <=