locked
CoreWindow::Bounds doesn't respect orientation

    General discussion

  • I'm currently handling a bug in our game. Our game is set to be only Landscape or LandscapeFlipped. If we start in Portrait, however, the following all seem to be true.

    CoreWindow::GetForCurrentThread()->Bounds.Height > CoreWindow::GetForCurrentThread()->Bounds.Width

    DisplayInformation::GetForCurrentView()->CurrentOrientation == Landscape

    DisplayInformation::GetForCurrentView()->NativeOrientation == Landscape

    This seems internally-inconsistent. How can everything about orientation declare 'landscape' when the bounds of the window is quite clearly portrait? Seems like an API bug.

    My fix for now is a hack. If the orientation is landscape but the bounds are taller than wide, then swap the width & height.


    TedHoward

    Friday, January 30, 2015 4:59 AM

All replies

  • Monday, February 2, 2015 6:31 AM
  • It's not quite a bug since it's an API. If the API is assumed to be broken and then fixed, it will likely break many existing apps. So, the issue is more about documentation and obsolescence.

    TedHoward

    Monday, February 2, 2015 8:23 AM
  • Thanks Ted,

    I'll take a look into this. You may be right that it needs to be documented for compatibility reasons rather than changed. Comparing bounds is generally recommended for flexibility when handling different window sizes.

    Captain JackZ, there isn't currently a connect site for Windows issues. The best place to report Windows Store app dev bugs is here in the forums.

    --Rob

    Thursday, February 5, 2015 5:46 PM
    Moderator