Skip to content

Commit

Permalink
oscplot: fix save as png
Browse files Browse the repository at this point in the history
correctly get window allocation
pass x and y coordinates to gdk_pixbuf_get_from_window

Signed-off-by: Cristina Suteu <[email protected]>
  • Loading branch information
cristina-suteu committed Oct 12, 2023
1 parent 6b9db82 commit 2823740
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion oscplot.c
Original file line number Diff line number Diff line change
Expand Up @@ -4436,13 +4436,15 @@ static void plot_destroyed (GtkWidget *object, OscPlot *plot)
static GdkPixbuf * window_get_screenshot_pixbuf(GtkWidget *window)
{
GdkWindow *gdk_w;
GtkAllocation allocation;
gint width, height;

gdk_w = gtk_widget_get_window(window);
gtk_widget_get_allocation(window, &allocation);
width = gdk_window_get_width(gdk_w);
height = gdk_window_get_height(gdk_w);

return gdk_pixbuf_get_from_window(gdk_w, 0, 0, width, height);
return gdk_pixbuf_get_from_window(gdk_w, allocation.x, allocation.y, width, height);
}

static void screenshot_saveas_png(OscPlot *plot)
Expand Down

0 comments on commit 2823740

Please sign in to comment.