Display a warning when running under Wayland

This commit is contained in:
Cameron Gutman 2018-08-11 22:42:25 -07:00
parent c0e697eb58
commit 5f5f835b2e
3 changed files with 23 additions and 1 deletions

View file

@ -34,7 +34,10 @@ GridView {
// Setup signals on CM // Setup signals on CM
ComputerManager.computerAddCompleted.connect(addComplete) ComputerManager.computerAddCompleted.connect(addComplete)
if (!prefs.hasAnyHardwareAcceleration()) { if (prefs.isRunningWayland()) {
waylandDialog.open()
}
else if (!prefs.hasAnyHardwareAcceleration()) {
noHwDecoderDialog.open() noHwDecoderDialog.open()
} }
} }
@ -224,6 +227,18 @@ GridView {
} }
} }
MessageDialog {
id: waylandDialog
modality:Qt.WindowModal
icon: StandardIcon.Warning
standardButtons: StandardButton.Ok | StandardButton.Help
text: "Moonlight does not support hardware acceleration on Wayland. Continuing on Wayland may result in poor streaming performance. " +
"Please switch to an X session for optimal performance."
onHelp: {
Qt.openUrlExternally("https://github.com/moonlight-stream/moonlight-docs/wiki/Fixing-Hardware-Decoding-Problems");
}
}
MessageDialog { MessageDialog {
id: pairDialog id: pairDialog
// don't allow edits to the rest of the window while open // don't allow edits to the rest of the window while open

View file

@ -67,6 +67,11 @@ bool StreamingPreferences::hasAnyHardwareAcceleration()
1920, 1080, 60); 1920, 1080, 60);
} }
bool StreamingPreferences::isRunningWayland()
{
return qgetenv("XDG_SESSION_TYPE") == QByteArray("wayland");
}
int StreamingPreferences::getMaximumStreamingFrameRate() int StreamingPreferences::getMaximumStreamingFrameRate()
{ {
// Never let the maximum drop below 60 FPS // Never let the maximum drop below 60 FPS

View file

@ -17,6 +17,8 @@ public:
Q_INVOKABLE static bool hasAnyHardwareAcceleration(); Q_INVOKABLE static bool hasAnyHardwareAcceleration();
Q_INVOKABLE static bool isRunningWayland();
Q_INVOKABLE static int getMaximumStreamingFrameRate(); Q_INVOKABLE static int getMaximumStreamingFrameRate();
Q_INVOKABLE QRect getDisplayResolution(int displayIndex); Q_INVOKABLE QRect getDisplayResolution(int displayIndex);