Fix "Fl_Double_Window::make_current() issues with Cairo drawing" (#1285)

This commit is contained in:
ManoloFLTK 2025-08-05 10:14:07 +02:00
parent 8bcf65fa66
commit 11f4b5a992
2 changed files with 9 additions and 1 deletions

View File

@ -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);

View File

@ -417,6 +417,8 @@ void Fl_X11_Window_Driver::make_current() {
cairo_save(cairo_);
}
((Fl_X11_Cairo_Graphics_Driver*)fl_graphics_driver)->set_cairo(cairo_);
} else if (other_xid) {
pWindow->damage(FL_DAMAGE_EXPOSE);
}
fl_graphics_driver->scale(scale);
#elif USE_XFT