mirror of https://github.com/fltk/fltk
macOS platform: compute the screen number where a top window is mapped.
This commit is contained in:
parent
9154291940
commit
8bf62c67cf
|
@ -1234,6 +1234,10 @@ static FLWindowDelegate *flwindowdelegate_instance = nil;
|
|||
if (window->parent()) [nsw recursivelySendToSubwindows:@selector(checkSubwindowFrame) applyToSelf:YES];
|
||||
starting_moved_window = NULL;
|
||||
}
|
||||
if (!window->parent()) {
|
||||
int nscreen = Fl::screen_num(window->x(), window->y(), window->w(), window->h());
|
||||
Fl_Window_Driver::driver(window)->screen_num(nscreen);
|
||||
}
|
||||
fl_unlock_function();
|
||||
}
|
||||
- (void)view_did_resize:(NSNotification *)notif
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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_;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue