From c029bba113a2a28d858ac6d25607ccb870a6928a Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Fri, 30 Sep 2011 08:03:22 +0000 Subject: Fix STR#2600 for the MSWindow and Mac OS platforms. A new event FL_SCREEN_CONFIGURATION_CHANGED is introduced. Fl::add_handler() allows to register a callback for this event. The unix/X11 implementation is still missing. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9087 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl.cxx | 3 ++- src/Fl_cocoa.mm | 1 + src/Fl_win32.cxx | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') 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; -- cgit v1.2.3