diff options
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx | 9 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx | 13 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Window_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Window_Driver.cxx | 12 |
6 files changed, 32 insertions, 5 deletions
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H index 70d1dffcf..33a47448c 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H +++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H @@ -108,6 +108,7 @@ public: // --- window data virtual int decorated_w(); virtual int decorated_h(); + virtual const Fl_Image* shape(); // --- window management virtual Fl_X *makeWindow(); diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx index 8fd33743d..764744f02 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx @@ -227,7 +227,10 @@ void Fl_Cocoa_Window_Driver::shape(const Fl_Image* img) { memset(shape_data_, 0, sizeof(shape_data_type)); pWindow->border(false); int d = img->d(); - if (d && img->count() >= 2) shape_pixmap_((Fl_Image*)img); + if (d && img->count() >= 2) { + shape_pixmap_((Fl_Image*)img); + shape_data_->shape_ = (Fl_Image*)img; + } else if (d == 0) shape_bitmap_((Fl_Image*)img); else if (d == 2 || d == 4) shape_alpha_((Fl_Image*)img, d - 1); else if ((d == 1 || d == 3) && img->count() == 1) shape_alpha_((Fl_Image*)img, 0); @@ -313,6 +316,10 @@ void Fl_Cocoa_Window_Driver::clip_to_rounded_corners(CGContextRef gc, int w, int CGContextClip(gc); } +const Fl_Image* Fl_Cocoa_Window_Driver::shape() { + return shape_data_ ? shape_data_->shape_ : NULL; +} + // // End of "$Id$". // diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H index 509326727..eabca3522 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H +++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H @@ -87,6 +87,7 @@ public: // --- window data virtual int decorated_w(); virtual int decorated_h(); + virtual const Fl_Image* shape(); // --- window management virtual Fl_X *makeWindow(); diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx index 3b6974330..27263b374 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx @@ -179,6 +179,7 @@ void Fl_WinAPI_Window_Driver::shape_alpha_(Fl_Image* img, int offset) { bitmap->alloc_array = 1; shape_bitmap_(bitmap); shape_data_->todelete_ = bitmap; + shape_data_->shape_ = img; } void Fl_WinAPI_Window_Driver::shape(const Fl_Image* img) { @@ -191,7 +192,10 @@ void Fl_WinAPI_Window_Driver::shape(const Fl_Image* img) { memset(shape_data_, 0, sizeof(shape_data_type)); pWindow->border(false); int d = img->d(); - if (d && img->count() >= 2) shape_pixmap_((Fl_Image*)img); + if (d && img->count() >= 2) { + shape_pixmap_((Fl_Image*)img); + shape_data_->shape_ = (Fl_Image*)img; + } else if (d == 0) shape_bitmap_((Fl_Image*)img); else if (d == 2 || d == 4) shape_alpha_((Fl_Image*)img, d - 1); else if ((d == 1 || d == 3) && img->count() == 1) shape_alpha_((Fl_Image*)img, 0); @@ -285,7 +289,8 @@ void Fl_WinAPI_Window_Driver::draw_begin() // size of window has changed since last time shape_data_->lw_ = s*w(); shape_data_->lh_ = s*h(); - Fl_Image* temp = shape_data_->shape_->copy(shape_data_->lw_, shape_data_->lh_); + Fl_Image* temp = shape_data_->todelete_ ? shape_data_->todelete_ : shape_data_->shape_; + temp = temp->copy(shape_data_->lw_, shape_data_->lh_); HRGN region = bitmap2region(temp); SetWindowRgn(fl_xid(pWindow), region, TRUE); // the system deletes the region when it's no longer needed delete temp; @@ -698,6 +703,10 @@ void Fl_WinAPI_Window_Driver::resize_after_screen_change(void *data) { data_for_resize_window_between_screens_.busy = false; } +const Fl_Image* Fl_WinAPI_Window_Driver::shape() { + return shape_data_ ? shape_data_->shape_ : NULL; +} + // // End of "$Id$". // diff --git a/src/drivers/X11/Fl_X11_Window_Driver.H b/src/drivers/X11/Fl_X11_Window_Driver.H index d31940018..0cef4d07f 100644 --- a/src/drivers/X11/Fl_X11_Window_Driver.H +++ b/src/drivers/X11/Fl_X11_Window_Driver.H @@ -99,6 +99,7 @@ public: // --- window data virtual int decorated_w(); virtual int decorated_h(); + virtual const Fl_Image* shape(); // --- window management virtual Fl_X *makeWindow(); diff --git a/src/drivers/X11/Fl_X11_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Window_Driver.cxx index 1d0af72e9..7a75e8188 100644 --- a/src/drivers/X11/Fl_X11_Window_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Window_Driver.cxx @@ -291,6 +291,7 @@ void Fl_X11_Window_Driver::shape_alpha_(Fl_Image* img, int offset) { bitmap->alloc_array = 1; shape_bitmap_(bitmap); shape_data_->todelete_ = bitmap; + shape_data_->shape_ = img; } void Fl_X11_Window_Driver::shape(const Fl_Image* img) { @@ -303,7 +304,10 @@ void Fl_X11_Window_Driver::shape(const Fl_Image* img) { memset(shape_data_, 0, sizeof(shape_data_type)); pWindow->border(false); int d = img->d(); - if (d && img->count() >= 2) shape_pixmap_((Fl_Image*)img); + if (d && img->count() >= 2) { + shape_pixmap_((Fl_Image*)img); + shape_data_->shape_ = (Fl_Image*)img; + } else if (d == 0) shape_bitmap_((Fl_Image*)img); else if (d == 2 || d == 4) shape_alpha_((Fl_Image*)img, d - 1); else if ((d == 1 || d == 3) && img->count() == 1) shape_alpha_((Fl_Image*)img, 0); @@ -333,7 +337,8 @@ void Fl_X11_Window_Driver::combine_mask() float s = Fl::screen_driver()->scale(screen_num()); shape_data_->lw_ = w()*s; shape_data_->lh_ = h()*s; - Fl_Image* temp = shape_data_->shape_->copy(shape_data_->lw_, shape_data_->lh_); + Fl_Image* temp = shape_data_->todelete_ ? shape_data_->todelete_ : shape_data_->shape_; + temp = temp->copy(shape_data_->lw_, shape_data_->lh_); Pixmap pbitmap = XCreateBitmapFromData(fl_display, fl_xid(pWindow), (const char*)*temp->data(), temp->w(), temp->h()); @@ -682,6 +687,9 @@ Fl_X *Fl_X11_Window_Driver::makeWindow() return Fl_X::i(pWindow); } +const Fl_Image* Fl_X11_Window_Driver::shape() { + return shape_data_ ? shape_data_->shape_ : NULL; +} #if USE_XFT |
