Commit 367f76c1 authored by Sam Lantinga's avatar Sam Lantinga

Added initial support for Nano-X (thanks Hsieh-Fu!)

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%4031
parent 6216069a
=================================================================
Patch version 0.8 of SDL(Simple DirectMedia Layer) for Nano-X API
=================================================================
Author: Hsieh-Fu Tsai, clare@setabox.com
There are two patch files in this package.
1. The first patch file, nanox.patch, is to fix a bug in Nano-X.
This patch is proposed by Gary James (gjames@twcny.rr.com).
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.
=============
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
============
--with-nanox-pixel-type=[rgb/0888/888/565/555/332/pal]
If the wrong pixel type is used, the program will crash when the
sub-routine updates the screen. This option depends on SCREEN_PIXTYPE
which is defined in Microwin0.89pre7/src/config. SCREEN_PIXTYPE
is used to define the pixel type in Microwindows/Nano-X.
I only test the program when the pixel type is in "rgb"
(Microwin under X11) or "888" (framebuffer in 24-bit).
--enable-nanox-debug Show debug messages
--enable-nanox-share-memory Use shared-memory to speed up
=============================================
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/
=========
Todo List
=========
1. Create hardware surface
2. Create YUVOverlay on hardware
3. Use OpenGL
4. Gamma correction
5. Hide/Change mouse pointer
=====================
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.
===================
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
...@@ -403,6 +403,49 @@ CheckNASM() ...@@ -403,6 +403,49 @@ CheckNASM()
fi fi
} }
dnl Find the nanox include and library directories
CheckNANOX()
{
AC_ARG_ENABLE(video-nanox,
[ --enable-video-nanox use nanox video driver [default=no]],
, enable_video_nanox=no)
AC_ARG_ENABLE(nanox-debug,
[ --enable-nanox-debug print debug messages [default=no]],
, enable_nanox_debug=no)
AC_ARG_ENABLE(nanox-share-memory,
[ --enable-nanox-share-memory use share memory [default=no]],
, enable_nanox_share_memory=no)
AC_ARG_WITH(nanox_pixel_type,
[ --with-nanox-pixel-type=[rgb/0888/888/565/555/332/pal]])
if test x$enable_video = xyes -a x$enable_video_nanox = xyes; then
if test x$enable_nanox_debug = xyes; then
CFLAGS="$CFLAGS -DENABLE_NANOX_DEBUG"
fi
if test x$enable_nanox_share_memory = xyes; then
CFLAGS="$CFLAGS -DNANOX_SHARE_MEMORY"
fi
case "$with_nanox_pixel_type" in
rgb) CFLAGS="$CFLAGS -DNANOX_PIXEL_RGB" ;;
0888) CFLAGS="$CFLAGS -DNANOX_PIXEL_0888" ;;
888) CFLAGS="$CFLAGS -DNANOX_PIXEL_888" ;;
565) CFLAGS="$CFLAGS -DNANOX_PIXEL_565" ;;
555) CFLAGS="$CFLAGS -DNANOX_PIXEL_555" ;;
332) CFLAGS="$CFLAGS -DNANOX_PIXEL_332" ;;
pal) CFLAGS="$CFLAGS -DNANOX_PIXEL_PAL" ;;
*) AC_MSG_ERROR([Invalid nanox_pixel_type]);;
esac
CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_NANOX"
SYSTEM_LIBS="$SYSTEM_LIBS -lnano-X"
VIDEO_SUBDIRS="$VIDEO_SUBDIRS nanox"
VIDEO_DRIVERS="$VIDEO_DRIVERS nanox/libvideo_nanox.la"
fi
}
dnl Find the X11 include and library directories dnl Find the X11 include and library directories
CheckX11() CheckX11()
{ {
...@@ -1042,6 +1085,7 @@ case "$target" in ...@@ -1042,6 +1085,7 @@ case "$target" in
CheckESD CheckESD
CheckNAS CheckNAS
CheckX11 CheckX11
CheckNANOX
CheckDGA CheckDGA
CheckFBCON CheckFBCON
CheckGGI CheckGGI
...@@ -1921,6 +1965,7 @@ src/video/Makefile ...@@ -1921,6 +1965,7 @@ src/video/Makefile
src/video/cybergfx/Makefile src/video/cybergfx/Makefile
src/video/x11/Makefile src/video/x11/Makefile
src/video/dga/Makefile src/video/dga/Makefile
src/video/nanox/Makefile
src/video/fbcon/Makefile src/video/fbcon/Makefile
src/video/ggi/Makefile src/video/ggi/Makefile
src/video/maccommon/Makefile src/video/maccommon/Makefile
......
...@@ -16,6 +16,7 @@ be found at the <A HREF="http://www.libsdl.org/"> main SDL page</A>. ...@@ -16,6 +16,7 @@ be found at the <A HREF="http://www.libsdl.org/"> main SDL page</A>.
Major changes since SDL 1.0.0: Major changes since SDL 1.0.0:
</H2> </H2>
<UL> <UL>
<LI> 1.2.1: Added initial support for Nano-X (thanks Hsieh-Fu!)
<LI> 1.2.1: Fixed endian detection on IA64 architectures (thanks Bill!) <LI> 1.2.1: Fixed endian detection on IA64 architectures (thanks Bill!)
<LI> 1.2.1: Added --disable-dga configure option to disable DGA <LI> 1.2.1: Added --disable-dga configure option to disable DGA
<LI> 1.2.1: Fixed stuck keys when changing the video mode <LI> 1.2.1: Fixed stuck keys when changing the video mode
......
...@@ -50,7 +50,7 @@ typedef struct SDL_SysWMinfo SDL_SysWMinfo; ...@@ -50,7 +50,7 @@ typedef struct SDL_SysWMinfo SDL_SysWMinfo;
/* This is the structure for custom window manager events */ /* This is the structure for custom window manager events */
#if (defined(unix) || defined(__unix__) || defined(_AIX)) && \ #if (defined(unix) || defined(__unix__) || defined(_AIX)) && \
(!defined(DISABLE_X11) && !defined(__CYGWIN32__)) (defined(ENABLE_X11) && !defined(__CYGWIN32__))
/* AIX is unix, of course, but the native compiler CSet doesn't define unix */ /* AIX is unix, of course, but the native compiler CSet doesn't define unix */
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xatom.h> #include <X11/Xatom.h>
...@@ -95,6 +95,21 @@ typedef struct { ...@@ -95,6 +95,21 @@ typedef struct {
} info; } info;
} SDL_SysWMinfo; } SDL_SysWMinfo;
#elif defined(ENABLE_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 */
typedef struct {
SDL_version version ;
GR_WINDOW_ID window ; /* The display window */
} SDL_SysWMinfo;
#elif defined(WIN32) #elif defined(WIN32)
#include <windows.h> #include <windows.h>
......
...@@ -5,7 +5,7 @@ noinst_LTLIBRARIES = libvideo.la ...@@ -5,7 +5,7 @@ noinst_LTLIBRARIES = libvideo.la
# Define which subdirectories need to be built # Define which subdirectories need to be built
SUBDIRS = @VIDEO_SUBDIRS@ SUBDIRS = @VIDEO_SUBDIRS@
DIST_SUBDIRS = dummy x11 dga fbcon svga ggi aalib \ DIST_SUBDIRS = dummy x11 dga nanox fbcon svga ggi aalib \
wincommon windib windx5 \ wincommon windib windx5 \
maccommon macdsp macrom bwindow photon cybergfx maccommon macdsp macrom bwindow photon cybergfx
......
...@@ -331,6 +331,9 @@ extern VideoBootStrap X11_bootstrap; ...@@ -331,6 +331,9 @@ extern VideoBootStrap X11_bootstrap;
#ifdef ENABLE_DGA #ifdef ENABLE_DGA
extern VideoBootStrap DGA_bootstrap; extern VideoBootStrap DGA_bootstrap;
#endif #endif
#ifdef ENABLE_NANOX
extern VideoBootStrap NX_bootstrap;
#endif
#ifdef ENABLE_FBCON #ifdef ENABLE_FBCON
extern VideoBootStrap FBCON_bootstrap; extern VideoBootStrap FBCON_bootstrap;
#endif #endif
......
...@@ -51,6 +51,9 @@ static VideoBootStrap *bootstrap[] = { ...@@ -51,6 +51,9 @@ static VideoBootStrap *bootstrap[] = {
#ifdef ENABLE_DGA #ifdef ENABLE_DGA
&DGA_bootstrap, &DGA_bootstrap,
#endif #endif
#ifdef ENABLE_NANOX
&NX_bootstrap,
#endif
#ifdef ENABLE_FBCON #ifdef ENABLE_FBCON
&FBCON_bootstrap, &FBCON_bootstrap,
#endif #endif
......
## Makefile.am for SDL using the nanox video driver
noinst_LTLIBRARIES = libvideo_nanox.la
libvideo_nanox_la_SOURCES = $(NANOX_SRCS)
# The SDL nanox video driver sources
NANOX_SRCS = \
SDL_nxmodes.c \
SDL_nxmodes_c.h \
SDL_nxmouse.c \
SDL_nxmouse_c.h \
SDL_nxvideo.c \
SDL_nxvideo.h \
SDL_nxwm.c \
SDL_nxwm_c.h \
SDL_nxevents.c \
SDL_nxevents_c.h \
SDL_nximage.c \
SDL_nximage_c.h
This diff is collapsed.
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997, 1998, 1999, 2000, 2001 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@devolution.com
Hsieh-Fu Tsai
clare@setabox.com
*/
#include "SDL_nxvideo.h"
// Functions to be exported
extern void NX_InitOSKeymap (_THIS) ;
extern void NX_PumpEvents (_THIS) ;
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997, 1998, 1999, 2000, 2001 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@devolution.com
Hsieh-Fu Tsai
clare@setabox.com
*/
#include <stdlib.h>
#include "SDL_error.h"
#include "SDL_nximage_c.h"
void NX_NormalUpdate (_THIS, int numrects, SDL_Rect * rects)
{
int i, j, xinc, yinc, destinc ;
int x, y, w, h ;
unsigned char * src = NULL, * dest = NULL ;
Dprintf ("enter NX_NormalUpdate\n") ;
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 ;
dest = Image_buff ;
destinc = w * xinc ;
// apply GammaRamp table
#if (defined (NANOX_PIXEL_RGB) || defined (NANOX_PIXEL_0888) || \
defined (NANOX_PIXEL_888))
if (GammaRamp_R && GammaRamp_G && GammaRamp_B) {
Uint8 * ptr ;
int k ;
for (j = h; j > 0; -- j, src += yinc) {
ptr = src - 1 ;
for (k = w; k > 0; -- k) {
#ifdef NANOX_PIXEL_RGB
ptr += 2 ;
#endif
#ifdef NANOX_PIXEL_0888
ptr += 2 ;
#endif
#ifdef NANOX_PIXEL_888
++ ptr ;
#endif
(* ptr) = GammaRamp_B [(* ptr)] ;
++ ptr ;
(* ptr) = GammaRamp_G [(* ptr)] ;
++ ptr ;
(* ptr) = GammaRamp_R [(* ptr)] ;
}
}
src = SDL_Image + y * yinc + x * xinc ;
}
#endif // apply Gamma table
for (j = h; j > 0; -- j, src += yinc, dest += destinc) {
memcpy (dest, src, destinc) ;
}
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) ;
}
}
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 *) malloc (size) ;
Image_buff = (unsigned char *) malloc (size) ;
if (screen -> pixels == NULL || Image_buff == NULL) {
free (screen -> pixels) ;
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) free (SDL_Image) ;
if (Image_buff) 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 ;
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;
}
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) ;
}
Dprintf ("leave NX_RefreshDisplay\n") ;
}
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997, 1998, 1999, 2000, 2001 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@devolution.com
Hsieh-Fu Tsai
clare@setabox.com
*/
#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) ;
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997, 1998, 1999, 2000, 2001 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@devolution.com
Hsieh-Fu Tsai
clare@setabox.com
*/
#include <stdlib.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) {
free (SDL_modelist [i]) ;
}
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 ;
}
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997, 1998, 1999, 2000, 2001 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@devolution.com
Hsieh-Fu Tsai
clare@setabox.com
*/
#include "SDL_nxvideo.h"
#include <SDL/SDL.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) ;
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997, 1998, 1999, 2000, 2001 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@devolution.com
Hsieh-Fu Tsai
clare@setabox.com
*/
#include <stdlib.h>
#include "SDL_error.h"
#include "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 *) 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") ;
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 ;
}
#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) ;
This diff is collapsed.
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997, 1998, 1999, 2000, 2001 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@devolution.com
Hsieh-Fu Tsai
clare@setabox.com
*/
#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 ;
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 ;
} ;
#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 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 CI_SIZE 256 // color index size
#endif // _SDL_nxvideo_h
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997, 1998, 1999, 2000, 2001 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@devolution.com
Hsieh-Fu Tsai
clare@setabox.com
*/
#include <stdlib.h>
#include "SDL_syswm.h"
#include "SDL_error.h"
#include "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") ;
}
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997, 1998, 1999, 2000, 2001 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@devolution.com
Hsieh-Fu Tsai
clare@setabox.com
*/
#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) ;
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