+ /* Some events only sent to main window. Check if the current window that
+ * the mouse is over is a child window. Below when handling some messages,
+ * we make sure that we process callbacks on the child window instead.
+ * This mirrors how GLUT does things.
+ */
+ if (window && window->Children.First)
+ {
+ POINT mouse_pos;
+ SFG_WindowHandleType hwnd;
+ SFG_Window* temp_window;
+
+ GetCursorPos( &mouse_pos );
+ ScreenToClient( window->Window.Handle, &mouse_pos );
+ hwnd = ChildWindowFromPoint(window->Window.Handle, mouse_pos);
+ if (hwnd) /* can be NULL if mouse outside parent by the time we get here */
+ {
+ temp_window = fgWindowByHandle(hwnd);
+ if (temp_window->Parent) /* Verify we got a child window */
+ child_window = temp_window;
+ }
+ }
+