Mercurial > sdl-ios-xcode
annotate src/video/quartz/SDL_QuartzEvents.m @ 4390:725e506f6243 SDL-1.2
Fixed bug #895
Markus Rothe 2009-12-07 09:32:46 PST
Check if libspe2 is available
Building on PowerPC64 results in:
[...]
In file included from ./src/video/ps3/SDL_ps3events_c.h:33,
from ./src/video/ps3/SDL_ps3video.c:32:
./src/video/ps3/SDL_ps3video.h:34:21: error: libspe2.h: No such file or
directory
In file included from ./src/video/ps3/SDL_ps3events_c.h:33,
from ./src/video/ps3/SDL_ps3video.c:32:
./src/video/ps3/SDL_ps3video.h:75: error: expected specifier-qualifier-list
before 'spe_context_ptr_t'
./src/video/ps3/SDL_ps3video.c:78: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'fb_writer_spu'
./src/video/ps3/SDL_ps3video.c: In function 'PS3_VideoInit':
./src/video/ps3/SDL_ps3video.c:167: error: 'spu_data_t' has no member named
'program'
./src/video/ps3/SDL_ps3video.c:167: error: 'fb_writer_spu' undeclared (first
use in this function)
[...]
The problem is that the ps3 video driver is being build regardless if libspe2
is installed or not. The attached patch fixes this problem.
[ Note: The other headers that are being checked for are coming from the linux
headers package on powerpc64. As a result these are also available if you're on
a generic powerpc64 machine and not a PS3 only. ]
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 11 Dec 2009 15:14:13 +0000 |
parents | ed5e32187eec |
children |
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 |
4159 | 3 Copyright (C) 1997-2009 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 */ |
1403
376665398b25
Catch the C++ and Objective C sources too...
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
22 #include "SDL_config.h" |
761
c5b2b6d2d1fe
Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
683
diff
changeset
|
23 |
c5b2b6d2d1fe
Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
683
diff
changeset
|
24 #include "SDL_QuartzVideo.h" |
4070
b8f2db95145e
Patch from Christian Walther
Sam Lantinga <slouken@libsdl.org>
parents:
4066
diff
changeset
|
25 #include "SDL_QuartzWM.h" |
761
c5b2b6d2d1fe
Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
683
diff
changeset
|
26 |
1487
dc6b59e925a2
Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
1403
diff
changeset
|
27 #include <IOKit/IOMessage.h> /* For wake from sleep detection */ |
dc6b59e925a2
Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
1403
diff
changeset
|
28 #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
|
29 #include "SDL_QuartzKeys.h" |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
30 |
4244 | 31 /* |
32 * On Leopard, this is missing from the 64-bit headers | |
33 */ | |
4251
ed5e32187eec
Better fix from Max Horn
Sam Lantinga <slouken@libsdl.org>
parents:
4244
diff
changeset
|
34 #if defined(__LP64__) && !defined(__POWER__) |
ed5e32187eec
Better fix from Max Horn
Sam Lantinga <slouken@libsdl.org>
parents:
4244
diff
changeset
|
35 /* |
ed5e32187eec
Better fix from Max Horn
Sam Lantinga <slouken@libsdl.org>
parents:
4244
diff
changeset
|
36 * Workaround for a bug in the 10.5 SDK: By accident, OSService.h does |
ed5e32187eec
Better fix from Max Horn
Sam Lantinga <slouken@libsdl.org>
parents:
4244
diff
changeset
|
37 * not include Power.h at all when compiling in 64bit mode. This has |
ed5e32187eec
Better fix from Max Horn
Sam Lantinga <slouken@libsdl.org>
parents:
4244
diff
changeset
|
38 * been fixed in 10.6, but for 10.5, we manually define UsrActivity |
ed5e32187eec
Better fix from Max Horn
Sam Lantinga <slouken@libsdl.org>
parents:
4244
diff
changeset
|
39 * to ensure compilation works. |
ed5e32187eec
Better fix from Max Horn
Sam Lantinga <slouken@libsdl.org>
parents:
4244
diff
changeset
|
40 */ |
4244 | 41 #define UsrActivity 1 |
42 #endif | |
43 | |
934
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
44 /* |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
45 * In Panther, this header defines device dependent masks for |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
46 * right side keys. These definitions only exist in Panther, but |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
47 * the header seems to exist at least in Jaguar and probably earlier |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
48 * versions of the OS, so this should't break anything. |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
49 */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
50 #include <IOKit/hidsystem/IOLLEvent.h> |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
51 /* |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
52 * These are not defined before Panther. To keep the code compiling |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
53 * on systems without these, I will define if they don't exist. |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
54 */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
55 #ifndef NX_DEVICERCTLKEYMASK |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
56 #define NX_DEVICELCTLKEYMASK 0x00000001 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
57 #endif |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
58 #ifndef NX_DEVICELSHIFTKEYMASK |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
59 #define NX_DEVICELSHIFTKEYMASK 0x00000002 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
60 #endif |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
61 #ifndef NX_DEVICERSHIFTKEYMASK |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
62 #define NX_DEVICERSHIFTKEYMASK 0x00000004 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
63 #endif |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
64 #ifndef NX_DEVICELCMDKEYMASK |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
65 #define NX_DEVICELCMDKEYMASK 0x00000008 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
66 #endif |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
67 #ifndef NX_DEVICERCMDKEYMASK |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
68 #define NX_DEVICERCMDKEYMASK 0x00000010 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
69 #endif |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
70 #ifndef NX_DEVICELALTKEYMASK |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
71 #define NX_DEVICELALTKEYMASK 0x00000020 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
72 #endif |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
73 #ifndef NX_DEVICERALTKEYMASK |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
74 #define NX_DEVICERALTKEYMASK 0x00000040 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
75 #endif |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
76 #ifndef NX_DEVICERCTLKEYMASK |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
77 #define NX_DEVICERCTLKEYMASK 0x00002000 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
78 #endif |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
79 |
761
c5b2b6d2d1fe
Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
683
diff
changeset
|
80 void QZ_InitOSKeymap (_THIS) { |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
81 const void *KCHRPtr; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
82 UInt32 state; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
83 UInt32 value; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
84 int i; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
85 int world = SDLK_WORLD_0; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
86 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
87 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
|
88 keymap[i] = SDLK_UNKNOWN; |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
89 |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
90 /* 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
|
91 keymap[QZ_ESCAPE] = SDLK_ESCAPE; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
92 keymap[QZ_F1] = SDLK_F1; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
93 keymap[QZ_F2] = SDLK_F2; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
94 keymap[QZ_F3] = SDLK_F3; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
95 keymap[QZ_F4] = SDLK_F4; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
96 keymap[QZ_F5] = SDLK_F5; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
97 keymap[QZ_F6] = SDLK_F6; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
98 keymap[QZ_F7] = SDLK_F7; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
99 keymap[QZ_F8] = SDLK_F8; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
100 keymap[QZ_F9] = SDLK_F9; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
101 keymap[QZ_F10] = SDLK_F10; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
102 keymap[QZ_F11] = SDLK_F11; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
103 keymap[QZ_F12] = SDLK_F12; |
3914
4fd12011d8d6
Quartz code should use F13, F14, and F15 keys instead of PrintScreen,
Ryan C. Gordon <icculus@icculus.org>
parents:
1876
diff
changeset
|
104 keymap[QZ_F13] = SDLK_F13; |
4fd12011d8d6
Quartz code should use F13, F14, and F15 keys instead of PrintScreen,
Ryan C. Gordon <icculus@icculus.org>
parents:
1876
diff
changeset
|
105 keymap[QZ_F14] = SDLK_F14; |
4fd12011d8d6
Quartz code should use F13, F14, and F15 keys instead of PrintScreen,
Ryan C. Gordon <icculus@icculus.org>
parents:
1876
diff
changeset
|
106 keymap[QZ_F15] = SDLK_F15; |
4fd12011d8d6
Quartz code should use F13, F14, and F15 keys instead of PrintScreen,
Ryan C. Gordon <icculus@icculus.org>
parents:
1876
diff
changeset
|
107 /* |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
108 keymap[QZ_PRINT] = SDLK_PRINT; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
109 keymap[QZ_SCROLLOCK] = SDLK_SCROLLOCK; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
110 keymap[QZ_PAUSE] = SDLK_PAUSE; |
3914
4fd12011d8d6
Quartz code should use F13, F14, and F15 keys instead of PrintScreen,
Ryan C. Gordon <icculus@icculus.org>
parents:
1876
diff
changeset
|
111 */ |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
112 keymap[QZ_POWER] = SDLK_POWER; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
113 keymap[QZ_BACKQUOTE] = SDLK_BACKQUOTE; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
114 keymap[QZ_1] = SDLK_1; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
115 keymap[QZ_2] = SDLK_2; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
116 keymap[QZ_3] = SDLK_3; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
117 keymap[QZ_4] = SDLK_4; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
118 keymap[QZ_5] = SDLK_5; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
119 keymap[QZ_6] = SDLK_6; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
120 keymap[QZ_7] = SDLK_7; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
121 keymap[QZ_8] = SDLK_8; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
122 keymap[QZ_9] = SDLK_9; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
123 keymap[QZ_0] = SDLK_0; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
124 keymap[QZ_MINUS] = SDLK_MINUS; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
125 keymap[QZ_EQUALS] = SDLK_EQUALS; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
126 keymap[QZ_BACKSPACE] = SDLK_BACKSPACE; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
127 keymap[QZ_INSERT] = SDLK_INSERT; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
128 keymap[QZ_HOME] = SDLK_HOME; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
129 keymap[QZ_PAGEUP] = SDLK_PAGEUP; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
130 keymap[QZ_NUMLOCK] = SDLK_NUMLOCK; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
131 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
|
132 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
|
133 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
|
134 keymap[QZ_TAB] = SDLK_TAB; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
135 keymap[QZ_q] = SDLK_q; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
136 keymap[QZ_w] = SDLK_w; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
137 keymap[QZ_e] = SDLK_e; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
138 keymap[QZ_r] = SDLK_r; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
139 keymap[QZ_t] = SDLK_t; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
140 keymap[QZ_y] = SDLK_y; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
141 keymap[QZ_u] = SDLK_u; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
142 keymap[QZ_i] = SDLK_i; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
143 keymap[QZ_o] = SDLK_o; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
144 keymap[QZ_p] = SDLK_p; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
145 keymap[QZ_LEFTBRACKET] = SDLK_LEFTBRACKET; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
146 keymap[QZ_RIGHTBRACKET] = SDLK_RIGHTBRACKET; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
147 keymap[QZ_BACKSLASH] = SDLK_BACKSLASH; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
148 keymap[QZ_DELETE] = SDLK_DELETE; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
149 keymap[QZ_END] = SDLK_END; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
150 keymap[QZ_PAGEDOWN] = SDLK_PAGEDOWN; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
151 keymap[QZ_KP7] = SDLK_KP7; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
152 keymap[QZ_KP8] = SDLK_KP8; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
153 keymap[QZ_KP9] = SDLK_KP9; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
154 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
|
155 keymap[QZ_CAPSLOCK] = SDLK_CAPSLOCK; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
156 keymap[QZ_a] = SDLK_a; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
157 keymap[QZ_s] = SDLK_s; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
158 keymap[QZ_d] = SDLK_d; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
159 keymap[QZ_f] = SDLK_f; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
160 keymap[QZ_g] = SDLK_g; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
161 keymap[QZ_h] = SDLK_h; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
162 keymap[QZ_j] = SDLK_j; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
163 keymap[QZ_k] = SDLK_k; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
164 keymap[QZ_l] = SDLK_l; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
165 keymap[QZ_SEMICOLON] = SDLK_SEMICOLON; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
166 keymap[QZ_QUOTE] = SDLK_QUOTE; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
167 keymap[QZ_RETURN] = SDLK_RETURN; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
168 keymap[QZ_KP4] = SDLK_KP4; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
169 keymap[QZ_KP5] = SDLK_KP5; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
170 keymap[QZ_KP6] = SDLK_KP6; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
171 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
|
172 keymap[QZ_LSHIFT] = SDLK_LSHIFT; |
934
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
173 keymap[QZ_RSHIFT] = SDLK_RSHIFT; |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
174 keymap[QZ_z] = SDLK_z; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
175 keymap[QZ_x] = SDLK_x; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
176 keymap[QZ_c] = SDLK_c; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
177 keymap[QZ_v] = SDLK_v; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
178 keymap[QZ_b] = SDLK_b; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
179 keymap[QZ_n] = SDLK_n; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
180 keymap[QZ_m] = SDLK_m; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
181 keymap[QZ_COMMA] = SDLK_COMMA; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
182 keymap[QZ_PERIOD] = SDLK_PERIOD; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
183 keymap[QZ_SLASH] = SDLK_SLASH; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
184 keymap[QZ_UP] = SDLK_UP; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
185 keymap[QZ_KP1] = SDLK_KP1; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
186 keymap[QZ_KP2] = SDLK_KP2; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
187 keymap[QZ_KP3] = SDLK_KP3; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
188 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
|
189 keymap[QZ_LCTRL] = SDLK_LCTRL; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
190 keymap[QZ_LALT] = SDLK_LALT; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
191 keymap[QZ_LMETA] = SDLK_LMETA; |
934
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
192 keymap[QZ_RCTRL] = SDLK_RCTRL; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
193 keymap[QZ_RALT] = SDLK_RALT; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
194 keymap[QZ_RMETA] = SDLK_RMETA; |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
195 keymap[QZ_SPACE] = SDLK_SPACE; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
196 keymap[QZ_LEFT] = SDLK_LEFT; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
197 keymap[QZ_DOWN] = SDLK_DOWN; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
198 keymap[QZ_RIGHT] = SDLK_RIGHT; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
199 keymap[QZ_KP0] = SDLK_KP0; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
200 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
|
201 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
|
202 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
|
203 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
|
204 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
|
205 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
|
206 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
207 /* |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
208 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
|
209 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
|
210 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
|
211 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
|
212 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
|
213 */ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
214 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
215 /* 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
|
216 KCHRPtr = (void *)GetScriptManagerVariable(smKCHRCache); |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
217 if (KCHRPtr) |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
218 { |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
219 /* 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
|
220 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
|
221 { |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
222 /* 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
|
223 state = 0; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
224 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
225 /* 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
|
226 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
|
227 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
228 /* 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
|
229 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
|
230 if (state != 0) |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
231 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
|
232 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
233 /* 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
|
234 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
|
235 keymap[i] = world++; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
236 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
|
237 keymap[i] = value; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
238 } |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
239 } |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
240 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
241 /* |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
242 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
|
243 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
|
244 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
|
245 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
|
246 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
|
247 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
|
248 */ |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
249 keymap[QZ_KP0] = SDLK_KP0; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
250 keymap[QZ_KP1] = SDLK_KP1; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
251 keymap[QZ_KP2] = SDLK_KP2; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
252 keymap[QZ_KP3] = SDLK_KP3; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
253 keymap[QZ_KP4] = SDLK_KP4; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
254 keymap[QZ_KP5] = SDLK_KP5; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
255 keymap[QZ_KP6] = SDLK_KP6; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
256 keymap[QZ_KP7] = SDLK_KP7; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
257 keymap[QZ_KP8] = SDLK_KP8; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
258 keymap[QZ_KP9] = SDLK_KP9; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
259 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
|
260 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
|
261 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
|
262 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
|
263 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
|
264 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
|
265 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
|
266 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
267 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
268 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
|
269 |
4130
a922394ae038
Fixed 1 out of 210 warnings. ;-)
Sam Lantinga <slouken@libsdl.org>
parents:
4101
diff
changeset
|
270 NSString *chars = NULL; |
4049
60f677630282
Added key composition support, courtesy of Kuon
Sam Lantinga <slouken@libsdl.org>
parents:
4011
diff
changeset
|
271 unsigned int i, numChars; |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
272 SDL_keysym key; |
561
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
273 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
274 /* |
561
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
275 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
|
276 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
|
277 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
|
278 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
|
279 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
|
280 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
|
281 */ |
4049
60f677630282
Added key composition support, courtesy of Kuon
Sam Lantinga <slouken@libsdl.org>
parents:
4011
diff
changeset
|
282 if (SDL_TranslateUNICODE && state == SDL_PRESSED) { |
60f677630282
Added key composition support, courtesy of Kuon
Sam Lantinga <slouken@libsdl.org>
parents:
4011
diff
changeset
|
283 [field_edit interpretKeyEvents:[NSArray arrayWithObject:event]]; |
1876 | 284 chars = [ event characters ]; |
285 numChars = [ chars length ]; | |
4093
7ea10b80eda3
Fixed bugs #471 and #480
Sam Lantinga <slouken@libsdl.org>
parents:
4072
diff
changeset
|
286 if (numChars > 0) |
7ea10b80eda3
Fixed bugs #471 and #480
Sam Lantinga <slouken@libsdl.org>
parents:
4072
diff
changeset
|
287 [field_edit setString:@""]; |
1876 | 288 } else { |
289 numChars = 0; | |
290 } | |
561
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
291 |
1876 | 292 if (numChars == 0) { |
293 | |
294 key.scancode = [ event keyCode ]; | |
295 key.sym = keymap [ key.scancode ]; | |
296 key.unicode = 0; | |
297 key.mod = KMOD_NONE; | |
298 | |
299 SDL_PrivateKeyboard (state, &key); | |
300 } | |
4049
60f677630282
Added key composition support, courtesy of Kuon
Sam Lantinga <slouken@libsdl.org>
parents:
4011
diff
changeset
|
301 else if (numChars >= 1) { |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
302 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
303 key.scancode = [ event keyCode ]; |
561
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
304 key.sym = keymap [ key.scancode ]; |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
305 key.unicode = [ chars characterAtIndex:0 ]; |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
306 key.mod = KMOD_NONE; |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
307 |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
308 SDL_PrivateKeyboard (state, &key); |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
309 |
4049
60f677630282
Added key composition support, courtesy of Kuon
Sam Lantinga <slouken@libsdl.org>
parents:
4011
diff
changeset
|
310 for (i = 1; i < numChars; i++) { |
561
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
311 |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
312 key.scancode = 0; |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
313 key.sym = 0; |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
314 key.unicode = [ chars characterAtIndex:i]; |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
315 key.mod = KMOD_NONE; |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
316 |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
317 SDL_PrivateKeyboard (state, &key); |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
318 } |
4bcf7dd06c47
Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
555
diff
changeset
|
319 } |
683
5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
664
diff
changeset
|
320 |
1338
604d73db6802
Removed uses of stdlib.h and string.h
Sam Lantinga <slouken@libsdl.org>
parents:
1213
diff
changeset
|
321 if (SDL_getenv ("SDL_ENABLEAPPEVENTS")) |
683
5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
664
diff
changeset
|
322 [ NSApp sendEvent:event ]; |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
323 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
324 |
934
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
325 /* This is the original behavior, before support was added for |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
326 * differentiating between left and right versions of the keys. |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
327 */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
328 static void QZ_DoUnsidedModifiers (_THIS, unsigned int newMods) { |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
329 |
664
abfdc08eb289
Date: Sun, 3 Aug 2003 22:07:57 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
631
diff
changeset
|
330 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
|
331 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
332 int i; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
333 int bit; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
334 SDL_keysym key; |
816
428f688f2ad2
Date: Fri, 13 Feb 2004 17:03:16 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
782
diff
changeset
|
335 |
664
abfdc08eb289
Date: Sun, 3 Aug 2003 22:07:57 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
631
diff
changeset
|
336 key.scancode = 0; |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
337 key.sym = SDLK_UNKNOWN; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
338 key.unicode = 0; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
339 key.mod = KMOD_NONE; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
340 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
341 /* 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
|
342 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
|
343 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
344 unsigned int currentMask, newMask; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
345 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
346 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
|
347 newMask = newMods & bit; |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
348 |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
349 if ( currentMask && |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
350 currentMask != newMask ) { /* modifier up event */ |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
351 |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
352 key.sym = mapping[i]; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
353 /* 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
|
354 if (bit == NSAlphaShiftKeyMask) |
761
c5b2b6d2d1fe
Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
683
diff
changeset
|
355 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
|
356 SDL_PrivateKeyboard (SDL_RELEASED, &key); |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
357 } |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
358 else if ( newMask && |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
359 currentMask != newMask ) { /* modifier down event */ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
360 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
361 key.sym = mapping[i]; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
362 SDL_PrivateKeyboard (SDL_PRESSED, &key); |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
363 /* 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
|
364 if (bit == NSAlphaShiftKeyMask) |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
365 SDL_PrivateKeyboard (SDL_RELEASED, &key); |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
366 } |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
367 } |
934
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
368 } |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
369 |
934
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
370 /* This is a helper function for QZ_HandleModifierSide. This |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
371 * function reverts back to behavior before the distinction between |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
372 * sides was made. |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
373 */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
374 static void QZ_HandleNonDeviceModifier ( _THIS, unsigned int device_independent_mask, unsigned int newMods, unsigned int key_sym) { |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
375 unsigned int currentMask, newMask; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
376 SDL_keysym key; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
377 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
378 key.scancode = 0; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
379 key.sym = key_sym; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
380 key.unicode = 0; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
381 key.mod = KMOD_NONE; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
382 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
383 /* Isolate just the bits we care about in the depedent bits so we can |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
384 * figure out what changed |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
385 */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
386 currentMask = current_mods & device_independent_mask; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
387 newMask = newMods & device_independent_mask; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
388 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
389 if ( currentMask && |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
390 currentMask != newMask ) { /* modifier up event */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
391 SDL_PrivateKeyboard (SDL_RELEASED, &key); |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
392 } |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
393 else if ( newMask && |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
394 currentMask != newMask ) { /* modifier down event */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
395 SDL_PrivateKeyboard (SDL_PRESSED, &key); |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
396 } |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
397 } |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
398 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
399 /* This is a helper function for QZ_HandleModifierSide. |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
400 * This function sets the actual SDL_PrivateKeyboard event. |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
401 */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
402 static void QZ_HandleModifierOneSide ( _THIS, unsigned int newMods, |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
403 unsigned int key_sym, |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
404 unsigned int sided_device_dependent_mask ) { |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
405 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
406 SDL_keysym key; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
407 unsigned int current_dep_mask, new_dep_mask; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
408 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
409 key.scancode = 0; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
410 key.sym = key_sym; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
411 key.unicode = 0; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
412 key.mod = KMOD_NONE; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
413 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
414 /* Isolate just the bits we care about in the depedent bits so we can |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
415 * figure out what changed |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
416 */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
417 current_dep_mask = current_mods & sided_device_dependent_mask; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
418 new_dep_mask = newMods & sided_device_dependent_mask; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
419 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
420 /* We now know that this side bit flipped. But we don't know if |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
421 * it went pressed to released or released to pressed, so we must |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
422 * find out which it is. |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
423 */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
424 if( new_dep_mask && |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
425 current_dep_mask != new_dep_mask ) { |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
426 /* Modifier down event */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
427 SDL_PrivateKeyboard (SDL_PRESSED, &key); |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
428 } |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
429 else /* Modifier up event */ { |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
430 SDL_PrivateKeyboard (SDL_RELEASED, &key); |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
431 } |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
432 } |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
433 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
434 /* This is a helper function for QZ_DoSidedModifiers. |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
435 * This function will figure out if the modifier key is the left or right side, |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
436 * e.g. left-shift vs right-shift. |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
437 */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
438 static void QZ_HandleModifierSide ( _THIS, int device_independent_mask, |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
439 unsigned int newMods, |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
440 unsigned int left_key_sym, |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
441 unsigned int right_key_sym, |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
442 unsigned int left_device_dependent_mask, |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
443 unsigned int right_device_dependent_mask ) { |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
444 unsigned int device_dependent_mask = 0; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
445 unsigned int diff_mod = 0; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
446 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
447 device_dependent_mask = left_device_dependent_mask | right_device_dependent_mask; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
448 /* On the basis that the device independent mask is set, but there are |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
449 * no device dependent flags set, we'll assume that we can't detect this |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
450 * keyboard and revert to the unsided behavior. |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
451 */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
452 if ( (device_dependent_mask & newMods) == 0 ) { |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
453 /* Revert to the old behavior */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
454 QZ_HandleNonDeviceModifier ( this, device_independent_mask, newMods, left_key_sym ); |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
455 return; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
456 } |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
457 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
458 /* XOR the previous state against the new state to see if there's a change */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
459 diff_mod = (device_dependent_mask & current_mods) |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
460 ^ (device_dependent_mask & newMods); |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
461 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
462 if ( diff_mod ) { |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
463 /* A change in state was found. Isolate the left and right bits |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
464 * to handle them separately just in case the values can simulataneously |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
465 * change or if the bits don't both exist. |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
466 */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
467 if ( left_device_dependent_mask & diff_mod ) { |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
468 QZ_HandleModifierOneSide ( this, newMods, left_key_sym, left_device_dependent_mask ); |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
469 } |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
470 if ( right_device_dependent_mask & diff_mod ) { |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
471 QZ_HandleModifierOneSide ( this, newMods, right_key_sym, right_device_dependent_mask ); |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
472 } |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
473 } |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
474 } |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
475 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
476 /* This is a helper function for QZ_DoSidedModifiers. |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
477 * This function will release a key press in the case that |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
478 * it is clear that the modifier has been released (i.e. one side |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
479 * can't still be down). |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
480 */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
481 static void QZ_ReleaseModifierSide ( _THIS, |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
482 unsigned int device_independent_mask, |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
483 unsigned int newMods, |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
484 unsigned int left_key_sym, |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
485 unsigned int right_key_sym, |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
486 unsigned int left_device_dependent_mask, |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
487 unsigned int right_device_dependent_mask ) { |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
488 unsigned int device_dependent_mask = 0; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
489 SDL_keysym key; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
490 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
491 key.scancode = 0; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
492 key.sym = SDLK_UNKNOWN; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
493 key.unicode = 0; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
494 key.mod = KMOD_NONE; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
495 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
496 device_dependent_mask = left_device_dependent_mask | right_device_dependent_mask; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
497 /* On the basis that the device independent mask is set, but there are |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
498 * no device dependent flags set, we'll assume that we can't detect this |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
499 * keyboard and revert to the unsided behavior. |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
500 */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
501 if ( (device_dependent_mask & current_mods) == 0 ) { |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
502 /* In this case, we can't detect the keyboard, so use the left side |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
503 * to represent both, and release it. |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
504 */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
505 key.sym = left_key_sym; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
506 SDL_PrivateKeyboard (SDL_RELEASED, &key); |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
507 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
508 return; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
509 } |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
510 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
511 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
512 /* |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
513 * This could have been done in an if-else case because at this point, |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
514 * we know that all keys have been released when calling this function. |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
515 * But I'm being paranoid so I want to handle each separately, |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
516 * so I hope this doesn't cause other problems. |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
517 */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
518 if ( left_device_dependent_mask & current_mods ) { |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
519 key.sym = left_key_sym; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
520 SDL_PrivateKeyboard (SDL_RELEASED, &key); |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
521 } |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
522 if ( right_device_dependent_mask & current_mods ) { |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
523 key.sym = right_key_sym; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
524 SDL_PrivateKeyboard (SDL_RELEASED, &key); |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
525 } |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
526 } |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
527 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
528 /* This is a helper function for QZ_DoSidedModifiers. |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
529 * This function handles the CapsLock case. |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
530 */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
531 static void QZ_HandleCapsLock (_THIS, unsigned int newMods) { |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
532 unsigned int currentMask, newMask; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
533 SDL_keysym key; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
534 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
535 key.scancode = 0; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
536 key.sym = SDLK_CAPSLOCK; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
537 key.unicode = 0; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
538 key.mod = KMOD_NONE; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
539 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
540 currentMask = current_mods & NSAlphaShiftKeyMask; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
541 newMask = newMods & NSAlphaShiftKeyMask; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
542 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
543 if ( currentMask && |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
544 currentMask != newMask ) { /* modifier up event */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
545 /* If this was Caps Lock, we need some additional voodoo to make SDL happy */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
546 SDL_PrivateKeyboard (SDL_PRESSED, &key); |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
547 SDL_PrivateKeyboard (SDL_RELEASED, &key); |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
548 } |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
549 else if ( newMask && |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
550 currentMask != newMask ) { /* modifier down event */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
551 /* If this was Caps Lock, we need some additional voodoo to make SDL happy */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
552 SDL_PrivateKeyboard (SDL_PRESSED, &key); |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
553 SDL_PrivateKeyboard (SDL_RELEASED, &key); |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
554 } |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
555 } |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
556 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
557 /* This function will handle the modifier keys and also determine the |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
558 * correct side of the key. |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
559 */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
560 static void QZ_DoSidedModifiers (_THIS, unsigned int newMods) { |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
561 /* Set up arrays for the key syms for the left and right side. */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
562 const unsigned int left_mapping[] = { SDLK_LSHIFT, SDLK_LCTRL, SDLK_LALT, SDLK_LMETA }; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
563 const unsigned int right_mapping[] = { SDLK_RSHIFT, SDLK_RCTRL, SDLK_RALT, SDLK_RMETA }; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
564 /* Set up arrays for the device dependent masks with indices that |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
565 * correspond to the _mapping arrays |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
566 */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
567 const unsigned int left_device_mapping[] = { NX_DEVICELSHIFTKEYMASK, NX_DEVICELCTLKEYMASK, NX_DEVICELALTKEYMASK, NX_DEVICELCMDKEYMASK }; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
568 const unsigned int right_device_mapping[] = { NX_DEVICERSHIFTKEYMASK, NX_DEVICERCTLKEYMASK, NX_DEVICERALTKEYMASK, NX_DEVICERCMDKEYMASK }; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
569 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
570 unsigned int i; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
571 unsigned int bit; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
572 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
573 /* Handle CAPSLOCK separately because it doesn't have a left/right side */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
574 QZ_HandleCapsLock ( this, newMods ); |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
575 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
576 /* Iterate through the bits, testing each against the current modifiers */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
577 for (i = 0, bit = NSShiftKeyMask; bit <= NSCommandKeyMask; bit <<= 1, ++i) { |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
578 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
579 unsigned int currentMask, newMask; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
580 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
581 currentMask = current_mods & bit; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
582 newMask = newMods & bit; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
583 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
584 /* If the bit is set, we must always examine it because the left |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
585 * and right side keys may alternate or both may be pressed. |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
586 */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
587 if ( newMask ) { |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
588 QZ_HandleModifierSide ( this, bit, newMods, |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
589 left_mapping[i], |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
590 right_mapping[i], |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
591 left_device_mapping[i], |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
592 right_device_mapping[i] ); |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
593 } |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
594 /* If the state changed from pressed to unpressed, we must examine |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
595 * the device dependent bits to release the correct keys. |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
596 */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
597 else if ( currentMask && |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
598 currentMask != newMask ) { /* modifier up event */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
599 QZ_ReleaseModifierSide ( this, bit, newMods, |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
600 left_mapping[i], |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
601 right_mapping[i], |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
602 left_device_mapping[i], |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
603 right_device_mapping[i] ); |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
604 } |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
605 } |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
606 } |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
607 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
608 /* This function is called to handle the modifiers. |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
609 * It will try to distinguish between the left side and right side |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
610 * of the keyboard for those modifiers that qualify if the |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
611 * operating system version supports it. Otherwise, the code |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
612 * will not try to make the distinction. |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
613 */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
614 static void QZ_DoModifiers (_THIS, unsigned int newMods) { |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
615 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
616 if (current_mods == newMods) |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
617 return; |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
618 |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
619 /* |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
620 * Starting with Panther (10.3.0), the ability to distinguish between |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
621 * left side and right side modifiers is available. |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
622 */ |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
623 if( system_version >= 0x1030 ) { |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
624 QZ_DoSidedModifiers (this, newMods); |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
625 } |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
626 else { |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
627 QZ_DoUnsidedModifiers (this, newMods); |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
628 } |
af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
898
diff
changeset
|
629 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
630 current_mods = newMods; |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
631 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
632 |
782
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
633 static void QZ_GetMouseLocation (_THIS, NSPoint *p) { |
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
634 *p = [ NSEvent mouseLocation ]; /* global coordinates */ |
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
635 if (qz_window) |
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
636 QZ_PrivateGlobalToLocal (this, p); |
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
637 QZ_PrivateCocoaToSDL (this, p); |
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
638 } |
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
639 |
1629 | 640 void QZ_DoActivate (_THIS) { |
641 | |
4070
b8f2db95145e
Patch from Christian Walther
Sam Lantinga <slouken@libsdl.org>
parents:
4066
diff
changeset
|
642 SDL_PrivateAppActive (1, SDL_APPINPUTFOCUS | (QZ_IsMouseInWindow (this) ? SDL_APPMOUSEFOCUS : 0)); |
4066
58a5055da431
More improvements for bug #373
Sam Lantinga <slouken@libsdl.org>
parents:
4049
diff
changeset
|
643 |
4070
b8f2db95145e
Patch from Christian Walther
Sam Lantinga <slouken@libsdl.org>
parents:
4066
diff
changeset
|
644 QZ_UpdateCursor(this); |
172
37e3ca9254c7
Date: Sat, 8 Sep 2001 04:42:23 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
645 |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
646 /* 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
|
647 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
|
648 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
649 /* 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
|
650 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
|
651 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
|
652 } |
1560
34b9e479047e
Keep mouse cursor state sane on focus change in Quartz driver.
Ryan C. Gordon <icculus@icculus.org>
parents:
1487
diff
changeset
|
653 else { |
34b9e479047e
Keep mouse cursor state sane on focus change in Quartz driver.
Ryan C. Gordon <icculus@icculus.org>
parents:
1487
diff
changeset
|
654 /* Update SDL's mouse location */ |
34b9e479047e
Keep mouse cursor state sane on focus change in Quartz driver.
Ryan C. Gordon <icculus@icculus.org>
parents:
1487
diff
changeset
|
655 NSPoint p; |
34b9e479047e
Keep mouse cursor state sane on focus change in Quartz driver.
Ryan C. Gordon <icculus@icculus.org>
parents:
1487
diff
changeset
|
656 QZ_GetMouseLocation (this, &p); |
34b9e479047e
Keep mouse cursor state sane on focus change in Quartz driver.
Ryan C. Gordon <icculus@icculus.org>
parents:
1487
diff
changeset
|
657 SDL_PrivateMouseMotion (0, 0, p.x, p.y); |
34b9e479047e
Keep mouse cursor state sane on focus change in Quartz driver.
Ryan C. Gordon <icculus@icculus.org>
parents:
1487
diff
changeset
|
658 } |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
659 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
660 |
1629 | 661 void QZ_DoDeactivate (_THIS) { |
662 | |
663 SDL_PrivateAppActive (0, SDL_APPINPUTFOCUS | SDL_APPMOUSEFOCUS); | |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
664 |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
665 /* Get the current cursor location, for restore on activate */ |
782
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
666 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
|
667 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
668 /* Reassociate mouse and cursor */ |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
669 CGAssociateMouseAndMouseCursorPosition (1); |
172
37e3ca9254c7
Date: Sat, 8 Sep 2001 04:42:23 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
670 |
4070
b8f2db95145e
Patch from Christian Walther
Sam Lantinga <slouken@libsdl.org>
parents:
4066
diff
changeset
|
671 QZ_UpdateCursor(this); |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
672 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
673 |
555 | 674 void QZ_SleepNotificationHandler (void * refcon, |
675 io_service_t service, | |
676 natural_t messageType, | |
677 void * messageArgument ) | |
678 { | |
679 SDL_VideoDevice *this = (SDL_VideoDevice*)refcon; | |
680 | |
681 switch(messageType) | |
682 { | |
683 case kIOMessageSystemWillSleep: | |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
684 IOAllowPowerChange(power_connection, (long) messageArgument); |
555 | 685 break; |
686 case kIOMessageCanSystemSleep: | |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
687 IOAllowPowerChange(power_connection, (long) messageArgument); |
555 | 688 break; |
689 case kIOMessageSystemHasPoweredOn: | |
761
c5b2b6d2d1fe
Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
683
diff
changeset
|
690 /* awake */ |
555 | 691 SDL_PrivateExpose(); |
692 break; | |
693 } | |
694 } | |
695 | |
761
c5b2b6d2d1fe
Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
683
diff
changeset
|
696 void QZ_RegisterForSleepNotifications (_THIS) |
555 | 697 { |
698 CFRunLoopSourceRef rls; | |
699 IONotificationPortRef thePortRef; | |
700 io_object_t notifier; | |
701 | |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
702 power_connection = IORegisterForSystemPower (this, &thePortRef, QZ_SleepNotificationHandler, ¬ifier); |
555 | 703 |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
704 if (power_connection == 0) |
555 | 705 NSLog(@"SDL: QZ_SleepNotificationHandler() IORegisterForSystemPower failed."); |
706 | |
707 rls = IONotificationPortGetRunLoopSource (thePortRef); | |
708 CFRunLoopAddSource (CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode); | |
709 CFRelease (rls); | |
710 } | |
711 | |
624
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
712 |
1487
dc6b59e925a2
Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
1403
diff
changeset
|
713 /* Try to map Quartz mouse buttons to SDL's lingo... */ |
624
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
714 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
|
715 { |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
716 switch (button) |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
717 { |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
718 case 0: |
1487
dc6b59e925a2
Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
1403
diff
changeset
|
719 return(SDL_BUTTON_LEFT); /* 1 */ |
624
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
720 case 1: |
1487
dc6b59e925a2
Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
1403
diff
changeset
|
721 return(SDL_BUTTON_RIGHT); /* 3 */ |
624
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
722 case 2: |
1487
dc6b59e925a2
Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
1403
diff
changeset
|
723 return(SDL_BUTTON_MIDDLE); /* 2 */ |
624
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
724 } |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
725 |
1487
dc6b59e925a2
Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
1403
diff
changeset
|
726 /* >= 3: skip 4 & 5, since those are the SDL mousewheel buttons. */ |
624
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
727 return(button + 3); |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
728 } |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
729 |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
730 |
761
c5b2b6d2d1fe
Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
683
diff
changeset
|
731 void QZ_PumpEvents (_THIS) |
158
4382c38dfbee
Date: Tue, 21 Aug 2001 03:50:01 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
155
diff
changeset
|
732 { |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
733 CGMouseDelta dx, dy; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
734 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
735 NSDate *distantPast; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
736 NSEvent *event; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
737 NSRect winRect; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
738 NSAutoreleasePool *pool; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
739 |
1213
8eb191652834
Quartz target shouldn't crash if an event thread is used.
Ryan C. Gordon <icculus@icculus.org>
parents:
1212
diff
changeset
|
740 if (!SDL_VideoSurface) |
8eb191652834
Quartz target shouldn't crash if an event thread is used.
Ryan C. Gordon <icculus@icculus.org>
parents:
1212
diff
changeset
|
741 return; /* don't do anything if there's no screen surface. */ |
8eb191652834
Quartz target shouldn't crash if an event thread is used.
Ryan C. Gordon <icculus@icculus.org>
parents:
1212
diff
changeset
|
742 |
619
bf816ce70144
Disable MacOS X screensaver for duration of application run by triggering a
Ryan C. Gordon <icculus@icculus.org>
parents:
615
diff
changeset
|
743 /* Update activity every five seconds to prevent screensaver. --ryan. */ |
3936
c5c3c772f5aa
Let app set SDL_VIDEO_ALLOW_SCREENSAVER environment variable to override SDL's
Ryan C. Gordon <icculus@icculus.org>
parents:
3922
diff
changeset
|
744 if (!allow_screensaver) { |
4139
568c9b3c0167
* Added configure option --enable-screensaver, to allow enabling the screensaver by default.
Sam Lantinga <slouken@libsdl.org>
parents:
4130
diff
changeset
|
745 static Uint32 screensaverTicks; |
568c9b3c0167
* Added configure option --enable-screensaver, to allow enabling the screensaver by default.
Sam Lantinga <slouken@libsdl.org>
parents:
4130
diff
changeset
|
746 Uint32 nowTicks = SDL_GetTicks(); |
3936
c5c3c772f5aa
Let app set SDL_VIDEO_ALLOW_SCREENSAVER environment variable to override SDL's
Ryan C. Gordon <icculus@icculus.org>
parents:
3922
diff
changeset
|
747 if ((nowTicks - screensaverTicks) > 5000) |
c5c3c772f5aa
Let app set SDL_VIDEO_ALLOW_SCREENSAVER environment variable to override SDL's
Ryan C. Gordon <icculus@icculus.org>
parents:
3922
diff
changeset
|
748 { |
c5c3c772f5aa
Let app set SDL_VIDEO_ALLOW_SCREENSAVER environment variable to override SDL's
Ryan C. Gordon <icculus@icculus.org>
parents:
3922
diff
changeset
|
749 UpdateSystemActivity(UsrActivity); |
c5c3c772f5aa
Let app set SDL_VIDEO_ALLOW_SCREENSAVER environment variable to override SDL's
Ryan C. Gordon <icculus@icculus.org>
parents:
3922
diff
changeset
|
750 screensaverTicks = nowTicks; |
c5c3c772f5aa
Let app set SDL_VIDEO_ALLOW_SCREENSAVER environment variable to override SDL's
Ryan C. Gordon <icculus@icculus.org>
parents:
3922
diff
changeset
|
751 } |
619
bf816ce70144
Disable MacOS X screensaver for duration of application run by triggering a
Ryan C. Gordon <icculus@icculus.org>
parents:
615
diff
changeset
|
752 } |
bf816ce70144
Disable MacOS X screensaver for duration of application run by triggering a
Ryan C. Gordon <icculus@icculus.org>
parents:
615
diff
changeset
|
753 |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
754 pool = [ [ NSAutoreleasePool alloc ] init ]; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
755 distantPast = [ NSDate distantPast ]; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
756 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
757 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
|
758 |
3952
e3c28caea46d
Better handling of multiple queued Cocoa mouse events. Thanks to Christian
Ryan C. Gordon <icculus@icculus.org>
parents:
3936
diff
changeset
|
759 /* while grabbed, accumulate all 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
|
760 dx = 0; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
761 dy = 0; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
762 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
763 do { |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
764 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
765 /* 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
|
766 event = [ NSApp nextEventMatchingMask:NSAnyEventMask |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
767 untilDate:distantPast |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
768 inMode: NSDefaultRunLoopMode dequeue:YES ]; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
769 if (event != nil) { |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
770 |
624
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
771 int button; |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
772 unsigned int type; |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
773 BOOL isInGameWin; |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
774 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
775 #define DO_MOUSE_DOWN(button) do { \ |
1629 | 776 if ( SDL_GetAppState() & SDL_APPMOUSEFOCUS ) { \ |
777 SDL_PrivateMouseButton (SDL_PRESSED, button, 0, 0); \ | |
778 expect_mouse_up |= 1<<button; \ | |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
779 } \ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
780 [ NSApp sendEvent:event ]; \ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
781 } while(0) |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
782 |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
783 #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
|
784 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
|
785 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
|
786 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
|
787 } \ |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
788 [ NSApp sendEvent:event ]; \ |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
789 } while(0) |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
790 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
791 type = [ event type ]; |
779
68c8da837fc0
Date: Tue, 6 Jan 2004 21:54:02 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
761
diff
changeset
|
792 isInGameWin = QZ_IsMouseInWindow (this); |
782
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
793 |
816
428f688f2ad2
Date: Fri, 13 Feb 2004 17:03:16 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
782
diff
changeset
|
794 QZ_DoModifiers(this, [ event modifierFlags ] ); |
428f688f2ad2
Date: Fri, 13 Feb 2004 17:03:16 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
782
diff
changeset
|
795 |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
796 switch (type) { |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
797 case NSLeftMouseDown: |
1338
604d73db6802
Removed uses of stdlib.h and string.h
Sam Lantinga <slouken@libsdl.org>
parents:
1213
diff
changeset
|
798 if ( SDL_getenv("SDL_HAS3BUTTONMOUSE") ) { |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
799 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
|
800 } else { |
4230
2bb68bacdc54
Max correctly pointed out that this will cause unexpected change in application
Sam Lantinga <slouken@libsdl.org>
parents:
4225
diff
changeset
|
801 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
|
802 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
|
803 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
|
804 } |
79c189f5bd76
Added an environment variable SDL_HAS3BUTTONMOUSE for Quartz
Sam Lantinga <slouken@libsdl.org>
parents:
502
diff
changeset
|
805 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
|
806 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
|
807 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
|
808 } |
79c189f5bd76
Added an environment variable SDL_HAS3BUTTONMOUSE for Quartz
Sam Lantinga <slouken@libsdl.org>
parents:
502
diff
changeset
|
809 else { |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
810 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
|
811 } |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
812 } |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
813 break; |
624
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
814 |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
815 case NSLeftMouseUp: |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
816 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
|
817 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
|
818 last_virtual_button = 0; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
819 } |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
820 else { |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
821 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
|
822 } |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
823 break; |
624
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
824 |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
825 case NSOtherMouseDown: |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
826 case NSRightMouseDown: |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
827 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
|
828 DO_MOUSE_DOWN (button); |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
829 break; |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
830 |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
831 case NSOtherMouseUp: |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
832 case NSRightMouseUp: |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
833 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
|
834 DO_MOUSE_UP (button); |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
835 break; |
fb78cadbfeb8
More-than-three mouse button support for Quartz target.
Ryan C. Gordon <icculus@icculus.org>
parents:
619
diff
changeset
|
836 |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
837 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
|
838 /* |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
839 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
|
840 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
|
841 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
|
842 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
|
843 */ |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
844 break; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
845 case NSLeftMouseDragged: |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
846 case NSRightMouseDragged: |
435
140798e1e7a6
Darrell's fix for Quartz mouse motion
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
847 case NSOtherMouseDragged: /* usually middle mouse dragged */ |
898
f221cadd6eda
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
897
diff
changeset
|
848 case NSMouseMoved: |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
849 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
|
850 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
851 /* |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
852 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
|
853 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
|
854 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
|
855 */ |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
856 CGMouseDelta dx1, dy1; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
857 CGGetLastMouseDelta (&dx1, &dy1); |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
858 dx += dx1; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
859 dy += dy1; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
860 } |
3952
e3c28caea46d
Better handling of multiple queued Cocoa mouse events. Thanks to Christian
Ryan C. Gordon <icculus@icculus.org>
parents:
3936
diff
changeset
|
861 else { |
435
140798e1e7a6
Darrell's fix for Quartz mouse motion
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
862 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
863 /* |
3952
e3c28caea46d
Better handling of multiple queued Cocoa mouse events. Thanks to Christian
Ryan C. Gordon <icculus@icculus.org>
parents:
3936
diff
changeset
|
864 Get the absolute mouse location. This is not the |
e3c28caea46d
Better handling of multiple queued Cocoa mouse events. Thanks to Christian
Ryan C. Gordon <icculus@icculus.org>
parents:
3936
diff
changeset
|
865 mouse location after the currently processed event, |
e3c28caea46d
Better handling of multiple queued Cocoa mouse events. Thanks to Christian
Ryan C. Gordon <icculus@icculus.org>
parents:
3936
diff
changeset
|
866 but the *current* mouse location, i.e. after all |
e3c28caea46d
Better handling of multiple queued Cocoa mouse events. Thanks to Christian
Ryan C. Gordon <icculus@icculus.org>
parents:
3936
diff
changeset
|
867 pending events. This means that if there are |
e3c28caea46d
Better handling of multiple queued Cocoa mouse events. Thanks to Christian
Ryan C. Gordon <icculus@icculus.org>
parents:
3936
diff
changeset
|
868 multiple mouse moved events in the queue, we make |
e3c28caea46d
Better handling of multiple queued Cocoa mouse events. Thanks to Christian
Ryan C. Gordon <icculus@icculus.org>
parents:
3936
diff
changeset
|
869 multiple identical calls to SDL_PrivateMouseMotion(), |
e3c28caea46d
Better handling of multiple queued Cocoa mouse events. Thanks to Christian
Ryan C. Gordon <icculus@icculus.org>
parents:
3936
diff
changeset
|
870 but that's no problem since the latter only |
e3c28caea46d
Better handling of multiple queued Cocoa mouse events. Thanks to Christian
Ryan C. Gordon <icculus@icculus.org>
parents:
3936
diff
changeset
|
871 generates SDL events for nonzero movements. In my |
e3c28caea46d
Better handling of multiple queued Cocoa mouse events. Thanks to Christian
Ryan C. Gordon <icculus@icculus.org>
parents:
3936
diff
changeset
|
872 experience on PBG4/10.4.8, this rarely happens anyway. |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
454
diff
changeset
|
873 */ |
782
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
874 NSPoint p; |
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
875 QZ_GetMouseLocation (this, &p); |
454
c4338ecf45f9
Fixed mouse motion on MacOS X (recently broken)
Sam Lantinga <slouken@libsdl.org>
parents:
435
diff
changeset
|
876 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
|
877 } |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
878 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
879 /* |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
880 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
|
881 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
|
882 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
|
883 */ |
4066
58a5055da431
More improvements for bug #373
Sam Lantinga <slouken@libsdl.org>
parents:
4049
diff
changeset
|
884 if ( grab_state == QZ_VISIBLE_GRAB && !isInGameWin ) { |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
885 |
782
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
886 NSPoint p; |
dbc5905402b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
779
diff
changeset
|
887 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
|
888 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
889 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
|
890 p.x = 0.0; |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
891 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
892 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
|
893 p.y = 0.0; |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
894 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
895 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
|
896 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
|
897 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
898 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
|
899 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
|
900 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
901 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
|
902 } |
631
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
624
diff
changeset
|
903 else |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
624
diff
changeset
|
904 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
|
905 |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
624
diff
changeset
|
906 SDL_PrivateAppActive (0, SDL_APPMOUSEFOCUS); |
4070
b8f2db95145e
Patch from Christian Walther
Sam Lantinga <slouken@libsdl.org>
parents:
4066
diff
changeset
|
907 |
1212 | 908 if (grab_state == QZ_INVISIBLE_GRAB) |
909 /*The cursor has left the window even though it is | |
910 disassociated from the mouse (and therefore | |
911 shouldn't move): this can happen with Wacom | |
912 tablets, and it effectively breaks the grab, since | |
913 mouse down events now go to background | |
914 applications. The only possibility to avoid this | |
915 seems to be talking to the tablet driver | |
916 (AppleEvents) to constrain its mapped area to the | |
917 window, which may not be worth the effort. For | |
918 now, handle the condition more gracefully than | |
919 before by reassociating cursor and mouse until the | |
920 cursor enters the window again, making it obvious | |
921 to the user that the grab is broken.*/ | |
922 CGAssociateMouseAndMouseCursorPosition (1); | |
4066
58a5055da431
More improvements for bug #373
Sam Lantinga <slouken@libsdl.org>
parents:
4049
diff
changeset
|
923 |
4070
b8f2db95145e
Patch from Christian Walther
Sam Lantinga <slouken@libsdl.org>
parents:
4066
diff
changeset
|
924 QZ_UpdateCursor(this); |
631
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
624
diff
changeset
|
925 } |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
624
diff
changeset
|
926 else |
1629 | 927 if ( isInGameWin && (SDL_GetAppState() & (SDL_APPMOUSEFOCUS | SDL_APPINPUTFOCUS)) == SDL_APPINPUTFOCUS ) { |
631
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
624
diff
changeset
|
928 |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
624
diff
changeset
|
929 SDL_PrivateAppActive (1, SDL_APPMOUSEFOCUS); |
4066
58a5055da431
More improvements for bug #373
Sam Lantinga <slouken@libsdl.org>
parents:
4049
diff
changeset
|
930 |
4070
b8f2db95145e
Patch from Christian Walther
Sam Lantinga <slouken@libsdl.org>
parents:
4066
diff
changeset
|
931 QZ_UpdateCursor(this); |
4066
58a5055da431
More improvements for bug #373
Sam Lantinga <slouken@libsdl.org>
parents:
4049
diff
changeset
|
932 |
1212 | 933 if (grab_state == QZ_INVISIBLE_GRAB) { /*see comment above*/ |
934 QZ_PrivateWarpCursor (this, SDL_VideoSurface->w / 2, SDL_VideoSurface->h / 2); | |
935 CGAssociateMouseAndMouseCursorPosition (0); | |
936 } | |
631
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
624
diff
changeset
|
937 } |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
938 break; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
939 case NSScrollWheel: |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
561
diff
changeset
|
940 if ( isInGameWin ) { |
1050
8e1815fd9777
Holding down shift while moving the mouse's scrollwheel on MacOS X makes the
Ryan C. Gordon <icculus@icculus.org>
parents:
934
diff
changeset
|
941 float dy, dx; |
502
80a3d09bab29
Fixed mouse wheel events on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
942 Uint8 button; |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
943 dy = [ event deltaY ]; |
1050
8e1815fd9777
Holding down shift while moving the mouse's scrollwheel on MacOS X makes the
Ryan C. Gordon <icculus@icculus.org>
parents:
934
diff
changeset
|
944 dx = [ event deltaX ]; |
4101
ab38230546a5
Oskar Linde fixed bug #507
Sam Lantinga <slouken@libsdl.org>
parents:
4093
diff
changeset
|
945 if ( dy > 0.0 ) /* Scroll up */ |
4011
f5794774970d
Reverted mousewheel support in 1.2, since it breaks binary compatibility.
Sam Lantinga <slouken@libsdl.org>
parents:
4009
diff
changeset
|
946 button = SDL_BUTTON_WHEELUP; |
4101
ab38230546a5
Oskar Linde fixed bug #507
Sam Lantinga <slouken@libsdl.org>
parents:
4093
diff
changeset
|
947 else if ( dy < 0.0 ) /* Scroll down */ |
4011
f5794774970d
Reverted mousewheel support in 1.2, since it breaks binary compatibility.
Sam Lantinga <slouken@libsdl.org>
parents:
4009
diff
changeset
|
948 button = SDL_BUTTON_WHEELDOWN; |
4101
ab38230546a5
Oskar Linde fixed bug #507
Sam Lantinga <slouken@libsdl.org>
parents:
4093
diff
changeset
|
949 else |
ab38230546a5
Oskar Linde fixed bug #507
Sam Lantinga <slouken@libsdl.org>
parents:
4093
diff
changeset
|
950 break; /* Horizontal scroll */ |
4011
f5794774970d
Reverted mousewheel support in 1.2, since it breaks binary compatibility.
Sam Lantinga <slouken@libsdl.org>
parents:
4009
diff
changeset
|
951 /* For now, wheel is sent as a quick down+up */ |
f5794774970d
Reverted mousewheel support in 1.2, since it breaks binary compatibility.
Sam Lantinga <slouken@libsdl.org>
parents:
4009
diff
changeset
|
952 SDL_PrivateMouseButton (SDL_PRESSED, button, 0, 0); |
f5794774970d
Reverted mousewheel support in 1.2, since it breaks binary compatibility.
Sam Lantinga <slouken@libsdl.org>
parents:
4009
diff
changeset
|
953 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
|
954 } |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
955 break; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
956 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
|
957 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
|
958 break; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
959 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
|
960 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
|
961 break; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
962 case NSFlagsChanged: |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
963 break; |
4072 | 964 case NSAppKitDefined: |
965 [ NSApp sendEvent:event ]; | |
966 if ([ event subtype ] == NSApplicationActivatedEventType && (mode_flags & SDL_FULLSCREEN)) { | |
967 /* the default handling of this event seems to reset any cursor set by [NSCursor set] (used by SDL_SetCursor() in fullscreen mode) to the default system arrow cursor */ | |
968 SDL_Cursor *sdlc = SDL_GetCursor(); | |
969 if (sdlc != NULL && sdlc->wm_cursor != NULL) { | |
970 [ sdlc->wm_cursor->nscursor set ]; | |
971 } | |
972 } | |
973 break; | |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
974 /* case NSApplicationDefined: break; */ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
975 /* case NSPeriodic: break; */ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
976 /* case NSCursorUpdate: break; */ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
977 default: |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
978 [ NSApp sendEvent:event ]; |
272
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
979 } |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
980 } |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
981 } while (event != nil); |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
982 |
435
140798e1e7a6
Darrell's fix for Quartz mouse motion
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
983 /* 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
|
984 if (dx != 0 || dy != 0) |
435
140798e1e7a6
Darrell's fix for Quartz mouse motion
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
985 SDL_PrivateMouseMotion (0, 1, dx, dy); |
898
f221cadd6eda
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
897
diff
changeset
|
986 |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
389
diff
changeset
|
987 [ pool release ]; |
502
80a3d09bab29
Fixed mouse wheel events on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
988 } |
1212 | 989 |
990 void QZ_UpdateMouse (_THIS) | |
991 { | |
992 NSPoint p; | |
993 QZ_GetMouseLocation (this, &p); | |
994 SDL_PrivateAppActive (QZ_IsMouseInWindow (this), SDL_APPMOUSEFOCUS); | |
995 SDL_PrivateMouseMotion (0, 0, p.x, p.y); | |
996 } |