src/video/mir/SDL_mirmouse.c
author Philipp Wiesemann <philipp.wiesemann@arcor.de>
Wed, 24 Feb 2016 21:07:19 +0100
changeset 10094 fdfdae3f6039
parent 10091 9fccd3acad30
child 10180 7356b2938fba
permissions -rw-r--r--
Mir: Replaced memcpy() with SDL_memcpy().
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     1
/*
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     2
  Simple DirectMedia Layer
9998
f67cf37e9cd4 Updated copyright to 2016
Sam Lantinga <slouken@libsdl.org>
parents: 9807
diff changeset
     3
  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     4
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     5
  This software is provided 'as-is', without any express or implied
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     6
  warranty.  In no event will the authors be held liable for any damages
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     7
  arising from the use of this software.
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     8
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     9
  Permission is granted to anyone to use this software for any purpose,
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    10
  including commercial applications, and to alter it and redistribute it
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    11
  freely, subject to the following restrictions:
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    12
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    13
  1. The origin of this software must not be misrepresented; you must not
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    14
     claim that you wrote the original software. If you use this software
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    15
     in a product, an acknowledgment in the product documentation would be
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    16
     appreciated but is not required.
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    17
  2. Altered source versions must be plainly marked as such, and must not be
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    18
     misrepresented as being the original software.
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    19
  3. This notice may not be removed or altered from any source distribution.
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    20
*/
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    21
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    22
/*
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    23
  Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    24
*/
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    25
8154
ea6b25de67b6 Cleaned up headers and footers on Mir code.
Ryan C. Gordon <icculus@icculus.org>
parents: 8153
diff changeset
    26
#include "../../SDL_internal.h"
ea6b25de67b6 Cleaned up headers and footers on Mir code.
Ryan C. Gordon <icculus@icculus.org>
parents: 8153
diff changeset
    27
ea6b25de67b6 Cleaned up headers and footers on Mir code.
Ryan C. Gordon <icculus@icculus.org>
parents: 8153
diff changeset
    28
#if SDL_VIDEO_DRIVER_MIR
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    29
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    30
#include "../../events/SDL_mouse_c.h"
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    31
#include "../SDL_sysvideo.h"
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    32
#include "SDL_assert.h"
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    33
8159
427e8fdf6f69 Hooked up dynamic loading for Mir.
Ryan C. Gordon <icculus@icculus.org>
parents: 8157
diff changeset
    34
#include "SDL_mirdyn.h"
427e8fdf6f69 Hooked up dynamic loading for Mir.
Ryan C. Gordon <icculus@icculus.org>
parents: 8157
diff changeset
    35
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    36
#include "SDL_mirvideo.h"
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    37
#include "SDL_mirmouse.h"
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    38
#include "SDL_mirwindow.h"
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    39
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    40
typedef struct
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    41
{
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    42
    MirCursorConfiguration* conf;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    43
    MirBufferStream*        stream;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    44
} MIR_Cursor;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    45
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    46
static SDL_Cursor*
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    47
MIR_CreateDefaultCursor()
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    48
{
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    49
    SDL_Cursor* cursor;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    50
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    51
    cursor = SDL_calloc(1, sizeof(SDL_Cursor));
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    52
    if (cursor) {
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    53
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    54
        MIR_Cursor* mir_cursor = SDL_calloc(1, sizeof(MIR_Cursor));
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    55
        if (mir_cursor) {
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    56
            mir_cursor->conf   = NULL;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    57
            mir_cursor->stream = NULL;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    58
            cursor->driverdata = mir_cursor;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    59
        }
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    60
        else {
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    61
            SDL_OutOfMemory();
10091
9fccd3acad30 Mir: Fixed crash if allocating memory for cursor failed.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 10089
diff changeset
    62
            SDL_free(cursor);
9fccd3acad30 Mir: Fixed crash if allocating memory for cursor failed.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 10089
diff changeset
    63
            cursor = NULL;
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    64
        }
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    65
    }
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    66
    else {
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    67
        SDL_OutOfMemory();
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    68
    }
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    69
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    70
    return cursor;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    71
}
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    72
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    73
static void
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    74
CopySurfacePixelsToMirStream(SDL_Surface* surface, MirBufferStream* stream)
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    75
{
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    76
    char* dest, *pixels;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    77
    int i, s_w, s_h, r_stride, p_stride, bytes_per_pixel, bytes_per_row;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    78
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    79
    MirGraphicsRegion region;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    80
    MIR_mir_buffer_stream_get_graphics_region(stream, &region);
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    81
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    82
    s_w = surface->w;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    83
    s_h = surface->h;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    84
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    85
    bytes_per_pixel = surface->format->BytesPerPixel;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    86
    bytes_per_row   = bytes_per_pixel * s_w;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    87
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    88
    dest = region.vaddr;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    89
    pixels = (char*)surface->pixels;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    90
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    91
    r_stride = region.stride;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    92
    p_stride = surface->pitch;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    93
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    94
    for (i = 0; i < s_h; i++)
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    95
    {
10094
fdfdae3f6039 Mir: Replaced memcpy() with SDL_memcpy().
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 10091
diff changeset
    96
        SDL_memcpy(dest, pixels, bytes_per_row);
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    97
        dest   += r_stride;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    98
        pixels += p_stride;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    99
    }
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   100
}
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   101
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   102
static SDL_Cursor*
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   103
MIR_CreateCursor(SDL_Surface* surface, int hot_x, int hot_y)
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   104
{
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   105
    MirCursorConfiguration* conf;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   106
    MirBufferStream*        stream;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   107
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   108
    int s_w = surface->w;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   109
    int s_h = surface->h;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   110
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   111
    MIR_Data* mir_data     = (MIR_Data*)SDL_GetVideoDevice()->driverdata;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   112
    SDL_Cursor* cursor     = MIR_CreateDefaultCursor();
10091
9fccd3acad30 Mir: Fixed crash if allocating memory for cursor failed.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 10089
diff changeset
   113
    MIR_Cursor* mir_cursor;
9fccd3acad30 Mir: Fixed crash if allocating memory for cursor failed.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 10089
diff changeset
   114
9fccd3acad30 Mir: Fixed crash if allocating memory for cursor failed.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 10089
diff changeset
   115
    if (!cursor) {
9fccd3acad30 Mir: Fixed crash if allocating memory for cursor failed.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 10089
diff changeset
   116
        return NULL;
9fccd3acad30 Mir: Fixed crash if allocating memory for cursor failed.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 10089
diff changeset
   117
    }
9fccd3acad30 Mir: Fixed crash if allocating memory for cursor failed.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 10089
diff changeset
   118
9fccd3acad30 Mir: Fixed crash if allocating memory for cursor failed.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 10089
diff changeset
   119
    mir_cursor = (MIR_Cursor*)cursor->driverdata;
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   120
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   121
    stream = MIR_mir_connection_create_buffer_stream_sync(mir_data->connection,
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   122
                                                          s_w, s_h, mir_data->pixel_format,
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   123
                                                          mir_buffer_usage_software);
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   124
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   125
    conf = MIR_mir_cursor_configuration_from_buffer_stream(stream, hot_x, hot_y);
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   126
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   127
    CopySurfacePixelsToMirStream(surface, stream);
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   128
    MIR_mir_buffer_stream_swap_buffers_sync(stream);
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   129
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   130
    mir_cursor->conf   = conf;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   131
    mir_cursor->stream = stream;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   132
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   133
    return cursor;
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   134
}
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   135
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   136
static SDL_Cursor*
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   137
MIR_CreateSystemCursor(SDL_SystemCursor id)
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   138
{
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   139
    char const* cursor_name = NULL;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   140
    MirCursorConfiguration* conf;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   141
    SDL_Cursor* cursor = MIR_CreateDefaultCursor();
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   142
10091
9fccd3acad30 Mir: Fixed crash if allocating memory for cursor failed.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 10089
diff changeset
   143
    if (!cursor) {
9fccd3acad30 Mir: Fixed crash if allocating memory for cursor failed.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 10089
diff changeset
   144
        return NULL;
9fccd3acad30 Mir: Fixed crash if allocating memory for cursor failed.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 10089
diff changeset
   145
    }
9fccd3acad30 Mir: Fixed crash if allocating memory for cursor failed.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 10089
diff changeset
   146
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   147
    switch(id) {
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   148
        case SDL_SYSTEM_CURSOR_ARROW:
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   149
            cursor_name = MIR_mir_arrow_cursor_name;
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   150
            break;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   151
        case SDL_SYSTEM_CURSOR_IBEAM:
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   152
            cursor_name = MIR_mir_caret_cursor_name;
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   153
            break;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   154
        case SDL_SYSTEM_CURSOR_WAIT:
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   155
            cursor_name = MIR_mir_busy_cursor_name;
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   156
            break;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   157
        case SDL_SYSTEM_CURSOR_CROSSHAIR:
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   158
            /* Unsupported */
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   159
            cursor_name = MIR_mir_arrow_cursor_name;
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   160
            break;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   161
        case SDL_SYSTEM_CURSOR_WAITARROW:
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   162
            cursor_name = MIR_mir_busy_cursor_name;
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   163
            break;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   164
        case SDL_SYSTEM_CURSOR_SIZENWSE:
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   165
            cursor_name = MIR_mir_omnidirectional_resize_cursor_name;
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   166
            break;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   167
        case SDL_SYSTEM_CURSOR_SIZENESW:
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   168
            cursor_name = MIR_mir_omnidirectional_resize_cursor_name;
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   169
            break;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   170
        case SDL_SYSTEM_CURSOR_SIZEWE:
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   171
            cursor_name = MIR_mir_horizontal_resize_cursor_name;
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   172
            break;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   173
        case SDL_SYSTEM_CURSOR_SIZENS:
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   174
            cursor_name = MIR_mir_vertical_resize_cursor_name;
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   175
            break;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   176
        case SDL_SYSTEM_CURSOR_SIZEALL:
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   177
            cursor_name = MIR_mir_omnidirectional_resize_cursor_name;
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   178
            break;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   179
        case SDL_SYSTEM_CURSOR_NO:
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   180
            /* Unsupported */
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   181
            cursor_name = MIR_mir_closed_hand_cursor_name;
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   182
            break;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   183
        case SDL_SYSTEM_CURSOR_HAND:
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   184
            cursor_name = MIR_mir_open_hand_cursor_name;
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   185
            break;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   186
        default:
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   187
            SDL_assert(0);
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   188
            return NULL;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   189
    }
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   190
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   191
    conf = MIR_mir_cursor_configuration_from_name(cursor_name);
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   192
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   193
    cursor->driverdata = conf;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   194
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   195
    return cursor;
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   196
}
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   197
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   198
static void
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   199
MIR_FreeCursor(SDL_Cursor* cursor)
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   200
{
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   201
    if (cursor) {
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   202
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   203
        if (cursor->driverdata) {
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   204
            MIR_Cursor* mir_cursor = (MIR_Cursor*)cursor->driverdata;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   205
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   206
            if (mir_cursor->conf)
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   207
                MIR_mir_cursor_configuration_destroy(mir_cursor->conf);
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   208
            if (mir_cursor->stream)
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   209
                MIR_mir_buffer_stream_release_sync(mir_cursor->stream);
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   210
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   211
            SDL_free(mir_cursor);
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   212
        }
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   213
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   214
        SDL_free(cursor);
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   215
    }
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   216
}
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   217
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   218
static int
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   219
MIR_ShowCursor(SDL_Cursor* cursor)
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   220
{
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   221
    MIR_Data* mir_data      = (MIR_Data*)SDL_GetVideoDevice()->driverdata;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   222
    MIR_Window* mir_window  = mir_data->current_window;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   223
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   224
    if (cursor && cursor->driverdata) {
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   225
        if (mir_window && MIR_mir_surface_is_valid(mir_window->surface)) {
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   226
            MIR_Cursor* mir_cursor = (MIR_Cursor*)cursor->driverdata;
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   227
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   228
            if (mir_cursor->conf) {
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   229
                MIR_mir_wait_for(MIR_mir_surface_configure_cursor(mir_window->surface, mir_cursor->conf));
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   230
            }
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   231
        }
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   232
    }
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   233
    else if(mir_window && MIR_mir_surface_is_valid(mir_window->surface)) {
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   234
        MIR_mir_wait_for(MIR_mir_surface_configure_cursor(mir_window->surface, NULL));
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   235
    }
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   236
    
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   237
    return 0;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   238
}
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   239
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   240
static void
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   241
MIR_WarpMouse(SDL_Window* window, int x, int y)
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   242
{
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   243
    SDL_Unsupported();
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   244
}
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   245
9807
57b448735f48 SDL_WarpMouseGlobal() should return non-void.
Ryan C. Gordon <icculus@icculus.org>
parents: 9619
diff changeset
   246
static int
8815
c6d0a457f3b2 Added an API function to warp the mouse cursor in global screen space: SDL_WarpMouseGlobal()
Sam Lantinga <slouken@libsdl.org>
parents: 8159
diff changeset
   247
MIR_WarpMouseGlobal(int x, int y)
c6d0a457f3b2 Added an API function to warp the mouse cursor in global screen space: SDL_WarpMouseGlobal()
Sam Lantinga <slouken@libsdl.org>
parents: 8159
diff changeset
   248
{
9807
57b448735f48 SDL_WarpMouseGlobal() should return non-void.
Ryan C. Gordon <icculus@icculus.org>
parents: 9619
diff changeset
   249
    return SDL_Unsupported();
8815
c6d0a457f3b2 Added an API function to warp the mouse cursor in global screen space: SDL_WarpMouseGlobal()
Sam Lantinga <slouken@libsdl.org>
parents: 8159
diff changeset
   250
}
c6d0a457f3b2 Added an API function to warp the mouse cursor in global screen space: SDL_WarpMouseGlobal()
Sam Lantinga <slouken@libsdl.org>
parents: 8159
diff changeset
   251
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   252
static int
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   253
MIR_SetRelativeMouseMode(SDL_bool enabled)
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   254
{
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   255
    return SDL_Unsupported();
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   256
}
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   257
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   258
/* TODO Actually implement the cursor, need to wait for mir support */
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   259
void
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   260
MIR_InitMouse()
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   261
{
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   262
    SDL_Mouse* mouse = SDL_GetMouse();
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   263
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   264
    mouse->CreateCursor         = MIR_CreateCursor;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   265
    mouse->ShowCursor           = MIR_ShowCursor;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   266
    mouse->FreeCursor           = MIR_FreeCursor;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   267
    mouse->WarpMouse            = MIR_WarpMouse;
8815
c6d0a457f3b2 Added an API function to warp the mouse cursor in global screen space: SDL_WarpMouseGlobal()
Sam Lantinga <slouken@libsdl.org>
parents: 8159
diff changeset
   268
    mouse->WarpMouseGlobal      = MIR_WarpMouseGlobal;
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   269
    mouse->CreateSystemCursor   = MIR_CreateSystemCursor;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   270
    mouse->SetRelativeMouseMode = MIR_SetRelativeMouseMode;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   271
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   272
    SDL_SetDefaultCursor(MIR_CreateDefaultCursor());
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   273
}
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   274
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   275
void
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   276
MIR_FiniMouse()
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   277
{
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   278
    SDL_Mouse* mouse = SDL_GetMouse();
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   279
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   280
    MIR_FreeCursor(mouse->def_cursor);
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   281
    mouse->def_cursor = NULL;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   282
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   283
    mouse->CreateCursor         = NULL;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   284
    mouse->ShowCursor           = NULL;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   285
    mouse->FreeCursor           = NULL;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   286
    mouse->WarpMouse            = NULL;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   287
    mouse->CreateSystemCursor   = NULL;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   288
    mouse->SetRelativeMouseMode = NULL;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   289
}
8154
ea6b25de67b6 Cleaned up headers and footers on Mir code.
Ryan C. Gordon <icculus@icculus.org>
parents: 8153
diff changeset
   290
ea6b25de67b6 Cleaned up headers and footers on Mir code.
Ryan C. Gordon <icculus@icculus.org>
parents: 8153
diff changeset
   291
#endif /* SDL_VIDEO_DRIVER_MIR */
ea6b25de67b6 Cleaned up headers and footers on Mir code.
Ryan C. Gordon <icculus@icculus.org>
parents: 8153
diff changeset
   292
ea6b25de67b6 Cleaned up headers and footers on Mir code.
Ryan C. Gordon <icculus@icculus.org>
parents: 8153
diff changeset
   293
/* vi: set ts=4 sw=4 expandtab: */
ea6b25de67b6 Cleaned up headers and footers on Mir code.
Ryan C. Gordon <icculus@icculus.org>
parents: 8153
diff changeset
   294