DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L1891
Version: 1.1-current





Link: http://www.fltk.org/str.php?L1891
Version: 1.1-current
--- fl_read_image.cxx~
+++ fl_read_image.cxx
@@ -124,16 +124,17 @@
 
   if (!image) {
     // fetch absolute coordinates
-    int dx, dy;
+    int dx, dy, sx, sy, sw, sh;
     Window child_win;
-    XTranslateCoordinates(fl_display, fl_window,
-       RootWindow(fl_display, fl_screen), X, Y, &dx, &dy, &child_win);
+    Fl_Window* flw = fl_find(fl_window);
 
-    // screen dimensions
-    int sx, sy, sw, sh;
-    Fl::screen_xywh(sx, sy, sw, sh, fl_screen);
+    if (flw) {
+      XTranslateCoordinates(fl_display, fl_window,
+         RootWindow(fl_display, fl_screen), X, Y, &dx, &dy, &child_win);
+      Fl::screen_xywh(sx, sy, sw, sh, fl_screen);
+    }
 
-    if (dx >= sx && dy >= sy && dx + w <= sw && dy + h <= sh) {
+    if ( !flw  ||  (dx >= sx && dy >= sy && dx + w <= sw && dy + h <= sh)) {
       // the image is fully contained, we can use the traditional method
     image = XGetImage(fl_display, fl_window, X, Y, w, h, AllPlanes, ZPixmap);
     } else {
@@ -151,7 +152,7 @@
       if (!image) {
        if (buf) free(buf);
        return 0;
-  }
+      }
 
       if (!XGetSubImage(fl_display, fl_window, X + noffx, Y + noffy,
              nw, nh, AllPlanes, ZPixmap, image, noffx, noffy)) {
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to