FLTK logo

[master] 2ea85ea - Fix regression in fl_read_image() after introduction of hybrid Wayland/X11 platform.

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

[master] 2ea85ea - Fix regression in fl_read_image() after introduction of hybrid Wayland/X11 platform. "ManoloFLTK" Sep 11, 2022  
 
commit 2ea85ea6d7a9d377abcc01f4755d146dcbe30d60
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Sun Sep 11 09:15:42 2022 +0200
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Sun Sep 11 09:15:42 2022 +0200

    Fix regression in fl_read_image() after introduction of hybrid Wayland/X11 platform.
    
    The special use context of fl_read_image() inside the draw() function of an
    Fl_Double_Window, where the function should read inside the window's double buffer
    rather than the on-screen window, no longer worked.
    
    Removal of all uses of the fl_window global variable from platform-independent
    code remains necessary, because this variable is ill-defined in the Wayland/X11
    library.

 src/fl_read_image.cxx | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git src/fl_read_image.cxx src/fl_read_image.cxx
index 0d5f7ec..b345851 100644
--- src/fl_read_image.cxx
+++ src/fl_read_image.cxx
@@ -40,7 +40,9 @@
 uchar *fl_read_image(uchar *p, int X, int Y, int w, int h, int alpha) {
   uchar *image_data = NULL;
   Fl_RGB_Image *img;
-  if (Fl_Surface_Device::surface()->as_image_surface()) { // read from off_screen buffer
+  // TODO: strive to remove use of the fl_window global variable in platform-independent code
+  //if (Fl_Surface_Device::surface()->as_image_surface()) { // read from off_screen buffer
+  if (fl_find(fl_window)==0) { // read from off_screen buffer
     img = Fl::screen_driver()->read_win_rectangle(X, Y, w, h, 0);
     if (!img) {
       return NULL;
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

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