[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Fix gdk_cairo_create deprecation warning in board_motion_notify
From: |
Nikolas Nyby |
Subject: |
[PATCH] Fix gdk_cairo_create deprecation warning in board_motion_notify |
Date: |
Sat, 18 May 2024 01:53:10 -0400 |
---
gtkboard.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/gtkboard.c b/gtkboard.c
index 48cecf36..ef1e8ee5 100644
--- a/gtkboard.c
+++ b/gtkboard.c
@@ -2146,6 +2146,11 @@ board_motion_notify(GtkWidget * board, GdkEventMotion *
event, BoardData * bd)
if (bd->DragTargetHelp) { /* Display 2d drag target help */
gint i, ptx, pty, ptcx, ptcy;
cairo_t *cr;
+ GdkWindow *window = gtk_widget_get_window(board);
+#if GTK_CHECK_VERSION(3,22,0)
+ cairo_region_t * cairoRegion = cairo_region_create();
+ GdkDrawingContext *context;
+#endif
#if GTK_CHECK_VERSION(3,0,0)
GdkRGBA TargetHelpRGBA;
@@ -2167,7 +2172,14 @@ board_motion_notify(GtkWidget * board, GdkEventMotion *
event, BoardData * bd)
/* get the closest color available in the colormap if no 24-bit */
gdk_colormap_alloc_color(gtk_widget_get_colormap(board),
&TargetHelpColor, TRUE, TRUE);
#endif
- cr = gdk_cairo_create(gtk_widget_get_window(board));
+
+#if GTK_CHECK_VERSION(3,22,0)
+ context = gdk_window_begin_draw_frame(window, cairoRegion);
+ cr = gdk_drawing_context_get_cairo_context(context);
+#else
+ cr = gdk_cairo_create(window);
+#endif
+
#if GTK_CHECK_VERSION(3,0,0)
gdk_cairo_set_source_rgba(cr, &TargetHelpRGBA);
#else
@@ -2185,7 +2197,12 @@ board_motion_notify(GtkWidget * board, GdkEventMotion *
event, BoardData * bd)
}
}
+#if GTK_CHECK_VERSION(3,22,0)
+ gdk_window_end_draw_frame(window, context);
+ cairo_region_destroy(cairoRegion);
+#else
cairo_destroy(cr);
+#endif
}
}
--
2.34.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Fix gdk_cairo_create deprecation warning in board_motion_notify,
Nikolas Nyby <=