mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-25 09:40:15 +00:00
Code guidelines fixes
This commit is contained in:
parent
4e097e05d2
commit
0df188969f
@ -63,16 +63,16 @@ void EmuWindow_SDL2::OnResize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EmuWindow_SDL2::WaitForFocus() {
|
void EmuWindow_SDL2::WaitForFocus() {
|
||||||
while(!has_focus) {
|
while (!has_focus) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
SDL_WaitEvent(&event);
|
SDL_WaitEvent(&event);
|
||||||
if(event.type == SDL_WINDOWEVENT) {
|
if (event.type == SDL_WINDOWEVENT) {
|
||||||
switch (event.window.event) {
|
switch (event.window.event) {
|
||||||
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
||||||
has_focus=true;
|
has_focus = true;
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_CLOSE:
|
case SDL_WINDOWEVENT_CLOSE:
|
||||||
has_focus=true;
|
has_focus = true;
|
||||||
is_open = false;
|
is_open = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ private:
|
|||||||
/// Is the window still open?
|
/// Is the window still open?
|
||||||
bool is_open = true;
|
bool is_open = true;
|
||||||
|
|
||||||
/// Is the window has focus
|
/// Does the window has focus
|
||||||
bool has_focus = true;
|
bool has_focus = true;
|
||||||
|
|
||||||
/// Internal SDL2 render window
|
/// Internal SDL2 render window
|
||||||
|
@ -136,22 +136,16 @@ public slots:
|
|||||||
signals:
|
signals:
|
||||||
/// Emitted when the window is closed
|
/// Emitted when the window is closed
|
||||||
void Closed();
|
void Closed();
|
||||||
/// Emitted when the window focus changed
|
/// Emitted when the window focus changes
|
||||||
void focusChanged(bool hasFocus);
|
void focusChanged(bool has_focus);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnMinimalClientAreaChangeRequest(const std::pair<unsigned,unsigned>& minimal_size) override;
|
void OnMinimalClientAreaChangeRequest(const std::pair<unsigned,unsigned>& minimal_size) override;
|
||||||
|
|
||||||
/**
|
/// Capture focus gain to unset pause
|
||||||
* Capture focus gain to unset pause
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
void focusInEvent(QFocusEvent*) override;
|
void focusInEvent(QFocusEvent*) override;
|
||||||
|
|
||||||
/**
|
/// Capture focus lost to set pause
|
||||||
* Capture focus lost to set pause
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
void focusOutEvent(QFocusEvent*) override;
|
void focusOutEvent(QFocusEvent*) override;
|
||||||
|
|
||||||
GGLWidgetInternal* child;
|
GGLWidgetInternal* child;
|
||||||
|
@ -116,7 +116,7 @@ void Config::ReadValues() {
|
|||||||
|
|
||||||
UISettings::values.single_window_mode = qt_config->value("singleWindowMode", true).toBool();
|
UISettings::values.single_window_mode = qt_config->value("singleWindowMode", true).toBool();
|
||||||
UISettings::values.display_titlebar = qt_config->value("displayTitleBars", true).toBool();
|
UISettings::values.display_titlebar = qt_config->value("displayTitleBars", true).toBool();
|
||||||
UISettings::values.pause_onfocuslost = qt_config->value("pauseOnFocusLost",false).toBool();
|
UISettings::values.pause_onfocuslost = qt_config->value("pauseOnFocusLost", false).toBool();
|
||||||
UISettings::values.confirm_before_closing = qt_config->value("confirmClose",true).toBool();
|
UISettings::values.confirm_before_closing = qt_config->value("confirmClose",true).toBool();
|
||||||
UISettings::values.first_start = qt_config->value("firstStart", true).toBool();
|
UISettings::values.first_start = qt_config->value("firstStart", true).toBool();
|
||||||
|
|
||||||
|
@ -489,20 +489,17 @@ void GMainWindow::OnStopGame() {
|
|||||||
ShutdownGame();
|
ShutdownGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnFocusChanged(bool hasFocus) {
|
void GMainWindow::OnFocusChanged(bool has_focus) {
|
||||||
// The focus change does not impact actual emulator state if:
|
// The focus change does not impact actual emulator state if:
|
||||||
// - the option is disabled
|
// - the option is disabled
|
||||||
// - the emulation is not started
|
// - the emulation is not started
|
||||||
// - the emulation has been paused through menu
|
// - the emulation has been paused through menu
|
||||||
if(!UISettings::values.pause_onfocuslost ||
|
if (!UISettings::values.pause_onfocuslost ||
|
||||||
!emu_thread ||
|
!emu_thread ||
|
||||||
emulation_paused)
|
emulation_paused)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (hasFocus)
|
emu_thread->SetRunning(has_focus);
|
||||||
emu_thread->SetRunning(true);
|
|
||||||
else // focus lost
|
|
||||||
emu_thread->SetRunning(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::ToggleWindowMode() {
|
void GMainWindow::ToggleWindowMode() {
|
||||||
|
@ -99,7 +99,7 @@ private slots:
|
|||||||
void OnPauseGame();
|
void OnPauseGame();
|
||||||
void OnStopGame();
|
void OnStopGame();
|
||||||
/// Called whenever the render window focus is changed
|
/// Called whenever the render window focus is changed
|
||||||
void OnFocusChanged(bool hasFocus);
|
void OnFocusChanged(bool has_focus);
|
||||||
/// Called whenever a user selects a game in the game list widget.
|
/// Called whenever a user selects a game in the game list widget.
|
||||||
void OnGameListLoadFile(QString game_path);
|
void OnGameListLoadFile(QString game_path);
|
||||||
void OnMenuLoadFile();
|
void OnMenuLoadFile();
|
||||||
|
Loading…
Reference in New Issue
Block a user