steamclient: Monitor GameOverlayActivated_t callbacks to track overlay presence.

This commit is contained in:
Rémi Bernon 2020-12-17 18:44:41 +01:00 committed by Andrew Eikum
parent 38f603d7bf
commit 186f81ec47

View file

@ -28,6 +28,7 @@ char g_tmppath[PATH_MAX];
static char *controller_glyphs[512]; /* at least k_EControllerActionOrigin_Count */ static char *controller_glyphs[512]; /* at least k_EControllerActionOrigin_Count */
static CRITICAL_SECTION steamclient_cs = { NULL, -1, 0, 0, 0, 0 }; static CRITICAL_SECTION steamclient_cs = { NULL, -1, 0, 0, 0, 0 };
static HANDLE steam_overlay_event;
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved)
{ {
@ -37,6 +38,10 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved)
{ {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(instance); DisableThreadLibraryCalls(instance);
steam_overlay_event = CreateEventA(NULL, TRUE, FALSE, "__wine_steamclient_GameOverlayActivated");
break;
case DLL_PROCESS_DETACH:
CloseHandle(steam_overlay_event);
break; break;
} }
@ -554,6 +559,15 @@ bool CDECL Steam_BGetCallback(HSteamPipe pipe, struct winCallbackMsg_t *win_msg,
BOOL need_free = TRUE; BOOL need_free = TRUE;
win_msg->m_hSteamUser = lin_msg.m_hSteamUser; win_msg->m_hSteamUser = lin_msg.m_hSteamUser;
win_msg->m_iCallback = lin_msg.m_iCallback; win_msg->m_iCallback = lin_msg.m_iCallback;
if (win_msg->m_iCallback == 0x14b) /* GameOverlayActivated_t::k_iCallback */
{
uint8 activated = *(uint8 *)lin_msg.m_pubParam;
TRACE("steam overlay %sactivated, %sabling all X11 events.\n", activated ? "" : "de", activated ? "dis" : "en");
if (activated) SetEvent(steam_overlay_event);
else ResetEvent(steam_overlay_event);
}
switch(win_msg->m_iCallback | (lin_msg.m_cubParam << 16)){ switch(win_msg->m_iCallback | (lin_msg.m_cubParam << 16)){
#include "cb_converters.dat" #include "cb_converters.dat"
default: default: