diff options
author | raveit65 <[email protected]> | 2017-04-03 16:13:44 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2017-04-06 15:18:13 +0200 |
commit | f72cb3d12d794beedab5bb392506b54c1b5d1a2c (patch) | |
tree | 315e2e144e729a40c4ebe081757cabc4ef3c8e19 | |
parent | 303e86ed31a12d44592b3a688d2584a6bd9304ff (diff) | |
download | libmatekbd-f72cb3d12d794beedab5bb392506b54c1b5d1a2c.tar.bz2 libmatekbd-f72cb3d12d794beedab5bb392506b54c1b5d1a2c.tar.xz |
matekbd-indicator: don't use deprecated gdk_cairo_create
Expose event is changed to draw
partial taken from:
https://git.gnome.org/browse/libgnomekbd/commit/?id=16c6c2b
-rw-r--r-- | libmatekbd/matekbd-indicator.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/libmatekbd/matekbd-indicator.c b/libmatekbd/matekbd-indicator.c index 0273c77..40bee1e 100644 --- a/libmatekbd/matekbd-indicator.c +++ b/libmatekbd/matekbd-indicator.c @@ -251,35 +251,28 @@ matekbd_indicator_button_pressed (GtkWidget * } static void -flag_exposed (GtkWidget * flag, GdkEventExpose * event, GdkPixbuf * image) +draw_flag (GtkWidget * flag, cairo_t * cr, GdkPixbuf * image) { /* Image width and height */ int iw = gdk_pixbuf_get_width (image); int ih = gdk_pixbuf_get_height (image); GtkAllocation allocation; double xwiratio, ywiratio, wiratio; - cairo_t *cr; gtk_widget_get_allocation (flag, &allocation); - cr = gdk_cairo_create (event->window); - gdk_cairo_region (cr, event->region); - cairo_clip (cr); - /* widget-to-image scales, X and Y */ xwiratio = 1.0 * allocation.width / iw; ywiratio = 1.0 * allocation.height / ih; wiratio = xwiratio < ywiratio ? xwiratio : ywiratio; - /* transform cairo context */ - cairo_translate (cr, allocation.width / 2.0, allocation.height / 2.0); - cairo_scale (cr, wiratio, wiratio); - cairo_translate (cr, - iw / 2.0, - ih / 2.0); - - gdk_cairo_set_source_pixbuf (cr, image, 0, 0); - cairo_paint (cr); + /* transform cairo context */ + cairo_translate (cr, allocation.width / 2.0, allocation.height / 2.0); + cairo_scale (cr, wiratio, wiratio); + cairo_translate (cr, - iw / 2.0, - ih / 2.0); - cairo_destroy (cr); + gdk_cairo_set_source_pixbuf (cr, image, 0, 0); + cairo_paint (cr); } gchar * @@ -382,8 +375,8 @@ matekbd_indicator_prepare_drawing (MatekbdIndicator * gki, int group) flag = gtk_drawing_area_new (); gtk_widget_add_events (GTK_WIDGET (flag), GDK_BUTTON_PRESS_MASK); - g_signal_connect (G_OBJECT (flag), "expose_event", - G_CALLBACK (flag_exposed), image); + g_signal_connect (G_OBJECT (flag), "draw", + G_CALLBACK (draw_flag), image); gtk_container_add (GTK_CONTAINER (ebox), flag); } else { char *lbl_title = NULL; |