Skip to content

Commit

Permalink
very minor code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
VolsandJezuz committed Dec 8, 2015
1 parent b7b6511 commit b0e917b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static DWORD WINAPI DummyWindowThread(LPVOID lpBla)

MSG msg;

while (GetMessage(&msg, NULL, 0, 0) > 0)
while (GetMessage(&msg, NULL, 0, 0) != 0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
Expand Down
18 changes: 10 additions & 8 deletions rawinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ unsigned int CRawInput::pollInput()
{
MSG msg;

while (GetMessage(&msg, CRawInput::hwndInput, 0, 0) > 0)
while (GetMessage(&msg, CRawInput::hwndInput, 0, 0) != 0)
DispatchMessage(&msg);

return msg.message;
Expand Down Expand Up @@ -233,7 +233,8 @@ int __stdcall CRawInput::hSetCursorPos(int x, int y)
{
if (n_sourceEXE == 2)
{
++CRawInput::signal;
if (CRawInput::signal >= 1)
++CRawInput::signal;

// Bug fix for Steam overlay in TF2 backpack
if (((consec_EndScene == 6) && (CRawInput::consecG == 3)) && !CRawInput::alttab)
Expand Down Expand Up @@ -287,15 +288,14 @@ int __stdcall CRawInput::hGetCursorPos(LPPOINT lpPoint)
{
// Split off raw input handling to accumulate independently
CRawInput::set_x += CRawInput::x;
CRawInput::set_y += CRawInput::y;

// Raw input accumulation resets moved here from hSetCursorPos
CRawInput::x = 0;
CRawInput::set_y += CRawInput::y;
CRawInput::y = 0;

if (n_sourceEXE == 2)
{
++CRawInput::signal;
if (CRawInput::signal >= 1)
++CRawInput::signal;

if (CRawInput::consecG < 3)
++CRawInput::consecG;
Expand Down Expand Up @@ -371,7 +371,7 @@ LRESULT CALLBACK CRawInput::SubclassWndProc(HWND hWnd, UINT uMsg, WPARAM wParam,
{
case WM_SETFOCUS:
// Bug fix during alt-tab back into TF2 backpack
CRawInput::signal = 0;
CRawInput::signal = 1;
CRawInput::hCreateThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)CRawInput::blockInput, NULL, 0, 0);
break;

Expand All @@ -391,9 +391,11 @@ void CRawInput::blockInput()
BlockInput(TRUE);

// Unblock input after 7 SetCursorPos and/or GetCursorPos calls
for (size_t q = 0; CRawInput::signal < 7; ++q)
for (size_t q = 0; CRawInput::signal < 8; ++q)
Sleep(16);

CRawInput::signal = 0;

BlockInput(FALSE);
CloseHandle(CRawInput::hCreateThread);
}
Expand Down

0 comments on commit b0e917b

Please sign in to comment.