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
This commit is contained in:
Manolo Gouy 2011-09-30 08:03:22 +00:00
parent 9f9c16ac16
commit c029bba113
4 changed files with 11 additions and 2 deletions

View File

@ -283,7 +283,11 @@ enum Fl_Event { // events
If the widget returns 1, it will receive the data in the immediately If the widget returns 1, it will receive the data in the immediately
following FL_PASTE event. 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 */ /** \name When Conditions */

View File

@ -776,8 +776,9 @@ static handler_link *handlers = 0;
them returns non-zero then the event is ignored. Events that cause them returns non-zero then the event is ignored. Events that cause
this to be called are: 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. 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. - System events that FLTK does not recognize. See fl_xevent.
- \e Some other events when the widget FLTK selected returns - \e Some other events when the widget FLTK selected returns
zero from its handle() method. Exactly which ones may change zero from its handle() method. Exactly which ones may change

View File

@ -1099,6 +1099,7 @@ void fl_open_callback(void (*cb)(const char *)) {
[[NSNotificationCenter defaultCenter] postNotificationName:NSWindowDidMoveNotification object:win]; [[NSNotificationCenter defaultCenter] postNotificationName:NSWindowDidMoveNotification object:win];
} }
} }
Fl::handle(FL_SCREEN_CONFIGURATION_CHANGED, NULL);
} }
- (void)applicationWillResignActive:(NSNotification *)notify - (void)applicationWillResignActive:(NSNotification *)notify
{ {

View File

@ -1203,6 +1203,9 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
// unclear on what is correct: // unclear on what is correct:
if (fl_msg.message == WM_RENDERALLFORMATS) CloseClipboard(); if (fl_msg.message == WM_RENDERALLFORMATS) CloseClipboard();
return 1;} return 1;}
case WM_DISPLAYCHANGE: // occurs when screen configuration (number, position) changes
Fl::handle(FL_SCREEN_CONFIGURATION_CHANGED, NULL);
return 0;
default: default:
if (Fl::handle(0,0)) return 0; if (Fl::handle(0,0)) return 0;