summaryrefslogtreecommitdiff
path: root/src/drivers/X11/Fl_X11_Screen_Driver.cxx
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2025-08-05 10:14:07 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2025-08-05 10:14:07 +0200
commit11f4b5a99215f329d429da4e4f964fef70978d19 (patch)
treee9e18b9d8e616ce98388928d5f67c1a73a0f71f2 /src/drivers/X11/Fl_X11_Screen_Driver.cxx
parent8bcf65fa660beeaf1c1f16bc113cb275026fcb65 (diff)
Fix "Fl_Double_Window::make_current() issues with Cairo drawing" (#1285)
Diffstat (limited to 'src/drivers/X11/Fl_X11_Screen_Driver.cxx')
-rw-r--r--src/drivers/X11/Fl_X11_Screen_Driver.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.cxx b/src/drivers/X11/Fl_X11_Screen_Driver.cxx
index ad2958a36..4fa3b8698 100644
--- a/src/drivers/X11/Fl_X11_Screen_Driver.cxx
+++ b/src/drivers/X11/Fl_X11_Screen_Driver.cxx
@@ -670,7 +670,13 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int
//
int allow_outside = w < 0; // negative w allows negative X or Y, that is, window frame
if (w < 0) w = - w;
- Window xid = (win && !allow_outside ? fl_xid(win) : fl_window);
+ Window xid;
+ if (win && !allow_outside) {
+ if (win->as_double_window()) { // read from the window's offscreen buffer
+ xid = Fl_X11_Window_Driver::driver(win)->other_xid->offscreen();
+ win = NULL;
+ } else xid = fl_xid(win);
+ } else xid = fl_window;
float s = allow_outside ? 1 : Fl_Surface_Device::surface()->driver()->scale();
int Xs = Fl_Scalable_Graphics_Driver::floor(X, s);