FLTK logo

[master] 11f4b5a - Fix "Fl_Double_Window::make_current() issues with Cairo drawing" (#1285)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Library      Forums      Links      Apps     Login 
[  All Forums  |  Back to fltk.commit  ]
 
[ Previous Message ] [ Next Message ]

[master] 11f4b5a - Fix "Fl_Double_Window::make_current() issues with Cairo drawing" (#1285) "ManoloFLTK" Aug 05, 2025  
 
commit 11f4b5a99215f329d429da4e4f964fef70978d19
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Tue Aug 5 10:14:07 2025 +0200
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Tue Aug 5 10:14:07 2025 +0200

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

 src/drivers/X11/Fl_X11_Screen_Driver.cxx | 8 +++++++-
 src/drivers/X11/Fl_X11_Window_Driver.cxx | 2 ++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git src/drivers/X11/Fl_X11_Screen_Driver.cxx src/drivers/X11/Fl_X11_Screen_Driver.cxx
index ad2958a..4fa3b86 100644
--- src/drivers/X11/Fl_X11_Screen_Driver.cxx
+++ 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);
diff --git src/drivers/X11/Fl_X11_Window_Driver.cxx src/drivers/X11/Fl_X11_Window_Driver.cxx
index 65a1944..37a2e92 100644
--- src/drivers/X11/Fl_X11_Window_Driver.cxx
+++ src/drivers/X11/Fl_X11_Window_Driver.cxx
@@ -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
[ Direct Link to Message ]
 
     
[ Previous Message ] [ Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2026 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.