summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-04-28 15:31:02 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-04-28 15:31:02 +0200
commit172063b2addc54a5bd376d4595673eac8b5d490e (patch)
tree3712866dc6e94da8790197ab2f9e4bf295dd72d7 /src/drivers
parent9ac73175be30f23ca2aaa23071909f19229e5982 (diff)
macOS: yet simpler implementation of window resize and rescale.
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H5
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx12
2 files changed, 16 insertions, 1 deletions
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H
index 1dca7f133..2e76fbe8f 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H
+++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H
@@ -82,7 +82,8 @@ private:
void shape_bitmap_(Fl_Image* b);
void shape_alpha_(Fl_Image* img, int offset);
CGRect* subRect_; // makes sure subwindow remains inside its parent window
- // stores 2 binary flags: whether window is mapped to retina display; whether resolution just changed
+ // stores 3 binary flags: whether window is mapped to retina display; whether resolution just changed;
+ // whether window's view received the [FLView view_did_resize] message
unsigned window_flags_;
public:
Fl_Cocoa_Window_Driver(Fl_Window*);
@@ -97,6 +98,8 @@ public:
void mapped_to_retina(bool); // sets whether window is mapped to retina display
bool changed_resolution(); // did window just moved to display with another resolution?
void changed_resolution(bool);// sets whether window just moved to display with another resolution
+ bool view_resized(); // did window's view receive [FLView view_did_resize] message?
+ void view_resized(bool b); // sets whether window's view received [FLView view_did_resize] message
CGRect* subRect() { return subRect_; } // getter
void subRect(CGRect *r) { subRect_ = r; } // setter
static void destroy(FLWindow*);
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx
index 9355f41ea..866ce0919 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx
+++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx
@@ -49,6 +49,7 @@ Fl_Cocoa_Window_Driver::Fl_Cocoa_Window_Driver(Fl_Window *win)
: Fl_Window_Driver(win)
{
cursor = nil;
+ window_flags_ = 0;
}
@@ -274,6 +275,7 @@ int Fl_Cocoa_Window_Driver::scroll(int src_x, int src_y, int src_w, int src_h, i
static const unsigned mapped_mask = 1;
static const unsigned changed_mask = 2;
+static const unsigned view_resized_mask = 4;
bool Fl_Cocoa_Window_Driver::mapped_to_retina() {
return window_flags_ & mapped_mask;
@@ -293,6 +295,16 @@ void Fl_Cocoa_Window_Driver::changed_resolution(bool b) {
else window_flags_ &= ~changed_mask;
}
+bool Fl_Cocoa_Window_Driver::view_resized() {
+ return window_flags_ & view_resized_mask;
+}
+
+void Fl_Cocoa_Window_Driver::view_resized(bool b) {
+ if (b) window_flags_ |= view_resized_mask;
+ else window_flags_ &= ~view_resized_mask;
+}
+
+
// clip the graphics context to rounded corners
void Fl_Cocoa_Window_Driver::clip_to_rounded_corners(CGContextRef gc, int w, int h) {
const CGFloat radius = 7.5;