-#if TARGET_CARBON
- BeginAppModalStateForWindow( (WindowRef) MacGetWindowRef()) ;
-#else
- // TODO : test whether parent gets disabled
- bool formerModal = s_macIsInModalLoop ;
- s_macIsInModalLoop = true ;
-#endif
+ WindowRef windowRef = (WindowRef) MacGetWindowRef();
+ WindowGroupRef windowGroup;
+ WindowGroupRef formerParentGroup;
+ bool resetGroupParent = false;
+
+ if ( GetParent() == NULL )
+ {
+ windowGroup = GetWindowGroup(windowRef) ;
+ formerParentGroup = GetWindowGroupParent( windowGroup );
+ SetWindowGroupParent( windowGroup, GetWindowGroupOfClass( kMovableModalWindowClass ) );
+ resetGroupParent = true;
+ }
+ BeginAppModalStateForWindow(windowRef) ;