Mercurial > sdl-ios-xcode
annotate src/video/quartz/SDL_QuartzEvents.m @ 916:46916168361d
Date: Sun, 25 Jul 2004 23:10:03 +0800
From: Chris Taylor
Subject: SDL for Macintosh Programmer's Workshop: removed dynamic loading
I'm working on a game called D2X which uses SDL, and I recently ported
it to Mac OS 9. I used MPW to build it. It uses OpenGL. To get it to
work, I had to build SDL so it doesn't dynamically load OpenGL. This is
because I don't think MPW supports dynamic loading. The following patch
makes sure when SDL is built under MPW, dynamic loading of shared
libraries is disabled.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 25 Jul 2004 19:43:56 +0000 |
parents | f221cadd6eda |
children | af585d6efec8 |
rev | line source |
---|---|
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
1 /* |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
761
c5b2b6d2d1fe
Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
683
diff
changeset
|
3 Copyright (C) 1997-2003 Sam Lantinga |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
4 |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
6 modify it under the terms of the GNU Library General Public |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
7 License as published by the Free Software Foundation; either |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
8 version 2 of the License, or (at your option) any later version. |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
9 |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
13 Library General Public License for more details. |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
14 |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
15 You should have received a copy of the GNU Library General Public |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
16 License along with this library; if not, write to the Free |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
18 |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
19 Sam Lantinga |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
20 slouken@libsdl.org |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
21 */ |
761
c5b2b6d2d1fe
Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
683
diff
changeset
|
22 |
c5b2b6d2d1fe
Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
683
diff
changeset
|
23 #include "SDL_QuartzVideo.h" |
c5b2b6d2d1fe
Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
683
diff
changeset
|
24 |
c5b2b6d2d1fe
Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
683
diff
changeset
|
25 #include <stdlib.h> // For getenv() |
555 | 26 #include <IOKit/IOMessage.h> // For wake from sleep detection |
27 #include <IOKit/pwr_mgt/IOPMLib.h> // For wake from sleep detection | |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
28 #include "SDL_QuartzKeys.h" |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
29 |
761
c5b2b6d2d1fe
Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
683
diff
changeset
|
30 void QZ_InitOSKeymap (_THIS) { |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
31 const void *KCHRPtr; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
32 UInt32 state; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
33 UInt32 value; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
34 int i; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
35 int world = SDLK_WORLD_0; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
36 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
37 for ( i=0; i<SDL_TABLESIZE(keymap); ++i ) |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
38 keymap[i] = SDLK_UNKNOWN; |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
39 |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
40 /* This keymap is almost exactly the same as the OS 9 one */ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
41 keymap[QZ_ESCAPE] = SDLK_ESCAPE; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
42 keymap[QZ_F1] = SDLK_F1; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
43 keymap[QZ_F2] = SDLK_F2; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
44 keymap[QZ_F3] = SDLK_F3; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
45 keymap[QZ_F4] = SDLK_F4; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
46 keymap[QZ_F5] = SDLK_F5; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
47 keymap[QZ_F6] = SDLK_F6; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
48 keymap[QZ_F7] = SDLK_F7; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
49 keymap[QZ_F8] = SDLK_F8; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
50 keymap[QZ_F9] = SDLK_F9; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
51 keymap[QZ_F10] = SDLK_F10; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
52 keymap[QZ_F11] = SDLK_F11; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
53 keymap[QZ_F12] = SDLK_F12; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
54 keymap[QZ_PRINT] = SDLK_PRINT; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
55 keymap[QZ_SCROLLOCK] = SDLK_SCROLLOCK; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
56 keymap[QZ_PAUSE] = SDLK_PAUSE; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
57 keymap[QZ_POWER] = SDLK_POWER; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
58 keymap[QZ_BACKQUOTE] = SDLK_BACKQUOTE; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
59 keymap[QZ_1] = SDLK_1; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
60 keymap[QZ_2] = SDLK_2; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
61 keymap[QZ_3] = SDLK_3; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
62 keymap[QZ_4] = SDLK_4; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
63 keymap[QZ_5] = SDLK_5; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
64 keymap[QZ_6] = SDLK_6; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
65 keymap[QZ_7] = SDLK_7; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
66 keymap[QZ_8] = SDLK_8; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
67 keymap[QZ_9] = SDLK_9; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
68 keymap[QZ_0] = SDLK_0; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
69 keymap[QZ_MINUS] = SDLK_MINUS; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
70 keymap[QZ_EQUALS] = SDLK_EQUALS; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
71 keymap[QZ_BACKSPACE] = SDLK_BACKSPACE; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
72 keymap[QZ_INSERT] = SDLK_INSERT; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
73 keymap[QZ_HOME] = SDLK_HOME; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
74 keymap[QZ_PAGEUP] = SDLK_PAGEUP; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
75 keymap[QZ_NUMLOCK] = SDLK_NUMLOCK; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
76 keymap[QZ_KP_EQUALS] = SDLK_KP_EQUALS; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
77 keymap[QZ_KP_DIVIDE] = SDLK_KP_DIVIDE; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
78 keymap[QZ_KP_MULTIPLY] = SDLK_KP_MULTIPLY; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
79 keymap[QZ_TAB] = SDLK_TAB; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
80 keymap[QZ_q] = SDLK_q; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
81 keymap[QZ_w] = SDLK_w; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
82 keymap[QZ_e] = SDLK_e; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
83 keymap[QZ_r] = SDLK_r; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
84 keymap[QZ_t] = SDLK_t; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
85 keymap[QZ_y] = SDLK_y; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
86 keymap[QZ_u] = SDLK_u; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
87 keymap[QZ_i] = SDLK_i; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
88 keymap[QZ_o] = SDLK_o; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
89 keymap[QZ_p] = SDLK_p; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
90 keymap[QZ_LEFTBRACKET] = SDLK_LEFTBRACKET; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
91 keymap[QZ_RIGHTBRACKET] = SDLK_RIGHTBRACKET; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
92 keymap[QZ_BACKSLASH] = SDLK_BACKSLASH; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
93 keymap[QZ_DELETE] = SDLK_DELETE; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
94 keymap[QZ_END] = SDLK_END; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
95 keymap[QZ_PAGEDOWN] = SDLK_PAGEDOWN; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
96 keymap[QZ_KP7] = SDLK_KP7; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
97 keymap[QZ_KP8] = SDLK_KP8; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
98 keymap[QZ_KP9] = SDLK_KP9; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
99 keymap[QZ_KP_MINUS] = SDLK_KP_MINUS; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
100 keymap[QZ_CAPSLOCK] = SDLK_CAPSLOCK; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
101 keymap[QZ_a] = SDLK_a; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
102 keymap[QZ_s] = SDLK_s; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
103 keymap[QZ_d] = SDLK_d; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
104 keymap[QZ_f] = SDLK_f; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
105 keymap[QZ_g] = SDLK_g; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
106 keymap[QZ_h] = SDLK_h; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
107 keymap[QZ_j] = SDLK_j; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
108 keymap[QZ_k] = SDLK_k; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
109 keymap[QZ_l] = SDLK_l; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
110 keymap[QZ_SEMICOLON] = SDLK_SEMICOLON; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
111 keymap[QZ_QUOTE] = SDLK_QUOTE; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
112 keymap[QZ_RETURN] = SDLK_RETURN; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
113 keymap[QZ_KP4] = SDLK_KP4; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
114 keymap[QZ_KP5] = SDLK_KP5; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
115 keymap[QZ_KP6] = SDLK_KP6; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
116 keymap[QZ_KP_PLUS] = SDLK_KP_PLUS; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
117 keymap[QZ_LSHIFT] = SDLK_LSHIFT; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
118 keymap[QZ_z] = SDLK_z; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
119 keymap[QZ_x] = SDLK_x; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
120 keymap[QZ_c] = SDLK_c; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
121 keymap[QZ_v] = SDLK_v; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
122 keymap[QZ_b] = SDLK_b; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
123 keymap[QZ_n] = SDLK_n; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
124 keymap[QZ_m] = SDLK_m; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
125 keymap[QZ_COMMA] = SDLK_COMMA; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
126 keymap[QZ_PERIOD] = SDLK_PERIOD; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
127 keymap[QZ_SLASH] = SDLK_SLASH; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
128 keymap[QZ_UP] = SDLK_UP; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
129 keymap[QZ_KP1] = SDLK_KP1; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
130 keymap[QZ_KP2] = SDLK_KP2; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
131 keymap[QZ_KP3] = SDLK_KP3; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
132 keymap[QZ_KP_ENTER] = SDLK_KP_ENTER; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
133 keymap[QZ_LCTRL] = SDLK_LCTRL; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
134 keymap[QZ_LALT] = SDLK_LALT; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
135 keymap[QZ_LMETA] = SDLK_LMETA; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
136 keymap[QZ_SPACE] = SDLK_SPACE; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
137 keymap[QZ_LEFT] = SDLK_LEFT; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
138 keymap[QZ_DOWN] = SDLK_DOWN; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
139 keymap[QZ_RIGHT] = SDLK_RIGHT; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
140 keymap[QZ_KP0] = SDLK_KP0; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
141 keymap[QZ_KP_PERIOD] = SDLK_KP_PERIOD; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
142 keymap[QZ_IBOOK_ENTER] = SDLK_KP_ENTER; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
143 keymap[QZ_IBOOK_RIGHT] = SDLK_RIGHT; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
144 keymap[QZ_IBOOK_DOWN] = SDLK_DOWN; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
145 keymap[QZ_IBOOK_UP] = SDLK_UP; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
146 keymap[QZ_IBOOK_LEFT] = SDLK_LEFT; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
147 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
148 /* |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
149 Up there we setup a static scancode->keysym map. However, it will not |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
150 work very well on international keyboard. Hence we now query MacOS |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
151 for its own keymap to adjust our own mapping table. However, this is |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
152 basically only useful for ascii char keys. This is also the reason |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
153 why we keep the static table, too. |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
154 */ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
155 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
156 /* Get a pointer to the systems cached KCHR */ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
157 KCHRPtr = (void *)GetScriptManagerVariable(smKCHRCache); |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
158 if (KCHRPtr) |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
159 { |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
160 /* Loop over all 127 possible scan codes */ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
161 for (i = 0; i < 0x7F; i++) |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
162 { |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
163 /* We pretend a clean start to begin with (i.e. no dead keys active */ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
164 state = 0; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
165 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
166 /* Now translate the key code to a key value */ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
167 value = KeyTranslate(KCHRPtr, i, &state) & 0xff; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
168 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
169 /* If the state become 0, it was a dead key. We need to translate again, |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
170 passing in the new state, to get the actual key value */ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
171 if (state != 0) |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
172 value = KeyTranslate(KCHRPtr, i, &state) & 0xff; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
173 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
174 /* Now we should have an ascii value, or 0. Try to figure out to which SDL symbol it maps */ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
175 if (value >= 128) /* Some non-ASCII char, map it to SDLK_WORLD_* */ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
176 keymap[i] = world++; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
177 else if (value >= 32) /* non-control ASCII char */ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
178 keymap[i] = value; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
179 } |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
180 } |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
181 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
182 /* |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
183 The keypad codes are re-setup here, because the loop above cannot |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
184 distinguish between a key on the keypad and a regular key. We maybe |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
185 could get around this problem in another fashion: NSEvent's flags |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
186 include a "NSNumericPadKeyMask" bit; we could check that and modify |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
187 the symbol we return on the fly. However, this flag seems to exhibit |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
188 some weird behaviour related to the num lock key |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
189 */ |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
190 keymap[QZ_KP0] = SDLK_KP0; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
191 keymap[QZ_KP1] = SDLK_KP1; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
192 keymap[QZ_KP2] = SDLK_KP2; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
193 keymap[QZ_KP3] = SDLK_KP3; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
194 keymap[QZ_KP4] = SDLK_KP4; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
195 keymap[QZ_KP5] = SDLK_KP5; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
196 keymap[QZ_KP6] = SDLK_KP6; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
197 keymap[QZ_KP7] = SDLK_KP7; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
198 keymap[QZ_KP8] = SDLK_KP8; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
199 keymap[QZ_KP9] = SDLK_KP9; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
200 keymap[QZ_KP_MINUS] = SDLK_KP_MINUS; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
201 keymap[QZ_KP_PLUS] = SDLK_KP_PLUS; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
202 keymap[QZ_KP_PERIOD] = SDLK_KP_PERIOD; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
203 keymap[QZ_KP_EQUALS] = SDLK_KP_EQUALS; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
204 keymap[QZ_KP_DIVIDE] = SDLK_KP_DIVIDE; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
205 keymap[QZ_KP_MULTIPLY] = SDLK_KP_MULTIPLY; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
206 keymap[QZ_KP_ENTER] = SDLK_KP_ENTER; |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
207 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
208 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
209 static void QZ_DoKey (_THIS, int state, NSEvent *event) { |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
210 |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
211 NSString *chars; |
561
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
212 unsigned int numChars; |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
213 SDL_keysym key; |
561
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
214 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
215 /* |
561
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
216 A key event can contain multiple characters, |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
217 or no characters at all. In most cases, it |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
218 will contain a single character. If it contains |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
219 0 characters, we'll use 0 as the unicode. If it |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
220 contains multiple characters, we'll use 0 as |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
221 the scancode/keysym. |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
222 */ |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
223 chars = [ event characters ]; |
561
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
224 numChars = [ chars length ]; |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
225 |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
226 if (numChars == 1) { |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
227 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
228 key.scancode = [ event keyCode ]; |
561
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
229 key.sym = keymap [ key.scancode ]; |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
230 key.unicode = [ chars characterAtIndex:0 ]; |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
231 key.mod = KMOD_NONE; |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
232 |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
233 SDL_PrivateKeyboard (state, &key); |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
234 } |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
235 else if (numChars == 0) { |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
236 |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
237 key.scancode = [ event keyCode ]; |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
238 key.sym = keymap [ key.scancode ]; |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
239 key.unicode = 0; |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
240 key.mod = KMOD_NONE; |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
241 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
242 SDL_PrivateKeyboard (state, &key); |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
243 } |
561
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
244 else /* (numChars > 1) */ { |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
245 |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
246 int i; |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
247 for (i = 0; i < numChars; i++) { |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
248 |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
249 key.scancode = 0; |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
250 key.sym = 0; |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
251 key.unicode = [ chars characterAtIndex:i]; |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
252 key.mod = KMOD_NONE; |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
253 |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
254 SDL_PrivateKeyboard (state, &key); |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
255 } |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
256 } |
683
5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
664
diff
changeset
|
257 |
5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
664
diff
changeset
|
258 if (getenv ("SDL_ENABLEAPPEVENTS")) |
5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
664
diff
changeset
|
259 [ NSApp sendEvent:event ]; |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
260 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
261 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
262 static void QZ_DoModifiers (_THIS, unsigned int newMods) { |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
263 |
664
abfdc08eb289
Date: Sun, 3 Aug 2003 22:07:57 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
631
diff
changeset
|
264 const int mapping[] = { SDLK_CAPSLOCK, SDLK_LSHIFT, SDLK_LCTRL, SDLK_LALT, SDLK_LMETA }; |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
265 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
266 int i; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
267 int bit; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
268 SDL_keysym key; |
816
428f688f2ad2
Date: Fri, 13 Feb 2004 17:03:16 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
782
diff
changeset
|
269 |
428f688f2ad2
Date: Fri, 13 Feb 2004 17:03:16 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
782
diff
changeset
|
270 if (current_mods == newMods) |
428f688f2ad2
Date: Fri, 13 Feb 2004 17:03:16 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
782
diff
changeset
|
271 return; |
172
37e3ca9254c7
Date: Sat, 8 Sep 2001 04:42:23 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
272 |
664
abfdc08eb289
Date: Sun, 3 Aug 2003 22:07:57 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
631
diff
changeset
|
273 key.scancode = 0; |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
274 key.sym = SDLK_UNKNOWN; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
275 key.unicode = 0; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
276 key.mod = KMOD_NONE; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
277 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
278 /* Iterate through the bits, testing each against the current modifiers */ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
279 for (i = 0, bit = NSAlphaShiftKeyMask; bit <= NSCommandKeyMask; bit <<= 1, ++i) { |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
280 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
281 unsigned int currentMask, newMask; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
282 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
283 currentMask = current_mods & bit; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
284 newMask = newMods & bit; |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
285 |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
286 if ( currentMask && |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
287 currentMask != newMask ) { /* modifier up event */ |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
288 |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
289 key.sym = mapping[i]; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
290 /* If this was Caps Lock, we need some additional voodoo to make SDL happy */ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
291 if (bit == NSAlphaShiftKeyMask) |
761
c5b2b6d2d1fe
Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
683
diff
changeset
|
292 SDL_PrivateKeyboard (SDL_PRESSED, &key); |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
293 SDL_PrivateKeyboard (SDL_RELEASED, &key); |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
294 } |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
295 else if ( newMask && |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
296 currentMask != newMask ) { /* modifier down event */ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
297 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
298 key.sym = mapping[i]; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
299 SDL_PrivateKeyboard (SDL_PRESSED, &key); |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
300 /* If this was Caps Lock, we need some additional voodoo to make SDL happy */ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
301 if (bit == NSAlphaShiftKeyMask) |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
302 SDL_PrivateKeyboard (SDL_RELEASED, &key); |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
303 } |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
304 } |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
305 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
306 current_mods = newMods; |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
307 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
308 |
782
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
309 static void QZ_GetMouseLocation (_THIS, NSPoint *p) { |
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
310 *p = [ NSEvent mouseLocation ]; /* global coordinates */ |
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
311 if (qz_window) |
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
312 QZ_PrivateGlobalToLocal (this, p); |
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
313 QZ_PrivateCocoaToSDL (this, p); |
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
314 } |
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
315 |
117
aac75d5f7869
Fixed fullscreen mouse events on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
47
diff
changeset
|
316 static void QZ_DoActivate (_THIS) |
aac75d5f7869
Fixed fullscreen mouse events on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
47
diff
changeset
|
317 { |
615
7ec821f3cbd0
Date: Thu, 17 Apr 2003 23:27:34 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
318 /* Hide the cursor if it was hidden by SDL_ShowCursor() */ |
761
c5b2b6d2d1fe
Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
683
diff
changeset
|
319 if (!cursor_should_be_visible) |
c5b2b6d2d1fe
Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
683
diff
changeset
|
320 QZ_HideMouse (this); |
172
37e3ca9254c7
Date: Sat, 8 Sep 2001 04:42:23 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
321 |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
322 /* Regrab input, only if it was previously grabbed */ |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
323 if ( current_grab_mode == SDL_GRAB_ON ) { |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
324 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
325 /* Restore cursor location if input was grabbed */ |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
326 QZ_PrivateWarpCursor (this, cursor_loc.x, cursor_loc.y); |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
327 QZ_ChangeGrabState (this, QZ_ENABLE_GRAB); |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
328 } |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
329 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
330 |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
331 static void QZ_DoDeactivate (_THIS) { |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
332 |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
333 /* Get the current cursor location, for restore on activate */ |
782
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
334 QZ_GetMouseLocation (this, &cursor_loc); |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
335 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
336 /* Reassociate mouse and cursor */ |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
337 CGAssociateMouseAndMouseCursorPosition (1); |
172
37e3ca9254c7
Date: Sat, 8 Sep 2001 04:42:23 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
338 |
615
7ec821f3cbd0
Date: Thu, 17 Apr 2003 23:27:34 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
339 /* Show the cursor if it was hidden by SDL_ShowCursor() */ |
761
c5b2b6d2d1fe
Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
683
diff
changeset
|
340 if (!cursor_should_be_visible) |
c5b2b6d2d1fe
Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
683
diff
changeset
|
341 QZ_ShowMouse (this); |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
342 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
343 |
555 | 344 void QZ_SleepNotificationHandler (void * refcon, |
345 io_service_t service, | |
346 natural_t messageType, | |
347 void * messageArgument ) | |
348 { | |
349 SDL_VideoDevice *this = (SDL_VideoDevice*)refcon; | |
350 | |
351 switch(messageType) | |
352 { | |
353 case kIOMessageSystemWillSleep: | |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
354 IOAllowPowerChange(power_connection, (long) messageArgument); |
555 | 355 break; |
356 case kIOMessageCanSystemSleep: | |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
357 IOAllowPowerChange(power_connection, (long) messageArgument); |
555 | 358 break; |
359 case kIOMessageSystemHasPoweredOn: | |
761
c5b2b6d2d1fe
Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
683
diff
changeset
|
360 /* awake */ |
555 | 361 SDL_PrivateExpose(); |
362 break; | |
363 } | |
364 } | |
365 | |
761
c5b2b6d2d1fe
Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
683
diff
changeset
|
366 void QZ_RegisterForSleepNotifications (_THIS) |
555 | 367 { |
368 CFRunLoopSourceRef rls; | |
369 IONotificationPortRef thePortRef; | |
370 io_object_t notifier; | |
371 | |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
372 power_connection = IORegisterForSystemPower (this, &thePortRef, QZ_SleepNotificationHandler, ¬ifier); |
555 | 373 |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
374 if (power_connection == 0) |
555 | 375 NSLog(@"SDL: QZ_SleepNotificationHandler() IORegisterForSystemPower failed."); |
376 | |
377 rls = IONotificationPortGetRunLoopSource (thePortRef); | |
378 CFRunLoopAddSource (CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode); | |
379 CFRelease (rls); | |
380 } | |
381 | |
624
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
382 |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
383 // Try to map Quartz mouse buttons to SDL's lingo... |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
384 static int QZ_OtherMouseButtonToSDL(int button) |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
385 { |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
386 switch (button) |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
387 { |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
388 case 0: |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
389 return(SDL_BUTTON_LEFT); // 1 |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
390 case 1: |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
391 return(SDL_BUTTON_RIGHT); // 3 |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
392 case 2: |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
393 return(SDL_BUTTON_MIDDLE); // 2 |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
394 } |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
395 |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
396 // >= 3: skip 4 & 5, since those are the SDL mousewheel buttons. |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
397 return(button + 3); |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
398 } |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
399 |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
400 |
761
c5b2b6d2d1fe
Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
683
diff
changeset
|
401 void QZ_PumpEvents (_THIS) |
158
4382c38dfbee
Date: Tue, 21 Aug 2001 03:50:01 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
155
diff
changeset
|
402 { |
435
140798e1e7a6
Darrell's fix for Quartz mouse motion
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
403 int firstMouseEvent; |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
404 CGMouseDelta dx, dy; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
405 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
406 NSDate *distantPast; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
407 NSEvent *event; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
408 NSRect winRect; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
409 NSAutoreleasePool *pool; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
410 |
619
bf816ce70144
Disable MacOS X screensaver for duration of application run by triggering a
Ryan C. Gordon <icculus@icculus.org>
parents:
615
diff
changeset
|
411 /* Update activity every five seconds to prevent screensaver. --ryan. */ |
bf816ce70144
Disable MacOS X screensaver for duration of application run by triggering a
Ryan C. Gordon <icculus@icculus.org>
parents:
615
diff
changeset
|
412 static Uint32 screensaverTicks = 0; |
bf816ce70144
Disable MacOS X screensaver for duration of application run by triggering a
Ryan C. Gordon <icculus@icculus.org>
parents:
615
diff
changeset
|
413 Uint32 nowTicks = SDL_GetTicks(); |
bf816ce70144
Disable MacOS X screensaver for duration of application run by triggering a
Ryan C. Gordon <icculus@icculus.org>
parents:
615
diff
changeset
|
414 if ((nowTicks - screensaverTicks) > 5000) |
bf816ce70144
Disable MacOS X screensaver for duration of application run by triggering a
Ryan C. Gordon <icculus@icculus.org>
parents:
615
diff
changeset
|
415 { |
bf816ce70144
Disable MacOS X screensaver for duration of application run by triggering a
Ryan C. Gordon <icculus@icculus.org>
parents:
615
diff
changeset
|
416 UpdateSystemActivity(UsrActivity); |
bf816ce70144
Disable MacOS X screensaver for duration of application run by triggering a
Ryan C. Gordon <icculus@icculus.org>
parents:
615
diff
changeset
|
417 screensaverTicks = nowTicks; |
bf816ce70144
Disable MacOS X screensaver for duration of application run by triggering a
Ryan C. Gordon <icculus@icculus.org>
parents:
615
diff
changeset
|
418 } |
bf816ce70144
Disable MacOS X screensaver for duration of application run by triggering a
Ryan C. Gordon <icculus@icculus.org>
parents:
615
diff
changeset
|
419 |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
420 pool = [ [ NSAutoreleasePool alloc ] init ]; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
421 distantPast = [ NSDate distantPast ]; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
422 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
423 winRect = NSMakeRect (0, 0, SDL_VideoSurface->w, SDL_VideoSurface->h); |
435
140798e1e7a6
Darrell's fix for Quartz mouse motion
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
424 |
140798e1e7a6
Darrell's fix for Quartz mouse motion
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
425 /* send the first mouse event in absolute coordinates */ |
140798e1e7a6
Darrell's fix for Quartz mouse motion
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
426 firstMouseEvent = 1; |
140798e1e7a6
Darrell's fix for Quartz mouse motion
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
427 |
140798e1e7a6
Darrell's fix for Quartz mouse motion
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
428 /* accumulate any additional mouse moved events into one SDL mouse event */ |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
429 dx = 0; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
430 dy = 0; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
431 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
432 do { |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
433 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
434 /* Poll for an event. This will not block */ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
435 event = [ NSApp nextEventMatchingMask:NSAnyEventMask |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
436 untilDate:distantPast |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
437 inMode: NSDefaultRunLoopMode dequeue:YES ]; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
438 if (event != nil) { |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
439 |
624
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
440 int button; |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
441 unsigned int type; |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
442 BOOL isInGameWin; |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
443 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
444 #define DO_MOUSE_DOWN(button) do { \ |
761
c5b2b6d2d1fe
Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
683
diff
changeset
|
445 if ( [ NSApp isActive ] ) { \ |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
446 if ( isInGameWin ) { \ |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
447 SDL_PrivateMouseButton (SDL_PRESSED, button, 0, 0); \ |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
448 expect_mouse_up |= 1<<button; \ |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
449 } \ |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
450 } \ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
451 else { \ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
452 QZ_DoActivate (this); \ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
453 } \ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
454 [ NSApp sendEvent:event ]; \ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
455 } while(0) |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
456 |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
457 #define DO_MOUSE_UP(button) do { \ |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
458 if ( expect_mouse_up & (1<<button) ) { \ |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
459 SDL_PrivateMouseButton (SDL_RELEASED, button, 0, 0); \ |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
460 expect_mouse_up &= ~(1<<button); \ |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
461 } \ |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
462 [ NSApp sendEvent:event ]; \ |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
463 } while(0) |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
464 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
465 type = [ event type ]; |
779
68c8da837fc0
Date: Tue, 6 Jan 2004 21:54:02 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
761
diff
changeset
|
466 isInGameWin = QZ_IsMouseInWindow (this); |
782
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
467 |
816
428f688f2ad2
Date: Fri, 13 Feb 2004 17:03:16 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
782
diff
changeset
|
468 QZ_DoModifiers(this, [ event modifierFlags ] ); |
428f688f2ad2
Date: Fri, 13 Feb 2004 17:03:16 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
782
diff
changeset
|
469 |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
470 switch (type) { |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
471 case NSLeftMouseDown: |
511
79c189f5bd76
Added an environment variable SDL_HAS3BUTTONMOUSE for Quartz
Sam Lantinga <slouken@libsdl.org>
parents:
502
diff
changeset
|
472 if ( getenv("SDL_HAS3BUTTONMOUSE") ) { |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
473 DO_MOUSE_DOWN (SDL_BUTTON_LEFT); |
511
79c189f5bd76
Added an environment variable SDL_HAS3BUTTONMOUSE for Quartz
Sam Lantinga <slouken@libsdl.org>
parents:
502
diff
changeset
|
474 } else { |
898
f221cadd6eda
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
897
diff
changeset
|
475 if ( NSCommandKeyMask & current_mods ) { |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
476 last_virtual_button = SDL_BUTTON_RIGHT; |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
477 DO_MOUSE_DOWN (SDL_BUTTON_RIGHT); |
511
79c189f5bd76
Added an environment variable SDL_HAS3BUTTONMOUSE for Quartz
Sam Lantinga <slouken@libsdl.org>
parents:
502
diff
changeset
|
478 } |
79c189f5bd76
Added an environment variable SDL_HAS3BUTTONMOUSE for Quartz
Sam Lantinga <slouken@libsdl.org>
parents:
502
diff
changeset
|
479 else if ( NSAlternateKeyMask & current_mods ) { |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
480 last_virtual_button = SDL_BUTTON_MIDDLE; |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
481 DO_MOUSE_DOWN (SDL_BUTTON_MIDDLE); |
511
79c189f5bd76
Added an environment variable SDL_HAS3BUTTONMOUSE for Quartz
Sam Lantinga <slouken@libsdl.org>
parents:
502
diff
changeset
|
482 } |
79c189f5bd76
Added an environment variable SDL_HAS3BUTTONMOUSE for Quartz
Sam Lantinga <slouken@libsdl.org>
parents:
502
diff
changeset
|
483 else { |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
484 DO_MOUSE_DOWN (SDL_BUTTON_LEFT); |
511
79c189f5bd76
Added an environment variable SDL_HAS3BUTTONMOUSE for Quartz
Sam Lantinga <slouken@libsdl.org>
parents:
502
diff
changeset
|
485 } |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
486 } |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
487 break; |
624
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
488 |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
489 case NSLeftMouseUp: |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
490 if ( last_virtual_button != 0 ) { |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
491 DO_MOUSE_UP (last_virtual_button); |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
492 last_virtual_button = 0; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
493 } |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
494 else { |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
495 DO_MOUSE_UP (SDL_BUTTON_LEFT); |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
496 } |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
497 break; |
624
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
498 |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
499 case NSOtherMouseDown: |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
500 case NSRightMouseDown: |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
501 button = QZ_OtherMouseButtonToSDL([ event buttonNumber ]); |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
502 DO_MOUSE_DOWN (button); |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
503 break; |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
504 |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
505 case NSOtherMouseUp: |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
506 case NSRightMouseUp: |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
507 button = QZ_OtherMouseButtonToSDL([ event buttonNumber ]); |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
508 DO_MOUSE_UP (button); |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
509 break; |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
510 |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
511 case NSSystemDefined: |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
512 /* |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
513 Future: up to 32 "mouse" buttons can be handled. |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
514 if ([event subtype] == 7) { |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
515 unsigned int buttons; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
516 buttons = [ event data2 ]; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
517 */ |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
518 break; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
519 case NSLeftMouseDragged: |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
520 case NSRightMouseDragged: |
435
140798e1e7a6
Darrell's fix for Quartz mouse motion
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
521 case NSOtherMouseDragged: /* usually middle mouse dragged */ |
898
f221cadd6eda
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
897
diff
changeset
|
522 case NSMouseMoved: |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
523 if ( grab_state == QZ_INVISIBLE_GRAB ) { |
272
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
524 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
525 /* |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
526 If input is grabbed+hidden, the cursor doesn't move, |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
527 so we have to call the lowlevel window server |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
528 function. This is less accurate but works OK. |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
529 */ |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
530 CGMouseDelta dx1, dy1; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
531 CGGetLastMouseDelta (&dx1, &dy1); |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
532 dx += dx1; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
533 dy += dy1; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
534 } |
435
140798e1e7a6
Darrell's fix for Quartz mouse motion
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
535 else if (firstMouseEvent) { |
140798e1e7a6
Darrell's fix for Quartz mouse motion
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
536 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
537 /* |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
538 Get the first mouse event in a possible |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
539 sequence of mouse moved events. Since we |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
540 use absolute coordinates, this serves to |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
541 compensate any inaccuracy in deltas, and |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
542 provides the first known mouse position, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
543 since everything after this uses deltas |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
544 */ |
782
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
545 NSPoint p; |
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
546 QZ_GetMouseLocation (this, &p); |
454
c4338ecf45f9
Fixed mouse motion on MacOS X (recently broken)
Sam Lantinga <slouken@libsdl.org>
parents:
435
diff
changeset
|
547 SDL_PrivateMouseMotion (0, 0, p.x, p.y); |
435
140798e1e7a6
Darrell's fix for Quartz mouse motion
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
548 firstMouseEvent = 0; |
782
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
549 } |
435
140798e1e7a6
Darrell's fix for Quartz mouse motion
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
550 else { |
140798e1e7a6
Darrell's fix for Quartz mouse motion
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
551 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
552 /* |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
553 Get the amount moved since the last drag or move event, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
554 add it on for one big move event at the end. |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
555 */ |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
556 dx += [ event deltaX ]; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
557 dy += [ event deltaY ]; |
435
140798e1e7a6
Darrell's fix for Quartz mouse motion
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
558 } |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
559 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
560 /* |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
561 Handle grab input+cursor visible by warping the cursor back |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
562 into the game window. This still generates a mouse moved event, |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
563 but not as a result of the warp (so it's in the right direction). |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
564 */ |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
565 if ( grab_state == QZ_VISIBLE_GRAB && |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
566 !isInGameWin ) { |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
567 |
782
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
568 NSPoint p; |
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
569 QZ_GetMouseLocation (this, &p); |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
570 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
571 if ( p.x < 0.0 ) |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
572 p.x = 0.0; |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
573 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
574 if ( p.y < 0.0 ) |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
575 p.y = 0.0; |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
576 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
577 if ( p.x >= winRect.size.width ) |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
578 p.x = winRect.size.width-1; |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
579 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
580 if ( p.y >= winRect.size.height ) |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
581 p.y = winRect.size.height-1; |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
582 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
583 QZ_PrivateWarpCursor (this, p.x, p.y); |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
584 } |
631
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
624
diff
changeset
|
585 else |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
624
diff
changeset
|
586 if ( !isInGameWin && (SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) { |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
624
diff
changeset
|
587 |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
624
diff
changeset
|
588 SDL_PrivateAppActive (0, SDL_APPMOUSEFOCUS); |
779
68c8da837fc0
Date: Tue, 6 Jan 2004 21:54:02 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
761
diff
changeset
|
589 if (!cursor_should_be_visible) |
68c8da837fc0
Date: Tue, 6 Jan 2004 21:54:02 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
761
diff
changeset
|
590 QZ_ShowMouse (this); |
631
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
624
diff
changeset
|
591 } |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
624
diff
changeset
|
592 else |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
624
diff
changeset
|
593 if ( isInGameWin && !(SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) { |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
624
diff
changeset
|
594 |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
624
diff
changeset
|
595 SDL_PrivateAppActive (1, SDL_APPMOUSEFOCUS); |
779
68c8da837fc0
Date: Tue, 6 Jan 2004 21:54:02 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
761
diff
changeset
|
596 if (!cursor_should_be_visible) |
68c8da837fc0
Date: Tue, 6 Jan 2004 21:54:02 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
761
diff
changeset
|
597 QZ_HideMouse (this); |
631
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
624
diff
changeset
|
598 } |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
599 break; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
600 case NSScrollWheel: |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
601 if ( isInGameWin ) { |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
602 float dy; |
502
80a3d09bab29
Fixed mouse wheel events on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
603 Uint8 button; |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
604 dy = [ event deltaY ]; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
605 if ( dy > 0.0 ) /* Scroll up */ |
502
80a3d09bab29
Fixed mouse wheel events on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
606 button = SDL_BUTTON_WHEELUP; |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
607 else /* Scroll down */ |
502
80a3d09bab29
Fixed mouse wheel events on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
608 button = SDL_BUTTON_WHEELDOWN; |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
609 /* For now, wheel is sent as a quick down+up */ |
502
80a3d09bab29
Fixed mouse wheel events on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
610 SDL_PrivateMouseButton (SDL_PRESSED, button, 0, 0); |
80a3d09bab29
Fixed mouse wheel events on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
611 SDL_PrivateMouseButton (SDL_RELEASED, button, 0, 0); |
272
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
612 } |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
613 break; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
614 case NSKeyUp: |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
615 QZ_DoKey (this, SDL_RELEASED, event); |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
616 break; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
617 case NSKeyDown: |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
618 QZ_DoKey (this, SDL_PRESSED, event); |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
619 break; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
620 case NSFlagsChanged: |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
621 break; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
622 case NSAppKitDefined: |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
623 switch ( [ event subtype ] ) { |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
624 case NSApplicationActivatedEventType: |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
625 QZ_DoActivate (this); |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
626 break; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
627 case NSApplicationDeactivatedEventType: |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
628 QZ_DoDeactivate (this); |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
629 break; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
630 } |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
631 [ NSApp sendEvent:event ]; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
632 break; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
633 /* case NSApplicationDefined: break; */ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
634 /* case NSPeriodic: break; */ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
635 /* case NSCursorUpdate: break; */ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
636 default: |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
637 [ NSApp sendEvent:event ]; |
272
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
638 } |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
639 } |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
640 } while (event != nil); |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
641 |
435
140798e1e7a6
Darrell's fix for Quartz mouse motion
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
642 /* handle accumulated mouse moved events */ |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
643 if (dx != 0 || dy != 0) |
435
140798e1e7a6
Darrell's fix for Quartz mouse motion
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
644 SDL_PrivateMouseMotion (0, 1, dx, dy); |
898
f221cadd6eda
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
897
diff
changeset
|
645 |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
646 [ pool release ]; |
502
80a3d09bab29
Fixed mouse wheel events on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
647 } |