src/video/windows/SDL_windowsmouse.c
author Sam Lantinga <slouken@libsdl.org>
Fri, 08 Apr 2011 13:03:26 -0700
changeset 5535 96594ac5fd1a
parent 5472 674d45edfaeb
child 6044 35448a5ea044
permissions -rw-r--r--
SDL 1.3 is now under the zlib license.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     1
/*
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5472
diff changeset
     2
  Simple DirectMedia Layer
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5472
diff changeset
     3
  Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     4
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5472
diff changeset
     5
  This software is provided 'as-is', without any express or implied
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5472
diff changeset
     6
  warranty.  In no event will the authors be held liable for any damages
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5472
diff changeset
     7
  arising from the use of this software.
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     8
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5472
diff changeset
     9
  Permission is granted to anyone to use this software for any purpose,
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5472
diff changeset
    10
  including commercial applications, and to alter it and redistribute it
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5472
diff changeset
    11
  freely, subject to the following restrictions:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    12
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5472
diff changeset
    13
  1. The origin of this software must not be misrepresented; you must not
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5472
diff changeset
    14
     claim that you wrote the original software. If you use this software
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5472
diff changeset
    15
     in a product, an acknowledgment in the product documentation would be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5472
diff changeset
    16
     appreciated but is not required.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5472
diff changeset
    17
  2. Altered source versions must be plainly marked as such, and must not be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5472
diff changeset
    18
     misrepresented as being the original software.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5472
diff changeset
    19
  3. This notice may not be removed or altered from any source distribution.
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    20
*/
2710
44e49d3fa6cf Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
    21
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    22
#include "SDL_config.h"
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    23
5472
674d45edfaeb We can assume ARGB surface format when creating cursors (enforced by higher level API)
Sam Lantinga <slouken@libsdl.org>
parents: 5421
diff changeset
    24
#include "SDL_assert.h"
5062
e8916fe9cfc8 Fixed bug #925
Sam Lantinga <slouken@libsdl.org>
parents: 4465
diff changeset
    25
#include "SDL_windowsvideo.h"
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    26
5421
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    27
#include "../../events/SDL_mouse_c.h"
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    28
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    29
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    30
HCURSOR SDL_cursor = NULL;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    31
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    32
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    33
static SDL_Cursor *
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    34
WIN_CreateDefaultCursor()
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    35
{
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    36
    SDL_Cursor *cursor;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    37
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    38
    cursor = SDL_calloc(1, sizeof(*cursor));
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    39
    if (cursor) {
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    40
        cursor->driverdata = LoadCursor(NULL, IDC_ARROW);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    41
    } else {
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    42
        SDL_OutOfMemory();
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    43
    }
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    44
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    45
    return cursor;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    46
}
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    47
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    48
static SDL_Cursor *
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    49
WIN_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    50
{
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    51
    SDL_Cursor *cursor;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    52
    HICON hicon;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    53
    HDC hdc;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    54
    BITMAPV4HEADER bmh;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    55
    LPVOID pixels;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    56
    ICONINFO ii;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    57
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    58
    SDL_zero(bmh);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    59
    bmh.bV4Size = sizeof(bmh);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    60
    bmh.bV4Width = surface->w;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    61
    bmh.bV4Height = -surface->h; /* Invert the image */
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    62
    bmh.bV4Planes = 1;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    63
    bmh.bV4BitCount = 32;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    64
    bmh.bV4V4Compression = BI_BITFIELDS;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    65
    bmh.bV4AlphaMask = 0xFF000000;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    66
    bmh.bV4RedMask   = 0x00FF0000;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    67
    bmh.bV4GreenMask = 0x0000FF00;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    68
    bmh.bV4BlueMask  = 0x000000FF;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    69
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    70
    hdc = GetDC(NULL);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    71
    SDL_zero(ii);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    72
    ii.fIcon = FALSE;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    73
    ii.xHotspot = (DWORD)hot_x;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    74
    ii.yHotspot = (DWORD)hot_y;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    75
    ii.hbmColor = CreateDIBSection(hdc, (BITMAPINFO*)&bmh, DIB_RGB_COLORS, &pixels, NULL, 0);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    76
    ii.hbmMask = CreateBitmap(surface->w, surface->h, 1, 1, NULL);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    77
    ReleaseDC(NULL, hdc);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    78
5472
674d45edfaeb We can assume ARGB surface format when creating cursors (enforced by higher level API)
Sam Lantinga <slouken@libsdl.org>
parents: 5421
diff changeset
    79
    SDL_assert(surface->format->format == SDL_PIXELFORMAT_ARGB8888);
674d45edfaeb We can assume ARGB surface format when creating cursors (enforced by higher level API)
Sam Lantinga <slouken@libsdl.org>
parents: 5421
diff changeset
    80
    SDL_assert(surface->pitch == surface->w * 4);
674d45edfaeb We can assume ARGB surface format when creating cursors (enforced by higher level API)
Sam Lantinga <slouken@libsdl.org>
parents: 5421
diff changeset
    81
    SDL_memcpy(pixels, surface->pixels, surface->h * surface->pitch);
5421
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    82
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    83
    hicon = CreateIconIndirect(&ii);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    84
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    85
    DeleteObject(ii.hbmColor);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    86
    DeleteObject(ii.hbmMask);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    87
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    88
    if (!hicon) {
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    89
        WIN_SetError("CreateIconIndirect()");
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    90
        return NULL;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    91
    }
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    92
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    93
    cursor = SDL_calloc(1, sizeof(*cursor));
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    94
    if (cursor) {
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    95
        cursor->driverdata = hicon;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    96
    } else {
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    97
        DestroyIcon(hicon);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    98
        SDL_OutOfMemory();
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    99
    }
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   100
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   101
    return cursor;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   102
}
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   103
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   104
static void
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   105
WIN_FreeCursor(SDL_Cursor * cursor)
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   106
{
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   107
    HICON hicon = (HICON)cursor->driverdata;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   108
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   109
    DestroyIcon(hicon);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   110
    SDL_free(cursor);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   111
}
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   112
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   113
static int
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   114
WIN_ShowCursor(SDL_Cursor * cursor)
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   115
{
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   116
    if (cursor) {
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   117
        SDL_cursor = (HCURSOR)cursor->driverdata;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   118
    } else {
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   119
        SDL_cursor = NULL;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   120
    }
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   121
    if (SDL_GetMouseFocus() != NULL) {
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   122
        SetCursor(SDL_cursor);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   123
    }
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   124
    return 0;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   125
}
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   126
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   127
static void
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   128
WIN_WarpMouse(SDL_Window * window, int x, int y)
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   129
{
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   130
    HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   131
    POINT pt;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   132
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   133
    pt.x = x;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   134
    pt.y = y;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   135
    ClientToScreen(hwnd, &pt);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   136
    SetCursorPos(pt.x, pt.y);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   137
}
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   138
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   139
static int
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   140
WIN_SetRelativeMouseMode(SDL_bool enabled)
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   141
{
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   142
    SDL_Unsupported();
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   143
    return -1;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   144
}
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   145
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   146
void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   147
WIN_InitMouse(_THIS)
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   148
{
5421
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   149
    SDL_Mouse *mouse = SDL_GetMouse();
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   150
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   151
    mouse->CreateCursor = WIN_CreateCursor;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   152
    mouse->ShowCursor = WIN_ShowCursor;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   153
    mouse->FreeCursor = WIN_FreeCursor;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   154
    mouse->WarpMouse = WIN_WarpMouse;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   155
    mouse->SetRelativeMouseMode = WIN_SetRelativeMouseMode;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   156
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   157
    SDL_SetDefaultCursor(WIN_CreateDefaultCursor());
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   158
}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   159
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   160
void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   161
WIN_QuitMouse(_THIS)
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   162
{
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   163
}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   164
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   165
/* vi: set ts=4 sw=4 expandtab: */