From 8d7aad19808ef31b9181de100ddd159ca26340ca Mon Sep 17 00:00:00 2001 From: William Wold Date: Mon, 7 Jan 2019 04:13:42 -0500 Subject: Store fish surface size to enable rendering without backend specific code --- applets/fish/fish.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'applets/fish') diff --git a/applets/fish/fish.c b/applets/fish/fish.c index 3eb41cef..0ee7bcc4 100644 --- a/applets/fish/fish.c +++ b/applets/fish/fish.c @@ -81,6 +81,9 @@ typedef struct { GtkRequisition requisition; GdkRectangle prev_allocation; cairo_surface_t *surface; + gint surface_width; + gint surface_height; + guint timeout; int current_frame; gboolean in_applet; @@ -1414,6 +1417,8 @@ static void update_pixmap(FishApplet* fish) fish->surface = gdk_window_create_similar_surface (gtk_widget_get_window (widget), CAIRO_CONTENT_COLOR_ALPHA, width, height); + fish->surface_width = width; + fish->surface_height = height; gtk_widget_queue_resize (widget); @@ -1475,8 +1480,8 @@ static gboolean fish_applet_draw(GtkWidget* widget, cairo_t *cr, FishApplet* fis g_assert (fish->n_frames > 0); - width = cairo_image_surface_get_width (fish->surface); - height = cairo_image_surface_get_height (fish->surface); + width = fish->surface_width; + height = fish->surface_height; src_x = 0; src_y = 0; @@ -1519,6 +1524,8 @@ static void fish_applet_unrealize(GtkWidget* widget, FishApplet* fish) if (fish->surface) cairo_surface_destroy (fish->surface); fish->surface = NULL; + fish->surface_width = 0; + fish->surface_height = 0; } static void fish_applet_change_orient(MatePanelApplet* applet, MatePanelAppletOrient orientation) @@ -1804,6 +1811,8 @@ static void fish_applet_dispose (GObject *object) if (fish->surface) cairo_surface_destroy (fish->surface); fish->surface = NULL; + fish->surface_width = 0; + fish->surface_height = 0; if (fish->pixbuf) g_object_unref (fish->pixbuf); -- cgit v1.2.1