Don't overwrite window mode settings when switching between WM and non-WM environments

This commit is contained in:
Cameron Gutman 2021-02-07 10:49:29 -06:00
parent 3bd6a6a614
commit 6dab251055
3 changed files with 38 additions and 26 deletions

View File

@ -525,6 +525,11 @@ Flickable {
AutoResizingComboBox {
// ignore setting the index at first, and actually set it when the component is loaded
Component.onCompleted: {
if (!visible) {
// Do nothing if the control won't even be visible
return
}
// Set the recommended option based on the OS
for (var i = 0; i < windowModeListModel.count; i++) {
var thisWm = windowModeListModel.get(i).val;
@ -537,15 +542,13 @@ Flickable {
currentIndex = 0
if (SystemProperties.hasWindowManager && !SystemProperties.rendererAlwaysFullScreen) {
var savedWm = StreamingPreferences.windowMode
for (var i = 0; i < windowModeListModel.count; i++) {
var thisWm = windowModeListModel.get(i).val;
if (savedWm === thisWm) {
currentIndex = i
break
}
}
var savedWm = StreamingPreferences.windowMode
for (var i = 0; i < windowModeListModel.count; i++) {
var thisWm = windowModeListModel.get(i).val;
if (savedWm === thisWm) {
currentIndex = i
break
}
}
activated(currentIndex)
@ -792,20 +795,19 @@ Flickable {
AutoResizingComboBox {
// ignore setting the index at first, and actually set it when the component is loaded
Component.onCompleted: {
if (SystemProperties.hasWindowManager) {
var saved_uidisplaymode = StreamingPreferences.uiDisplayMode
currentIndex = 0
for (var i = 0; i < uiDisplayModeListModel.count; i++) {
var el_uidisplaymode = uiDisplayModeListModel.get(i).val;
if (saved_uidisplaymode === el_uidisplaymode) {
currentIndex = i
break
}
}
if (!visible) {
// Do nothing if the control won't even be visible
return
}
else {
// Full-screen is always selected when there is no window manager
currentIndex = 2
var saved_uidisplaymode = StreamingPreferences.uiDisplayMode
currentIndex = 0
for (var i = 0; i < uiDisplayModeListModel.count; i++) {
var el_uidisplaymode = uiDisplayModeListModel.get(i).val;
if (saved_uidisplaymode === el_uidisplaymode) {
currentIndex = i
break
}
}
activated(currentIndex)

View File

@ -340,6 +340,10 @@ bool Session::populateDecoderProperties(SDL_Window* window)
m_StreamConfig.colorSpace = decoder->getDecoderColorspace();
if (decoder->isAlwaysFullScreen()) {
m_IsFullScreen = true;
}
delete decoder;
return true;
@ -347,6 +351,7 @@ bool Session::populateDecoderProperties(SDL_Window* window)
Session::Session(NvComputer* computer, NvApp& app, StreamingPreferences *preferences)
: m_Preferences(preferences ? preferences : new StreamingPreferences(this)),
m_IsFullScreen(m_Preferences->windowMode != StreamingPreferences::WM_WINDOWED || !WMUtils::isRunningWindowManager()),
m_Computer(computer),
m_App(app),
m_Window(nullptr),
@ -506,8 +511,12 @@ bool Session::initialize()
{
default:
case StreamingPreferences::WM_FULLSCREEN_DESKTOP:
m_FullScreenFlag = SDL_WINDOW_FULLSCREEN_DESKTOP;
break;
// Only use full-screen desktop mode if we're running a window manager
if (WMUtils::isRunningWindowManager()) {
m_FullScreenFlag = SDL_WINDOW_FULLSCREEN_DESKTOP;
break;
}
// Fall-through
case StreamingPreferences::WM_FULLSCREEN:
m_FullScreenFlag = SDL_WINDOW_FULLSCREEN;
break;
@ -817,7 +826,7 @@ void Session::getWindowDimensions(int& x, int& y,
}
}
fullScreen = (m_Preferences->windowMode != StreamingPreferences::WM_WINDOWED);
fullScreen = m_IsFullScreen;
}
SDL_Rect usableBounds;
@ -1212,7 +1221,7 @@ void Session::exec(int displayOriginX, int displayOriginY)
// For non-full screen windows, call getWindowDimensions()
// again after creating a window to allow it to account
// for window chrome size.
if (m_Preferences->windowMode == StreamingPreferences::WM_WINDOWED) {
if (!m_IsFullScreen) {
getWindowDimensions(x, y, width, height);
// We must set the size before the position because centering

View File

@ -133,6 +133,7 @@ private:
int drSubmitDecodeUnit(PDECODE_UNIT du);
StreamingPreferences* m_Preferences;
bool m_IsFullScreen;
STREAM_CONFIGURATION m_StreamConfig;
DECODER_RENDERER_CALLBACKS m_VideoCallbacks;
AUDIO_RENDERER_CALLBACKS m_AudioCallbacks;