comparison src/video/cybergfx/SDL_amigamouse.c @ 0:74212992fb08

Initial revision
author Sam Lantinga <slouken@lokigames.com>
date Thu, 26 Apr 2001 16:45:43 +0000
parents
children e8157fcb3114
comparison
equal deleted inserted replaced
-1:000000000000 0:74212992fb08
1 /*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the Free
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 Sam Lantinga
20 slouken@devolution.com
21 */
22
23 #ifdef SAVE_RCSID
24 static char rcsid =
25 "@(#) $Id$";
26 #endif
27
28 #include "SDL_error.h"
29 #include "SDL_mouse.h"
30 #include "SDL_events_c.h"
31 #include "SDL_cursor_c.h"
32 #include "SDL_amigamouse_c.h"
33
34
35 /* The implementation dependent data for the window manager cursor */
36
37 typedef void * WMCursor;
38
39 void amiga_FreeWMCursor(_THIS, WMcursor *cursor)
40 {
41 }
42
43 WMcursor *amiga_CreateWMCursor(_THIS,
44 Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y)
45 {
46 return (WMcursor *)1; // Amiga has an Hardware cursor, so it's ok to return something unuseful but true
47 }
48
49 int amiga_ShowWMCursor(_THIS, WMcursor *cursor)
50 {
51 /* Don't do anything if the display is gone */
52 if ( SDL_Display == NULL) {
53 return(0);
54 }
55
56 /* Set the Amiga prefs cursor cursor, or blank if cursor is NULL */
57
58 if ( SDL_Window ) {
59 SDL_Lock_EventThread();
60 if ( cursor == NULL ) {
61 if ( SDL_BlankCursor != NULL ) {
62 // Hide cursor HERE
63 SetPointer(SDL_Window,(UWORD *)SDL_BlankCursor,1,1,0,0);
64 }
65 } else {
66 // Show cursor
67 ClearPointer(SDL_Window);
68 }
69 SDL_Unlock_EventThread();
70 }
71 return(1);
72 }
73
74 void amiga_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
75 {
76 /* FIXME: Not implemented */
77 }
78
79 /* Check to see if we need to enter or leave mouse relative mode */
80 void amiga_CheckMouseMode(_THIS)
81 {
82 /* If the mouse is hidden and input is grabbed, we use relative mode */
83 #if 0
84 SDL_Lock_EventThread();
85 if ( !(SDL_cursorstate & CURSOR_VISIBLE) &&
86 (this->input_grab != SDL_GRAB_OFF) ) {
87 mouse_relative = 1;
88 X11_EnableDGAMouse(this);
89 if ( ! (using_dga & DGA_MOUSE) ) {
90 char *use_mouse_accel;
91
92 SDL_GetMouseState(&mouse_last.x, &mouse_last.y);
93 /* Use as raw mouse mickeys as possible */
94 XGetPointerControl(SDL_Display,
95 &mouse_accel.numerator,
96 &mouse_accel.denominator,
97 &mouse_accel.threshold);
98 use_mouse_accel = getenv("SDL_VIDEO_X11_MOUSEACCEL");
99 if ( use_mouse_accel ) {
100 SetMouseAccel(this, use_mouse_accel);
101 }
102 }
103 } else {
104 if ( mouse_relative ) {
105 if ( using_dga & DGA_MOUSE ) {
106 X11_DisableDGAMouse(this);
107 } else {
108 XChangePointerControl(SDL_Display, True, True,
109 mouse_accel.numerator,
110 mouse_accel.denominator,
111 mouse_accel.threshold);
112 }
113 mouse_relative = 0;
114 }
115 }
116 SDL_Unlock_EventThread();
117 #endif
118 }