c++ - Properly Handling Alt-Enter / Alt-Tab Fullscreen Resolution -


the msdn page on dxgi gives instructions on how handle fullscreen resolutions different desktop resolution. says call idxgiswapchain::resizetargets() before calling idxgiswapchain::setfullscreenstate() prevent flickering, among other things.

it not how handle alt-enter, calls idxgiswapchain::setfullscreenstate() before program given chance make own call idxgiswapchain::resizetargets(). if latter method called upon wm_size message, wm_size message sent, possibly causing infinite loop. how can ensure latter called before former when alt-enter or alt-tab pressed, , mode switching occurs painlessly in general?

this going tricky ... right way how supposed handled idxgifactory::makewindowassociation, which, far know, nobody has managed use successfully. may want try anyway.

the "right" answer manually handle alt+enter. so, disable alt+enter using makewindowassociation , hands dirty. first, there no need capture wm_size. instead, listen on wm_entersizemove, wm_capturechanged, wm_windowposchanged , wm_exitsizemove. prevent having deal wm_size , still relevant window resizing events. (when doing this, read question well: wm_entersizemove / wm_exitsizemove - when using menu, not paired)

ok, assuming went fine, alt+enter, have following: set swap chain full screen using idxgiswapchain::setfullscreenstate , resize swap chain (idxgiswapchain::resizebuffers). default, you'll swap chain close possible current resolution of window before resizing. way enumerate full screen resolutions first, , upon going fullscreen, forcing resolution want have. sounds ugly, seems robust way solve problem.

in general, real, exclusive fullscreen mode not worth trouble, flickering when goes alt+tab (you can't avoid if mode switch happens, screen have readjust.) better solution use fullscreen borderless window. create window class without decoration, make full-screen, place such covers whole screen , done it. don't have worry alt+enter , alt+tab @ all. allows people continue working on second screen without flickering. performance wise, pretty ok'ish (most new games support "borderless fullscreen".)

there might silver bullet solves of correctly, haven't seen yet. if there cleaner/nicer solution, i'd curious hear it. "borderless fullscreen" seems current standard though, iirc, unity 5 allow "borderless fullscreen" direct3d 11.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -