Fixed hit-testing on Windows.
authorRyan C. Gordon
Fri, 30 May 2014 01:49:26 -0400
changeset 89419229a54e4952
parent 8940 850e149d02d8
child 8942 3d84839c97b2
Fixed hit-testing on Windows.

Needed to convert from screen to client coords.
src/video/windows/SDL_windowsevents.c
     1.1 --- a/src/video/windows/SDL_windowsevents.c	Fri May 30 01:48:26 2014 -0400
     1.2 +++ b/src/video/windows/SDL_windowsevents.c	Fri May 30 01:49:26 2014 -0400
     1.3 @@ -870,10 +870,13 @@
     1.4          {
     1.5              SDL_Window *window = data->window;
     1.6              if (window->hit_test) {
     1.7 -                const SDL_Point point = { (int) LOWORD(lParam), (int) HIWORD(lParam) };
     1.8 -                const SDL_HitTestResult rc = window->hit_test(window, &point, window->hit_test_data);
     1.9 -                if (rc == SDL_HITTEST_DRAGGABLE) {
    1.10 -                    return HTCAPTION;
    1.11 +                POINT winpoint = { (int) LOWORD(lParam), (int) HIWORD(lParam) };
    1.12 +                if (ScreenToClient(data->hwnd, &winpoint)) {
    1.13 +                    const SDL_Point point = { (int) winpoint.x, (int) winpoint.y };
    1.14 +                    const SDL_HitTestResult rc = window->hit_test(window, &point, window->hit_test_data);
    1.15 +                    if (rc == SDL_HITTEST_DRAGGABLE) {
    1.16 +                        return HTCAPTION;
    1.17 +                    }
    1.18                  }
    1.19                  // if we didn't return, this will call DefWindowProc below.
    1.20              }