talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 7f2cc1b35642b2bae5c2d1c7e08ffaed57be18d2
parent d832b62d7b4044e00ea5c3d035f18d2a05289301
Author: Ricardo Mones <ricardo@mones.org>
Date:   Fri, 25 Mar 2022 21:04:56 +0100

Fix three warnings in do_pix_draw()

stock_pixmap.c:971:4: warning: ‘gtk_widget_get_style’ is deprecated: Use 'gtk_widget_get_style_context' instead [-Wdeprecated-declarations]
stock_pixmap.c:973:4: warning: ‘gdk_cairo_create’ is deprecated: Use 'gdk_window_begin_draw_frame() and gdk_drawing_context_get_cairo_context()' instead [-Wdeprecated-declarations]
stock_pixmap.c:974:4: warning: ‘gdk_cairo_set_source_color’ is deprecated: Use 'gdk_cairo_set_source_rgba' instead [-Wdeprecated-declarations]

Diffstat:
Msrc/stock_pixmap.c | 15++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/stock_pixmap.c b/src/stock_pixmap.c @@ -949,10 +949,14 @@ static gboolean do_pix_draw(GtkWidget *widget, cairo_t *cr, mw = mainwindow_get_mainwindow(); if (mw != NULL && mw->menubar != NULL) { cairo_t *cr; - GdkColor color = gtk_widget_get_style(mw->menubar)->base[GTK_STATE_SELECTED]; - - cr = gdk_cairo_create(drawable); - gdk_cairo_set_source_color(cr, &color); + GdkRGBA color; + + GtkStyleContext *context = gtk_widget_get_style_context (mw->menubar); + gtk_style_context_lookup_color (context, "selected_bg_color", &color); + cairo_region_t * creg = cairo_region_create(); + GdkDrawingContext * dctx = gdk_window_begin_draw_frame (drawable, creg); + cr = gdk_drawing_context_get_cairo_context (dctx); + gdk_cairo_set_source_rgba (cr, &color); cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE); cairo_set_line_width(cr, 1.); cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT); @@ -960,7 +964,8 @@ static gboolean do_pix_draw(GtkWidget *widget, cairo_t *cr, cairo_rectangle(cr, data->border_x-2, data->border_y-2, data->base_width+3, data->base_height+3); cairo_stroke(cr); - cairo_destroy(cr); + gdk_window_end_draw_frame (drawable, dctx); + cairo_region_destroy (creg); } }