mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
Qt: save last gs_frame screen and re-use it in no-gui mode
This commit is contained in:
parent
eb0fb2fef7
commit
75fbb3d551
@ -146,6 +146,22 @@ gs_frame::gs_frame(QScreen* screen, const QRect& geometry, const QIcon& appIcon,
|
||||
gs_frame::~gs_frame()
|
||||
{
|
||||
g_user_asked_for_screenshot = false;
|
||||
|
||||
// Save active screen to gui settings
|
||||
const QScreen* current_screen = screen();
|
||||
const QList<QScreen*> screens = QGuiApplication::screens();
|
||||
int screen_index = 0;
|
||||
|
||||
for (int i = 0; i < screens.count(); i++)
|
||||
{
|
||||
if (current_screen == ::at32(screens, i))
|
||||
{
|
||||
screen_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_gui_settings->SetValue(gui::gs_screen, screen_index);
|
||||
}
|
||||
|
||||
void gs_frame::paintEvent(QPaintEvent *event)
|
||||
|
@ -291,13 +291,23 @@ std::unique_ptr<gs_frame> gui_application::get_gs_frame()
|
||||
QScreen* screen = nullptr;
|
||||
QRect base_geometry{};
|
||||
|
||||
if (m_game_screen_index >= 0)
|
||||
// Use screen index set by CLI argument
|
||||
int screen_index = m_game_screen_index;
|
||||
|
||||
// In no-gui mode: use last used screen if no CLI index was set
|
||||
if (screen_index < 0 && !m_main_window)
|
||||
{
|
||||
screen_index = m_gui_settings->GetValue(gui::gs_screen).toInt();
|
||||
}
|
||||
|
||||
// Try to find the specified screen
|
||||
if (screen_index >= 0)
|
||||
{
|
||||
const QList<QScreen*> available_screens = screens();
|
||||
|
||||
if (m_game_screen_index < available_screens.count())
|
||||
if (screen_index < available_screens.count())
|
||||
{
|
||||
screen = ::at32(available_screens, m_game_screen_index);
|
||||
screen = ::at32(available_screens, screen_index);
|
||||
|
||||
if (screen)
|
||||
{
|
||||
@ -307,10 +317,11 @@ std::unique_ptr<gs_frame> gui_application::get_gs_frame()
|
||||
|
||||
if (!screen)
|
||||
{
|
||||
gui_log.error("The selected game screen with index %d is not available (available screens: %d)", m_game_screen_index, available_screens.count());
|
||||
gui_log.error("The selected game screen with index %d is not available (available screens: %d)", screen_index, available_screens.count());
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback to the screen of the main window. Use the primary screen as last resort.
|
||||
if (!screen)
|
||||
{
|
||||
screen = m_main_window ? m_main_window->screen() : primaryScreen();
|
||||
|
@ -221,6 +221,7 @@ namespace gui
|
||||
const gui_save gs_lockMouseFs = gui_save(gs_frame, "lockMouseInFullscreen", true);
|
||||
const gui_save gs_resize = gui_save(gs_frame, "resize", false);
|
||||
const gui_save gs_resize_manual = gui_save(gs_frame, "resizeManual", true);
|
||||
const gui_save gs_screen = gui_save(gs_frame, "screen", 0);
|
||||
const gui_save gs_width = gui_save(gs_frame, "width", 1280);
|
||||
const gui_save gs_height = gui_save(gs_frame, "height", 720);
|
||||
const gui_save gs_hideMouseIdle = gui_save(gs_frame, "hideMouseOnIdle", false);
|
||||
|
Loading…
Reference in New Issue
Block a user