comparison src/video/gem/SDL_gemmouse.c @ 1668:4da1ee79c9af SDL-1.3

more tweaking indent options
author Sam Lantinga <slouken@libsdl.org>
date Mon, 29 May 2006 04:04:35 +0000
parents 782fd950bd46
children
comparison
equal deleted inserted replaced
1667:1fddae038bc8 1668:4da1ee79c9af
47 MFORM *mform_p; 47 MFORM *mform_p;
48 }; 48 };
49 49
50 50
51 void 51 void
52 GEM_FreeWMCursor (_THIS, WMcursor * cursor) 52 GEM_FreeWMCursor(_THIS, WMcursor * cursor)
53 { 53 {
54 if (cursor == NULL) 54 if (cursor == NULL)
55 return; 55 return;
56 56
57 graf_mouse (ARROW, NULL); 57 graf_mouse(ARROW, NULL);
58 58
59 if (cursor->mform_p != NULL) 59 if (cursor->mform_p != NULL)
60 SDL_free (cursor->mform_p); 60 SDL_free(cursor->mform_p);
61 61
62 SDL_free (cursor); 62 SDL_free(cursor);
63 } 63 }
64 64
65 WMcursor * 65 WMcursor *
66 GEM_CreateWMCursor (_THIS, 66 GEM_CreateWMCursor(_THIS,
67 Uint8 * data, Uint8 * mask, int w, int h, int hot_x, 67 Uint8 * data, Uint8 * mask, int w, int h, int hot_x,
68 int hot_y) 68 int hot_y)
69 { 69 {
70 WMcursor *cursor; 70 WMcursor *cursor;
71 MFORM *new_mform; 71 MFORM *new_mform;
72 int i; 72 int i;
73 73
74 /* Check the size */ 74 /* Check the size */
75 if ((w > MAXCURWIDTH) || (h > MAXCURHEIGHT)) { 75 if ((w > MAXCURWIDTH) || (h > MAXCURHEIGHT)) {
76 SDL_SetError ("Only cursors of dimension (%dx%d) are allowed", 76 SDL_SetError("Only cursors of dimension (%dx%d) are allowed",
77 MAXCURWIDTH, MAXCURHEIGHT); 77 MAXCURWIDTH, MAXCURHEIGHT);
78 return (NULL); 78 return (NULL);
79 } 79 }
80 80
81 /* Allocate the cursor memory */ 81 /* Allocate the cursor memory */
82 cursor = (WMcursor *) SDL_malloc (sizeof (WMcursor)); 82 cursor = (WMcursor *) SDL_malloc(sizeof(WMcursor));
83 if (cursor == NULL) { 83 if (cursor == NULL) {
84 SDL_OutOfMemory (); 84 SDL_OutOfMemory();
85 return (NULL); 85 return (NULL);
86 } 86 }
87 87
88 /* Allocate mform */ 88 /* Allocate mform */
89 new_mform = (MFORM *) SDL_malloc (sizeof (MFORM)); 89 new_mform = (MFORM *) SDL_malloc(sizeof(MFORM));
90 if (new_mform == NULL) { 90 if (new_mform == NULL) {
91 SDL_free (cursor); 91 SDL_free(cursor);
92 SDL_OutOfMemory (); 92 SDL_OutOfMemory();
93 return (NULL); 93 return (NULL);
94 } 94 }
95 95
96 cursor->mform_p = new_mform; 96 cursor->mform_p = new_mform;
97 97
118 } 118 }
119 } 119 }
120 120
121 #ifdef DEBUG_VIDEO_GEM 121 #ifdef DEBUG_VIDEO_GEM
122 for (i = 0; i < h; i++) { 122 for (i = 0; i < h; i++) {
123 printf ("sdl:video:gem: cursor, line %d = 0x%04x\n", i, 123 printf("sdl:video:gem: cursor, line %d = 0x%04x\n", i,
124 new_mform->mf_mask[i]); 124 new_mform->mf_mask[i]);
125 } 125 }
126 126
127 printf ("sdl:video:gem: CreateWMCursor(): done\n"); 127 printf("sdl:video:gem: CreateWMCursor(): done\n");
128 #endif 128 #endif
129 129
130 return cursor; 130 return cursor;
131 } 131 }
132 132
133 int 133 int
134 GEM_ShowWMCursor (_THIS, WMcursor * cursor) 134 GEM_ShowWMCursor(_THIS, WMcursor * cursor)
135 { 135 {
136 /* 136 /*
137 if (cursor == NULL) { 137 if (cursor == NULL) {
138 graf_mouse(M_OFF, NULL); 138 graf_mouse(M_OFF, NULL);
139 } else if (cursor->mform_p) { 139 } else if (cursor->mform_p) {
140 graf_mouse(USER_DEF, cursor->mform_p); 140 graf_mouse(USER_DEF, cursor->mform_p);
141 } 141 }
142 */ 142 */
143 #ifdef DEBUG_VIDEO_GEM 143 #ifdef DEBUG_VIDEO_GEM
144 printf ("sdl:video:gem: ShowWMCursor(0x%08x)\n", (long) cursor); 144 printf("sdl:video:gem: ShowWMCursor(0x%08x)\n", (long) cursor);
145 #endif 145 #endif
146 146
147 return 1; 147 return 1;
148 } 148 }
149 149
150 #if 0 150 #if 0
151 void 151 void
152 GEM_WarpWMCursor (_THIS, Uint16 x, Uint16 y) 152 GEM_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
153 { 153 {
154 /* This seems to work only on AES 3.4 (Falcon) */ 154 /* This seems to work only on AES 3.4 (Falcon) */
155 155
156 EVNTREC warpevent; 156 EVNTREC warpevent;
157 157
158 warpevent.ap_event = APPEVNT_MOUSE; 158 warpevent.ap_event = APPEVNT_MOUSE;
159 warpevent.ap_value = (x << 16) | y; 159 warpevent.ap_value = (x << 16) | y;
160 160
161 appl_tplay (&warpevent, 1, 1000); 161 appl_tplay(&warpevent, 1, 1000);
162 } 162 }
163 #endif 163 #endif
164 164
165 void 165 void
166 GEM_CheckMouseMode (_THIS) 166 GEM_CheckMouseMode(_THIS)
167 { 167 {
168 /* If the mouse is hidden and input is grabbed, we use relative mode */ 168 /* If the mouse is hidden and input is grabbed, we use relative mode */
169 if ((!(SDL_cursorstate & CURSOR_VISIBLE)) && 169 if ((!(SDL_cursorstate & CURSOR_VISIBLE)) &&
170 /*(this->input_grab != SDL_GRAB_OFF) && *//* Damn GEM can not grab */ 170 /*(this->input_grab != SDL_GRAB_OFF) && *//* Damn GEM can not grab */
171 (SDL_GetAppState () & SDL_APPACTIVE)) { 171 (SDL_GetAppState() & SDL_APPACTIVE)) {
172 GEM_mouse_relative = SDL_TRUE; 172 GEM_mouse_relative = SDL_TRUE;
173 } else { 173 } else {
174 GEM_mouse_relative = SDL_FALSE; 174 GEM_mouse_relative = SDL_FALSE;
175 } 175 }
176 } 176 }