src/events/SDL_mouse.c
author Sam Lantinga <slouken@libsdl.org>
Mon, 21 Feb 2011 17:15:50 -0800
changeset 5376 183ec2d4485c
parent 5371 fc3d3d580777
child 5405 64fa8526e1ce
permissions -rw-r--r--
Implemented cursor support and SDL_WarpMouseInWindow() on Mac OS X
slouken@0
     1
/*
slouken@0
     2
    SDL - Simple DirectMedia Layer
slouken@5262
     3
    Copyright (C) 1997-2011 Sam Lantinga
slouken@0
     4
slouken@0
     5
    This library is free software; you can redistribute it and/or
slouken@1312
     6
    modify it under the terms of the GNU Lesser General Public
slouken@0
     7
    License as published by the Free Software Foundation; either
slouken@1312
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@0
     9
slouken@0
    10
    This library is distributed in the hope that it will be useful,
slouken@0
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@0
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1312
    13
    Lesser General Public License for more details.
slouken@0
    14
slouken@1312
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1312
    16
    License along with this library; if not, write to the Free Software
slouken@1312
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@0
    18
slouken@0
    19
    Sam Lantinga
slouken@252
    20
    slouken@libsdl.org
slouken@0
    21
*/
slouken@1402
    22
#include "SDL_config.h"
slouken@0
    23
slouken@0
    24
/* General mouse handling code for SDL */
slouken@0
    25
slouken@0
    26
#include "SDL_events.h"
slouken@0
    27
#include "SDL_events_c.h"
slouken@1895
    28
#include "default_cursor.h"
slouken@3685
    29
#include "../video/SDL_sysvideo.h"
slouken@0
    30
slouken@0
    31
slouken@5371
    32
/* The mouse state */
slouken@4465
    33
static SDL_Mouse SDL_mouse;
slouken@0
    34
slouken@0
    35
slouken@0
    36
/* Public functions */
slouken@1895
    37
int
slouken@1895
    38
SDL_MouseInit(void)
slouken@0
    39
{
slouken@5376
    40
    SDL_Mouse *mouse = SDL_GetMouse();
slouken@5376
    41
slouken@5376
    42
    mouse->cursor_shown = SDL_TRUE;
slouken@5376
    43
slouken@1895
    44
    return (0);
slouken@1123
    45
}
slouken@0
    46
slouken@5371
    47
SDL_Mouse *
slouken@5371
    48
SDL_GetMouse(void)
slouken@5371
    49
{
slouken@5371
    50
    return &SDL_mouse;
slouken@5371
    51
}
slouken@5371
    52
slouken@4465
    53
SDL_Window *
slouken@4465
    54
SDL_GetMouseFocus(void)
slouken@2710
    55
{
slouken@5371
    56
    SDL_Mouse *mouse = SDL_GetMouse();
slouken@2940
    57
slouken@4465
    58
    return mouse->focus;
slouken@0
    59
}
slouken@0
    60
slouken@1895
    61
void
slouken@4465
    62
SDL_SetMouseFocus(SDL_Window * window)
slouken@0
    63
{
slouken@5371
    64
    SDL_Mouse *mouse = SDL_GetMouse();
slouken@1895
    65
slouken@4465
    66
    if (mouse->focus == window) {
slouken@1895
    67
        return;
slouken@1895
    68
    }
slouken@1895
    69
slouken@1895
    70
    /* See if the current window has lost focus */
slouken@1895
    71
    if (mouse->focus) {
slouken@4465
    72
        SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_LEAVE, 0, 0);
slouken@1895
    73
    }
slouken@1895
    74
slouken@3685
    75
    mouse->focus = window;
slouken@1895
    76
slouken@1895
    77
    if (mouse->focus) {
slouken@4465
    78
        SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_ENTER, 0, 0);
slouken@1895
    79
    }
slouken@1895
    80
}
slouken@1895
    81
slouken@1895
    82
int
slouken@4484
    83
SDL_SendMouseMotion(SDL_Window * window, int relative, int x, int y)
slouken@1895
    84
{
slouken@5371
    85
    SDL_Mouse *mouse = SDL_GetMouse();
slouken@1895
    86
    int posted;
slouken@1895
    87
    int xrel;
slouken@1895
    88
    int yrel;
slouken@2860
    89
    int x_max = 0, y_max = 0;
slouken@1895
    90
slouken@4484
    91
    if (window) {
slouken@4484
    92
        SDL_SetMouseFocus(window);
slouken@4484
    93
    }
slouken@4484
    94
slouken@2710
    95
    /* the relative motion is calculated regarding the system cursor last position */
slouken@2842
    96
    if (relative) {
slouken@2842
    97
        xrel = x;
slouken@2842
    98
        yrel = y;
slouken@2860
    99
        x = (mouse->last_x + x);
slouken@2860
   100
        y = (mouse->last_y + y);
slouken@2842
   101
    } else {
slouken@2860
   102
        xrel = x - mouse->last_x;
slouken@2860
   103
        yrel = y - mouse->last_y;
slouken@2842
   104
    }
slouken@2710
   105
slouken@1895
   106
    /* Drop events that don't change state */
slouken@1895
   107
    if (!xrel && !yrel) {
slouken@1895
   108
#if 0
slouken@1895
   109
        printf("Mouse event didn't change state - dropped!\n");
slouken@1895
   110
#endif
slouken@1895
   111
        return 0;
slouken@1895
   112
    }
slouken@1895
   113
slouken@2710
   114
    /* Update internal mouse coordinates */
slouken@2710
   115
    if (mouse->relative_mode == SDL_FALSE) {
slouken@1895
   116
        mouse->x = x;
slouken@1895
   117
        mouse->y = y;
slouken@2710
   118
    } else {
slouken@2860
   119
        mouse->x += xrel;
slouken@2860
   120
        mouse->y += yrel;
slouken@2860
   121
    }
slouken@2849
   122
slouken@2860
   123
    SDL_GetWindowSize(mouse->focus, &x_max, &y_max);
slouken@5370
   124
    --x_max;
slouken@5370
   125
    --y_max;
slouken@2849
   126
slouken@2860
   127
    /* make sure that the pointers find themselves inside the windows */
slouken@2860
   128
    /* only check if mouse->xmax is set ! */
slouken@5370
   129
    if (mouse->x > x_max) {
slouken@2860
   130
        mouse->x = x_max;
slouken@5370
   131
    }
slouken@5370
   132
    if (mouse->x < 0) {
slouken@2860
   133
        mouse->x = 0;
slouken@1895
   134
    }
slouken@2860
   135
slouken@5370
   136
    if (mouse->y > y_max) {
slouken@2860
   137
        mouse->y = y_max;
slouken@5370
   138
    }
slouken@5370
   139
    if (mouse->y < 0) {
slouken@2860
   140
        mouse->y = 0;
slouken@2860
   141
    }
slouken@2860
   142
slouken@1895
   143
    mouse->xdelta += xrel;
slouken@1895
   144
    mouse->ydelta += yrel;
slouken@1895
   145
slouken@4465
   146
#if 0 /* FIXME */
slouken@1895
   147
    /* Move the mouse cursor, if needed */
slouken@1895
   148
    if (mouse->cursor_shown && !mouse->relative_mode &&
slouken@1895
   149
        mouse->MoveCursor && mouse->cur_cursor) {
slouken@1895
   150
        mouse->MoveCursor(mouse->cur_cursor);
slouken@1895
   151
    }
slouken@4465
   152
#endif
slouken@1895
   153
slouken@1895
   154
    /* Post the event, if desired */
slouken@1895
   155
    posted = 0;
slouken@4465
   156
    if (SDL_GetEventState(SDL_MOUSEMOTION) == SDL_ENABLE) {
slouken@1895
   157
        SDL_Event event;
slouken@1895
   158
        event.motion.type = SDL_MOUSEMOTION;
slouken@4465
   159
        event.motion.windowID = mouse->focus ? mouse->focus->id : 0;
slouken@1895
   160
        event.motion.state = mouse->buttonstate;
slouken@1895
   161
        event.motion.x = mouse->x;
slouken@1895
   162
        event.motion.y = mouse->y;
slouken@1895
   163
        event.motion.xrel = xrel;
slouken@1895
   164
        event.motion.yrel = yrel;
slouken@1895
   165
        posted = (SDL_PushEvent(&event) > 0);
slouken@1895
   166
    }
lestat@3112
   167
    mouse->last_x = mouse->x;
lestat@3112
   168
    mouse->last_y = mouse->y;
slouken@1895
   169
    return posted;
slouken@1895
   170
}
slouken@1895
   171
slouken@1895
   172
int
slouken@4484
   173
SDL_SendMouseButton(SDL_Window * window, Uint8 state, Uint8 button)
slouken@1895
   174
{
slouken@5371
   175
    SDL_Mouse *mouse = SDL_GetMouse();
slouken@1895
   176
    int posted;
slouken@4429
   177
    Uint32 type;
slouken@1895
   178
slouken@4484
   179
    if (window) {
slouken@4484
   180
        SDL_SetMouseFocus(window);
slouken@4484
   181
    }
slouken@4484
   182
slouken@1895
   183
    /* Figure out which event to perform */
slouken@1895
   184
    switch (state) {
slouken@1895
   185
    case SDL_PRESSED:
slouken@1895
   186
        if (mouse->buttonstate & SDL_BUTTON(button)) {
slouken@1895
   187
            /* Ignore this event, no state change */
slouken@1895
   188
            return 0;
slouken@1895
   189
        }
slouken@1895
   190
        type = SDL_MOUSEBUTTONDOWN;
slouken@1895
   191
        mouse->buttonstate |= SDL_BUTTON(button);
slouken@1895
   192
        break;
slouken@1895
   193
    case SDL_RELEASED:
slouken@2725
   194
        if (!(mouse->buttonstate & SDL_BUTTON(button))) {
kazeuser@2718
   195
            /* Ignore this event, no state change */
kazeuser@2718
   196
            return 0;
kazeuser@2718
   197
        }
slouken@1895
   198
        type = SDL_MOUSEBUTTONUP;
slouken@1895
   199
        mouse->buttonstate &= ~SDL_BUTTON(button);
slouken@1895
   200
        break;
slouken@1895
   201
    default:
slouken@1895
   202
        /* Invalid state -- bail */
slouken@1895
   203
        return 0;
slouken@1895
   204
    }
slouken@1895
   205
slouken@1895
   206
    /* Post the event, if desired */
slouken@1895
   207
    posted = 0;
slouken@4429
   208
    if (SDL_GetEventState(type) == SDL_ENABLE) {
slouken@1895
   209
        SDL_Event event;
slouken@1895
   210
        event.type = type;
slouken@1895
   211
        event.button.state = state;
slouken@1895
   212
        event.button.button = button;
slouken@1895
   213
        event.button.x = mouse->x;
slouken@1895
   214
        event.button.y = mouse->y;
slouken@3689
   215
        event.button.windowID = mouse->focus ? mouse->focus->id : 0;
slouken@1895
   216
        posted = (SDL_PushEvent(&event) > 0);
slouken@1895
   217
    }
slouken@1895
   218
    return posted;
slouken@1895
   219
}
slouken@1895
   220
slouken@1895
   221
int
slouken@4484
   222
SDL_SendMouseWheel(SDL_Window * window, int x, int y)
slouken@1895
   223
{
slouken@5371
   224
    SDL_Mouse *mouse = SDL_GetMouse();
slouken@1895
   225
    int posted;
slouken@1895
   226
slouken@4484
   227
    if (window) {
slouken@4484
   228
        SDL_SetMouseFocus(window);
slouken@4484
   229
    }
slouken@4484
   230
slouken@4465
   231
    if (!x && !y) {
slouken@1895
   232
        return 0;
slouken@1895
   233
    }
slouken@1895
   234
slouken@1895
   235
    /* Post the event, if desired */
slouken@1895
   236
    posted = 0;
slouken@4429
   237
    if (SDL_GetEventState(SDL_MOUSEWHEEL) == SDL_ENABLE) {
slouken@1895
   238
        SDL_Event event;
slouken@1895
   239
        event.type = SDL_MOUSEWHEEL;
slouken@4465
   240
        event.wheel.windowID = mouse->focus ? mouse->focus->id : 0;
slouken@2152
   241
        event.wheel.x = x;
slouken@2152
   242
        event.wheel.y = y;
slouken@1895
   243
        posted = (SDL_PushEvent(&event) > 0);
slouken@1895
   244
    }
slouken@1895
   245
    return posted;
slouken@1895
   246
}
slouken@1895
   247
slouken@1895
   248
void
slouken@4465
   249
SDL_MouseQuit(void)
slouken@4465
   250
{
slouken@4465
   251
}
slouken@4465
   252
slouken@4465
   253
Uint8
slouken@4465
   254
SDL_GetMouseState(int *x, int *y)
slouken@4465
   255
{
slouken@5371
   256
    SDL_Mouse *mouse = SDL_GetMouse();
slouken@4465
   257
slouken@4465
   258
    if (x) {
slouken@4465
   259
        *x = mouse->x;
slouken@4465
   260
    }
slouken@4465
   261
    if (y) {
slouken@4465
   262
        *y = mouse->y;
slouken@4465
   263
    }
slouken@4465
   264
    return mouse->buttonstate;
slouken@4465
   265
}
slouken@4465
   266
slouken@4465
   267
Uint8
slouken@4465
   268
SDL_GetRelativeMouseState(int *x, int *y)
slouken@4465
   269
{
slouken@5371
   270
    SDL_Mouse *mouse = SDL_GetMouse();
slouken@4465
   271
slouken@4465
   272
    if (x) {
slouken@4465
   273
        *x = mouse->xdelta;
slouken@4465
   274
    }
slouken@4465
   275
    if (y) {
slouken@4465
   276
        *y = mouse->ydelta;
slouken@4465
   277
    }
slouken@4465
   278
    mouse->xdelta = 0;
slouken@4465
   279
    mouse->ydelta = 0;
slouken@4465
   280
    return mouse->buttonstate;
slouken@4465
   281
}
slouken@4465
   282
slouken@4465
   283
void
slouken@3685
   284
SDL_WarpMouseInWindow(SDL_Window * window, int x, int y)
slouken@1895
   285
{
slouken@5371
   286
    SDL_Mouse *mouse = SDL_GetMouse();
slouken@1895
   287
slouken@1895
   288
    if (mouse->WarpMouse) {
slouken@5371
   289
        mouse->WarpMouse(window, x, y);
slouken@1895
   290
    } else {
slouken@4484
   291
        SDL_SendMouseMotion(window, 0, x, y);
slouken@1895
   292
    }
slouken@1895
   293
}
slouken@1895
   294
slouken@4465
   295
int
slouken@4465
   296
SDL_SetRelativeMouseMode(SDL_bool enabled)
slouken@4465
   297
{
slouken@5371
   298
    SDL_Mouse *mouse = SDL_GetMouse();
slouken@4465
   299
slouken@4465
   300
    /* Flush pending mouse motion */
slouken@4465
   301
    SDL_FlushEvent(SDL_MOUSEMOTION);
slouken@4465
   302
slouken@4465
   303
    /* Set the relative mode */
slouken@4465
   304
    mouse->relative_mode = enabled;
slouken@4465
   305
slouken@4465
   306
    if (!enabled) {
slouken@4465
   307
        /* Restore the expected mouse position */
slouken@4465
   308
        SDL_WarpMouseInWindow(mouse->focus, mouse->x, mouse->y);
slouken@4465
   309
    }
slouken@4465
   310
slouken@4465
   311
    /* Update cursor visibility */
slouken@4465
   312
    SDL_SetCursor(NULL);
slouken@4465
   313
slouken@4465
   314
    return 0;
slouken@4465
   315
}
slouken@4465
   316
slouken@4465
   317
SDL_bool
slouken@4465
   318
SDL_GetRelativeMouseMode()
slouken@4465
   319
{
slouken@5371
   320
    SDL_Mouse *mouse = SDL_GetMouse();
slouken@4465
   321
slouken@4465
   322
    return mouse->relative_mode;
slouken@4465
   323
}
slouken@4465
   324
slouken@1895
   325
SDL_Cursor *
slouken@1895
   326
SDL_CreateCursor(const Uint8 * data, const Uint8 * mask,
slouken@1895
   327
                 int w, int h, int hot_x, int hot_y)
slouken@1895
   328
{
slouken@5371
   329
    SDL_Mouse *mouse = SDL_GetMouse();
slouken@1895
   330
    SDL_Surface *surface;
slouken@1895
   331
    SDL_Cursor *cursor;
slouken@1895
   332
    int x, y;
slouken@1895
   333
    Uint32 *pixel;
slouken@4465
   334
    Uint8 datab = 0, maskb = 0;
slouken@1895
   335
    const Uint32 black = 0xFF000000;
slouken@1895
   336
    const Uint32 white = 0xFFFFFFFF;
slouken@1895
   337
    const Uint32 transparent = 0x00000000;
slouken@1895
   338
slouken@1895
   339
    if (!mouse->CreateCursor) {
slouken@4465
   340
        SDL_SetError("Cursors are not currently supported");
slouken@1895
   341
        return NULL;
slouken@1895
   342
    }
slouken@1895
   343
slouken@1895
   344
    /* Sanity check the hot spot */
slouken@1895
   345
    if ((hot_x < 0) || (hot_y < 0) || (hot_x >= w) || (hot_y >= h)) {
slouken@1895
   346
        SDL_SetError("Cursor hot spot doesn't lie within cursor");
slouken@1895
   347
        return NULL;
slouken@1895
   348
    }
slouken@1895
   349
slouken@1895
   350
    /* Make sure the width is a multiple of 8 */
slouken@1895
   351
    w = ((w + 7) & ~7);
slouken@1895
   352
slouken@1895
   353
    /* Create the surface from a bitmap */
slouken@1895
   354
    surface =
slouken@1895
   355
        SDL_CreateRGBSurface(0, w, h, 32, 0x00FF0000, 0x0000FF00, 0x000000FF,
slouken@1895
   356
                             0xFF000000);
slouken@1895
   357
    if (!surface) {
slouken@1895
   358
        return NULL;
slouken@1895
   359
    }
slouken@1895
   360
    for (y = 0; y < h; ++y) {
slouken@1895
   361
        pixel = (Uint32 *) ((Uint8 *) surface->pixels + y * surface->pitch);
slouken@1895
   362
        for (x = 0; x < w; ++x) {
slouken@1895
   363
            if ((x % 8) == 0) {
slouken@1895
   364
                datab = *data++;
slouken@1895
   365
                maskb = *mask++;
slouken@1895
   366
            }
slouken@1895
   367
            if (maskb & 0x80) {
slouken@1895
   368
                *pixel++ = (datab & 0x80) ? black : white;
slouken@1895
   369
            } else {
slouken@1895
   370
                *pixel++ = (datab & 0x80) ? black : transparent;
slouken@1895
   371
            }
slouken@1895
   372
            datab <<= 1;
slouken@1895
   373
            maskb <<= 1;
slouken@1895
   374
        }
slouken@1895
   375
    }
slouken@1895
   376
slouken@1895
   377
    cursor = mouse->CreateCursor(surface, hot_x, hot_y);
slouken@1895
   378
    if (cursor) {
slouken@1895
   379
        cursor->next = mouse->cursors;
slouken@1895
   380
        mouse->cursors = cursor;
slouken@1895
   381
    }
slouken@1895
   382
slouken@1895
   383
    SDL_FreeSurface(surface);
slouken@1895
   384
slouken@1895
   385
    return cursor;
slouken@1895
   386
}
slouken@1895
   387
slouken@1895
   388
/* SDL_SetCursor(NULL) can be used to force the cursor redraw,
slouken@1895
   389
   if this is desired for any reason.  This is used when setting
slouken@1895
   390
   the video mode and when the SDL window gains the mouse focus.
slouken@1895
   391
 */
slouken@1895
   392
void
slouken@1895
   393
SDL_SetCursor(SDL_Cursor * cursor)
slouken@1895
   394
{
slouken@5371
   395
    SDL_Mouse *mouse = SDL_GetMouse();
slouken@1895
   396
slouken@1895
   397
    /* Set the new cursor */
slouken@1895
   398
    if (cursor) {
slouken@1895
   399
        /* Make sure the cursor is still valid for this mouse */
slouken@1895
   400
        SDL_Cursor *found;
slouken@1895
   401
        for (found = mouse->cursors; found; found = found->next) {
slouken@1895
   402
            if (found == cursor) {
slouken@1895
   403
                break;
slouken@1895
   404
            }
slouken@1895
   405
        }
slouken@1895
   406
        if (!found) {
slouken@1895
   407
            SDL_SetError("Cursor not associated with the current mouse");
slouken@1895
   408
            return;
slouken@1895
   409
        }
slouken@1895
   410
        mouse->cur_cursor = cursor;
slouken@1895
   411
    } else {
slouken@1895
   412
        cursor = mouse->cur_cursor;
slouken@1895
   413
    }
slouken@1895
   414
slouken@1895
   415
    if (cursor && mouse->cursor_shown && !mouse->relative_mode) {
slouken@1895
   416
        if (mouse->ShowCursor) {
slouken@1895
   417
            mouse->ShowCursor(cursor);
slouken@1895
   418
        }
slouken@1895
   419
    } else {
slouken@1895
   420
        if (mouse->ShowCursor) {
slouken@1895
   421
            mouse->ShowCursor(NULL);
slouken@1895
   422
        }
slouken@1895
   423
    }
slouken@1895
   424
}
slouken@1895
   425
slouken@1895
   426
SDL_Cursor *
slouken@1895
   427
SDL_GetCursor(void)
slouken@1895
   428
{
slouken@5371
   429
    SDL_Mouse *mouse = SDL_GetMouse();
slouken@1895
   430
slouken@1895
   431
    if (!mouse) {
slouken@1895
   432
        return NULL;
slouken@1895
   433
    }
slouken@1895
   434
    return mouse->cur_cursor;
slouken@1895
   435
}
slouken@1895
   436
slouken@1895
   437
void
slouken@1895
   438
SDL_FreeCursor(SDL_Cursor * cursor)
slouken@1895
   439
{
slouken@5371
   440
    SDL_Mouse *mouse = SDL_GetMouse();
slouken@1895
   441
    SDL_Cursor *curr, *prev;
slouken@1895
   442
slouken@1895
   443
    if (!cursor) {
slouken@1895
   444
        return;
slouken@1895
   445
    }
slouken@1895
   446
slouken@1895
   447
    if (cursor == mouse->def_cursor) {
slouken@1895
   448
        return;
slouken@1895
   449
    }
slouken@1895
   450
    if (cursor == mouse->cur_cursor) {
slouken@1895
   451
        SDL_SetCursor(mouse->def_cursor);
slouken@1895
   452
    }
slouken@1895
   453
slouken@1895
   454
    for (prev = NULL, curr = mouse->cursors; curr;
slouken@1895
   455
         prev = curr, curr = curr->next) {
slouken@1895
   456
        if (curr == cursor) {
slouken@1895
   457
            if (prev) {
slouken@1895
   458
                prev->next = curr->next;
slouken@1895
   459
            } else {
slouken@1895
   460
                mouse->cursors = curr->next;
slouken@1895
   461
            }
slouken@1895
   462
slouken@1895
   463
            if (mouse->FreeCursor) {
slouken@1895
   464
                mouse->FreeCursor(curr);
slouken@1895
   465
            }
slouken@1895
   466
            return;
slouken@1895
   467
        }
slouken@1895
   468
    }
slouken@1895
   469
}
slouken@1895
   470
slouken@1895
   471
int
slouken@1895
   472
SDL_ShowCursor(int toggle)
slouken@1895
   473
{
slouken@5371
   474
    SDL_Mouse *mouse = SDL_GetMouse();
slouken@1895
   475
    SDL_bool shown;
slouken@1895
   476
slouken@1895
   477
    if (!mouse) {
slouken@1895
   478
        return 0;
slouken@1895
   479
    }
slouken@1895
   480
slouken@1895
   481
    shown = mouse->cursor_shown;
slouken@1895
   482
    if (toggle >= 0) {
slouken@1895
   483
        if (toggle) {
slouken@1895
   484
            mouse->cursor_shown = SDL_TRUE;
slouken@1895
   485
        } else {
slouken@1895
   486
            mouse->cursor_shown = SDL_FALSE;
slouken@1895
   487
        }
slouken@1895
   488
        if (mouse->cursor_shown != shown) {
slouken@1895
   489
            SDL_SetCursor(NULL);
slouken@1895
   490
        }
slouken@1895
   491
    }
slouken@1895
   492
    return shown;
slouken@1895
   493
}
slouken@1895
   494
slouken@1895
   495
/* vi: set ts=4 sw=4 expandtab: */