annotate src/video/riscos/SDL_wimppoll.c @ 1672:8e754b82cecc SDL-1.3

Updated SDL_Surface code for software-only access, fixed some build errors
author Sam Lantinga <slouken@libsdl.org>
date Fri, 09 Jun 2006 07:06:12 +0000
parents 4da1ee79c9af
children
rev   line source
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
769
b8d311d90021 Updated copyright information for 2004 (Happy New Year!)
Sam Lantinga <slouken@libsdl.org>
parents: 630
diff changeset
3 Copyright (C) 1997-2004 Sam Lantinga
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 modify it under the terms of the GNU Library General Public
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 version 2 of the License, or (at your option) any later version.
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 Library General Public License for more details.
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 You should have received a copy of the GNU Library General Public
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 License along with this library; if not, write to the Free
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1208
diff changeset
20 slouken@libsdl.org
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 */
1402
d910939febfa Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents: 1361
diff changeset
22 #include "SDL_config.h"
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 /*
1035
974ba6ae0fa3 Date: Wed, 26 Jan 2005 13:37:09 GMT
Sam Lantinga <slouken@libsdl.org>
parents: 955
diff changeset
25 File added by Alan Buckley (alan_baa@hotmail.com) for RISC OS compatability
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 27 March 2003
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 Implements Pumping of events and WIMP polling
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 */
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 #include "SDL.h"
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 #include "SDL_syswm.h"
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1336
diff changeset
33 #include "../../events/SDL_sysevents.h"
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1336
diff changeset
34 #include "../../events/SDL_events_c.h"
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 #include "SDL_riscosvideo.h"
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36 #include "SDL_riscosevents_c.h"
1035
974ba6ae0fa3 Date: Wed, 26 Jan 2005 13:37:09 GMT
Sam Lantinga <slouken@libsdl.org>
parents: 955
diff changeset
37 #include "SDL_riscosmouse_c.h"
1415
a30f8553eeb1 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
38 #include "../../timer/SDL_timer_c.h"
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 #include "memory.h"
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 #include "stdlib.h"
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 #include "ctype.h"
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44 #include "kernel.h"
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 #include "swis.h"
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 #include "unixlib/os.h"
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1336
diff changeset
48 #if !SDL_THREADS_DISABLED
955
d74fbf56f2f6 Date: Fri, 25 Jun 2004 13:29:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
49 #include <pthread.h>
d74fbf56f2f6 Date: Fri, 25 Jun 2004 13:29:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
50 #endif
d74fbf56f2f6 Date: Fri, 25 Jun 2004 13:29:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
51
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 /* Local functions */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
53 void WIMP_Poll(_THIS, int waitTime);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
54 void WIMP_SetFocus(int win);
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 /* SDL_riscossprite functions */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
57 void WIMP_PlotSprite(_THIS, int x, int y);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
58 void WIMP_ModeChanged(_THIS);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
59 void WIMP_PaletteChanged(_THIS);
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
62 extern void WIMP_PollMouse(_THIS);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
63 extern void RISCOS_PollKeyboard();
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1336
diff changeset
65 #if SDL_THREADS_DISABLED
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 /* Timer running function */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
67 extern void RISCOS_CheckTimer();
955
d74fbf56f2f6 Date: Fri, 25 Jun 2004 13:29:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
68 #else
d74fbf56f2f6 Date: Fri, 25 Jun 2004 13:29:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
69 extern int riscos_using_threads;
d74fbf56f2f6 Date: Fri, 25 Jun 2004 13:29:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
70 #endif
d74fbf56f2f6 Date: Fri, 25 Jun 2004 13:29:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
71
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 /* Mouse cursor handling */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
73 extern void WIMP_ReshowCursor(_THIS);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
74 extern void WIMP_RestoreWimpCursor();
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 int hasFocus = 0;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 int mouseInWindow = 0;
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
78
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 /* Flag to ensure window is correct size after a mode change */
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 static int resizeOnOpen = 0;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
82 void
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
83 WIMP_PumpEvents(_THIS)
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
85 WIMP_Poll(this, 0);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
86 if (hasFocus)
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
87 RISCOS_PollKeyboard();
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
88 if (mouseInWindow)
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
89 WIMP_PollMouse(this);
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1336
diff changeset
90 #if SDL_THREADS_DISABLED
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
91 if (SDL_timer_running)
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
92 RISCOS_CheckTimer();
955
d74fbf56f2f6 Date: Fri, 25 Jun 2004 13:29:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
93 #endif
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
97 void
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
98 WIMP_Poll(_THIS, int waitTime)
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
100 _kernel_swi_regs regs;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
101 int message[64];
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
102 unsigned int code;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
103 int pollMask = 0;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
104 int doPoll = 1;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
105 int sysEvent;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
106 int sdlWindow = this->hidden->window_handle;
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
108 if (this->PumpEvents != WIMP_PumpEvents)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
109 return;
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
111 if (waitTime > 0) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
112 _kernel_swi(OS_ReadMonotonicTime, &regs, &regs);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
113 waitTime += regs.r[0];
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
115
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
116 while (doPoll) {
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1336
diff changeset
117 #if !SDL_THREADS_DISABLED
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
118 /* Stop thread callbacks while program is paged out */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
119 if (riscos_using_threads)
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
120 __pthread_stop_ticker();
955
d74fbf56f2f6 Date: Fri, 25 Jun 2004 13:29:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
121 #endif
d74fbf56f2f6 Date: Fri, 25 Jun 2004 13:29:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
122
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
123 if (waitTime <= 0) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
124 regs.r[0] = pollMask; /* Poll Mask */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
125 /* For no wait time mask out null event so we wait until something happens */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
126 if (waitTime < 0)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
127 regs.r[0] |= 1;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
128 regs.r[1] = (int) message;
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
129 _kernel_swi(Wimp_Poll, &regs, &regs);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
130 } else {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
131 regs.r[0] = pollMask;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
132 regs.r[1] = (int) message;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
133 regs.r[2] = waitTime;
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
134 _kernel_swi(Wimp_PollIdle, &regs, &regs);
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
135 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
136
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
137 /* Flag to specify if we post a SDL_SysWMEvent */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
138 sysEvent = 0;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
139
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
140 code = (unsigned int) regs.r[0];
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
141
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
142 switch (code) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
143 case 0: /* Null Event - drop out for standard processing */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
144 doPoll = 0;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
145 break;
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
146
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
147 case 1: /* Redraw window */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
148 _kernel_swi(Wimp_RedrawWindow, &regs, &regs);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
149 if (message[0] == sdlWindow) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
150 while (regs.r[0]) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
151 WIMP_PlotSprite(this, message[1], message[2]);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
152 _kernel_swi(Wimp_GetRectangle, &regs, &regs);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
153 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
154 } else {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
155 /* TODO: Currently we just eat them - we may need to pass them on */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
156 while (regs.r[0]) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
157 _kernel_swi(Wimp_GetRectangle, &regs, &regs);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
158 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
159 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
160 break;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
161
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
162 case 2: /* Open window */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
163 if (resizeOnOpen && message[0] == sdlWindow) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
164 /* Ensure window is correct size */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
165 resizeOnOpen = 0;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
166 message[3] =
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
167 message[1] + (this->screen->w << this->hidden->xeig);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
168 message[4] =
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
169 message[2] + (this->screen->h << this->hidden->yeig);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
170 }
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
171 _kernel_swi(Wimp_OpenWindow, &regs, &regs);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
172 break;
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
173
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
174 case 3: /* Close window */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
175 if (message[0] == sdlWindow) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
176 /* Documentation makes it looks as if the following line is correct:
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
177 ** if (SDL_PrivateQuit() == 1) _kernel_swi(Wimp_CloseWindow, &regs, &regs);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
178 ** However some programs don't process this message and so sit there invisibly
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
179 ** in the background so I just post the quit message and hope the application
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
180 ** does the correct thing.
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
181 */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
182 SDL_PrivateQuit();
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
183 } else
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
184 sysEvent = 1;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
185 doPoll = 0;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
186 break;
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
187
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
188 case 4: /* Pointer_Leaving_Window */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
189 if (message[0] == sdlWindow) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
190 mouseInWindow = 0;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
191 //TODO: Lose buttons / dragging
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
192 /* Reset to default pointer */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
193 WIMP_RestoreWimpCursor();
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
194 SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
195 } else
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
196 sysEvent = 1;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
197 break;
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
198
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
199 case 5: /* Pointer_Entering_Window */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
200 if (message[0] == sdlWindow) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
201 mouseInWindow = 1;
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
202 WIMP_ReshowCursor(this);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
203 SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
204 } else
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
205 sysEvent = 1;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
206 break;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
207
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
208 case 6: /* Mouse_Click */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
209 if (hasFocus == 0) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
210 /* First click gives focus if it's not a menu */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
211 /* we only count non-menu clicks on a window that has the focus */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
212 WIMP_SetFocus(message[3]);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
213 } else
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
214 doPoll = 0; // So PollMouse gets a chance to pick it up
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
215 break;
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
216
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
217 case 7: /* User_Drag_Box - Used for mouse release */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
218 //TODO: May need to implement this in the future
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
219 sysEvent = 1;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
220 break;
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
221
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
222 case 8: /* Keypressed */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
223 doPoll = 0; /* PollKeyboard should pick it up */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
224 if (message[0] != sdlWindow)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
225 sysEvent = 1;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
226 /*TODO: May want to always pass F12 etc to the wimp
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
227 {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
228 regs.r[0] = message[6];
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
229 _kernel_swi(Wimp_ProcessKey, &regs, &regs);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
230 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
231 */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
232 break;
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
233
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
234 case 11: /* Lose Caret */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
235 hasFocus = 0;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
236 if (message[0] == sdlWindow)
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
237 SDL_PrivateAppActive(0, SDL_APPINPUTFOCUS);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
238 else
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
239 sysEvent = 1;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
240 break;
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
241
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
242 case 12: /* Gain Caret */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
243 hasFocus = 1;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
244 if (message[0] == sdlWindow)
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
245 SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
246 else
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
247 sysEvent = 1;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
248 break;
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
249
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
250 case 17:
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
251 case 18:
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
252 sysEvent = 1; /* All messages are passed on */
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
253
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
254 switch (message[4]) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
255 case 0: /* Quit Event */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
256 /* No choice - have to quit */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
257 SDL_Quit();
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
258 exit(0);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
259 break;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
260
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
261 case 8: /* Pre Quit */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
262 SDL_PrivateQuit();
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
263 break;
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
264
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
265 case 0x400c1: /* Mode change */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
266 WIMP_ModeChanged(this);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
267 resizeOnOpen = 1;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
268 break;
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
269
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
270 case 9: /* Palette changed */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
271 WIMP_PaletteChanged(this);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
272 break;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
273 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
274 break;
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
275
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
276 default:
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
277 /* Pass unknown events on */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
278 sysEvent = 1;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
279 break;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
280 }
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
281
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
282 if (sysEvent) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
283 SDL_SysWMmsg wmmsg;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
284
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
285 SDL_VERSION(&wmmsg.version);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
286 wmmsg.eventCode = code;
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
287 SDL_memcpy(wmmsg.pollBlock, message, 64 * sizeof(int));
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
288
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
289 /* Fall out of polling loop if message is successfully posted */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
290 if (SDL_PrivateSysWMEvent(&wmmsg))
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
291 doPoll = 0;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
292 }
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1336
diff changeset
293 #if !SDL_THREADS_DISABLED
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
294 if (riscos_using_threads) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
295 /* Restart ticker here so other thread can not interfere
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
296 with the Redraw processing */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
297 if (riscos_using_threads)
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
298 __pthread_start_ticker();
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
299 /* Give other threads a better chance of running */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
300 pthread_yield();
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
301 }
955
d74fbf56f2f6 Date: Fri, 25 Jun 2004 13:29:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
302 #endif
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
303 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
304 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
305
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
306 /* Set focus to specified window */
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
307 void
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
308 WIMP_SetFocus(int win)
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
309 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
310 _kernel_swi_regs regs;
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
311
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
312 regs.r[0] = win;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
313 regs.r[1] = -1; /* Icon handle */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
314 regs.r[2] = 0; /* X-offset we just put it at position 0 */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
315 regs.r[3] = 0; /* Y-offset as above */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
316 regs.r[4] = 1 << 25; /* Caret is invisible */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
317 regs.r[5] = 0; /* index into string */
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
318
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
319 _kernel_swi(Wimp_SetCaretPosition, &regs, &regs);
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
320 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
321
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
322 /** Run background task while in a sleep command */
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
323 void
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
324 RISCOS_BackgroundTasks(void)
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
325 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
326 if (current_video && current_video->hidden->window_handle) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
327 WIMP_Poll(current_video, 0);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
328 }
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1336
diff changeset
329 #if SDL_THREADS_DISABLED
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
330 if (SDL_timer_running)
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
331 RISCOS_CheckTimer();
955
d74fbf56f2f6 Date: Fri, 25 Jun 2004 13:29:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
332 #endif
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
333 }
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
334
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1415
diff changeset
335 /* vi: set ts=4 sw=4 expandtab: */