[Bug 5725] New: Code for undocumented SwitchToThisWindow function does not reflect empirical evidence

Wine Bugs wine-bugs at winehq.org
Thu Jul 20 08:36:08 CDT 2006


http://bugs.winehq.org/show_bug.cgi?id=5725

           Summary: Code for undocumented SwitchToThisWindow function does
                    not reflect empirical evidence
           Product: Wine
           Version: unspecified
          Platform: All
               URL: http://source.winehq.org/source/dlls/user/winpos.c#L153
        OS/Version: All
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: wine-gui
        AssignedTo: wine-bugs at winehq.org
        ReportedBy: neil at parkwaycc.co.uk


void WINAPI SwitchToThisWindow( HWND hwnd, BOOL restore )
{
    ShowWindow( hwnd, restore ? SW_RESTORE : SW_SHOWMINIMIZED );
}
1. SwitchToThisWindow never minimizes a window
2. The restore flag only applies to minimised windows
3. If restore is false then the foreground window is sent to the back
   (even if it was the hwnd) unless it is a topmost window.
So, the code should look something like this:
void WINAPI SwitchToThisWindow( HWND hwnd, BOOL restore )
{
    HWND hwndOld = GetForegroundWindow();
    SetForegroundWindow( hWnd );
    if ( restore )
    {
        if ( IsIconic( hwnd ) )
            ShowWindow( hwnd, SW_RESTORE );
    }
    else
    {
        if ( !( GetWindowLong( hwndOld, GWL_EXSTYLE ) & WS_EX_TOPMOST ) )
            SetWindowPos( hWndOld, HWNDBOTTOM, 0, 0, 0, 0,
                SWP_NOMOVE | SWP_NOSIZE );
    }
}
(sorry I don't know a better way of testing for a topmost window)

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the wine-bugs mailing list