Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Vista auto-fullscreen-detection disabling aero?

  1. #1
    Intern Newbie
    Join Date
    Nov 2002
    Posts
    37

    Vista auto-fullscreen-detection disabling aero?

    I'm working on OpenGL based game on windows. If I make the window with the OpenGL context cover the whole screen, it seems that Vista automatically flags the app as being 'full screen', and disables aero to boost performance. I don't even have to call ChangeDisplaySettings(..., CDS_FULLSCREEN) - It is entirely automatic!

    Now, the problem is, what if I don't want it do that? I would like to control myself whether aero is disabled (or not disabled, as the case may be). Enabling or disabling aero is a fairly disruptive event, taking up to 10 seconds to complete and flashing the screen several times. And this happens every time the user alt-tabs to/from our game.

    Frankly, I don't understand why Microsoft would do this. If an application wants fullscreen mode, it can specify that by calling ChangeDisplaySettings with CDS_FULLSCREEN. That's how it worked on XP so everyone is doing it already anyway.

    I have noticed that some other apps that do hardware accelerated 3D, specifically VLC and Media Player Classic, CAN toggle between windowed and fullscreen without causing aero to get toggled. I don't know if they use OpenGL though.

    So, my question is, does anyone know anything about this automatic fullscreen thing in Vista, and how to control it? I apologise in advance if my google-fu is weak, but I just couldn't find anything related to this at all. Not in the documentation or on the net in general.

  2. #2
    Member Regular Contributor
    Join Date
    Oct 2006
    Posts
    349

    Re: Vista auto-fullscreen-detection disabling aero?

    Windows define "fullscreen" as a WS_POPUP, SW_MAXIMIZE, topmost window. This is the same as XP, only XP doesn't have Aero so the transition is less jarring. (Don't believe me? Try using 'print screen' on an application with those styles).

    CDS_FULLSCREEN is completely orthogonal to that - this is merely a hint to restore the original display settings when the application exits. CDS_FULLSCREEN does *not* in any way affect whether an application is considered fullscreen or not (you can ChangeDisplaySettings(CDS_FULLSCREEN) and keep your application windowed just fine).

    So how can you create a maximized, borderless window that doesn't trigger the "fullscreen" effect? To the best of my knowledge, you can only do this by *not* using SW_MAXIMIZE on the window. Instead, make it fixed size and resize it so that it covers the whole monitor (or working area, if you wish to keep the taskbar intact). Annoying, but this seems to be a very common workaround that (I can confirm) works fine. The only issue is that you need to respond to display change events, if you don't wish your application to look broken.

    If you manage to find a better solution, please post it!


  3. #3
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: Vista auto-fullscreen-detection disabling aero?

    VLC on windows and Media Player Classic do not use GL by default.
    For vlc you can force it somewhere on the advanced settings, that way you can check if vlc is affected too.

  4. #4
    Intern Newbie
    Join Date
    Nov 2002
    Posts
    37

    Re: Vista auto-fullscreen-detection disabling aero?

    Thank you both for the replies. That's interesting - and good to know - about CDS_FULLSCREEN being orthogonal to windows considering the app to be fullscreen.

    I've done some further investigation. VLC under OpenGL does not experience the problem.

    Stephen A is correct about it being related to the window flags, but my tests indicate it also has to do with OpenGL. If I use the same combination of flags that causes the problem, but just BitBlt a bitmap instead of using OpenGL, then aero does not get disabled.

    According to my experiments, the condition appears to be something like this:

    disableAero = usingOpenGL && (windowRect == screenRect) && ((flags & WS_POPUP) || isTopMost)

    SW_MAXIMIZE (and/or WS_MAXIMIZE) do not appear to be related.

    (Shouldn't this stuff be documented somewhere???)

    I was able to mostly get the desired behavior by removing WS_POPUP and not making the window topmost. I was also able to regain most of the speed lost by not disabling aero by rendering to the front buffer and using glFlush instead of SwapBuffers.

    However, making the window "not topmost" creates another problem: The taskbar isn't always hidden anymore! Sometimes it is, sometimes it isn't - I'm not really sure what the condition is, but it looks really silly to have it visible in-game.

    Any ideas how I can simultaneously not disable aero, and ensure the taskbar is hidden?

  5. #5
    Member Regular Contributor
    Join Date
    Oct 2006
    Posts
    349

    Re: Vista auto-fullscreen-detection disabling aero?

    I've always assumed that the window needed to be maximized for the fullscreen mode to be enabled, but you say it only needs windowRect == screenRect? Interesting!

    Since VLC is open source, I'd suggest digging into its source to see what exactly is going on when it goes fullscreen. Another pssibility is to use a tool that can display the styles of a specific window (I think sysinternals releases such a tools for free) - this should show the exact combination you need to use.

    As far as I know fullscreen mode is enabled only for OpenGL or D3D applications. Among other things, it causes the secondary monitors (if any) to go black and causes print screen to capture black rectangles.

    Finally, I would suggest against drawing to the frontbuffer, both for obvious reasons (flicker) and less obvious reasons (it doesn't cooperate well with compositors and may cause Aero to be disabled on some systems).

    Sorry, no idea about the taskbar.

  6. #6
    Intern Newbie
    Join Date
    Nov 2002
    Posts
    37

    Re: Vista auto-fullscreen-detection disabling aero?

    Correct me if I'm wrong, but I think rendering to the front buffer is fine for "non fullscreen" apps, because in windowed mode the OpenGL frontbuffer acts like a backbuffer. When you call glFlush, the frontbuffer gets copied into the compositing surface, and then it becomes visible.

    Windowed applications that use frontbuffer rendering without ever calling glFlush or glFinish (as they should) are likely to appear completely black, because the rendering will sit forever in the offscreen frontbuffer. Not even switching the DWM off is likely to fix these, given that the offscreen frontbuffer is a requirement of the driver model itself.
    Source: http://www.opengl.org/pipeline/article/vol003_7/

    Actually, I tested this with fullscreen too and it seems fine (no flicker). I also noticed that aero does not get disabled unless SwapBuffers is called.

    So the condition can be modified to

    disableAero = usingSwapBuffers && (windowRect == screenRect) && ((flags & WS_POPUP) || isTopMost)

    This means that I can use popup and topmost as long as I don't use swapbuffers. I think that solves all my problems.

  7. #7
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: Vista auto-fullscreen-detection disabling aero?

    Yikes, using only front buffer seem ... so disturbing.

    You basically just hope that the compositer will display your frame at the right moment. Normally this moment is when swapbuffers is called, but without it, how do you mark your frame as complete ?

    Fine if it is fine for you, just be warned that this sounds very fragile.

  8. #8
    Senior Member OpenGL Pro
    Join Date
    Sep 2004
    Location
    Prombaatu
    Posts
    1,401

    Re: Vista auto-fullscreen-detection disabling aero?

    >> Enabling or disabling aero is a fairly disruptive event, taking up to 10 seconds to complete and flashing the screen several times.

    That sounds a wee bit high. Shouldn't take more than a second or thereabouts. A call to SetWindowLongPtr + SetWindowPos should do the trick.

  9. #9
    Intern Newbie
    Join Date
    Nov 2002
    Posts
    37

    Re: Vista auto-fullscreen-detection disabling aero?

    Quote Originally Posted by ZbuffeR
    Yikes, using only front buffer seem ... so disturbing.

    You basically just hope that the compositer will display your frame at the right moment. Normally this moment is when swapbuffers is called, but without it, how do you mark your frame as complete ?

    Fine if it is fine for you, just be warned that this sounds very fragile.
    Tests indicate that it works on ATI and nVidia but not Intel integrated graphics. So you are correct, it does not work in general. Unfortunately

    Quote Originally Posted by Brolingstanz
    >> Enabling or disabling aero is a fairly disruptive event, taking up to 10 seconds to complete and flashing the screen several times.

    That sounds a wee bit high. Shouldn't take more than a second or thereabouts. A call to SetWindowLongPtr + SetWindowPos should do the trick.
    This is a bit of a non sequitur, I think perhaps you didn't understand the topic?

    Let's recap:

    1) I was looking for a way to have my app not disable aero while fullscreen.

    2) We discovered (at least part of) the condition under which aero is diabled:

    disableAero = usingSwapBuffers && (windowRect == screenRect) && ((flags & WS_POPUP) || isTopMost)

    3) This leads to two methods to avoid disabling aero while fullscreen:

    either (don't use SwapBuffers), or (remove WS_POPUP and make the window not topmost).

    The former just isn't usable (doesn't work on intel integrated graphics) and the latter has an unfortunate issue: If the window is not topmost, then the taskbar can cover up part of the app which isn't acceptable for fullscreen.

    So I still don't have a complete solution.

  10. #10
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: Vista auto-fullscreen-detection disabling aero?

    Did you look at VLC source to check how this problem is solved ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •