First shot (not even compiled) at Windows hit-testing support.
authorRyan C. Gordon <icculus@icculus.org>
Thu, 29 May 2014 13:39:02 -0400
changeset 8938c73bac338b90
parent 8937 e5caf226926d
child 8939 caaa7653f02b
First shot (not even compiled) at Windows hit-testing support.
src/video/windows/SDL_windowsevents.c
src/video/windows/SDL_windowsvideo.c
src/video/windows/SDL_windowswindow.c
src/video/windows/SDL_windowswindow.h
     1.1 --- a/src/video/windows/SDL_windowsevents.c	Thu May 29 13:38:39 2014 -0400
     1.2 +++ b/src/video/windows/SDL_windowsevents.c	Thu May 29 13:39:02 2014 -0400
     1.3 @@ -865,6 +865,21 @@
     1.4              return 0;
     1.5          }
     1.6          break;
     1.7 +
     1.8 +    case WM_NCHITTEST:
     1.9 +        {
    1.10 +            SDL_Window *window = data->window;
    1.11 +            if (window->hit_test) {
    1.12 +                const SDL_Point point = { (int) LOWORD(lParam), (int) HIWORD(lParam) };
    1.13 +                const SDL_HitTestResult rc = window->hit_test(window, &point, window->hit_test_data);
    1.14 +                if (rc == SDL_HITTEST_DRAGGABLE) {
    1.15 +                    return HTCAPTION;
    1.16 +                }
    1.17 +                // if we didn't return, this will call DefWindowProc below.
    1.18 +            }
    1.19 +        }
    1.20 +        break;
    1.21 +
    1.22      }
    1.23  
    1.24      /* If there's a window proc, assume it's going to handle messages */
     2.1 --- a/src/video/windows/SDL_windowsvideo.c	Thu May 29 13:38:39 2014 -0400
     2.2 +++ b/src/video/windows/SDL_windowsvideo.c	Thu May 29 13:39:02 2014 -0400
     2.3 @@ -121,6 +121,7 @@
     2.4      device->UpdateWindowFramebuffer = WIN_UpdateWindowFramebuffer;
     2.5      device->DestroyWindowFramebuffer = WIN_DestroyWindowFramebuffer;
     2.6      device->OnWindowEnter = WIN_OnWindowEnter;
     2.7 +    device->SetWindowHitTest = WIN_SetWindowHitTest;
     2.8  
     2.9      device->shape_driver.CreateShaper = Win32_CreateShaper;
    2.10      device->shape_driver.SetWindowShape = Win32_SetWindowShape;
     3.1 --- a/src/video/windows/SDL_windowswindow.c	Thu May 29 13:38:39 2014 -0400
     3.2 +++ b/src/video/windows/SDL_windowswindow.c	Thu May 29 13:39:02 2014 -0400
     3.3 @@ -782,6 +782,12 @@
     3.4      }
     3.5  }
     3.6  
     3.7 +int
     3.8 +WIN_SetWindowHitTest(SDL_Window *window, SDL_bool enabled)
     3.9 +{
    3.10 +    return 0;  /* just succeed, the real work is done elsewhere. */
    3.11 +}
    3.12 +
    3.13  #endif /* SDL_VIDEO_DRIVER_WINDOWS */
    3.14  
    3.15  /* vi: set ts=4 sw=4 expandtab: */
     4.1 --- a/src/video/windows/SDL_windowswindow.h	Thu May 29 13:38:39 2014 -0400
     4.2 +++ b/src/video/windows/SDL_windowswindow.h	Thu May 29 13:39:02 2014 -0400
     4.3 @@ -68,6 +68,7 @@
     4.4                                      struct SDL_SysWMinfo *info);
     4.5  extern void WIN_OnWindowEnter(_THIS, SDL_Window * window);
     4.6  extern void WIN_UpdateClipCursor(SDL_Window *window);
     4.7 +extern int WIN_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
     4.8  
     4.9  #endif /* _SDL_windowswindow_h */
    4.10