annotate src/video/riscos/SDL_riscosvideo.c @ 1643:51038e80ae59

More general fix for bug #189 The clipping is done at a higher level, and the low level functions are passed clipped rectangles. Drivers which don't support source clipping have not been changed, so the image will be squished instead of clipped, but at least they will no longer crash when the destination rect was out of bounds.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 17 Apr 2006 06:47:23 +0000
parents 066236f0cbf0
children 782fd950bd46 c121d94672cb a1b03ba2fcd0
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: 687
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: 769
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 23 March 2003
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27
1035
974ba6ae0fa3 Date: Wed, 26 Jan 2005 13:37:09 GMT
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
28 Implements RISC OS display device management.
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 Routines for full screen and wimp modes are split
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 into other source files.
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 */
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 #include "SDL_video.h"
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 #include "SDL_mouse.h"
1358
c71e05b4dc2e More header massaging... works great on Windows. ;-)
Sam Lantinga <slouken@libsdl.org>
parents: 1338
diff changeset
35 #include "SDL_syswm.h"
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
36 #include "../SDL_sysvideo.h"
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
37 #include "../SDL_pixels_c.h"
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
38 #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
39
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 #include "SDL_riscostask.h"
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 #include "SDL_riscosvideo.h"
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 #include "SDL_riscosevents_c.h"
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 #include "SDL_riscosmouse_c.h"
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 #include "kernel.h"
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 #include "swis.h"
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48 #define RISCOSVID_DRIVER_NAME "riscos"
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 /* Initialization/Query functions */
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 static int RISCOS_VideoInit(_THIS, SDL_PixelFormat *vformat);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 static void RISCOS_VideoQuit(_THIS);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 static SDL_Rect **RISCOS_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 static SDL_Surface *RISCOS_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 int RISCOS_GetWmInfo(_THIS, SDL_SysWMinfo *info);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 int RISCOS_ToggleFullScreen(_THIS, int fullscreen);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 /* Mouse checking */
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 void RISCOS_CheckMouseMode(_THIS);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 extern SDL_GrabMode RISCOS_GrabInput(_THIS, SDL_GrabMode mode);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 /* Fullscreen mode functions */
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 extern SDL_Surface *FULLSCREEN_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 extern void FULLSCREEN_BuildModeList(_THIS);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 extern void FULLSCREEN_SetDeviceMode(_THIS);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68 extern int FULLSCREEN_ToggleFromWimp(_THIS);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 /* Wimp mode functions */
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 extern SDL_Surface *WIMP_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 extern void WIMP_DeleteWindow(_THIS);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 extern int WIMP_ToggleFromFullScreen(_THIS);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75 /* Hardware surface functions - common to WIMP and FULLSCREEN */
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 static int RISCOS_AllocHWSurface(_THIS, SDL_Surface *surface);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 static int RISCOS_LockHWSurface(_THIS, SDL_Surface *surface);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 static void RISCOS_UnlockHWSurface(_THIS, SDL_Surface *surface);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 static void RISCOS_FreeHWSurface(_THIS, SDL_Surface *surface);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80
1035
974ba6ae0fa3 Date: Wed, 26 Jan 2005 13:37:09 GMT
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
81 /* RISC OS driver bootstrap functions */
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83 static int RISCOS_Available(void)
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 {
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85 return(1);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88 static void RISCOS_DeleteDevice(SDL_VideoDevice *device)
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 {
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
90 SDL_free(device->hidden);
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
91 SDL_free(device);
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 static SDL_VideoDevice *RISCOS_CreateDevice(int devindex)
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 SDL_VideoDevice *device;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98 /* Initialize all variables that we clean on shutdown */
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
99 device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice));
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100 if ( device ) {
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
101 SDL_memset(device, 0, (sizeof *device));
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102 device->hidden = (struct SDL_PrivateVideoData *)
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
103 SDL_malloc((sizeof *device->hidden));
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105 if ( (device == NULL) || (device->hidden == NULL) ) {
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 SDL_OutOfMemory();
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107 if ( device ) {
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
108 SDL_free(device);
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
109 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110 return(0);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
111 }
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
112 SDL_memset(device->hidden, 0, (sizeof *device->hidden));
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
113
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114 /* Set the function pointers */
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
115 device->VideoInit = RISCOS_VideoInit;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116 device->VideoQuit = RISCOS_VideoQuit;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118 device->ListModes = RISCOS_ListModes;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119 device->SetVideoMode = RISCOS_SetVideoMode;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120 device->CreateYUVOverlay = NULL;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121 device->AllocHWSurface = RISCOS_AllocHWSurface;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
122 device->CheckHWBlit = NULL;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123 device->FillHWRect = NULL;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
124 device->SetHWColorKey = NULL;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125 device->SetHWAlpha = NULL;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126 device->LockHWSurface = RISCOS_LockHWSurface;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127 device->UnlockHWSurface = RISCOS_UnlockHWSurface;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128 device->FreeHWSurface = RISCOS_FreeHWSurface;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130 device->FreeWMCursor = RISCOS_FreeWMCursor;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
131 device->CreateWMCursor = RISCOS_CreateWMCursor;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
132 device->CheckMouseMode = RISCOS_CheckMouseMode;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
133 device->GrabInput = RISCOS_GrabInput;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
134
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
135 device->InitOSKeymap = RISCOS_InitOSKeymap;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
136
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
137 device->GetWMInfo = RISCOS_GetWmInfo;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
139 device->free = RISCOS_DeleteDevice;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
141 /* Can't get Toggle screen to work if program starts up in Full screen mode so
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
142 disable it here and re-enable it when a wimp screen is chosen */
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
143 device->ToggleFullScreen = NULL; /*RISCOS_ToggleFullScreen;*/
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
144
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
145 /* Set other entries for fullscreen mode */
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
146 FULLSCREEN_SetDeviceMode(device);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147
1208
d90b362628ea From: "alan buckley" <alan_baa@hotmail.com>
Sam Lantinga <slouken@libsdl.org>
parents: 1035
diff changeset
148 /* Mouse pointer needs to use the WIMP ShowCursor version so
d90b362628ea From: "alan buckley" <alan_baa@hotmail.com>
Sam Lantinga <slouken@libsdl.org>
parents: 1035
diff changeset
149 that it doesn't modify the pointer until the SDL Window is
d90b362628ea From: "alan buckley" <alan_baa@hotmail.com>
Sam Lantinga <slouken@libsdl.org>
parents: 1035
diff changeset
150 entered or the application goes full screen */
d90b362628ea From: "alan buckley" <alan_baa@hotmail.com>
Sam Lantinga <slouken@libsdl.org>
parents: 1035
diff changeset
151 device->ShowWMCursor = WIMP_ShowWMCursor;
d90b362628ea From: "alan buckley" <alan_baa@hotmail.com>
Sam Lantinga <slouken@libsdl.org>
parents: 1035
diff changeset
152
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
153 return device;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
155
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
156 VideoBootStrap RISCOS_bootstrap = {
1035
974ba6ae0fa3 Date: Wed, 26 Jan 2005 13:37:09 GMT
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
157 RISCOSVID_DRIVER_NAME, "RISC OS video driver",
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158 RISCOS_Available, RISCOS_CreateDevice
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159 };
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
161
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162 int RISCOS_VideoInit(_THIS, SDL_PixelFormat *vformat)
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163 {
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
164 _kernel_swi_regs regs;
1549
066236f0cbf0 Implemented RISC OS and OS/2 desktop resolution code (thanks to Alan and Doodle)
Sam Lantinga <slouken@libsdl.org>
parents: 1545
diff changeset
165 int vars[4], vals[3];
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167 if (RISCOS_InitTask() == 0)
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
168 {
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
169 SDL_SetError("Unable to start task");
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170 return 0;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
171 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
172
1549
066236f0cbf0 Implemented RISC OS and OS/2 desktop resolution code (thanks to Alan and Doodle)
Sam Lantinga <slouken@libsdl.org>
parents: 1545
diff changeset
173 vars[0] = 9; /* Log base 2 bpp */
066236f0cbf0 Implemented RISC OS and OS/2 desktop resolution code (thanks to Alan and Doodle)
Sam Lantinga <slouken@libsdl.org>
parents: 1545
diff changeset
174 vars[1] = 11; /* XWndLimit - num x pixels -1 */
066236f0cbf0 Implemented RISC OS and OS/2 desktop resolution code (thanks to Alan and Doodle)
Sam Lantinga <slouken@libsdl.org>
parents: 1545
diff changeset
175 vars[2] = 12; /* YWndLimit - num y pixels -1 */
066236f0cbf0 Implemented RISC OS and OS/2 desktop resolution code (thanks to Alan and Doodle)
Sam Lantinga <slouken@libsdl.org>
parents: 1545
diff changeset
176 vars[3] = -1; /* Terminate list */
066236f0cbf0 Implemented RISC OS and OS/2 desktop resolution code (thanks to Alan and Doodle)
Sam Lantinga <slouken@libsdl.org>
parents: 1545
diff changeset
177 regs.r[0] = (int)vars;
066236f0cbf0 Implemented RISC OS and OS/2 desktop resolution code (thanks to Alan and Doodle)
Sam Lantinga <slouken@libsdl.org>
parents: 1545
diff changeset
178 regs.r[1] = (int)vals;
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
179
1549
066236f0cbf0 Implemented RISC OS and OS/2 desktop resolution code (thanks to Alan and Doodle)
Sam Lantinga <slouken@libsdl.org>
parents: 1545
diff changeset
180 _kernel_swi(OS_ReadVduVariables, &regs, &regs);
066236f0cbf0 Implemented RISC OS and OS/2 desktop resolution code (thanks to Alan and Doodle)
Sam Lantinga <slouken@libsdl.org>
parents: 1545
diff changeset
181 vformat->BitsPerPixel = (1 << vals[0]);
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
182
1545
8d9bb0cf2c2a Added current_w and current_h to the SDL_VideoInfo structure, which is set to the desktop resolution during video intialization, and then set to the current resolution when a video mode is set.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
183 /* Determine the current screen size */
1549
066236f0cbf0 Implemented RISC OS and OS/2 desktop resolution code (thanks to Alan and Doodle)
Sam Lantinga <slouken@libsdl.org>
parents: 1545
diff changeset
184 this->info.current_w = vals[1] + 1;
066236f0cbf0 Implemented RISC OS and OS/2 desktop resolution code (thanks to Alan and Doodle)
Sam Lantinga <slouken@libsdl.org>
parents: 1545
diff changeset
185 this->info.current_h = vals[2] + 1;
1545
8d9bb0cf2c2a Added current_w and current_h to the SDL_VideoInfo structure, which is set to the desktop resolution during video intialization, and then set to the current resolution when a video mode is set.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
186
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
187 /* Minimum bpp for SDL is 8 */
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
188 if (vformat->BitsPerPixel < 8) vformat->BitsPerPixel = 8;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
189
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
190
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
191 switch (vformat->BitsPerPixel)
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
192 {
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
193 case 15:
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
194 case 16:
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
195 vformat->Bmask = 0x00007c00;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
196 vformat->Gmask = 0x000003e0;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
197 vformat->Rmask = 0x0000001f;
687
91400ecf307d Date: Mon, 11 Aug 2003 22:49:06 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 630
diff changeset
198 vformat->BitsPerPixel = 16; /* SDL wants actual number of bits used */
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
199 vformat->BytesPerPixel = 2;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
200 break;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
201
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
202 case 24:
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
203 case 32:
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
204 vformat->Bmask = 0x00ff0000;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
205 vformat->Gmask = 0x0000ff00;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
206 vformat->Rmask = 0x000000ff;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
207 vformat->BytesPerPixel = 4;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
208 break;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
209
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
210 default:
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
211 vformat->Bmask = 0;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
212 vformat->Gmask = 0;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
213 vformat->Rmask = 0;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
214 vformat->BytesPerPixel = 1;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
215 break;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
216 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
217
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
218 /* Fill in some window manager capabilities */
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
219 this->info.wm_available = 1;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
220
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
221 /* We're done! */
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
222 return(0);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
223 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
224
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
225 /* Note: If we are terminated, this could be called in the middle of
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
226 another SDL video routine -- notably UpdateRects.
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
227 */
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
228 void RISCOS_VideoQuit(_THIS)
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
229 {
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
230 RISCOS_ExitTask();
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
231
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
232 if (this->hidden->alloc_bank) SDL_free(this->hidden->alloc_bank);
630
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
233 this->hidden->alloc_bank = 0;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
234 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
235
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
236
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
237 SDL_Rect **RISCOS_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags)
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
238 {
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
239 if (flags & SDL_FULLSCREEN)
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
240 {
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
241 /* Build mode list when first required. */
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
242 if (SDL_nummodes[0] == 0) FULLSCREEN_BuildModeList(this);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
243
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
244 return(SDL_modelist[((format->BitsPerPixel+7)/8)-1]);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
245 } else
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
246 return (SDL_Rect **)-1;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
247 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
248
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
249
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
250 /* Set up video mode */
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
251 SDL_Surface *RISCOS_SetVideoMode(_THIS, SDL_Surface *current,
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
252 int width, int height, int bpp, Uint32 flags)
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
253 {
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
254 if (flags & SDL_FULLSCREEN)
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
255 {
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
256 RISCOS_StoreWimpMode();
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
257 /* Dump wimp window on switch to full screen */
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
258 if (this->hidden->window_handle) WIMP_DeleteWindow(this);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
259
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
260 return FULLSCREEN_SetVideoMode(this, current, width, height, bpp, flags);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
261 } else
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
262 {
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
263 RISCOS_RestoreWimpMode();
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
264 return WIMP_SetVideoMode(this, current, width, height, bpp, flags);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
265 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
266 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
267
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
268
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
269 /* We don't actually allow hardware surfaces other than the main one */
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
270 static int RISCOS_AllocHWSurface(_THIS, SDL_Surface *surface)
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
271 {
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
272 return(-1);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
273 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
274 static void RISCOS_FreeHWSurface(_THIS, SDL_Surface *surface)
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
275 {
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
276 return;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
277 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
278
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
279 /* We need to wait for vertical retrace on page flipped displays */
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
280 static int RISCOS_LockHWSurface(_THIS, SDL_Surface *surface)
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
281 {
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
282 return(0);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
283 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
284
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
285 static void RISCOS_UnlockHWSurface(_THIS, SDL_Surface *surface)
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
286 {
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
287 return;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
288 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
289
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
290
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
291 int RISCOS_GetWmInfo(_THIS, SDL_SysWMinfo *info)
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
292 {
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
293 SDL_VERSION(&(info->version));
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
294 info->wimpVersion = RISCOS_GetWimpVersion();
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
295 info->taskHandle = RISCOS_GetTaskHandle();
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
296 info->window = this->hidden->window_handle;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
297
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
298 return 1;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
299 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
300 /* Toggle full screen mode.
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
301 Returns 1 if successful otherwise 0
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
302 */
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 int RISCOS_ToggleFullScreen(_THIS, int fullscreen)
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 if (fullscreen)
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
307 {
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
308 return FULLSCREEN_ToggleFromWimp(this);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
309 } else
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
310 {
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
311 return WIMP_ToggleFromFullScreen(this);
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
312 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
313
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
314 return 0;
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
315 }
550bccdf04bd Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
316