全屏无边框窗口,顶部为“自有"窗口 [英] Fullscreen borderless window with 'owned' window on-top

查看:174
本文介绍了全屏无边框窗口,顶部为“自有"窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个OpenGL窗口:一个是主窗口,一个是由主窗口拥有"的较小窗口(hWndParent在CreateWindowEx中设置,但未设置WS_CHILD样式). 如果随后将主窗口转换为无边界且与桌面大小相同的窗口,则即使拥有该主窗口,该窗口也会跳到较小的窗口的前面,这是不可能的(

I have two OpenGL windows: a main one and a smaller one that is set to be 'owned' by the main one (hWndParent is set in CreateWindowEx, but the WS_CHILD style is not set). If I then convert my main window to be borderless and the same size as my desktop it will jump in front of the smaller window even though it's owned and that should not be possible (https://msdn.microsoft.com/en-us/library/windows/desktop/ms632599%28v=vs.85%29.aspx#owned_windows). This is true even if the smaller window is set to be always-on-top.

靠它本身并不可怕,但是核心问题是我仍然可以在较小的窗口所在的位置单击主窗口,较小的窗口将在前面弹出.通过单击主窗口,然后单击进入主窗口,我可以像这样无休止地进入两个窗口.

On it's own this isn't terrible, but the core issue is that I can still click-through my main window on where the smaller window is, and the smaller window will pop infront. I can go between the two windows endlessly like this by clicking on the main window, then clicking-through the main window.

如果我使主窗口的大小比整个桌面的大小小1像素,则这些问题均不会发生,并且窗口的行为符合预期.

If I make the main window size 1 pixel less than the full desktop size, none of these issues occur and the windows behave is as expected.

我找不到任何描述此行为的文档.此功能可防止窗口进入未记录的内容(例如正在播放的视频)的前面,还是我只是想念它?

I can't find any documentation that describes this behavior. It is a feature to keep windows from going infront of content (such as a video playing back) that isn't documented, or am I just missing it?

我会在这里提到我不在使用分层或透明窗口,所以我认为点击不通甚至是不可能的?

I'll mention I'm not using layered or transparent window here, so I don't think click-through should even be possible?

谢谢

推荐答案

您遇到的问题很可能是OpenGL实现错误,该错误是由驱动程序在窗口式"和全屏"渲染之间切换的启发式方法触发的: ,对于OpenGL,没有Direct3D那样的特殊专有全屏模式".取而代之的是,覆盖整个屏幕的无边界窗口不会被外来窗口覆盖,这可能会触发全屏"检测,这可能会使相关的OpenGL实现切换到另一个代码路径(即,其中所有像素所有权测试都被禁用,并且帧缓冲翻转直接进入显示扫描,而绕开了窗口合成器.

What you experience may very well be a OpenGL implementation bug that's triggered by the heuristic in which the driver switched between "windowed" and "fullscreen" rendering: You see, for OpenGL there's no special "exclusive fullscreen mode" as Direct3D has. Instead a borderless window covering the whole screen, which is not overlapped by foreign windows may trigger a "fullscreen" detection, which may the OpenGL implementation in question make switch to another code path (namely one, where all pixel ownership tests are disabled and the framebuffer flips go directly to the display scanout, bypassing the windowing compositor.

您在这里所做的事情非常罕见,以至于它可能已经通过了所有一致性测试.首先,将子窗口放置在OpenGL窗口中并不常见,而将它们悬浮在窗口中的情况则更为罕见.

What you do there is so uncommon, that it likely may have slipped through all conformance tests. Having child windows to a OpenGL window is uncommon in the first place and them being floating is even rarer.

如果您只展示了最小的示例展示,则可能应该将其作为错误报告给驱动程序供应商.同时,我提出了一种解决方法:使OpenGL窗口成为顶层窗口的子窗口(当然,需要在顶层WM_SIZE中调整大小),并使浮动窗口成为顶层子窗口.父窗口中子级之间的z顺序得到尊重并保持.作为顶层窗口的孩子应该禁止大多数启发式方法,并且OpenGL驱动程序不应在OpenGL父窗口的边界和大小上循环.

If you've got a minimal example showcase, you should probably report it as a bug to the driver vendor. In the meantime I propose a workaround: Make your OpenGL window a child-window to your top level window (will of course require resizing in the toplevel WM_SIZE) and make your floating window another child to the toplevel; the z-order between childs in a parent window is respected and kept. Being a child to a toplevel window should inhibit most heuristics and OpenGL drivers should not loop at the border and size of OpenGL parent windows.

这篇关于全屏无边框窗口,顶部为“自有"窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆