mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-17 06:01:12 +00:00
Remove desktop resolution in favor of native (unscaled) resolution
Seeing 2 "native" resolutions for a single high DPI display is confusing. If someone wants a lower resolution aspect-ratio match of a display, they can use a custom resolution.
This commit is contained in:
@@ -71,16 +71,9 @@ SystemProperties::SystemProperties()
|
|||||||
querySdlVideoInfo();
|
querySdlVideoInfo();
|
||||||
|
|
||||||
Q_ASSERT(maximumStreamingFrameRate >= 60);
|
Q_ASSERT(maximumStreamingFrameRate >= 60);
|
||||||
Q_ASSERT(!monitorDesktopResolutions.isEmpty());
|
|
||||||
Q_ASSERT(!monitorNativeResolutions.isEmpty());
|
Q_ASSERT(!monitorNativeResolutions.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect SystemProperties::getDesktopResolution(int displayIndex)
|
|
||||||
{
|
|
||||||
// Returns default constructed QRect if out of bounds
|
|
||||||
return monitorDesktopResolutions.value(displayIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
QRect SystemProperties::getNativeResolution(int displayIndex)
|
QRect SystemProperties::getNativeResolution(int displayIndex)
|
||||||
{
|
{
|
||||||
// Returns default constructed QRect if out of bounds
|
// Returns default constructed QRect if out of bounds
|
||||||
@@ -193,7 +186,6 @@ void SystemProperties::refreshDisplaysInternal()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
monitorDesktopResolutions.clear();
|
|
||||||
monitorNativeResolutions.clear();
|
monitorNativeResolutions.clear();
|
||||||
|
|
||||||
// Never let the maximum drop below 60 FPS
|
// Never let the maximum drop below 60 FPS
|
||||||
@@ -202,24 +194,6 @@ void SystemProperties::refreshDisplaysInternal()
|
|||||||
SDL_DisplayMode bestMode;
|
SDL_DisplayMode bestMode;
|
||||||
for (int displayIndex = 0; displayIndex < SDL_GetNumVideoDisplays(); displayIndex++) {
|
for (int displayIndex = 0; displayIndex < SDL_GetNumVideoDisplays(); displayIndex++) {
|
||||||
SDL_DisplayMode desktopMode;
|
SDL_DisplayMode desktopMode;
|
||||||
int err;
|
|
||||||
|
|
||||||
err = SDL_GetDesktopDisplayMode(displayIndex, &desktopMode);
|
|
||||||
if (err == 0) {
|
|
||||||
if (desktopMode.w <= 8192 && desktopMode.h <= 8192) {
|
|
||||||
monitorDesktopResolutions.insert(displayIndex, QRect(0, 0, desktopMode.w, desktopMode.h));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"Skipping resolution over 8K: %dx%d",
|
|
||||||
desktopMode.w, desktopMode.h);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"SDL_GetDesktopDisplayMode() failed: %s",
|
|
||||||
SDL_GetError());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StreamUtils::getNativeDesktopMode(displayIndex, &desktopMode)) {
|
if (StreamUtils::getNativeDesktopMode(displayIndex, &desktopMode)) {
|
||||||
if (desktopMode.w <= 8192 && desktopMode.h <= 8192) {
|
if (desktopMode.w <= 8192 && desktopMode.h <= 8192) {
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ public:
|
|||||||
Q_PROPERTY(bool supportsHdr MEMBER supportsHdr CONSTANT)
|
Q_PROPERTY(bool supportsHdr MEMBER supportsHdr CONSTANT)
|
||||||
|
|
||||||
Q_INVOKABLE void refreshDisplays();
|
Q_INVOKABLE void refreshDisplays();
|
||||||
Q_INVOKABLE QRect getDesktopResolution(int displayIndex);
|
|
||||||
Q_INVOKABLE QRect getNativeResolution(int displayIndex);
|
Q_INVOKABLE QRect getNativeResolution(int displayIndex);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@@ -52,7 +51,6 @@ private:
|
|||||||
QString unmappedGamepads;
|
QString unmappedGamepads;
|
||||||
int maximumStreamingFrameRate;
|
int maximumStreamingFrameRate;
|
||||||
QSize maximumResolution;
|
QSize maximumResolution;
|
||||||
QList<QRect> monitorDesktopResolutions;
|
|
||||||
QList<QRect> monitorNativeResolutions;
|
QList<QRect> monitorNativeResolutions;
|
||||||
QString versionString;
|
QString versionString;
|
||||||
bool supportsHdr;
|
bool supportsHdr;
|
||||||
|
|||||||
+27
-38
@@ -97,50 +97,39 @@ Flickable {
|
|||||||
// Add native resolutions for all attached displays
|
// Add native resolutions for all attached displays
|
||||||
var done = false
|
var done = false
|
||||||
for (var displayIndex = 0; !done; displayIndex++) {
|
for (var displayIndex = 0; !done; displayIndex++) {
|
||||||
for (var displayResIndex = 0; displayResIndex < 2; displayResIndex++) {
|
var screenRect = SystemProperties.getNativeResolution(displayIndex);
|
||||||
var screenRect;
|
|
||||||
|
|
||||||
// Some platforms have different desktop resolutions
|
if (screenRect.width === 0) {
|
||||||
// and native resolutions (like macOS with Retina displays)
|
// Exceeded max count of displays
|
||||||
if (displayResIndex === 0) {
|
done = true
|
||||||
screenRect = SystemProperties.getDesktopResolution(displayIndex)
|
break
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
screenRect = SystemProperties.getNativeResolution(displayIndex)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (screenRect.width === 0) {
|
var indexToAdd = 0
|
||||||
// Exceeded max count of displays
|
for (var j = 0; j < resolutionComboBox.count; j++) {
|
||||||
done = true
|
var existing_width = parseInt(resolutionListModel.get(j).video_width);
|
||||||
|
var existing_height = parseInt(resolutionListModel.get(j).video_height);
|
||||||
|
|
||||||
|
if (screenRect.width === existing_width && screenRect.height === existing_height) {
|
||||||
|
// Duplicate entry, skip
|
||||||
|
indexToAdd = -1
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
else if (screenRect.width * screenRect.height > existing_width * existing_height) {
|
||||||
var indexToAdd = 0
|
// Candidate entrypoint after this entry
|
||||||
for (var j = 0; j < resolutionComboBox.count; j++) {
|
indexToAdd = j + 1
|
||||||
var existing_width = parseInt(resolutionListModel.get(j).video_width);
|
|
||||||
var existing_height = parseInt(resolutionListModel.get(j).video_height);
|
|
||||||
|
|
||||||
if (screenRect.width === existing_width && screenRect.height === existing_height) {
|
|
||||||
// Duplicate entry, skip
|
|
||||||
indexToAdd = -1
|
|
||||||
break
|
|
||||||
}
|
|
||||||
else if (screenRect.width * screenRect.height > existing_width * existing_height) {
|
|
||||||
// Candidate entrypoint after this entry
|
|
||||||
indexToAdd = j + 1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Insert this display's resolution if it's not a duplicate
|
// Insert this display's resolution if it's not a duplicate
|
||||||
if (indexToAdd >= 0) {
|
if (indexToAdd >= 0) {
|
||||||
resolutionListModel.insert(indexToAdd,
|
resolutionListModel.insert(indexToAdd,
|
||||||
{
|
{
|
||||||
"text": "Native ("+screenRect.width+"x"+screenRect.height+")",
|
"text": "Native ("+screenRect.width+"x"+screenRect.height+")",
|
||||||
"video_width": ""+screenRect.width,
|
"video_width": ""+screenRect.width,
|
||||||
"video_height": ""+screenRect.height,
|
"video_height": ""+screenRect.height,
|
||||||
"is_custom": false
|
"is_custom": false
|
||||||
})
|
})
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user