steamcompmgr: Add workaround for Disgaea PC (405900)

This app doesn't like using the controller unless its clicked on first.
This commit is contained in:
Joshua Ashton 2023-02-23 05:07:37 +00:00
parent 9600bbaadf
commit a3dc37f262
2 changed files with 35 additions and 12 deletions

View file

@ -990,16 +990,25 @@ void MouseCursor::checkSuspension()
bool bWasHidden = m_hideForMovement;
if (buttonMask & ( Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask )) {
m_hideForMovement = false;
m_lastMovedTime = get_time_in_milliseconds();
steamcompmgr_win_t *window = m_ctx->focus.inputFocusWindow;
if (window && window->ignoreNextClickForVisibility)
{
window->ignoreNextClickForVisibility--;
m_hideForMovement = true;
return;
}
else
{
if (buttonMask & ( Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask )) {
m_hideForMovement = false;
m_lastMovedTime = get_time_in_milliseconds();
// Move the cursor back to where we left it if the window didn't want us to give
// it hover/focus where we left it and we moved it before.
steamcompmgr_win_t *window = m_ctx->focus.inputFocusWindow;
if (window_wants_no_focus_when_mouse_hidden(window) && bWasHidden)
{
XWarpPointer(m_ctx->dpy, None, x11_win(m_ctx->focus.inputFocusWindow), 0, 0, 0, 0, m_lastX, m_lastY);
// Move the cursor back to where we left it if the window didn't want us to give
// it hover/focus where we left it and we moved it before.
if (window_wants_no_focus_when_mouse_hidden(window) && bWasHidden)
{
XWarpPointer(m_ctx->dpy, None, x11_win(m_ctx->focus.inputFocusWindow), 0, 0, 0, 0, m_lastX, m_lastY);
}
}
}
@ -1007,8 +1016,6 @@ void MouseCursor::checkSuspension()
if (!m_hideForMovement && suspended) {
m_hideForMovement = true;
steamcompmgr_win_t *window = m_ctx->focus.inputFocusWindow;
// Rearm warp count
if (window) {
window->mouseMoved = 0;
@ -3176,7 +3183,22 @@ determine_and_apply_focus()
}
sdlwindow_visible( global_focus.focusWindow != nullptr );
// Some games such as Disagea PC (405900) don't take controller input until
// the window is first clicked on despite it having focus.
if ( global_focus.inputFocusWindow && global_focus.inputFocusWindow->appID == 405900 )
{
global_focus.inputFocusWindow->mouseMoved = 0;
global_focus.inputFocusWindow->ignoreNextClickForVisibility = 2;
auto now = get_time_in_milliseconds();
wlserver_lock();
wlserver_touchdown( 0.5, 0.5, 0, now );
wlserver_touchup( 0, now + 1 );
wlserver_unlock();
}
focusDirty = false;
}

View file

@ -114,6 +114,7 @@ struct steamcompmgr_win_t {
bool hasHwndStyle;
uint32_t hwndStyle;
bool hasHwndStyleEx;
int ignoreNextClickForVisibility;
uint32_t hwndStyleEx;
motif_hints_t *motif_hints;