src/video/windows/SDL_windowsmouse.c
author Sam Lantinga <slouken@libsdl.org>
Mon, 28 Feb 2011 23:50:32 -0800
changeset 5421 f8588afb6486
parent 5336 66d3c4a6d6f8
child 5472 674d45edfaeb
permissions -rwxr-xr-x
Added support for Windows cursors
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
/*
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
     2
    SDL - Simple DirectMedia Layer
5262
b530ef003506 Happy 2011! :)
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
     3
    Copyright (C) 1997-2011 Sam Lantinga
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
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
     5
    This library is free software; you can redistribute it and/or
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
     6
    modify it under the terms of the GNU Lesser General Public
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
     7
    License as published by the Free Software Foundation; either
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
    version 2.1 of the License, or (at your option) any later version.
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
     9
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
    10
    This library is distributed in the hope that it will be useful,
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
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
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
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
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
    13
    Lesser General Public License for more details.
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
    14
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
    15
    You should have received a copy of the GNU Lesser General Public
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
    16
    License along with this library; if not, write to the Free Software
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
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
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
    18
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
    19
    Sam Lantinga
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
    slouken@libsdl.org
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
    21
*/
2710
44e49d3fa6cf Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
    22
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
    23
#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
    24
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
    SDL_Surface *cvt;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    53
    HICON hicon;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    54
    HDC hdc;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    55
    BITMAPV4HEADER bmh;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    56
    LPVOID pixels;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    57
    ICONINFO ii;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    58
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    59
    SDL_zero(bmh);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    60
    bmh.bV4Size = sizeof(bmh);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    61
    bmh.bV4Width = surface->w;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    62
    bmh.bV4Height = -surface->h; /* Invert the image */
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    63
    bmh.bV4Planes = 1;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    64
    bmh.bV4BitCount = 32;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    65
    bmh.bV4V4Compression = BI_BITFIELDS;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    66
    bmh.bV4AlphaMask = 0xFF000000;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    67
    bmh.bV4RedMask   = 0x00FF0000;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    68
    bmh.bV4GreenMask = 0x0000FF00;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    69
    bmh.bV4BlueMask  = 0x000000FF;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    70
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    71
    hdc = GetDC(NULL);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    72
    SDL_zero(ii);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    73
    ii.fIcon = FALSE;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    74
    ii.xHotspot = (DWORD)hot_x;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    75
    ii.yHotspot = (DWORD)hot_y;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    76
    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
    77
    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
    78
    ReleaseDC(NULL, hdc);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    79
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    80
    cvt = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ARGB8888, 0);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    81
    if (!cvt) {
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    82
        return NULL;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    83
    }
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    84
    SDL_memcpy(pixels, cvt->pixels, cvt->h * cvt->pitch);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    85
    SDL_FreeSurface(cvt);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    86
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    87
    hicon = CreateIconIndirect(&ii);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    88
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    89
    DeleteObject(ii.hbmColor);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    90
    DeleteObject(ii.hbmMask);
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
    if (!hicon) {
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    93
        WIN_SetError("CreateIconIndirect()");
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    94
        return NULL;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    95
    }
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    96
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    97
    cursor = SDL_calloc(1, sizeof(*cursor));
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    98
    if (cursor) {
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
    99
        cursor->driverdata = hicon;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   100
    } else {
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   101
        DestroyIcon(hicon);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   102
        SDL_OutOfMemory();
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
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   105
    return 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
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   108
static void
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   109
WIN_FreeCursor(SDL_Cursor * cursor)
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   110
{
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   111
    HICON hicon = (HICON)cursor->driverdata;
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
    DestroyIcon(hicon);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   114
    SDL_free(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
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   117
static int
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   118
WIN_ShowCursor(SDL_Cursor * cursor)
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   119
{
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   120
    if (cursor) {
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   121
        SDL_cursor = (HCURSOR)cursor->driverdata;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   122
    } else {
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   123
        SDL_cursor = NULL;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   124
    }
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   125
    if (SDL_GetMouseFocus() != NULL) {
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   126
        SetCursor(SDL_cursor);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   127
    }
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   128
    return 0;
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
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   131
static void
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   132
WIN_WarpMouse(SDL_Window * window, int x, int y)
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   133
{
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   134
    HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   135
    POINT pt;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   136
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   137
    pt.x = x;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   138
    pt.y = y;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   139
    ClientToScreen(hwnd, &pt);
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   140
    SetCursorPos(pt.x, pt.y);
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
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   143
static int
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   144
WIN_SetRelativeMouseMode(SDL_bool enabled)
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   145
{
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   146
    SDL_Unsupported();
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   147
    return -1;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   148
}
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   149
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
   150
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
   151
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
   152
{
5421
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   153
    SDL_Mouse *mouse = SDL_GetMouse();
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   154
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   155
    mouse->CreateCursor = WIN_CreateCursor;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   156
    mouse->ShowCursor = WIN_ShowCursor;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   157
    mouse->FreeCursor = WIN_FreeCursor;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   158
    mouse->WarpMouse = WIN_WarpMouse;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   159
    mouse->SetRelativeMouseMode = WIN_SetRelativeMouseMode;
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   160
f8588afb6486 Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5336
diff changeset
   161
    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
   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
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
   165
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
   166
{
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
   167
}
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
   168
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
   169
/* vi: set ts=4 sw=4 expandtab: */