mirror of
https://github.com/fltk/fltk.git
synced 2026-05-10 05:27:55 +08:00
Windows: Fix "If app appears on non-active screen …, window resizes" (#259)
The fix puts the first window an app creates on the screen containing the mouse, because the present window creation code needs to know on what screen a created window is going to appear before creating it.
This commit is contained in:
+3
-1
@@ -2190,9 +2190,11 @@ void Fl_WinAPI_Window_Driver::makeWindow() {
|
||||
Fl_Window *hint = Fl::first_window();
|
||||
if (hint) {
|
||||
nscreen = Fl_Window_Driver::driver(hint->top_window())->screen_num();
|
||||
} else {
|
||||
} else if (Fl::screen_driver()->screen_count() > 1 ) {
|
||||
int mx, my;
|
||||
nscreen = Fl::screen_driver()->get_mouse(mx, my);
|
||||
float s = Fl::screen_driver()->scale(nscreen);
|
||||
w->position(mx/s, my/s); // put the new window on same screen as mouse
|
||||
}
|
||||
}
|
||||
Fl_Window_Driver::driver(w)->screen_num(nscreen);
|
||||
|
||||
Reference in New Issue
Block a user