summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Copy_Surface.cxx9
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.H1
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.cxx17
3 files changed, 27 insertions, 0 deletions
diff --git a/src/Fl_Copy_Surface.cxx b/src/Fl_Copy_Surface.cxx
index 53881c62e..011d0f06d 100644
--- a/src/Fl_Copy_Surface.cxx
+++ b/src/Fl_Copy_Surface.cxx
@@ -63,6 +63,10 @@ int Fl_Copy_Surface::printable_rect(int *w, int *h) {
return 1;
}
+void Fl_Copy_Surface::draw_decorated_window(Fl_Window *win, int x_offset, int y_offset) {
+ if (platform_surface) platform_surface->draw_decorated_window(win, x_offset, y_offset);
+}
+
/**
\cond DriverDev
\addtogroup DriverDeveloper
@@ -72,6 +76,11 @@ int Fl_Copy_Surface_Driver::printable_rect(int *w, int *h) {
*w = width; *h = height;
return 0;
}
+
+void Fl_Copy_Surface_Driver::draw_decorated_window(Fl_Window *win, int x_offset, int y_offset) {
+ Fl_Widget_Surface::draw_decorated_window(win, x_offset, y_offset);
+}
+
/**
\}
\endcond
diff --git a/src/drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.H b/src/drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.H
index 37751419b..938600dac 100644
--- a/src/drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.H
+++ b/src/drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.H
@@ -37,6 +37,7 @@ protected:
void set_current();
void translate(int x, int y);
void untranslate();
+ virtual void draw_decorated_window(Fl_Window *win, int x_offset, int y_offset);
};
#endif /* Fl_Quartz_Copy_Surface_Driver_H */
diff --git a/src/drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.cxx b/src/drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.cxx
index 4fe51c513..b5d09344f 100644
--- a/src/drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.cxx
@@ -23,6 +23,7 @@
#include <FL/platform.H>
#include "Fl_Quartz_Graphics_Driver.H"
#include "Fl_Quartz_Copy_Surface_Driver.H"
+#include "../Cocoa/Fl_Cocoa_Window_Driver.H"
/**
\cond DriverDev
@@ -98,6 +99,22 @@ void Fl_Quartz_Copy_Surface_Driver::untranslate() {
CGContextRestoreGState(gc);
}
+void Fl_Quartz_Copy_Surface_Driver::draw_decorated_window(Fl_Window *win, int x_offset, int y_offset) {
+ CALayer *layer = Fl_Cocoa_Window_Driver::driver(win)->get_titlebar_layer();
+ if (!layer) {
+ return Fl_Widget_Surface::draw_decorated_window(win, x_offset, y_offset);
+ }
+ CGContextRef gc = (CGContextRef)driver()->gc();
+ CGContextSaveGState(gc);
+ int bt = win->decorated_h() - win->h();
+ CGContextTranslateCTM(gc, x_offset - 0.5, y_offset + bt - 0.5);
+ float s = Fl::screen_scale(win->screen_num());
+ CGContextScaleCTM(gc, 1/s, s >= 1 ? -1/s : -1);
+ Fl_Cocoa_Window_Driver::draw_layer_to_context(layer, gc, win->w() * s, bt);
+ CGContextRestoreGState(gc);
+ draw(win, x_offset, y_offset + bt); // print the window inner part
+}
+
#endif // FL_CFG_GFX_QUARTZ
//