Commit b02edf20 authored by Sam Lantinga's avatar Sam Lantinga

Removed outdated Nano-X support

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403815
parent 351e3d48
=================================================================
Patch version 0.9 of SDL(Simple DirectMedia Layer) for Nano-X API
=================================================================
Authors: Hsieh-Fu Tsai, clare@setabox.com
Greg Haerr, greg@censoft.com
This patch is against SDL version 1.2.4.
It enhances previous patch 0.8 by providing direct framebuffer
access as well as dynamic hardware pixel type support, not
requiring a compile-time option setting for different framebuffer
modes.
Tested against Microwindows version 0.89pre9.
Older Microwindows versions
===========================
If running on a version older than Microwindows 0.89pre9,
the following items might need to be patched in Microwindows.
1. Patch src/nanox/client.c::GrClose()
It fixes the client side GrClose(). In the original version,
GrOpen() can only be called once. When the GrOpen() is called at
the second time, the program will terminate. In order to prevent
this situation, we need to insert "nxSocket = -1" after
"close(nxSocket)" in GrClose(). If you do not have this problem,
you may skip this step.
2. Patch src/nanox/clientfb.c to return absolute x,y coordinates
when using GrGetWindowFBInfo(). Copy the version 0.89pre9
of src/nanox/clientfb.c to your system, or configure
using --disable-nanox-direct-fb.
=============
Quick Install
=============
1. ./configure --disable-video-x11 --disable-video-fbcon \
--enable-video-nanox \
--with-nanox-pixel-type=[rgb/0888/888/565/555/332/pal]
2. make clean
3. make
4. make install (as root)
============
Nitty-gritty
============
--enable-nanox-direct-fb Use direct framebuffer access
--enable-nanox-debug Show debug messages
--enable-nanox-share-memory Use shared-memory to speed up
When running multi-threaded applications using SDL, such
as SMPEG, set THREADSAFE=Y in Microwindows' config file,
to enable GrXXX() system call critical section support.
=============================================
Some programs can be used to test this patch.
=============================================
1. http://www.cs.berkeley.edu/~weimer/atris (a tetris-like game)
2. http://www.libsdl.org/projects/newvox/
3. http://www.libsdl.org/projects/xflame/
4. http://www.libsdl.org/projects/optimum/
5. http://www.gnugeneration.com/software/loop/
6: http://www.lokigames.com/development/smpeg.php3 (SMPEG version 0.4.4)
=========
Todo List
=========
1. Create hardware surface
2. Create YUVOverlay on hardware
3. Use OpenGL
4. Gamma correction
5. Hide/Change mouse pointer
6. Better window movement control with direct fb access
7. Palette handling in 8bpp could be improved
=====================
Supporting Institutes
=====================
Many thanks to go to Setabox Co., Ltd. and CML (Communication and
Multimedia Laboratory, http://www.cmlab.csie.ntu.edu.tw/) in the
Department of Computer Science and Information Engineering of
National Taiwan University for supporting this porting project.
Century Embedded Technologies (http://embedded.censoft.com)
for this patch.
===================
Contact Information
===================
Welcome to give me any suggestion and to report bugs.
My e-mail address : clare@setabox.com or niky@cmlab.csie.ntu.edu.tw
or greg@censoft.com
......@@ -943,42 +943,6 @@ CheckVisibilityHidden()
}
dnl Find the nanox include and library directories
CheckNANOX()
{
AC_ARG_ENABLE(video-nanox,
AC_HELP_STRING([--enable-video-nanox], [use nanox video driver [[default=no]]]),
, enable_video_nanox=no)
if test x$enable_video = xyes -a x$enable_video_nanox = xyes; then
AC_ARG_ENABLE(nanox-debug,
AC_HELP_STRING([--enable-nanox-debug], [print debug messages [[default=no]]]),
, enable_nanox_debug=no)
if test x$enable_nanox_debug = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -DENABLE_NANOX_DEBUG"
fi
AC_ARG_ENABLE(nanox-share-memory,
AC_HELP_STRING([--enable-nanox-share-memory], [use share memory [[default=no]]]),
, enable_nanox_share_memory=no)
if test x$enable_nanox_share_memory = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -DNANOX_SHARE_MEMORY"
fi
AC_ARG_ENABLE(nanox_direct_fb,
AC_HELP_STRING([--enable-nanox-direct-fb], [use direct framebuffer access [[default=no]]]),
, enable_nanox_direct_fb=no)
if test x$enable_nanox_direct_fb = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -DENABLE_NANOX_DIRECT_FB"
fi
AC_DEFINE(SDL_VIDEO_DRIVER_NANOX)
SOURCES="$SOURCES $srcdir/src/video/nanox/*.c"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lnano-X"
have_video=yes
fi
}
dnl Find the X11 include and library directories
CheckX11()
{
......@@ -2422,7 +2386,6 @@ case "$host" in
CheckESD
CheckNAS
CheckX11
CheckNANOX
CheckFBCON
CheckDirectFB
CheckFusionSound
......
......@@ -256,7 +256,6 @@
#undef SDL_VIDEO_DRIVER_DUMMY
#undef SDL_VIDEO_DRIVER_FBCON
#undef SDL_VIDEO_DRIVER_GEM
#undef SDL_VIDEO_DRIVER_NANOX
#undef SDL_VIDEO_DRIVER_NDS
#undef SDL_VIDEO_DRIVER_PHOTON
#undef SDL_VIDEO_DRIVER_QNXGF
......
......@@ -112,23 +112,6 @@ struct SDL_SysWMinfo
} info;
};
#elif defined(SDL_VIDEO_DRIVER_NANOX)
#include <microwin/nano-X.h>
/* The generic custom event structure */
struct SDL_SysWMmsg
{
SDL_version version;
int data;
};
/* The windows custom window manager information structure */
struct SDL_SysWMinfo
{
SDL_version version;
GR_WINDOW_ID window; /* The display window */
};
#elif defined(SDL_VIDEO_DRIVER_WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
......
......@@ -341,9 +341,6 @@ extern VideoBootStrap COCOA_bootstrap;
#if SDL_VIDEO_DRIVER_X11
extern VideoBootStrap X11_bootstrap;
#endif
#if SDL_VIDEO_DRIVER_NANOX
extern VideoBootStrap NX_bootstrap;
#endif
#if SDL_VIDEO_DRIVER_WSCONS
extern VideoBootStrap WSCONS_bootstrap;
#endif
......
......@@ -55,9 +55,6 @@ static VideoBootStrap *bootstrap[] = {
#if SDL_VIDEO_DRIVER_X11
&X11_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_NANOX
&NX_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_WSCONS
&WSCONS_bootstrap,
#endif
......
This diff is collapsed.
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
Copyright (C) 2001 Hsieh-Fu Tsai
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
Hsieh-Fu Tsai
clare@setabox.com
*/
#include "SDL_config.h"
#include "SDL_nxvideo.h"
// Functions to be exported
extern void NX_InitOSKeymap(_THIS);
extern void NX_PumpEvents(_THIS);
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
Copyright (C) 2001 Hsieh-Fu Tsai
Copyright (C) 2002 Greg Haerr <greg@censoft.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
Hsieh-Fu Tsai
clare@setabox.com
*/
#include "SDL_config.h"
#include "SDL_nximage_c.h"
void
NX_NormalUpdate(_THIS, int numrects, SDL_Rect * rects)
{
int i, j, xinc, yinc, destinc, rowinc;
int x, y, w, h;
unsigned char *src = NULL, *dest = NULL;
Dprintf("enter NX_NormalUpdate\n");
/* These are the values for the incoming image */
xinc = this->screen->format->BytesPerPixel;
yinc = this->screen->pitch;
for (i = 0; i < numrects; ++i) {
x = rects[i].x, y = rects[i].y;
w = rects[i].w, h = rects[i].h;
src = SDL_Image + y * yinc + x * xinc;
#ifdef ENABLE_NANOX_DIRECT_FB
if (Clientfb) {
if (currently_fullscreen)
dest =
fbinfo.winpixels + (((y + OffsetY) * fbinfo.pitch) +
((x + OffsetX) * fbinfo.bytespp));
else
dest =
fbinfo.winpixels + ((y * fbinfo.pitch) +
(x * fbinfo.bytespp));
destinc = fbinfo.pitch;
} else
#endif
{
dest = Image_buff;
destinc = w * xinc;
}
rowinc = w * xinc;
// apply GammaRamp table
if ((pixel_type == MWPF_TRUECOLOR0888
|| pixel_type == MWPF_TRUECOLOR888) && GammaRamp_R
&& GammaRamp_G && GammaRamp_B) {
Uint8 *ptrsrc;
Uint8 *ptrdst;
int k;
for (j = h; j > 0; --j, src += yinc, dest += destinc) {
ptrsrc = src;
ptrdst = dest;
for (k = w; k > 0; --k) {
*ptrdst++ = GammaRamp_B[*ptrsrc++] >> 8;
*ptrdst++ = GammaRamp_G[*ptrsrc++] >> 8;
*ptrdst++ = GammaRamp_R[*ptrsrc++] >> 8;
*ptrdst++ = 0;
++ptrsrc;
}
}
}
#if 1 /* This is needed for microwindows 0.90 or older */
else if (pixel_type == MWPF_TRUECOLOR0888
|| pixel_type == MWPF_TRUECOLOR888) {
Uint8 *ptrsrc;
Uint8 *ptrdst;
int k;
for (j = h; j > 0; --j, src += yinc, dest += destinc) {
ptrsrc = src;
ptrdst = dest;
for (k = w; k > 0; --k) {
*ptrdst++ = *ptrsrc++;
*ptrdst++ = *ptrsrc++;
*ptrdst++ = *ptrsrc++;
*ptrdst++ = 0;
++ptrsrc;
}
}
}
#endif
else {
for (j = h; j > 0; --j, src += yinc, dest += destinc)
SDL_memcpy(dest, src, rowinc);
}
if (!Clientfb) {
if (currently_fullscreen) {
GrArea(FSwindow, SDL_GC, x + OffsetX, y + OffsetY, w,
h, Image_buff, pixel_type);
} else {
GrArea(SDL_Window, SDL_GC, x, y, w, h, Image_buff,
pixel_type);
}
}
}
GrFlush();
Dprintf("leave NX_NormalUpdate\n");
}
int
NX_SetupImage(_THIS, SDL_Surface * screen)
{
int size = screen->h * screen->pitch;
Dprintf("enter NX_SetupImage\n");
screen->pixels = (void *) SDL_malloc(size);
if (!Clientfb) {
Image_buff = (unsigned char *) SDL_malloc(size);
if (screen->pixels == NULL || Image_buff == NULL) {
SDL_free(screen->pixels);
SDL_free(Image_buff);
SDL_OutOfMemory();
return -1;
}
}
SDL_Image = (unsigned char *) screen->pixels;
this->UpdateRects = NX_NormalUpdate;
Dprintf("leave NX_SetupImage\n");
return 0;
}
void
NX_DestroyImage(_THIS, SDL_Surface * screen)
{
Dprintf("enter NX_DestroyImage\n");
if (SDL_Image)
SDL_free(SDL_Image);
if (Image_buff)
SDL_free(Image_buff);
if (screen)
screen->pixels = NULL;
Dprintf("leave NX_DestroyImage\n");
}
int
NX_ResizeImage(_THIS, SDL_Surface * screen, Uint32 flags)
{
int retval;
GR_SCREEN_INFO si;
Dprintf("enter NX_ResizeImage\n");
NX_DestroyImage(this, screen);
retval = NX_SetupImage(this, screen);
GrGetScreenInfo(&si);
OffsetX = (si.cols - screen->w) / 2;
OffsetY = (si.rows - screen->h) / 2;
#ifdef ENABLE_NANOX_DIRECT_FB
if (Clientfb) {
/* Get current window position and fb pointer */
if (currently_fullscreen)
GrGetWindowFBInfo(FSwindow, &fbinfo);
else
GrGetWindowFBInfo(SDL_Window, &fbinfo);
}
#endif
Dprintf("leave NX_ResizeImage\n");
return retval;
}
void
NX_RefreshDisplay(_THIS)
{
Dprintf("enter NX_RefreshDisplay\n");
// Don't refresh a display that doesn't have an image (like GL)
if (!SDL_Image) {
return;
}
#ifdef ENABLE_NANOX_DIRECT_FB
if (Clientfb) {
int j;
char *src, *dest = NULL;
int xinc, yinc, rowinc;
GrGetWindowFBInfo(SDL_Window, &fbinfo);
xinc = this->screen->format->BytesPerPixel;
yinc = this->screen->pitch;
src = SDL_Image;
if (currently_fullscreen)
dest = fbinfo.winpixels + ((OffsetY * fbinfo.pitch) +
(OffsetX * fbinfo.bytespp));
else
dest = fbinfo.winpixels;
rowinc = xinc * this->screen->w;
for (j = this->screen->h; j > 0;
--j, src += yinc, dest += fbinfo.pitch)
SDL_memcpy(dest, src, rowinc);
} else
#endif
{
if (currently_fullscreen) {
GrArea(FSwindow, SDL_GC, OffsetX, OffsetY, this->screen->w,
this->screen->h, SDL_Image, pixel_type);
} else {
GrArea(SDL_Window, SDL_GC, 0, 0, this->screen->w,
this->screen->h, SDL_Image, pixel_type);
}
}
GrFlush();
Dprintf("leave NX_RefreshDisplay\n");
}
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
Copyright (C) 2001 Hsieh-Fu Tsai
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
Hsieh-Fu Tsai
clare@setabox.com
*/
#include "SDL_config.h"
#include "SDL_nxvideo.h"
extern int NX_SetupImage(_THIS, SDL_Surface * screen);
extern void NX_DestroyImage(_THIS, SDL_Surface * screen);
extern int NX_ResizeImage(_THIS, SDL_Surface * screen, Uint32 flags);
extern void NX_NormalUpdate(_THIS, int numrects, SDL_Rect * rects);
extern void NX_RefreshDisplay(_THIS);
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
Copyright (C) 2001 Hsieh-Fu Tsai
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
Hsieh-Fu Tsai
clare@setabox.com
*/
#include "SDL_config.h"
#include "SDL_stdinc.h"
#include "SDL_nxmodes_c.h"
SDL_Rect **
NX_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags)
{
if (flags & SDL_FULLSCREEN)
return SDL_modelist;
if (SDL_Visual.bpp == format->BitsPerPixel) {
return ((SDL_Rect **) - 1);
} else {
return ((SDL_Rect **) 0);
}
}
void
NX_FreeVideoModes(_THIS)
{
int i;
if (SDL_modelist) {
for (i = 0; SDL_modelist[i]; ++i) {
SDL_free(SDL_modelist[i]);
}
SDL_free(SDL_modelist);
SDL_modelist = NULL;
}
}
int
NX_EnterFullScreen(_THIS)
{
if (!currently_fullscreen) {
GR_SCREEN_INFO si;
GrGetScreenInfo(&si);
GrResizeWindow(FSwindow, si.cols, si.rows);
GrUnmapWindow(SDL_Window);
GrMapWindow(FSwindow);
GrRaiseWindow(FSwindow);
GrSetFocus(FSwindow);
currently_fullscreen = 1;
}
return 1;
}
int
NX_LeaveFullScreen(_THIS)
{
if (currently_fullscreen) {
GrUnmapWindow(FSwindow);
GrMapWindow(SDL_Window);
GrRaiseWindow(SDL_Window);
GrSetFocus(SDL_Window);
currently_fullscreen = 0;
}
return 0;
}
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
Copyright (C) 2001 Hsieh-Fu Tsai
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
Hsieh-Fu Tsai
clare@setabox.com
*/
#include "SDL_config.h"
#include "SDL_nxvideo.h"
extern SDL_Rect **NX_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags);
extern void NX_FreeVideoModes(_THIS);
extern int NX_EnterFullScreen(_THIS);
extern int NX_LeaveFullScreen(_THIS);
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
Copyright (C) 2001 Hsieh-Fu Tsai
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
Hsieh-Fu Tsai
clare@setabox.com
*/
#include "SDL_config.h"
#include "../../events/SDL_events_c.h"
#include "SDL_nxmouse_c.h"
// The implementation dependent data for the window manager cursor
struct WMcursor
{
int unused;
};
WMcursor *
NX_CreateWMCursor(_THIS,
Uint8 * data, Uint8 * mask, int w, int h, int hot_x,
int hot_y)
{
WMcursor *cursor;
Dprintf("enter NX_CreateWMCursor\n");
cursor = (WMcursor *) SDL_malloc(sizeof(WMcursor));
if (cursor == NULL) {
SDL_OutOfMemory();
return NULL;
}
Dprintf("leave NX_CreateWMCursor\n");
return cursor;
}
void
NX_FreeWMCursor(_THIS, WMcursor * cursor)
{
Dprintf("NX_FreeWMCursor\n");
SDL_free(cursor);
return;
}
void
NX_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
{
GR_WINDOW_INFO info;
Dprintf("enter NX_WarpWMCursor\n");
SDL_Lock_EventThread();
GrGetWindowInfo(SDL_Window, &info);
GrMoveCursor(info.x + x, info.y + y);
SDL_Unlock_EventThread();
Dprintf("leave NX_WarpWMCursor\n");
}
int
NX_ShowWMCursor(_THIS, WMcursor * cursor)
{
Dprintf("NX_ShowWMCursor\n");
return 1;
}
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#include "SDL_nxvideo.h"
extern WMcursor *NX_CreateWMCursor(_THIS, Uint8 * data, Uint8 * mask, int w,
int h, int hot_x, int hot_y);
void NX_FreeWMCursor(_THIS, WMcursor * cursor);
extern void NX_WarpWMCursor(_THIS, Uint16 x, Uint16 y);
extern int NX_ShowWMCursor(_THIS, WMcursor * cursor);
/* vi: set ts=4 sw=4 expandtab: */
This diff is collapsed.
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
Copyright (C) 2001 Hsieh-Fu Tsai
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
Hsieh-Fu Tsai
clare@setabox.com
*/
#include "SDL_config.h"
#ifndef _SDL_nxvideo_h
#define _SDL_nxvideo_h
#include <microwin/nano-X.h>
#include "../SDL_sysvideo.h"
#ifdef ENABLE_NANOX_DEBUG
#define Dprintf printf
#else
#define Dprintf(ignore...)
#endif
// Hidden "this" pointer for the video functions
#define _THIS SDL_VideoDevice * this
// Private display data
typedef struct NX_SDL_VISUAL
{
int bpp;
Uint32 red_mask;
Uint32 green_mask;
Uint32 blue_mask;
} nx_sdl_visual_t;
struct SDL_PrivateVideoData
{
GR_WINDOW_ID SDL_Window;
GR_WINDOW_ID FSwindow;
// Flag: true if we have been passed a window
char *SDL_windowid;
GR_GC_ID GC;
unsigned char *Image;
unsigned char *Image_buff; /* for GrArea */
unsigned char *Clientfb; /* for DirectFB */
nx_sdl_visual_t SDL_Visual;
// The current list of available video modes
SDL_Rect **modelist;
int currently_fullscreen;
// for fullscreen
int OffsetX, OffsetY;
// for GammaRamp
Uint16 *GammaRamp_R, *GammaRamp_G, *GammaRamp_B;
// for GrArea, r_mask, g_mask, b_mask
int pixel_type;
#ifdef ENABLE_NANOX_DIRECT_FB
GR_WINDOW_FB_INFO fbinfo;
#endif
};
#define SDL_Window (this -> hidden -> SDL_Window)
#define FSwindow (this -> hidden -> FSwindow)
#define SDL_windowid (this -> hidden -> SDL_windowid)
#define SDL_GC (this -> hidden -> GC)
#define SDL_Image (this -> hidden -> Image)
#define Image_buff (this -> hidden -> Image_buff)
#define Clientfb (this -> hidden -> Clientfb)
#define SDL_Visual (this -> hidden -> SDL_Visual)
#define SDL_modelist (this -> hidden -> modelist)
#define currently_fullscreen (this -> hidden -> currently_fullscreen)
#define OffsetX (this -> hidden -> OffsetX)
#define OffsetY (this -> hidden -> OffsetY)
#define GammaRamp_R (this -> hidden -> GammaRamp_R)
#define GammaRamp_G (this -> hidden -> GammaRamp_G)
#define GammaRamp_B (this -> hidden -> GammaRamp_B)
#define pixel_type (this -> hidden -> pixel_type)
#define fbinfo (this -> hidden -> fbinfo)
#define CI_SIZE 256 // color index size
#endif // _SDL_nxvideo_h
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
Copyright (C) 2001 Hsieh-Fu Tsai
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
Hsieh-Fu Tsai
clare@setabox.com
*/
#include "SDL_config.h"
#include "SDL_syswm.h"
#include "../../events/SDL_events_c.h"
#include "SDL_nxwm_c.h"
void
NX_SetCaption(_THIS, const char *title, const char *icon)
{
Dprintf("enter NX_SetCaption\n");
// Lock the event thread, in multi-threading environments
SDL_Lock_EventThread();
if (SDL_Window)
GrSetWindowTitle(SDL_Window, title);
SDL_Unlock_EventThread();
Dprintf("leave NX_SetCaption\n");
}
int
NX_GetWMInfo(_THIS, SDL_SysWMinfo * info)
{
Dprintf("enter NX_GetWMInfo\n");
if (info->version.major <= SDL_MAJOR_VERSION) {
info->window = SDL_Window;
return 1;
} else {
SDL_SetError("Application not compiled with SDL %d.%d\n",
SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
return -1;
}
Dprintf("leave NX_GetWMInfo\n");
}
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
Copyright (C) 2001 Hsieh-Fu Tsai
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
Hsieh-Fu Tsai
clare@setabox.com
*/
#include "SDL_config.h"
#include "SDL_nxvideo.h"
// Functions to be exported
extern void NX_SetCaption(_THIS, const char *title, const char *icon);
extern int NX_GetWMInfo(_THIS, SDL_SysWMinfo * info);
/* vi: set ts=4 sw=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment