mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-19 09:41:32 +08:00
UI: Add option to hide OBS windows on Windows
This uses the SetWindowDisplayAffinity API to hide windows from capture applications (including OBS). This is not perfect - internal windows such as context menus, combo box dropdowns, etc will still be displayed. Even with these limitations, it should help people with single monitors capture content with less interference from the OBS window. This implementation is for Windows only but the code is generic enough that adding other platforms should be straightforward.
This commit is contained in:
@@ -30,6 +30,10 @@ OBSProjector::OBSProjector(QWidget *widget, obs_source_t *source_, int monitor,
|
||||
if (isAlwaysOnTop)
|
||||
setWindowFlags(Qt::WindowStaysOnTopHint);
|
||||
|
||||
// Mark the window as a projector so SetDisplayAffinity
|
||||
// can skip it
|
||||
windowHandle()->setProperty("isOBSProjectorWindow", true);
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
// Prevents resizing of projector windows
|
||||
setAttribute(Qt::WA_PaintOnScreen, false);
|
||||
|
||||
Reference in New Issue
Block a user