Window position broken with WINVER

Hello,

I’ve changed WINVER and _WIN32_WINNT in Engine/Source/Programs/UnrealBuildTool/Windows/UEBuildWindows.cs as I need some features from ms media foundation that are only (Camera input)

That exposed below broken code in WindowsApplication.cpp. It should be:

CalculatedPopUpPosition->Set( WindowPos.left, WindowPos.top)

bool FWindowsApplication::TryCalculatePopupWindowPosition( const FPlatformRect& InAnchor, const 
                                                                                                      FVector2D& InSize, 
                                                                                                      const EPopUpOrientation::Type Orientation,
                                                                                                       /*OUT*/ FVector2D* const CalculatedPopUpPosition ) const
{
#if(_WIN32_WINNT >= 0x0601) 
    	POINT AnchorPoint = { FMath::TruncToInt(InAnchor.Left), FMath::TruncToInt(InAnchor.Top) };
        SIZE WindowSize = { FMath::TruncToInt(InSize.X), FMath::TruncToInt(InSize.Y) };

        RECT WindowPos;
        ::CalculatePopupWindowPosition( &AnchorPoint, &WindowSize, TPM_CENTERALIGN | TPM_VCENTERALIGN, NULL, &WindowPos );

        CalculatedPopUpPosition->Set( WindowPos.left, WindowPos.right );
        return true;
#else
        return false;
#endif
}

Actually code is more broken than just that. Popup menus require top/left alignment whereas tooltips should be centered as in above code. In other words for menus code should be:

::CalculatePopupWindowPosition( &AnchorPoint, &WindowSize, TPM_TOPALIGN | TPM_LEFTALIGN, NULL, &WindowPos );

However this code is called indiscriminately for tooltips and menus and thus can’t be fixed for both unless interface in FSlateApplication is changed. For now in my fork I’ve changed it to top/left as menus are more important than tooltips.

I guess I should also mention that copies of Windows SDK header files in Engine/Source/ThirdParty/Windows are incompatible with + SDKs

Hi iktomi,

Thanks for report! I’ve assigned a member of our team to look into this for you, and they’ll post here if need any additional information.

Hi iktomi,

Thank you for letting us know about this issue. I have entered a ticket to have this investigated further (UE-19753).

Ok. Thanks. Note that this is still broken in 4.9.0.

And still broken in 4.10

And still broken in 4.10.1

Hi Dav4723,

I checked status of ticket I entered for this issue, and it looks like it has already been updated to reflect your additional interest in issue. Unfortunately we do not yet have an estimate for when this will be corrected.

Here’s remainder of a workaround (in addition to changes mentioned above). Modify SMenuAnchor.cpp
according to this
Gist