diff options
author | raveit65 <[email protected]> | 2017-04-03 16:13:44 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2017-04-06 15:14:09 +0200 |
commit | db1705669d63a7d688e1e6507509906c9fc9d668 (patch) | |
tree | 0691caf6214638152b3d8c75c7daf7bbd036f90b | |
parent | 3611172a4debb5557534f50051bf6fbeebd5c7bf (diff) | |
download | libmatekbd-db1705669d63a7d688e1e6507509906c9fc9d668.tar.bz2 libmatekbd-db1705669d63a7d688e1e6507509906c9fc9d668.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; |