annotate src/video/ps2gs/SDL_gsmouse.c @ 1614:6162b8d921ce

Date: Wed, 29 Mar 2006 17:26:55 +0200 CEST From: "Fran���is Revol" Subject: [SDL] BeOS port fix: PrintScreen key crashing It seems the latest SDL crashes when someone hits the PrtScrn key in ZETA (BeOS R6), somewhere it gets a negative value as key code (or a big unsigned maybe ?), and uses it as an index in the keysym table... I'll investigate the cause for the negative value, but it's always better to check for bounds correctly when indexing a table. The attached diff fixes it. Fran���is Revol -- Software Architect yellowTAB GmbH
author Sam Lantinga <slouken@libsdl.org>
date Fri, 31 Mar 2006 06:16:20 +0000
parents d910939febfa
children 782fd950bd46 c121d94672cb a1b03ba2fcd0
rev   line source
70
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
1 /*
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
3 Copyright (C) 1997-2006 Sam Lantinga
70
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
4
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
6 modify it under the terms of the GNU Lesser General Public
70
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
70
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
9
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
13 Lesser General Public License for more details.
70
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
14
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
15 You should have received a copy of the GNU Lesser General Public
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
16 License along with this library; if not, write to the Free Software
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
70
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
18
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
19 Sam Lantinga
252
e8157fcb3114 Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents: 136
diff changeset
20 slouken@libsdl.org
70
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
21 */
1402
d910939febfa Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents: 1361
diff changeset
22 #include "SDL_config.h"
70
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
23
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
24 #include <sys/ioctl.h>
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
25
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
26 #include "SDL_mouse.h"
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
27 #include "../../events/SDL_events_c.h"
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
28 #include "../SDL_cursor_c.h"
70
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
29 #include "SDL_gsvideo.h"
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
30 #include "SDL_gsmouse_c.h"
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
31
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
32
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
33 /* The implementation dependent data for the window manager cursor */
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
34 struct WMcursor {
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
35 int unused;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
36 };
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
37
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
38 /* There isn't any implementation dependent data */
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
39 void GS_FreeWMCursor(_THIS, WMcursor *cursor)
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
40 {
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
41 return;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
42 }
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
43
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
44 /* There isn't any implementation dependent data */
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
45 WMcursor *GS_CreateWMCursor(_THIS,
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
46 Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y)
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
47 {
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
48 return((WMcursor *)0x01);
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
49 }
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
50
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
51 static void GS_MoveCursor(_THIS, SDL_Cursor *cursor, int x, int y)
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
52 {
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
53 SDL_Surface *screen;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
54 struct ps2_image image;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
55 SDL_Rect area;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
56 int mouse_y1, mouse_y2;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
57 void *saved_pixels;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
58 int screen_updated;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
59
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
60 /* Lock so we don't interrupt an update with mouse motion */
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
61 SDL_LockCursor();
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
62
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
63 /* Make sure any pending DMA has completed */
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
64 if ( dma_pending ) {
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
65 ioctl(console_fd, PS2IOC_SENDQCT, 1);
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
66 dma_pending = 0;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
67 }
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
68
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
69 /* Remove the cursor image from the DMA area */
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
70 screen = this->screen;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
71 saved_pixels = screen->pixels;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
72 screen->pixels = mapped_mem + screen->offset;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
73 screen_updated = 0;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
74 if ( cursor_drawn ) {
136
717f739d6ec1 Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents: 70
diff changeset
75 SDL_EraseCursorNoLock(screen);
70
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
76 cursor_drawn = 0;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
77 screen_updated = 1;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
78 }
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
79
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
80 /* Save the current mouse area */
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
81 SDL_MouseRect(&area);
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
82 mouse_y1 = area.y;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
83 mouse_y2 = area.y+area.h;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
84
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
85 /* Only draw the new cursor if there was one passed in */
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
86 if ( cursor ) {
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
87 /* Set the new location */
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
88 cursor->area.x = (x - cursor->hot_x);
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
89 cursor->area.y = (y - cursor->hot_y);
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
90
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
91 /* Draw the cursor at the new location */
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
92 if ( (SDL_cursorstate & CURSOR_VISIBLE) && screen->pixels ) {
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
93 SDL_DrawCursorNoLock(screen);
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
94 cursor_drawn = 1;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
95 screen_updated = 1;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
96 }
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
97 }
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
98 screen->pixels = saved_pixels;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
99
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
100 /* Update the affected area of the screen */
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
101 if ( screen_updated ) {
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
102 SDL_MouseRect(&area);
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
103 if ( area.y < mouse_y1 ) {
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
104 mouse_y1 = area.y;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
105 }
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
106 if ( (area.y+area.h) > mouse_y2 ) {
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
107 mouse_y2 = area.y+area.h;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
108 }
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
109 image = screen_image;
136
717f739d6ec1 Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents: 70
diff changeset
110 image.y += screen->offset / screen->pitch + mouse_y1;
70
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
111 image.h = mouse_y2 - mouse_y1;
136
717f739d6ec1 Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents: 70
diff changeset
112 image.ptr = mapped_mem +
717f739d6ec1 Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents: 70
diff changeset
113 (image.y - screen_image.y) * screen->pitch;
70
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
114 ioctl(console_fd, PS2IOC_LOADIMAGE, &image);
136
717f739d6ec1 Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents: 70
diff changeset
115
717f739d6ec1 Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents: 70
diff changeset
116 /* Need to scale offscreen image to TV output */
717f739d6ec1 Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents: 70
diff changeset
117 if ( image.y > 0 ) {
717f739d6ec1 Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents: 70
diff changeset
118 scaleimage_nonblock(console_fd,
717f739d6ec1 Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents: 70
diff changeset
119 tex_tags_mem, scale_tags_mem);
717f739d6ec1 Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents: 70
diff changeset
120 }
70
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
121 }
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
122
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
123 /* We're finished */
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
124 SDL_UnlockCursor();
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
125 }
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
126
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
127 void GS_MoveWMCursor(_THIS, int x, int y)
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
128 {
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
129 GS_MoveCursor(this, SDL_cursor, x, y);
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
130 }
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
131
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
132 int GS_ShowWMCursor(_THIS, WMcursor *wmcursor)
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
133 {
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
134 SDL_Cursor *cursor;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
135 int x, y;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
136
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
137 /* Draw the cursor at the appropriate location */
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
138 SDL_GetMouseState(&x, &y);
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
139 if ( wmcursor ) {
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
140 cursor = SDL_cursor;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
141 } else {
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
142 cursor = NULL;
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
143 }
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
144 GS_MoveCursor(this, cursor, x, y);
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
145 return(1);
f590dd383b5d Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
146 }