Skip to content

Commit 8d7aad1

Browse files
wmwwlukefromdc
authored andcommitted
Store fish surface size to enable rendering without backend specific code
1 parent c4b2b33 commit 8d7aad1

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

applets/fish/fish.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ typedef struct {
8181
GtkRequisition requisition;
8282
GdkRectangle prev_allocation;
8383
cairo_surface_t *surface;
84+
gint surface_width;
85+
gint surface_height;
86+
8487
guint timeout;
8588
int current_frame;
8689
gboolean in_applet;
@@ -1414,6 +1417,8 @@ static void update_pixmap(FishApplet* fish)
14141417
fish->surface = gdk_window_create_similar_surface (gtk_widget_get_window (widget),
14151418
CAIRO_CONTENT_COLOR_ALPHA,
14161419
width, height);
1420+
fish->surface_width = width;
1421+
fish->surface_height = height;
14171422

14181423
gtk_widget_queue_resize (widget);
14191424

@@ -1475,8 +1480,8 @@ static gboolean fish_applet_draw(GtkWidget* widget, cairo_t *cr, FishApplet* fis
14751480

14761481
g_assert (fish->n_frames > 0);
14771482

1478-
width = cairo_image_surface_get_width (fish->surface);
1479-
height = cairo_image_surface_get_height (fish->surface);
1483+
width = fish->surface_width;
1484+
height = fish->surface_height;
14801485
src_x = 0;
14811486
src_y = 0;
14821487

@@ -1519,6 +1524,8 @@ static void fish_applet_unrealize(GtkWidget* widget, FishApplet* fish)
15191524
if (fish->surface)
15201525
cairo_surface_destroy (fish->surface);
15211526
fish->surface = NULL;
1527+
fish->surface_width = 0;
1528+
fish->surface_height = 0;
15221529
}
15231530

15241531
static void fish_applet_change_orient(MatePanelApplet* applet, MatePanelAppletOrient orientation)
@@ -1804,6 +1811,8 @@ static void fish_applet_dispose (GObject *object)
18041811
if (fish->surface)
18051812
cairo_surface_destroy (fish->surface);
18061813
fish->surface = NULL;
1814+
fish->surface_width = 0;
1815+
fish->surface_height = 0;
18071816

18081817
if (fish->pixbuf)
18091818
g_object_unref (fish->pixbuf);

0 commit comments

Comments
 (0)