summaryrefslogtreecommitdiff
path: root/src/drivers/X11
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/X11')
-rw-r--r--src/drivers/X11/Fl_X11_Screen_Driver.H2
-rw-r--r--src/drivers/X11/Fl_X11_Screen_Driver.cxx7
-rw-r--r--src/drivers/X11/Fl_X11_Window_Driver.cxx29
3 files changed, 19 insertions, 19 deletions
diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.H b/src/drivers/X11/Fl_X11_Screen_Driver.H
index 0d1bcaf0e..2585cb972 100644
--- a/src/drivers/X11/Fl_X11_Screen_Driver.H
+++ b/src/drivers/X11/Fl_X11_Screen_Driver.H
@@ -79,7 +79,7 @@ public:
virtual int compose(int &del);
virtual void compose_reset();
virtual int text_display_can_leak();
- virtual uchar *read_win_rectangle(uchar *p, int X, int Y, int w, int h, int alpha);
+ virtual Fl_RGB_Image *read_win_rectangle(uchar *p, int X, int Y, int w, int h, int alpha);
virtual void get_mouse(int &x, int &y);
virtual void enable_im();
virtual void disable_im();
diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.cxx b/src/drivers/X11/Fl_X11_Screen_Driver.cxx
index 5eeb2a1b6..f8bf520b1 100644
--- a/src/drivers/X11/Fl_X11_Screen_Driver.cxx
+++ b/src/drivers/X11/Fl_X11_Screen_Driver.cxx
@@ -750,7 +750,7 @@ extern "C" {
}
}
-uchar *Fl_X11_Screen_Driver::read_win_rectangle(uchar *p, int X, int Y, int w, int h, int alpha)
+Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(uchar *p, int X, int Y, int w, int h, int alpha)
{
XImage *image; // Captured image
int i, maxindex; // Looping vars
@@ -858,6 +858,7 @@ uchar *Fl_X11_Screen_Driver::read_win_rectangle(uchar *p, int X, int Y, int w, i
d = alpha ? 4 : 3;
// Allocate the image data array as needed...
+ const uchar *oldp = p;
if (!p) p = new uchar[w * h * d];
// Initialize the default colors/alpha in the whole image...
@@ -1157,7 +1158,9 @@ uchar *Fl_X11_Screen_Driver::read_win_rectangle(uchar *p, int X, int Y, int w, i
// Destroy the X image we've read and return the RGB(A) image...
XDestroyImage(image);
- return p;
+ Fl_RGB_Image *rgb = new Fl_RGB_Image(p, w, h, d);
+ if (!oldp) rgb->alloc_array = 1;
+ return rgb;
}
//
diff --git a/src/drivers/X11/Fl_X11_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Window_Driver.cxx
index 07f9c5407..6fc76e325 100644
--- a/src/drivers/X11/Fl_X11_Window_Driver.cxx
+++ b/src/drivers/X11/Fl_X11_Window_Driver.cxx
@@ -402,26 +402,23 @@ void Fl_X11_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top, F
if (!do_it) wsides = htop = 0;
int hbottom = wsides;
fl_window = parent;
- uchar *rgb;
if (htop) {
- rgb = Fl::screen_driver()->read_win_rectangle(NULL, 0, 0, - (w() + 2 * wsides), htop, 0);
- r_top = new Fl_RGB_Image(rgb, w() + 2 * wsides, htop, 3);
- r_top->alloc_array = 1;
+ r_top = Fl::screen_driver()->read_win_rectangle(NULL, 0, 0, - (w() + 2 * wsides), htop, 0);
top = Fl_Shared_Image::get(r_top);
}
if (wsides) {
- rgb = Fl::screen_driver()->read_win_rectangle(NULL, 0, htop, -wsides, h(), 0);
- r_left = new Fl_RGB_Image(rgb, wsides, h(), 3);
- r_left->alloc_array = 1;
- left = Fl_Shared_Image::get(r_left);
- rgb = Fl::screen_driver()->read_win_rectangle(NULL, w() + wsides, htop, -wsides, h(), 0);
- r_right = new Fl_RGB_Image(rgb, wsides, h(), 3);
- r_right->alloc_array = 1;
- right = Fl_Shared_Image::get(r_right);
- rgb = Fl::screen_driver()->read_win_rectangle(NULL, 0, htop + h(), -(w() + 2*wsides), hbottom, 0);
- r_bottom = new Fl_RGB_Image(rgb, w() + 2*wsides, hbottom, 3);
- r_bottom->alloc_array = 1;
- bottom = Fl_Shared_Image::get(r_bottom);
+ r_left = Fl::screen_driver()->read_win_rectangle(NULL, 0, htop, -wsides, h(), 0);
+ if (r_left) {
+ left = Fl_Shared_Image::get(r_left);
+ }
+ r_right = Fl::screen_driver()->read_win_rectangle(NULL, w() + wsides, htop, -wsides, h(), 0);
+ if (r_right) {
+ right = Fl_Shared_Image::get(r_right);
+ }
+ r_bottom = Fl::screen_driver()->read_win_rectangle(NULL, 0, htop + h(), -(w() + 2*wsides), hbottom, 0);
+ if (r_bottom) {
+ bottom = Fl_Shared_Image::get(r_bottom);
+ }
}
fl_window = from;
previous->Fl_Surface_Device::set_current();