From c0c2cf7d408fc6bfefd9eecbfe5aabcbc4d55ff3 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Wed, 8 Jan 2025 14:37:57 +0100 Subject: Make draw to image and draw to clipboard behave equally in X11 and Wayland --- src/drivers/Cairo/Fl_X11_Cairo_Graphics_Driver.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/drivers/Cairo') diff --git a/src/drivers/Cairo/Fl_X11_Cairo_Graphics_Driver.cxx b/src/drivers/Cairo/Fl_X11_Cairo_Graphics_Driver.cxx index 3ad9a0d88..926121bdb 100644 --- a/src/drivers/Cairo/Fl_X11_Cairo_Graphics_Driver.cxx +++ b/src/drivers/Cairo/Fl_X11_Cairo_Graphics_Driver.cxx @@ -48,8 +48,13 @@ void Fl_X11_Cairo_Graphics_Driver::scale(float f) { } -void Fl_X11_Cairo_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy) { - XCopyArea(fl_display, pixmap, fl_window, (GC)Fl_Graphics_Driver::default_driver().gc(), int(srcx*scale()), int(srcy*scale()), int(w*scale()), int(h*scale()), int(x*scale()), int(y*scale())); +void Fl_X11_Cairo_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, + Fl_Offscreen pixmap, int srcx, int srcy) { + cairo_matrix_t mat; + if (cairo_) cairo_get_matrix(cairo_, &mat); + else cairo_matrix_init_identity(&mat); + XCopyArea(fl_display, pixmap, fl_window, (GC)Fl_Graphics_Driver::default_driver().gc(), int(srcx*scale()), int(srcy*scale()), int(w*scale()), int(h*scale()), + int(x*scale()) + mat.x0, int(y*scale()) + mat.y0); } -- cgit v1.2.3