diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2019-05-22 21:33:02 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2019-05-22 21:33:02 +0200 |
| commit | b2c027fa83fea660446f338c731201da76c49dca (patch) | |
| tree | a1938836fa9ded607852547d12d7fc8a26b841ab /src/drivers | |
| parent | 277cee73b0a888894b5a68c239f4d26780830e8e (diff) | |
Implement Fl_Quartz_Copy_Surface_Driver::draw_decorated_window()
The window title is copied in vectorial form when the titlebar is layer-backed.
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.cxx | 17 |
2 files changed, 18 insertions, 0 deletions
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 // |
