Mercurial > sdl-ios-xcode
annotate src/video/qtopia/SDL_sysvideo.cc @ 1662:782fd950bd46 SDL-1.3
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid.
The code is now run through a consistent indent format:
indent -i4 -nut -nsc -br -ce
The headers are being converted to automatically generate doxygen documentation.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 28 May 2006 13:04:16 +0000 |
parents | e49147870aac |
children | 4da1ee79c9af |
rev | line source |
---|---|
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
6 modify it under the terms 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:
769
diff
changeset
|
7 License as published by the Free Software Foundation; either |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
13 Lesser General Public License for more details. |
371
db0cc6034336
Added David Hedbor's Qtopia patches
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:
769
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:
769
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:
769
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
19 Sam Lantinga |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
20 slouken@libsdl.org |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
21 */ |
1403
376665398b25
Catch the C++ and Objective C sources too...
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
22 #include "SDL_config.h" |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 |
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 /* Qtopia based framebuffer implementation */ |
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 |
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 #include <unistd.h> |
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 |
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 #include <qapplication.h> |
379
11c8a7684f74
Date: Fri, 24 May 2002 10:32:00 -0700
Sam Lantinga <slouken@libsdl.org>
parents:
371
diff
changeset
|
29 #include <qpe/qpeapplication.h> |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 |
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 #include "SDL_timer.h" |
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 |
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 #include "SDL_QWin.h" |
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
34 |
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:
1658
diff
changeset
|
35 extern "C" |
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:
1658
diff
changeset
|
36 { |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
38 #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
|
39 #include "../../events/SDL_events_c.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
40 #include "SDL_sysevents_c.h" |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 #include "SDL_sysmouse_c.h" |
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 #include "SDL_syswm_c.h" |
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 #include "SDL_lowvideo.h" |
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 |
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:
1658
diff
changeset
|
45 //#define QTOPIA_DEBUG |
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:
1658
diff
changeset
|
46 #define QT_HIDDEN_SIZE 32 /* starting hidden window size */ |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 |
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:
1658
diff
changeset
|
48 /* Name of the environment variable used to invert the screen rotation or not: |
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:
1658
diff
changeset
|
49 Possible values: |
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:
1658
diff
changeset
|
50 !=0 : Screen is 270° rotated |
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:
1658
diff
changeset
|
51 0: Screen is 90° rotated */ |
481
c96e2137f9eb
Date: Sat, 31 Aug 2002 15:42:45 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
379
diff
changeset
|
52 #define SDL_QT_ROTATION_ENV_NAME "SDL_QT_INVERT_ROTATION" |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 |
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:
1658
diff
changeset
|
54 /* Initialization/Query functions */ |
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:
1658
diff
changeset
|
55 static int QT_VideoInit (_THIS, SDL_PixelFormat * vformat); |
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:
1658
diff
changeset
|
56 static SDL_Rect **QT_ListModes (_THIS, SDL_PixelFormat * format, |
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:
1658
diff
changeset
|
57 Uint32 flags); |
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:
1658
diff
changeset
|
58 static SDL_Surface *QT_SetVideoMode (_THIS, SDL_Surface * current, |
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:
1658
diff
changeset
|
59 int width, int height, int bpp, |
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:
1658
diff
changeset
|
60 Uint32 flags); |
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:
1658
diff
changeset
|
61 static void QT_UpdateMouse (_THIS); |
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:
1658
diff
changeset
|
62 static int QT_SetColors (_THIS, int firstcolor, int ncolors, |
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:
1658
diff
changeset
|
63 SDL_Color * colors); |
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:
1658
diff
changeset
|
64 static void QT_VideoQuit (_THIS); |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
65 |
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:
1658
diff
changeset
|
66 /* Hardware surface functions */ |
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:
1658
diff
changeset
|
67 static int QT_AllocHWSurface (_THIS, SDL_Surface * surface); |
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:
1658
diff
changeset
|
68 static int QT_LockHWSurface (_THIS, SDL_Surface * surface); |
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:
1658
diff
changeset
|
69 static void QT_UnlockHWSurface (_THIS, SDL_Surface * surface); |
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:
1658
diff
changeset
|
70 static void QT_FreeHWSurface (_THIS, SDL_Surface * surface); |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 |
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:
1658
diff
changeset
|
72 static int QT_ToggleFullScreen (_THIS, int fullscreen); |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
73 |
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:
1658
diff
changeset
|
74 static int QT_IconifyWindow (_THIS); |
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:
1658
diff
changeset
|
75 static SDL_GrabMode QT_GrabInput (_THIS, SDL_GrabMode mode); |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
76 |
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:
1658
diff
changeset
|
77 /* FB driver bootstrap functions */ |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 |
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:
1658
diff
changeset
|
79 static int QT_Available (void) |
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:
1658
diff
changeset
|
80 { |
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:
1658
diff
changeset
|
81 return (1); |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 } |
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 |
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:
1658
diff
changeset
|
84 static void QT_DeleteDevice (SDL_VideoDevice * device) |
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:
1658
diff
changeset
|
85 { |
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:
1658
diff
changeset
|
86 SDL_free (device->hidden); |
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:
1658
diff
changeset
|
87 SDL_free (device); |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 } |
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 |
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:
1658
diff
changeset
|
90 static SDL_VideoDevice *QT_CreateDevice (int devindex) |
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:
1658
diff
changeset
|
91 { |
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:
1658
diff
changeset
|
92 SDL_VideoDevice *device; |
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:
1658
diff
changeset
|
93 |
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:
1658
diff
changeset
|
94 /* Initialize all variables that we clean on shutdown */ |
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:
1658
diff
changeset
|
95 device = (SDL_VideoDevice *) SDL_malloc (sizeof (SDL_VideoDevice)); |
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:
1658
diff
changeset
|
96 if (device) { |
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:
1658
diff
changeset
|
97 SDL_memset (device, 0, (sizeof *device)); |
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:
1658
diff
changeset
|
98 device->hidden = (struct SDL_PrivateVideoData *) |
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:
1658
diff
changeset
|
99 SDL_malloc ((sizeof *device->hidden)); |
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:
1658
diff
changeset
|
100 } |
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:
1658
diff
changeset
|
101 if ((device == NULL) || (device->hidden == NULL)) { |
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:
1658
diff
changeset
|
102 SDL_OutOfMemory (); |
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:
1658
diff
changeset
|
103 if (device) { |
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:
1658
diff
changeset
|
104 SDL_free (device); |
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:
1658
diff
changeset
|
105 } |
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:
1658
diff
changeset
|
106 return (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:
1658
diff
changeset
|
107 } |
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:
1658
diff
changeset
|
108 SDL_memset (device->hidden, 0, (sizeof *device->hidden)); |
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:
1658
diff
changeset
|
109 |
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:
1658
diff
changeset
|
110 /* Set the function pointers */ |
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:
1658
diff
changeset
|
111 device->VideoInit = QT_VideoInit; |
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:
1658
diff
changeset
|
112 device->ListModes = QT_ListModes; |
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:
1658
diff
changeset
|
113 device->SetVideoMode = QT_SetVideoMode; |
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:
1658
diff
changeset
|
114 device->UpdateMouse = QT_UpdateMouse; |
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:
1658
diff
changeset
|
115 device->SetColors = QT_SetColors; |
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:
1658
diff
changeset
|
116 device->UpdateRects = NULL; |
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:
1658
diff
changeset
|
117 device->VideoQuit = QT_VideoQuit; |
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:
1658
diff
changeset
|
118 device->AllocHWSurface = QT_AllocHWSurface; |
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:
1658
diff
changeset
|
119 device->CheckHWBlit = NULL; |
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:
1658
diff
changeset
|
120 device->FillHWRect = NULL; |
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:
1658
diff
changeset
|
121 device->SetHWColorKey = NULL; |
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:
1658
diff
changeset
|
122 device->SetHWAlpha = NULL; |
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:
1658
diff
changeset
|
123 device->LockHWSurface = QT_LockHWSurface; |
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:
1658
diff
changeset
|
124 device->UnlockHWSurface = QT_UnlockHWSurface; |
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:
1658
diff
changeset
|
125 device->FlipHWSurface = NULL; |
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:
1658
diff
changeset
|
126 device->FreeHWSurface = QT_FreeHWSurface; |
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:
1658
diff
changeset
|
127 device->SetIcon = NULL; |
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:
1658
diff
changeset
|
128 device->SetCaption = QT_SetWMCaption; |
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:
1658
diff
changeset
|
129 device->IconifyWindow = QT_IconifyWindow; |
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:
1658
diff
changeset
|
130 device->GrabInput = QT_GrabInput; |
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:
1658
diff
changeset
|
131 device->GetWMInfo = NULL; |
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:
1658
diff
changeset
|
132 device->FreeWMCursor = QT_FreeWMCursor; |
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:
1658
diff
changeset
|
133 device->CreateWMCursor = QT_CreateWMCursor; |
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:
1658
diff
changeset
|
134 device->ShowWMCursor = QT_ShowWMCursor; |
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:
1658
diff
changeset
|
135 device->WarpWMCursor = QT_WarpWMCursor; |
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:
1658
diff
changeset
|
136 device->InitOSKeymap = QT_InitOSKeymap; |
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:
1658
diff
changeset
|
137 device->PumpEvents = QT_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:
1658
diff
changeset
|
138 |
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:
1658
diff
changeset
|
139 device->free = QT_DeleteDevice; |
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:
1658
diff
changeset
|
140 device->ToggleFullScreen = QT_ToggleFullScreen; |
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:
1658
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:
1658
diff
changeset
|
142 /* Set the driver flags */ |
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:
1658
diff
changeset
|
143 device->handles_any_size = 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:
1658
diff
changeset
|
144 |
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:
1658
diff
changeset
|
145 return device; |
371
db0cc6034336
Added David Hedbor's Qtopia patches
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:
1658
diff
changeset
|
147 |
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:
1658
diff
changeset
|
148 VideoBootStrap Qtopia_bootstrap = { |
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:
1658
diff
changeset
|
149 "qtopia", "Qtopia / QPE graphics", |
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:
1658
diff
changeset
|
150 QT_Available, QT_CreateDevice |
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:
1658
diff
changeset
|
151 }; |
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:
1658
diff
changeset
|
152 |
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:
1658
diff
changeset
|
153 /* Function to sort the display_list */ |
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:
1658
diff
changeset
|
154 static int CompareModes (const void *A, const void *B) |
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:
1658
diff
changeset
|
155 { |
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:
1658
diff
changeset
|
156 #if 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:
1658
diff
changeset
|
157 const display_mode *a = (display_mode *) A; |
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:
1658
diff
changeset
|
158 const display_mode *b = (display_mode *) B; |
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:
1658
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:
1658
diff
changeset
|
160 if (a->space == b->space) { |
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:
1658
diff
changeset
|
161 return ((b->virtual_width * b->virtual_height) - |
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:
1658
diff
changeset
|
162 (a->virtual_width * a->virtual_height)); |
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:
1658
diff
changeset
|
163 } 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:
1658
diff
changeset
|
164 return (ColorSpaceToBitsPerPixel (b->space) - |
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:
1658
diff
changeset
|
165 ColorSpaceToBitsPerPixel (a->space)); |
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:
1658
diff
changeset
|
166 } |
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:
1658
diff
changeset
|
167 #endif |
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:
1658
diff
changeset
|
168 return 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:
1658
diff
changeset
|
169 } |
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:
1658
diff
changeset
|
170 |
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:
1658
diff
changeset
|
171 /* Yes, this isn't the fastest it could be, but it works nicely */ |
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:
1658
diff
changeset
|
172 static int QT_AddMode (_THIS, int index, unsigned int w, unsigned int h) |
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:
1658
diff
changeset
|
173 { |
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:
1658
diff
changeset
|
174 SDL_Rect *mode; |
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:
1658
diff
changeset
|
175 int i; |
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:
1658
diff
changeset
|
176 int next_mode; |
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:
1658
diff
changeset
|
177 |
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:
1658
diff
changeset
|
178 /* Check to see if we already have this mode */ |
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:
1658
diff
changeset
|
179 if (SDL_nummodes[index] > 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:
1658
diff
changeset
|
180 for (i = SDL_nummodes[index] - 1; i >= 0; --i) { |
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:
1658
diff
changeset
|
181 mode = SDL_modelist[index][i]; |
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:
1658
diff
changeset
|
182 if ((mode->w == w) && (mode->h == h)) { |
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:
1658
diff
changeset
|
183 return (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:
1658
diff
changeset
|
184 } |
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:
1658
diff
changeset
|
185 } |
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:
1658
diff
changeset
|
186 } |
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:
1658
diff
changeset
|
187 |
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:
1658
diff
changeset
|
188 /* Set up the new video mode rectangle */ |
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:
1658
diff
changeset
|
189 mode = (SDL_Rect *) SDL_malloc (sizeof *mode); |
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:
1658
diff
changeset
|
190 if (mode == NULL) { |
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:
1658
diff
changeset
|
191 SDL_OutOfMemory (); |
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:
1658
diff
changeset
|
192 return (-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:
1658
diff
changeset
|
193 } |
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:
1658
diff
changeset
|
194 mode->x = 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:
1658
diff
changeset
|
195 mode->y = 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:
1658
diff
changeset
|
196 mode->w = w; |
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:
1658
diff
changeset
|
197 mode->h = h; |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
198 #ifdef QTOPIA_DEBUG |
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:
1658
diff
changeset
|
199 fprintf (stderr, "Adding mode %dx%d at %d bytes per pixel\n", w, h, |
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:
1658
diff
changeset
|
200 index + 1); |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
201 #endif |
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
202 |
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:
1658
diff
changeset
|
203 /* Allocate the new list of modes, and fill in the new mode */ |
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:
1658
diff
changeset
|
204 next_mode = SDL_nummodes[index]; |
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:
1658
diff
changeset
|
205 SDL_modelist[index] = (SDL_Rect **) |
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:
1658
diff
changeset
|
206 SDL_realloc (SDL_modelist[index], |
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:
1658
diff
changeset
|
207 (1 + next_mode + 1) * sizeof (SDL_Rect *)); |
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:
1658
diff
changeset
|
208 if (SDL_modelist[index] == NULL) { |
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:
1658
diff
changeset
|
209 SDL_OutOfMemory (); |
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:
1658
diff
changeset
|
210 SDL_nummodes[index] = 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:
1658
diff
changeset
|
211 SDL_free (mode); |
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:
1658
diff
changeset
|
212 return (-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:
1658
diff
changeset
|
213 } |
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:
1658
diff
changeset
|
214 SDL_modelist[index][next_mode] = mode; |
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:
1658
diff
changeset
|
215 SDL_modelist[index][next_mode + 1] = NULL; |
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:
1658
diff
changeset
|
216 SDL_nummodes[index]++; |
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:
1658
diff
changeset
|
217 |
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:
1658
diff
changeset
|
218 return (0); |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
219 } |
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
220 |
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:
1658
diff
changeset
|
221 int QT_VideoInit (_THIS, SDL_PixelFormat * vformat) |
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:
1658
diff
changeset
|
222 { |
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:
1658
diff
changeset
|
223 /* Initialize the QPE 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:
1658
diff
changeset
|
224 /* Determine the screen depth */ |
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:
1658
diff
changeset
|
225 vformat->BitsPerPixel = QPixmap::defaultDepth (); |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
226 |
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:
1658
diff
changeset
|
227 // For now we hardcode the current depth because anything 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:
1658
diff
changeset
|
228 // might as well be emulated by SDL rather than by Qtopia. |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
229 |
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:
1658
diff
changeset
|
230 QSize desktop_size = qApp->desktop ()->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:
1658
diff
changeset
|
231 QT_AddMode (_this, ((vformat->BitsPerPixel + 7) / 8) - 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:
1658
diff
changeset
|
232 desktop_size.width (), desktop_size.height ()); |
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:
1658
diff
changeset
|
233 QT_AddMode (_this, ((vformat->BitsPerPixel + 7) / 8) - 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:
1658
diff
changeset
|
234 desktop_size.height (), desktop_size.width ()); |
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:
1658
diff
changeset
|
235 |
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:
1658
diff
changeset
|
236 /* Determine the current screen 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:
1658
diff
changeset
|
237 this->info.current_w = desktop_size.width (); |
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:
1658
diff
changeset
|
238 this->info.current_h = desktop_size.height (); |
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:
1658
diff
changeset
|
239 |
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:
1658
diff
changeset
|
240 /* Create the window / widget */ |
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:
1658
diff
changeset
|
241 SDL_Win = new SDL_QWin (QSize (QT_HIDDEN_SIZE, QT_HIDDEN_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:
1658
diff
changeset
|
242 ((QPEApplication *) qApp)->showMainWidget (SDL_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:
1658
diff
changeset
|
243 /* Fill in some window manager capabilities */ |
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:
1658
diff
changeset
|
244 _this->info.wm_available = 0; |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
245 |
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:
1658
diff
changeset
|
246 /* We're done! */ |
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:
1658
diff
changeset
|
247 return (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:
1658
diff
changeset
|
248 } |
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:
1658
diff
changeset
|
249 |
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:
1658
diff
changeset
|
250 /* We support any dimension at our bit-depth */ |
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:
1658
diff
changeset
|
251 SDL_Rect **QT_ListModes (_THIS, SDL_PixelFormat * format, Uint32 flags) |
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:
1658
diff
changeset
|
252 { |
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:
1658
diff
changeset
|
253 SDL_Rect **modes; |
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:
1403
diff
changeset
|
254 |
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:
1658
diff
changeset
|
255 modes = ((SDL_Rect **) 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:
1658
diff
changeset
|
256 if ((flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) { |
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:
1658
diff
changeset
|
257 modes = SDL_modelist[((format->BitsPerPixel + 7) / 8) - 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:
1658
diff
changeset
|
258 } 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:
1658
diff
changeset
|
259 if (format->BitsPerPixel == _this->screen->format->BitsPerPixel) { |
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:
1658
diff
changeset
|
260 modes = ((SDL_Rect **) - 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:
1658
diff
changeset
|
261 } |
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:
1658
diff
changeset
|
262 } |
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:
1658
diff
changeset
|
263 return (modes); |
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:
1658
diff
changeset
|
264 } |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
265 |
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:
1658
diff
changeset
|
266 /* Various screen update functions available */ |
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:
1658
diff
changeset
|
267 static void QT_NormalUpdate (_THIS, int numrects, SDL_Rect * rects); |
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:
1658
diff
changeset
|
268 |
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:
1658
diff
changeset
|
269 |
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:
1658
diff
changeset
|
270 static int QT_SetFullScreen (_THIS, SDL_Surface * screen, int fullscreen) |
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:
1658
diff
changeset
|
271 { |
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:
1658
diff
changeset
|
272 return -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:
1658
diff
changeset
|
273 } |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
274 |
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:
1658
diff
changeset
|
275 static int QT_ToggleFullScreen (_THIS, int fullscreen) |
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:
1658
diff
changeset
|
276 { |
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:
1658
diff
changeset
|
277 return -1; |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
278 } |
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
279 |
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:
1658
diff
changeset
|
280 /* FIXME: check return values and cleanup here */ |
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:
1658
diff
changeset
|
281 SDL_Surface *QT_SetVideoMode (_THIS, SDL_Surface * current, |
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:
1658
diff
changeset
|
282 int width, int height, int bpp, |
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:
1658
diff
changeset
|
283 Uint32 flags) |
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:
1658
diff
changeset
|
284 { |
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:
1658
diff
changeset
|
285 |
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:
1658
diff
changeset
|
286 QImage *qimage; |
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:
1658
diff
changeset
|
287 QSize desktop_size = qApp->desktop ()->size (); |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
288 |
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
289 |
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:
1658
diff
changeset
|
290 current->flags = 0; //SDL_FULLSCREEN; // We always run fullscreen. |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
291 |
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:
1658
diff
changeset
|
292 if (width <= desktop_size.width () |
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:
1658
diff
changeset
|
293 && height <= desktop_size.height ()) { |
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:
1658
diff
changeset
|
294 current->w = desktop_size.width (); |
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:
1658
diff
changeset
|
295 current->h = desktop_size.height (); |
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:
1658
diff
changeset
|
296 } else if (width <= desktop_size.height () |
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:
1658
diff
changeset
|
297 && height <= desktop_size.width ()) { |
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:
1658
diff
changeset
|
298 // Landscape mode |
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:
1658
diff
changeset
|
299 char *envString = SDL_getenv (SDL_QT_ROTATION_ENV_NAME); |
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:
1658
diff
changeset
|
300 int envValue = envString ? atoi (envString) : 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:
1658
diff
changeset
|
301 screenRotation = |
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:
1658
diff
changeset
|
302 envValue ? SDL_QT_ROTATION_270 : SDL_QT_ROTATION_90; |
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:
1658
diff
changeset
|
303 current->h = desktop_size.width (); |
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:
1658
diff
changeset
|
304 current->w = desktop_size.height (); |
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:
1658
diff
changeset
|
305 } 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:
1658
diff
changeset
|
306 SDL_SetError ("Unsupported resolution, %dx%d\n", width, height); |
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:
1658
diff
changeset
|
307 } |
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:
1658
diff
changeset
|
308 if (flags & SDL_INTERNALOPENGL) { |
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:
1658
diff
changeset
|
309 SDL_SetError ("OpenGL not supported"); |
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:
1658
diff
changeset
|
310 return (NULL); |
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:
1658
diff
changeset
|
311 } |
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:
1658
diff
changeset
|
312 /* Create the QImage framebuffer */ |
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:
1658
diff
changeset
|
313 qimage = new QImage (current->w, current->h, bpp); |
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:
1658
diff
changeset
|
314 if (qimage->isNull ()) { |
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:
1658
diff
changeset
|
315 SDL_SetError ("Couldn't create screen bitmap"); |
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:
1658
diff
changeset
|
316 delete qimage; |
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:
1658
diff
changeset
|
317 return (NULL); |
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:
1658
diff
changeset
|
318 } |
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:
1658
diff
changeset
|
319 current->pitch = qimage->bytesPerLine (); |
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:
1658
diff
changeset
|
320 current->pixels = (void *) qimage->bits (); |
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:
1658
diff
changeset
|
321 SDL_Win->setImage (qimage); |
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:
1658
diff
changeset
|
322 _this->UpdateRects = QT_NormalUpdate; |
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:
1658
diff
changeset
|
323 SDL_Win->setFullscreen (true); |
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:
1658
diff
changeset
|
324 /* We're done */ |
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:
1658
diff
changeset
|
325 return (current); |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
326 } |
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:
1658
diff
changeset
|
327 |
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:
1658
diff
changeset
|
328 /* Update the current mouse state and position */ |
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:
1658
diff
changeset
|
329 void QT_UpdateMouse (_THIS) |
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:
1658
diff
changeset
|
330 { |
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:
1658
diff
changeset
|
331 QPoint point (-1, -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:
1658
diff
changeset
|
332 if (SDL_Win->isActiveWindow ()) { |
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:
1658
diff
changeset
|
333 point = SDL_Win->mousePos (); |
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:
1658
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:
1658
diff
changeset
|
335 |
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:
1658
diff
changeset
|
336 if ((point.x () >= 0) && (point.x () < SDL_VideoSurface->w) && |
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:
1658
diff
changeset
|
337 (point.y () >= 0) && (point.y () < SDL_VideoSurface->h)) { |
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:
1658
diff
changeset
|
338 SDL_PrivateAppActive (1, SDL_APPMOUSEFOCUS); |
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:
1658
diff
changeset
|
339 SDL_PrivateMouseMotion (0, 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:
1658
diff
changeset
|
340 (Sint16) point.x (), (Sint16) point.y ()); |
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:
1658
diff
changeset
|
341 } 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:
1658
diff
changeset
|
342 SDL_PrivateAppActive (0, SDL_APPMOUSEFOCUS); |
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:
1658
diff
changeset
|
343 } |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
344 } |
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
345 |
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:
1658
diff
changeset
|
346 /* We don't actually allow hardware surfaces other than the main one */ |
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:
1658
diff
changeset
|
347 static int QT_AllocHWSurface (_THIS, SDL_Surface * surface) |
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:
1658
diff
changeset
|
348 { |
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:
1658
diff
changeset
|
349 return (-1); |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
350 } |
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:
1658
diff
changeset
|
351 static void QT_FreeHWSurface (_THIS, SDL_Surface * surface) |
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:
1658
diff
changeset
|
352 { |
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:
1658
diff
changeset
|
353 return; |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
354 } |
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:
1658
diff
changeset
|
355 static int QT_LockHWSurface (_THIS, SDL_Surface * surface) |
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:
1658
diff
changeset
|
356 { |
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:
1658
diff
changeset
|
357 return (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:
1658
diff
changeset
|
358 } |
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:
1658
diff
changeset
|
359 static void QT_UnlockHWSurface (_THIS, SDL_Surface * surface) |
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:
1658
diff
changeset
|
360 { |
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:
1658
diff
changeset
|
361 return; |
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:
1658
diff
changeset
|
362 } |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
363 |
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:
1658
diff
changeset
|
364 static void QT_NormalUpdate (_THIS, int numrects, SDL_Rect * rects) |
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:
1658
diff
changeset
|
365 { |
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:
1658
diff
changeset
|
366 if (SDL_Win->lockScreen ()) { |
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:
1658
diff
changeset
|
367 for (int i = 0; i < numrects; ++i) { |
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:
1658
diff
changeset
|
368 QRect rect (rects[i].x, rects[i].y, rects[i].w, rects[i].h); |
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:
1658
diff
changeset
|
369 SDL_Win->repaintRect (rect); |
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:
1658
diff
changeset
|
370 } |
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:
1658
diff
changeset
|
371 SDL_Win->unlockScreen (); |
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:
1658
diff
changeset
|
372 } |
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:
1658
diff
changeset
|
373 } |
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:
1658
diff
changeset
|
374 /* Is the system palette settable? */ |
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:
1658
diff
changeset
|
375 int QT_SetColors (_THIS, int firstcolor, int ncolors, SDL_Color * colors) |
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:
1658
diff
changeset
|
376 { |
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:
1658
diff
changeset
|
377 return -1; |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
378 } |
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:
1658
diff
changeset
|
379 |
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:
1658
diff
changeset
|
380 void QT_VideoQuit (_THIS) |
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:
1658
diff
changeset
|
381 { |
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:
1658
diff
changeset
|
382 // This is dumb, but if I free this, the app doesn't exit correctly. |
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:
1658
diff
changeset
|
383 // Of course, this will leak memory if init video is done more than once. |
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:
1658
diff
changeset
|
384 // Sucks but such is life. |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
385 |
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:
1658
diff
changeset
|
386 // -- David Hedbor |
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:
1658
diff
changeset
|
387 // delete SDL_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:
1658
diff
changeset
|
388 // SDL_Win = 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:
1658
diff
changeset
|
389 _this->screen->pixels = NULL; |
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:
1658
diff
changeset
|
390 QT_GrabInput (_this, SDL_GRAB_OFF); |
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:
1658
diff
changeset
|
391 } |
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:
1658
diff
changeset
|
392 |
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:
1658
diff
changeset
|
393 static int QT_IconifyWindow (_THIS) |
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:
1658
diff
changeset
|
394 { |
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:
1658
diff
changeset
|
395 SDL_Win->hide (); |
567 | 396 |
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:
1658
diff
changeset
|
397 return true; |
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:
1658
diff
changeset
|
398 } |
371
db0cc6034336
Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
399 |
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:
1658
diff
changeset
|
400 static SDL_GrabMode QT_GrabInput (_THIS, SDL_GrabMode mode) |
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:
1658
diff
changeset
|
401 { |
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:
1658
diff
changeset
|
402 if (mode == SDL_GRAB_OFF) { |
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:
1658
diff
changeset
|
403 QPEApplication::grabKeyboard (); |
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:
1658
diff
changeset
|
404 qApp->processEvents (); |
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:
1658
diff
changeset
|
405 QPEApplication::ungrabKeyboard (); |
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:
1658
diff
changeset
|
406 } 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:
1658
diff
changeset
|
407 QPEApplication::grabKeyboard (); |
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:
1658
diff
changeset
|
408 } |
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:
1658
diff
changeset
|
409 qApp->processEvents (); |
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:
1658
diff
changeset
|
410 return mode; |
567 | 411 } |
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:
1658
diff
changeset
|
412 |
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:
1658
diff
changeset
|
413 }; /* Extern C */ |
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:
1658
diff
changeset
|
414 |
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:
1658
diff
changeset
|
415 /* vi: set ts=4 sw=4 expandtab: */ |