Skip to content

Commit f456a57

Browse files
committed
Added initial support for PicoGUI (thanks Micah!)
1 parent ac1213d commit f456a57

13 files changed

+692
-1
lines changed

Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ EXTRA_DIST = \
3030
README.MacOSX \
3131
README.MiNT \
3232
README.NanoX \
33+
README.PicoGUI \
3334
README.QNX \
3435
README.Qtopia \
3536
README.WinCE \

README.PicoGUI

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
========================
2+
Using SDL with PicoGUI
3+
========================
4+
5+
- Originally contributed by Micah Dowty <[email protected]>
6+
7+
PicoGUI is a scalable GUI system with a unique architecture, primarily focused
8+
on scalability to various embedded systems. You can find more information
9+
including a FAQ at http://picogui.org
10+
11+
To use the patch:
12+
13+
1. When compiling, add the "--enable-video-picogui" switch to ./configure
14+
15+
2. When running your program, ensure that the picogui driver for SDL
16+
is in use by setting the SDL_VIDEODRIVER environment variable
17+
to "picogui".
18+
19+
3. The program must also be linked to the C client library for PicoGUI
20+
(libpgui.so). If the program is being compiled with a patched SDL
21+
installed this should be done automatically. If you want to use an
22+
existing binary with PicoGUI, you can set the LD_PRELOAD environment
23+
variable to the path of your libpgui.so file.
24+
25+
Capabilities:
26+
27+
So far only basic functionality is provided on true color (linear16/24/32)
28+
devices. Accessing a memory mapped bitmap, updating the display, and handling
29+
mouse/keyboard input. This functionality has been tested with several
30+
applications, including mplayer, Xine, sldroids, and Abuse.
31+
32+
TODO list:
33+
34+
- YUV overlays will be helpful for watching video on set top boxes or other
35+
embedded devices that have some graphics acceleration hardware
36+
37+
- Account for rotated bitmap storage in pgserver
38+
39+
- Support for hiding or changing the cursor
40+
41+
- The display should be centered when the SDL application is smaller
42+
than the PicoGUI panel
43+
44+
- Fullscreen or any other special modes
45+
46+
- Support for indexed and grayscale modes
47+
48+
- Probably much more...
49+
50+
--- The End ---

configure.in

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,6 +1470,32 @@ CheckQtopia()
14701470
fi
14711471
}
14721472

1473+
dnl Set up the PicoGUI video driver if enabled
1474+
CheckPicoGUI()
1475+
{
1476+
AC_ARG_ENABLE(video-picogui,
1477+
[ --enable-video-picogui use PicoGUI video driver [default=no]],
1478+
, enable_video_picogui=no)
1479+
if test x$enable_video = xyes -a x$enable_video_picogui = xyes; then
1480+
AC_MSG_CHECKING(for PicoGUI support)
1481+
video_picogui=no
1482+
AC_TRY_COMPILE([
1483+
#include <picogui.h>
1484+
],[
1485+
],[
1486+
video_picogui=yes
1487+
])
1488+
AC_MSG_RESULT($video_picogui)
1489+
if test x$video_picogui = xyes; then
1490+
SDL_LIBS="$SDL_LIBS -lpgui"
1491+
CFLAGS="$CFLAGS -DENABLE_PICOGUI"
1492+
VIDEO_SUBDIRS="$VIDEO_SUBDIRS picogui"
1493+
VIDEO_DRIVERS="$VIDEO_DRIVERS picogui/libvideo_picogui.la"
1494+
fi
1495+
AC_LANG_C
1496+
fi
1497+
}
1498+
14731499
dnl Set up the Mac toolbox video driver for Mac OS 7-9
14741500
CheckTOOLBOX()
14751501
{
@@ -1676,6 +1702,7 @@ case "$target" in
16761702
CheckSVGA
16771703
CheckAAlib
16781704
CheckQtopia
1705+
CheckPicoGUI
16791706
CheckOpenGL
16801707
CheckInputEvents
16811708
CheckPTHREAD
@@ -2602,6 +2629,7 @@ src/video/ataricommon/Makefile
26022629
src/video/xbios/Makefile
26032630
src/video/gem/Makefile
26042631
src/video/qtopia/Makefile
2632+
src/video/picogui/Makefile
26052633
src/events/Makefile
26062634
src/joystick/Makefile
26072635
src/joystick/amigaos/Makefile

docs.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ <H2>
1616
Major changes since SDL 1.0.0:
1717
</H2>
1818
<UL>
19+
<LI> 1.2.5: Added initial support for PicoGUI (thanks Micah!)
1920
<LI> 1.2.5: Fixed SDL_DisplayFormatAlpha() on RGB surfaces with alpha
2021
<LI> 1.2.5: Fixed setting OpenGL mode multiple times on Windows
2122
<LI> 1.2.5: Added support for Qtopia on embedded systems (thanks David!)

src/video/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ SUBDIRS = @VIDEO_SUBDIRS@
88
DIST_SUBDIRS = dummy x11 dga nanox fbcon directfb vgl svga ggi aalib \
99
wincommon windib windx5 \
1010
maccommon macdsp macrom quartz \
11-
bwindow ps2gs photon cybergfx epoc \
11+
bwindow ps2gs photon cybergfx epoc picogui \
1212
ataricommon xbios gem XFree86
1313

1414
DRIVERS = @VIDEO_DRIVERS@

src/video/SDL_sysvideo.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,9 @@ extern VideoBootStrap GEM_bootstrap;
401401
#ifdef ENABLE_QTOPIA
402402
extern VideoBootStrap Qtopia_bootstrap;
403403
#endif
404+
#ifdef ENABLE_PICOGUI
405+
extern VideoBootStrap PG_bootstrap;
406+
#endif
404407
/* This is the current video device */
405408
extern SDL_VideoDevice *current_video;
406409

src/video/SDL_video.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ static VideoBootStrap *bootstrap[] = {
113113
#endif
114114
#ifdef ENABLE_QTOPIA
115115
&Qtopia_bootstrap,
116+
#endif
117+
#ifdef ENABLE_PICOGUI
118+
&PG_bootstrap,
116119
#endif
117120
NULL
118121
};

src/video/picogui/.cvsignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Makefile.in
2+
Makefile
3+
.libs
4+
*.o
5+
*.lo
6+
*.la

src/video/picogui/Makefile.am

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
## Makefile.am for SDL using the PicoGUI video driver
3+
4+
noinst_LTLIBRARIES = libvideo_picogui.la
5+
libvideo_picogui_la_SOURCES = $(PICOGUI_SRCS)
6+
7+
# The SDL PicoGUI video driver sources
8+
PICOGUI_SRCS = \
9+
SDL_pgevents.c \
10+
SDL_pgevents_c.h \
11+
SDL_pgvideo.c \
12+
SDL_pgvideo.h
13+

src/video/picogui/SDL_pgevents.c

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
/*
2+
SDL - Simple DirectMedia Layer
3+
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Library General Public
7+
License as published by the Free Software Foundation; either
8+
version 2 of the License, or (at your option) any later version.
9+
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
Library General Public License for more details.
14+
15+
You should have received a copy of the GNU Library General Public
16+
License along with this library; if not, write to the Free
17+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18+
19+
Sam Lantinga
20+
21+
22+
Micah Dowty
23+
24+
*/
25+
26+
#ifdef SAVE_RCSID
27+
static char rcsid =
28+
"@(#) $Id$";
29+
#endif
30+
31+
#include "SDL.h"
32+
#include "SDL_sysevents.h"
33+
#include "SDL_events_c.h"
34+
#include "SDL_pgvideo.h"
35+
#include "SDL_pgevents_c.h"
36+
37+
int PG_HandleClose(struct pgEvent *evt)
38+
{
39+
SDL_PrivateQuit();
40+
return 1; /* Intercept the event's normal quit handling */
41+
}
42+
43+
int PG_HandleResize(struct pgEvent *evt)
44+
{
45+
SDL_PrivateResize(evt->e.size.w, evt->e.size.h);
46+
return 0;
47+
}
48+
49+
int PG_HandleKey(struct pgEvent *evt)
50+
{
51+
SDL_keysym sym;
52+
memset(&sym,0,sizeof(sym));
53+
sym.sym = evt->e.kbd.key;
54+
sym.mod = evt->e.kbd.mods;
55+
SDL_PrivateKeyboard(evt->type == PG_WE_KBD_KEYDOWN, &sym);
56+
return 0;
57+
}
58+
59+
int PG_HandleChar(struct pgEvent *evt)
60+
{
61+
SDL_keysym sym;
62+
memset(&sym,0,sizeof(sym));
63+
sym.unicode = evt->e.kbd.key;
64+
sym.mod = evt->e.kbd.mods;
65+
SDL_PrivateKeyboard(evt->type == PG_WE_KBD_KEYDOWN, &sym);
66+
return 0;
67+
}
68+
69+
int PG_HandleMouseButton(struct pgEvent *evt)
70+
{
71+
/* We need to focus the canvas when it's clicked */
72+
if (evt->extra) {
73+
SDL_VideoDevice *this = (SDL_VideoDevice *) evt->extra;
74+
pgFocus(this->hidden->wCanvas);
75+
}
76+
SDL_PrivateMouseButton(evt->type == PG_WE_PNTR_DOWN, evt->e.pntr.chbtn,
77+
evt->e.pntr.x, evt->e.pntr.y);
78+
return 0;
79+
}
80+
81+
int PG_HandleMouseMotion(struct pgEvent *evt)
82+
{
83+
SDL_PrivateMouseMotion(evt->e.pntr.btn,0,evt->e.pntr.x, evt->e.pntr.y);
84+
return 0;
85+
}
86+
87+
void PG_PumpEvents(_THIS)
88+
{
89+
/* Process all pending events */
90+
pgEventPoll();
91+
}
92+
93+
void PG_InitOSKeymap(_THIS)
94+
{
95+
/* We need no keymap */
96+
}
97+
98+
void PG_InitEvents(_THIS)
99+
{
100+
/* Turn on all the mouse and keyboard triggers for our canvas, normally less important
101+
* events like mouse movement are ignored to save bandwidth. */
102+
pgSetWidget(this->hidden->wCanvas, PG_WP_TRIGGERMASK,
103+
pgGetWidget(this->hidden->wCanvas, PG_WP_TRIGGERMASK) |
104+
PG_TRIGGER_UP | PG_TRIGGER_DOWN | PG_TRIGGER_MOVE |
105+
PG_TRIGGER_KEYUP | PG_TRIGGER_KEYDOWN | PG_TRIGGER_CHAR,0);
106+
107+
/* Start our canvas out focused, so we get keyboard input */
108+
pgFocus(this->hidden->wCanvas);
109+
110+
/* Set up bindings for all the above event handlers */
111+
pgBind(this->hidden->wApp, PG_WE_CLOSE, &PG_HandleClose, NULL);
112+
pgBind(this->hidden->wCanvas, PG_WE_BUILD, &PG_HandleResize, NULL);
113+
pgBind(this->hidden->wCanvas, PG_WE_KBD_CHAR, &PG_HandleChar, NULL);
114+
pgBind(this->hidden->wCanvas, PG_WE_KBD_KEYUP, &PG_HandleKey, NULL);
115+
pgBind(this->hidden->wCanvas, PG_WE_KBD_KEYDOWN, &PG_HandleKey, NULL);
116+
pgBind(this->hidden->wCanvas, PG_WE_PNTR_MOVE, &PG_HandleMouseMotion, NULL);
117+
pgBind(this->hidden->wCanvas, PG_WE_PNTR_UP, &PG_HandleMouseButton, NULL);
118+
pgBind(this->hidden->wCanvas, PG_WE_PNTR_DOWN, &PG_HandleMouseButton, this);
119+
}
120+
121+
/* end of SDL_pgevents.c ... */

src/video/picogui/SDL_pgevents_c.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
SDL - Simple DirectMedia Layer
3+
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Library General Public
7+
License as published by the Free Software Foundation; either
8+
version 2 of the License, or (at your option) any later version.
9+
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
Library General Public License for more details.
14+
15+
You should have received a copy of the GNU Library General Public
16+
License along with this library; if not, write to the Free
17+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18+
19+
Sam Lantinga
20+
21+
22+
Micah Dowty
23+
24+
*/
25+
26+
#ifdef SAVE_RCSID
27+
static char rcsid =
28+
"@(#) $Id$";
29+
#endif
30+
31+
#include "SDL_pgvideo.h"
32+
33+
/* Variables and functions exported by SDL_sysevents.c to other parts
34+
of the native video subsystem (SDL_sysvideo.c)
35+
*/
36+
extern void PG_PumpEvents(_THIS);
37+
extern void PG_InitEvents(_THIS);
38+
extern void PG_InitOSKeymap(_THIS);
39+
40+
/* end of SDL_pgevents_c.h ... */
41+

0 commit comments

Comments
 (0)