comparison src/video/photon/SDL_ph_mouse.c @ 315:3333b6e68289

Date: Sat, 23 Mar 2002 13:53:37 +0200 From: "Mike Gorchak" <mike@malva.ua> Subject: Big QNX patch again. Added 8bit palette emulation code for window mode with bpp>=15. Added store/restore original palette for 8bit modes. Added more information about photon API call fails. Rewroten change palette code, slow but works. Fixed bug with set caption before window was inited. Fixed bugs with some initial state of variables. Fixed bug with storing old video mode settings. Fixed bug with switching to fullscreen mode and back. Fixed few double SEGFAULTS during parachute mode. Removed compilation warning with no PgWaitHWIdle prototype. Removed pack of dead unusable code. Cleanups SDL_PrivateVideoData structure, some headers. Some code formatting.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 23 Mar 2002 20:19:44 +0000
parents f6ffac90895c
children bce7171e7a85
comparison
equal deleted inserted replaced
314:bff64eba7721 315:3333b6e68289
34 #include "SDL_events_c.h" 34 #include "SDL_events_c.h"
35 #include "SDL_cursor_c.h" 35 #include "SDL_cursor_c.h"
36 #include "SDL_ph_mouse_c.h" 36 #include "SDL_ph_mouse_c.h"
37 37
38 struct WMcursor { 38 struct WMcursor {
39 PhCursorDef_t *ph_cursor ; 39 PhCursorDef_t *ph_cursor ;
40 }; 40 };
41 41
42 42
43 void ph_FreeWMCursor(_THIS, WMcursor *cursor) 43 void ph_FreeWMCursor(_THIS, WMcursor *cursor)
44 { 44 {
45 if (window != NULL)
46 {
47 SDL_Lock_EventThread();
45 48
46 if ( window != NULL ) { 49 if (PtSetResource( window, Pt_ARG_CURSOR_TYPE, Ph_CURSOR_INHERIT, 0 ) < 0)
47 SDL_Lock_EventThread(); 50 {
48 51 /* TODO: output error msg */
49 if (PtSetResource( window, Pt_ARG_CURSOR_TYPE, Ph_CURSOR_INHERIT, 0 ) < 0) 52 }
50 { 53
51 //TODO: output error msg 54 SDL_Unlock_EventThread();
52 } 55 }
53 56 /* free(cursor->ph_cursor.images); */
54 SDL_Unlock_EventThread(); 57 free(cursor);
55 }
56 //free(cursor->ph_cursor.images);
57 free(cursor);
58 } 58 }
59 59
60 WMcursor *ph_CreateWMCursor(_THIS, 60 WMcursor *ph_CreateWMCursor(_THIS,
61 Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y) 61 Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y)
62 { 62 {
118 } 118 }
119 119
120 120
121 PhCursorDef_t ph_GetWMPhCursor(WMcursor *cursor) 121 PhCursorDef_t ph_GetWMPhCursor(WMcursor *cursor)
122 { 122 {
123 return(*cursor->ph_cursor); 123 return(*cursor->ph_cursor);
124 } 124 }
125 125
126 int ph_ShowWMCursor(_THIS, WMcursor *cursor) 126 int ph_ShowWMCursor(_THIS, WMcursor *cursor)
127 { 127 {
128 PtArg_t args[3]; 128 PtArg_t args[3];
168 return(1); 168 return(1);
169 } 169 }
170 170
171 void ph_WarpWMCursor(_THIS, Uint16 x, Uint16 y) 171 void ph_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
172 { 172 {
173 short abs_x, abs_y; 173 short abs_x, abs_y;
174 174
175 SDL_Lock_EventThread(); 175 SDL_Lock_EventThread();
176 PtGetAbsPosition( window, &abs_x, &abs_y ); 176 PtGetAbsPosition( window, &abs_x, &abs_y );
177 PhMoveCursorAbs( PhInputGroup(NULL), x + abs_x, y + abs_y ); 177 PhMoveCursorAbs( PhInputGroup(NULL), x + abs_x, y + abs_y );
178 SDL_Unlock_EventThread(); 178 SDL_Unlock_EventThread();
179 } 179 }
180 180
181 181
182 void ph_CheckMouseMode(_THIS) 182 void ph_CheckMouseMode(_THIS)
183 { 183 {
184 /* If the mouse is hidden and input is grabbed, we use relative mode */ 184 /* If the mouse is hidden and input is grabbed, we use relative mode */
185 if ( !(SDL_cursorstate & CURSOR_VISIBLE) && 185 if ( !(SDL_cursorstate & CURSOR_VISIBLE) && (this->input_grab != SDL_GRAB_OFF))
186 (this->input_grab != SDL_GRAB_OFF) ) { 186 {
187 mouse_relative = 1; 187 mouse_relative = 1;
188 } else { 188 }
189 mouse_relative = 0; 189 else
190 } 190 {
191 mouse_relative = 0;
192 }
191 } 193 }