diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index e7539737f..e7d92a206 100644
@@ -572,16 +572,16 @@ class Fl_Win32_At_Exit {
public:
Fl_Win32_At_Exit() {}
~Fl_Win32_At_Exit() {
- fl_free_fonts(); // do some Windows cleanup
- fl_cleanup_pens();
- OleUninitialize();
- if (fl_graphics_driver) fl_brush_action(1);
- fl_cleanup_dc_list();
- // This is actually too late in the cleanup process to remove the
- // clipboard notifications, but we have no earlier hook so we try
- // to work around it anyway.
- if (clipboard_wnd != NULL)
- fl_clipboard_notify_untarget(clipboard_wnd);
+ // fl_free_fonts(); // do some Windows cleanup
+ // fl_cleanup_pens();
+ // OleUninitialize();
+ // if (fl_graphics_driver) fl_brush_action(1);
+ // fl_cleanup_dc_list();
+ // // This is actually too late in the cleanup process to remove the
+ // // clipboard notifications, but we have no earlier hook so we try
+ // // to work around it anyway.
+ // if (clipboard_wnd != NULL)
+ // fl_clipboard_notify_untarget(clipboard_wnd);
#if USE_GDIPLUS
Fl_GDIplus_Graphics_Driver::shutdown();
#endif
@@ -1200,6 +1200,8 @@ static Fl_Window *resize_bug_fix;
extern void fl_save_pen(void);
extern void fl_restore_pen(void);
+static bool left_window = true;
+
static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
// Copy the message to fl_msg so add_handler code can see it.
@@ -1373,6 +1375,14 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
}
case WM_MOUSEMOVE:
+ if (left_window) {
+ Fl_Window *tw = window;
+ while (tw->parent()) // find top level window
+ tw = tw->window();
+ Fl::handle(FL_ENTER, tw);
+ left_window = false;
+ return 0;
+ }
#ifdef USE_TRACK_MOUSE
if (track_mouse_win != window) {
TRACKMOUSEEVENT tme;
@@ -1392,6 +1402,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
while (tw->parent()) // find top level window
tw = tw->window();
Fl::belowmouse(0);
+ left_window = true;
Fl::handle(FL_LEAVE, tw);
}
track_mouse_win = 0; // force TrackMouseEvent() restart