@@ -112,13 +112,7 @@ std::optional<std::string> SaveScreenshot(std::vector<uint8> data, int width, in
112
112
}
113
113
114
114
extern WindowSystem::WindowInfo g_window_info;
115
- const std::unordered_map<sHotkeyCfg *, std::function<void (void )>> HotkeySettings::s_cfgHotkeyToFuncMap{
116
- {&s_cfgHotkeys.toggleFullscreen , [](void ) { s_mainWindow->ShowFullScreen (!s_mainWindow->IsFullScreen ()); }},
117
- {&s_cfgHotkeys.toggleFullscreenAlt , [](void ) { s_mainWindow->ShowFullScreen (!s_mainWindow->IsFullScreen ()); }},
118
- {&s_cfgHotkeys.exitFullscreen , [](void ) { s_mainWindow->ShowFullScreen (false ); }},
119
- {&s_cfgHotkeys.takeScreenshot , [](void ) { if (g_renderer) g_renderer->RequestScreenshot (SaveScreenshot); }},
120
- {&s_cfgHotkeys.toggleFastForward , [](void ) { ActiveSettings::SetTimerShiftFactor ((ActiveSettings::GetTimerShiftFactor () < 3 ) ? 3 : 1 ); }},
121
- };
115
+ std::unordered_map<sHotkeyCfg *, std::function<void (void )>> HotkeySettings::s_cfgHotkeyToFuncMap;
122
116
123
117
struct HotkeyEntry
124
118
{
@@ -180,6 +174,25 @@ HotkeySettings::~HotkeySettings()
180
174
181
175
void HotkeySettings::Init (wxFrame* mainWindowFrame)
182
176
{
177
+ s_cfgHotkeyToFuncMap.insert ({
178
+ {&s_cfgHotkeys.toggleFullscreen , [](void ) {
179
+ s_mainWindow->ShowFullScreen (!s_mainWindow->IsFullScreen ());
180
+ }},
181
+ {&s_cfgHotkeys.toggleFullscreenAlt , [](void ) {
182
+ s_mainWindow->ShowFullScreen (!s_mainWindow->IsFullScreen ());
183
+ }},
184
+ {&s_cfgHotkeys.exitFullscreen , [](void ) {
185
+ s_mainWindow->ShowFullScreen (false );
186
+ }},
187
+ {&s_cfgHotkeys.takeScreenshot , [](void ) {
188
+ if (g_renderer)
189
+ g_renderer->RequestScreenshot (SaveScreenshot);
190
+ }},
191
+ {&s_cfgHotkeys.toggleFastForward , [](void ) {
192
+ ActiveSettings::SetTimerShiftFactor ((ActiveSettings::GetTimerShiftFactor () < 3 ) ? 3 : 1 );
193
+ }},
194
+ });
195
+
183
196
s_keyboardHotkeyToFuncMap.reserve (s_cfgHotkeyToFuncMap.size ());
184
197
for (const auto & [cfgHotkey, func] : s_cfgHotkeyToFuncMap)
185
198
{
@@ -325,7 +338,7 @@ void HotkeySettings::OnKeyboardHotkeyInputRightClick(wxMouseEvent& event)
325
338
}
326
339
auto * inputButton = static_cast <wxButton*>(event.GetEventObject ());
327
340
auto & cfgHotkey = *static_cast <sHotkeyCfg *>(inputButton->GetClientData ());
328
- uKeyboardHotkey newHotkey{ sHotkeyCfg ::keyboardNone };
341
+ uKeyboardHotkey newHotkey{sHotkeyCfg ::keyboardNone};
329
342
if (cfgHotkey.keyboard .raw != newHotkey.raw )
330
343
{
331
344
m_needToSave |= true ;
@@ -344,7 +357,7 @@ void HotkeySettings::OnControllerHotkeyInputRightClick(wxMouseEvent& event)
344
357
}
345
358
auto * inputButton = static_cast <wxButton*>(event.GetEventObject ());
346
359
auto & cfgHotkey = *static_cast <sHotkeyCfg *>(inputButton->GetClientData ());
347
- ControllerHotkey_t newHotkey{ sHotkeyCfg ::controllerNone };
360
+ ControllerHotkey_t newHotkey{sHotkeyCfg ::controllerNone};
348
361
if (cfgHotkey.controller != newHotkey)
349
362
{
350
363
m_needToSave |= true ;
@@ -394,7 +407,7 @@ void HotkeySettings::OnKeyUp(wxKeyEvent& event)
394
407
FinalizeInput<uKeyboardHotkey>(inputButton);
395
408
}
396
409
397
- template <typename T>
410
+ template <typename T>
398
411
void HotkeySettings::FinalizeInput (wxButton* inputButton)
399
412
{
400
413
auto & cfgHotkey = *static_cast <sHotkeyCfg *>(inputButton->GetClientData ());
@@ -409,7 +422,7 @@ void HotkeySettings::FinalizeInput(wxButton* inputButton)
409
422
m_activeInputButton = nullptr ;
410
423
}
411
424
412
- template <typename T>
425
+ template <typename T>
413
426
void HotkeySettings::RestoreInputButton (void )
414
427
{
415
428
FinalizeInput<T>(m_activeInputButton);
0 commit comments