summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fl_read_image.cxx20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/fl_read_image.cxx b/src/fl_read_image.cxx
index e2d6b61e2..da48d5ea1 100644
--- a/src/fl_read_image.cxx
+++ b/src/fl_read_image.cxx
@@ -124,18 +124,18 @@ fl_read_image(uchar *p, // I - Pixel buffer or NULL to allocate
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);
-
- // screen dimensions
- int sx, sy, sw, sh;
- Fl::screen_xywh(sx, sy, sw, sh, fl_screen);
-
- if (dx >= sx && dy >= sy && dx + w <= sw && dy + h <= sh) {
+ Fl_Window *win = fl_find(fl_window);
+ if (win) {
+ XTranslateCoordinates(fl_display, fl_window,
+ RootWindow(fl_display, fl_screen), X, Y, &dx, &dy, &child_win);
+ // screen dimensions
+ Fl::screen_xywh(sx, sy, sw, sh, fl_screen);
+ }
+ if (!win || (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);
+ image = XGetImage(fl_display, fl_window, X, Y, w, h, AllPlanes, ZPixmap);
} else {
// image is crossing borders, determine visible region
int nw, nh, noffx, noffy;