summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2018-03-08 23:09:23 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2018-03-08 23:09:23 +0000
commit12f628514771294102d2aa961373373a95ddab6b (patch)
treedc36d796106498de29b2c90d813d9d77dce041c2 /src/drivers
parentad10e4adaf9206499b695b46137a8b8b0272b45e (diff)
Fix X11 clip region outside 16-bit coordinate space.
This is the first commit of X11 16-bit coordinate space (clipping) fixes. More to follow... git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12722 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx
index 10d6f4875..bf1edd3ac 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx
@@ -143,11 +143,16 @@ int Fl_Xlib_Graphics_Driver::clip_x (int x) {
// Missing X call: (is this the fastest way to init a 1-rectangle region?)
// Windows equivalent exists, implemented inline in win32.H
+
+// Note: if the entire region is outside the 16-bit X coordinate space an empty
+// clipping region is returned which means that *nothing* will be visible.
+
Fl_Region Fl_Xlib_Graphics_Driver::XRectangleRegion(int x, int y, int w, int h) {
XRectangle R;
- clip_to_short(x, y, w, h, line_width_);
+ Fl_Region r = XCreateRegion(); // create an empty region
+ if (clip_to_short(x, y, w, h, line_width_)) // outside X coordinate space
+ return r;
R.x = x; R.y = y; R.width = w; R.height = h;
- Fl_Region r = XCreateRegion();
XUnionRectWithRegion(&R, r, r);
return r;
}