diff --git a/FL/Enumerations.H b/FL/Enumerations.H index 3a34f47a6..7ad8c531c 100644 --- a/FL/Enumerations.H +++ b/FL/Enumerations.H @@ -283,7 +283,11 @@ enum Fl_Event { // events If the widget returns 1, it will receive the data in the immediately following FL_PASTE event. */ - FL_DND_RELEASE = 23 + FL_DND_RELEASE = 23, + /** The screen configuration (number, positions) was changed. + Use Fl::add_handler() to be notified of this event. + */ + FL_SCREEN_CONFIGURATION_CHANGED = 24 }; /** \name When Conditions */ diff --git a/src/Fl.cxx b/src/Fl.cxx index 597fa2942..6264c4a30 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -776,8 +776,9 @@ static handler_link *handlers = 0; them returns non-zero then the event is ignored. Events that cause this to be called are: - - FL_SHORTCUT events that are not recognized by any widget. + - \ref FL_SHORTCUT events that are not recognized by any widget. This lets you provide global shortcut keys. + - \ref FL_SCREEN_CONFIGURATION_CHANGED events (not implemented on the X11 platform). - System events that FLTK does not recognize. See fl_xevent. - \e Some other events when the widget FLTK selected returns zero from its handle() method. Exactly which ones may change diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 801c848c2..67cae882c 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -1099,6 +1099,7 @@ void fl_open_callback(void (*cb)(const char *)) { [[NSNotificationCenter defaultCenter] postNotificationName:NSWindowDidMoveNotification object:win]; } } + Fl::handle(FL_SCREEN_CONFIGURATION_CHANGED, NULL); } - (void)applicationWillResignActive:(NSNotification *)notify { diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index 1774c416b..9adbfc9dd 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -1203,6 +1203,9 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar // unclear on what is correct: if (fl_msg.message == WM_RENDERALLFORMATS) CloseClipboard(); return 1;} + case WM_DISPLAYCHANGE: // occurs when screen configuration (number, position) changes + Fl::handle(FL_SCREEN_CONFIGURATION_CHANGED, NULL); + return 0; default: if (Fl::handle(0,0)) return 0;