annotate src/video/picogui/SDL_pgvideo.c @ 1358:c71e05b4dc2e

More header massaging... works great on Windows. ;-)
author Sam Lantinga <slouken@libsdl.org>
date Fri, 10 Feb 2006 06:48:43 +0000
parents 604d73db6802
children 19418e4422cb
rev   line source
433
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
3 Copyright (C) 1997-2006 Sam Lantinga
433
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
6 modify it under the terms of the GNU Lesser General Public
433
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
433
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
13 Lesser General Public License for more details.
433
706de3956894 Added initial support for PicoGUI (thanks Micah!)
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
433
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22 Micah Dowty
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23 micahjd@users.sourceforge.net
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 #include "SDL_video.h"
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27 #include "SDL_mouse.h"
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 #include "SDL_sysvideo.h"
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 #include "SDL_pixels_c.h"
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 #include "SDL_events_c.h"
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 #include "SDL_pgvideo.h"
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 #include "SDL_pgevents_c.h"
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 #define PGVID_DRIVER_NAME "picogui"
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 /* Initialization/Query functions */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 static int PG_VideoInit(_THIS, SDL_PixelFormat *vformat);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 static SDL_Rect **PG_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 static SDL_Surface *PG_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 static int PG_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 static void PG_VideoQuit(_THIS);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44 /* Hardware surface functions */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 static int PG_AllocHWSurface(_THIS, SDL_Surface *surface);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 static int PG_LockHWSurface(_THIS, SDL_Surface *surface);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47 static void PG_UnlockHWSurface(_THIS, SDL_Surface *surface);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48 static void PG_FreeHWSurface(_THIS, SDL_Surface *surface);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 /* etc. */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 static void PG_UpdateRects(_THIS, int numrects, SDL_Rect *rects);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53 // The implementation dependent data for the window manager cursor
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 struct WMcursor {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 /* Our cursor is a PicoGUI theme */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 pghandle theme;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 } ;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 /* WM functions */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 void PG_SetCaption(_THIS, const char *title, const char *icon);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 WMcursor * PG_CreateWMCursor (_THIS,Uint8 * data, Uint8 * mask,
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 int w, int h, int hot_x, int hot_y);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63 void PG_FreeWMCursor (_THIS, WMcursor * cursor);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 void PG_WarpWMCursor(_THIS, Uint16 x, Uint16 y);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 int PG_ShowWMCursor (_THIS, WMcursor * cursor);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 /* PicoGUI driver bootstrap functions */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 static int PG_Available(void)
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 /* FIXME: The current client lib doesn't give a way to see if the picogui
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 * server is reachable without causing a fatal error if it isn't.
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 * This should be fixed in cli_c2, but until then assume we can
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74 * connect. Since more common drivers like X11 are probed first anyway,
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75 * this shouldn't be a huge problem.
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 return(1);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 }
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 static void PG_DeleteDevice(SDL_VideoDevice *device)
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81 {
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
82 SDL_free(device->hidden);
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
83 SDL_free(device);
433
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 }
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 static SDL_VideoDevice *PG_CreateDevice(int devindex)
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87 {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88 SDL_VideoDevice *device;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90 /* Initialize all variables that we clean on shutdown */
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
91 device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice));
433
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 if ( device ) {
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
93 SDL_memset(device, 0, (sizeof *device));
433
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 device->hidden = (struct SDL_PrivateVideoData *)
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
95 SDL_malloc((sizeof *device->hidden));
433
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96 }
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97 if ( (device == NULL) || (device->hidden == NULL) ) {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98 SDL_OutOfMemory();
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 if ( device ) {
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
100 SDL_free(device);
433
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101 }
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102 return(0);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103 }
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
104 SDL_memset(device->hidden, 0, (sizeof *device->hidden));
433
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 /* Set the function pointers */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107 device->VideoInit = PG_VideoInit;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108 device->ListModes = PG_ListModes;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
109 device->SetVideoMode = PG_SetVideoMode;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110 device->CreateYUVOverlay = NULL;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
111 device->SetColors = PG_SetColors;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
112 device->UpdateRects = PG_UpdateRects;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
113 device->VideoQuit = PG_VideoQuit;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114 device->AllocHWSurface = PG_AllocHWSurface;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
115 device->CheckHWBlit = NULL;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116 device->FillHWRect = NULL;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117 device->SetHWColorKey = NULL;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118 device->SetHWAlpha = NULL;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119 device->LockHWSurface = PG_LockHWSurface;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120 device->UnlockHWSurface = PG_UnlockHWSurface;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121 device->FlipHWSurface = NULL;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
122 device->FreeHWSurface = PG_FreeHWSurface;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123 device->SetCaption = PG_SetCaption;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
124 device->SetIcon = NULL;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125 device->IconifyWindow = NULL;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126 device->GrabInput = NULL;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128 device->PumpEvents = PG_PumpEvents;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129 device->InitOSKeymap = PG_InitOSKeymap;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
131 device->ShowWMCursor = PG_ShowWMCursor;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
132 device->CreateWMCursor = PG_CreateWMCursor;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
133 device->FreeWMCursor = PG_FreeWMCursor;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
134 device->WarpWMCursor = PG_WarpWMCursor;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
135
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
136 device->free = PG_DeleteDevice;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
137
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138 return device;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
139 }
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
141 VideoBootStrap PG_bootstrap = {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
142 PGVID_DRIVER_NAME, "PicoGUI SDL driver",
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
143 PG_Available, PG_CreateDevice
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
144 };
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
145
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
146
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147 int PG_VideoInit(_THIS, SDL_PixelFormat *vformat)
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148 {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
149 /* Connect to the PicoGUI server. No way to process command line args yet,
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
150 * but since this is based on SHM it's not important to be able to specify
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
151 * a remote PicoGUI server.
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
152 *
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
153 * FIXME: Another nitpick about the current client lib is there's no
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 * clean way to indicate that command line args are not available.
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
155 */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
156 pgInit(0,(char**)"");
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157 this->hidden->mi = *pgGetVideoMode();
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159 /* Create a picogui application and canvas. We'll populate the canvas later. */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160 this->hidden->wApp = pgRegisterApp(PG_APP_NORMAL,"SDL",0);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
161 this->hidden->wCanvas = pgNewWidget(PG_WIDGET_CANVAS,0,0);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162 pgSetWidget(PGDEFAULT,
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163 PG_WP_SIDE, PG_S_ALL,
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
164 0);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166 PG_InitEvents(this);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
168 /* Determine the screen depth.
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
169 * We change this during the SDL_SetVideoMode implementation...
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170 * Round up to the nearest Bytes per pixel
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
171 */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
172 vformat->BitsPerPixel = this->hidden->mi.bpp;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
173 vformat->BytesPerPixel = this->hidden->mi.bpp >> 3;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
174 if (this->hidden->mi.bpp & 7)
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
175 vformat->BytesPerPixel++;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
176
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
177 /* We're done! */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
178 return(0);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
179 }
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
180
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
181 SDL_Rect **PG_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags)
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
182 {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
183 return (SDL_Rect **) -1;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
184 }
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
185
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
186 SDL_Surface *PG_SetVideoMode(_THIS, SDL_Surface *current,
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
187 int width, int height, int bpp, Uint32 flags)
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
188 {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
189 if ( this->hidden->bitmap ) {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
190 /* Free old bitmap */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
191 if (current->pixels) {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
192 shmdt(current->pixels);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
193 current->pixels = NULL;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
194 }
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
195 pgDelete(this->hidden->bitmap);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
196 }
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
197
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
198 /* Allocate the new pixel format for the screen */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
199 if ( ! SDL_ReallocFormat(current, bpp, 0, 0, 0, 0) ) {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
200 SDL_SetError("Couldn't allocate new pixel format for requested mode");
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
201 return(NULL);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
202 }
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
203
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
204 /* Create a new picogui bitmap */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
205 this->hidden->bitmap = pgCreateBitmap(width,height);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
206 this->hidden->shm = *pgMakeSHMBitmap(this->hidden->bitmap);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
207 current->pixels = shmat(shmget(this->hidden->shm.shm_key,
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
208 this->hidden->shm.shm_length,0),NULL,0);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
209
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
210 /* Reset the canvas, and draw persistent and incremental grops.
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
211 * Use mapping and offsets to center it.
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
212 */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
213
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
214 pgWriteCmd(this->hidden->wCanvas, PGCANVAS_NUKE, 0);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
215
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
216 /* 0. Set the source position during incremental rendering
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
217 */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
218 pgWriteCmd(this->hidden->wCanvas, PGCANVAS_GROP, 5, PG_GROP_SETSRC,0,0,0,0);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
219 pgWriteCmd(this->hidden->wCanvas, PGCANVAS_GROPFLAGS, 1, PG_GROPF_INCREMENTAL);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
220
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
221 /* 1. Incremental bitmap rendering
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
222 */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
223 pgWriteCmd(this->hidden->wCanvas, PGCANVAS_GROP, 6, PG_GROP_BITMAP,
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
224 0,0,0,0,this->hidden->bitmap);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
225 pgWriteCmd(this->hidden->wCanvas, PGCANVAS_GROPFLAGS, 1, PG_GROPF_INCREMENTAL);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
226
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
227 /* 2. Normal bitmap rendering
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
228 */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
229 pgWriteCmd(this->hidden->wCanvas, PGCANVAS_GROP, 6, PG_GROP_BITMAP,
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
230 0,0,this->hidden->shm.width,this->hidden->shm.height,this->hidden->bitmap);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
231
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
232 /* Set up the new mode framebuffer */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
233 current->flags = 0;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
234 current->w = this->hidden->shm.width;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
235 current->h = this->hidden->shm.height;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
236 current->pitch = this->hidden->shm.pitch;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
237
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
238 /* Set up pixel format */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
239 current->format->BitsPerPixel = this->hidden->shm.bpp;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
240 current->format->BytesPerPixel = this->hidden->shm.bpp >> 3;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
241 if (this->hidden->shm.bpp & 7)
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
242 current->format->BytesPerPixel++;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
243 current->format->palette = NULL;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
244 current->format->Rmask = this->hidden->shm.red_mask;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
245 current->format->Gmask = this->hidden->shm.green_mask;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
246 current->format->Bmask = this->hidden->shm.blue_mask;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
247 current->format->Amask = this->hidden->shm.alpha_mask;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
248 current->format->Rshift = this->hidden->shm.red_shift;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
249 current->format->Gshift = this->hidden->shm.green_shift;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
250 current->format->Bshift = this->hidden->shm.blue_shift;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
251 current->format->Ashift = this->hidden->shm.alpha_shift;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
252 current->format->Rloss = 8 - this->hidden->shm.red_length;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
253 current->format->Gloss = 8 - this->hidden->shm.green_length;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
254 current->format->Bloss = 8 - this->hidden->shm.blue_length;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
255 current->format->Aloss = 8 - this->hidden->shm.alpha_length;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
256
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
257 /* Draw the app */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
258 pgUpdate();
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
259
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
260 /* We're done */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
261 return(current);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
262 }
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
263
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
264 /* We don't actually allow hardware surfaces other than the main one */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
265 static int PG_AllocHWSurface(_THIS, SDL_Surface *surface)
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
266 {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
267 return(-1);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
268 }
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
269 static void PG_FreeHWSurface(_THIS, SDL_Surface *surface)
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
270 {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
271 return;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
272 }
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
273
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
274 /* We need to wait for vertical retrace on page flipped displays */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
275 static int PG_LockHWSurface(_THIS, SDL_Surface *surface)
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
276 {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
277 return(0);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
278 }
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
279
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
280 static void PG_UnlockHWSurface(_THIS, SDL_Surface *surface)
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
281 {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
282 return;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
283 }
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
284
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
285 static void PG_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
286 {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
287 int i;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
288
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
289 for (i = 0; i < numrects; i++) {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
290 if (rects[i].w <= 0 || rects[i].h <= 0)
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
291 continue;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
292
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
293 /* Schedule an incremental update for this rectangle, using
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
294 * the canvas gropnodes we've loaded beforehand.
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
295 */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
296 pgWriteCmd(this->hidden->wCanvas, PGCANVAS_FINDGROP, 1, 0);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
297 pgWriteCmd(this->hidden->wCanvas, PGCANVAS_MOVEGROP, 4,
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
298 rects[i].x, rects[i].y,
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
299 rects[i].w, rects[i].h);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
300 pgWriteCmd(this->hidden->wCanvas, PGCANVAS_FINDGROP, 1, 1);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
301 pgWriteCmd(this->hidden->wCanvas, PGCANVAS_MOVEGROP, 4,
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
302 rects[i].x, rects[i].y,
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
303 rects[i].w, rects[i].h);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
304
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
305 /* Go perform the update */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
306 pgWriteCmd(this->hidden->wCanvas, PGCANVAS_INCREMENTAL, 0);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
307 pgSubUpdate(this->hidden->wCanvas);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
308 }
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
309 }
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
310
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
311 int PG_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
312 {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
313 /* do nothing of note. */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
314 return(1);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
315 }
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
316
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
317 /* Note: If we are terminated, this could be called in the middle of
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
318 another SDL video routine -- notably UpdateRects.
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
319 */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
320 void PG_VideoQuit(_THIS)
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
321 {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
322 if (this->screen->pixels != NULL)
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
323 {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
324 shmdt(this->screen->pixels);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
325 this->screen->pixels = NULL;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
326 pgDelete(this->hidden->bitmap);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
327 }
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
328 pgDelete(this->hidden->wCanvas);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
329 pgDelete(this->hidden->wApp);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
330 }
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
331
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
332 void PG_SetCaption(_THIS, const char *title, const char *icon)
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
333 {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
334 if (title != NULL)
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
335 pgReplaceText(this->hidden->wApp, title);
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
336 pgUpdate();
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
337 }
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
338
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
339 /* FIXME: The cursor stuff isn't implemented yet! */
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
340
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
341 WMcursor * PG_CreateWMCursor (_THIS,Uint8 * data, Uint8 * mask,
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
342 int w, int h, int hot_x, int hot_y)
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
343 {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
344 static WMcursor dummy;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
345 return &dummy;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
346 }
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
347
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
348 void PG_FreeWMCursor (_THIS, WMcursor * cursor)
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
349 {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
350 }
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
351
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
352 void PG_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
353 {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
354 }
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
355
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
356 int PG_ShowWMCursor (_THIS, WMcursor * cursor)
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
357 {
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
358 return 1;
706de3956894 Added initial support for PicoGUI (thanks Micah!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
359 }