FLTK logo

[branch-1.4] 3b6c451 - 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 ]

[branch-1.4] 3b6c451 - Fix "Fl_Double_Window::make_current() issues with Cairo drawing" (#1285) "ManoloFLTK" Aug 07, 2025  
 
commit 3b6c45125c7728cceed94d6e256f2cde5a7a1307
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Thu Aug 7 09:43:04 2025 +0200
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Thu Aug 7 09:43:22 2025 +0200

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

 src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx | 4 ++--
 src/drivers/X11/Fl_X11_Screen_Driver.cxx         | 8 +++++++-
 src/drivers/X11/Fl_X11_Window_Driver.cxx         | 4 +++-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
index 9d49a51..bed34d3 100644
--- src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
+++ src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
@@ -355,8 +355,8 @@ void Fl_Wayland_Window_Driver::make_current() {
   }
 
   // to support progressive drawing
-  if ( (!Fl_Wayland_Window_Driver::in_flush_) && window->buffer && (!window->frame_cb)
-      && window->buffer->draw_buffer_needs_commit && (!wait_for_expose_value) ) {
+  if ( (!Fl_Wayland_Window_Driver::in_flush_) && window->buffer && (!window->frame_cb) &&
+      (!wait_for_expose_value) ) {
     Fl_Wayland_Graphics_Driver::buffer_commit(window);
   }
 
diff --git src/drivers/X11/Fl_X11_Screen_Driver.cxx src/drivers/X11/Fl_X11_Screen_Driver.cxx
index 50a7260..40401b2 100644
--- src/drivers/X11/Fl_X11_Screen_Driver.cxx
+++ src/drivers/X11/Fl_X11_Screen_Driver.cxx
@@ -669,7 +669,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 4af030f..511b8ca 100644
--- src/drivers/X11/Fl_X11_Window_Driver.cxx
+++ src/drivers/X11/Fl_X11_Window_Driver.cxx
@@ -413,8 +413,10 @@ void Fl_X11_Window_Driver::make_current() {
       cairo_surface_destroy(s);
       cairo_save(cairo_);
     }
-    ((Fl_X11_Cairo_Graphics_Driver*)fl_graphics_driver)->set_cairo(cairo_);
+  } else if (other_xid) {
+    pWindow->damage(FL_DAMAGE_EXPOSE);
   }
+  if (cairo_) ((Fl_X11_Cairo_Graphics_Driver*)fl_graphics_driver)->set_cairo(cairo_);
   fl_graphics_driver->scale(scale);
 #elif USE_XFT
   ((Fl_Xlib_Graphics_Driver*)fl_graphics_driver)->scale(Fl::screen_driver()->scale(screen_num()));
[ 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'.