aboutsummaryrefslogtreecommitdiff
path: root/src/Overlay.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-11-18 18:08:00 +0100
committerdec05eba <dec05eba@protonmail.com>2024-11-18 18:08:00 +0100
commitb06113d21ce467fa905684cfb296231d2e13f2e3 (patch)
tree5d64c53435c4f46436766db1bd47b9fb9f92f9d9 /src/Overlay.cpp
parent71f95e4b12b0a79e7ff9fc4239af87b1380ad3cd (diff)
Allow turning on/off replay automatically when using fullscreen/power supply replay mode
Diffstat (limited to 'src/Overlay.cpp')
-rw-r--r--src/Overlay.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/Overlay.cpp b/src/Overlay.cpp
index f06ea3b..f4729e1 100644
--- a/src/Overlay.cpp
+++ b/src/Overlay.cpp
@@ -899,11 +899,12 @@ namespace gsr {
if(window && focused_window == window->get_system_handle())
return;
- if(recording_status == RecordingStatus::NONE) {
- if(focused_window != 0 && window_is_fullscreen(display, focused_window))
+ const bool prev_focused_window_is_fullscreen = focused_window_is_fullscreen;
+ focused_window_is_fullscreen = focused_window != 0 && window_is_fullscreen(display, focused_window);
+ if(focused_window_is_fullscreen != prev_focused_window_is_fullscreen) {
+ if(recording_status == RecordingStatus::NONE && focused_window_is_fullscreen)
on_press_start_replay(false);
- } else if(recording_status == RecordingStatus::REPLAY) {
- if(focused_window == 0 || !window_is_fullscreen(display, focused_window))
+ else if(recording_status == RecordingStatus::REPLAY && !focused_window_is_fullscreen)
on_press_start_replay(true);
}
}
@@ -912,12 +913,13 @@ namespace gsr {
if(config.replay_config.turn_on_replay_automatically_mode != "turn_on_at_power_supply_connected")
return;
- if(recording_status == RecordingStatus::NONE) {
- if(power_supply_online_filepath.empty() || power_supply_is_connected(power_supply_online_filepath.c_str()))
- on_press_start_replay(true);
- } else if(recording_status == RecordingStatus::REPLAY) {
- if(!power_supply_online_filepath.empty() && !power_supply_is_connected(power_supply_online_filepath.c_str()))
- on_press_start_replay(true);
+ const bool prev_power_supply_status = power_supply_connected;
+ power_supply_connected = power_supply_online_filepath.empty() || power_supply_is_connected(power_supply_online_filepath.c_str());
+ if(power_supply_connected != prev_power_supply_status) {
+ if(recording_status == RecordingStatus::NONE && power_supply_connected)
+ on_press_start_replay(false);
+ else if(recording_status == RecordingStatus::REPLAY && !power_supply_connected)
+ on_press_start_replay(false);
}
}