Mercurial > sdl-ios-xcode
comparison src/video/maccommon/SDL_macevents.c @ 155:2d162219f433
Date: Thu, 16 Aug 2001 21:50:51 -0500 (EST)
From: Darrell Walisser <dwaliss1@purdue.edu>
Subject: Patch for video bugs + Max's additions
I've attached a patch for today's CVS that includes Max's virtual
mouse button fix as well as some other changes:
-building mode list correctly now (had duplicate entries, was unsorted)
-switching modes correctly now (wasn't destroying previous mode)
-releasing memory correctly in event loop
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 19 Aug 2001 23:57:39 +0000 |
parents | ee3bb7cd06b5 |
children | e92aa316c517 |
comparison
equal
deleted
inserted
replaced
154:50d2b5305c2c | 155:2d162219f433 |
---|---|
105 } | 105 } |
106 | 106 |
107 /* The main MacOS event handler */ | 107 /* The main MacOS event handler */ |
108 static int Mac_HandleEvents(_THIS, int wait4it) | 108 static int Mac_HandleEvents(_THIS, int wait4it) |
109 { | 109 { |
110 static int mouse_button = 1; | |
110 int i; | 111 int i; |
111 EventRecord event; | 112 EventRecord event; |
112 | 113 |
113 #if TARGET_API_MAC_CARBON | 114 #if TARGET_API_MAC_CARBON |
114 /* There's no GetOSEvent() in the Carbon API. *sigh* */ | 115 /* There's no GetOSEvent() in the Carbon API. *sigh* */ |
146 | 147 |
147 #if TARGET_API_MAC_CARBON | 148 #if TARGET_API_MAC_CARBON |
148 /* for some reason, event.where isn't set ? */ | 149 /* for some reason, event.where isn't set ? */ |
149 GetGlobalMouse ( &event.where ); | 150 GetGlobalMouse ( &event.where ); |
150 #endif | 151 #endif |
151 | 152 |
152 /* Check for mouse motion */ | 153 /* Check for mouse motion */ |
153 if ( (event.where.h != last_where.h) || | 154 if ( (event.where.h != last_where.h) || |
154 (event.where.v != last_where.v) ) { | 155 (event.where.v != last_where.v) ) { |
155 Point pt; | 156 Point pt; |
156 pt = last_where = event.where; | 157 pt = last_where = event.where; |
280 break; | 281 break; |
281 case inContent: | 282 case inContent: |
282 myGlobalToLocal(this, &event.where); | 283 myGlobalToLocal(this, &event.where); |
283 /* Treat command-click as right mouse button */ | 284 /* Treat command-click as right mouse button */ |
284 if ( event.modifiers & optionKey ) { | 285 if ( event.modifiers & optionKey ) { |
285 SDL_PrivateMouseButton(SDL_PRESSED, | 286 mouse_button = 2; |
286 2,event.where.h,event.where.v); | 287 } else if ( event.modifiers & cmdKey ) { |
287 } | 288 mouse_button = 3; |
288 else if ( event.modifiers & cmdKey ) { | |
289 SDL_PrivateMouseButton(SDL_PRESSED, | |
290 3,event.where.h,event.where.v); | |
291 } else { | 289 } else { |
292 SDL_PrivateMouseButton(SDL_PRESSED, | 290 mouse_button = 1; |
293 1,event.where.h,event.where.v); | 291 } |
294 } | 292 SDL_PrivateMouseButton(SDL_PRESSED, |
293 mouse_button, event.where.h, event.where.v); | |
295 break; | 294 break; |
296 case inGrow: { | 295 case inGrow: { |
297 int newSize; | 296 int newSize; |
298 | 297 |
299 /* Don't allow resize if video mode isn't resizable */ | 298 /* Don't allow resize if video mode isn't resizable */ |
334 #if TARGET_API_MAC_CARBON | 333 #if TARGET_API_MAC_CARBON |
335 case inCollapseBox: | 334 case inCollapseBox: |
336 if ( TrackBox (win, event.where, area )) { | 335 if ( TrackBox (win, event.where, area )) { |
337 if ( IsWindowCollapsable(win) ) { | 336 if ( IsWindowCollapsable(win) ) { |
338 CollapseWindow (win, !IsWindowCollapsed(win)); | 337 CollapseWindow (win, !IsWindowCollapsed(win)); |
339 // There should be something done like in inGrow case, but... | 338 /* There should be something done like in inGrow case, but... */ |
340 } | 339 } |
341 } | 340 } |
342 break; | 341 break; |
343 #endif /* TARGET_API_MAC_CARBON */ | 342 #endif /* TARGET_API_MAC_CARBON */ |
344 case inSysWindow: | 343 case inSysWindow: |
353 } | 352 } |
354 } | 353 } |
355 break; | 354 break; |
356 case mouseUp: { | 355 case mouseUp: { |
357 myGlobalToLocal(this, &event.where); | 356 myGlobalToLocal(this, &event.where); |
358 /* Treat command-click as right mouse button */ | 357 /* Release the mouse button we simulated in the last press. |
359 if ( event.modifiers & cmdKey ) { | 358 The drawback of this methos is we cannot press more than |
360 SDL_PrivateMouseButton(SDL_RELEASED, | 359 one button. However, this doesn't matter, since there is |
361 3, event.where.h, event.where.v); | 360 only a single logical mouse button, even if you have a |
362 } | 361 multi-button mouse, this doesn't matter at all. |
363 else if ( event.modifiers & optionKey ) { | 362 */ |
364 SDL_PrivateMouseButton(SDL_RELEASED, | 363 SDL_PrivateMouseButton(SDL_RELEASED, |
365 2,event.where.h,event.where.v); | 364 mouse_button, event.where.h, event.where.v); |
366 } else { | |
367 SDL_PrivateMouseButton(SDL_RELEASED, | |
368 1, event.where.h, event.where.v); | |
369 } | |
370 } | 365 } |
371 break; | 366 break; |
372 #if 0 /* Handled above the switch statement */ | 367 #if 0 /* Handled above the switch statement */ |
373 case keyDown: { | 368 case keyDown: { |
374 SDL_keysym keysym; | 369 SDL_keysym keysym; |