Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Matlo committed Jul 22, 2014
1 parent b0d7c03 commit 8d285b9
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
29 changes: 24 additions & 5 deletions shared/event/src/windows/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,36 @@ HANDLE timer_start(int usec)
timeBeginPeriod(1);

hTimer = CreateWaitableTimer(NULL, FALSE, NULL);
LARGE_INTEGER li = { .QuadPart = 0 };
SetWaitableTimer(hTimer, &li, usec / 1000, NULL, NULL, FALSE);
if(hTimer)
{
LARGE_INTEGER li = { .QuadPart = -(usec*10) };
if(!SetWaitableTimer(hTimer, &li, usec / 1000, NULL, NULL, FALSE))
{
fprintf(stderr, "SetWaitableTimer failed.\n");
hTimer = NULL;
}
}
else
{
fprintf(stderr, "CreateWaitableTimer failed.\n");
}

if(!hTimer)
{
timeEndPeriod(0);
}

return hTimer;
}

int timer_close(int unused)
{
CloseHandle(hTimer);

timeEndPeriod(0);
if(hTimer)
{
CloseHandle(hTimer);

timeEndPeriod(0);
}

return 1;
}
Expand Down
6 changes: 4 additions & 2 deletions shared/event/src/windows/winmm/windows_wminput.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,9 +542,11 @@ void wminput_handler_buff()
}

/*
* For some reason GetRawInputBuffer does not work when winmm and SDL-1.2.14 are used together...
* For some reason GetRawInputBuffer does not work in Windows 8:
* it seems there remain WM_INPUT messages in the queue, which
* make the MsgWaitForMultipleInput always return immediately.
*/
int buff = 1;
int buff = 0;

static LRESULT CALLBACK RawWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
Expand Down
2 changes: 2 additions & 0 deletions shared/event/test/GE_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ int main(int argc, char* argv[])
//do something periodically
}

GE_TimerClose();

GE_quit();

printf("Exiting\n");
Expand Down

0 comments on commit 8d285b9

Please sign in to comment.