mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-10-03 08:48:14 -07:00
overlay: create a dedicated thread for polling hotkeys (#864)
## Link to GitHub Issue or related Pull Request, if one exists n/a ## Description of change Create a new thread that polls for the following hotkeys: * super exit (both alt+f4 and bound key) * coin insert * screenshot The goal is to make the capture of these more reliable, because before this PR it wasn't. ## Testing
This commit is contained in:
@@ -158,6 +158,11 @@ void overlay::destroy(HWND hWnd) {
|
||||
}
|
||||
}
|
||||
|
||||
bool overlay::global_hotkeys_triggered() {
|
||||
const std::lock_guard<std::mutex> lock(OVERLAY_MUTEX);
|
||||
return !overlay::OVERLAY || overlay::OVERLAY->hotkeys_triggered();
|
||||
}
|
||||
|
||||
overlay::SpiceOverlay::SpiceOverlay(HWND hWnd, IDirect3D9 *d3d, IDirect3DDevice9 *device)
|
||||
: renderer(OverlayRenderer::D3D9), hWnd(hWnd), d3d(d3d), device(device) {
|
||||
log_info("overlay", "initializing (D3D9)");
|
||||
@@ -924,6 +929,9 @@ bool overlay::SpiceOverlay::has_focus() {
|
||||
}
|
||||
|
||||
bool overlay::SpiceOverlay::hotkeys_triggered() {
|
||||
const std::lock_guard<std::mutex> lock(this->hotkeys_mutex);
|
||||
|
||||
// this query also consumes the shared HotkeyToggle edge; the mutex gives all callers one latch
|
||||
// prevent hotkeys in spicecfg
|
||||
if (cfg::CONFIGURATOR_STANDALONE) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user