diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2021-12-06 10:18:13 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2021-12-06 10:18:29 +0100 |
| commit | 8bf62c67cfb8349064e2d2104ce9049a233fd914 (patch) | |
| tree | 0f5a13c9d0292cce0b5111a66277fe070844fa22 /src/drivers/Cocoa | |
| parent | 915429194022a5e2823f0d9ce57c06e03a753363 (diff) | |
macOS platform: compute the screen number where a top window is mapped.
Diffstat (limited to 'src/drivers/Cocoa')
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H | 3 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx | 10 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H index 6f0f11d3f..4bc7d3783 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H +++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H @@ -85,6 +85,7 @@ private: // 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_; + int screen_num_; // number of screen where window is mapped public: Fl_Cocoa_Window_Driver(Fl_Window*); ~Fl_Cocoa_Window_Driver(); @@ -133,6 +134,8 @@ public: virtual void size_range(); virtual void iconize(); virtual void decoration_sizes(int *top, int *left, int *right, int *bottom); + virtual int screen_num(); + virtual void screen_num(int n); // --- window cursor stuff virtual int set_cursor(Fl_Cursor); virtual int set_cursor(const Fl_RGB_Image*, int, int); diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx index f9ba65683..7cb411418 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx @@ -51,6 +51,7 @@ Fl_Cocoa_Window_Driver::Fl_Cocoa_Window_Driver(Fl_Window *win) cursor = nil; window_flags_ = 0; icon_image = NULL; + screen_num_ = 0; } @@ -342,3 +343,12 @@ void Fl_Cocoa_Window_Driver::capture_titlebar_and_borders(Fl_RGB_Image*& top, Fl top->scale(w(),htop, s <1 ? 0 : 1, 1); CGContextRelease(auxgc); } + +void Fl_Cocoa_Window_Driver::screen_num(int n) { + screen_num_ = n; +} + +int Fl_Cocoa_Window_Driver::screen_num() { + if (pWindow->parent()) return pWindow->top_window()->screen_num(); + else return screen_num_; +} |
