Mercurial > sdl-ios-xcode
annotate src/video/photon/SDL_ph_events.c @ 1312:c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
I batch edited these files, so please let me know if I've accidentally removed anybody's
credit here.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 01 Feb 2006 06:32:25 +0000 |
parents | 4ab6d1fd028f |
children | 19418e4422cb |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
0 | 7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0 | 9 |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
13 Lesser General Public License for more details. |
0 | 14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 18 |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
220
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
22 | |
23 /* Handle the event stream, converting photon events into SDL events */ | |
24 | |
19
8cc4dbfab9ab
Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
25 #define DISABLE_X11 |
8cc4dbfab9ab
Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
26 |
0 | 27 #include <stdio.h> |
28 #include <setjmp.h> | |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
29 #include <sys/time.h> |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
30 |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
31 #include <Ph.h> |
0 | 32 #include <photon/PkKeyDef.h> |
33 | |
34 #include "SDL.h" | |
35 #include "SDL_syswm.h" | |
36 #include "SDL_sysevents.h" | |
37 #include "SDL_sysvideo.h" | |
38 #include "SDL_events_c.h" | |
39 #include "SDL_ph_video.h" | |
40 #include "SDL_ph_modes_c.h" | |
41 #include "SDL_ph_image_c.h" | |
42 #include "SDL_ph_events_c.h" | |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
43 #include "SDL_phyuv_c.h" |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
44 |
0 | 45 /* The translation tables from a photon keysym to a SDL keysym */ |
46 static SDLKey ODD_keymap[256]; | |
47 static SDLKey MISC_keymap[0xFF + 1]; | |
48 SDL_keysym *ph_TranslateKey(PhKeyEvent_t *key, SDL_keysym *keysym); | |
49 | |
50 /* Check to see if this is a repeated key. | |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
51 (idea shamelessly lifted from GII -- thanks guys! :) */ |
283
3d8b6b9f1e18
Date: Mon, 18 Feb 2002 16:46:59 +1200
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
52 static int ph_WarpedMotion(_THIS, PhEvent_t *winEvent) |
3d8b6b9f1e18
Date: Mon, 18 Feb 2002 16:46:59 +1200
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
53 { |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
54 PhRect_t *rect = PhGetRects( winEvent ); |
0 | 55 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
56 int centre_x, centre_y; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
57 int dx, dy; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
58 short abs_x, abs_y; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
59 int posted; |
0 | 60 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
61 centre_x = SDL_VideoSurface->w / 2; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
62 centre_y = SDL_VideoSurface->h / 2; |
283
3d8b6b9f1e18
Date: Mon, 18 Feb 2002 16:46:59 +1200
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
63 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
64 dx = rect->ul.x - centre_x; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
65 dy = rect->ul.y - centre_y; |
0 | 66 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
67 posted = SDL_PrivateMouseMotion( 0, 1, dx, dy ); |
283
3d8b6b9f1e18
Date: Mon, 18 Feb 2002 16:46:59 +1200
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
68 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
69 /* Move mouse cursor to middle of the window */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
70 PtGetAbsPosition( window, &abs_x, &abs_y ); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
71 PhMoveCursorAbs(PhInputGroup(NULL), abs_x + centre_x, abs_y + centre_y); |
283
3d8b6b9f1e18
Date: Mon, 18 Feb 2002 16:46:59 +1200
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
72 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
73 return (posted); |
0 | 74 } |
75 | |
220 | 76 /* Control which motion flags the window has set, a flags value of -1 sets |
77 * MOTION_BUTTON and MOTION_NOBUTTON */ | |
266
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
78 |
220 | 79 static void set_motion_sensitivity(_THIS, unsigned int flags) |
80 { | |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
81 int rid; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
82 int fields = Ph_EV_PTR_MOTION_BUTTON | Ph_EV_PTR_MOTION_NOBUTTON; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
83 PhRegion_t region; |
220 | 84 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
85 if( window ) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
86 { |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
87 rid = PtWidgetRid(window); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
88 if( rid != 0 && PhRegionQuery(rid, ®ion, NULL, NULL, 0) == 0 ) |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
89 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
90 region.events_sense=(region.events_sense & ~fields)|(flags & fields); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
91 PhRegionChange(Ph_REGION_EV_SENSE, 0, ®ion, NULL, NULL); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
92 } |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
93 } |
220 | 94 } |
95 | |
96 /* Convert the photon button state value to an SDL value */ | |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
97 static Uint8 ph2sdl_mousebutton(unsigned short button_state) |
220 | 98 { |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
99 Uint8 mouse_button = 0; |
220 | 100 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
101 if (button_state & Ph_BUTTON_SELECT) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
102 mouse_button |= SDL_BUTTON_LEFT; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
103 if (button_state & Ph_BUTTON_MENU) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
104 mouse_button |= SDL_BUTTON_RIGHT; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
105 if (button_state & Ph_BUTTON_ADJUST) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
106 mouse_button |= SDL_BUTTON_MIDDLE; |
220 | 107 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
108 return (mouse_button); |
220 | 109 } |
110 | |
0 | 111 static int ph_DispatchEvent(_THIS) |
112 { | |
320
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
113 int posted; |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
114 PhRect_t* rect; |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
115 PhPointerEvent_t* pointerEvent; |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
116 PhKeyEvent_t* keyEvent; |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
117 PhWindowEvent_t* winEvent; |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
118 int i, buttons; |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
119 SDL_Rect sdlrects[PH_SDL_MAX_RECTS]; |
0 | 120 |
320
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
121 posted = 0; |
0 | 122 |
320
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
123 switch (event->type) |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
124 { |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
125 case Ph_EV_BOUNDARY: |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
126 { |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
127 if (event->subtype == Ph_EV_PTR_ENTER) |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
128 { |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
129 posted = SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS); |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
130 } |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
131 else if (event->subtype ==Ph_EV_PTR_LEAVE) |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
132 { |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
133 posted = SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS); |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
134 } |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
135 } |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
136 break; |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
137 |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
138 case Ph_EV_PTR_MOTION_BUTTON: |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
139 case Ph_EV_PTR_MOTION_NOBUTTON: |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
140 { |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
141 if (SDL_VideoSurface) |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
142 { |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
143 pointerEvent = PhGetData(event); |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
144 rect = PhGetRects(event); |
0 | 145 |
320
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
146 if (mouse_relative) |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
147 { |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
148 posted = ph_WarpedMotion(this, event); |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
149 } |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
150 else |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
151 { |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
152 posted = SDL_PrivateMouseMotion(0, 0, rect->ul.x, rect->ul.y); |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
153 } |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
154 } |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
155 } |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
156 break; |
0 | 157 |
320
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
158 case Ph_EV_BUT_PRESS: |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
159 { |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
160 pointerEvent = PhGetData( event ); |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
161 buttons = ph2sdl_mousebutton( pointerEvent->buttons ); |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
162 if (buttons != 0) |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
163 { |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
164 posted = SDL_PrivateMouseButton(SDL_PRESSED, buttons, 0, 0); |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
165 } |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
166 } |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
167 break; |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
168 |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
169 case Ph_EV_BUT_RELEASE: |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
170 { |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
171 pointerEvent = PhGetData(event); |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
172 buttons = ph2sdl_mousebutton(pointerEvent->buttons); |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
173 if (event->subtype == Ph_EV_RELEASE_REAL && buttons != 0) |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
174 { |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
175 posted = SDL_PrivateMouseButton(SDL_RELEASED, buttons, 0, 0); |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
176 } |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
177 else if(event->subtype == Ph_EV_RELEASE_PHANTOM) |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
178 { |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
179 /* If the mouse is outside the window, |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
180 * only a phantom release event is sent, so |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
181 * check if the window doesn't have mouse focus. |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
182 * Not perfect, maybe checking the mouse button |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
183 * state for Ph_EV_BOUNDARY events would be |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
184 * better. */ |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
185 if ((SDL_GetAppState() & SDL_APPMOUSEFOCUS) == 0) |
0 | 186 { |
320
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
187 posted = SDL_PrivateMouseButton(SDL_RELEASED, buttons, 0, 0); |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
188 } |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
189 } |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
190 } |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
191 break; |
0 | 192 |
320
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
193 case Ph_EV_WM: |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
194 { |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
195 winEvent = PhGetData(event); |
0 | 196 |
320
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
197 /* losing focus */ |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
198 if ((winEvent->event_f==Ph_WM_FOCUS) && (winEvent->event_state==Ph_WM_EVSTATE_FOCUSLOST)) |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
199 { |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
200 set_motion_sensitivity(this, Ph_EV_PTR_MOTION_BUTTON); |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
201 posted = SDL_PrivateAppActive(0, SDL_APPINPUTFOCUS); |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
202 } |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
203 /* gaining focus */ |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
204 else if ((winEvent->event_f==Ph_WM_FOCUS) && (winEvent->event_state==Ph_WM_EVSTATE_FOCUS)) |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
205 { |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
206 set_motion_sensitivity(this, -1); |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
207 posted = SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS); |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
208 } |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
209 /* request quit */ |
320
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
210 else if (winEvent->event_f==Ph_WM_CLOSE) |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
211 { |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
212 posted = SDL_PrivateQuit(); |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
213 } |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
214 /* request hide/unhide */ |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
215 else if (winEvent->event_f==Ph_WM_HIDE) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
216 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
217 if (currently_hided) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
218 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
219 /* got unhide window event */ |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
220 /* TODO: restore application's palette if in palette mode */ |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
221 currently_hided=0; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
222 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
223 else |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
224 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
225 /* got hide window event */ |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
226 /* TODO: restore original palette if in palette mode */ |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
227 currently_hided=1; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
228 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
229 } |
320
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
230 /* request to resize */ |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
231 else if (winEvent->event_f==Ph_WM_RESIZE) |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
232 { |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
233 currently_maximized=0; |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
234 #if (_NTO_VERSION < 630) |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
235 SDL_PrivateResize(winEvent->size.w+1, winEvent->size.h+1); |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
236 #else |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
237 /* QNX 6.3.0 have this bug fixed */ |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
238 SDL_PrivateResize(winEvent->size.w, winEvent->size.h); |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
239 #endif /* _NTO_VERSION */ |
320
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
240 } |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
241 /* request to move */ |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
242 else if (winEvent->event_f==Ph_WM_MOVE) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
243 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
244 if (current_overlay!=NULL) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
245 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
246 int lockedstate=current_overlay->hwdata->locked; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
247 int chromastate=current_overlay->hwdata->ischromakey; |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
248 int error; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
249 SDL_Rect target; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
250 |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
251 current_overlay->hwdata->locked=1; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
252 target.x=current_overlay->hwdata->CurrentViewPort.pos.x; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
253 target.y=current_overlay->hwdata->CurrentViewPort.pos.y; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
254 target.w=current_overlay->hwdata->CurrentViewPort.size.w; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
255 target.h=current_overlay->hwdata->CurrentViewPort.size.h; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
256 current_overlay->hwdata->ischromakey=0; |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
257 error=ph_DisplayYUVOverlay(this, current_overlay, &target); |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
258 if (!error) |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
259 { |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
260 current_overlay->hwdata->ischromakey=chromastate; |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
261 current_overlay->hwdata->locked=lockedstate; |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
262 } |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
263 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
264 } |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
265 /* maximize request */ |
320
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
266 else if (winEvent->event_f==Ph_WM_MAX) |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
267 { |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
268 /* window already moved and resized here */ |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
269 currently_maximized=1; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
270 } |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
271 /* restore request */ |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
272 else if (winEvent->event_f==Ph_WM_RESTORE) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
273 { |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
274 /* window already moved and resized here */ |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
275 currently_maximized=0; |
320
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
276 } |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
277 } |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
278 break; |
0 | 279 |
320
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
280 /* window has been resized, moved or removed */ |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
281 case Ph_EV_EXPOSE: |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
282 { |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
283 if (event->num_rects!=0) |
320
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
284 { |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
285 int numrects; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
286 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
287 if (SDL_VideoSurface) |
320
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
288 { |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
289 rect = PhGetRects(event); |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
290 if (event->num_rects>PH_SDL_MAX_RECTS) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
291 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
292 /* sorry, buffers underrun, we'll update only first PH_SDL_MAX_RECTS rects */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
293 numrects=PH_SDL_MAX_RECTS; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
294 } |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
295 |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
296 for(i=0; i<event->num_rects; i++) |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
297 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
298 sdlrects[i].x = rect[i].ul.x; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
299 sdlrects[i].y = rect[i].ul.y; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
300 sdlrects[i].w = rect[i].lr.x - rect[i].ul.x + 1; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
301 sdlrects[i].h = rect[i].lr.y - rect[i].ul.y + 1; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
302 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
303 |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
304 this->UpdateRects(this, event->num_rects, sdlrects); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
305 |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
306 if (current_overlay!=NULL) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
307 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
308 int lockedstate=current_overlay->hwdata->locked; |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
309 int error; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
310 SDL_Rect target; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
311 |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
312 current_overlay->hwdata->locked=1; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
313 target.x=current_overlay->hwdata->CurrentViewPort.pos.x; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
314 target.y=current_overlay->hwdata->CurrentViewPort.pos.y; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
315 target.w=current_overlay->hwdata->CurrentViewPort.size.w; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
316 target.h=current_overlay->hwdata->CurrentViewPort.size.h; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
317 current_overlay->hwdata->forcedredraw=1; |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
318 error=ph_DisplayYUVOverlay(this, current_overlay, &target); |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
319 if (!error) |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
320 { |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
321 current_overlay->hwdata->forcedredraw=0; |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
322 current_overlay->hwdata->locked=lockedstate; |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
323 } |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
324 } |
320
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
325 } |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
326 } |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
327 } |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
328 break; |
0 | 329 |
320
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
330 case Ph_EV_KEY: |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
331 { |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
332 SDL_keysym keysym; |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
333 |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
334 posted = 0; |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
335 |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
336 keyEvent = PhGetData( event ); |
0 | 337 |
320
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
338 if (Pk_KF_Key_Down & keyEvent->key_flags) |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
339 { |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
340 /* split the wheel events from real key events */ |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
341 if ((keyEvent->key_cap==Pk_Up) && (keyEvent->key_scan==0) && ((keyEvent->key_flags & Pk_KF_Scan_Valid)==Pk_KF_Scan_Valid)) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
342 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
343 posted = SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_WHEELUP, 0, 0); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
344 break; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
345 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
346 if ((keyEvent->key_cap==Pk_Down) && (keyEvent->key_scan==0) && ((keyEvent->key_flags & Pk_KF_Scan_Valid)==Pk_KF_Scan_Valid)) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
347 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
348 posted = SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_WHEELDOWN, 0, 0); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
349 break; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
350 } |
320
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
351 posted = SDL_PrivateKeyboard(SDL_PRESSED, ph_TranslateKey(keyEvent, &keysym)); |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
352 } |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
353 else /* must be key release */ |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
354 { |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
355 /* split the wheel events from real key events */ |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
356 if ((keyEvent->key_cap==Pk_Up) && (keyEvent->key_scan==0) && ((keyEvent->key_flags & Pk_KF_Scan_Valid)==Pk_KF_Scan_Valid)) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
357 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
358 posted = SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELUP, 0, 0); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
359 break; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
360 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
361 if ((keyEvent->key_cap==Pk_Down) && (keyEvent->key_scan==0) && ((keyEvent->key_flags & Pk_KF_Scan_Valid)==Pk_KF_Scan_Valid)) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
362 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
363 posted = SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELDOWN, 0, 0); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
364 break; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
365 } |
320
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
366 posted = SDL_PrivateKeyboard(SDL_RELEASED, ph_TranslateKey( keyEvent, &keysym)); |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
367 } |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
368 } |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
369 break; |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
370 |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
371 case Ph_EV_INFO: |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
372 { |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
373 if (event->subtype==Ph_OFFSCREEN_INVALID) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
374 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
375 unsigned long* EvInfoData; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
376 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
377 EvInfoData=(unsigned long*)PhGetData(event); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
378 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
379 switch (*EvInfoData) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
380 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
381 case Pg_VIDEO_MODE_SWITCHED: |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
382 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
383 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
384 break; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
385 case Pg_ENTERED_DIRECT: |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
386 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
387 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
388 break; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
389 case Pg_EXITED_DIRECT: |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
390 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
391 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
392 break; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
393 case Pg_DRIVER_STARTED: |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
394 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
395 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
396 break; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
397 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
398 } |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
399 } |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
400 break; |
320
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
401 } |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
402 |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
403 return(posted); |
0 | 404 } |
405 | |
406 /* perform a blocking read if no events available */ | |
407 int ph_Pending(_THIS) | |
408 { | |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
409 /* Flush the display connection and look to see if events are queued */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
410 PgFlush(); |
0 | 411 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
412 while (1) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
413 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
414 switch(PhEventPeek(event, EVENT_SIZE)) |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
415 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
416 case Ph_EVENT_MSG: |
0 | 417 return 1; |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
418 case -1: |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
419 SDL_SetError("ph_Pending(): PhEventNext failed.\n"); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
420 return 0; |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
421 default: |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
422 return 0; |
0 | 423 } |
424 } | |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
425 |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
426 /* Oh well, nothing is ready .. */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
427 return(0); |
0 | 428 } |
429 | |
430 void ph_PumpEvents(_THIS) | |
431 { | |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
432 /* Flush the display connection and look to see if events are queued */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
433 PgFlush(); |
0 | 434 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
435 while (ph_Pending(this)) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
436 { |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
437 PtEventHandler(event); |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
438 ph_DispatchEvent(this); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
439 } |
0 | 440 } |
441 | |
442 void ph_InitKeymap(void) | |
443 { | |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
444 int i; |
0 | 445 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
446 /* Odd keys used in international keyboards */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
447 for (i=0; i<SDL_TABLESIZE(ODD_keymap); ++i) |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
448 { |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
449 ODD_keymap[i] = SDLK_UNKNOWN; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
450 } |
0 | 451 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
452 /* Map the miscellaneous keys */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
453 for (i=0; i<SDL_TABLESIZE(MISC_keymap); ++i) |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
454 { |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
455 MISC_keymap[i] = SDLK_UNKNOWN; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
456 } |
0 | 457 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
458 MISC_keymap[Pk_BackSpace&0xFF] = SDLK_BACKSPACE; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
459 MISC_keymap[Pk_Tab&0xFF] = SDLK_TAB; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
460 MISC_keymap[Pk_Clear&0xFF] = SDLK_CLEAR; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
461 MISC_keymap[Pk_Return&0xFF] = SDLK_RETURN; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
462 MISC_keymap[Pk_Pause&0xFF] = SDLK_PAUSE; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
463 MISC_keymap[Pk_Escape&0xFF] = SDLK_ESCAPE; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
464 MISC_keymap[Pk_Delete&0xFF] = SDLK_DELETE; |
0 | 465 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
466 MISC_keymap[Pk_KP_0&0xFF] = SDLK_KP0; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
467 MISC_keymap[Pk_KP_1&0xFF] = SDLK_KP1; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
468 MISC_keymap[Pk_KP_2&0xFF] = SDLK_KP2; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
469 MISC_keymap[Pk_KP_3&0xFF] = SDLK_KP3; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
470 MISC_keymap[Pk_KP_4&0xFF] = SDLK_KP4; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
471 MISC_keymap[Pk_KP_5&0xFF] = SDLK_KP5; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
472 MISC_keymap[Pk_KP_6&0xFF] = SDLK_KP6; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
473 MISC_keymap[Pk_KP_7&0xFF] = SDLK_KP7; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
474 MISC_keymap[Pk_KP_8&0xFF] = SDLK_KP8; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
475 MISC_keymap[Pk_KP_9&0xFF] = SDLK_KP9; |
0 | 476 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
477 MISC_keymap[Pk_KP_Decimal&0xFF] = SDLK_KP_PERIOD; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
478 MISC_keymap[Pk_KP_Divide&0xFF] = SDLK_KP_DIVIDE; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
479 MISC_keymap[Pk_KP_Multiply&0xFF] = SDLK_KP_MULTIPLY; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
480 MISC_keymap[Pk_KP_Subtract&0xFF] = SDLK_KP_MINUS; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
481 MISC_keymap[Pk_KP_Add&0xFF] = SDLK_KP_PLUS; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
482 MISC_keymap[Pk_KP_Enter&0xFF] = SDLK_KP_ENTER; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
483 MISC_keymap[Pk_KP_Equal&0xFF] = SDLK_KP_EQUALS; |
0 | 484 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
485 MISC_keymap[Pk_Up&0xFF] = SDLK_UP; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
486 MISC_keymap[Pk_Down&0xFF] = SDLK_DOWN; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
487 MISC_keymap[Pk_Right&0xFF] = SDLK_RIGHT; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
488 MISC_keymap[Pk_Left&0xFF] = SDLK_LEFT; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
489 MISC_keymap[Pk_Insert&0xFF] = SDLK_INSERT; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
490 MISC_keymap[Pk_Home&0xFF] = SDLK_HOME; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
491 MISC_keymap[Pk_End&0xFF] = SDLK_END; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
492 MISC_keymap[Pk_Pg_Up&0xFF] = SDLK_PAGEUP; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
493 MISC_keymap[Pk_Pg_Down&0xFF] = SDLK_PAGEDOWN; |
0 | 494 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
495 MISC_keymap[Pk_F1&0xFF] = SDLK_F1; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
496 MISC_keymap[Pk_F2&0xFF] = SDLK_F2; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
497 MISC_keymap[Pk_F3&0xFF] = SDLK_F3; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
498 MISC_keymap[Pk_F4&0xFF] = SDLK_F4; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
499 MISC_keymap[Pk_F5&0xFF] = SDLK_F5; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
500 MISC_keymap[Pk_F6&0xFF] = SDLK_F6; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
501 MISC_keymap[Pk_F7&0xFF] = SDLK_F7; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
502 MISC_keymap[Pk_F8&0xFF] = SDLK_F8; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
503 MISC_keymap[Pk_F9&0xFF] = SDLK_F9; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
504 MISC_keymap[Pk_F10&0xFF] = SDLK_F10; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
505 MISC_keymap[Pk_F11&0xFF] = SDLK_F11; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
506 MISC_keymap[Pk_F12&0xFF] = SDLK_F12; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
507 MISC_keymap[Pk_F13&0xFF] = SDLK_F13; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
508 MISC_keymap[Pk_F14&0xFF] = SDLK_F14; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
509 MISC_keymap[Pk_F15&0xFF] = SDLK_F15; |
0 | 510 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
511 MISC_keymap[Pk_Num_Lock&0xFF] = SDLK_NUMLOCK; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
512 MISC_keymap[Pk_Caps_Lock&0xFF] = SDLK_CAPSLOCK; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
513 MISC_keymap[Pk_Scroll_Lock&0xFF] = SDLK_SCROLLOCK; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
514 MISC_keymap[Pk_Shift_R&0xFF] = SDLK_RSHIFT; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
515 MISC_keymap[Pk_Shift_L&0xFF] = SDLK_LSHIFT; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
516 MISC_keymap[Pk_Control_R&0xFF] = SDLK_RCTRL; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
517 MISC_keymap[Pk_Control_L&0xFF] = SDLK_LCTRL; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
518 MISC_keymap[Pk_Alt_R&0xFF] = SDLK_RALT; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
519 MISC_keymap[Pk_Alt_L&0xFF] = SDLK_LALT; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
520 MISC_keymap[Pk_Meta_R&0xFF] = SDLK_RMETA; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
521 MISC_keymap[Pk_Meta_L&0xFF] = SDLK_LMETA; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
522 MISC_keymap[Pk_Super_L&0xFF] = SDLK_LSUPER; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
523 MISC_keymap[Pk_Super_R&0xFF] = SDLK_RSUPER; |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
524 MISC_keymap[Pk_Mode_switch&0xFF] = SDLK_MODE; /* "Alt Gr" key */ |
0 | 525 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
526 MISC_keymap[Pk_Help&0xFF] = SDLK_HELP; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
527 MISC_keymap[Pk_Print&0xFF] = SDLK_PRINT; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
528 MISC_keymap[Pk_Break&0xFF] = SDLK_BREAK; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
529 MISC_keymap[Pk_Menu&0xFF] = SDLK_MENU; /* Windows "Menu" key */ |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
530 |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
531 MISC_keymap[Pk_Hyper_R&0xFF] = SDLK_RSUPER; /* Right "Windows" */ |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
532 |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
533 /* Left "Windows" key, but it can't be catched by application */ |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
534 MISC_keymap[Pk_Hyper_L&0xFF] = SDLK_LSUPER; |
0 | 535 } |
536 | |
537 static unsigned long cap; | |
538 | |
539 SDL_keysym *ph_TranslateKey(PhKeyEvent_t *key, SDL_keysym *keysym) | |
540 { | |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
541 /* 'sym' is set to the value of the key with modifiers applied to it. |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
542 This member is valid only if Pk_KF_Sym_Valid is set in the key_flags. |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
543 We will assume it is valid. */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
544 |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
545 /* FIXME: This needs to check whether the cap & scancode is valid */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
546 |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
547 cap = key->key_cap; |
283
3d8b6b9f1e18
Date: Mon, 18 Feb 2002 16:46:59 +1200
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
548 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
549 switch (cap>>8) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
550 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
551 case 0x00: /* Latin 1 */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
552 case 0x01: /* Latin 2 */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
553 case 0x02: /* Latin 3 */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
554 case 0x03: /* Latin 4 */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
555 case 0x04: /* Katakana */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
556 case 0x05: /* Arabic */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
557 case 0x06: /* Cyrillic */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
558 case 0x07: /* Greek */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
559 case 0x08: /* Technical */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
560 case 0x0A: /* Publishing */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
561 case 0x0C: /* Hebrew */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
562 case 0x0D: /* Thai */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
563 keysym->sym = (SDLKey)(cap&0xFF); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
564 /* Map capital letter syms to lowercase */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
565 if ((keysym->sym >= 'A')&&(keysym->sym <= 'Z')) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
566 keysym->sym += ('a'-'A'); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
567 break; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
568 case 0xF0: |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
569 keysym->sym = MISC_keymap[cap&0xFF]; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
570 break; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
571 default: |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
572 keysym->sym = SDLK_UNKNOWN; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
573 break; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
574 } |
283
3d8b6b9f1e18
Date: Mon, 18 Feb 2002 16:46:59 +1200
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
575 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
576 keysym->scancode = key->key_scan; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
577 keysym->unicode = 0; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
578 |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
579 if (SDL_TranslateUNICODE) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
580 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
581 char utf8[MB_CUR_MAX]; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
582 int utf8len; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
583 wchar_t unicode; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
584 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
585 switch (keysym->scancode) |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
586 { |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
587 /* Esc key */ |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
588 case 0x01: keysym->unicode = 27; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
589 break; |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
590 /* BackSpace key */ |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
591 case 0x0E: keysym->unicode = 127; |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
592 break; |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
593 /* Enter key */ |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
594 case 0x1C: keysym->unicode = 10; |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
595 break; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
596 default: |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
597 utf8len = PhKeyToMb(utf8, key); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
598 if (utf8len > 0) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
599 { |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
600 utf8len = mbtowc(&unicode, utf8, utf8len); |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
601 if (utf8len > 0) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
602 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
603 keysym->unicode = unicode; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
604 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
605 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
606 break; |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
607 } |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
608 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
609 } |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
610 |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
611 return (keysym); |
0 | 612 } |
613 | |
614 void ph_InitOSKeymap(_THIS) | |
615 { | |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
616 ph_InitKeymap(); |
0 | 617 } |