Skip to content

Commit f01b8db

Browse files
committed
Merge remote-tracking branch 'frog/nightly' into nightly
2 parents f6f2762 + ff1095f commit f01b8db

4 files changed

Lines changed: 67 additions & 72 deletions

File tree

src/platform/windows/display_device/windows_utils.cpp

Lines changed: 54 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -396,18 +396,16 @@ namespace display_device::w_utils {
396396

397397
boost::optional<UINT32>
398398
get_source_index(const DISPLAYCONFIG_PATH_INFO &path, const std::vector<DISPLAYCONFIG_MODE_INFO> &modes) {
399-
UINT32 index {};
400-
if (path.flags & DISPLAYCONFIG_PATH_SUPPORT_VIRTUAL_MODE) {
401-
index = path.sourceInfo.sourceModeInfoIdx;
402-
if (index == DISPLAYCONFIG_PATH_SOURCE_MODE_IDX_INVALID) {
403-
return boost::none;
404-
}
405-
}
406-
else {
407-
index = path.sourceInfo.modeInfoIdx;
408-
if (index == DISPLAYCONFIG_PATH_MODE_IDX_INVALID) {
409-
return boost::none;
410-
}
399+
// The MS docs is not clear when to access union struct or not. It appears that union struct is available,
400+
// whenever QDC_VIRTUAL_MODE_AWARE is specified when querying.
401+
//
402+
// The docs state, however, that it is only available when
403+
// DISPLAYCONFIG_PATH_SUPPORT_VIRTUAL_MODE flag is set, but that is just BS (maybe copy-pasta mistake), because some cases
404+
// were found where the flag is not set and the union is still being used.
405+
406+
const UINT32 index { path.sourceInfo.sourceModeInfoIdx };
407+
if (index == DISPLAYCONFIG_PATH_SOURCE_MODE_IDX_INVALID) {
408+
return boost::none;
411409
}
412410

413411
if (index >= modes.size()) {
@@ -420,65 +418,69 @@ namespace display_device::w_utils {
420418

421419
void
422420
set_source_index(DISPLAYCONFIG_PATH_INFO &path, const boost::optional<UINT32> &index) {
423-
if (path.flags & DISPLAYCONFIG_PATH_SUPPORT_VIRTUAL_MODE) {
424-
if (index) {
425-
path.sourceInfo.sourceModeInfoIdx = *index;
426-
}
427-
else {
428-
path.sourceInfo.sourceModeInfoIdx = DISPLAYCONFIG_PATH_SOURCE_MODE_IDX_INVALID;
429-
}
421+
// The MS docs is not clear when to access union struct or not. It appears that union struct is available,
422+
// whenever QDC_VIRTUAL_MODE_AWARE is specified when querying.
423+
//
424+
// The docs state, however, that it is only available when
425+
// DISPLAYCONFIG_PATH_SUPPORT_VIRTUAL_MODE flag is set, but that is just BS (maybe copy-pasta mistake), because some cases
426+
// were found where the flag is not set and the union is still being used.
427+
428+
if (index) {
429+
path.sourceInfo.sourceModeInfoIdx = *index;
430430
}
431431
else {
432-
if (index) {
433-
path.sourceInfo.modeInfoIdx = *index;
434-
}
435-
else {
436-
path.sourceInfo.modeInfoIdx = DISPLAYCONFIG_PATH_MODE_IDX_INVALID;
437-
}
432+
path.sourceInfo.sourceModeInfoIdx = DISPLAYCONFIG_PATH_SOURCE_MODE_IDX_INVALID;
438433
}
439434
}
440435

441436
void
442437
set_target_index(DISPLAYCONFIG_PATH_INFO &path, const boost::optional<UINT32> &index) {
443-
if (path.flags & DISPLAYCONFIG_PATH_SUPPORT_VIRTUAL_MODE) {
444-
if (index) {
445-
path.targetInfo.targetModeInfoIdx = *index;
446-
}
447-
else {
448-
path.targetInfo.targetModeInfoIdx = DISPLAYCONFIG_PATH_TARGET_MODE_IDX_INVALID;
449-
}
438+
// The MS docs is not clear when to access union struct or not. It appears that union struct is available,
439+
// whenever QDC_VIRTUAL_MODE_AWARE is specified when querying.
440+
//
441+
// The docs state, however, that it is only available when
442+
// DISPLAYCONFIG_PATH_SUPPORT_VIRTUAL_MODE flag is set, but that is just BS (maybe copy-pasta mistake), because some cases
443+
// were found where the flag is not set and the union is still being used.
444+
445+
if (index) {
446+
path.targetInfo.targetModeInfoIdx = *index;
450447
}
451448
else {
452-
if (index) {
453-
path.targetInfo.modeInfoIdx = *index;
454-
}
455-
else {
456-
path.targetInfo.modeInfoIdx = DISPLAYCONFIG_PATH_MODE_IDX_INVALID;
457-
}
449+
path.targetInfo.targetModeInfoIdx = DISPLAYCONFIG_PATH_TARGET_MODE_IDX_INVALID;
458450
}
459451
}
460452

461453
void
462454
set_desktop_index(DISPLAYCONFIG_PATH_INFO &path, const boost::optional<UINT32> &index) {
463-
if (path.flags & DISPLAYCONFIG_PATH_SUPPORT_VIRTUAL_MODE) {
464-
if (index) {
465-
path.targetInfo.desktopModeInfoIdx = *index;
466-
}
467-
else {
468-
path.targetInfo.desktopModeInfoIdx = DISPLAYCONFIG_PATH_DESKTOP_IMAGE_IDX_INVALID;
469-
}
455+
// The MS docs is not clear when to access union struct or not. It appears that union struct is available,
456+
// whenever QDC_VIRTUAL_MODE_AWARE is specified when querying.
457+
//
458+
// The docs state, however, that it is only available when
459+
// DISPLAYCONFIG_PATH_SUPPORT_VIRTUAL_MODE flag is set, but that is just BS (maybe copy-pasta mistake), because some cases
460+
// were found where the flag is not set and the union is still being used.
461+
462+
if (index) {
463+
path.targetInfo.desktopModeInfoIdx = *index;
464+
}
465+
else {
466+
path.targetInfo.desktopModeInfoIdx = DISPLAYCONFIG_PATH_DESKTOP_IMAGE_IDX_INVALID;
470467
}
471468
}
472469

473470
void
474471
set_clone_group_id(DISPLAYCONFIG_PATH_INFO &path, const boost::optional<UINT32> &id) {
475-
if (path.flags & DISPLAYCONFIG_PATH_SUPPORT_VIRTUAL_MODE) {
476-
if (id) {
477-
path.sourceInfo.cloneGroupId = *id;
478-
}
479-
else {
480-
path.sourceInfo.cloneGroupId = DISPLAYCONFIG_PATH_CLONE_GROUP_INVALID;
481-
}
472+
// The MS docs is not clear when to access union struct or not. It appears that union struct is available,
473+
// whenever QDC_VIRTUAL_MODE_AWARE is specified when querying.
474+
//
475+
// The docs state, however, that it is only available when
476+
// DISPLAYCONFIG_PATH_SUPPORT_VIRTUAL_MODE flag is set, but that is just BS (maybe copy-pasta mistake), because some cases
477+
// were found where the flag is not set and the union is still being used.
478+
479+
if (id) {
480+
path.sourceInfo.cloneGroupId = *id;
481+
}
482+
else {
483+
path.sourceInfo.cloneGroupId = DISPLAYCONFIG_PATH_CLONE_GROUP_INVALID;
482484
}
483485
}
484486

src/platform/windows/display_device/windows_utils.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,6 @@ namespace display_device::w_utils {
264264
/**
265265
* @brief Get the source mode index from the path.
266266
*
267-
* This function correctly retrieves the index from the path based on
268-
* some flags that indicate how to access the union structure containing the index.
269-
*
270267
* It performs sanity checks on the modes list that the index is indeed correct.
271268
*
272269
* @param path Path to get the source mode index for.
@@ -287,10 +284,6 @@ namespace display_device::w_utils {
287284

288285
/**
289286
* @brief Set the source mode index in the path.
290-
*
291-
* This function correctly sets the index in the path based on
292-
* some flags that indicate how to access the union structure containing the index.
293-
*
294287
* @param path Path to modify.
295288
* @param index Index value to set or empty optional to mark the index as invalid.
296289
* @see query_display_config on how to get paths and modes from the system.
@@ -307,10 +300,6 @@ namespace display_device::w_utils {
307300

308301
/**
309302
* @brief Set the target mode index in the path.
310-
*
311-
* This function correctly sets the index in the path based on
312-
* some flags that indicate how to access the union structure containing the index.
313-
*
314303
* @param path Path to modify.
315304
* @param index Index value to set or empty optional to mark the index as invalid.
316305
* @see query_display_config on how to get paths and modes from the system.
@@ -327,10 +316,6 @@ namespace display_device::w_utils {
327316

328317
/**
329318
* @brief Set the desktop mode index in the path.
330-
*
331-
* This function correctly sets the index in the path based on
332-
* some flags that indicate how to access the union structure containing the index.
333-
*
334319
* @param path Path to modify.
335320
* @param index Index value to set or empty optional to mark the index as invalid.
336321
* @see query_display_config on how to get paths and modes from the system.
@@ -347,10 +332,6 @@ namespace display_device::w_utils {
347332

348333
/**
349334
* @brief Set the clone group id in the path.
350-
*
351-
* This function correctly sets the id in the path based on
352-
* some flags that indicate how to access the union structure containing the id.
353-
*
354335
* @param path Path to modify.
355336
* @param id Id value to set or empty optional to mark the id as invalid.
356337
* @see query_display_config on how to get paths and modes from the system.

src_assets/common/assets/web/template_header.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<script type="module" src="bootstrap/dist/js/bootstrap.bundle.min.js"></script>
1010
<style>
1111
body {
12-
background: url(https://w.wallhaven.cc/full/6d/wallhaven-6dge5w.jpg) no-repeat;
12+
background: url(https://s21.ax1x.com/2024/03/19/pFRIHNF.jpg) no-repeat;
1313
background-size: cover;
1414
}
1515
</style>

src_assets/common/assets/web/troubleshooting.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,18 @@ <h2 id="logs">Logs</h2>
199199
}, 5000);
200200
});
201201
},
202+
resetDisplayDevicePersistence() {
203+
this.resetDisplayDevicePressed = true;
204+
fetch("/api/reset-display-device-persistence", { method: "POST" })
205+
.then((r) => r.json())
206+
.then((r) => {
207+
this.resetDisplayDevicePressed = false;
208+
this.resetDisplayDeviceStatus = r.status.toString() === "true";
209+
setTimeout(() => {
210+
this.resetDisplayDeviceStatus = null;
211+
}, 5000);
212+
});
213+
},
202214
copyLogs() {
203215
navigator.clipboard.writeText(this.actualLogs);
204216
},

0 commit comments

Comments
 (0)