annotate src/video/xbios/SDL_xbios.h @ 4249:429c8dd3175d SDL-1.2

Fixed bug #713 Don't clamp the mouse coordinates to the video surface size, instead clamp them to the last known window size. This allows users to get the correct mouse coordinates even if they don't call SDL_SetVideoMode() in response to an SDL_VIDEORESIZE event (used as a hack to retain the OpenGL context on Windows and Linux after a window resize)
author Sam Lantinga <slouken@libsdl.org>
date Sun, 27 Sep 2009 05:18:43 +0000
parents 6405314a7c07
children
rev   line source
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
4159
a1b03ba2fcd0 Updated copyright date
Sam Lantinga <slouken@libsdl.org>
parents: 4150
diff changeset
3 Copyright (C) 1997-2009 Sam Lantinga
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1064
diff changeset
6 modify it under the terms of the GNU Lesser General Public
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1064
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1064
diff changeset
13 Lesser General Public License for more details.
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1064
diff changeset
15 You should have received a copy of the GNU Lesser General Public
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1064
diff changeset
16 License along with this library; if not, write to the Free Software
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1064
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
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"
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 #ifndef _SDL_xbios_h
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 #define _SDL_xbios_h
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26
1358
c71e05b4dc2e More header massaging... works great on Windows. ;-)
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
27 #include "SDL_stdinc.h"
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
28 #include "../SDL_sysvideo.h"
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 /* Hidden "this" pointer for the video functions */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 #define _THIS SDL_VideoDevice *this
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32
4198
6405314a7c07 Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
33 #define XBIOSMODE_DOUBLELINE (1<<0)
6405314a7c07 Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
34 #define XBIOSMODE_C2P (1<<1)
6405314a7c07 Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
35
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36 typedef struct
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 Uint16 number; /* Video mode number */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 Uint16 width; /* Size */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 Uint16 height;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 Uint16 depth; /* bits per plane */
4198
6405314a7c07 Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
42 Uint16 flags;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 } xbiosmode_t;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 /* Private display data */
4194
05c9e942cc46 Preliminary work to support the Milan video bios, that will gives access to 24 or 32 bpp modes. I used the svga driver as model to dynamically build video modes list.
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
46 #define NUM_MODELISTS 4 /* 8, 16, 24, and 32 bits-per-pixel */
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48 struct SDL_PrivateVideoData {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 long cookie_vdo;
4198
6405314a7c07 Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
50 long old_video_mode; /* Old video mode before entering SDL */
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 void *old_video_base; /* Old pointer to screen buffer */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 void *old_palette; /* Old palette */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53 Uint32 old_num_colors; /* Nb of colors in saved palette */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 void *screens[2]; /* Pointers to aligned screen buffer */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 void *screensmem[2]; /* Pointers to screen buffer */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 void *shadowscreen; /* Shadow screen for c2p conversion */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58 int frame_number; /* Number of frame for double buffer */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 int pitch; /* Destination line width for C2P */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60
1064
fba6b67b4d60 Add Centscreen extended modes support
Patrice Mandin <patmandin@gmail.com>
parents: 1042
diff changeset
61 SDL_bool centscreen; /* Centscreen extension present ? */
fba6b67b4d60 Add Centscreen extended modes support
Patrice Mandin <patmandin@gmail.com>
parents: 1042
diff changeset
62
4198
6405314a7c07 Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
63 xbiosmode_t *current; /* Current set mode */
4194
05c9e942cc46 Preliminary work to support the Milan video bios, that will gives access to 24 or 32 bpp modes. I used the svga driver as model to dynamically build video modes list.
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
64 int SDL_nummodes[NUM_MODELISTS];
05c9e942cc46 Preliminary work to support the Milan video bios, that will gives access to 24 or 32 bpp modes. I used the svga driver as model to dynamically build video modes list.
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
65 SDL_Rect **SDL_modelist[NUM_MODELISTS];
05c9e942cc46 Preliminary work to support the Milan video bios, that will gives access to 24 or 32 bpp modes. I used the svga driver as model to dynamically build video modes list.
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
66 xbiosmode_t **SDL_xbiosmode[NUM_MODELISTS];
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 };
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 /* _VDO cookie values */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 enum {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 VDO_ST=0,
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 VDO_STE,
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 VDO_TT,
4195
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents: 4194
diff changeset
74 VDO_F30,
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents: 4194
diff changeset
75 VDO_MILAN
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 };
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 /* Monitor types */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 enum {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 MONITOR_MONO=0,
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81 MONITOR_TV,
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82 MONITOR_VGA,
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83 MONITOR_RGB
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 };
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 /* EgetShift masks */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87 #define ES_MODE 0x0700
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 /* TT shifter modes */
4150
1019eb074a56 Check defines do not already exist in recent system headers
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
90 #ifndef ST_LOW
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91 #define ST_LOW 0x0000
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 #define ST_MED 0x0100
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93 #define ST_HIGH 0x0200
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 #define TT_LOW 0x0700
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95 #define TT_MED 0x0300
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96 #define TT_HIGH 0x0600
4150
1019eb074a56 Check defines do not already exist in recent system headers
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
97 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 /* Hidden structure -> variables names */
4194
05c9e942cc46 Preliminary work to support the Milan video bios, that will gives access to 24 or 32 bpp modes. I used the svga driver as model to dynamically build video modes list.
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
100 #define SDL_nummodes (this->hidden->SDL_nummodes)
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101 #define SDL_modelist (this->hidden->SDL_modelist)
4194
05c9e942cc46 Preliminary work to support the Milan video bios, that will gives access to 24 or 32 bpp modes. I used the svga driver as model to dynamically build video modes list.
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
102 #define SDL_xbiosmode (this->hidden->SDL_xbiosmode)
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103 #define XBIOS_mutex (this->hidden->mutex)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104 #define XBIOS_cvdo (this->hidden->cookie_vdo)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105 #define XBIOS_oldpalette (this->hidden->old_palette)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 #define XBIOS_oldnumcol (this->hidden->old_num_colors)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107 #define XBIOS_oldvbase (this->hidden->old_video_base)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108 #define XBIOS_oldvmode (this->hidden->old_video_mode)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
109 #define XBIOS_screens (this->hidden->screens)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110 #define XBIOS_screensmem (this->hidden->screensmem)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
111 #define XBIOS_shadowscreen (this->hidden->shadowscreen)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
112 #define XBIOS_fbnum (this->hidden->frame_number)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
113 #define XBIOS_pitch (this->hidden->pitch)
1064
fba6b67b4d60 Add Centscreen extended modes support
Patrice Mandin <patmandin@gmail.com>
parents: 1042
diff changeset
114 #define XBIOS_centscreen (this->hidden->centscreen)
4198
6405314a7c07 Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
115 #define XBIOS_current (this->hidden->current)
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116
1042
0e7218843cfb Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents: 989
diff changeset
117 /*--- Functions prototypes ---*/
0e7218843cfb Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents: 989
diff changeset
118
4194
05c9e942cc46 Preliminary work to support the Milan video bios, that will gives access to 24 or 32 bpp modes. I used the svga driver as model to dynamically build video modes list.
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
119 void SDL_XBIOS_AddMode(_THIS, int actually_add, const xbiosmode_t *modeinfo);
1042
0e7218843cfb Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents: 989
diff changeset
120
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121 #endif /* _SDL_xbios_h */