Fix all display being enabled when virtual display quits

The inclusion of libdisplaydevice further complicated the already messy display configuration thing...
This commit is contained in:
Yukino Song
2025-01-20 21:55:49 +08:00
parent 0b2ca076da
commit a63b0892aa
+16 -2
View File
@@ -231,6 +231,7 @@ namespace proc {
launch_session->display_guid launch_session->display_guid
); );
if (!vdisplayName.empty()) {
BOOST_LOG(info) << "Virtual Display created at " << vdisplayName; BOOST_LOG(info) << "Virtual Display created at " << vdisplayName;
// Don't change display settings when no params are given // Don't change display settings when no params are given
@@ -247,12 +248,25 @@ namespace proc {
// empty name when probing graphics cards. // empty name when probing graphics cards.
config::video.output_name = display_device::map_display_name(this->display_name); config::video.output_name = display_device::map_display_name(this->display_name);
} else {
BOOST_LOG(warning) << "Virtual Display creation failed!";
}
} }
} }
#endif
display_device::configure_display(config::video, *launch_session); display_device::configure_display(config::video, *launch_session);
// We should not preserve display state when using virtual display.
// It is already handled by Windows properly.
if (this->virtual_display) {
display_device::reset_persistence();
}
#else
display_device::configure_display(config::video, *launch_session);
#endif
// Probe encoders again before streaming to ensure our chosen // Probe encoders again before streaming to ensure our chosen
// encoder matches the active GPU (which could have changed // encoder matches the active GPU (which could have changed
@@ -543,7 +557,7 @@ namespace proc {
// Load the configured output_name first // Load the configured output_name first
// to prevent the value being write to empty when the initial terminate happens // to prevent the value being write to empty when the initial terminate happens
if (proc.initial_display.empty()) { if (!has_run && proc.initial_display.empty()) {
proc.initial_display = config::video.output_name; proc.initial_display = config::video.output_name;
} else { } else {
// Restore output name to its original value // Restore output name to its original value