[Bug 30814] Age of Empires II scrolling gets stuck after Alt-Tab away and back

wine-bugs at winehq.org wine-bugs at winehq.org
Sun Apr 7 16:34:32 CDT 2013


http://bugs.winehq.org/show_bug.cgi?id=30814

bshalm at broadpark.no changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bshalm at broadpark.no

--- Comment #11 from bshalm at broadpark.no 2013-04-07 16:34:32 CDT ---
I think the problem is that GetKeyboardState after ALT-TAB returns the 0x40
bit!
GetKeyboardState documentation only documents LSB and MSB, so maybe they just
do  something like "if (state[VK_LEFT])"

I modified the code to remove everything but LSB and MSB, now it is almost
perfect: If I ALT-TAB while holding a scrollkey, it will continue scrolling
until I hit that key again.

BOOL WINAPI DECLSPEC_HOTPATCH GetKeyboardState( LPBYTE state )
{
    BOOL ret;
    BOOL yo;
    int i;

    TRACE("(%p)\n", state);

    memset( state, 0, 256 );
    SERVER_START_REQ( get_key_state )
    {
        req->tid = GetCurrentThreadId();
        req->key = -1;
        wine_server_set_reply( req, state, 256 );
        ret = !wine_server_call_err( req );
    }
    SERVER_END_REQ;

    yo = state[VK_LEFT] || state[VK_UP] || state[VK_RIGHT] || state[VK_DOWN];

    if (yo)
        ERR("not-fixed: l=%02x u=%02x r=%02x d=%02x\n", state[VK_LEFT],
state[VK_UP], state[VK_RIGHT], state[VK_DOWN]);

    for (i = 0; i < 256; ++i)
        state[i] &= 0x81; // remove everything but LSB and MSB!

    if (yo)
        ERR("    fixed: l=%02x u=%02x r=%02x d=%02x\n", state[VK_LEFT],
state[VK_UP], state[VK_RIGHT], state[VK_DOWN]);

    return ret;
}

*before alt-tab*
err:win:GetKeyboardState     fixed: l=00 u=00 r=80 d=01
err:win:GetKeyboardState not-fixed: l=00 u=81 r=80 d=01
err:win:GetKeyboardState     fixed: l=00 u=81 r=80 d=01
err:win:GetKeyboardState not-fixed: l=00 u=81 r=80 d=01
err:win:GetKeyboardState     fixed: l=00 u=81 r=80 d=01
*after alt-tab*
err:win:GetKeyboardState not-fixed: l=40 u=41 r=40 d=00
err:win:GetKeyboardState     fixed: l=00 u=01 r=00 d=00
err:win:GetKeyboardState not-fixed: l=40 u=41 r=40 d=00
err:win:GetKeyboardState     fixed: l=00 u=01 r=00 d=00
err:win:GetKeyboardState not-fixed: l=40 u=41 r=40 d=00
err:win:GetKeyboardState     fixed: l=00 u=01 r=00 d=00

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list