Removed AmigaOS code for 1.3 branch.
authorRyan C. Gordon <icculus@icculus.org>
Sun, 29 Oct 2006 04:09:17 +0000
changeset 2062c9aa6bcb26f3
parent 2061 6051761b5934
child 2063 dea73e1d07b0
Removed AmigaOS code for 1.3 branch.
BUGS
README
README.AmigaOS
include/SDL.h
include/SDL_config.h.default
include/SDL_config.h.in
include/SDL_config_amiga.h
include/SDL_platform.h
src/joystick/amigaos/SDL_sysjoystick.c
src/thread/SDL_thread_c.h
src/thread/amigaos/SDL_syssem.c
src/thread/amigaos/SDL_systhread.c
src/thread/amigaos/SDL_systhread_c.h
src/thread/amigaos/SDL_thread.c
src/timer/amigaos/SDL_systimer.c
src/video/SDL_sysvideo.h
src/video/SDL_video.c
src/video/cybergfx/SDL_amigaevents.c
src/video/cybergfx/SDL_amigaevents_c.h
src/video/cybergfx/SDL_amigamouse.c
src/video/cybergfx/SDL_amigamouse_c.h
src/video/cybergfx/SDL_cgxaccel.c
src/video/cybergfx/SDL_cgxgl.c
src/video/cybergfx/SDL_cgxgl_c.h
src/video/cybergfx/SDL_cgximage.c
src/video/cybergfx/SDL_cgximage_c.h
src/video/cybergfx/SDL_cgxmodes.c
src/video/cybergfx/SDL_cgxmodes_c.h
src/video/cybergfx/SDL_cgxvideo.c
src/video/cybergfx/SDL_cgxvideo.h
src/video/cybergfx/SDL_cgxwm.c
src/video/cybergfx/SDL_cgxwm_c.h
test/testplatform.c
     1.1 --- a/BUGS	Sun Oct 29 03:39:13 2006 +0000
     1.2 +++ b/BUGS	Sun Oct 29 04:09:17 2006 +0000
     1.3 @@ -190,15 +190,3 @@
     1.4  	More information on this port is available at:
     1.5  	http://www.kom.e-technik.tu-darmstadt.de/~griff/SDL/
     1.6  
     1.7 -AmigaOS:  -= NOT YET SUPPORTED =-
     1.8 -	The OpenGL support isn't implemented yet.
     1.9 -
    1.10 -	SDL_WM_GrabInput() is not implemented.
    1.11 -	Does anyone know how to do this?  SDL_WM_GrabInput() is designed
    1.12 -	to prevent the user from switching input and mouse focus away from
    1.13 -	the SDL application.
    1.14 -
    1.15 -	Continuous relative mouse motion is not implemented.
    1.16 -
    1.17 -	The AmigaOS port was done by Gabriele.Greco@galactica.it
    1.18 -
     2.1 --- a/README	Sun Oct 29 03:39:13 2006 +0000
     2.2 +++ b/README	Sun Oct 29 04:09:17 2006 +0000
     2.3 @@ -14,7 +14,7 @@
     2.4  
     2.5  The current version supports Linux, Windows, Windows CE, BeOS, MacOS,
     2.6  Mac OS X, FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, IRIX, and QNX.
     2.7 -The code contains support for AmigaOS, Dreamcast, Atari, AIX, OSF/Tru64,
     2.8 +The code contains support for Dreamcast, Atari, AIX, OSF/Tru64,
     2.9  RISC OS, SymbianOS, and OS/2, but these are not officially supported.
    2.10  
    2.11  SDL is written in C, but works with C++ natively, and has bindings to
     3.1 --- a/README.AmigaOS	Sun Oct 29 03:39:13 2006 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,50 +0,0 @@
     3.4 -This is the porting of 1.2.0 version of SDL (the latest stable one)
     3.5 -to AmigaOS/68k.
     3.6 -
     3.7 -All the bugs known of the past version have been corrected. And I've
     3.8 -added all the new SDL features.
     3.9 -
    3.10 -This version of SDL needs Cybergraphx V3 (r69+) or CyberGraphX V4
    3.11 -and AHI v3+. Probably it works also with P96 or CGXAga, but it's 
    3.12 -untested.
    3.13 -
    3.14 -This version is available as linked library for SAS/C and GCC, only 68k this 
    3.15 -time, a powerup (ppcemu compatible) and a morphos version will be ready quite 
    3.16 -soon (i hope).
    3.17 -
    3.18 -Implemented:
    3.19 -
    3.20 -- 8/16/24/32bit video modes, both fullscreen and windowed.
    3.21 -- Hardware surfaces.
    3.22 -- CGX blitting acceleration.
    3.23 -- CGX colorkey blitting acceleration.
    3.24 -- AHI audio (8/16 bit, with any audio format), always uses unit 0 for now.
    3.25 -- Thread support (maybe not 100% compatible with other implementations)
    3.26 -- Semaphores 
    3.27 -- Window resizing and backdrop windows (NEW)
    3.28 -- Joystick/Joypad support.
    3.29 -
    3.30 -To do:
    3.31 -
    3.32 -- CDRom audio playing support
    3.33 -- OpenGL (A guy was working on it but I've lost his tracks :( )
    3.34 -
    3.35 -The SAS/C library is distributed with debug info attached, to strip debug info 
    3.36 -simply add STRIPDEBUG argument to the linker.
    3.37 -
    3.38 -NOTE: SDL includes debug output using kprintf, to disable it add to your 
    3.39 -project a function like this:
    3.40 -
    3.41 -void kprintf(char *a,...)
    3.42 -{
    3.43 -}
    3.44 -
    3.45 -Otherwise you can redirect the debug to a console window with sushi, sashimi or
    3.46 -similar tools (the default output is the internal serial port). 
    3.47 -
    3.48 -For info, support, bugfix and other feel free to mail me:
    3.49 -
    3.50 -Gabriele Greco (gabriele.greco@aruba.it)
    3.51 -
    3.52 -You can find also a small SDL Amiga page at:
    3.53 -http://ggreco.interfree.it/sdl.html
     4.1 --- a/include/SDL.h	Sun Oct 29 03:39:13 2006 +0000
     4.2 +++ b/include/SDL.h	Sun Oct 29 04:09:17 2006 +0000
     4.3 @@ -38,7 +38,7 @@
     4.4  
     4.5  The current version supports Linux, Windows, Windows CE, BeOS, MacOS,
     4.6  Mac OS X, FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, IRIX, and QNX.
     4.7 -The code contains support for AmigaOS, Dreamcast, Atari, AIX, OSF/Tru64,
     4.8 +The code contains support for Dreamcast, Atari, AIX, OSF/Tru64,
     4.9  RISC OS, SymbianOS, and OS/2, but these are not officially supported.
    4.10  
    4.11  SDL is written in C, but works with C++ natively, and has bindings to
     5.1 --- a/include/SDL_config.h.default	Sun Oct 29 03:39:13 2006 +0000
     5.2 +++ b/include/SDL_config.h.default	Sun Oct 29 04:09:17 2006 +0000
     5.3 @@ -26,9 +26,7 @@
     5.4  #include "SDL_platform.h"
     5.5  
     5.6  /* Add any platform that doesn't build using the configure system */
     5.7 -#if defined(__AMIGA__)
     5.8 -#include "SDL_config_amiga.h"
     5.9 -#elif defined(__DREAMCAST__)
    5.10 +#if defined(__DREAMCAST__)
    5.11  #include "SDL_config_dreamcast.h"
    5.12  #elif defined(__MACOSX__)
    5.13  #include "SDL_config_macosx.h"
     6.1 --- a/include/SDL_config.h.in	Sun Oct 29 03:39:13 2006 +0000
     6.2 +++ b/include/SDL_config.h.in	Sun Oct 29 04:09:17 2006 +0000
     6.3 @@ -149,7 +149,6 @@
     6.4  #undef SDL_VIDEO_DISABLED
     6.5  
     6.6  /* Enable various audio drivers */
     6.7 -#undef SDL_AUDIO_DRIVER_AHI
     6.8  #undef SDL_AUDIO_DRIVER_ALSA
     6.9  #undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
    6.10  #undef SDL_AUDIO_DRIVER_ARTS
    6.11 @@ -195,7 +194,6 @@
    6.12  
    6.13  /* Enable various input drivers */
    6.14  #undef SDL_INPUT_TSLIB
    6.15 -#undef SDL_JOYSTICK_AMIGA
    6.16  #undef SDL_JOYSTICK_BEOS
    6.17  #undef SDL_JOYSTICK_DC
    6.18  #undef SDL_JOYSTICK_DINPUT
    6.19 @@ -220,7 +218,6 @@
    6.20  #undef SDL_LOADSO_WIN32
    6.21  
    6.22  /* Enable various threading systems */
    6.23 -#undef SDL_THREAD_AMIGA
    6.24  #undef SDL_THREAD_BEOS
    6.25  #undef SDL_THREAD_DC
    6.26  #undef SDL_THREAD_EPOC
    6.27 @@ -233,7 +230,6 @@
    6.28  #undef SDL_THREAD_WIN32
    6.29  
    6.30  /* Enable various timer systems */
    6.31 -#undef SDL_TIMER_AMIGA
    6.32  #undef SDL_TIMER_BEOS
    6.33  #undef SDL_TIMER_DC
    6.34  #undef SDL_TIMER_DUMMY
    6.35 @@ -248,7 +244,6 @@
    6.36  /* Enable various video drivers */
    6.37  #undef SDL_VIDEO_DRIVER_BWINDOW
    6.38  #undef SDL_VIDEO_DRIVER_COCOA
    6.39 -#undef SDL_VIDEO_DRIVER_CYBERGRAPHICS
    6.40  #undef SDL_VIDEO_DRIVER_DC
    6.41  #undef SDL_VIDEO_DRIVER_DIRECTFB
    6.42  #undef SDL_VIDEO_DRIVER_DUMMY
     7.1 --- a/include/SDL_config_amiga.h	Sun Oct 29 03:39:13 2006 +0000
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,80 +0,0 @@
     7.4 -/*
     7.5 -    SDL - Simple DirectMedia Layer
     7.6 -    Copyright (C) 1997-2006 Sam Lantinga
     7.7 -
     7.8 -    This library is free software; you can redistribute it and/or
     7.9 -    modify it under the terms of the GNU Lesser General Public
    7.10 -    License as published by the Free Software Foundation; either
    7.11 -    version 2.1 of the License, or (at your option) any later version.
    7.12 -
    7.13 -    This library is distributed in the hope that it will be useful,
    7.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    7.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    7.16 -    Lesser General Public License for more details.
    7.17 -
    7.18 -    You should have received a copy of the GNU Lesser General Public
    7.19 -    License along with this library; if not, write to the Free Software
    7.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    7.21 -
    7.22 -    Sam Lantinga
    7.23 -    slouken@libsdl.org
    7.24 -*/
    7.25 -
    7.26 -#ifndef _SDL_config_amiga_h
    7.27 -#define _SDL_config_amiga_h
    7.28 -
    7.29 -#include "SDL_platform.h"
    7.30 -
    7.31 -/* This is a set of defines to configure the SDL features */
    7.32 -
    7.33 -#define SDL_HAS_64BIT_TYPE	1
    7.34 -
    7.35 -/* Useful headers */
    7.36 -#define HAVE_SYS_TYPES_H	1
    7.37 -#define HAVE_STDIO_H	1
    7.38 -#define STDC_HEADERS	1
    7.39 -#define HAVE_STRING_H	1
    7.40 -#define HAVE_INTTYPES_H	1
    7.41 -#define HAVE_SIGNAL_H	1
    7.42 -
    7.43 -/* C library functions */
    7.44 -#define HAVE_MALLOC	1
    7.45 -#define HAVE_CALLOC	1
    7.46 -#define HAVE_REALLOC	1
    7.47 -#define HAVE_FREE	1
    7.48 -#define HAVE_ALLOCA	1
    7.49 -#define HAVE_GETENV	1
    7.50 -#define HAVE_PUTENV	1
    7.51 -#define HAVE_MEMSET	1
    7.52 -#define HAVE_MEMCPY	1
    7.53 -#define HAVE_MEMMOVE	1
    7.54 -#define HAVE_MEMCMP	1
    7.55 -
    7.56 -/* Enable various audio drivers */
    7.57 -#define SDL_AUDIO_DRIVER_AHI	1
    7.58 -#define SDL_AUDIO_DRIVER_DISK	1
    7.59 -#define SDL_AUDIO_DRIVER_DUMMY	1
    7.60 -
    7.61 -/* Enable various cdrom drivers */
    7.62 -#define SDL_CDROM_DUMMY	1
    7.63 -
    7.64 -/* Enable various input drivers */
    7.65 -#define SDL_JOYSTICK_AMIGA	1
    7.66 -
    7.67 -/* Enable various shared object loading systems */
    7.68 -#define SDL_LOADSO_DUMMY	1
    7.69 -
    7.70 -/* Enable various threading systems */
    7.71 -#define SDL_THREAD_AMIGA	1
    7.72 -
    7.73 -/* Enable various timer systems */
    7.74 -#define SDL_TIMER_AMIGA	1
    7.75 -
    7.76 -/* Enable various video drivers */
    7.77 -#define SDL_VIDEO_DRIVER_CYBERGRAPHICS	1
    7.78 -#define SDL_VIDEO_DRIVER_DUMMY	1
    7.79 -
    7.80 -/* Enable OpenGL support */
    7.81 -#define SDL_VIDEO_OPENGL	1
    7.82 -
    7.83 -#endif /* _SDL_config_amiga_h */
     8.1 --- a/include/SDL_platform.h	Sun Oct 29 03:39:13 2006 +0000
     8.2 +++ b/include/SDL_platform.h	Sun Oct 29 04:09:17 2006 +0000
     8.3 @@ -29,10 +29,6 @@
     8.4  #undef __AIX__
     8.5  #define __AIX__		1
     8.6  #endif
     8.7 -#if defined(AMIGA) || defined(__AMIGA) || defined(__amigados__)
     8.8 -#undef __AMIGA__
     8.9 -#define __AMIGA__	1
    8.10 -#endif
    8.11  #if defined(__BEOS__)
    8.12  #undef __BEOS__
    8.13  #define __BEOS__	1
     9.1 --- a/src/joystick/amigaos/SDL_sysjoystick.c	Sun Oct 29 03:39:13 2006 +0000
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,219 +0,0 @@
     9.4 -/*
     9.5 -    SDL - Simple DirectMedia Layer
     9.6 -    Copyright (C) 1997-2006 Sam Lantinga
     9.7 -
     9.8 -    This library is free software; you can redistribute it and/or
     9.9 -    modify it under the terms of the GNU Lesser General Public
    9.10 -    License as published by the Free Software Foundation; either
    9.11 -    version 2.1 of the License, or (at your option) any later version.
    9.12 -
    9.13 -    This library is distributed in the hope that it will be useful,
    9.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    9.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    9.16 -    Lesser General Public License for more details.
    9.17 -
    9.18 -    You should have received a copy of the GNU Lesser General Public
    9.19 -    License along with this library; if not, write to the Free Software
    9.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    9.21 -
    9.22 -    Sam Lantinga
    9.23 -    slouken@libsdl.org
    9.24 -*/
    9.25 -#include "SDL_config.h"
    9.26 -
    9.27 -#ifdef SDL_JOYSTICK_AMIGA
    9.28 -
    9.29 -/* This is the system specific header for the SDL joystick API */
    9.30 -
    9.31 -#include <libraries/lowlevel.h>
    9.32 -#if defined(__SASC) || defined(STORMC4_WOS)
    9.33 -#include <proto/exec.h>
    9.34 -#include <proto/lowlevel.h>
    9.35 -#include <proto/graphics.h>
    9.36 -#else
    9.37 -#include <inline/exec.h>
    9.38 -#include <inline/lowlevel.h>
    9.39 -#include <inline/graphics.h>
    9.40 -#endif
    9.41 -#include "mydebug.h"
    9.42 -
    9.43 -extern struct ExecBase *SysBase;
    9.44 -extern struct GfxBase *GfxBase;
    9.45 -
    9.46 -#include "SDL_joystick.h"
    9.47 -#include "../SDL_sysjoystick.h"
    9.48 -#include "../SDL_joystick_c.h"
    9.49 -
    9.50 -/* Function to scan the system for joysticks.
    9.51 - * This function should set SDL_numjoysticks to the number of available
    9.52 - * joysticks.  Joystick 0 should be the system default joystick.
    9.53 - * It should return 0, or -1 on an unrecoverable fatal error.
    9.54 - */
    9.55 -
    9.56 -
    9.57 -/* Amiga specific datas */
    9.58 -struct Library *LowLevelBase = NULL;
    9.59 -
    9.60 -ULONG joybut[] = {
    9.61 -    JPF_BUTTON_RED,
    9.62 -    JPF_BUTTON_BLUE,
    9.63 -    JPF_BUTTON_PLAY,
    9.64 -    JPF_BUTTON_YELLOW,
    9.65 -    JPF_BUTTON_GREEN,
    9.66 -    JPF_BUTTON_FORWARD,
    9.67 -    JPF_BUTTON_REVERSE,
    9.68 -};
    9.69 -
    9.70 -struct joystick_hwdata
    9.71 -{
    9.72 -    ULONG joystate;
    9.73 -};
    9.74 -
    9.75 -int
    9.76 -SDL_SYS_JoystickInit(void)
    9.77 -{
    9.78 -    if (!LowLevelBase) {
    9.79 -        if (LowLevelBase = OpenLibrary("lowlevel.library", 37))
    9.80 -            return 2;
    9.81 -    } else
    9.82 -        return 2;
    9.83 -
    9.84 -    D(bug("%ld joysticks available.\n", SDL_numjoysticks));
    9.85 -
    9.86 -    return 0;
    9.87 -}
    9.88 -
    9.89 -/* Function to get the device-dependent name of a joystick */
    9.90 -const char *
    9.91 -SDL_SYS_JoystickName(int index)
    9.92 -{
    9.93 -    if (index < 2 && LowLevelBase) {
    9.94 -        switch (index) {
    9.95 -        case 0:
    9.96 -            return "Port 1 Amiga Joystick/Joypad";
    9.97 -        case 1:
    9.98 -            return "Port 2 Amiga Joystick/Joypad";
    9.99 -        }
   9.100 -    }
   9.101 -
   9.102 -    SDL_SetError("No joystick available with that index");
   9.103 -    return (NULL);
   9.104 -}
   9.105 -
   9.106 -/* Function to open a joystick for use.
   9.107 -   The joystick to open is specified by the index field of the joystick.
   9.108 -   This should fill the nbuttons and naxes fields of the joystick structure.
   9.109 -   It returns 0, or -1 if there is an error.
   9.110 - */
   9.111 -
   9.112 -int
   9.113 -SDL_SYS_JoystickOpen(SDL_Joystick * joystick)
   9.114 -{
   9.115 -    ULONG temp, i;
   9.116 -    D(bug("Opening joystick %ld\n", joystick->index));
   9.117 -
   9.118 -    if (!(joystick->hwdata = SDL_malloc(sizeof(struct joystick_hwdata))))
   9.119 -        return -1;
   9.120 -
   9.121 -/* This loop is to check if the controller is a joypad */
   9.122 -
   9.123 -    for (i = 0; i < 20; i++) {
   9.124 -        temp = ReadJoyPort(joystick->index ^ 1);        // fix to invert amiga joyports
   9.125 -        WaitTOF();
   9.126 -    }
   9.127 -
   9.128 -    if ((temp & JP_TYPE_MASK) == JP_TYPE_GAMECTLR)
   9.129 -        joystick->nbuttons = 7;
   9.130 -    else
   9.131 -        joystick->nbuttons = 3;
   9.132 -
   9.133 -    joystick->nhats = 0;
   9.134 -    joystick->nballs = 0;
   9.135 -    joystick->naxes = 2;
   9.136 -    joystick->hwdata->joystate = 0L;
   9.137 -
   9.138 -    return 0;
   9.139 -}
   9.140 -
   9.141 -/* Function to update the state of a joystick - called as a device poll.
   9.142 - * This function shouldn't update the joystick structure directly,
   9.143 - * but instead should call SDL_PrivateJoystick*() to deliver events
   9.144 - * and update joystick device state.
   9.145 - */
   9.146 -void
   9.147 -SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
   9.148 -{
   9.149 -    ULONG data;
   9.150 -    int i;
   9.151 -
   9.152 -    if (joystick->index < 2) {
   9.153 -        data = ReadJoyPort(joystick->index);
   9.154 -
   9.155 -        if (data & JP_DIRECTION_MASK) {
   9.156 -            if (data & JPF_JOY_DOWN) {
   9.157 -                if (!(joystick->hwdata->joystate & JPF_JOY_DOWN))
   9.158 -                    SDL_PrivateJoystickAxis(joystick, 0, 127);
   9.159 -            } else if (data & JPF_JOY_UP) {
   9.160 -                if (!(joystick->hwdata->joystate & JPF_JOY_UP))
   9.161 -                    SDL_PrivateJoystickAxis(joystick, 0, -127);
   9.162 -            } else if (joystick->hwdata->
   9.163 -                       joystate & (JPF_JOY_UP | JPF_JOY_DOWN))
   9.164 -                SDL_PrivateJoystickAxis(joystick, 0, 0);
   9.165 -
   9.166 -            if (data & JPF_JOY_LEFT) {
   9.167 -                if (!(joystick->hwdata->joystate & JPF_JOY_LEFT))
   9.168 -                    SDL_PrivateJoystickAxis(joystick, 1, -127);
   9.169 -            } else if (data & JPF_JOY_RIGHT) {
   9.170 -                if (!(joystick->hwdata->joystate & JPF_JOY_RIGHT))
   9.171 -                    SDL_PrivateJoystickAxis(joystick, 1, 127);
   9.172 -            } else if (joystick->hwdata->
   9.173 -                       joystate & (JPF_JOY_LEFT | JPF_JOY_RIGHT))
   9.174 -                SDL_PrivateJoystickAxis(joystick, 1, 0);
   9.175 -        } else if (joystick->hwdata->
   9.176 -                   joystate & (JPF_JOY_LEFT | JPF_JOY_RIGHT)) {
   9.177 -            SDL_PrivateJoystickAxis(joystick, 1, 0);
   9.178 -        } else if (joystick->hwdata->joystate & (JPF_JOY_UP | JPF_JOY_DOWN)) {
   9.179 -            SDL_PrivateJoystickAxis(joystick, 0, 0);
   9.180 -        }
   9.181 -
   9.182 -        for (i = 0; i < joystick->nbuttons; i++) {
   9.183 -            if ((data & joybut[i])) {
   9.184 -                if (i == 1)
   9.185 -                    data &= (~(joybut[2]));
   9.186 -
   9.187 -                if (!(joystick->hwdata->joystate & joybut[i]))
   9.188 -                    SDL_PrivateJoystickButton(joystick, i, SDL_PRESSED);
   9.189 -            } else if (joystick->hwdata->joystate & joybut[i])
   9.190 -                SDL_PrivateJoystickButton(joystick, i, SDL_RELEASED);
   9.191 -        }
   9.192 -
   9.193 -        joystick->hwdata->joystate = data;
   9.194 -    }
   9.195 -
   9.196 -    return;
   9.197 -}
   9.198 -
   9.199 -/* Function to close a joystick after use */
   9.200 -void
   9.201 -SDL_SYS_JoystickClose(SDL_Joystick * joystick)
   9.202 -{
   9.203 -    if (joystick->hwdata)
   9.204 -        SDL_free(joystick->hwdata);
   9.205 -    return;
   9.206 -}
   9.207 -
   9.208 -/* Function to perform any system-specific joystick related cleanup */
   9.209 -
   9.210 -void
   9.211 -SDL_SYS_JoystickQuit(void)
   9.212 -{
   9.213 -    if (LowLevelBase) {
   9.214 -        CloseLibrary(LowLevelBase);
   9.215 -        LowLevelBase = NULL;
   9.216 -        SDL_numjoysticks = 0;
   9.217 -    }
   9.218 -    return;
   9.219 -}
   9.220 -
   9.221 -#endif /* SDL_JOYSTICK_AMIGA */
   9.222 -/* vi: set ts=4 sw=4 expandtab: */
    10.1 --- a/src/thread/SDL_thread_c.h	Sun Oct 29 03:39:13 2006 +0000
    10.2 +++ b/src/thread/SDL_thread_c.h	Sun Oct 29 04:09:17 2006 +0000
    10.3 @@ -27,8 +27,6 @@
    10.4  /* Need the definitions of SYS_ThreadHandle */
    10.5  #if SDL_THREADS_DISABLED
    10.6  #include "generic/SDL_systhread_c.h"
    10.7 -#elif SDL_THREAD_AMIGA
    10.8 -#include "amigaos/SDL_systhread_c.h"
    10.9  #elif SDL_THREAD_BEOS
   10.10  #include "beos/SDL_systhread_c.h"
   10.11  #elif SDL_THREAD_DC
    11.1 --- a/src/thread/amigaos/SDL_syssem.c	Sun Oct 29 03:39:13 2006 +0000
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,154 +0,0 @@
    11.4 -/*
    11.5 -    SDL - Simple DirectMedia Layer
    11.6 -    Copyright (C) 1997-2006 Sam Lantinga
    11.7 -
    11.8 -    This library is free software; you can redistribute it and/or
    11.9 -    modify it under the terms of the GNU Lesser General Public
   11.10 -    License as published by the Free Software Foundation; either
   11.11 -    version 2.1 of the License, or (at your option) any later version.
   11.12 -
   11.13 -    This library is distributed in the hope that it will be useful,
   11.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   11.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   11.16 -    Lesser General Public License for more details.
   11.17 -
   11.18 -    You should have received a copy of the GNU Lesser General Public
   11.19 -    License along with this library; if not, write to the Free Software
   11.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   11.21 -
   11.22 -    Sam Lantinga
   11.23 -    slouken@libsdl.org
   11.24 -*/
   11.25 -#include "SDL_config.h"
   11.26 -
   11.27 -/* An implementation of semaphores using mutexes and condition variables */
   11.28 -
   11.29 -#include "SDL_thread.h"
   11.30 -#include "SDL_systhread_c.h"
   11.31 -
   11.32 -
   11.33 -struct SDL_semaphore
   11.34 -{
   11.35 -    struct SignalSemaphore Sem;
   11.36 -};
   11.37 -
   11.38 -#undef D
   11.39 -
   11.40 -#define D(x)
   11.41 -
   11.42 -SDL_sem *
   11.43 -SDL_CreateSemaphore(Uint32 initial_value)
   11.44 -{
   11.45 -    SDL_sem *sem;
   11.46 -
   11.47 -    sem = (SDL_sem *) SDL_malloc(sizeof(*sem));
   11.48 -
   11.49 -    if (!sem) {
   11.50 -        SDL_OutOfMemory();
   11.51 -        return (0);
   11.52 -    }
   11.53 -
   11.54 -    D(bug("Creating semaphore %lx...\n", sem));
   11.55 -
   11.56 -    SDL_memset(sem, 0, sizeof(*sem));
   11.57 -
   11.58 -    InitSemaphore(&sem->Sem);
   11.59 -
   11.60 -    return (sem);
   11.61 -}
   11.62 -
   11.63 -void
   11.64 -SDL_DestroySemaphore(SDL_sem * sem)
   11.65 -{
   11.66 -    D(bug("Destroying semaphore %lx...\n", sem));
   11.67 -
   11.68 -    if (sem) {
   11.69 -// Condizioni per liberare i task in attesa?
   11.70 -        SDL_free(sem);
   11.71 -    }
   11.72 -}
   11.73 -
   11.74 -int
   11.75 -SDL_SemTryWait(SDL_sem * sem)
   11.76 -{
   11.77 -    if (!sem) {
   11.78 -        SDL_SetError("Passed a NULL semaphore");
   11.79 -        return -1;
   11.80 -    }
   11.81 -
   11.82 -    D(bug("TryWait semaphore...%lx\n", sem));
   11.83 -
   11.84 -    ObtainSemaphore(&sem->Sem);
   11.85 -//      ReleaseSemaphore(&sem->Sem);
   11.86 -
   11.87 -    return 1;
   11.88 -}
   11.89 -
   11.90 -int
   11.91 -SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
   11.92 -{
   11.93 -    int retval;
   11.94 -
   11.95 -
   11.96 -    if (!sem) {
   11.97 -        SDL_SetError("Passed a NULL semaphore");
   11.98 -        return -1;
   11.99 -    }
  11.100 -
  11.101 -    D(bug("WaitTimeout (%ld) semaphore...%lx\n", timeout, sem));
  11.102 -
  11.103 -    /* A timeout of 0 is an easy case */
  11.104 -    if (timeout == 0) {
  11.105 -        ObtainSemaphore(&sem->Sem);
  11.106 -        return 1;
  11.107 -    }
  11.108 -    if (!(retval = AttemptSemaphore(&sem->Sem))) {
  11.109 -        SDL_Delay(timeout);
  11.110 -        retval = AttemptSemaphore(&sem->Sem);
  11.111 -    }
  11.112 -
  11.113 -    if (retval == TRUE) {
  11.114 -//              ReleaseSemaphore(&sem->Sem);
  11.115 -        retval = 1;
  11.116 -    }
  11.117 -
  11.118 -    return retval;
  11.119 -}
  11.120 -
  11.121 -int
  11.122 -SDL_SemWait(SDL_sem * sem)
  11.123 -{
  11.124 -    ObtainSemaphore(&sem->Sem);
  11.125 -    return 0;
  11.126 -}
  11.127 -
  11.128 -Uint32
  11.129 -SDL_SemValue(SDL_sem * sem)
  11.130 -{
  11.131 -    Uint32 value;
  11.132 -
  11.133 -    value = 0;
  11.134 -    if (sem) {
  11.135 -#ifdef STORMC4_WOS
  11.136 -        value = sem->Sem.ssppc_SS.ss_NestCount;
  11.137 -#else
  11.138 -        value = sem->Sem.ss_NestCount;
  11.139 -#endif
  11.140 -    }
  11.141 -    return value;
  11.142 -}
  11.143 -
  11.144 -int
  11.145 -SDL_SemPost(SDL_sem * sem)
  11.146 -{
  11.147 -    if (!sem) {
  11.148 -        SDL_SetError("Passed a NULL semaphore");
  11.149 -        return -1;
  11.150 -    }
  11.151 -    D(bug("SemPost semaphore...%lx\n", sem));
  11.152 -
  11.153 -    ReleaseSemaphore(&sem->Sem);
  11.154 -    return 0;
  11.155 -}
  11.156 -
  11.157 -/* vi: set ts=4 sw=4 expandtab: */
    12.1 --- a/src/thread/amigaos/SDL_systhread.c	Sun Oct 29 03:39:13 2006 +0000
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,165 +0,0 @@
    12.4 -/*
    12.5 -    SDL - Simple DirectMedia Layer
    12.6 -    Copyright (C) 1997-2006 Sam Lantinga
    12.7 -
    12.8 -    This library is free software; you can redistribute it and/or
    12.9 -    modify it under the terms of the GNU Lesser General Public
   12.10 -    License as published by the Free Software Foundation; either
   12.11 -    version 2.1 of the License, or (at your option) any later version.
   12.12 -
   12.13 -    This library is distributed in the hope that it will be useful,
   12.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   12.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   12.16 -    Lesser General Public License for more details.
   12.17 -
   12.18 -    You should have received a copy of the GNU Lesser General Public
   12.19 -    License along with this library; if not, write to the Free Software
   12.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   12.21 -
   12.22 -    Sam Lantinga
   12.23 -    slouken@libsdl.org
   12.24 -*/
   12.25 -#include "SDL_config.h"
   12.26 -
   12.27 -/* BeOS thread management routines for SDL */
   12.28 -
   12.29 -#include "SDL_mutex.h"
   12.30 -#include "SDL_thread.h"
   12.31 -#include "../SDL_thread_c.h"
   12.32 -#include "../SDL_systhread.h"
   12.33 -#include "mydebug.h"
   12.34 -
   12.35 -typedef struct
   12.36 -{
   12.37 -    int (*func) (void *);
   12.38 -    void *data;
   12.39 -    SDL_Thread *info;
   12.40 -    struct Task *wait;
   12.41 -} thread_args;
   12.42 -
   12.43 -#ifndef MORPHOS
   12.44 -
   12.45 -#if defined(__SASC) && !defined(__PPC__)
   12.46 -__saveds __asm Uint32
   12.47 -RunThread(register __a0 char *args)
   12.48 -#elif defined(__PPC__)
   12.49 -Uint32
   12.50 -RunThread(char *args)
   12.51 -#else
   12.52 -Uint32 __saveds
   12.53 -RunThread(char *args __asm("a0"))
   12.54 -#endif
   12.55 -{
   12.56 -#ifdef STORMC4_WOS
   12.57 -    thread_args *data = (thread_args *) args;
   12.58 -#else
   12.59 -    thread_args *data = (thread_args *) atol(args);
   12.60 -#endif
   12.61 -
   12.62 -    struct Task *Father;
   12.63 -
   12.64 -    D(bug("Received data: %lx\n", data));
   12.65 -    Father = data->wait;
   12.66 -
   12.67 -    SDL_RunThread(data);
   12.68 -
   12.69 -    Signal(Father, SIGBREAKF_CTRL_F);
   12.70 -    D(bug("Thread with data %lx ended\n", data));
   12.71 -    return (0);
   12.72 -}
   12.73 -
   12.74 -#else
   12.75 -
   12.76 -#include <emul/emulinterface.h>
   12.77 -
   12.78 -Uint32
   12.79 -RunTheThread(void)
   12.80 -{
   12.81 -    thread_args *data = (thread_args *) atol((char *) REG_A0);
   12.82 -    struct Task *Father;
   12.83 -
   12.84 -    D(bug("Received data: %lx\n", data));
   12.85 -    Father = data->wait;
   12.86 -
   12.87 -    SDL_RunThread(data);
   12.88 -
   12.89 -    Signal(Father, SIGBREAKF_CTRL_F);
   12.90 -    D(bug("Thread with data %lx ended\n", data));
   12.91 -    return (0);
   12.92 -}
   12.93 -
   12.94 -struct EmulLibEntry RunThreadStruct = {
   12.95 -    TRAP_LIB,
   12.96 -    0,
   12.97 -    (ULONG) RunTheThread
   12.98 -};
   12.99 -
  12.100 -void *RunThread = &RunThreadStruct;
  12.101 -#endif
  12.102 -
  12.103 -
  12.104 -int
  12.105 -SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
  12.106 -{
  12.107 -    /* Create the thread and go! */
  12.108 -    char buffer[20];
  12.109 -
  12.110 -    D(bug("Sending %lx to the new thread...\n", args));
  12.111 -
  12.112 -    if (args)
  12.113 -        SDL_snprintf(buffer, SDL_arraysize(buffer), "%ld", args);
  12.114 -
  12.115 -#ifdef STORMC4_WOS
  12.116 -    thread->handle = CreateTaskPPCTags(TASKATTR_CODE, RunThread,
  12.117 -                                       TASKATTR_NAME, "SDL subtask",
  12.118 -                                       TASKATTR_STACKSIZE, 100000,
  12.119 -                                       (args ? TASKATTR_R3 : TAG_IGNORE),
  12.120 -                                       args, TASKATTR_INHERITR2, TRUE,
  12.121 -                                       TAG_DONE);
  12.122 -#else
  12.123 -    thread->handle = (struct Task *) CreateNewProcTags(NP_Output, Output(),
  12.124 -                                                       NP_Name,
  12.125 -                                                       (ULONG) "SDL subtask",
  12.126 -                                                       NP_CloseOutput, FALSE,
  12.127 -                                                       NP_StackSize, 20000,
  12.128 -                                                       NP_Entry,
  12.129 -                                                       (ULONG) RunThread,
  12.130 -                                                       args ? NP_Arguments :
  12.131 -                                                       TAG_IGNORE,
  12.132 -                                                       (ULONG) buffer,
  12.133 -                                                       TAG_DONE);
  12.134 -#endif
  12.135 -
  12.136 -    if (!thread->handle) {
  12.137 -        SDL_SetError("Not enough resources to create thread");
  12.138 -        return (-1);
  12.139 -    }
  12.140 -
  12.141 -    return (0);
  12.142 -}
  12.143 -
  12.144 -void
  12.145 -SDL_SYS_SetupThread(void)
  12.146 -{
  12.147 -}
  12.148 -
  12.149 -Uint32
  12.150 -SDL_ThreadID(void)
  12.151 -{
  12.152 -    return ((Uint32) FindTask(NULL));
  12.153 -}
  12.154 -
  12.155 -void
  12.156 -SDL_SYS_WaitThread(SDL_Thread * thread)
  12.157 -{
  12.158 -    SetSignal(0L, SIGBREAKF_CTRL_F | SIGBREAKF_CTRL_C);
  12.159 -    Wait(SIGBREAKF_CTRL_F | SIGBREAKF_CTRL_C);
  12.160 -}
  12.161 -
  12.162 -void
  12.163 -SDL_SYS_KillThread(SDL_Thread * thread)
  12.164 -{
  12.165 -    Signal((struct Task *) thread->handle, SIGBREAKF_CTRL_C);
  12.166 -}
  12.167 -
  12.168 -/* vi: set ts=4 sw=4 expandtab: */
    13.1 --- a/src/thread/amigaos/SDL_systhread_c.h	Sun Oct 29 03:39:13 2006 +0000
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,61 +0,0 @@
    13.4 -/*
    13.5 -    SDL - Simple DirectMedia Layer
    13.6 -    Copyright (C) 1997-2006 Sam Lantinga
    13.7 -
    13.8 -    This library is free software; you can redistribute it and/or
    13.9 -    modify it under the terms of the GNU Lesser General Public
   13.10 -    License as published by the Free Software Foundation; either
   13.11 -    version 2.1 of the License, or (at your option) any later version.
   13.12 -
   13.13 -    This library is distributed in the hope that it will be useful,
   13.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   13.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   13.16 -    Lesser General Public License for more details.
   13.17 -
   13.18 -    You should have received a copy of the GNU Lesser General Public
   13.19 -    License along with this library; if not, write to the Free Software
   13.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   13.21 -
   13.22 -    Sam Lantinga
   13.23 -    slouken@libsdl.org
   13.24 -*/
   13.25 -#include "SDL_config.h"
   13.26 -
   13.27 -#include <exec/exec.h>
   13.28 -#include <dos/dos.h>
   13.29 -#include <dos/dostags.h>
   13.30 -#if defined (__SASC) || defined(STORMC4_WOS)
   13.31 -#include <proto/dos.h>
   13.32 -#include <proto/exec.h>
   13.33 -#else
   13.34 -#include <inline/dos.h>
   13.35 -#include <inline/exec.h>
   13.36 -#endif
   13.37 -
   13.38 -#include "mydebug.h"
   13.39 -
   13.40 -extern struct ExecBase *SysBase;
   13.41 -extern struct DosLibrary *DOSBase;
   13.42 -
   13.43 -#ifdef STORMC4_WOS
   13.44 -#include <proto/powerpc.h>
   13.45 -
   13.46 -/* use powerpc.library functions instead og exec */
   13.47 -#define SYS_ThreadHandle struct TaskPPC *
   13.48 -#define Signal SignalPPC
   13.49 -#define Wait WaitPPC
   13.50 -#define Task TaskPPC
   13.51 -#define FindTask FindTaskPPC
   13.52 -#define SetSignal SetSignalPPC
   13.53 -
   13.54 -#define InitSemaphore InitSemaphorePPC
   13.55 -#define ObtainSemaphore ObtainSemaphorePPC
   13.56 -#define AttemptSemaphore AttemptSemaphorePPC
   13.57 -#define ReleaseSemaphore ReleaseSemaphorePPC
   13.58 -#define SignalSemaphore SignalSemaphorePPC
   13.59 -
   13.60 -#else
   13.61 -
   13.62 -#define SYS_ThreadHandle struct Task *
   13.63 -#endif /*STORMC4_WOS */
   13.64 -/* vi: set ts=4 sw=4 expandtab: */
    14.1 --- a/src/thread/amigaos/SDL_thread.c	Sun Oct 29 03:39:13 2006 +0000
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,291 +0,0 @@
    14.4 -/*
    14.5 -    SDL - Simple DirectMedia Layer
    14.6 -    Copyright (C) 1997-2006 Sam Lantinga
    14.7 -
    14.8 -    This library is free software; you can redistribute it and/or
    14.9 -    modify it under the terms of the GNU Lesser General Public
   14.10 -    License as published by the Free Software Foundation; either
   14.11 -    version 2.1 of the License, or (at your option) any later version.
   14.12 -
   14.13 -    This library is distributed in the hope that it will be useful,
   14.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   14.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   14.16 -    Lesser General Public License for more details.
   14.17 -
   14.18 -    You should have received a copy of the GNU Lesser General Public
   14.19 -    License along with this library; if not, write to the Free Software
   14.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   14.21 -
   14.22 -    Sam Lantinga
   14.23 -    slouken@libsdl.org
   14.24 -*/
   14.25 -#include "SDL_config.h"
   14.26 -
   14.27 -/* System independent thread management routines for SDL */
   14.28 -
   14.29 -#include "SDL_mutex.h"
   14.30 -#include "SDL_thread.h"
   14.31 -#include "../SDL_thread_c.h"
   14.32 -#include "../SDL_systhread.h"
   14.33 -
   14.34 -#define ARRAY_CHUNKSIZE	32
   14.35 -/* The array of threads currently active in the application
   14.36 -   (except the main thread)
   14.37 -   The manipulation of an array here is safer than using a linked list.
   14.38 -*/
   14.39 -static int SDL_maxthreads = 0;
   14.40 -static int SDL_numthreads = 0;
   14.41 -static SDL_Thread **SDL_Threads = NULL;
   14.42 -static struct SignalSemaphore thread_lock;
   14.43 -int thread_lock_created = 0;
   14.44 -
   14.45 -int
   14.46 -SDL_ThreadsInit(void)
   14.47 -{
   14.48 -    InitSemaphore(&thread_lock);
   14.49 -    thread_lock_created = 1;
   14.50 -    return 0;
   14.51 -}
   14.52 -
   14.53 -/* This should never be called...
   14.54 -   If this is called by SDL_Quit(), we don't know whether or not we should
   14.55 -   clean up threads here.  If any threads are still running after this call,
   14.56 -   they will no longer have access to any per-thread data.
   14.57 - */
   14.58 -void
   14.59 -SDL_ThreadsQuit()
   14.60 -{
   14.61 -    thread_lock_created = 0;
   14.62 -}
   14.63 -
   14.64 -/* Routines for manipulating the thread list */
   14.65 -static void
   14.66 -SDL_AddThread(SDL_Thread * thread)
   14.67 -{
   14.68 -    SDL_Thread **threads;
   14.69 -
   14.70 -    /* WARNING:
   14.71 -       If the very first threads are created simultaneously, then
   14.72 -       there could be a race condition causing memory corruption.
   14.73 -       In practice, this isn't a problem because by definition there
   14.74 -       is only one thread running the first time this is called.
   14.75 -     */
   14.76 -    if (!thread_lock_created) {
   14.77 -        if (SDL_ThreadsInit() < 0) {
   14.78 -            return;
   14.79 -        }
   14.80 -    }
   14.81 -    ObtainSemaphore(&thread_lock);
   14.82 -
   14.83 -    /* Expand the list of threads, if necessary */
   14.84 -#ifdef DEBUG_THREADS
   14.85 -    printf("Adding thread (%d already - %d max)\n",
   14.86 -           SDL_numthreads, SDL_maxthreads);
   14.87 -#endif
   14.88 -    if (SDL_numthreads == SDL_maxthreads) {
   14.89 -        threads =
   14.90 -            (SDL_Thread **) SDL_malloc((SDL_maxthreads + ARRAY_CHUNKSIZE) *
   14.91 -                                       (sizeof *threads));
   14.92 -        if (threads == NULL) {
   14.93 -            SDL_OutOfMemory();
   14.94 -            goto done;
   14.95 -        }
   14.96 -        SDL_memcpy(threads, SDL_Threads, SDL_numthreads * (sizeof *threads));
   14.97 -        SDL_maxthreads += ARRAY_CHUNKSIZE;
   14.98 -        if (SDL_Threads) {
   14.99 -            SDL_free(SDL_Threads);
  14.100 -        }
  14.101 -        SDL_Threads = threads;
  14.102 -    }
  14.103 -    SDL_Threads[SDL_numthreads++] = thread;
  14.104 -  done:
  14.105 -    ReleaseSemaphore(&thread_lock);
  14.106 -}
  14.107 -
  14.108 -static void
  14.109 -SDL_DelThread(SDL_Thread * thread)
  14.110 -{
  14.111 -    int i;
  14.112 -
  14.113 -    if (thread_lock_created) {
  14.114 -        ObtainSemaphore(&thread_lock);
  14.115 -        for (i = 0; i < SDL_numthreads; ++i) {
  14.116 -            if (thread == SDL_Threads[i]) {
  14.117 -                break;
  14.118 -            }
  14.119 -        }
  14.120 -        if (i < SDL_numthreads) {
  14.121 -            --SDL_numthreads;
  14.122 -            while (i < SDL_numthreads) {
  14.123 -                SDL_Threads[i] = SDL_Threads[i + 1];
  14.124 -                ++i;
  14.125 -            }
  14.126 -#ifdef DEBUG_THREADS
  14.127 -            printf("Deleting thread (%d left - %d max)\n",
  14.128 -                   SDL_numthreads, SDL_maxthreads);
  14.129 -#endif
  14.130 -        }
  14.131 -        ReleaseSemaphore(&thread_lock);
  14.132 -    }
  14.133 -}
  14.134 -
  14.135 -/* The default (non-thread-safe) global error variable */
  14.136 -static SDL_error SDL_global_error;
  14.137 -
  14.138 -/* Routine to get the thread-specific error variable */
  14.139 -SDL_error *
  14.140 -SDL_GetErrBuf(void)
  14.141 -{
  14.142 -    SDL_error *errbuf;
  14.143 -
  14.144 -    errbuf = &SDL_global_error;
  14.145 -    if (SDL_Threads) {
  14.146 -        int i;
  14.147 -        Uint32 this_thread;
  14.148 -
  14.149 -        this_thread = SDL_ThreadID();
  14.150 -        ObtainSemaphore(&thread_lock);
  14.151 -        for (i = 0; i < SDL_numthreads; ++i) {
  14.152 -            if (this_thread == SDL_Threads[i]->threadid) {
  14.153 -                errbuf = &SDL_Threads[i]->errbuf;
  14.154 -                break;
  14.155 -            }
  14.156 -        }
  14.157 -        ReleaseSemaphore(&thread_lock);
  14.158 -    }
  14.159 -    return (errbuf);
  14.160 -}
  14.161 -
  14.162 -
  14.163 -/* Arguments and callback to setup and run the user thread function */
  14.164 -typedef struct
  14.165 -{
  14.166 -    int (*func) (void *);
  14.167 -    void *data;
  14.168 -    SDL_Thread *info;
  14.169 -    struct Task *wait;
  14.170 -} thread_args;
  14.171 -
  14.172 -void
  14.173 -SDL_RunThread(void *data)
  14.174 -{
  14.175 -    thread_args *args;
  14.176 -    int (*userfunc) (void *);
  14.177 -    void *userdata;
  14.178 -    int *statusloc;
  14.179 -
  14.180 -    /* Perform any system-dependent setup
  14.181 -       - this function cannot fail, and cannot use SDL_SetError()
  14.182 -     */
  14.183 -    SDL_SYS_SetupThread();
  14.184 -
  14.185 -    /* Get the thread id */
  14.186 -    args = (thread_args *) data;
  14.187 -    args->info->threadid = SDL_ThreadID();
  14.188 -
  14.189 -    /* Figure out what function to run */
  14.190 -    userfunc = args->func;
  14.191 -    userdata = args->data;
  14.192 -    statusloc = &args->info->status;
  14.193 -
  14.194 -    /* Wake up the parent thread */
  14.195 -    Signal(args->wait, SIGBREAKF_CTRL_E);
  14.196 -
  14.197 -    /* Run the function */
  14.198 -    *statusloc = userfunc(userdata);
  14.199 -}
  14.200 -
  14.201 -SDL_Thread *
  14.202 -SDL_CreateThread(int (*fn) (void *), void *data)
  14.203 -{
  14.204 -    SDL_Thread *thread;
  14.205 -    thread_args *args;
  14.206 -    int ret;
  14.207 -
  14.208 -    /* Allocate memory for the thread info structure */
  14.209 -    thread = (SDL_Thread *) SDL_malloc(sizeof(*thread));
  14.210 -    if (thread == NULL) {
  14.211 -        SDL_OutOfMemory();
  14.212 -        return (NULL);
  14.213 -    }
  14.214 -    SDL_memset(thread, 0, (sizeof *thread));
  14.215 -    thread->status = -1;
  14.216 -
  14.217 -    /* Set up the arguments for the thread */
  14.218 -    args = (thread_args *) SDL_malloc(sizeof(*args));
  14.219 -    if (args == NULL) {
  14.220 -        SDL_OutOfMemory();
  14.221 -        SDL_free(thread);
  14.222 -        return (NULL);
  14.223 -    }
  14.224 -    args->func = fn;
  14.225 -    args->data = data;
  14.226 -    args->info = thread;
  14.227 -    args->wait = FindTask(NULL);
  14.228 -    if (args->wait == NULL) {
  14.229 -        SDL_free(thread);
  14.230 -        SDL_free(args);
  14.231 -        SDL_OutOfMemory();
  14.232 -        return (NULL);
  14.233 -    }
  14.234 -
  14.235 -    /* Add the thread to the list of available threads */
  14.236 -    SDL_AddThread(thread);
  14.237 -
  14.238 -    D(bug("Starting thread...\n"));
  14.239 -
  14.240 -    /* Create the thread and go! */
  14.241 -    ret = SDL_SYS_CreateThread(thread, args);
  14.242 -    if (ret >= 0) {
  14.243 -        D(bug("Waiting for thread CTRL_E...\n"));
  14.244 -        /* Wait for the thread function to use arguments */
  14.245 -        Wait(SIGBREAKF_CTRL_E);
  14.246 -        D(bug("  Arrived."));
  14.247 -    } else {
  14.248 -        /* Oops, failed.  Gotta free everything */
  14.249 -        SDL_DelThread(thread);
  14.250 -        SDL_free(thread);
  14.251 -        thread = NULL;
  14.252 -    }
  14.253 -    SDL_free(args);
  14.254 -
  14.255 -    /* Everything is running now */
  14.256 -    return (thread);
  14.257 -}
  14.258 -
  14.259 -void
  14.260 -SDL_WaitThread(SDL_Thread * thread, int *status)
  14.261 -{
  14.262 -    if (thread) {
  14.263 -        SDL_SYS_WaitThread(thread);
  14.264 -        if (status) {
  14.265 -            *status = thread->status;
  14.266 -        }
  14.267 -        SDL_DelThread(thread);
  14.268 -        SDL_free(thread);
  14.269 -    }
  14.270 -}
  14.271 -
  14.272 -Uint32
  14.273 -SDL_GetThreadID(SDL_Thread * thread)
  14.274 -{
  14.275 -    Uint32 id;
  14.276 -
  14.277 -    if (thread) {
  14.278 -        id = thread->threadid;
  14.279 -    } else {
  14.280 -        id = SDL_ThreadID();
  14.281 -    }
  14.282 -    return (id);
  14.283 -}
  14.284 -
  14.285 -void
  14.286 -SDL_KillThread(SDL_Thread * thread)
  14.287 -{
  14.288 -    if (thread) {
  14.289 -        SDL_SYS_KillThread(thread);
  14.290 -        SDL_WaitThread(thread, NULL);
  14.291 -    }
  14.292 -}
  14.293 -
  14.294 -/* vi: set ts=4 sw=4 expandtab: */
    15.1 --- a/src/timer/amigaos/SDL_systimer.c	Sun Oct 29 03:39:13 2006 +0000
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,268 +0,0 @@
    15.4 -/*
    15.5 -    SDL - Simple DirectMedia Layer
    15.6 -    Copyright (C) 1997-2006 Sam Lantinga
    15.7 -
    15.8 -    This library is free software; you can redistribute it and/or
    15.9 -    modify it under the terms of the GNU Lesser General Public
   15.10 -    License as published by the Free Software Foundation; either
   15.11 -    version 2.1 of the License, or (at your option) any later version.
   15.12 -
   15.13 -    This library is distributed in the hope that it will be useful,
   15.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   15.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   15.16 -    Lesser General Public License for more details.
   15.17 -
   15.18 -    You should have received a copy of the GNU Lesser General Public
   15.19 -    License along with this library; if not, write to the Free Software
   15.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   15.21 -
   15.22 -    Sam Lantinga
   15.23 -    slouken@libsdl.org
   15.24 -*/
   15.25 -#include "SDL_config.h"
   15.26 -
   15.27 -#ifdef SDL_TIMER_AMIGA
   15.28 -
   15.29 -#include <stdio.h>
   15.30 -#include <time.h>
   15.31 -#include <signal.h>
   15.32 -#include <unistd.h>
   15.33 -#include <string.h>
   15.34 -#include <errno.h>
   15.35 -#include <exec/types.h>
   15.36 -#ifdef __SASC
   15.37 -#include <proto/dos.h>
   15.38 -#include <clib/graphics_protos.h>
   15.39 -#include <pragmas/graphics.h>
   15.40 -#include <clib/exec_protos.h>
   15.41 -#include <pragmas/exec.h>
   15.42 -#elif defined(STORMC4_WOS)
   15.43 -#include <proto/dos.h>
   15.44 -#include <proto/exec.h>
   15.45 -#include <proto/graphics.h>
   15.46 -#else
   15.47 -#include <inline/dos.h>
   15.48 -#include <inline/exec.h>
   15.49 -#include <inline/graphics.h>
   15.50 -#endif
   15.51 -#include "mydebug.h"
   15.52 -
   15.53 -extern struct DosLibrary *DOSBase;
   15.54 -extern struct ExecBase *SysBase;
   15.55 -static struct GfxBase *GfxBase;
   15.56 -
   15.57 -#include "SDL_timer.h"
   15.58 -#include "../SDL_timer_c.h"
   15.59 -
   15.60 -/* The first ticks value of the application */
   15.61 -
   15.62 -#if !defined(__PPC__) || defined(STORMC4_WOS) || defined(MORPHOS)
   15.63 -static clock_t start;
   15.64 -
   15.65 -void
   15.66 -SDL_StartTicks(void)
   15.67 -{
   15.68 -    /* Set first ticks value */
   15.69 -    start = clock();
   15.70 -}
   15.71 -
   15.72 -Uint32
   15.73 -SDL_GetTicks(void)
   15.74 -{
   15.75 -    clock_t ticks;
   15.76 -
   15.77 -    ticks = clock() - start;
   15.78 -
   15.79 -#ifdef __SASC
   15.80 -// CLOCKS_PER_SEC == 1000 !
   15.81 -
   15.82 -    return (ticks);
   15.83 -#else
   15.84 -// CLOCKS_PER_SEC != 1000 !
   15.85 -
   15.86 -    return ticks * (1000 / CLOCKS_PER_SEC);
   15.87 -#endif
   15.88 -}
   15.89 -
   15.90 -void
   15.91 -SDL_Delay(Uint32 ms)
   15.92 -{
   15.93 -// Do a busy wait if time is less than 50ms
   15.94 -
   15.95 -    if (ms < 50) {
   15.96 -        clock_t to_wait = clock();
   15.97 -
   15.98 -#ifndef __SASC
   15.99 -        ms *= (CLOCKS_PER_SEC / 1000);
  15.100 -#endif
  15.101 -        to_wait += ms;
  15.102 -
  15.103 -        while (clock() < to_wait);
  15.104 -    } else {
  15.105 -        Delay(ms / 20);
  15.106 -    }
  15.107 -}
  15.108 -
  15.109 -#else
  15.110 -
  15.111 -ULONG MY_CLOCKS_PER_SEC;
  15.112 -
  15.113 -void PPC_TimerInit(void);
  15.114 -APTR MyTimer;
  15.115 -
  15.116 -ULONG start[2];
  15.117 -
  15.118 -void
  15.119 -SDL_StartTicks(void)
  15.120 -{
  15.121 -    /* Set first ticks value */
  15.122 -    if (!MyTimer)
  15.123 -        PPC_TimerInit();
  15.124 -
  15.125 -    PPCGetTimerObject(MyTimer, PPCTIMERTAG_CURRENTTICKS, start);
  15.126 -    start[1] >>= 10;
  15.127 -    start[1] |= ((result[0] & 0x3ff) << 22);
  15.128 -    start[0] >>= 10;
  15.129 -}
  15.130 -
  15.131 -Uint32
  15.132 -SDL_GetTicks(void)
  15.133 -{
  15.134 -    ULONG result[2];
  15.135 -    PPCGetTimerObject(MyTimer, PPCTIMERTAG_CURRENTTICKS, result);
  15.136 -
  15.137 -//      PPCAsr64p(result,10);
  15.138 -// Non va, la emulo:
  15.139 -
  15.140 -    result[1] >>= 10;
  15.141 -    result[1] |= ((result[0] & 0x3ff) << 22);
  15.142 -
  15.143 -// Non mi interessa piu' result[0]
  15.144 -
  15.145 -    return result[1] * 1000 / MY_CLOCKS_PER_SEC;
  15.146 -}
  15.147 -
  15.148 -void
  15.149 -SDL_Delay(Uint32 ms)
  15.150 -{
  15.151 -// Do a busy wait if time is less than 50ms
  15.152 -
  15.153 -    if (ms < 50) {
  15.154 -        ULONG to_wait[2], actual[2];
  15.155 -        PPCGetTimerObject(MyTimer, PPCTIMERTAG_CURRENTTICKS, result);
  15.156 -        actual[1] = 0;
  15.157 -        to_wait[1] += ms * 1000 / MY_CLOCKS_PER_SEC;
  15.158 -
  15.159 -        while (actual[1] < to_wait[1]) {
  15.160 -            PPCGetTimerObject(MyTimer, PPCTIMERTAG_CURRENTTICKS, actual);
  15.161 -        }
  15.162 -    } else {
  15.163 -        Delay(ms / 50);
  15.164 -    }
  15.165 -}
  15.166 -
  15.167 -void
  15.168 -PPC_TimerInit(void)
  15.169 -{
  15.170 -    struct TagItem tags[] = {
  15.171 -        PPCTIMERTAG_CPU, TRUE,
  15.172 -        TAG_DONE, 0
  15.173 -    };
  15.174 -
  15.175 -
  15.176 -    if (MyTimer = PPCCreateTimerObject(tags)) {
  15.177 -        ULONG result[2];
  15.178 -
  15.179 -        PPCGetTimerObject(MyTimer, PPCTIMERTAG_TICKSPERSEC, result);
  15.180 -        D(bug("Timer inizializzato, TPS: %lu - %lu\n", result[0], result[1]));
  15.181 -//              PPCAsr64p(result,10);
  15.182 -        result[1] >>= 10;
  15.183 -        result[1] |= ((result[0] & 0x3ff) << 22);
  15.184 -        result[0] >>= 10;
  15.185 -
  15.186 -        D(bug("Shiftato TPS: %lu - %lu\n", result[0], result[1]));
  15.187 -        MY_CLOCKS_PER_SEC = result[1];
  15.188 -
  15.189 -        PPCGetTimerObject(MyTimer, PPCTIMERTAG_CURRENTTICKS, result);
  15.190 -
  15.191 -        D(bug("Current ticks: %lu - %lu\n", result[0], result[1]));
  15.192 -        result[1] >>= 10;
  15.193 -        result[1] |= ((result[0] & 0x3ff) << 22);
  15.194 -        result[0] >>= 10;
  15.195 -//              PPCAsr64p(result,10);
  15.196 -        D(bug("Shiftato: %lu - %lu\n", result[0], result[1]));
  15.197 -    } else {
  15.198 -        D(bug("Errore nell'inizializzazione del timer!\n"));
  15.199 -    }
  15.200 -}
  15.201 -
  15.202 -#endif
  15.203 -
  15.204 -#include "SDL_thread.h"
  15.205 -
  15.206 -/* Data to handle a single periodic alarm */
  15.207 -static int timer_alive = 0;
  15.208 -static SDL_Thread *timer_thread = NULL;
  15.209 -
  15.210 -static int
  15.211 -RunTimer(void *unused)
  15.212 -{
  15.213 -    D(bug("SYSTimer: Entering RunTimer loop..."));
  15.214 -
  15.215 -    if (GfxBase == NULL)
  15.216 -        GfxBase = (struct GfxBase *) OpenLibrary("graphics.library", 37);
  15.217 -
  15.218 -    while (timer_alive) {
  15.219 -        if (SDL_timer_running) {
  15.220 -            SDL_ThreadedTimerCheck();
  15.221 -        }
  15.222 -        if (GfxBase)
  15.223 -            WaitTOF();          // Check the timer every fifth of seconds. Was SDL_Delay(1)->BusyWait!
  15.224 -        else
  15.225 -            Delay(1);
  15.226 -    }
  15.227 -    D(bug("SYSTimer: EXITING RunTimer loop..."));
  15.228 -    return (0);
  15.229 -}
  15.230 -
  15.231 -/* This is only called if the event thread is not running */
  15.232 -int
  15.233 -SDL_SYS_TimerInit(void)
  15.234 -{
  15.235 -    D(bug("Creating thread for the timer (NOITIMER)...\n"));
  15.236 -
  15.237 -    timer_alive = 1;
  15.238 -    timer_thread = SDL_CreateThread(RunTimer, NULL);
  15.239 -    if (timer_thread == NULL) {
  15.240 -        D(bug("Creazione del thread fallita...\n"));
  15.241 -
  15.242 -        return (-1);
  15.243 -    }
  15.244 -    return (SDL_SetTimerThreaded(1));
  15.245 -}
  15.246 -
  15.247 -void
  15.248 -SDL_SYS_TimerQuit(void)
  15.249 -{
  15.250 -    timer_alive = 0;
  15.251 -    if (timer_thread) {
  15.252 -        SDL_WaitThread(timer_thread, NULL);
  15.253 -        timer_thread = NULL;
  15.254 -    }
  15.255 -}
  15.256 -
  15.257 -int
  15.258 -SDL_SYS_StartTimer(void)
  15.259 -{
  15.260 -    SDL_SetError("Internal logic error: AmigaOS uses threaded timer");
  15.261 -    return (-1);
  15.262 -}
  15.263 -
  15.264 -void
  15.265 -SDL_SYS_StopTimer(void)
  15.266 -{
  15.267 -    return;
  15.268 -}
  15.269 -
  15.270 -#endif /* SDL_TIMER_AMIGA */
  15.271 -/* vi: set ts=4 sw=4 expandtab: */
    16.1 --- a/src/video/SDL_sysvideo.h	Sun Oct 29 03:39:13 2006 +0000
    16.2 +++ b/src/video/SDL_sysvideo.h	Sun Oct 29 04:09:17 2006 +0000
    16.3 @@ -344,9 +344,6 @@
    16.4  #if SDL_VIDEO_DRIVER_BWINDOW
    16.5  extern VideoBootStrap BWINDOW_bootstrap;
    16.6  #endif
    16.7 -#if SDL_VIDEO_DRIVER_CYBERGRAPHICS
    16.8 -extern VideoBootStrap CGX_bootstrap;
    16.9 -#endif
   16.10  #if SDL_VIDEO_DRIVER_PHOTON
   16.11  extern VideoBootStrap ph_bootstrap;
   16.12  #endif
    17.1 --- a/src/video/SDL_video.c	Sun Oct 29 03:39:13 2006 +0000
    17.2 +++ b/src/video/SDL_video.c	Sun Oct 29 04:09:17 2006 +0000
    17.3 @@ -82,9 +82,6 @@
    17.4  #if SDL_VIDEO_DRIVER_BWINDOW
    17.5      &BWINDOW_bootstrap,
    17.6  #endif
    17.7 -#if SDL_VIDEO_DRIVER_CYBERGRAPHICS
    17.8 -    &CGX_bootstrap,
    17.9 -#endif
   17.10  #if SDL_VIDEO_DRIVER_PHOTON
   17.11      &ph_bootstrap,
   17.12  #endif
    18.1 --- a/src/video/cybergfx/SDL_amigaevents.c	Sun Oct 29 03:39:13 2006 +0000
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,539 +0,0 @@
    18.4 -/*
    18.5 -    SDL - Simple DirectMedia Layer
    18.6 -    Copyright (C) 1997-2006 Sam Lantinga
    18.7 -
    18.8 -    This library is free software; you can redistribute it and/or
    18.9 -    modify it under the terms of the GNU Lesser General Public
   18.10 -    License as published by the Free Software Foundation; either
   18.11 -    version 2.1 of the License, or (at your option) any later version.
   18.12 -
   18.13 -    This library is distributed in the hope that it will be useful,
   18.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   18.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   18.16 -    Lesser General Public License for more details.
   18.17 -
   18.18 -    You should have received a copy of the GNU Lesser General Public
   18.19 -    License along with this library; if not, write to the Free Software
   18.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   18.21 -
   18.22 -    Sam Lantinga
   18.23 -    slouken@libsdl.org
   18.24 -*/
   18.25 -#include "SDL_config.h"
   18.26 -
   18.27 -/* Handle the event stream, converting Amiga events into SDL events */
   18.28 -#include "SDL.h"
   18.29 -
   18.30 -#include "SDL_syswm.h"
   18.31 -#include "../SDL_sysvideo.h"
   18.32 -#include "../../events/SDL_sysevents.h"
   18.33 -#include "../../events/SDL_events_c.h"
   18.34 -#include "SDL_cgxvideo.h"
   18.35 -#include "SDL_cgxmodes_c.h"
   18.36 -#include "SDL_cgximage_c.h"
   18.37 -#include "SDL_cgxwm_c.h"
   18.38 -#include "SDL_amigaevents_c.h"
   18.39 -
   18.40 -
   18.41 -/* The translation tables from an Amiga keysym to a SDL keysym */
   18.42 -static SDLKey MISC_keymap[256];
   18.43 -SDL_keysym *amiga_TranslateKey(int code, SDL_keysym * keysym);
   18.44 -struct IOStdReq *ConReq = NULL;
   18.45 -struct MsgPort *ConPort = NULL;
   18.46 -
   18.47 -/* Note:  The X server buffers and accumulates mouse motion events, so
   18.48 -   the motion event generated by the warp may not appear exactly as we
   18.49 -   expect it to.  We work around this (and improve performance) by only
   18.50 -   warping the pointer when it reaches the edge, and then wait for it.
   18.51 -*/
   18.52 -#define MOUSE_FUDGE_FACTOR	8
   18.53 -
   18.54 -#if 0
   18.55 -
   18.56 -static inline int
   18.57 -amiga_WarpedMotion(_THIS, struct IntuiMessage *m)
   18.58 -{
   18.59 -    int w, h, i;
   18.60 -    int deltax, deltay;
   18.61 -    int posted;
   18.62 -
   18.63 -    w = SDL_VideoSurface->w;
   18.64 -    h = SDL_VideoSurface->h;
   18.65 -    deltax = xevent->xmotion.x - mouse_last.x;
   18.66 -    deltay = xevent->xmotion.y - mouse_last.y;
   18.67 -#ifdef DEBUG_MOTION
   18.68 -    printf("Warped mouse motion: %d,%d\n", deltax, deltay);
   18.69 -#endif
   18.70 -    mouse_last.x = xevent->xmotion.x;
   18.71 -    mouse_last.y = xevent->xmotion.y;
   18.72 -    posted = SDL_PrivateMouseMotion(0, 1, deltax, deltay);
   18.73 -
   18.74 -    if ((xevent->xmotion.x < MOUSE_FUDGE_FACTOR) ||
   18.75 -        (xevent->xmotion.x > (w - MOUSE_FUDGE_FACTOR)) ||
   18.76 -        (xevent->xmotion.y < MOUSE_FUDGE_FACTOR) ||
   18.77 -        (xevent->xmotion.y > (h - MOUSE_FUDGE_FACTOR))) {
   18.78 -        /* Get the events that have accumulated */
   18.79 -        while (XCheckTypedEvent(SDL_Display, MotionNotify, xevent)) {
   18.80 -            deltax = xevent->xmotion.x - mouse_last.x;
   18.81 -            deltay = xevent->xmotion.y - mouse_last.y;
   18.82 -#ifdef DEBUG_MOTION
   18.83 -            printf("Extra mouse motion: %d,%d\n", deltax, deltay);
   18.84 -#endif
   18.85 -            mouse_last.x = xevent->xmotion.x;
   18.86 -            mouse_last.y = xevent->xmotion.y;
   18.87 -            posted += SDL_PrivateMouseMotion(0, 1, deltax, deltay);
   18.88 -        }
   18.89 -        mouse_last.x = w / 2;
   18.90 -        mouse_last.y = h / 2;
   18.91 -        XWarpPointer(SDL_Display, None, SDL_Window, 0, 0, 0, 0,
   18.92 -                     mouse_last.x, mouse_last.y);
   18.93 -        for (i = 0; i < 10; ++i) {
   18.94 -            XMaskEvent(SDL_Display, PointerMotionMask, xevent);
   18.95 -            if ((xevent->xmotion.x >
   18.96 -                 (mouse_last.x - MOUSE_FUDGE_FACTOR)) &&
   18.97 -                (xevent->xmotion.x <
   18.98 -                 (mouse_last.x + MOUSE_FUDGE_FACTOR)) &&
   18.99 -                (xevent->xmotion.y >
  18.100 -                 (mouse_last.y - MOUSE_FUDGE_FACTOR)) &&
  18.101 -                (xevent->xmotion.y < (mouse_last.y + MOUSE_FUDGE_FACTOR))) {
  18.102 -                break;
  18.103 -            }
  18.104 -#ifdef DEBUG_XEVENTS
  18.105 -            printf("Lost mouse motion: %d,%d\n", xevent->xmotion.x,
  18.106 -                   xevent->xmotion.y);
  18.107 -#endif
  18.108 -        }
  18.109 -#ifdef DEBUG_XEVENTS
  18.110 -        if (i == 10) {
  18.111 -            printf("Warning: didn't detect mouse warp motion\n");
  18.112 -        }
  18.113 -#endif
  18.114 -    }
  18.115 -    return (posted);
  18.116 -}
  18.117 -
  18.118 -#endif
  18.119 -
  18.120 -static int
  18.121 -amiga_GetButton(int code)
  18.122 -{
  18.123 -    switch (code) {
  18.124 -    case IECODE_MBUTTON:
  18.125 -        return SDL_BUTTON_MIDDLE;
  18.126 -    case IECODE_RBUTTON:
  18.127 -        return SDL_BUTTON_RIGHT;
  18.128 -    default:
  18.129 -        return SDL_BUTTON_LEFT;
  18.130 -    }
  18.131 -}
  18.132 -
  18.133 -static int
  18.134 -amiga_DispatchEvent(_THIS, struct IntuiMessage *msg)
  18.135 -{
  18.136 -    int class = msg->Class, code = msg->Code;
  18.137 -    int posted;
  18.138 -
  18.139 -    posted = 0;
  18.140 -    switch (class) {
  18.141 -        /* Gaining mouse coverage? */
  18.142 -    case IDCMP_ACTIVEWINDOW:
  18.143 -        posted = SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
  18.144 -        break;
  18.145 -
  18.146 -        /* Losing mouse coverage? */
  18.147 -    case IDCMP_INACTIVEWINDOW:
  18.148 -        posted = SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
  18.149 -        break;
  18.150 -#if 0
  18.151 -        /* Gaining input focus? */
  18.152 -    case IDCMP_ACTIVEWINDOW:
  18.153 -        posted = SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
  18.154 -
  18.155 -        /* Queue entry into fullscreen mode */
  18.156 -        switch_waiting = 0x01 | SDL_FULLSCREEN;
  18.157 -        switch_time = SDL_GetTicks() + 1500;
  18.158 -        break;
  18.159 -
  18.160 -        /* Losing input focus? */
  18.161 -    case IDCMP_INACTIVEWINDOW:
  18.162 -        posted = SDL_PrivateAppActive(0, SDL_APPINPUTFOCUS);
  18.163 -
  18.164 -        /* Queue leaving fullscreen mode */
  18.165 -        switch_waiting = 0x01;
  18.166 -        switch_time = SDL_GetTicks() + 200;
  18.167 -        break;
  18.168 -#endif
  18.169 -        /* Mouse motion? */
  18.170 -    case IDCMP_MOUSEMOVE:
  18.171 -        if (SDL_VideoSurface) {
  18.172 -            posted = SDL_PrivateMouseMotion(0, 0,
  18.173 -                                            msg->MouseX -
  18.174 -                                            SDL_Window->BorderLeft,
  18.175 -                                            msg->MouseY -
  18.176 -                                            SDL_Window->BorderTop);
  18.177 -        }
  18.178 -        break;
  18.179 -
  18.180 -        /* Mouse button press? */
  18.181 -    case IDCMP_MOUSEBUTTONS:
  18.182 -
  18.183 -        if (!(code & IECODE_UP_PREFIX)) {
  18.184 -            posted = SDL_PrivateMouseButton(SDL_PRESSED,
  18.185 -                                            amiga_GetButton(code), 0, 0);
  18.186 -        }
  18.187 -        /* Mouse button release? */
  18.188 -        else {
  18.189 -            code &= ~IECODE_UP_PREFIX;
  18.190 -            posted = SDL_PrivateMouseButton(SDL_RELEASED,
  18.191 -                                            amiga_GetButton(code), 0, 0);
  18.192 -        }
  18.193 -        break;
  18.194 -
  18.195 -    case IDCMP_RAWKEY:
  18.196 -
  18.197 -        /* Key press? */
  18.198 -
  18.199 -        if (!(code & IECODE_UP_PREFIX)) {
  18.200 -            SDL_keysym keysym;
  18.201 -            posted = SDL_PrivateKeyboard(SDL_PRESSED,
  18.202 -                                         amiga_TranslateKey(code, &keysym));
  18.203 -        } else {
  18.204 -            /* Key release? */
  18.205 -
  18.206 -            SDL_keysym keysym;
  18.207 -            code &= ~IECODE_UP_PREFIX;
  18.208 -
  18.209 -            /* Check to see if this is a repeated key */
  18.210 -/*			if ( ! X11_KeyRepeat(SDL_Display, &xevent) )  */
  18.211 -
  18.212 -            posted = SDL_PrivateKeyboard(SDL_RELEASED,
  18.213 -                                         amiga_TranslateKey(code, &keysym));
  18.214 -        }
  18.215 -        break;
  18.216 -        /* Have we been iconified? */
  18.217 -#if 0
  18.218 -    case UnmapNotify:
  18.219 -        {
  18.220 -#ifdef DEBUG_XEVENTS
  18.221 -            printf("UnmapNotify!\n");
  18.222 -#endif
  18.223 -            posted =
  18.224 -                SDL_PrivateAppActive(0, SDL_APPACTIVE | SDL_APPINPUTFOCUS);
  18.225 -        }
  18.226 -        break;
  18.227 -
  18.228 -        /* Have we been restored? */
  18.229 -
  18.230 -    case MapNotify:
  18.231 -        {
  18.232 -#ifdef DEBUG_XEVENTS
  18.233 -            printf("MapNotify!\n");
  18.234 -#endif
  18.235 -
  18.236 -            posted = SDL_PrivateAppActive(1, SDL_APPACTIVE);
  18.237 -
  18.238 -            if (SDL_VideoSurface &&
  18.239 -                (SDL_VideoSurface->flags & SDL_FULLSCREEN)) {
  18.240 -                CGX_EnterFullScreen(this);
  18.241 -            } else {
  18.242 -                X11_GrabInputNoLock(this, this->input_grab);
  18.243 -            }
  18.244 -            if (SDL_VideoSurface) {
  18.245 -                CGX_RefreshDisplay(this);
  18.246 -            }
  18.247 -        }
  18.248 -        break;
  18.249 -    case Expose:
  18.250 -        if (SDL_VideoSurface && (xevent.xexpose.count == 0)) {
  18.251 -            CGX_RefreshDisplay(this);
  18.252 -        }
  18.253 -        break;
  18.254 -#endif
  18.255 -
  18.256 -        /* Have we been resized? */
  18.257 -    case IDCMP_NEWSIZE:
  18.258 -        SDL_PrivateResize(SDL_Window->Width - SDL_Window->BorderLeft -
  18.259 -                          SDL_Window->BorderRight,
  18.260 -                          SDL_Window->Height - SDL_Window->BorderTop -
  18.261 -                          SDL_Window->BorderBottom);
  18.262 -
  18.263 -        break;
  18.264 -
  18.265 -        /* Have we been requested to quit? */
  18.266 -    case IDCMP_CLOSEWINDOW:
  18.267 -        posted = SDL_PrivateQuit();
  18.268 -        break;
  18.269 -
  18.270 -        /* Do we need to refresh ourselves? */
  18.271 -
  18.272 -    default:
  18.273 -        {
  18.274 -            /* Only post the event if we're watching for it */
  18.275 -            if (SDL_ProcessEvents[SDL_SYSWMEVENT] == SDL_ENABLE) {
  18.276 -                SDL_SysWMmsg wmmsg;
  18.277 -
  18.278 -                SDL_VERSION(&wmmsg.version);
  18.279 -#if 0
  18.280 -                wmmsg.subsystem = SDL_SYSWM_CGX;
  18.281 -                wmmsg.event.xevent = xevent;
  18.282 -#endif
  18.283 -                posted = SDL_PrivateSysWMEvent(&wmmsg);
  18.284 -            }
  18.285 -        }
  18.286 -        break;
  18.287 -    }
  18.288 -    ReplyMsg((struct Message *) msg);
  18.289 -
  18.290 -
  18.291 -    return (posted);
  18.292 -}
  18.293 -
  18.294 -void
  18.295 -amiga_PumpEvents(_THIS)
  18.296 -{
  18.297 -    int pending;
  18.298 -    struct IntuiMessage *m;
  18.299 -
  18.300 -    /* Keep processing pending events */
  18.301 -    pending = 0;
  18.302 -    while (m = (struct IntuiMessage *) GetMsg(SDL_Window->UserPort)) {
  18.303 -        amiga_DispatchEvent(this, m);
  18.304 -        ++pending;
  18.305 -    }
  18.306 -}
  18.307 -
  18.308 -void
  18.309 -amiga_InitKeymap(void)
  18.310 -{
  18.311 -    int i;
  18.312 -
  18.313 -    /* Map the miscellaneous keys */
  18.314 -    for (i = 0; i < SDL_arraysize(MISC_keymap); ++i)
  18.315 -        MISC_keymap[i] = SDLK_UNKNOWN;
  18.316 -
  18.317 -    /* These X keysyms have 0xFF as the high byte */
  18.318 -    MISC_keymap[65] = SDLK_BACKSPACE;
  18.319 -    MISC_keymap[66] = SDLK_TAB;
  18.320 -    MISC_keymap[70] = SDLK_CLEAR;
  18.321 -    MISC_keymap[70] = SDLK_DELETE;
  18.322 -    MISC_keymap[68] = SDLK_RETURN;
  18.323 -//      MISC_keymap[XK_Pause&0xFF] = SDLK_PAUSE;
  18.324 -    MISC_keymap[69] = SDLK_ESCAPE;
  18.325 -    MISC_keymap[70] = SDLK_DELETE;
  18.326 -/*
  18.327 -	SDLK_SPACE		= 32,
  18.328 -	SDLK_MINUS		= 45,
  18.329 -	SDLK_LESS		= 60,
  18.330 -	SDLK_COMMA		= 44,
  18.331 -	SDLK_PERIOD		= 46,
  18.332 -	SDLK_0			= 48,
  18.333 -	SDLK_1			= 49,
  18.334 -	SDLK_2			= 50,
  18.335 -	SDLK_3			= 51,
  18.336 -	SDLK_4			= 52,
  18.337 -	SDLK_5			= 53,
  18.338 -	SDLK_6			= 54,
  18.339 -	SDLK_7			= 55,
  18.340 -	SDLK_8			= 56,
  18.341 -	SDLK_9			= 57,
  18.342 -	SDLK_BACKQUOTE		= 96,
  18.343 -	SDLK_BACKSLASH		= 92,
  18.344 -	SDLK_a			= 97,
  18.345 -	SDLK_b			= 98,
  18.346 -	SDLK_c			= 99,
  18.347 -	SDLK_d			= 100,
  18.348 -	SDLK_e			= 101,
  18.349 -	SDLK_f			= 102,
  18.350 -	SDLK_g			= 103,
  18.351 -	SDLK_h			= 104,
  18.352 -	SDLK_i			= 105,
  18.353 -	SDLK_j			= 106,
  18.354 -	SDLK_k			= 107,
  18.355 -	SDLK_l			= 108,
  18.356 -	SDLK_m			= 109,
  18.357 -	SDLK_n			= 110,
  18.358 -	SDLK_o			= 111,
  18.359 -	SDLK_p			= 112,
  18.360 -	SDLK_q			= 113,
  18.361 -	SDLK_r			= 114,
  18.362 -	SDLK_s			= 115,
  18.363 -	SDLK_t			= 116,
  18.364 -	SDLK_u			= 117,
  18.365 -	SDLK_v			= 118,
  18.366 -	SDLK_w			= 119,
  18.367 -	SDLK_x			= 120,
  18.368 -	SDLK_y			= 121,
  18.369 -	SDLK_z			= 122,
  18.370 -*/
  18.371 -    MISC_keymap[15] = SDLK_KP0; /* Keypad 0-9 */
  18.372 -    MISC_keymap[29] = SDLK_KP1;
  18.373 -    MISC_keymap[30] = SDLK_KP2;
  18.374 -    MISC_keymap[31] = SDLK_KP3;
  18.375 -    MISC_keymap[45] = SDLK_KP4;
  18.376 -    MISC_keymap[46] = SDLK_KP5;
  18.377 -    MISC_keymap[47] = SDLK_KP6;
  18.378 -    MISC_keymap[61] = SDLK_KP7;
  18.379 -    MISC_keymap[62] = SDLK_KP8;
  18.380 -    MISC_keymap[63] = SDLK_KP9;
  18.381 -    MISC_keymap[60] = SDLK_KP_PERIOD;
  18.382 -    MISC_keymap[92] = SDLK_KP_DIVIDE;
  18.383 -    MISC_keymap[93] = SDLK_KP_MULTIPLY;
  18.384 -    MISC_keymap[74] = SDLK_KP_MINUS;
  18.385 -    MISC_keymap[94] = SDLK_KP_PLUS;
  18.386 -    MISC_keymap[67] = SDLK_KP_ENTER;
  18.387 -//      MISC_keymap[XK_KP_Equal&0xFF] = SDLK_KP_EQUALS;
  18.388 -
  18.389 -    MISC_keymap[76] = SDLK_UP;
  18.390 -    MISC_keymap[77] = SDLK_DOWN;
  18.391 -    MISC_keymap[78] = SDLK_RIGHT;
  18.392 -    MISC_keymap[79] = SDLK_LEFT;
  18.393 -/*
  18.394 -	MISC_keymap[XK_Insert&0xFF] = SDLK_INSERT;
  18.395 -	MISC_keymap[XK_Home&0xFF] = SDLK_HOME;
  18.396 -	MISC_keymap[XK_End&0xFF] = SDLK_END;
  18.397 -*/
  18.398 -// Mappati sulle parentesi del taastierino
  18.399 -    MISC_keymap[90] = SDLK_PAGEUP;
  18.400 -    MISC_keymap[91] = SDLK_PAGEDOWN;
  18.401 -
  18.402 -    MISC_keymap[80] = SDLK_F1;
  18.403 -    MISC_keymap[81] = SDLK_F2;
  18.404 -    MISC_keymap[82] = SDLK_F3;
  18.405 -    MISC_keymap[83] = SDLK_F4;
  18.406 -    MISC_keymap[84] = SDLK_F5;
  18.407 -    MISC_keymap[85] = SDLK_F6;
  18.408 -    MISC_keymap[86] = SDLK_F7;
  18.409 -    MISC_keymap[87] = SDLK_F8;
  18.410 -    MISC_keymap[88] = SDLK_F9;
  18.411 -    MISC_keymap[89] = SDLK_F10;
  18.412 -//      MISC_keymap[XK_F11&0xFF] = SDLK_F11;
  18.413 -//      MISC_keymap[XK_F12&0xFF] = SDLK_F12;
  18.414 -//      MISC_keymap[XK_F13&0xFF] = SDLK_F13;
  18.415 -//      MISC_keymap[XK_F14&0xFF] = SDLK_F14;
  18.416 -//      MISC_keymap[XK_F15&0xFF] = SDLK_F15;
  18.417 -
  18.418 -//      MISC_keymap[XK_Num_Lock&0xFF] = SDLK_NUMLOCK;
  18.419 -    MISC_keymap[98] = SDLK_CAPSLOCK;
  18.420 -//      MISC_keymap[XK_Scroll_Lock&0xFF] = SDLK_SCROLLOCK;
  18.421 -    MISC_keymap[97] = SDLK_RSHIFT;
  18.422 -    MISC_keymap[96] = SDLK_LSHIFT;
  18.423 -    MISC_keymap[99] = SDLK_LCTRL;
  18.424 -    MISC_keymap[99] = SDLK_LCTRL;
  18.425 -    MISC_keymap[101] = SDLK_RALT;
  18.426 -    MISC_keymap[100] = SDLK_LALT;
  18.427 -//      MISC_keymap[XK_Meta_R&0xFF] = SDLK_RMETA;
  18.428 -//      MISC_keymap[XK_Meta_L&0xFF] = SDLK_LMETA;
  18.429 -    MISC_keymap[103] = SDLK_LSUPER;     /* Left "Windows" */
  18.430 -    MISC_keymap[102] = SDLK_RSUPER;     /* Right "Windows */
  18.431 -
  18.432 -    MISC_keymap[95] = SDLK_HELP;
  18.433 -}
  18.434 -
  18.435 -SDL_keysym *
  18.436 -amiga_TranslateKey(int code, SDL_keysym * keysym)
  18.437 -{
  18.438 -#ifdef STORMC4_WOS
  18.439 -    static struct Library *KeymapBase = NULL;   /* Linking failed in WOS version if ConsoleDevice was used */
  18.440 -#else
  18.441 -    static struct Library *ConsoleDevice = NULL;
  18.442 -#endif
  18.443 -
  18.444 -    /* Get the raw keyboard scancode */
  18.445 -    keysym->scancode = code;
  18.446 -    keysym->sym = MISC_keymap[code];
  18.447 -
  18.448 -#ifdef DEBUG_KEYS
  18.449 -    fprintf(stderr, "Translating key 0x%.4x (%d)\n", xsym, xkey->keycode);
  18.450 -#endif
  18.451 -    /* Get the translated SDL virtual keysym */
  18.452 -    if (keysym->sym == SDLK_UNKNOWN) {
  18.453 -#ifdef STORMC4_WOS
  18.454 -        if (!KeymapBase)
  18.455 -#else
  18.456 -        if (!ConsoleDevice)
  18.457 -#endif
  18.458 -        {
  18.459 -#ifdef STORMC4_WOS
  18.460 -            KeymapBase = OpenLibrary("keymap.library", 0L);
  18.461 -#else
  18.462 -            if (ConPort = CreateMsgPort()) {
  18.463 -                if (ConReq =
  18.464 -                    CreateIORequest(ConPort, sizeof(struct IOStdReq))) {
  18.465 -                    if (!OpenDevice
  18.466 -                        ("console.device", -1,
  18.467 -                         (struct IORequest *) ConReq, 0))
  18.468 -                        ConsoleDevice = (struct Library *) ConReq->io_Device;
  18.469 -                    else {
  18.470 -                        DeleteIORequest(ConReq);
  18.471 -                        ConReq = NULL;
  18.472 -                    }
  18.473 -                } else {
  18.474 -                    DeleteMsgPort(ConPort);
  18.475 -                    ConPort = NULL;
  18.476 -                }
  18.477 -            }
  18.478 -#endif
  18.479 -        }
  18.480 -#ifdef STORMC4_WOS
  18.481 -        if (KeymapBase)
  18.482 -#else
  18.483 -        if (ConsoleDevice)
  18.484 -#endif
  18.485 -        {
  18.486 -            struct InputEvent event;
  18.487 -            long actual;
  18.488 -            char buffer[5];
  18.489 -
  18.490 -            event.ie_Qualifier = 0;
  18.491 -            event.ie_Class = IECLASS_RAWKEY;
  18.492 -            event.ie_SubClass = 0L;
  18.493 -            event.ie_Code = code;
  18.494 -            event.ie_X = event.ie_Y = 0;
  18.495 -            event.ie_EventAddress = NULL;
  18.496 -            event.ie_NextEvent = NULL;
  18.497 -            event.ie_Prev1DownCode = event.ie_Prev1DownQual =
  18.498 -                event.ie_Prev2DownCode = event.ie_Prev2DownQual = 0;
  18.499 -
  18.500 -#ifdef STORMC4_WOS
  18.501 -            if ((actual = MapRawKey(&event, buffer, 5, NULL)) >= 0)
  18.502 -#else
  18.503 -            if ((actual = RawKeyConvert(&event, buffer, 5, NULL)) >= 0)
  18.504 -#endif
  18.505 -            {
  18.506 -                if (actual > 1) {
  18.507 -                    D(bug("Warning (%ld) character conversion!\n", actual));
  18.508 -                } else if (actual == 1) {
  18.509 -                    keysym->sym = *buffer;
  18.510 -                    D(bug("Converted rawcode %ld to <%lc>\n", code, *buffer));
  18.511 -// Bufferizzo x le successive chiamate!
  18.512 -                    MISC_keymap[code] = *buffer;
  18.513 -                }
  18.514 -            }
  18.515 -        }
  18.516 -
  18.517 -    }
  18.518 -    keysym->mod = KMOD_NONE;
  18.519 -
  18.520 -    /* If UNICODE is on, get the UNICODE value for the key */
  18.521 -    keysym->unicode = 0;
  18.522 -    if (SDL_TranslateUNICODE) {
  18.523 -#if 0
  18.524 -        static XComposeStatus state;
  18.525 -        /* Until we handle the IM protocol, use XLookupString() */
  18.526 -        unsigned char keybuf[32];
  18.527 -        if (XLookupString(xkey, (char *) keybuf, sizeof(keybuf),
  18.528 -                          NULL, &state)) {
  18.529 -            keysym->unicode = keybuf[0];
  18.530 -        }
  18.531 -#endif
  18.532 -    }
  18.533 -    return (keysym);
  18.534 -}
  18.535 -
  18.536 -void
  18.537 -amiga_InitOSKeymap(_THIS)
  18.538 -{
  18.539 -    amiga_InitKeymap();
  18.540 -}
  18.541 -
  18.542 -/* vi: set ts=4 sw=4 expandtab: */
    19.1 --- a/src/video/cybergfx/SDL_amigaevents_c.h	Sun Oct 29 03:39:13 2006 +0000
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,29 +0,0 @@
    19.4 -/*
    19.5 -    SDL - Simple DirectMedia Layer
    19.6 -    Copyright (C) 1997-2006 Sam Lantinga
    19.7 -
    19.8 -    This library is free software; you can redistribute it and/or
    19.9 -    modify it under the terms of the GNU Lesser General Public
   19.10 -    License as published by the Free Software Foundation; either
   19.11 -    version 2.1 of the License, or (at your option) any later version.
   19.12 -
   19.13 -    This library is distributed in the hope that it will be useful,
   19.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   19.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   19.16 -    Lesser General Public License for more details.
   19.17 -
   19.18 -    You should have received a copy of the GNU Lesser General Public
   19.19 -    License along with this library; if not, write to the Free Software
   19.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   19.21 -
   19.22 -    Sam Lantinga
   19.23 -    slouken@libsdl.org
   19.24 -*/
   19.25 -#include "SDL_config.h"
   19.26 -
   19.27 -#include "SDL_cgxvideo.h"
   19.28 -
   19.29 -/* Functions to be exported */
   19.30 -extern void amiga_InitOSKeymap(_THIS);
   19.31 -extern void amiga_PumpEvents(_THIS);
   19.32 -/* vi: set ts=4 sw=4 expandtab: */
    20.1 --- a/src/video/cybergfx/SDL_amigamouse.c	Sun Oct 29 03:39:13 2006 +0000
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,85 +0,0 @@
    20.4 -/*
    20.5 -    SDL - Simple DirectMedia Layer
    20.6 -    Copyright (C) 1997-2006 Sam Lantinga
    20.7 -
    20.8 -    This library is free software; you can redistribute it and/or
    20.9 -    modify it under the terms of the GNU Lesser General Public
   20.10 -    License as published by the Free Software Foundation; either
   20.11 -    version 2.1 of the License, or (at your option) any later version.
   20.12 -
   20.13 -    This library is distributed in the hope that it will be useful,
   20.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   20.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   20.16 -    Lesser General Public License for more details.
   20.17 -
   20.18 -    You should have received a copy of the GNU Lesser General Public
   20.19 -    License along with this library; if not, write to the Free Software
   20.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   20.21 -
   20.22 -    Sam Lantinga
   20.23 -    slouken@libsdl.org
   20.24 -*/
   20.25 -#include "SDL_config.h"
   20.26 -
   20.27 -#include "SDL_mouse.h"
   20.28 -#include "../../events/SDL_events_c.h"
   20.29 -#include "../SDL_cursor_c.h"
   20.30 -#include "SDL_amigamouse_c.h"
   20.31 -
   20.32 -
   20.33 -/* The implementation dependent data for the window manager cursor */
   20.34 -
   20.35 -typedef void *WMCursor;
   20.36 -
   20.37 -void
   20.38 -amiga_FreeWMCursor(_THIS, WMcursor * cursor)
   20.39 -{
   20.40 -}
   20.41 -
   20.42 -WMcursor *
   20.43 -amiga_CreateWMCursor(_THIS,
   20.44 -                     Uint8 * data, Uint8 * mask, int w, int h, int hot_x,
   20.45 -                     int hot_y)
   20.46 -{
   20.47 -    return (WMcursor *) 1;      // Amiga has an Hardware cursor, so it's ok to return something unuseful but true
   20.48 -}
   20.49 -
   20.50 -int
   20.51 -amiga_ShowWMCursor(_THIS, WMcursor * cursor)
   20.52 -{
   20.53 -    /* Don't do anything if the display is gone */
   20.54 -    if (SDL_Display == NULL) {
   20.55 -        return (0);
   20.56 -    }
   20.57 -
   20.58 -    /* Set the Amiga prefs cursor cursor, or blank if cursor is NULL */
   20.59 -
   20.60 -    if (SDL_Window) {
   20.61 -        SDL_Lock_EventThread();
   20.62 -        if (cursor == NULL) {
   20.63 -            if (SDL_BlankCursor != NULL) {
   20.64 -// Hide cursor HERE
   20.65 -                SetPointer(SDL_Window, (UWORD *) SDL_BlankCursor, 1, 1, 0, 0);
   20.66 -            }
   20.67 -        } else {
   20.68 -// Show cursor
   20.69 -            ClearPointer(SDL_Window);
   20.70 -        }
   20.71 -        SDL_Unlock_EventThread();
   20.72 -    }
   20.73 -    return (1);
   20.74 -}
   20.75 -
   20.76 -void
   20.77 -amiga_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
   20.78 -{
   20.79 -/* FIXME: Not implemented */
   20.80 -}
   20.81 -
   20.82 -/* Check to see if we need to enter or leave mouse relative mode */
   20.83 -void
   20.84 -amiga_CheckMouseMode(_THIS)
   20.85 -{
   20.86 -}
   20.87 -
   20.88 -/* vi: set ts=4 sw=4 expandtab: */
    21.1 --- a/src/video/cybergfx/SDL_amigamouse_c.h	Sun Oct 29 03:39:13 2006 +0000
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,34 +0,0 @@
    21.4 -/*
    21.5 -    SDL - Simple DirectMedia Layer
    21.6 -    Copyright (C) 1997-2006 Sam Lantinga
    21.7 -
    21.8 -    This library is free software; you can redistribute it and/or
    21.9 -    modify it under the terms of the GNU Lesser General Public
   21.10 -    License as published by the Free Software Foundation; either
   21.11 -    version 2.1 of the License, or (at your option) any later version.
   21.12 -
   21.13 -    This library is distributed in the hope that it will be useful,
   21.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   21.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   21.16 -    Lesser General Public License for more details.
   21.17 -
   21.18 -    You should have received a copy of the GNU Lesser General Public
   21.19 -    License along with this library; if not, write to the Free Software
   21.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   21.21 -
   21.22 -    Sam Lantinga
   21.23 -    slouken@libsdl.org
   21.24 -*/
   21.25 -#include "SDL_config.h"
   21.26 -
   21.27 -#include "SDL_cgxvideo.h"
   21.28 -
   21.29 -/* Functions to be exported */
   21.30 -extern void amiga_FreeWMCursor(_THIS, WMcursor * cursor);
   21.31 -extern WMcursor *amiga_CreateWMCursor(_THIS,
   21.32 -                                      Uint8 * data, Uint8 * mask, int w,
   21.33 -                                      int h, int hot_x, int hot_y);
   21.34 -extern int amiga_ShowWMCursor(_THIS, WMcursor * cursor);
   21.35 -extern void amiga_WarpWMCursor(_THIS, Uint16 x, Uint16 y);
   21.36 -extern void amiga_CheckMouseMode(_THIS);
   21.37 -/* vi: set ts=4 sw=4 expandtab: */
    22.1 --- a/src/video/cybergfx/SDL_cgxaccel.c	Sun Oct 29 03:39:13 2006 +0000
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,272 +0,0 @@
    22.4 -/*
    22.5 -    SDL - Simple DirectMedia Layer
    22.6 -    Copyright (C) 1997-2006 Sam Lantinga
    22.7 -
    22.8 -    This library is free software; you can redistribute it and/or
    22.9 -    modify it under the terms of the GNU Lesser General Public
   22.10 -    License as published by the Free Software Foundation; either
   22.11 -    version 2.1 of the License, or (at your option) any later version.
   22.12 -
   22.13 -    This library is distributed in the hope that it will be useful,
   22.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   22.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   22.16 -    Lesser General Public License for more details.
   22.17 -
   22.18 -    You should have received a copy of the GNU Lesser General Public
   22.19 -    License along with this library; if not, write to the Free Software
   22.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   22.21 -
   22.22 -    Sam Lantinga
   22.23 -    slouken@libsdl.org
   22.24 -*/
   22.25 -#include "SDL_config.h"
   22.26 -
   22.27 -#include "SDL_endian.h"
   22.28 -#include "SDL_video.h"
   22.29 -#include "../SDL_sysvideo.h"
   22.30 -#include "../SDL_blit.h"
   22.31 -#include "SDL_cgxvideo.h"
   22.32 -
   22.33 -static int CGX_HWAccelBlit(SDL_Surface * src, SDL_Rect * srcrect,
   22.34 -                           SDL_Surface * dst, SDL_Rect * dstrect);
   22.35 -
   22.36 -// These are needed to avoid register troubles with gcc -O2!
   22.37 -
   22.38 -#if defined(__SASC) || defined(__PPC__) || defined(MORPHOS)
   22.39 -#define BMKBRP(a,b,c,d,e,f,g,h,i,j) BltMaskBitMapRastPort(a,b,c,d,e,f,g,h,i,j)
   22.40 -#define	BBRP(a,b,c,d,e,f,g,h,i) BltBitMapRastPort(a,b,c,d,e,f,g,h,i)
   22.41 -#define BBB(a,b,c,d,e,f,g,h,i,j,k) BltBitMap(a,b,c,d,e,f,g,h,i,j,k)
   22.42 -#else
   22.43 -void
   22.44 -BMKBRP(struct BitMap *a, WORD b, WORD c, struct RastPort *d, WORD e, WORD f,
   22.45 -       WORD g, WORD h, UBYTE i, APTR j)
   22.46 -{
   22.47 -    BltMaskBitMapRastPort(a, b, c, d, e, f, g, h, i, j);
   22.48 -}
   22.49 -
   22.50 -void
   22.51 -BBRP(struct BitMap *a, WORD b, WORD c, struct RastPort *d, WORD e, WORD f,
   22.52 -     WORD g, WORD h, UBYTE i)
   22.53 -{
   22.54 -    BltBitMapRastPort(a, b, c, d, e, f, g, h, i);
   22.55 -}
   22.56 -
   22.57 -void
   22.58 -BBB(struct BitMap *a, WORD b, WORD c, struct BitMap *d, WORD e, WORD f,
   22.59 -    WORD g, WORD h, UBYTE i, UBYTE j, UWORD * k)
   22.60 -{
   22.61 -    BltBitMap(a, b, c, d, e, f, g, h, i, j, k);
   22.62 -}
   22.63 -#endif
   22.64 -
   22.65 -int
   22.66 -CGX_SetHWColorKey(_THIS, SDL_Surface * surface, Uint32 key)
   22.67 -{
   22.68 -    if (surface->hwdata) {
   22.69 -        if (surface->hwdata->mask)
   22.70 -            SDL_free(surface->hwdata->mask);
   22.71 -
   22.72 -        if (surface->hwdata->mask =
   22.73 -            SDL_malloc(RASSIZE(surface->w, surface->h))) {
   22.74 -            Uint32 pitch, ok = 0;
   22.75 -            APTR lock;
   22.76 -
   22.77 -            SDL_memset(surface->hwdata->mask, 255,
   22.78 -                       RASSIZE(surface->w, surface->h));
   22.79 -
   22.80 -            D(bug
   22.81 -              ("Building colorkey mask: color: %ld, size: %ld x %ld, %ld bytes...Bpp:%ld\n",
   22.82 -               key, surface->w, surface->h, RASSIZE(surface->w,
   22.83 -                                                    surface->h),
   22.84 -               surface->format->BytesPerPixel));
   22.85 -
   22.86 -            if (lock =
   22.87 -                LockBitMapTags(surface->hwdata->bmap, LBMI_BASEADDRESS,
   22.88 -                               (ULONG) & surface->pixels,
   22.89 -                               LBMI_BYTESPERROW, (ULONG) & pitch, TAG_DONE)) {
   22.90 -                switch (surface->format->BytesPerPixel) {
   22.91 -                case 1:
   22.92 -                    {
   22.93 -                        unsigned char k = key;
   22.94 -                        register int i, j, t;
   22.95 -                        register unsigned char *dest =
   22.96 -                            surface->hwdata->mask, *map = surface->pixels;
   22.97 -
   22.98 -                        pitch -= surface->w;
   22.99 -
  22.100 -                        for (i = 0; i < surface->h; i++) {
  22.101 -                            for (t = 128, j = 0; j < surface->w; j++) {
  22.102 -                                if (*map == k)
  22.103 -                                    *dest &= ~t;
  22.104 -
  22.105 -                                t >>= 1;
  22.106 -
  22.107 -                                if (t == 0) {
  22.108 -                                    dest++;
  22.109 -                                    t = 128;
  22.110 -                                }
  22.111 -                                map++;
  22.112 -                            }
  22.113 -                            map += pitch;
  22.114 -                        }
  22.115 -                    }
  22.116 -                    break;
  22.117 -                case 2:
  22.118 -                    {
  22.119 -                        Uint16 k = key, *mapw;
  22.120 -                        register int i, j, t;
  22.121 -                        register unsigned char *dest =
  22.122 -                            surface->hwdata->mask, *map = surface->pixels;
  22.123 -
  22.124 -                        for (i = surface->h; i; --i) {
  22.125 -                            mapw = (Uint16 *) map;
  22.126 -
  22.127 -                            for (t = 128, j = surface->w; j; --j) {
  22.128 -                                if (*mapw == k)
  22.129 -                                    *dest &= ~t;
  22.130 -
  22.131 -                                t >>= 1;
  22.132 -
  22.133 -                                if (t == 0) {
  22.134 -                                    dest++;
  22.135 -                                    t = 128;
  22.136 -                                }
  22.137 -                                mapw++;
  22.138 -                            }
  22.139 -                            map += pitch;
  22.140 -                        }
  22.141 -                    }
  22.142 -                    break;
  22.143 -                case 4:
  22.144 -                    {
  22.145 -                        Uint32 *mapl;
  22.146 -                        register int i, j, t;
  22.147 -                        register unsigned char *dest =
  22.148 -                            surface->hwdata->mask, *map = surface->pixels;
  22.149 -
  22.150 -                        for (i = surface->h; i; --i) {
  22.151 -                            mapl = (Uint32 *) map;
  22.152 -
  22.153 -                            for (t = 128, j = surface->w; j; --j) {
  22.154 -                                if (*mapl == key)
  22.155 -                                    *dest &= ~t;
  22.156 -
  22.157 -                                t >>= 1;
  22.158 -
  22.159 -                                if (t == 0) {
  22.160 -                                    dest++;
  22.161 -                                    t = 128;
  22.162 -                                }
  22.163 -                                mapl++;
  22.164 -                            }
  22.165 -                            map += pitch;
  22.166 -                        }
  22.167 -
  22.168 -                    }
  22.169 -                    break;
  22.170 -                default:
  22.171 -                    D(bug("Pixel mode non supported for color key..."));
  22.172 -                    SDL_free(surface->hwdata->mask);
  22.173 -                    surface->hwdata->mask = NULL;
  22.174 -                    ok = -1;
  22.175 -                }
  22.176 -                UnLockBitMap(lock);
  22.177 -                D(bug("...Colorkey built!\n"));
  22.178 -                return ok;
  22.179 -            }
  22.180 -        }
  22.181 -    }
  22.182 -    D(bug("HW colorkey not supported for this depth\n"));
  22.183 -
  22.184 -    return -1;
  22.185 -}
  22.186 -
  22.187 -int
  22.188 -CGX_CheckHWBlit(_THIS, SDL_Surface * src, SDL_Surface * dst)
  22.189 -{
  22.190 -// Doesn't support yet alpha blitting
  22.191 -
  22.192 -    if (src->hwdata && !(src->flags & (SDL_SRCALPHA))) {
  22.193 -        D(bug("CheckHW blit... OK!\n"));
  22.194 -
  22.195 -        if ((src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) {
  22.196 -            if (CGX_SetHWColorKey(this, src, src->format->colorkey) < 0) {
  22.197 -                src->flags &= ~SDL_HWACCEL;
  22.198 -                return -1;
  22.199 -            }
  22.200 -        }
  22.201 -
  22.202 -        src->flags |= SDL_HWACCEL;
  22.203 -        src->map->hw_blit = CGX_HWAccelBlit;
  22.204 -        return 1;
  22.205 -    } else
  22.206 -        src->flags &= ~SDL_HWACCEL;
  22.207 -
  22.208 -    D(bug("CheckHW blit... NO!\n"));
  22.209 -
  22.210 -    return 0;
  22.211 -}
  22.212 -
  22.213 -static int temprp_init = 0;
  22.214 -static struct RastPort temprp;
  22.215 -
  22.216 -static int
  22.217 -CGX_HWAccelBlit(SDL_Surface * src, SDL_Rect * srcrect,
  22.218 -                SDL_Surface * dst, SDL_Rect * dstrect)
  22.219 -{
  22.220 -    struct SDL_VideoDevice *this = src->hwdata->videodata;
  22.221 -
  22.222 -//      D(bug("Accel blit!\n"));
  22.223 -
  22.224 -    if (src->flags & SDL_SRCCOLORKEY && src->hwdata->mask) {
  22.225 -        if (dst == SDL_VideoSurface) {
  22.226 -            BMKBRP(src->hwdata->bmap, srcrect->x, srcrect->y,
  22.227 -                   SDL_RastPort, dstrect->x + SDL_Window->BorderLeft,
  22.228 -                   dstrect->y + SDL_Window->BorderTop, srcrect->w,
  22.229 -                   srcrect->h, 0xc0, src->hwdata->mask);
  22.230 -        } else if (dst->hwdata) {
  22.231 -            if (!temprp_init) {
  22.232 -                InitRastPort(&temprp);
  22.233 -                temprp_init = 1;
  22.234 -            }
  22.235 -            temprp.BitMap = (struct BitMap *) dst->hwdata->bmap;
  22.236 -
  22.237 -            BMKBRP(src->hwdata->bmap, srcrect->x, srcrect->y,
  22.238 -                   &temprp, dstrect->x, dstrect->y,
  22.239 -                   srcrect->w, srcrect->h, 0xc0, src->hwdata->mask);
  22.240 -
  22.241 -        }
  22.242 -    } else if (dst == SDL_VideoSurface) {
  22.243 -        BBRP(src->hwdata->bmap, srcrect->x, srcrect->y, SDL_RastPort,
  22.244 -             dstrect->x + SDL_Window->BorderLeft,
  22.245 -             dstrect->y + SDL_Window->BorderTop, srcrect->w, srcrect->h,
  22.246 -             0xc0);
  22.247 -    } else if (dst->hwdata)
  22.248 -        BBB(src->hwdata->bmap, srcrect->x, srcrect->y, dst->hwdata->bmap,
  22.249 -            dstrect->x, dstrect->y, srcrect->w, srcrect->h, 0xc0, 0xff, NULL);
  22.250 -
  22.251 -    return 0;
  22.252 -}
  22.253 -
  22.254 -int
  22.255 -CGX_FillHWRect(_THIS, SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color)
  22.256 -{
  22.257 -    if (dst == SDL_VideoSurface) {
  22.258 -        FillPixelArray(SDL_RastPort, dstrect->x + SDL_Window->BorderLeft,
  22.259 -                       dstrect->y + SDL_Window->BorderTop, dstrect->w,
  22.260 -                       dstrect->h, color);
  22.261 -    } else if (dst->hwdata) {
  22.262 -        if (!temprp_init) {
  22.263 -            InitRastPort(&temprp);
  22.264 -            temprp_init = 1;
  22.265 -        }
  22.266 -
  22.267 -        temprp.BitMap = (struct BitMap *) dst->hwdata->bmap;
  22.268 -
  22.269 -        FillPixelArray(&temprp, dstrect->x, dstrect->y, dstrect->w,
  22.270 -                       dstrect->h, color);
  22.271 -    }
  22.272 -    return 0;
  22.273 -}
  22.274 -
  22.275 -/* vi: set ts=4 sw=4 expandtab: */
    23.1 --- a/src/video/cybergfx/SDL_cgxgl.c	Sun Oct 29 03:39:13 2006 +0000
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,227 +0,0 @@
    23.4 -/*
    23.5 -    SDL - Simple DirectMedia Layer
    23.6 -    Copyright (C) 1997-2006 Sam Lantinga
    23.7 -
    23.8 -    This library is free software; you can redistribute it and/or
    23.9 -    modify it under the terms of the GNU Lesser General Public
   23.10 -    License as published by the Free Software Foundation; either
   23.11 -    version 2.1 of the License, or (at your option) any later version.
   23.12 -
   23.13 -    This library is distributed in the hope that it will be useful,
   23.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   23.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   23.16 -    Lesser General Public License for more details.
   23.17 -
   23.18 -    You should have received a copy of the GNU Lesser General Public
   23.19 -    License along with this library; if not, write to the Free Software
   23.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   23.21 -
   23.22 -    Sam Lantinga
   23.23 -    slouken@libsdl.org
   23.24 -*/
   23.25 -#include "SDL_config.h"
   23.26 -
   23.27 -/* StormMesa implementation of SDL OpenGL support */
   23.28 -
   23.29 -#include "SDL_cgxgl_c.h"
   23.30 -#include "SDL_cgxvideo.h"
   23.31 -
   23.32 -#if SDL_VIDEO_OPENGL
   23.33 -AmigaMesaContext glcont = NULL;
   23.34 -#endif
   23.35 -
   23.36 -/* Init OpenGL */
   23.37 -int
   23.38 -CGX_GL_Init(_THIS)
   23.39 -{
   23.40 -#if SDL_VIDEO_OPENGL
   23.41 -    int i = 0;
   23.42 -    struct TagItem attributes[14];      /* 14 should be more than enough :) */
   23.43 -    struct Window *win = (struct Window *) SDL_Window;
   23.44 -
   23.45 -    // default config. Always used...
   23.46 -    attributes[i].ti_Tag = AMA_Window;
   23.47 -    attributes[i++].ti_Data = (unsigned long) win;
   23.48 -    attributes[i].ti_Tag = AMA_Left;
   23.49 -    attributes[i++].ti_Data = 0;
   23.50 -    attributes[i].ti_Tag = AMA_Bottom;
   23.51 -    attributes[i++].ti_Data = 0;
   23.52 -    attributes[i].ti_Tag = AMA_Width;
   23.53 -    attributes[i++].ti_Data = win->Width - win->BorderLeft - win->BorderRight;
   23.54 -    attributes[i].ti_Tag = AMA_Height;
   23.55 -    attributes[i++].ti_Data =
   23.56 -        win->Height - win->BorderBottom - win->BorderTop;
   23.57 -    attributes[i].ti_Tag = AMA_DirectRender;
   23.58 -    attributes[i++].ti_Data = GL_TRUE;
   23.59 -
   23.60 -    // double buffer ?
   23.61 -    attributes[i].ti_Tag = AMA_DoubleBuf;
   23.62 -    if (this->gl_config.double_buffer) {
   23.63 -        attributes[i++].ti_Data = GL_TRUE;
   23.64 -    } else {
   23.65 -        attributes[i++].ti_Data = GL_FALSE;
   23.66 -    }
   23.67 -    // RGB(A) Mode ?
   23.68 -    attributes[i].ti_Tag = AMA_RGBMode;
   23.69 -    if (this->gl_config.red_size != 0 &&
   23.70 -        this->gl_config.blue_size != 0 && this->gl_config.green_size != 0) {
   23.71 -        attributes[i++].ti_Data = GL_TRUE;
   23.72 -    } else {
   23.73 -        attributes[i++].ti_Data = GL_FALSE;
   23.74 -    }
   23.75 -    // no depth buffer ?
   23.76 -    if (this->gl_config.depth_size == 0) {
   23.77 -        attributes[i].ti_Tag = AMA_NoDepth;
   23.78 -        attributes[i++].ti_Data = GL_TRUE;
   23.79 -    }
   23.80 -    // no stencil buffer ?
   23.81 -    if (this->gl_config.stencil_size == 0) {
   23.82 -        attributes[i].ti_Tag = AMA_NoStencil;
   23.83 -        attributes[i++].ti_Data = GL_TRUE;
   23.84 -    }
   23.85 -    // no accum buffer ?
   23.86 -    if (this->gl_config.accum_red_size != 0 &&
   23.87 -        this->gl_config.accum_blue_size != 0 &&
   23.88 -        this->gl_config.accum_green_size != 0) {
   23.89 -        attributes[i].ti_Tag = AMA_NoAccum;
   23.90 -        attributes[i++].ti_Data = GL_TRUE;
   23.91 -    }
   23.92 -    // done...
   23.93 -    attributes[i].ti_Tag = TAG_DONE;
   23.94 -
   23.95 -    glcont = AmigaMesaCreateContext(attributes);
   23.96 -    if (glcont == NULL) {
   23.97 -        SDL_SetError("Couldn't create OpenGL context");
   23.98 -        return (-1);
   23.99 -    }
  23.100 -    this->gl_data->gl_active = 1;
  23.101 -    this->gl_config.driver_loaded = 1;
  23.102 -
  23.103 -    return (0);
  23.104 -#else
  23.105 -    SDL_SetError("OpenGL support not configured");
  23.106 -    return (-1);
  23.107 -#endif
  23.108 -}
  23.109 -
  23.110 -/* Quit OpenGL */
  23.111 -void
  23.112 -CGX_GL_Quit(_THIS)
  23.113 -{
  23.114 -#if SDL_VIDEO_OPENGL
  23.115 -    if (glcont != NULL) {
  23.116 -        AmigaMesaDestroyContext(glcont);
  23.117 -        glcont = NULL;
  23.118 -        this->gl_data->gl_active = 0;
  23.119 -        this->gl_config.driver_loaded = 0;
  23.120 -    }
  23.121 -#endif
  23.122 -}
  23.123 -
  23.124 -/* Attach context to another window */
  23.125 -int
  23.126 -CGX_GL_Update(_THIS)
  23.127 -{
  23.128 -#if SDL_VIDEO_OPENGL
  23.129 -    struct TagItem tags[2];
  23.130 -    struct Window *win = (struct Window *) SDL_Window;
  23.131 -    if (glcont == NULL) {
  23.132 -        return -1;              //should never happen
  23.133 -    }
  23.134 -    tags[0].ti_Tag = AMA_Window;
  23.135 -    tags[0].ti_Data = (unsigned long) win;
  23.136 -    tags[1].ti_Tag = TAG_DONE;
  23.137 -    AmigaMesaSetRast(glcont, tags);
  23.138 -
  23.139 -    return 0;
  23.140 -#else
  23.141 -    SDL_SetError("OpenGL support not configured");
  23.142 -    return -1;
  23.143 -#endif
  23.144 -}
  23.145 -
  23.146 -#if SDL_VIDEO_OPENGL
  23.147 -
  23.148 -/* Make the current context active */
  23.149 -int
  23.150 -CGX_GL_MakeCurrent(_THIS)
  23.151 -{
  23.152 -    if (glcont == NULL)
  23.153 -        return -1;
  23.154 -
  23.155 -    AmigaMesaMakeCurrent(glcont, glcont->buffer);
  23.156 -    return 0;
  23.157 -}
  23.158 -
  23.159 -void
  23.160 -CGX_GL_SwapBuffers(_THIS)
  23.161 -{
  23.162 -    AmigaMesaSwapBuffers(glcont);
  23.163 -}
  23.164 -
  23.165 -int
  23.166 -CGX_GL_GetAttribute(_THIS, SDL_GLattr attrib, int *value)
  23.167 -{
  23.168 -    GLenum mesa_attrib;
  23.169 -
  23.170 -    switch (attrib) {
  23.171 -    case SDL_GL_RED_SIZE:
  23.172 -        mesa_attrib = GL_RED_BITS;
  23.173 -        break;
  23.174 -    case SDL_GL_GREEN_SIZE:
  23.175 -        mesa_attrib = GL_GREEN_BITS;
  23.176 -        break;
  23.177 -    case SDL_GL_BLUE_SIZE:
  23.178 -        mesa_attrib = GL_BLUE_BITS;
  23.179 -        break;
  23.180 -    case SDL_GL_ALPHA_SIZE:
  23.181 -        mesa_attrib = GL_ALPHA_BITS;
  23.182 -        break;
  23.183 -    case SDL_GL_DOUBLEBUFFER:
  23.184 -        mesa_attrib = GL_DOUBLEBUFFER;
  23.185 -        break;
  23.186 -    case SDL_GL_DEPTH_SIZE:
  23.187 -        mesa_attrib = GL_DEPTH_BITS;
  23.188 -        break;
  23.189 -    case SDL_GL_STENCIL_SIZE:
  23.190 -        mesa_attrib = GL_STENCIL_BITS;
  23.191 -        break;
  23.192 -    case SDL_GL_ACCUM_RED_SIZE:
  23.193 -        mesa_attrib = GL_ACCUM_RED_BITS;
  23.194 -        break;
  23.195 -    case SDL_GL_ACCUM_GREEN_SIZE:
  23.196 -        mesa_attrib = GL_ACCUM_GREEN_BITS;
  23.197 -        break;
  23.198 -    case SDL_GL_ACCUM_BLUE_SIZE:
  23.199 -        mesa_attrib = GL_ACCUM_BLUE_BITS;
  23.200 -        break;
  23.201 -    case SDL_GL_ACCUM_ALPHA_SIZE:
  23.202 -        mesa_attrib = GL_ACCUM_ALPHA_BITS;
  23.203 -        break;
  23.204 -    default:
  23.205 -        return -1;
  23.206 -    }
  23.207 -
  23.208 -    AmigaMesaGetConfig(glcont->visual, mesa_attrib, value);
  23.209 -    return 0;
  23.210 -}
  23.211 -
  23.212 -void *
  23.213 -CGX_GL_GetProcAddress(_THIS, const char *proc)
  23.214 -{
  23.215 -    void *func = NULL;
  23.216 -    func = AmiGetGLProc(proc);
  23.217 -    return func;
  23.218 -}
  23.219 -
  23.220 -int
  23.221 -CGX_GL_LoadLibrary(_THIS, const char *path)
  23.222 -{
  23.223 -    /* Library is always open */
  23.224 -    this->gl_config.driver_loaded = 1;
  23.225 -
  23.226 -    return 0;
  23.227 -}
  23.228 -
  23.229 -#endif /* SDL_VIDEO_OPENGL */
  23.230 -/* vi: set ts=4 sw=4 expandtab: */
    24.1 --- a/src/video/cybergfx/SDL_cgxgl_c.h	Sun Oct 29 03:39:13 2006 +0000
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,53 +0,0 @@
    24.4 -/*
    24.5 -    SDL - Simple DirectMedia Layer
    24.6 -    Copyright (C) 1997-2006 Sam Lantinga
    24.7 -
    24.8 -    This library is free software; you can redistribute it and/or
    24.9 -    modify it under the terms of the GNU Lesser General Public
   24.10 -    License as published by the Free Software Foundation; either
   24.11 -    version 2.1 of the License, or (at your option) any later version.
   24.12 -
   24.13 -    This library is distributed in the hope that it will be useful,
   24.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   24.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   24.16 -    Lesser General Public License for more details.
   24.17 -
   24.18 -    You should have received a copy of the GNU Lesser General Public
   24.19 -    License along with this library; if not, write to the Free Software
   24.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   24.21 -
   24.22 -    Sam Lantinga
   24.23 -    slouken@libsdl.org
   24.24 -*/
   24.25 -#include "SDL_config.h"
   24.26 -
   24.27 -/* StormMesa implementation of SDL OpenGL support */
   24.28 -
   24.29 -#include "../SDL_sysvideo.h"
   24.30 -
   24.31 -#define _THIS   SDL_VideoDevice *_this
   24.32 -
   24.33 -#if SDL_VIDEO_OPENGL
   24.34 -#include <GL/Amigamesa.h>
   24.35 -extern void *AmiGetGLProc(const char *proc);
   24.36 -#endif /* SDL_VIDEO_OPENGL */
   24.37 -
   24.38 -struct SDL_PrivateGLData
   24.39 -{
   24.40 -    int gl_active;
   24.41 -};
   24.42 -
   24.43 -/* OpenGL functions */
   24.44 -extern int CGX_GL_Init(_THIS);
   24.45 -extern void CGX_GL_Quit(_THIS);
   24.46 -extern int CGX_GL_Update(_THIS);
   24.47 -#if SDL_VIDEO_OPENGL
   24.48 -extern int CGX_GL_MakeCurrent(_THIS);
   24.49 -extern int CGX_GL_GetAttribute(_THIS, SDL_GLattr attrib, int *value);
   24.50 -extern void CGX_GL_SwapBuffers(_THIS);
   24.51 -extern void *CGX_GL_GetProcAddress(_THIS, const char *proc);
   24.52 -extern int CGX_GL_LoadLibrary(_THIS, const char *path);
   24.53 -#endif
   24.54 -
   24.55 -#undef _THIS
   24.56 -/* vi: set ts=4 sw=4 expandtab: */
    25.1 --- a/src/video/cybergfx/SDL_cgximage.c	Sun Oct 29 03:39:13 2006 +0000
    25.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.3 @@ -1,933 +0,0 @@
    25.4 -/*
    25.5 -    SDL - Simple DirectMedia Layer
    25.6 -    Copyright (C) 1997-2006 Sam Lantinga
    25.7 -
    25.8 -    This library is free software; you can redistribute it and/or
    25.9 -    modify it under the terms of the GNU Lesser General Public
   25.10 -    License as published by the Free Software Foundation; either
   25.11 -    version 2.1 of the License, or (at your option) any later version.
   25.12 -
   25.13 -    This library is distributed in the hope that it will be useful,
   25.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   25.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   25.16 -    Lesser General Public License for more details.
   25.17 -
   25.18 -    You should have received a copy of the GNU Lesser General Public
   25.19 -    License along with this library; if not, write to the Free Software
   25.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   25.21 -
   25.22 -    Sam Lantinga
   25.23 -    slouken@libsdl.org
   25.24 -*/
   25.25 -#include "SDL_config.h"
   25.26 -
   25.27 -#include "SDL_endian.h"
   25.28 -#include "SDL_cgximage_c.h"
   25.29 -
   25.30 -#ifdef HAVE_KSTAT
   25.31 -#include <kstat.h>
   25.32 -#endif
   25.33 -
   25.34 -#ifdef USE_CGX_WRITELUTPIXEL
   25.35 -#if defined(__SASC) || defined(__PPC__)
   25.36 -#define WLUT WriteLUTPixelArray
   25.37 -#else
   25.38 -void
   25.39 -WLUT(APTR a, UWORD b, UWORD c, UWORD d, struct RastPort *e, APTR f, UWORD g,
   25.40 -     UWORD h, UWORD i, UWORD l, UBYTE m)
   25.41 -{
   25.42 -    WriteLUTPixelArray(a, b, c, d, e, f, g, h, i, l, m);
   25.43 -}
   25.44 -#endif
   25.45 -
   25.46 -#endif
   25.47 -
   25.48 -/* Various screen update functions available */
   25.49 -static void CGX_NormalUpdate(_THIS, int numrects, SDL_Rect * rects);
   25.50 -static void CGX_FakeUpdate(_THIS, int numrects, SDL_Rect * rects);
   25.51 -
   25.52 -BOOL SafeDisp = TRUE, SafeChange = TRUE;
   25.53 -struct MsgPort *safeport = NULL, *dispport = NULL;
   25.54 -ULONG safe_sigbit, disp_sigbit;
   25.55 -int use_picasso96 = 1;
   25.56 -
   25.57 -int
   25.58 -CGX_SetupImage(_THIS, SDL_Surface * screen)
   25.59 -{
   25.60 -    SDL_Ximage = NULL;
   25.61 -
   25.62 -    if (screen->flags & SDL_HWSURFACE) {
   25.63 -        ULONG pitch;
   25.64 -
   25.65 -        if (!screen->hwdata) {
   25.66 -            if (!(screen->hwdata = SDL_malloc(sizeof(struct private_hwdata))))
   25.67 -                return -1;
   25.68 -
   25.69 -            D(bug("Creating system accel struct\n"));
   25.70 -        }
   25.71 -        screen->hwdata->lock = NULL;
   25.72 -        screen->hwdata->allocated = 0;
   25.73 -        screen->hwdata->mask = NULL;
   25.74 -        screen->hwdata->bmap = SDL_RastPort->BitMap;
   25.75 -        screen->hwdata->videodata = this;
   25.76 -
   25.77 -        if (!(screen->hwdata->lock = LockBitMapTags(screen->hwdata->bmap,
   25.78 -                                                    LBMI_BASEADDRESS,
   25.79 -                                                    (ULONG) & screen->
   25.80 -                                                    pixels,
   25.81 -                                                    LBMI_BYTESPERROW,
   25.82 -                                                    (ULONG) & pitch,
   25.83 -                                                    TAG_DONE))) {
   25.84 -            SDL_free(screen->hwdata);
   25.85 -            screen->hwdata = NULL;
   25.86 -            return -1;
   25.87 -        } else {
   25.88 -            UnLockBitMap(screen->hwdata->lock);
   25.89 -            screen->hwdata->lock = NULL;
   25.90 -        }
   25.91 -
   25.92 -        screen->pitch = pitch;
   25.93 -
   25.94 -        this->UpdateRects = CGX_FakeUpdate;
   25.95 -
   25.96 -        D(bug
   25.97 -          ("Accel video image configured (%lx, pitch %ld).\n",
   25.98 -           screen->pixels, screen->pitch));
   25.99 -        return 0;
  25.100 -    }
  25.101 -
  25.102 -    screen->pixels = SDL_malloc(screen->h * screen->pitch);
  25.103 -
  25.104 -    if (screen->pixels == NULL) {
  25.105 -        SDL_OutOfMemory();
  25.106 -        return (-1);
  25.107 -    }
  25.108 -
  25.109 -    SDL_Ximage = screen->pixels;
  25.110 -
  25.111 -    if (SDL_Ximage == NULL) {
  25.112 -        SDL_SetError("Couldn't create XImage");
  25.113 -        return (-1);
  25.114 -    }
  25.115 -
  25.116 -    this->UpdateRects = CGX_NormalUpdate;
  25.117 -
  25.118 -    return (0);
  25.119 -}
  25.120 -
  25.121 -void
  25.122 -CGX_DestroyImage(_THIS, SDL_Surface * screen)
  25.123 -{
  25.124 -    if (SDL_Ximage) {
  25.125 -        SDL_free(SDL_Ximage);
  25.126 -        SDL_Ximage = NULL;
  25.127 -    }
  25.128 -    if (screen) {
  25.129 -        screen->pixels = NULL;
  25.130 -
  25.131 -        if (screen->hwdata) {
  25.132 -            SDL_free(screen->hwdata);
  25.133 -            screen->hwdata = NULL;
  25.134 -        }
  25.135 -    }
  25.136 -}
  25.137 -
  25.138 -/* This is a hack to see whether this system has more than 1 CPU */
  25.139 -static int
  25.140 -num_CPU(void)
  25.141 -{
  25.142 -    return 1;
  25.143 -}
  25.144 -
  25.145 -int
  25.146 -CGX_ResizeImage(_THIS, SDL_Surface * screen, Uint32 flags)
  25.147 -{
  25.148 -    int retval;
  25.149 -
  25.150 -    D(bug("Calling ResizeImage()\n"));
  25.151 -
  25.152 -    CGX_DestroyImage(this, screen);
  25.153 -
  25.154 -    if (flags & SDL_INTERNALOPENGL) {   /* No image when using GL */
  25.155 -        retval = 0;
  25.156 -    } else {
  25.157 -        retval = CGX_SetupImage(this, screen);
  25.158 -        /* We support asynchronous blitting on the display */
  25.159 -        if (flags & SDL_ASYNCBLIT) {
  25.160 -            if (num_CPU() > 1) {
  25.161 -                screen->flags |= SDL_ASYNCBLIT;
  25.162 -            }
  25.163 -        }
  25.164 -    }
  25.165 -    return (retval);
  25.166 -}
  25.167 -
  25.168 -int
  25.169 -CGX_AllocHWSurface(_THIS, SDL_Surface * surface)
  25.170 -{
  25.171 -    D(bug
  25.172 -      ("Alloc HW surface...%ld x %ld x %ld!\n", surface->w, surface->h,
  25.173 -       this->hidden->depth));
  25.174 -
  25.175 -    if (surface == SDL_VideoSurface) {
  25.176 -        D(bug("Allocation skipped, it's system one!\n"));
  25.177 -        return 0;
  25.178 -    }
  25.179 -
  25.180 -    if (!surface->hwdata) {
  25.181 -        if (!(surface->hwdata = SDL_malloc(sizeof(struct private_hwdata))))
  25.182 -            return -1;
  25.183 -    }
  25.184 -
  25.185 -    surface->hwdata->mask = NULL;
  25.186 -    surface->hwdata->lock = NULL;
  25.187 -    surface->hwdata->videodata = this;
  25.188 -    surface->hwdata->allocated = 0;
  25.189 -
  25.190 -    if (surface->hwdata->bmap =
  25.191 -        AllocBitMap(surface->w, surface->h, this->hidden->depth,
  25.192 -                    BMF_MINPLANES, SDL_Display->RastPort.BitMap)) {
  25.193 -        surface->hwdata->allocated = 1;
  25.194 -        surface->flags |= SDL_HWSURFACE;
  25.195 -        D(bug("...OK\n"));
  25.196 -        return 0;
  25.197 -    } else {
  25.198 -        SDL_free(surface->hwdata);
  25.199 -        surface->hwdata = NULL;
  25.200 -    }
  25.201 -
  25.202 -    return (-1);
  25.203 -}
  25.204 -
  25.205 -void
  25.206 -CGX_FreeHWSurface(_THIS, SDL_Surface * surface)
  25.207 -{
  25.208 -    if (surface && surface != SDL_VideoSurface && surface->hwdata) {
  25.209 -        D(bug("Free hw surface.\n"));
  25.210 -
  25.211 -        if (surface->hwdata->mask)
  25.212 -            SDL_free(surface->hwdata->mask);
  25.213 -
  25.214 -        if (surface->hwdata->bmap && surface->hwdata->allocated)
  25.215 -            FreeBitMap(surface->hwdata->bmap);
  25.216 -
  25.217 -        SDL_free(surface->hwdata);
  25.218 -        surface->hwdata = NULL;
  25.219 -        surface->pixels = NULL;
  25.220 -        D(bug("end of free hw surface\n"));
  25.221 -    }
  25.222 -    return;
  25.223 -}
  25.224 -
  25.225 -int
  25.226 -CGX_LockHWSurface(_THIS, SDL_Surface * surface)
  25.227 -{
  25.228 -    if (surface->hwdata) {
  25.229 -//              D(bug("Locking a bitmap...\n"));
  25.230 -        if (!surface->hwdata->lock) {
  25.231 -            Uint32 pitch;
  25.232 -
  25.233 -            if (!
  25.234 -                (surface->hwdata->lock =
  25.235 -                 LockBitMapTags(surface->hwdata->bmap, LBMI_BASEADDRESS,
  25.236 -                                (ULONG) & surface->pixels,
  25.237 -                                LBMI_BYTESPERROW, (ULONG) & pitch, TAG_DONE)))
  25.238 -                return -1;
  25.239 -
  25.240 -// surface->pitch e' a 16bit!
  25.241 -
  25.242 -            surface->pitch = pitch;
  25.243 -
  25.244 -            if (!currently_fullscreen && surface == SDL_VideoSurface)
  25.245 -                surface->pixels =
  25.246 -                    ((char *) surface->pixels) +
  25.247 -                    (surface->pitch *
  25.248 -                     (SDL_Window->BorderTop + SDL_Window->TopEdge) +
  25.249 -                     surface->format->BytesPerPixel *
  25.250 -                     (SDL_Window->BorderLeft + SDL_Window->LeftEdge));
  25.251 -        }
  25.252 -        D(
  25.253 -             else
  25.254 -             bug("Already locked!!!\n"));
  25.255 -    }
  25.256 -    return (0);
  25.257 -}
  25.258 -
  25.259 -void
  25.260 -CGX_UnlockHWSurface(_THIS, SDL_Surface * surface)
  25.261 -{
  25.262 -    if (surface->hwdata && surface->hwdata->lock) {
  25.263 -        UnLockBitMap(surface->hwdata->lock);
  25.264 -        surface->hwdata->lock = NULL;
  25.265 -//              surface->pixels=NULL;
  25.266 -    }
  25.267 -}
  25.268 -
  25.269 -int
  25.270 -CGX_FlipHWSurface(_THIS, SDL_Surface * surface)
  25.271 -{
  25.272 -    static int current = 0;
  25.273 -
  25.274 -    if (this->hidden->dbuffer) {
  25.275 -        if (!SafeChange) {
  25.276 -            Wait(disp_sigbit);
  25.277 -// Non faccio nulla, vuoto solo la porta
  25.278 -            while (GetMsg(dispport) != NULL);
  25.279 -            SafeChange = TRUE;
  25.280 -        }
  25.281 -
  25.282 -        if (ChangeScreenBuffer(SDL_Display, this->hidden->SB[current ^ 1])) {
  25.283 -            surface->hwdata->bmap = SDL_RastPort->BitMap =
  25.284 -                this->hidden->SB[current]->sb_BitMap;
  25.285 -            SafeChange = FALSE;
  25.286 -            SafeDisp = FALSE;
  25.287 -            current ^= 1;
  25.288 -        }
  25.289 -
  25.290 -        if (!SafeDisp) {
  25.291 -            Wait(safe_sigbit);
  25.292 -            while (GetMsg(safeport) != NULL);
  25.293 -            SafeDisp = TRUE;
  25.294 -        }
  25.295 -
  25.296 -    }
  25.297 -    return (0);
  25.298 -}
  25.299 -
  25.300 -/* Byte-swap the pixels in the display image */
  25.301 -static void
  25.302 -CGX_SwapAllPixels(SDL_Surface * screen)
  25.303 -{
  25.304 -    int x, y;
  25.305 -
  25.306 -    switch (screen->format->BytesPerPixel) {
  25.307 -    case 2:
  25.308 -        {
  25.309 -            Uint16 *spot;
  25.310 -            for (y = 0; y < screen->h; ++y) {
  25.311 -                spot = (Uint16 *) ((Uint8 *) screen->pixels +
  25.312 -                                   y * screen->pitch);
  25.313 -                for (x = 0; x < screen->w; ++x, ++spot) {
  25.314 -                    *spot = SDL_Swap16(*spot);
  25.315 -                }
  25.316 -            }
  25.317 -        }
  25.318 -        break;
  25.319 -
  25.320 -    case 4:
  25.321 -        {
  25.322 -            Uint32 *spot;
  25.323 -            for (y = 0; y < screen->h; ++y) {
  25.324 -                spot = (Uint32 *) ((Uint8 *) screen->pixels +
  25.325 -                                   y * screen->pitch);
  25.326 -                for (x = 0; x < screen->w; ++x, ++spot) {
  25.327 -                    *spot = SDL_Swap32(*spot);
  25.328 -                }
  25.329 -            }
  25.330 -        }
  25.331 -        break;
  25.332 -
  25.333 -    default:
  25.334 -        /* should never get here */
  25.335 -        break;
  25.336 -    }
  25.337 -}
  25.338 -static void
  25.339 -CGX_SwapPixels(SDL_Surface * screen, int numrects, SDL_Rect * rects)
  25.340 -{
  25.341 -    int i;
  25.342 -    int x, minx, maxx;
  25.343 -    int y, miny, maxy;
  25.344 -
  25.345 -    switch (screen->format->BytesPerPixel) {
  25.346 -    case 2:
  25.347 -        {
  25.348 -            Uint16 *spot;
  25.349 -            for (i = 0; i < numrects; ++i) {
  25.350 -                minx = rects[i].x;
  25.351 -                maxx = rects[i].x + rects[i].w;
  25.352 -                miny = rects[i].y;
  25.353 -                maxy = rects[i].y + rects[i].h;
  25.354 -                for (y = miny; y < maxy; ++y) {
  25.355 -                    spot = (Uint16 *) ((Uint8 *) screen->pixels +
  25.356 -                                       y * screen->pitch + minx * 2);
  25.357 -                    for (x = minx; x < maxx; ++x, ++spot) {
  25.358 -                        *spot = SDL_Swap16(*spot);
  25.359 -                    }
  25.360 -                }
  25.361 -            }
  25.362 -        }
  25.363 -        break;
  25.364 -
  25.365 -    case 4:
  25.366 -        {
  25.367 -            Uint32 *spot;
  25.368 -            for (i = 0; i < numrects; ++i) {
  25.369 -                minx = rects[i].x;
  25.370 -                maxx = rects[i].x + rects[i].w;
  25.371 -                miny = rects[i].y;
  25.372 -                maxy = rects[i].y + rects[i].h;
  25.373 -                for (y = miny; y < maxy; ++y) {
  25.374 -                    spot = (Uint32 *) ((Uint8 *) screen->pixels +
  25.375 -                                       y * screen->pitch + minx * 4);
  25.376 -                    for (x = minx; x < maxx; ++x, ++spot) {
  25.377 -                        *spot = SDL_Swap32(*spot);
  25.378 -                    }
  25.379 -                }
  25.380 -            }
  25.381 -        }
  25.382 -        break;
  25.383 -
  25.384 -    default:
  25.385 -        /* should never get here */
  25.386 -        break;
  25.387 -    }
  25.388 -}
  25.389 -
  25.390 -#ifdef __SASC
  25.391 -
  25.392 -#define USE_WPA WritePixelArray
  25.393 -#else
  25.394 -
  25.395 -void
  25.396 -USE_WPA(char *a, int b, int c, int d, struct RastPort *e, int f, int g,
  25.397 -        int h, int i, Uint32 l)
  25.398 -{
  25.399 -    WritePixelArray(a, b, c, d, e, f, g, h, i, l);
  25.400 -}
  25.401 -
  25.402 -#endif
  25.403 -
  25.404 -static void
  25.405 -CGX_FakeUpdate(_THIS, int numrects, SDL_Rect * rects)
  25.406 -{
  25.407 -}
  25.408 -
  25.409 -static void
  25.410 -CGX_NormalUpdate(_THIS, int numrects, SDL_Rect * rects)
  25.411 -{
  25.412 -    int i, format, customroutine = 0;
  25.413 -#ifndef USE_CGX_WRITELUTPIXEL
  25.414 -    int bpp;
  25.415 -#endif
  25.416 -    if (this->hidden->same_format && !use_picasso96) {
  25.417 -        format = RECTFMT_RAW;
  25.418 -    } else
  25.419 -        switch (this->screen->format->BytesPerPixel) {
  25.420 -        case 4:
  25.421 -            format = RECTFMT_RGBA;
  25.422 -            break;
  25.423 -        case 3:
  25.424 -            format = RECTFMT_RGB;
  25.425 -            break;
  25.426 -        case 2:
  25.427 -            customroutine = 1;
  25.428 -            break;
  25.429 -        case 1:
  25.430 -//                      D(bug("soft depth: 8 hardbpp: %ld\n",this->hidden->depth));
  25.431 -            if (this->hidden->depth > 8) {
  25.432 -#ifndef USE_CGX_WRITELUTPIXEL
  25.433 -                if (this->hidden->depth > 32)
  25.434 -                    customroutine = 4;
  25.435 -                else if (this->hidden->depth > 16) {
  25.436 -                    bpp = this->hidden->BytesPerPixel;  // That one is the only one that needs bpp
  25.437 -                    customroutine = 2;  // The slow one!
  25.438 -                } else
  25.439 -                    customroutine = 3;
  25.440 -#else
  25.441 -
  25.442 -                customroutine = 2;
  25.443 -#endif
  25.444 -
  25.445 -//                              format=RECTFMT_LUT8;   Vecchia funzione x usare la WritePixelArray.
  25.446 -            } else
  25.447 -                customroutine = 1;
  25.448 -            break;
  25.449 -        default:
  25.450 -            D(bug("Unable to blit this surface!\n"));
  25.451 -            return;
  25.452 -        }
  25.453 -
  25.454 -    /* Check for endian-swapped X server, swap if necessary (VERY slow!) */
  25.455 -    if (swap_pixels && ((this->screen->format->BytesPerPixel % 2) == 0)) {
  25.456 -        D(bug("Software Swapping! SLOOOW!\n"));
  25.457 -        CGX_SwapPixels(this->screen, numrects, rects);
  25.458 -        for (i = 0; i < numrects; ++i) {
  25.459 -            if (!rects[i].w) {  /* Clipped? */
  25.460 -                continue;
  25.461 -            }
  25.462 -            USE_WPA(this->screen->pixels, rects[i].x, rects[i].y,
  25.463 -                    this->screen->pitch, SDL_RastPort,
  25.464 -                    SDL_Window->BorderLeft + rects[i].x,
  25.465 -                    SDL_Window->BorderTop + rects[i].y, rects[i].w,
  25.466 -                    rects[i].h, format);
  25.467 -        }
  25.468 -        CGX_SwapPixels(this->screen, numrects, rects);
  25.469 -    } else if (customroutine == 2) {
  25.470 -#ifdef USE_CGX_WRITELUTPIXEL
  25.471 -        for (i = 0; i < numrects; ++i) {
  25.472 -            if (!rects[i].w) {  /* Clipped? */
  25.473 -                continue;
  25.474 -            }
  25.475 -
  25.476 -            WLUT(this->screen->pixels, rects[i].x, rects[i].y,
  25.477 -                 this->screen->pitch, SDL_RastPort, SDL_XPixels,
  25.478 -                 SDL_Window->BorderLeft + rects[i].x,
  25.479 -                 SDL_Window->BorderTop + rects[i].y, rects[i].w,
  25.480 -                 rects[i].h, CTABFMT_XRGB8);
  25.481 -        }
  25.482 -#else
  25.483 -        unsigned char *bm_address;
  25.484 -        Uint32 destpitch;
  25.485 -        APTR handle;
  25.486 -
  25.487 -        if (handle =
  25.488 -            LockBitMapTags(SDL_RastPort->BitMap, LBMI_BASEADDRESS,
  25.489 -                           &bm_address, LBMI_BYTESPERROW, &destpitch,
  25.490 -                           TAG_DONE)) {
  25.491 -            int srcwidth;
  25.492 -            unsigned char *destbase;
  25.493 -            register int j, k, t;
  25.494 -            register unsigned char *mask, *dst;
  25.495 -            register unsigned char *src, *dest;
  25.496 -
  25.497 -// Aggiungo il bordo della finestra se sono fullscreen.
  25.498 -            if (currently_fullscreen)
  25.499 -                destbase = bm_address;
  25.500 -            else
  25.501 -                destbase =
  25.502 -                    bm_address + (SDL_Window->TopEdge +
  25.503 -                                  SDL_Window->BorderTop) * destpitch +
  25.504 -                    (SDL_Window->BorderLeft +
  25.505 -                     SDL_Window->LeftEdge) * this->hidden->BytesPerPixel;
  25.506 -
  25.507 -            for (i = 0; i < numrects; ++i) {
  25.508 -                srcwidth = rects[i].w;
  25.509 -
  25.510 -                if (!srcwidth) {        /* Clipped? */
  25.511 -                    continue;
  25.512 -                }
  25.513 -
  25.514 -                dest = destbase + rects[i].x * this->hidden->BytesPerPixel;
  25.515 -                dest += (rects[i].y * destpitch);
  25.516 -                src = ((char *) (this->screen->pixels)) + rects[i].x;
  25.517 -                src += (rects[i].y * this->screen->pitch);
  25.518 -
  25.519 -                for (j = rects[i].h; j; --j) {
  25.520 -                    dst = dest;
  25.521 -// SLOW routine, used for 8->24 bit mapping
  25.522 -                    for (k = 0; k < srcwidth; k++) {
  25.523 -                        mask = (unsigned char *) (&SDL_XPixels[src[k]]);
  25.524 -                        for (t = 0; t < bpp; t++) {
  25.525 -                            dst[t] = mask[t];
  25.526 -                        }
  25.527 -                        dst += bpp;
  25.528 -                    }
  25.529 -                    src += this->screen->pitch;
  25.530 -                    dest += destpitch;
  25.531 -                }
  25.532 -            }
  25.533 -            UnLockBitMap(handle);
  25.534 -        }
  25.535 -    } else if (customroutine == 3) {
  25.536 -        unsigned char *bm_address;
  25.537 -        Uint32 destpitch;
  25.538 -        APTR handle;
  25.539 -
  25.540 -        if (handle =
  25.541 -            LockBitMapTags(SDL_RastPort->BitMap, LBMI_BASEADDRESS,
  25.542 -                           &bm_address, LBMI_BYTESPERROW, &destpitch,
  25.543 -                           TAG_DONE)) {
  25.544 -            int srcwidth;
  25.545 -            unsigned char *destbase;
  25.546 -            register int j, k;
  25.547 -            register unsigned char *src, *dest;
  25.548 -            register Uint16 *destl, *srcl;
  25.549 -
  25.550 -            if (currently_fullscreen)
  25.551 -                destbase = bm_address;
  25.552 -            else
  25.553 -                destbase =
  25.554 -                    bm_address + (SDL_Window->TopEdge +
  25.555 -                                  SDL_Window->BorderTop) * destpitch +
  25.556 -                    (SDL_Window->BorderLeft +
  25.557 -                     SDL_Window->LeftEdge) * this->hidden->BytesPerPixel;
  25.558 -
  25.559 -            for (i = 0; i < numrects; ++i) {
  25.560 -                srcwidth = rects[i].w;
  25.561 -
  25.562 -                if (!srcwidth) {        /* Clipped? */
  25.563 -                    continue;
  25.564 -                }
  25.565 -
  25.566 -                dest = destbase + rects[i].x * this->hidden->BytesPerPixel;
  25.567 -                dest += (rects[i].y * destpitch);
  25.568 -                src = ((char *) (this->screen->pixels)) + rects[i].x;
  25.569 -                src += (rects[i].y * this->screen->pitch);
  25.570 -
  25.571 -// This is the fast, well not too slow, remapping code for 16bit displays
  25.572 -
  25.573 -                for (j = rects[i].h; j; --j) {
  25.574 -                    destl = (Uint16 *) dest;
  25.575 -
  25.576 -                    for (k = 0; k < srcwidth; k++) {
  25.577 -                        srcl = (Uint16 *) & SDL_XPixels[src[k]];
  25.578 -                        *destl = *srcl;
  25.579 -                        destl++;
  25.580 -                    }
  25.581 -                    src += this->screen->pitch;
  25.582 -                    dest += destpitch;
  25.583 -                }
  25.584 -            }
  25.585 -            UnLockBitMap(handle);
  25.586 -        }
  25.587 -    } else if (customroutine == 4) {
  25.588 -        unsigned char *bm_address;
  25.589 -        Uint32 destpitch;
  25.590 -        APTR handle;
  25.591 -
  25.592 -        if (handle =
  25.593 -            LockBitMapTags(SDL_RastPort->BitMap, LBMI_BASEADDRESS,
  25.594 -                           &bm_address, LBMI_BYTESPERROW, &destpitch,
  25.595 -                           TAG_DONE)) {
  25.596 -            int srcwidth;
  25.597 -            unsigned char *destbase;
  25.598 -            register int j, k;
  25.599 -            register unsigned char *src, *dest;
  25.600 -            register Uint32 *destl, *srcl;
  25.601 -
  25.602 -            if (currently_fullscreen)
  25.603 -                destbase = bm_address;
  25.604 -            else
  25.605 -                destbase =
  25.606 -                    bm_address + (SDL_Window->TopEdge +
  25.607 -                                  SDL_Window->BorderTop) * destpitch +
  25.608 -                    (SDL_Window->BorderLeft +
  25.609 -                     SDL_Window->LeftEdge) * this->hidden->BytesPerPixel;
  25.610 -
  25.611 -            for (i = 0; i < numrects; ++i) {
  25.612 -                srcwidth = rects[i].w;
  25.613 -
  25.614 -                if (!srcwidth) {        /* Clipped? */
  25.615 -                    continue;
  25.616 -                }
  25.617 -
  25.618 -                dest = destbase + rects[i].x * this->hidden->BytesPerPixel;
  25.619 -                dest += (rects[i].y * destpitch);
  25.620 -                src = ((char *) (this->screen->pixels)) + rects[i].x;
  25.621 -                src += (rects[i].y * this->screen->pitch);
  25.622 -
  25.623 -// This is the fast, well not too slow, remapping code for 32bit displays
  25.624 -
  25.625 -                for (j = rects[i].h; j; --j) {
  25.626 -                    destl = (Uint32 *) dest;
  25.627 -
  25.628 -                    for (k = 0; k < srcwidth; k++) {
  25.629 -                        srcl = (Uint32 *) & SDL_XPixels[src[k]];
  25.630 -                        *destl = *srcl;
  25.631 -                        destl++;
  25.632 -                    }
  25.633 -                    src += this->screen->pitch;
  25.634 -                    dest += destpitch;
  25.635 -                }
  25.636 -            }
  25.637 -            UnLockBitMap(handle);
  25.638 -        }
  25.639 -#endif
  25.640 -    } else if (customroutine) {
  25.641 -        unsigned char *bm_address;
  25.642 -        Uint32 destpitch;
  25.643 -        APTR handle;
  25.644 -
  25.645 -//              D(bug("Using customroutine!\n"));
  25.646 -
  25.647 -        if (handle =
  25.648 -            LockBitMapTags(SDL_RastPort->BitMap, LBMI_BASEADDRESS,
  25.649 -                           (ULONG) & bm_address, LBMI_BYTESPERROW,
  25.650 -                           (ULONG) & destpitch, TAG_DONE)) {
  25.651 -            unsigned char *destbase;
  25.652 -            register int j, srcwidth;
  25.653 -            register unsigned char *src, *dest;
  25.654 -
  25.655 -// Aggiungo il bordo della finestra se sono fullscreen.
  25.656 -            if (currently_fullscreen)
  25.657 -                destbase = bm_address;
  25.658 -            else
  25.659 -                destbase =
  25.660 -                    bm_address + (SDL_Window->TopEdge +
  25.661 -                                  SDL_Window->BorderTop) * destpitch +
  25.662 -                    (SDL_Window->BorderLeft +
  25.663 -                     SDL_Window->LeftEdge) *
  25.664 -                    this->screen->format->BytesPerPixel;
  25.665 -
  25.666 -            for (i = 0; i < numrects; ++i) {
  25.667 -                srcwidth = rects[i].w;
  25.668 -
  25.669 -                if (!srcwidth) {        /* Clipped? */
  25.670 -                    continue;
  25.671 -                }
  25.672 -
  25.673 -                dest =
  25.674 -                    destbase +
  25.675 -                    rects[i].x * this->screen->format->BytesPerPixel;
  25.676 -                dest += (rects[i].y * destpitch);
  25.677 -                src =
  25.678 -                    ((char *) (this->screen->pixels)) +
  25.679 -                    rects[i].x * this->screen->format->BytesPerPixel;
  25.680 -                src += (rects[i].y * this->screen->pitch);
  25.681 -
  25.682 -                srcwidth *= this->screen->format->BytesPerPixel;
  25.683 -
  25.684 -//                              D(bug("Rects: %ld,%ld %ld,%ld Src:%lx Dest:%lx\n",rects[i].x,rects[i].y,rects[i].w,rects[i].h,src,dest));
  25.685 -
  25.686 -                for (j = rects[i].h; j; --j) {
  25.687 -                    SDL_memcpy(dest, src, srcwidth);
  25.688 -                    src += this->screen->pitch;
  25.689 -                    dest += destpitch;
  25.690 -                }
  25.691 -            }
  25.692 -            UnLockBitMap(handle);
  25.693 -//                      D(bug("Rectblit addr: %lx pitch: %ld rects:%ld srcptr: %lx srcpitch: %ld\n",bm_address,destpitch,numrects,this->screen->pixels,this->screen->pitch));
  25.694 -        }
  25.695 -    } else {
  25.696 -        for (i = 0; i < numrects; ++i) {
  25.697 -            if (!rects[i].w) {  /* Clipped? */
  25.698 -                continue;
  25.699 -            }
  25.700 -            USE_WPA(this->screen->pixels, rects[i].x, rects[i].y,
  25.701 -                    this->screen->pitch, SDL_RastPort,
  25.702 -                    SDL_Window->BorderLeft + rects[i].x,
  25.703 -                    SDL_Window->BorderTop + rects[i].y, rects[i].w,
  25.704 -                    rects[i].h, format);
  25.705 -        }
  25.706 -    }
  25.707 -}
  25.708 -
  25.709 -void
  25.710 -CGX_RefreshDisplay(_THIS)
  25.711 -{
  25.712 -    int format, customroutine = 0;
  25.713 -#ifndef USE_CGX_WRITELUTPIXEL
  25.714 -    int bpp;
  25.715 -#endif
  25.716 -    /* Don't refresh a display that doesn't have an image (like GL) */
  25.717 -    if (!SDL_Ximage) {
  25.718 -        return;
  25.719 -    }
  25.720 -
  25.721 -    if (this->hidden->same_format && !use_picasso96) {
  25.722 -        format = RECTFMT_RAW;
  25.723 -    } else
  25.724 -        switch (this->screen->format->BytesPerPixel) {
  25.725 -        case 4:
  25.726 -            format = RECTFMT_RGBA;
  25.727 -            break;
  25.728 -        case 3:
  25.729 -            format = RECTFMT_RGB;
  25.730 -            break;
  25.731 -        case 2:
  25.732 -            customroutine = 1;
  25.733 -            break;
  25.734 -        case 1:
  25.735 -//                      D(bug("soft depth: 8 hardbpp: %ld\n",this->hidden->depth));
  25.736 -            if (this->hidden->depth > 8) {
  25.737 -#ifndef USE_CGX_WRITELUTPIXEL
  25.738 -                if (this->hidden->depth > 32)
  25.739 -                    customroutine = 4;
  25.740 -                else if (this->hidden->depth > 16) {
  25.741 -                    bpp = this->hidden->BytesPerPixel;  // That one is the only one that needs bpp
  25.742 -                    customroutine = 2;  // The slow one!
  25.743 -                } else
  25.744 -                    customroutine = 3;
  25.745 -#else
  25.746 -
  25.747 -                customroutine = 2;
  25.748 -#endif
  25.749 -//                              format=RECTFMT_LUT8;
  25.750 -            } else
  25.751 -                customroutine = 1;
  25.752 -            break;
  25.753 -
  25.754 -        }
  25.755 -
  25.756 -    /* Check for endian-swapped X server, swap if necessary */
  25.757 -    if (swap_pixels && ((this->screen->format->BytesPerPixel % 2) == 0)) {
  25.758 -        CGX_SwapAllPixels(this->screen);
  25.759 -        USE_WPA(this->screen->pixels, 0, 0, this->screen->pitch,
  25.760 -                SDL_RastPort, SDL_Window->BorderLeft,
  25.761 -                SDL_Window->BorderTop, this->screen->w, this->screen->h,
  25.762 -                format);
  25.763 -        CGX_SwapAllPixels(this->screen);
  25.764 -    } else if (customroutine == 2) {
  25.765 -#ifdef USE_CGX_WRITELUTPIXEL
  25.766 -        WLUT(this->screen->pixels, 0, 0, this->screen->pitch,
  25.767 -             SDL_RastPort, SDL_XPixels, SDL_Window->BorderLeft,
  25.768 -             SDL_Window->BorderTop, this->screen->w, this->screen->h,
  25.769 -             CTABFMT_XRGB8);
  25.770 -#else
  25.771 -        unsigned char *bm_address;
  25.772 -        Uint32 destpitch;
  25.773 -        APTR handle;
  25.774 -
  25.775 -        if (handle =
  25.776 -            LockBitMapTags(SDL_RastPort->BitMap, LBMI_BASEADDRESS,
  25.777 -                           (ULONG) & bm_address, LBMI_BYTESPERROW,
  25.778 -                           (ULONG) & destpitch, TAG_DONE)) {
  25.779 -            register int j, k, t;
  25.780 -            register unsigned char *mask, *dst;
  25.781 -            register unsigned char *src, *dest;
  25.782 -
  25.783 -// Aggiungo il bordo della finestra se sono fullscreen.
  25.784 -            if (!currently_fullscreen)
  25.785 -                dest =
  25.786 -                    bm_address + (SDL_Window->TopEdge +
  25.787 -                                  SDL_Window->BorderTop) * destpitch +
  25.788 -                    (SDL_Window->BorderLeft +
  25.789 -                     SDL_Window->LeftEdge) * this->hidden->BytesPerPixel;
  25.790 -            else
  25.791 -                dest = bm_address;
  25.792 -
  25.793 -            src = this->screen->pixels;
  25.794 -
  25.795 -            for (j = this->screen->h; j; --j) {
  25.796 -                dst = dest;
  25.797 -// SLOW routine, used for 8->24 bit mapping
  25.798 -                for (k = 0; k < this->screen->w; k++) {
  25.799 -                    mask = (unsigned char *) (&SDL_XPixels[src[k]]);
  25.800 -                    for (t = 0; t < bpp; t++) {
  25.801 -                        dst[t] = mask[t];
  25.802 -                    }
  25.803 -                    dst += bpp;
  25.804 -                }
  25.805 -                src += this->screen->pitch;
  25.806 -                dest += destpitch;
  25.807 -            }
  25.808 -            UnLockBitMap(handle);
  25.809 -        }
  25.810 -    } else if (customroutine == 3) {
  25.811 -        unsigned char *bm_address;
  25.812 -        Uint32 destpitch;
  25.813 -        APTR handle;
  25.814 -
  25.815 -        if (handle =
  25.816 -            LockBitMapTags(SDL_RastPort->BitMap, LBMI_BASEADDRESS,
  25.817 -                           (ULONG) & bm_address, LBMI_BYTESPERROW,
  25.818 -                           (ULONG) & destpitch, TAG_DONE)) {
  25.819 -            register int j, k;
  25.820 -            register unsigned char *src, *dest;
  25.821 -            register Uint16 *destl, *srcl;
  25.822 -
  25.823 -            if (!currently_fullscreen)
  25.824 -                dest =
  25.825 -                    bm_address + (SDL_Window->TopEdge +
  25.826 -                                  SDL_Window->BorderTop) * destpitch +
  25.827 -                    (SDL_Window->BorderLeft +
  25.828 -                     SDL_Window->LeftEdge) * this->hidden->BytesPerPixel;
  25.829 -            else
  25.830 -                dest = bm_address;
  25.831 -
  25.832 -            src = this->screen->pixels;
  25.833 -
  25.834 -// This is the fast, well not too slow, remapping code for 16bit displays
  25.835 -
  25.836 -            for (j = this->screen->h; j; --j) {
  25.837 -                destl = (Uint16 *) dest;
  25.838 -
  25.839 -                for (k = 0; k < this->screen->w; k++) {
  25.840 -                    srcl = (Uint16 *) & SDL_XPixels[src[k]];
  25.841 -                    *destl = *srcl;
  25.842 -                    destl++;
  25.843 -                }
  25.844 -                src += this->screen->pitch;
  25.845 -                dest += destpitch;
  25.846 -            }
  25.847 -            UnLockBitMap(handle);
  25.848 -        }
  25.849 -    } else if (customroutine == 4) {
  25.850 -        unsigned char *bm_address;
  25.851 -        Uint32 destpitch;
  25.852 -        APTR handle;
  25.853 -
  25.854 -        if (handle =
  25.855 -            LockBitMapTags(SDL_RastPort->BitMap, LBMI_BASEADDRESS,
  25.856 -                           (ULONG) & bm_address, LBMI_BYTESPERROW,
  25.857 -                           (ULONG) & destpitch, TAG_DONE)) {
  25.858 -            register int j, k;
  25.859 -            register unsigned char *src, *dest;
  25.860 -            register Uint32 *destl, *srcl;
  25.861 -
  25.862 -            if (!currently_fullscreen)
  25.863 -                dest =
  25.864 -                    bm_address + (SDL_Window->TopEdge +
  25.865 -                                  SDL_Window->BorderTop) * destpitch +
  25.866 -                    (SDL_Window->BorderLeft +
  25.867 -                     SDL_Window->LeftEdge) * this->hidden->BytesPerPixel;
  25.868 -            else
  25.869 -                dest = bm_address;
  25.870 -
  25.871 -            src = this->screen->pixels;
  25.872 -
  25.873 -// This is the fast, well not too slow, remapping code for 32bit displays
  25.874 -
  25.875 -            for (j = this->screen->h; j; --j) {
  25.876 -                destl = (Uint32 *) dest;
  25.877 -
  25.878 -                for (k = 0; k < this->screen->w; k++) {
  25.879 -                    srcl = (Uint32 *) & SDL_XPixels[src[k]];
  25.880 -                    *destl = *srcl;
  25.881 -                    destl++;
  25.882 -                }
  25.883 -                src += this->screen->pitch;
  25.884 -                dest += destpitch;
  25.885 -            }
  25.886 -            UnLockBitMap(handle);
  25.887 -        }
  25.888 -#endif
  25.889 -    } else if (customroutine) {
  25.890 -        unsigned char *bm_address;
  25.891 -        Uint32 destpitch;
  25.892 -        APTR handle;
  25.893 -
  25.894 -        if (handle = LockBitMapTags(SDL_RastPort->BitMap,
  25.895 -                                    LBMI_BASEADDRESS, (ULONG) & bm_address,
  25.896 -                                    LBMI_BYTESPERROW, (ULONG) & destpitch,
  25.897 -                                    TAG_DONE)) {
  25.898 -            register int j;
  25.899 -            register unsigned char *src, *dest;
  25.900 -
  25.901 -            if (!currently_fullscreen)
  25.902 -                dest =
  25.903 -                    bm_address + (SDL_Window->TopEdge +
  25.904 -                                  SDL_Window->BorderTop) * destpitch +
  25.905 -                    (SDL_Window->BorderLeft +
  25.906 -                     SDL_Window->LeftEdge) *
  25.907 -                    this->screen->format->BytesPerPixel;
  25.908 -            else
  25.909 -                dest = bm_address;
  25.910 -
  25.911 -            src = this->screen->pixels;
  25.912 -
  25.913 -//                      D(bug("addr: %lx pitch: %ld src:%lx srcpitch: %ld\n",dest,destpitch,this->screen->pixels,this->screen->pitch));
  25.914 -
  25.915 -            if (this->screen->pitch == destpitch) {
  25.916 -                SDL_memcpy(dest, src, this->screen->pitch * this->screen->h);
  25.917 -            } else {
  25.918 -                for (j = this->screen->h; j; --j) {
  25.919 -                    SDL_memcpy(dest, src, this->screen->pitch);
  25.920 -                    src += this->screen->pitch;
  25.921 -                    dest += destpitch;
  25.922 -                }
  25.923 -            }
  25.924 -
  25.925 -            UnLockBitMap(handle);
  25.926 -        }
  25.927 -    } else {
  25.928 -        USE_WPA(this->screen->pixels, 0, 0, this->screen->pitch,
  25.929 -                SDL_RastPort, SDL_Window->BorderLeft,
  25.930 -                SDL_Window->BorderTop, this->screen->w, this->screen->h,
  25.931 -                format);
  25.932 -    }
  25.933 -
  25.934 -}
  25.935 -
  25.936 -/* vi: set ts=4 sw=4 expandtab: */
    26.1 --- a/src/video/cybergfx/SDL_cgximage_c.h	Sun Oct 29 03:39:13 2006 +0000
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,37 +0,0 @@
    26.4 -/*
    26.5 -    SDL - Simple DirectMedia Layer
    26.6 -    Copyright (C) 1997-2006 Sam Lantinga
    26.7 -
    26.8 -    This library is free software; you can redistribute it and/or
    26.9 -    modify it under the terms of the GNU Lesser General Public
   26.10 -    License as published by the Free Software Foundation; either
   26.11 -    version 2.1 of the License, or (at your option) any later version.
   26.12 -
   26.13 -    This library is distributed in the hope that it will be useful,
   26.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   26.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   26.16 -    Lesser General Public License for more details.
   26.17 -
   26.18 -    You should have received a copy of the GNU Lesser General Public
   26.19 -    License along with this library; if not, write to the Free Software
   26.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   26.21 -
   26.22 -    Sam Lantinga
   26.23 -    slouken@libsdl.org
   26.24 -*/
   26.25 -#include "SDL_config.h"
   26.26 -
   26.27 -#include "SDL_cgxvideo.h"
   26.28 -
   26.29 -extern int CGX_SetupImage(_THIS, SDL_Surface * screen);
   26.30 -extern void CGX_DestroyImage(_THIS, SDL_Surface * screen);
   26.31 -extern int CGX_ResizeImage(_THIS, SDL_Surface * screen, Uint32 flags);
   26.32 -
   26.33 -extern int CGX_AllocHWSurface(_THIS, SDL_Surface * surface);
   26.34 -extern void CGX_FreeHWSurface(_THIS, SDL_Surface * surface);
   26.35 -extern int CGX_LockHWSurface(_THIS, SDL_Surface * surface);
   26.36 -extern void CGX_UnlockHWSurface(_THIS, SDL_Surface * surface);
   26.37 -extern int CGX_FlipHWSurface(_THIS, SDL_Surface * surface);
   26.38 -
   26.39 -extern void CGX_RefreshDisplay(_THIS);
   26.40 -/* vi: set ts=4 sw=4 expandtab: */
    27.1 --- a/src/video/cybergfx/SDL_cgxmodes.c	Sun Oct 29 03:39:13 2006 +0000
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,334 +0,0 @@
    27.4 -/*
    27.5 -    SDL - Simple DirectMedia Layer
    27.6 -    Copyright (C) 1997-2006 Sam Lantinga
    27.7 -
    27.8 -    This library is free software; you can redistribute it and/or
    27.9 -    modify it under the terms of the GNU Lesser General Public
   27.10 -    License as published by the Free Software Foundation; either
   27.11 -    version 2.1 of the License, or (at your option) any later version.
   27.12 -
   27.13 -    This library is distributed in the hope that it will be useful,
   27.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   27.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   27.16 -    Lesser General Public License for more details.
   27.17 -
   27.18 -    You should have received a copy of the GNU Lesser General Public
   27.19 -    License along with this library; if not, write to the Free Software
   27.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   27.21 -
   27.22 -    Sam Lantinga
   27.23 -    slouken@libsdl.org
   27.24 -*/
   27.25 -#include "SDL_config.h"
   27.26 -
   27.27 -/* Utilities for getting and setting the X display mode */
   27.28 -
   27.29 -#include "SDL_timer.h"
   27.30 -#include "SDL_events.h"
   27.31 -#include "../../events/SDL_events_c.h"
   27.32 -#include "SDL_cgxvideo.h"
   27.33 -#include "SDL_cgxwm_c.h"
   27.34 -#include "SDL_cgxmodes_c.h"
   27.35 -
   27.36 -#define CGX_DEBUG
   27.37 -
   27.38 -static void
   27.39 -set_best_resolution(_THIS, int width, int height)
   27.40 -{
   27.41 -    Uint32 idok;
   27.42 -    int depth = 8;
   27.43 -
   27.44 -    if (SDL_Display)
   27.45 -        depth =
   27.46 -            GetCyberMapAttr(SDL_Display->RastPort.BitMap, CYBRMATTR_DEPTH);
   27.47 -
   27.48 -    idok = BestCModeIDTags(CYBRBIDTG_NominalWidth, width,
   27.49 -                           CYBRBIDTG_NominalHeight, height,
   27.50 -                           CYBRBIDTG_Depth, depth, TAG_DONE);
   27.51 -
   27.52 -    if (idok != INVALID_ID) {
   27.53 -        if (SDL_Display) {
   27.54 -            if (currently_fullscreen)
   27.55 -                CloseScreen(SDL_Display);
   27.56 -            else
   27.57 -                UnlockPubScreen(NULL, SDL_Display);
   27.58 -        }
   27.59 -        SDL_Display = GFX_Display =
   27.60 -            OpenScreenTags(NULL, SA_Width, width, SA_Height, height,
   27.61 -                           SA_Depth, depth, SA_DisplayID, idok,
   27.62 -                           SA_ShowTitle, FALSE, TAG_DONE);
   27.63 -    }
   27.64 -}
   27.65 -
   27.66 -static void
   27.67 -get_real_resolution(_THIS, int *w, int *h)
   27.68 -{
   27.69 -    *w = /*SDL_Display->Width */ SDL_Window->Width - SDL_Window->BorderLeft -
   27.70 -        SDL_Window->BorderRight;
   27.71 -    *h = /*SDL_Display->Height */ SDL_Window->Height -
   27.72 -        SDL_Window->BorderBottom - SDL_Window->BorderTop;
   27.73 -}
   27.74 -
   27.75 -static void
   27.76 -move_cursor_to(_THIS, int x, int y)
   27.77 -{
   27.78 -/*    XWarpPointer(SDL_Display, None, SDL_Root, 0, 0, 0, 0, x, y); */
   27.79 -
   27.80 -/* DA FARE! */
   27.81 -}
   27.82 -
   27.83 -static void
   27.84 -add_visual(_THIS, int depth, int class)
   27.85 -{
   27.86 -    Uint32 tID;
   27.87 -
   27.88 -    tID = BestCModeIDTags(CYBRBIDTG_Depth, depth,
   27.89 -                          CYBRBIDTG_NominalWidth, 640,
   27.90 -                          CYBRBIDTG_NominalHeight, 480, TAG_DONE);
   27.91 -
   27.92 -    if (tID != INVALID_ID) {
   27.93 -        int n = this->hidden->nvisuals;
   27.94 -
   27.95 -        this->hidden->visuals[n].depth = depth;
   27.96 -        this->hidden->visuals[n].visual = tID;
   27.97 -        this->hidden->visuals[n].bpp = GetCyberIDAttr(CYBRIDATTR_BPPIX, tID);
   27.98 -        this->hidden->nvisuals++;
   27.99 -    }
  27.100 -}
  27.101 -
  27.102 -#define TrueColor 1
  27.103 -#define PseudoColor 2
  27.104 -
  27.105 -int
  27.106 -CGX_GetVideoModes(_THIS)
  27.107 -{
  27.108 -    int i;
  27.109 -    ULONG nextid;
  27.110 -    int nmodes = 0;
  27.111 -
  27.112 -    SDL_modelist = NULL;
  27.113 -
  27.114 -    nextid = NextDisplayInfo(INVALID_ID);
  27.115 -
  27.116 -    while (nextid != INVALID_ID) {
  27.117 -        if (IsCyberModeID(nextid)) {
  27.118 -            DisplayInfoHandle h;
  27.119 -
  27.120 -            if (h = FindDisplayInfo(nextid)) {
  27.121 -                struct DimensionInfo info;
  27.122 -
  27.123 -                if (GetDisplayInfoData
  27.124 -                    (h, (char *) &info, sizeof(struct DimensionInfo),
  27.125 -                     DTAG_DIMS, NULL)) {
  27.126 -                    int ok = 0;
  27.127 -
  27.128 -                    for (i = 0; i < nmodes; i++) {
  27.129 -                        if (SDL_modelist[i]->w == (info.Nominal.MaxX + 1)
  27.130 -                            && SDL_modelist[i]->h == (info.Nominal.MaxY + 1))
  27.131 -                            ok = 1;
  27.132 -                    }
  27.133 -
  27.134 -                    if (!ok) {
  27.135 -                        nmodes++;
  27.136 -
  27.137 -                        SDL_modelist =
  27.138 -                            (SDL_Rect **) SDL_realloc(SDL_modelist,
  27.139 -                                                      (nmodes +
  27.140 -                                                       1) *
  27.141 -                                                      sizeof(SDL_Rect *));
  27.142 -                        SDL_modelist[nmodes] = NULL;
  27.143 -
  27.144 -                        if (SDL_modelist) {
  27.145 -                            SDL_modelist[nmodes - 1] = (SDL_Rect *)
  27.146 -                                SDL_malloc(sizeof(SDL_Rect));
  27.147 -
  27.148 -                            if (SDL_modelist[nmodes - 1] == NULL)
  27.149 -                                break;
  27.150 -
  27.151 -                            SDL_modelist[nmodes - 1]->x = 0;
  27.152 -                            SDL_modelist[nmodes - 1]->y = 0;
  27.153 -                            SDL_modelist[nmodes - 1]->w =
  27.154 -                                info.Nominal.MaxX + 1;
  27.155 -                            SDL_modelist[nmodes - 1]->h =
  27.156 -                                info.Nominal.MaxY + 1;
  27.157 -                        }
  27.158 -                    }
  27.159 -                }
  27.160 -            }
  27.161 -        }
  27.162 -        nextid = NextDisplayInfo(nextid);
  27.163 -    }
  27.164 -
  27.165 -
  27.166 -    this->hidden->nvisuals = 0;
  27.167 -    /* Search for the visuals in deepest-first order, so that the first
  27.168 -       will be the richest one */
  27.169 -    add_visual(this, 32, TrueColor);
  27.170 -    add_visual(this, 24, TrueColor);
  27.171 -    add_visual(this, 16, TrueColor);
  27.172 -    add_visual(this, 15, TrueColor);
  27.173 -    add_visual(this, 8, PseudoColor);
  27.174 -
  27.175 -    if (this->hidden->nvisuals == 0) {
  27.176 -        SDL_SetError("Found no sufficiently capable CGX visuals");
  27.177 -        return -1;
  27.178 -    }
  27.179 -
  27.180 -    if (SDL_modelist == NULL) {
  27.181 -        SDL_modelist = (SDL_Rect **) SDL_malloc((1 + 1) * sizeof(SDL_Rect *));
  27.182 -        i = 0;
  27.183 -        if (SDL_modelist) {
  27.184 -            SDL_modelist[i] = (SDL_Rect *) SDL_malloc(sizeof(SDL_Rect));
  27.185 -            if (SDL_modelist[i]) {
  27.186 -                SDL_modelist[i]->x = 0;
  27.187 -                SDL_modelist[i]->y = 0;
  27.188 -                SDL_modelist[i]->w = SDL_Display->Width;
  27.189 -                SDL_modelist[i]->h = SDL_Display->Height;
  27.190 -                ++i;
  27.191 -            }
  27.192 -            SDL_modelist[i] = NULL;
  27.193 -        }
  27.194 -    }
  27.195 -
  27.196 -    D(if (SDL_modelist) {
  27.197 -      bug("CGX video mode list: (%ld)\n", nmodes);
  27.198 -      for (i = 0; SDL_modelist[i]; ++i) {
  27.199 -      bug("\t%ld x %ld\n", SDL_modelist[i]->w, SDL_modelist[i]->h);}
  27.200 -      }
  27.201 -    );
  27.202 -
  27.203 -    D( {
  27.204 -      bug("CGX visuals list: (%ld)\n", this->hidden->nvisuals);
  27.205 -      for (i = 0; i < this->hidden->nvisuals; i++)
  27.206 -      bug("\t%lx - depth: %ld bpp: %ld\n",
  27.207 -          this->hidden->visuals[i].visual,
  27.208 -          this->hidden->visuals[i].depth, this->hidden->visuals[i].bpp);}
  27.209 -    );
  27.210 -    return 0;
  27.211 -}
  27.212 -
  27.213 -int
  27.214 -CGX_SupportedVisual(_THIS, SDL_PixelFormat * format)
  27.215 -{
  27.216 -    int i;
  27.217 -    for (i = 0; i < this->hidden->nvisuals; i++) {
  27.218 -        if (this->hidden->visuals[i].depth == format->BitsPerPixel)     // Era bpp
  27.219 -            return 1;
  27.220 -    }
  27.221 -    return 0;
  27.222 -}
  27.223 -
  27.224 -SDL_Rect **
  27.225 -CGX_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags)
  27.226 -{
  27.227 -    if (CGX_SupportedVisual(this, format)) {
  27.228 -        if (flags & SDL_FULLSCREEN) {
  27.229 -            return (SDL_modelist);
  27.230 -        } else {
  27.231 -            return ((SDL_Rect **) - 1);
  27.232 -        }
  27.233 -    } else {
  27.234 -        return ((SDL_Rect **) 0);
  27.235 -    }
  27.236 -}
  27.237 -
  27.238 -void
  27.239 -CGX_FreeVideoModes(_THIS)
  27.240 -{
  27.241 -    int i;
  27.242 -
  27.243 -    if (SDL_modelist) {
  27.244 -        for (i = 0; SDL_modelist[i]; ++i) {
  27.245 -            SDL_free(SDL_modelist[i]);
  27.246 -        }
  27.247 -        SDL_free(SDL_modelist);
  27.248 -        SDL_modelist = NULL;
  27.249 -    }
  27.250 -}
  27.251 -
  27.252 -int
  27.253 -CGX_ResizeFullScreen(_THIS)
  27.254 -{
  27.255 -    int x, y;
  27.256 -    int real_w, real_h;
  27.257 -
  27.258 -    if (currently_fullscreen) {
  27.259 -/* Per ora non faccio nulla qui */
  27.260 -    }
  27.261 -    return (1);
  27.262 -}
  27.263 -
  27.264 -void
  27.265 -_QueueEnterFullScreen(_THIS)
  27.266 -{
  27.267 -}
  27.268 -
  27.269 -int
  27.270 -CGX_EnterFullScreen(_THIS)
  27.271 -{
  27.272 -    int okay;
  27.273 -    Uint32 saved_flags;
  27.274 -
  27.275 -    okay = 1;
  27.276 -    saved_flags = this->screen->flags;
  27.277 -
  27.278 -    if (!currently_fullscreen) {
  27.279 -        int real_w, real_h;
  27.280 -
  27.281 -        /* Map the fullscreen window to blank the screen */
  27.282 -        get_real_resolution(this, &real_w, &real_h);
  27.283 -
  27.284 -        CGX_DestroyWindow(this, this->screen);
  27.285 -        set_best_resolution(this, real_w, real_h);
  27.286 -
  27.287 -        currently_fullscreen = 1;
  27.288 -        this->screen->flags = saved_flags;
  27.289 -
  27.290 -        CGX_CreateWindow(this, this->screen, real_w, real_h,
  27.291 -                         GetCyberMapAttr(SDL_Display->RastPort.BitMap,
  27.292 -                                         CYBRMATTR_DEPTH),
  27.293 -                         this->screen->flags);
  27.294 -
  27.295 -        /* Set the new resolution */
  27.296 -        okay = CGX_ResizeFullScreen(this);
  27.297 -        if (!okay) {
  27.298 -            CGX_LeaveFullScreen(this);
  27.299 -        }
  27.300 -        /* Set the colormap */
  27.301 -/*
  27.302 -		if ( SDL_XColorMap ) {
  27.303 -			XInstallColormap(SDL_Display, SDL_XColorMap);
  27.304 -		}
  27.305 -*/
  27.306 -    }
  27.307 -//    CGX_GrabInputNoLock(this, this->input_grab | SDL_GRAB_FULLSCREEN);
  27.308 -    return (okay);
  27.309 -}
  27.310 -
  27.311 -int
  27.312 -CGX_LeaveFullScreen(_THIS)
  27.313 -{
  27.314 -    if (currently_fullscreen) {
  27.315 -        int width, height;
  27.316 -        if (SDL_Window) {
  27.317 -            CloseWindow(SDL_Window);
  27.318 -            SDL_Window = NULL;
  27.319 -        }
  27.320 -        CloseScreen(SDL_Display);
  27.321 -
  27.322 -        GFX_Display = SDL_Display = LockPubScreen(NULL);
  27.323 -
  27.324 -        currently_fullscreen = 0;
  27.325 -
  27.326 -        CGX_CreateWindow(this, this->screen, this->screen->w,
  27.327 -                         this->screen->h,
  27.328 -                         GetCyberMapAttr(SDL_Display->RastPort.BitMap,
  27.329 -                                         CYBRMATTR_DEPTH),
  27.330 -                         this->screen->flags);
  27.331 -        CGX_ResizeImage(this, this->screen, 0L);
  27.332 -    }
  27.333 -
  27.334 -    return (0);
  27.335 -}
  27.336 -
  27.337 -/* vi: set ts=4 sw=4 expandtab: */
    28.1 --- a/src/video/cybergfx/SDL_cgxmodes_c.h	Sun Oct 29 03:39:13 2006 +0000
    28.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.3 @@ -1,47 +0,0 @@
    28.4 -/*
    28.5 -    SDL - Simple DirectMedia Layer
    28.6 -    Copyright (C) 1997-2006 Sam Lantinga
    28.7 -
    28.8 -    This library is free software; you can redistribute it and/or
    28.9 -    modify it under the terms of the GNU Lesser General Public
   28.10 -    License as published by the Free Software Foundation; either
   28.11 -    version 2.1 of the License, or (at your option) any later version.
   28.12 -
   28.13 -    This library is distributed in the hope that it will be useful,
   28.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   28.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   28.16 -    Lesser General Public License for more details.
   28.17 -
   28.18 -    You should have received a copy of the GNU Lesser General Public
   28.19 -    License along with this library; if not, write to the Free Software
   28.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   28.21 -
   28.22 -    Sam Lantinga
   28.23 -    slouken@libsdl.org
   28.24 -*/
   28.25 -#include "SDL_config.h"
   28.26 -
   28.27 -/* Utilities for getting and setting the X display mode */
   28.28 -
   28.29 -#include "SDL_cgxvideo.h"
   28.30 -
   28.31 -/* Define this if you want to grab the keyboard in fullscreen mode.
   28.32 -   If you do not define this, SDL will return from SDL_SetVideoMode()
   28.33 -   immediately, but will not actually go fullscreen until the window
   28.34 -   manager is idle.
   28.35 -*/
   28.36 -#define GRAB_FULLSCREEN
   28.37 -
   28.38 -extern int CGX_GetVideoModes(_THIS);
   28.39 -extern SDL_Rect **CGX_ListModes(_THIS, SDL_PixelFormat * format,
   28.40 -                                Uint32 flags);
   28.41 -extern void CGX_FreeVideoModes(_THIS);
   28.42 -extern int CGX_ResizeFullScreen(_THIS);
   28.43 -/*
   28.44 -extern void CGX_WaitMapped(_THIS, Window win);
   28.45 -extern void CGX_WaitUnmapped(_THIS, Window win);
   28.46 -extern void CGX_QueueEnterFullScreen(_THIS);
   28.47 -*/
   28.48 -extern int CGX_EnterFullScreen(_THIS);
   28.49 -extern int CGX_LeaveFullScreen(_THIS);
   28.50 -/* vi: set ts=4 sw=4 expandtab: */
    29.1 --- a/src/video/cybergfx/SDL_cgxvideo.c	Sun Oct 29 03:39:13 2006 +0000
    29.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.3 @@ -1,1444 +0,0 @@
    29.4 -/*
    29.5 -    SDL - Simple DirectMedia Layer
    29.6 -    Copyright (C) 1997-2006 Sam Lantinga
    29.7 -
    29.8 -    This library is free software; you can redistribute it and/or
    29.9 -    modify it under the terms of the GNU Lesser General Public
   29.10 -    License as published by the Free Software Foundation; either
   29.11 -    version 2.1 of the License, or (at your option) any later version.
   29.12 -
   29.13 -    This library is distributed in the hope that it will be useful,
   29.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   29.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   29.16 -    Lesser General Public License for more details.
   29.17 -
   29.18 -    You should have received a copy of the GNU Lesser General Public
   29.19 -    License along with this library; if not, write to the Free Software
   29.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   29.21 -
   29.22 -    Sam Lantinga
   29.23 -    slouken@libsdl.org
   29.24 -*/
   29.25 -#include "SDL_config.h"
   29.26 -
   29.27 -/*
   29.28 - * CGX based SDL video driver implementation by Gabriele Greco
   29.29 - * gabriele.greco@aruba.it
   29.30 - */
   29.31 -
   29.32 -#include "SDL_endian.h"
   29.33 -#include "SDL_timer.h"
   29.34 -#include "SDL_thread.h"
   29.35 -#include "SDL_video.h"
   29.36 -#include "SDL_mouse.h"
   29.37 -#include "../SDL_sysvideo.h"
   29.38 -#include "../SDL_pixels_c.h"
   29.39 -#include "../../events/SDL_events_c.h"
   29.40 -#include "SDL_cgxgl_c.h"
   29.41 -#include "SDL_cgxvideo.h"
   29.42 -#include "SDL_cgxwm_c.h"
   29.43 -#include "SDL_amigamouse_c.h"
   29.44 -#include "SDL_amigaevents_c.h"
   29.45 -#include "SDL_cgxmodes_c.h"
   29.46 -#include "SDL_cgximage_c.h"
   29.47 -
   29.48 -/* Initialization/Query functions */
   29.49 -static int CGX_VideoInit(_THIS, SDL_PixelFormat * vformat);
   29.50 -static SDL_Surface *CGX_SetVideoMode(_THIS, SDL_Surface * current, int width,
   29.51 -                                     int height, int bpp, Uint32 flags);
   29.52 -static int CGX_ToggleFullScreen(_THIS, int on);
   29.53 -static void CGX_UpdateMouse(_THIS);
   29.54 -static int CGX_SetColors(_THIS, int firstcolor, int ncolors,
   29.55 -                         SDL_Color * colors);
   29.56 -static void CGX_VideoQuit(_THIS);
   29.57 -
   29.58 -/* CGX driver bootstrap functions */
   29.59 -
   29.60 -struct Library *CyberGfxBase = NULL;
   29.61 -struct IntuitionBase *IntuitionBase = NULL;
   29.62 -struct GfxBase *GfxBase = NULL;
   29.63 -
   29.64 -int
   29.65 -CGX_SetGamma(_THIS, float red, float green, float blue)
   29.66 -{
   29.67 -    SDL_SetError("Gamma correction not supported");
   29.68 -    return -1;
   29.69 -}
   29.70 -
   29.71 -int
   29.72 -CGX_GetGamma(_THIS, float red, float green, float blue)
   29.73 -{
   29.74 -    SDL_SetError("Gamma correction not supported");
   29.75 -    return -1;
   29.76 -}
   29.77 -
   29.78 -int
   29.79 -CGX_SetGammaRamp(_THIS, Uint16 * ramp)
   29.80 -{
   29.81 -#if 0
   29.82 -    Int i, ncolors;
   29.83 -    XColor xcmap[256];
   29.84 -
   29.85 -    /* See if actually setting the gamma is supported */
   29.86 -    if (SDL_Visual->class != DirectColor) {
   29.87 -        SDL_SetError("Gamma correction not supported on this visual");
   29.88 -        return (-1);
   29.89 -    }
   29.90 -
   29.91 -    /* Calculate the appropriate palette for the given gamma ramp */
   29.92 -    ncolors = SDL_Visual->map_entries;
   29.93 -    for (i = 0; i < ncolors; ++i) {
   29.94 -        Uint8 c = (256 * i / ncolors);
   29.95 -        xcmap[i].pixel = SDL_MapRGB(this->screen->format, c, c, c);
   29.96 -        xcmap[i].red = ramp[0 * 256 + c];
   29.97 -        xcmap[i].green = ramp[1 * 256 + c];
   29.98 -        xcmap[i].blue = ramp[2 * 256 + c];
   29.99 -        xcmap[i].flags = (DoRed | DoGreen | DoBlue);
  29.100 -    }
  29.101 -    XStoreColors(GFX_Display, SDL_XColorMap, xcmap, ncolors);
  29.102 -    XSync(GFX_Display, False);
  29.103 -
  29.104 -    return (0);
  29.105 -
  29.106 -#else
  29.107 -    SDL_SetError("Gamma correction not supported on this visual");
  29.108 -    return (-1);
  29.109 -
  29.110 -#endif
  29.111 -}
  29.112 -
  29.113 -static void
  29.114 -DestroyScreen(_THIS)
  29.115 -{
  29.116 -    if (currently_fullscreen) {
  29.117 -        if (this->hidden->dbuffer) {
  29.118 -            extern struct MsgPort *safeport, *dispport;
  29.119 -
  29.120 -            this->hidden->dbuffer = 0;
  29.121 -
  29.122 -            if (safeport) {
  29.123 -                while (GetMsg(safeport) != NULL);
  29.124 -                DeleteMsgPort(safeport);
  29.125 -            }
  29.126 -            if (dispport) {
  29.127 -                while (GetMsg(dispport) != NULL);
  29.128 -                DeleteMsgPort(dispport);
  29.129 -            }
  29.130 -
  29.131 -            this->hidden->SB[0]->sb_DBufInfo->dbi_SafeMessage.
  29.132 -                mn_ReplyPort =
  29.133 -                this->hidden->SB[0]->sb_DBufInfo->dbi_DispMessage.
  29.134 -                mn_ReplyPort = NULL;
  29.135 -            this->hidden->SB[1]->sb_DBufInfo->dbi_SafeMessage.
  29.136 -                mn_ReplyPort =
  29.137 -                this->hidden->SB[1]->sb_DBufInfo->dbi_DispMessage.
  29.138 -                mn_ReplyPort = NULL;
  29.139 -
  29.140 -            if (this->hidden->SB[1])
  29.141 -                FreeScreenBuffer(SDL_Display, this->hidden->SB[1]);
  29.142 -            if (this->hidden->SB[0])
  29.143 -                FreeScreenBuffer(SDL_Display, this->hidden->SB[0]);
  29.144 -
  29.145 -
  29.146 -            this->hidden->SB[0] = this->hidden->SB[1] = NULL;
  29.147 -
  29.148 -            if (SDL_RastPort && SDL_RastPort != &SDL_Display->RastPort)
  29.149 -                SDL_free(SDL_RastPort);
  29.150 -
  29.151 -            SDL_RastPort = NULL;
  29.152 -        }
  29.153 -        CloseScreen(GFX_Display);
  29.154 -        currently_fullscreen = 0;
  29.155 -    } else if (GFX_Display)
  29.156 -        UnlockPubScreen(NULL, GFX_Display);
  29.157 -
  29.158 -    GFX_Display = NULL;
  29.159 -}
  29.160 -
  29.161 -static int
  29.162 -CGX_Available(void)
  29.163 -{
  29.164 -    struct Library *l;
  29.165 -
  29.166 -    l = OpenLibrary("cybergraphics.library", 0L);
  29.167 -
  29.168 -    if (l != NULL) {
  29.169 -        D(bug("CGX video device AVAILABLE\n"));
  29.170 -        CloseLibrary(l);
  29.171 -    }
  29.172 -    D(
  29.173 -         else
  29.174 -         bug("**CGX video device UNAVAILABLE\n"));
  29.175 -
  29.176 -    return (l != NULL);
  29.177 -}
  29.178 -
  29.179 -static void
  29.180 -CGX_DeleteDevice(SDL_VideoDevice * device)
  29.181 -{
  29.182 -    if (device) {
  29.183 -        if (device->hidden) {
  29.184 -            SDL_free(device->hidden);
  29.185 -        }
  29.186 -        if (device->gl_data) {
  29.187 -            SDL_free(device->gl_data);
  29.188 -        }
  29.189 -        SDL_free(device);
  29.190 -    }
  29.191 -}
  29.192 -
  29.193 -static SDL_VideoDevice *
  29.194 -CGX_CreateDevice(int devindex)
  29.195 -{
  29.196 -    SDL_VideoDevice *device;
  29.197 -
  29.198 -    /* Initialize all variables that we clean on shutdown */
  29.199 -    device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice));
  29.200 -    if (device) {
  29.201 -        SDL_memset(device, 0, (sizeof *device));
  29.202 -        device->hidden = (struct SDL_PrivateVideoData *)
  29.203 -            SDL_malloc((sizeof *device->hidden));
  29.204 -        device->gl_data = (struct SDL_PrivateGLData *)
  29.205 -            SDL_malloc((sizeof *device->gl_data));
  29.206 -    }
  29.207 -    if ((device == NULL) || (device->hidden == NULL) ||
  29.208 -        (device->gl_data == NULL)) {
  29.209 -        D(bug("Unable to create video device!\n"));
  29.210 -        SDL_OutOfMemory();
  29.211 -        CGX_DeleteDevice(device);
  29.212 -        return (0);
  29.213 -    }
  29.214 -    SDL_memset(device->hidden, 0, sizeof(*device->hidden));
  29.215 -    SDL_memset(device->gl_data, 0, sizeof(*device->gl_data));
  29.216 -
  29.217 -    /* Set the driver flags */
  29.218 -    device->handles_any_size = 1;
  29.219 -
  29.220 -    /* Set the function pointers */
  29.221 -    device->VideoInit = CGX_VideoInit;
  29.222 -    device->ListModes = CGX_ListModes;
  29.223 -    device->SetVideoMode = CGX_SetVideoMode;
  29.224 -    device->ToggleFullScreen = CGX_ToggleFullScreen;
  29.225 -    device->UpdateMouse = CGX_UpdateMouse;
  29.226 -    device->SetColors = CGX_SetColors;
  29.227 -    device->UpdateRects = NULL;
  29.228 -    device->VideoQuit = CGX_VideoQuit;
  29.229 -    device->AllocHWSurface = CGX_AllocHWSurface;
  29.230 -    device->CheckHWBlit = CGX_CheckHWBlit;
  29.231 -    device->FillHWRect = CGX_FillHWRect;
  29.232 -    device->SetHWColorKey = CGX_SetHWColorKey;
  29.233 -    device->SetHWAlpha = NULL;
  29.234 -    device->LockHWSurface = CGX_LockHWSurface;
  29.235 -    device->UnlockHWSurface = CGX_UnlockHWSurface;
  29.236 -    device->FlipHWSurface = CGX_FlipHWSurface;
  29.237 -    device->FreeHWSurface = CGX_FreeHWSurface;
  29.238 -    device->SetGamma = CGX_SetGamma;
  29.239 -    device->GetGamma = CGX_GetGamma;
  29.240 -    device->SetGammaRamp = CGX_SetGammaRamp;
  29.241 -    device->GetGammaRamp = NULL;
  29.242 -#if SDL_VIDEO_OPENGL
  29.243 -    device->GL_LoadLibrary = CGX_GL_LoadLibrary;
  29.244 -    device->GL_GetProcAddress = CGX_GL_GetProcAddress;
  29.245 -    device->GL_GetAttribute = CGX_GL_GetAttribute;
  29.246 -    device->GL_MakeCurrent = CGX_GL_MakeCurrent;
  29.247 -    device->GL_SwapBuffers = CGX_GL_SwapBuffers;
  29.248 -#endif
  29.249 -    device->SetIcon = CGX_SetIcon;
  29.250 -    device->SetCaption = CGX_SetCaption;
  29.251 -    device->IconifyWindow = NULL;       /* CGX_IconifyWindow; */
  29.252 -    device->GrabInput = NULL /* CGX_GrabInput */ ;
  29.253 -    device->GetWMInfo = CGX_GetWMInfo;
  29.254 -    device->FreeWMCursor = amiga_FreeWMCursor;
  29.255 -    device->CreateWMCursor = amiga_CreateWMCursor;
  29.256 -    device->ShowWMCursor = amiga_ShowWMCursor;
  29.257 -    device->WarpWMCursor = amiga_WarpWMCursor;
  29.258 -    device->CheckMouseMode = amiga_CheckMouseMode;
  29.259 -    device->InitOSKeymap = amiga_InitOSKeymap;
  29.260 -    device->PumpEvents = amiga_PumpEvents;
  29.261 -
  29.262 -    device->free = CGX_DeleteDevice;
  29.263 -
  29.264 -    return device;
  29.265 -}
  29.266 -
  29.267 -VideoBootStrap CGX_bootstrap = {
  29.268 -    "CGX", "AmigaOS CyberGraphics", CGX_Available, CGX_CreateDevice
  29.269 -};
  29.270 -
  29.271 -Uint32
  29.272 -MakeBitMask(_THIS, int type, int format, int *bpp)
  29.273 -{
  29.274 -    D(if (type == 0) bug("REAL pixel format: "));
  29.275 -
  29.276 -    if (this->hidden->depth == *bpp) {
  29.277 -
  29.278 -        switch (format) {
  29.279 -        case PIXFMT_LUT8:
  29.280 -            D(if (type == 0) bug("LUT8\n"));
  29.281 -            return 0;
  29.282 -        case PIXFMT_BGR15:
  29.283 -        case PIXFMT_RGB15PC:
  29.284 -            switch (type) {
  29.285 -            case 0:
  29.286 -                D(bug("RGB15PC/BGR15\n"));
  29.287 -                return 31;
  29.288 -            case 1:
  29.289 -                return 992;
  29.290 -            case 2:
  29.291 -                return 31744;
  29.292 -            }
  29.293 -        case PIXFMT_RGB15:
  29.294 -        case PIXFMT_BGR15PC:
  29.295 -            switch (type) {
  29.296 -            case 0:
  29.297 -                D(bug("RGB15/BGR15PC\n"));
  29.298 -                return 31744;
  29.299 -            case 1:
  29.300 -                return 992;
  29.301 -            case 2:
  29.302 -                return 31;
  29.303 -            }
  29.304 -        case PIXFMT_BGR16PC:
  29.305 -        case PIXFMT_RGB16:
  29.306 -            switch (type) {
  29.307 -            case 0:
  29.308 -                D(bug("RGB16PC\n"));
  29.309 -                return 63488;
  29.310 -            case 1:
  29.311 -                return 2016;
  29.312 -            case 2:
  29.313 -                return 31;
  29.314 -            }
  29.315 -        case PIXFMT_BGR16:
  29.316 -        case PIXFMT_RGB16PC:
  29.317 -            switch (type) {
  29.318 -            case 0:
  29.319 -                D(bug("RGB16PC/BGR16\n"));
  29.320 -                return 31;
  29.321 -            case 1:
  29.322 -                return 2016;
  29.323 -            case 2:
  29.324 -                return 63488;
  29.325 -            }
  29.326 -
  29.327 -        case PIXFMT_RGB24:
  29.328 -            switch (type) {
  29.329 -            case 0:
  29.330 -                D(bug("RGB24/BGR24\n"));
  29.331 -                return 0xff0000;
  29.332 -            case 1:
  29.333 -                return 0xff00;
  29.334 -            case 2:
  29.335 -                return 0xff;
  29.336 -            }
  29.337 -        case PIXFMT_BGR24:
  29.338 -            switch (type) {
  29.339 -            case 0:
  29.340 -                D(bug("BGR24\n"));
  29.341 -                return 0xff;
  29.342 -            case 1:
  29.343 -                return 0xff00;
  29.344 -            case 2:
  29.345 -                return 0xff0000;
  29.346 -            }
  29.347 -        case PIXFMT_ARGB32:
  29.348 -            switch (type) {
  29.349 -            case 0:
  29.350 -                D(bug("ARGB32\n"));
  29.351 -                return 0xff0000;
  29.352 -            case 1:
  29.353 -                return 0xff00;
  29.354 -            case 2:
  29.355 -                return 0xff;
  29.356 -            }
  29.357 -        case PIXFMT_BGRA32:
  29.358 -            switch (type) {
  29.359 -            case 0:
  29.360 -                D(bug("BGRA32\n"));
  29.361 -                return 0xff00;
  29.362 -            case 1:
  29.363 -                return 0xff0000;
  29.364 -            case 2:
  29.365 -                return 0xff000000;
  29.366 -            }
  29.367 -        case PIXFMT_RGBA32:
  29.368 -            switch (type) {
  29.369 -            case 0:
  29.370 -                D(bug("RGBA32\n"));
  29.371 -                return 0xff000000;
  29.372 -            case 1:
  29.373 -                return 0xff0000;
  29.374 -            case 2:
  29.375 -                return 0xff00;
  29.376 -            }
  29.377 -        default:
  29.378 -            D(bug("Unknown pixel format! Default to 24bit\n"));
  29.379 -            return (Uint32) (255 << (type * 8));
  29.380 -        }
  29.381 -    } else {
  29.382 -        D(if (type == 0)
  29.383 -          bug("DIFFERENT from screen.\nAllocated screen format: "));
  29.384 -
  29.385 -        switch (*bpp) {
  29.386 -        case 32:
  29.387 -            D(if (type == 0) bug("RGBA32\n"));
  29.388 -            switch (type) {
  29.389 -            case 0:
  29.390 -                return 0xff000000;
  29.391 -            case 1:
  29.392 -                return 0xff0000;
  29.393 -            case 2:
  29.394 -                return 0xff00;
  29.395 -            }
  29.396 -            break;
  29.397 -        case 24:
  29.398 -          use_truecolor:
  29.399 -            switch (type) {
  29.400 -            case 0:
  29.401 -                D(bug("RGB24\n"));
  29.402 -                return 0xff0000;
  29.403 -            case 1:
  29.404 -                return 0xff00;
  29.405 -            case 2:
  29.406 -                return 0xff;
  29.407 -            }
  29.408 -        case 16:
  29.409 -        case 15:
  29.410 -            D(if (type == 0)
  29.411 -              bug("Not supported, switching to 24bit!\n"));
  29.412 -            *bpp = 24;
  29.413 -            goto use_truecolor;
  29.414 -            break;
  29.415 -        default:
  29.416 -            D(if (type == 0) bug("This is a chunky display\n"));
  29.417 -// For chunky display mask is always 0;
  29.418 -            return 0;
  29.419 -        }
  29.420 -    }
  29.421 -    return 0;
  29.422 -}
  29.423 -
  29.424 -static int
  29.425 -CGX_VideoInit(_THIS, SDL_PixelFormat * vformat)
  29.426 -{
  29.427 -    int i;
  29.428 -    struct Library *RTGBase;
  29.429 -
  29.430 -    D(bug("VideoInit... Opening libraries\n"));
  29.431 -
  29.432 -    if (!IntuitionBase) {
  29.433 -        if (!
  29.434 -            (IntuitionBase =
  29.435 -             (struct IntuitionBase *) OpenLibrary("intuition.library",
  29.436 -                                                  39L))) {
  29.437 -            SDL_SetError("Couldn't open intuition V39+");
  29.438 -            return -1;
  29.439 -        }
  29.440 -    }
  29.441 -
  29.442 -    if (!GfxBase) {
  29.443 -        if (!
  29.444 -            (GfxBase =
  29.445 -             (struct GfxBase *) OpenLibrary("graphics.library", 39L))) {
  29.446 -            SDL_SetError("Couldn't open graphics V39+");
  29.447 -            return -1;
  29.448 -        }
  29.449 -    }
  29.450 -
  29.451 -    if (!CyberGfxBase) {
  29.452 -        if (!(CyberGfxBase = OpenLibrary("cybergraphics.library", 40L))) {
  29.453 -            SDL_SetError("Couldn't open cybergraphics.");
  29.454 -            return (-1);
  29.455 -        }
  29.456 -    }
  29.457 -
  29.458 -    if (RTGBase = OpenLibrary("libs:picasso96/rtg.library", 0L)) {
  29.459 -        extern int use_picasso96;
  29.460 -
  29.461 -        CloseLibrary(RTGBase);
  29.462 -        use_picasso96 = 1;
  29.463 -    }
  29.464 -
  29.465 -    D(bug("Library intialized, locking screen...\n"));
  29.466 -
  29.467 -    SDL_Display = LockPubScreen(NULL);
  29.468 -
  29.469 -    if (SDL_Display == NULL) {
  29.470 -        D(bug("Cannot lock display...\n"));
  29.471 -        SDL_SetError("Couldn't lock the display");
  29.472 -        return (-1);
  29.473 -    }
  29.474 -    this->info.current_w = SDL_Display->Width;
  29.475 -    this->info.current_h = SDL_Display->Height;
  29.476 -
  29.477 -    D(bug("Checking if we are using a CGX native display...\n"));
  29.478 -
  29.479 -    if (!IsCyberModeID(GetVPModeID(&SDL_Display->ViewPort))) {
  29.480 -        Uint32 okid =
  29.481 -            BestCModeIDTags(CYBRBIDTG_NominalWidth, SDL_Display->Width,
  29.482 -                            CYBRBIDTG_NominalHeight, SDL_Display->Height,
  29.483 -                            CYBRBIDTG_Depth, 8,
  29.484 -                            TAG_DONE);
  29.485 -
  29.486 -        D(bug("Default visual is not CGX native!\n"));
  29.487 -
  29.488 -        UnlockPubScreen(NULL, SDL_Display);
  29.489 -
  29.490 -        GFX_Display = NULL;
  29.491 -
  29.492 -        if (okid != INVALID_ID) {
  29.493 -            GFX_Display = OpenScreenTags(NULL,
  29.494 -                                         SA_Width, SDL_Display->Width,
  29.495 -                                         SA_Height, SDL_Display->Height,
  29.496 -                                         SA_Depth, 8, SA_Quiet, TRUE,
  29.497 -                                         SA_ShowTitle, FALSE,
  29.498 -                                         SA_DisplayID, okid, TAG_DONE);
  29.499 -        }
  29.500 -
  29.501 -        if (!GFX_Display) {
  29.502 -            SDL_SetError("Unable to open a suited CGX display");
  29.503 -            return -1;
  29.504 -        } else
  29.505 -            SDL_Display = GFX_Display;
  29.506 -
  29.507 -    } else
  29.508 -        GFX_Display = SDL_Display;
  29.509 -
  29.510 -
  29.511 -    /* See whether or not we need to swap pixels */
  29.512 -
  29.513 -    swap_pixels = 0;
  29.514 -
  29.515 -// Non e' detto che sia cosi' pero', alcune schede potrebbero gestire i modi in modo differente
  29.516 -
  29.517 -    if (SDL_BYTEORDER == SDL_LIL_ENDIAN) {
  29.518 -        swap_pixels = 1;
  29.519 -    }
  29.520 -
  29.521 -    D(bug("Before GetVideoModes....\n"));
  29.522 -
  29.523 -    /* Get the available video modes */
  29.524 -    if (CGX_GetVideoModes(this) < 0)
  29.525 -        return -1;
  29.526 -
  29.527 -    /* Determine the default screen depth:
  29.528 -       Use the default visual (or at least one with the same depth) */
  29.529 -
  29.530 -    for (i = 0; i < this->hidden->nvisuals; i++)
  29.531 -        if (this->hidden->visuals[i].depth ==
  29.532 -            GetCyberMapAttr(SDL_Display->RastPort.BitMap, CYBRMATTR_DEPTH))
  29.533 -            break;
  29.534 -    if (i == this->hidden->nvisuals) {
  29.535 -        /* default visual was useless, take the deepest one instead */
  29.536 -        i = 0;
  29.537 -    }
  29.538 -    SDL_Visual = this->hidden->visuals[i].visual;
  29.539 -
  29.540 -//      SDL_XColorMap = SDL_DisplayColormap;
  29.541 -
  29.542 -    this->hidden->depth = this->hidden->visuals[i].depth;
  29.543 -    D(bug("Init: Setting screen depth to: %ld\n", this->hidden->depth));
  29.544 -    vformat->BitsPerPixel = this->hidden->visuals[i].depth;     /* this->hidden->visuals[i].bpp; */
  29.545 -
  29.546 -    {
  29.547 -        int form;
  29.548 -        APTR handle;
  29.549 -        struct DisplayInfo info;
  29.550 -
  29.551 -        if (!(handle = FindDisplayInfo(this->hidden->visuals[i].visual))) {
  29.552 -            D(bug("Unable to get visual info...\n"));
  29.553 -            return -1;
  29.554 -        }
  29.555 -
  29.556 -        if (!GetDisplayInfoData
  29.557 -            (handle, (char *) &info, sizeof(struct DisplayInfo), DTAG_DISP,
  29.558 -             NULL)) {
  29.559 -            D(bug("Unable to get visual info data...\n"));
  29.560 -            return -1;
  29.561 -        }
  29.562 -
  29.563 -        form = GetCyberIDAttr(CYBRIDATTR_PIXFMT, SDL_Visual);
  29.564 -
  29.565 -// In this case I use makebitmask in a way that I'm sure I'll get PIXFMT pixel mask
  29.566 -
  29.567 -        if (vformat->BitsPerPixel > 8) {
  29.568 -            vformat->Rmask = MakeBitMask(this, 0, form, &this->hidden->depth);
  29.569 -            vformat->Gmask = MakeBitMask(this, 1, form, &this->hidden->depth);
  29.570 -            vformat->Bmask = MakeBitMask(this, 2, form, &this->hidden->depth);
  29.571 -        }
  29.572 -    }
  29.573 -
  29.574 -    /* See if we have been passed a window to use */
  29.575 -/*	SDL_windowid = SDL_getenv("SDL_WINDOWID"); */
  29.576 -    SDL_windowid = NULL;
  29.577 -
  29.578 -    /* Create the blank cursor */
  29.579 -    SDL_BlankCursor = AllocMem(16, MEMF_CHIP | MEMF_CLEAR);
  29.580 -
  29.581 -    /* Fill in some window manager capabilities */
  29.582 -    this->info.wm_available = 1;
  29.583 -    this->info.blit_hw = 1;
  29.584 -    this->info.blit_hw_CC = 1;
  29.585 -    this->info.blit_sw = 1;
  29.586 -    this->info.blit_fill = 1;
  29.587 -    this->info.video_mem = 2000000;     // Not always true but almost any Amiga card has this memory!
  29.588 -
  29.589 -    this->hidden->same_format = 0;
  29.590 -    SDL_RastPort = &SDL_Display->RastPort;
  29.591 -    /* We're done! */
  29.592 -    D(bug("End of CGX_VideoInit\n"));
  29.593 -
  29.594 -    return (0);
  29.595 -}
  29.596 -
  29.597 -void
  29.598 -CGX_DestroyWindow(_THIS, SDL_Surface * screen)
  29.599 -{
  29.600 -    D(bug("Destroy Window...\n"));
  29.601 -
  29.602 -    if (!SDL_windowid) {
  29.603 -        /* Hide the managed window */
  29.604 -        int was_fullscreen = 0;
  29.605 -
  29.606 -        /* Clean up OpenGL */
  29.607 -        if (screen) {
  29.608 -            screen->flags &= ~SDL_INTERNALOPENGL;
  29.609 -        }
  29.610 -
  29.611 -        if (screen && (screen->flags & SDL_FULLSCREEN)) {
  29.612 -            was_fullscreen = 1;
  29.613 -            screen->flags &= ~SDL_FULLSCREEN;
  29.614 -//                      CGX_LeaveFullScreen(this); tolto x crash
  29.615 -        }
  29.616 -
  29.617 -        /* Destroy the output window */
  29.618 -        if (SDL_Window) {
  29.619 -            CloseWindow(SDL_Window);
  29.620 -            SDL_Window = NULL;
  29.621 -        }
  29.622 -
  29.623 -        /* Free the colormap entries */
  29.624 -        if (SDL_XPixels) {
  29.625 -            int numcolors;
  29.626 -            unsigned long pixel;
  29.627 -
  29.628 -            if (this->screen->format && this->hidden->depth == 8
  29.629 -                && !was_fullscreen) {
  29.630 -                numcolors = 1 << this->screen->format->BitsPerPixel;
  29.631 -
  29.632 -                if (numcolors > 256)
  29.633 -                    numcolors = 256;
  29.634 -
  29.635 -                if (!was_fullscreen && this->hidden->depth == 8) {
  29.636 -                    for (pixel = 0; pixel < numcolors; pixel++) {
  29.637 -                        if (SDL_XPixels[pixel] >= 0)
  29.638 -                            ReleasePen(GFX_Display->ViewPort.
  29.639 -                                       ColorMap, SDL_XPixels[pixel]);
  29.640 -                    }
  29.641 -                }
  29.642 -            }
  29.643 -            SDL_free(SDL_XPixels);
  29.644 -            SDL_XPixels = NULL;
  29.645 -        }
  29.646 -    }
  29.647 -}
  29.648 -
  29.649 -static void
  29.650 -CGX_SetSizeHints(_THIS, int w, int h, Uint32 flags)
  29.651 -{
  29.652 -    if (flags & SDL_RESIZABLE) {
  29.653 -        WindowLimits(SDL_Window, 32, 32, 4096, 4096);
  29.654 -    } else {
  29.655 -        WindowLimits(SDL_Window, w, h, w, h);
  29.656 -    }
  29.657 -    if (flags & SDL_FULLSCREEN) {
  29.658 -        flags &= ~SDL_RESIZABLE;
  29.659 -    } else if (SDL_getenv("SDL_VIDEO_CENTERED")) {
  29.660 -        int display_w, display_h;
  29.661 -
  29.662 -        display_w = SDL_Display->Width;
  29.663 -        display_h = SDL_Display->Height;
  29.664 -        ChangeWindowBox(SDL_Window,
  29.665 -                        (display_w - w - SDL_Window->BorderLeft -
  29.666 -                         SDL_Window->BorderRight) / 2,
  29.667 -                        (display_h - h - SDL_Window->BorderTop -
  29.668 -                         SDL_Window->BorderBottom) / 2,
  29.669 -                        w + SDL_Window->BorderLeft +
  29.670 -                        SDL_Window->BorderRight,
  29.671 -                        h + SDL_Window->BorderTop + SDL_Window->BorderBottom);
  29.672 -    }
  29.673 -}
  29.674 -
  29.675 -int
  29.676 -CGX_CreateWindow(_THIS, SDL_Surface * screen,
  29.677 -                 int w, int h, int bpp, Uint32 flags)
  29.678 -{
  29.679 -#if 0
  29.680 -    int i, depth;
  29.681 -    Uint32 vis;
  29.682 -#endif
  29.683 -    D(bug("CGX_CreateWindow\n"));
  29.684 -
  29.685 -    /* If a window is already present, destroy it and start fresh */
  29.686 -    if (SDL_Window) {
  29.687 -        CGX_DestroyWindow(this, screen);
  29.688 -    }
  29.689 -
  29.690 -    /* See if we have been given a window id */
  29.691 -    if (SDL_windowid) {
  29.692 -        SDL_Window = (struct Window *) atol(SDL_windowid);
  29.693 -    } else {
  29.694 -        SDL_Window = 0;
  29.695 -    }
  29.696 -
  29.697 -    /* find out which visual we are going to use */
  29.698 -#if 0
  29.699 -/* questo l'ho spostato nell'apertura dello schermo, in quanto su Amiga le finestre
  29.700 -   hanno il pixel mode degli schermi.
  29.701 - */
  29.702 -    /*if ( flags & SDL_INTERNALOPENGL ) {
  29.703 -       SDL_SetError("OpenGL not supported by the Amiga SDL!");
  29.704 -       return -1;
  29.705 -       }
  29.706 -       else { */
  29.707 -    for (i = 0; i < this->hidden->nvisuals; i++) {
  29.708 -        if (this->hidden->visuals[i].depth == bpp)      /* era .depth */
  29.709 -            break;
  29.710 -    }
  29.711 -    if (i == this->hidden->nvisuals) {
  29.712 -        SDL_SetError("No matching visual for requested depth");
  29.713 -        return -1;              /* should never happen */
  29.714 -    }
  29.715 -    vis = this->hidden->visuals[i].visual;
  29.716 -    depth = this->hidden->visuals[i].depth;
  29.717 -//      }
  29.718 -    SDL_Visual = vis;
  29.719 -    this->hidden->depth = depth;
  29.720 -    D(bug("Setting screen depth to: %ld\n", this->hidden->depth));
  29.721 -#endif
  29.722 -
  29.723 -    /* Allocate the new pixel format for this video mode */
  29.724 -    {
  29.725 -        Uint32 form;
  29.726 -        APTR handle;
  29.727 -        struct DisplayInfo info;
  29.728 -
  29.729 -        if (!(handle = FindDisplayInfo(SDL_Visual)))
  29.730 -            return -1;
  29.731 -
  29.732 -        if (!GetDisplayInfoData
  29.733 -            (handle, (char *) &info, sizeof(struct DisplayInfo), DTAG_DISP,
  29.734 -             NULL))
  29.735 -            return -1;
  29.736 -
  29.737 -        form = GetCyberIDAttr(CYBRIDATTR_PIXFMT, SDL_Visual);
  29.738 -
  29.739 -        if (flags & SDL_HWSURFACE) {
  29.740 -            if (bpp != this->hidden->depth) {
  29.741 -                bpp = this->hidden->depth;
  29.742 -                D(bug("Accel forces bpp to be equal (%ld)\n", bpp));
  29.743 -            }
  29.744 -        }
  29.745 -
  29.746 -        D(bug
  29.747 -          ("BEFORE screen allocation: bpp:%ld (real:%ld)\n", bpp,
  29.748 -           this->hidden->depth));
  29.749 -
  29.750 -/* With this call if needed I'll revert the wanted bpp to a bpp best suited for the display, actually occurs
  29.751 -   only with requested format 15/16bit and display format != 15/16bit
  29.752 - */
  29.753 -
  29.754 -        if (!SDL_ReallocFormat(screen, bpp,
  29.755 -                               MakeBitMask(this, 0, form, &bpp),
  29.756 -                               MakeBitMask(this, 1, form, &bpp),
  29.757 -                               MakeBitMask(this, 2, form, &bpp), 0))
  29.758 -            return -1;
  29.759 -
  29.760 -        D(bug
  29.761 -          ("AFTER screen allocation: bpp:%ld (real:%ld)\n", bpp,
  29.762 -           this->hidden->depth));
  29.763 -
  29.764 -    }
  29.765 -
  29.766 -    /* Create the appropriate colormap */
  29.767 -/*
  29.768 -	if ( SDL_XColorMap != SDL_DisplayColormap ) {
  29.769 -		XFreeColormap(SDL_Display, SDL_XColorMap);
  29.770 -	}
  29.771 -*/
  29.772 -    if (GetCyberMapAttr(SDL_Display->RastPort.BitMap, CYBRMATTR_PIXFMT) ==
  29.773 -        PIXFMT_LUT8 || bpp == 8) {
  29.774 -        int ncolors, i;
  29.775 -        D(bug("XPixels palette allocation...\n"));
  29.776 -
  29.777 -        /* Allocate the pixel flags */
  29.778 -
  29.779 -        if (bpp == 8)
  29.780 -            ncolors = 256;
  29.781 -        else
  29.782 -            ncolors = 1 << screen->format->BitsPerPixel;
  29.783 -
  29.784 -        SDL_XPixels = (Sint32 *) SDL_malloc(ncolors * sizeof(Sint32));
  29.785 -
  29.786 -        if (SDL_XPixels == NULL) {
  29.787 -            SDL_OutOfMemory();
  29.788 -            return -1;
  29.789 -        }
  29.790 -
  29.791 -
  29.792 -        for (i = 0; i < ncolors; i++)
  29.793 -            SDL_XPixels[i] = -1;
  29.794 -
  29.795 -        /* always allocate a private colormap on non-default visuals */
  29.796 -        if (bpp == 8)
  29.797 -            flags |= SDL_HWPALETTE;
  29.798 -
  29.799 -        if (flags & SDL_HWPALETTE)
  29.800 -            screen->flags |= SDL_HWPALETTE;
  29.801 -    }
  29.802 -
  29.803 -    /* resize the (possibly new) window manager window */
  29.804 -
  29.805 -    /* Create (or use) the X11 display window */
  29.806 -
  29.807 -    if (!SDL_windowid) {
  29.808 -        if (flags & SDL_FULLSCREEN) {
  29.809 -            SDL_Window = OpenWindowTags(NULL, WA_Width, w, WA_Height, h,
  29.810 -                                        WA_Flags,
  29.811 -                                        WFLG_ACTIVATE | WFLG_RMBTRAP |
  29.812 -                                        WFLG_BORDERLESS | WFLG_BACKDROP |
  29.813 -                                        WFLG_REPORTMOUSE, WA_IDCMP,
  29.814 -                                        IDCMP_RAWKEY | IDCMP_MOUSEBUTTONS
  29.815 -                                        | IDCMP_MOUSEMOVE,
  29.816 -                                        WA_CustomScreen,
  29.817 -                                        (ULONG) SDL_Display, TAG_DONE);
  29.818 -
  29.819 -            D(bug
  29.820 -              ("Opening backdrop window %ldx%ld on display %lx!\n", w, h,
  29.821 -               SDL_Display));
  29.822 -        } else {
  29.823 -            /* Create GimmeZeroZero window when OpenGL is used */
  29.824 -            unsigned long gzz = FALSE;
  29.825 -            if (flags & SDL_INTERNALOPENGL) {
  29.826 -                gzz = TRUE;
  29.827 -            }
  29.828 -
  29.829 -            SDL_Window =
  29.830 -                OpenWindowTags(NULL, WA_InnerWidth, w, WA_InnerHeight, h,
  29.831 -                               WA_Flags,
  29.832 -                               WFLG_REPORTMOUSE | WFLG_ACTIVATE |
  29.833 -                               WFLG_RMBTRAP | ((flags & SDL_NOFRAME) ? 0
  29.834 -                                               : (WFLG_DEPTHGADGET |
  29.835 -                                                  WFLG_CLOSEGADGET |
  29.836 -                                                  WFLG_DRAGBAR |
  29.837 -                                                  ((flags &
  29.838 -                                                    SDL_RESIZABLE) ?
  29.839 -                                                   WFLG_SIZEGADGET |
  29.840 -                                                   WFLG_SIZEBBOTTOM :
  29.841 -                                                   0))), WA_IDCMP,
  29.842 -                               IDCMP_RAWKEY | IDCMP_CLOSEWINDOW |
  29.843 -                               IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
  29.844 -                               IDCMP_MOUSEMOVE, WA_PubScreen,
  29.845 -                               (ULONG) SDL_Display, WA_GimmeZeroZero,
  29.846 -                               gzz, TAG_DONE);
  29.847 -            D(bug("Opening WB window of size: %ldx%ld!\n", w, h));
  29.848 -        }
  29.849 -
  29.850 -        if (!SDL_Window)
  29.851 -            return -1;
  29.852 -    }
  29.853 -
  29.854 -    this->hidden->BytesPerPixel =
  29.855 -        GetCyberMapAttr(SDL_Window->RPort->BitMap, CYBRMATTR_BPPIX);
  29.856 -
  29.857 -    if (screen->flags & SDL_DOUBLEBUF) {
  29.858 -        if (SDL_RastPort = SDL_malloc(sizeof(struct RastPort))) {
  29.859 -            InitRastPort(SDL_RastPort);
  29.860 -            SDL_RastPort->BitMap = this->hidden->SB[1]->sb_BitMap;
  29.861 -        } else
  29.862 -            return -1;
  29.863 -    } else
  29.864 -        SDL_RastPort = SDL_Window->RPort;
  29.865 -
  29.866 -    if (flags & SDL_HWSURFACE)
  29.867 -        screen->flags |= SDL_HWSURFACE;
  29.868 -
  29.869 -    if (!SDL_windowid) {
  29.870 -        CGX_SetSizeHints(this, w, h, flags);
  29.871 -    }
  29.872 -
  29.873 -    /* Set our colormaps when not setting a GL mode */
  29.874 -/*
  29.875 -	if ( ! (flags & SDL_INTERNALOPENGL) ) {
  29.876 -		XSetWindowColormap(SDL_Display, SDL_Window, SDL_XColorMap);
  29.877 -	}
  29.878 -*/
  29.879 -
  29.880 -    /* Map them both and go fullscreen, if requested */
  29.881 -    if (!SDL_windowid) {
  29.882 -        if (flags & SDL_FULLSCREEN) {
  29.883 -            screen->flags |= SDL_FULLSCREEN;
  29.884 -            currently_fullscreen = 1;
  29.885 -//                      CGX_EnterFullScreen(this); Ci siamo gia'!
  29.886 -        } else {
  29.887 -            screen->flags &= ~SDL_FULLSCREEN;
  29.888 -        }
  29.889 -    }
  29.890 -    screen->w = w;
  29.891 -    screen->h = h;
  29.892 -    screen->pitch = SDL_CalculatePitch(screen);
  29.893 -    CGX_ResizeImage(this, screen, flags);
  29.894 -
  29.895 -    /* Make OpenGL Context if needed */
  29.896 -    if (flags & SDL_INTERNALOPENGL) {
  29.897 -        if (this->gl_data->gl_active == 0) {
  29.898 -            if (CGX_GL_Init(this) < 0)
  29.899 -                return -1;
  29.900 -            else
  29.901 -                screen->flags |= SDL_INTERNALOPENGL;
  29.902 -        } else {
  29.903 -            if (CGX_GL_Update(this) < 0)
  29.904 -                return -1;
  29.905 -            else
  29.906 -                screen->flags |= SDL_INTERNALOPENGL;
  29.907 -        }
  29.908 -    }
  29.909 -}
  29.910 -
  29.911 -int
  29.912 -CGX_ResizeWindow(_THIS, SDL_Surface * screen, int w, int h, Uint32 flags)
  29.913 -{
  29.914 -    D(bug("CGX_ResizeWindow\n"));
  29.915 -
  29.916 -    if (!SDL_windowid) {
  29.917 -        /* Resize the window manager window */
  29.918 -        CGX_SetSizeHints(this, w, h, flags);
  29.919 -
  29.920 -        ChangeWindowBox(SDL_Window, SDL_Window->LeftEdge,
  29.921 -                        SDL_Window->TopEdge,
  29.922 -                        w + SDL_Window->BorderLeft +
  29.923 -                        SDL_Window->BorderRight,
  29.924 -                        h + SDL_Window->BorderTop + SDL_Window->BorderBottom);
  29.925 -
  29.926 -        screen->w = w;
  29.927 -        screen->h = h;
  29.928 -        screen->pitch = SDL_CalculatePitch(screen);
  29.929 -        CGX_ResizeImage(this, screen, flags);
  29.930 -    }
  29.931 -    return (0);
  29.932 -}
  29.933 -
  29.934 -static SDL_Surface *
  29.935 -CGX_SetVideoMode(_THIS, SDL_Surface * current,
  29.936 -                 int width, int height, int bpp, Uint32 flags)
  29.937 -{
  29.938 -    Uint32 saved_flags;
  29.939 -    int needcreate = 0;
  29.940 -
  29.941 -    D(bug("CGX_SetVideoMode current:%lx\n", current));
  29.942 -
  29.943 -    /* Lock the event thread, in multi-threading environments */
  29.944 -    SDL_Lock_EventThread();
  29.945 -
  29.946 -// Check if the window needs to be closed or can be resized
  29.947 -
  29.948 -    if ((flags & SDL_FULLSCREEN)
  29.949 -        || (current && current->flags & SDL_FULLSCREEN
  29.950 -            && !(flags & SDL_FULLSCREEN)))
  29.951 -        needcreate = 1;
  29.952 -
  29.953 -// Check if we need to close an already existing videomode...
  29.954 -
  29.955 -    if (current && current->flags & SDL_FULLSCREEN
  29.956 -        && !(flags & SDL_FULLSCREEN)) {
  29.957 -        unsigned long i;
  29.958 -        D(bug("Destroying image, window & screen!\n"));
  29.959 -
  29.960 -        CGX_DestroyImage(this, current);
  29.961 -        CGX_DestroyWindow(this, current);
  29.962 -        DestroyScreen(this);
  29.963 -        GFX_Display = SDL_Display = LockPubScreen(NULL);
  29.964 -
  29.965 -        bpp = this->hidden->depth =
  29.966 -            GetCyberMapAttr(SDL_Display->RastPort.BitMap, CYBRMATTR_DEPTH);
  29.967 -
  29.968 -        for (i = 0; i < this->hidden->nvisuals; i++) {
  29.969 -            if (this->hidden->visuals[i].depth == bpp)  /* era .depth */
  29.970 -                break;
  29.971 -        }
  29.972 -        if (i == this->hidden->nvisuals) {
  29.973 -            SDL_SetError("No matching visual for requested depth");
  29.974 -            return NULL;        /* should never happen */
  29.975 -        }
  29.976 -        SDL_Visual = this->hidden->visuals[i].visual;
  29.977 -
  29.978 -        D(bug("Setting screen depth to: %ld\n", this->hidden->depth));
  29.979 -
  29.980 -    }
  29.981 -    /* Check the combination of flags we were passed */
  29.982 -    if (flags & SDL_FULLSCREEN) {
  29.983 -        int i;
  29.984 -
  29.985 -        /* Clear fullscreen flag if not supported */
  29.986 -        if (SDL_windowid) {
  29.987 -            flags &= ~SDL_FULLSCREEN;
  29.988 -        } else if (current && current->flags & SDL_FULLSCREEN) {
  29.989 -            if (current->w != width ||
  29.990 -                current->h != height ||
  29.991 -                (this->hidden && this->hidden->depth != bpp)) {
  29.992 -                D(bug("Deleting previous window...\n"));
  29.993 -                CGX_DestroyImage(this, current);
  29.994 -                CGX_DestroyWindow(this, current);
  29.995 -                DestroyScreen(this);
  29.996 -                goto buildnewscreen;
  29.997 -            }
  29.998 -        } else
  29.999 -          buildnewscreen:
 29.1000 -        {
 29.1001 -            Uint32 okid = BestCModeIDTags(CYBRBIDTG_NominalWidth, width,
 29.1002 -                                          CYBRBIDTG_NominalHeight,
 29.1003 -                                          height,
 29.1004 -                                          CYBRBIDTG_Depth, bpp,
 29.1005 -                                          TAG_DONE);
 29.1006 -
 29.1007 -            GFX_Display = NULL;
 29.1008 -
 29.1009 -            D(bug("Opening screen...\n"));
 29.1010 -
 29.1011 -            if (okid != INVALID_ID)
 29.1012 -                GFX_Display = OpenScreenTags(NULL,
 29.1013 -                                             SA_Width, width,
 29.1014 -                                             SA_Height, height,
 29.1015 -                                             SA_Quiet, TRUE,
 29.1016 -                                             SA_ShowTitle, FALSE,
 29.1017 -                                             SA_Depth, bpp, SA_DisplayID,
 29.1018 -                                             okid, TAG_DONE);
 29.1019 -
 29.1020 -            if (!GFX_Display) {
 29.1021 -                GFX_Display = SDL_Display;
 29.1022 -                flags &= ~SDL_FULLSCREEN;
 29.1023 -                flags &= ~SDL_DOUBLEBUF;
 29.1024 -            } else {
 29.1025 -                UnlockPubScreen(NULL, SDL_Display);
 29.1026 -                SDL_Display = GFX_Display;
 29.1027 -
 29.1028 -                D(bug("Screen opened.\n"));
 29.1029 -
 29.1030 -                if (flags & SDL_DOUBLEBUF) {
 29.1031 -                    int ok = 0;
 29.1032 -                    D(bug("Start of DBuffering allocations...\n"));
 29.1033 -
 29.1034 -                    if (this->hidden->SB[0] =
 29.1035 -                        AllocScreenBuffer(SDL_Display, NULL,
 29.1036 -                                          SB_SCREEN_BITMAP)) {
 29.1037 -
 29.1038 -                        if (this->hidden->SB[1] =
 29.1039 -                            AllocScreenBuffer(SDL_Display, NULL, 0L)) {
 29.1040 -                            extern struct MsgPort *safeport, *dispport;
 29.1041 -
 29.1042 -                            safeport = CreateMsgPort();
 29.1043 -                            dispport = CreateMsgPort();
 29.1044 -
 29.1045 -                            if (!safeport || !dispport) {
 29.1046 -                                if (safeport) {
 29.1047 -                                    DeleteMsgPort(safeport);
 29.1048 -                                    safeport = NULL;
 29.1049 -                                }
 29.1050 -                                if (dispport) {
 29.1051 -                                    DeleteMsgPort(dispport);
 29.1052 -                                    dispport = NULL;
 29.1053 -                                }
 29.1054 -                                FreeScreenBuffer(SDL_Display,
 29.1055 -                                                 this->hidden->SB[0]);
 29.1056 -                                FreeScreenBuffer(SDL_Display,
 29.1057 -                                                 this->hidden->SB[1]);
 29.1058 -                            } else {
 29.1059 -                                extern ULONG safe_sigbit, disp_sigbit;
 29.1060 -                                int i;
 29.1061 -
 29.1062 -                                safe_sigbit = 1L << safeport->mp_SigBit;
 29.1063 -                                disp_sigbit = 1L << dispport->mp_SigBit;
 29.1064 -
 29.1065 -                                for (i = 0; i < 2; i++) {
 29.1066 -                                    this->hidden->SB[i]->
 29.1067 -                                        sb_DBufInfo->
 29.1068 -                                        dbi_SafeMessage.
 29.1069 -                                        mn_ReplyPort = safeport;
 29.1070 -                                    this->hidden->SB[i]->
 29.1071 -                                        sb_DBufInfo->
 29.1072 -                                        dbi_DispMessage.
 29.1073 -                                        mn_ReplyPort = dispport;
 29.1074 -                                }
 29.1075 -
 29.1076 -                                ok = 1;
 29.1077 -                                D(bug("Dbuffering enabled!\n"));
 29.1078 -                                this->hidden->dbuffer = 1;
 29.1079 -                                current->flags |= SDL_DOUBLEBUF;
 29.1080 -                            }
 29.1081 -                        } else {
 29.1082 -                            FreeScreenBuffer(SDL_Display,
 29.1083 -                                             this->hidden->SB[1]);
 29.1084 -                            this->hidden->SB[0] = NULL;
 29.1085 -                        }
 29.1086 -                    }
 29.1087 -
 29.1088 -                    if (!ok)
 29.1089 -                        flags &= ~SDL_DOUBLEBUF;
 29.1090 -                }
 29.1091 -            }
 29.1092 -
 29.1093 -            if (GetCyberMapAttr
 29.1094 -                (SDL_Display->RastPort.BitMap, CYBRMATTR_DEPTH) == bpp)
 29.1095 -                this->hidden->same_format = 1;
 29.1096 -        }
 29.1097 -
 29.1098 -        bpp = this->hidden->depth =
 29.1099 -            GetCyberMapAttr(SDL_Display->RastPort.BitMap, CYBRMATTR_DEPTH);
 29.1100 -        D(bug("Setting screen depth to: %ld\n", this->hidden->depth));
 29.1101 -
 29.1102 -        for (i = 0; i < this->hidden->nvisuals; i++)
 29.1103 -            if (this->hidden->visuals[i].depth == bpp)  /* era .depth */
 29.1104 -                break;
 29.1105 -
 29.1106 -        if (i == this->hidden->nvisuals) {
 29.1107 -            SDL_SetError("No matching visual for requested depth");
 29.1108 -            return NULL;        /* should never happen */
 29.1109 -        }
 29.1110 -        SDL_Visual = this->hidden->visuals[i].visual;
 29.1111 -
 29.1112 -    }
 29.1113 -
 29.1114 -    /* Set up the X11 window */
 29.1115 -    saved_flags = current->flags;
 29.1116 -
 29.1117 -    if (SDL_Window
 29.1118 -        && (saved_flags & SDL_INTERNALOPENGL) == (flags & SDL_INTERNALOPENGL)
 29.1119 -        && bpp == current->format->BitsPerPixel && !needcreate) {
 29.1120 -        if (CGX_ResizeWindow(this, current, width, height, flags) < 0) {
 29.1121 -            current = NULL;
 29.1122 -            goto done;
 29.1123 -        }
 29.1124 -    } else {
 29.1125 -        if (CGX_CreateWindow(this, current, width, height, bpp, flags) < 0) {
 29.1126 -            current = NULL;
 29.1127 -            goto done;
 29.1128 -        }
 29.1129 -    }
 29.1130 -
 29.1131 -#if 0
 29.1132 -    /* Set up the new mode framebuffer */
 29.1133 -    if (((current->w != width) || (current->h != height)) ||
 29.1134 -        ((saved_flags & SDL_INTERNALOPENGL) != (flags & SDL_INTERNALOPENGL)))
 29.1135 -    {
 29.1136 -        current->w = width;
 29.1137 -        current->h = height;
 29.1138 -        current->pitch = SDL_CalculatePitch(current);
 29.1139 -        CGX_ResizeImage(this, current, flags);
 29.1140 -    }
 29.1141 -#endif
 29.1142 -
 29.1143 -    current->flags |= (flags & SDL_RESIZABLE);  // Resizable only if the user asked it
 29.1144 -
 29.1145 -  done:
 29.1146 -    /* Release the event thread */
 29.1147 -    SDL_Unlock_EventThread();
 29.1148 -
 29.1149 -    /* We're done! */
 29.1150 -    return (current);
 29.1151 -}
 29.1152 -
 29.1153 -static int
 29.1154 -CGX_ToggleFullScreen(_THIS, int on)
 29.1155 -{
 29.1156 -    Uint32 event_thread;
 29.1157 -
 29.1158 -    /* Don't switch if we don't own the window */
 29.1159 -    if (SDL_windowid) {
 29.1160 -        return (0);
 29.1161 -    }
 29.1162 -
 29.1163 -    /* Don't lock if we are the event thread */
 29.1164 -    event_thread = SDL_EventThreadID();
 29.1165 -    if (event_thread && (SDL_ThreadID() == event_thread)) {
 29.1166 -        event_thread = 0;
 29.1167 -    }
 29.1168 -    if (event_thread) {
 29.1169 -        SDL_Lock_EventThread();
 29.1170 -    }
 29.1171 -    if (on) {
 29.1172 -        this->screen->flags |= SDL_FULLSCREEN;
 29.1173 -        CGX_EnterFullScreen(this);
 29.1174 -    } else {
 29.1175 -        this->screen->flags &= ~SDL_FULLSCREEN;
 29.1176 -        CGX_LeaveFullScreen(this);
 29.1177 -    }
 29.1178 -
 29.1179 -    CGX_RefreshDisplay(this);
 29.1180 -    if (event_thread) {
 29.1181 -        SDL_Unlock_EventThread();
 29.1182 -    }
 29.1183 -
 29.1184 -    SDL_ResetKeyboard();
 29.1185 -
 29.1186 -    return (1);
 29.1187 -}
 29.1188 -
 29.1189 -static void
 29.1190 -SetSingleColor(Uint32 fmt, unsigned char r, unsigned char g, unsigned char b,
 29.1191 -               unsigned char *c)
 29.1192 -{
 29.1193 -    switch (fmt) {
 29.1194 -    case PIXFMT_BGR15:
 29.1195 -    case PIXFMT_RGB15PC:
 29.1196 -        {
 29.1197 -            Uint16 *t = (Uint16 *) c;
 29.1198 -            *t = (r >> 3) | ((g >> 3) << 5) | ((b >> 3) << 10);
 29.1199 -        }
 29.1200 -        break;
 29.1201 -    case PIXFMT_RGB15:
 29.1202 -    case PIXFMT_BGR15PC:
 29.1203 -        {
 29.1204 -            Uint16 *t = (Uint16 *) c;
 29.1205 -            *t = (b >> 3) | ((g >> 3) << 5) | ((r >> 3) << 10);
 29.1206 -        }
 29.1207 -        break;
 29.1208 -    case PIXFMT_BGR16PC:
 29.1209 -    case PIXFMT_RGB16:
 29.1210 -        {
 29.1211 -            Uint16 *t = (Uint16 *) c;
 29.1212 -            *t = (b >> 3) | ((g >> 2) << 5) | ((r >> 3) << 11);
 29.1213 -        }
 29.1214 -        break;
 29.1215 -    case PIXFMT_BGR16:
 29.1216 -    case PIXFMT_RGB16PC:
 29.1217 -        {
 29.1218 -            Uint16 *t = (Uint16 *) c;
 29.1219 -            *t = (r >> 3) | ((g >> 2) << 5) | ((b >> 3) << 11);
 29.1220 -        }
 29.1221 -        break;
 29.1222 -    case PIXFMT_RGB24:
 29.1223 -        c[0] = r;
 29.1224 -        c[1] = g;
 29.1225 -        c[2] = b;
 29.1226 -        c[3] = 0;
 29.1227 -        break;
 29.1228 -    case PIXFMT_BGR24:
 29.1229 -        c[0] = b;
 29.1230 -        c[1] = g;
 29.1231 -        c[2] = r;
 29.1232 -        c[3] = 0;
 29.1233 -        break;
 29.1234 -    case PIXFMT_ARGB32:
 29.1235 -        c[0] = 0;
 29.1236 -        c[1] = r;
 29.1237 -        c[2] = g;
 29.1238 -        c[3] = b;
 29.1239 -        break;
 29.1240 -    case PIXFMT_BGRA32:
 29.1241 -        c[0] = b;
 29.1242 -        c[1] = g;
 29.1243 -        c[2] = r;
 29.1244 -        c[3] = 0;
 29.1245 -        break;
 29.1246 -    case PIXFMT_RGBA32:
 29.1247 -        c[0] = r;
 29.1248 -        c[1] = g;
 29.1249 -        c[2] = b;
 29.1250 -        c[3] = 0;
 29.1251 -        break;
 29.1252 -
 29.1253 -    default:
 29.1254 -        D(bug("Error, SetSingleColor with PIXFMT %ld!\n", fmt));
 29.1255 -    }
 29.1256 -}
 29.1257 -
 29.1258 -/* Update the current mouse state and position */
 29.1259 -static void
 29.1260 -CGX_UpdateMouse(_THIS)
 29.1261 -{
 29.1262 -    /* Lock the event thread, in multi-threading environments */
 29.1263 -    SDL_Lock_EventThread();
 29.1264 -
 29.1265 -    if (currently_fullscreen) {
 29.1266 -        SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
 29.1267 -        SDL_PrivateMouseMotion(0, 0, SDL_Display->MouseX,
 29.1268 -                               SDL_Display->MouseY);
 29.1269 -    } else {
 29.1270 -        if (SDL_Display->MouseX >=
 29.1271 -            (SDL_Window->LeftEdge + SDL_Window->BorderLeft)
 29.1272 -            && SDL_Display->MouseX <
 29.1273 -            (SDL_Window->LeftEdge + SDL_Window->Width -
 29.1274 -             SDL_Window->BorderRight)
 29.1275 -            && SDL_Display->MouseY >=
 29.1276 -            (SDL_Window->TopEdge + SDL_Window->BorderLeft)
 29.1277 -            && SDL_Display->MouseY <
 29.1278 -            (SDL_Window->TopEdge + SDL_Window->Height -
 29.1279 -             SDL_Window->BorderBottom)) {
 29.1280 -            SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
 29.1281 -            SDL_PrivateMouseMotion(0, 0,
 29.1282 -                                   SDL_Display->MouseX -
 29.1283 -                                   SDL_Window->LeftEdge -
 29.1284 -                                   SDL_Window->BorderLeft,
 29.1285 -                                   SDL_Display->MouseY -
 29.1286 -                                   SDL_Window->TopEdge -
 29.1287 -                                   SDL_Window->BorderTop);
 29.1288 -        } else {
 29.1289 -            SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
 29.1290 -        }
 29.1291 -    }
 29.1292 -    SDL_Unlock_EventThread();
 29.1293 -}
 29.1294 -
 29.1295 -static int
 29.1296 -CGX_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color * colors)
 29.1297 -{
 29.1298 -    int i;
 29.1299 -
 29.1300 -    /* Check to make sure we have a colormap allocated */
 29.1301 -
 29.1302 -    /* It's easy if we have a hidden colormap */
 29.1303 -    if ((this->screen->flags & SDL_HWPALETTE) && currently_fullscreen) {
 29.1304 -        ULONG xcmap[256 * 3 + 2];
 29.1305 -
 29.1306 -        xcmap[0] = (ncolors << 16);
 29.1307 -        xcmap[0] += firstcolor;
 29.1308 -
 29.1309 -//              D(bug("Setting %ld colors on an HWPALETTE screen\n",ncolors));
 29.1310 -
 29.1311 -        for (i = 0; i < ncolors; i++) {
 29.1312 -            xcmap[i * 3 + 1] = colors[i + firstcolor].r << 24;
 29.1313 -            xcmap[i * 3 + 2] = colors[i + firstcolor].g << 24;
 29.1314 -            xcmap[i * 3 + 3] = colors[i + firstcolor].b << 24;
 29.1315 -        }
 29.1316 -        xcmap[ncolors * 3 + 1] = 0;
 29.1317 -        LoadRGB32(&GFX_Display->ViewPort, xcmap);
 29.1318 -    } else {
 29.1319 -// XPixels are not needed on 8bit screen with hwpalette
 29.1320 -        unsigned long pixel;
 29.1321 -
 29.1322 -        if (SDL_XPixels == NULL) {
 29.1323 -            D(bug("SetColors without colormap!"));
 29.1324 -            return (0);
 29.1325 -        }
 29.1326 -
 29.1327 -        if (this->hidden->depth == 8) {
 29.1328 -// In this case I have to unalloc and realloc the full palette
 29.1329 -            D(bug("Obtaining %ld colors on the screen\n", ncolors));
 29.1330 -
 29.1331 -            /* Free existing allocated colors */
 29.1332 -            for (pixel = 0;
 29.1333 -                 pixel < this->screen->format->palette->ncolors; ++pixel) {
 29.1334 -                if (SDL_XPixels[pixel] >= 0)
 29.1335 -                    ReleasePen(GFX_Display->ViewPort.ColorMap,
 29.1336 -                               SDL_XPixels[pixel]);
 29.1337 -            }
 29.1338 -
 29.1339 -            /* Try to allocate all the colors */
 29.1340 -            for (i = 0; i < this->screen->format->palette->ncolors; ++i) {
 29.1341 -                SDL_XPixels[i] =
 29.1342 -                    ObtainBestPenA(GFX_Display->ViewPort.ColorMap,
 29.1343 -                                   colors[i].r << 24,
 29.1344 -                                   colors[i].g << 24,
 29.1345 -                                   colors[i].b << 24, NULL);
 29.1346 -            }
 29.1347 -        } else {
 29.1348 -#ifndef USE_CGX_WRITELUTPIXEL
 29.1349 -            Uint32 fmt;
 29.1350 -            D(bug("Preparing a conversion pixel table...\n"));
 29.1351 -
 29.1352 -            fmt =
 29.1353 -                GetCyberMapAttr(SDL_Display->RastPort.BitMap,
 29.1354 -                                CYBRMATTR_PIXFMT);
 29.1355 -
 29.1356 -            for (i = 0; i < ncolors; i++) {
 29.1357 -                SetSingleColor(fmt, colors[firstcolor + i].r,
 29.1358 -                               colors[firstcolor + i].g,
 29.1359 -                               colors[firstcolor + i].b, (unsigned char *)
 29.1360 -                               &SDL_XPixels[firstcolor + i]);
 29.1361 -            }
 29.1362 -#else
 29.1363 -//                      D(bug("Executing XPixel(%lx) remapping: (from %ld, %ld colors) first: r%ld g%ld b%ld\n",SDL_XPixels,firstcolor,ncolors,colors[firstcolor].r,colors[firstcolor].g,colors[firstcolor].b));
 29.1364 -            for (i = 0; i < ncolors; i++)
 29.1365 -                SDL_XPixels[i + firstcolor] =
 29.1366 -                    (colors[firstcolor + i].r << 16) +
 29.1367 -                    (colors[firstcolor + i].g << 8) + colors[firstcolor +
 29.1368 -                                                             i].b;
 29.1369 -#endif
 29.1370 -        }
 29.1371 -    }
 29.1372 -
 29.1373 -// Actually it cannot fail!
 29.1374 -
 29.1375 -    return 1;
 29.1376 -}
 29.1377 -
 29.1378 -/* Note:  If we are terminated, this could be called in the middle of
 29.1379 -   another SDL video routine -- notably UpdateRects.
 29.1380 -*/
 29.1381 -static void
 29.1382 -CGX_VideoQuit(_THIS)
 29.1383 -{
 29.1384 -    /* Shutdown everything that's still up */
 29.1385 -    /* The event thread should be done, so we can touch SDL_Display */
 29.1386 -    D(bug("CGX_VideoQuit\n"));
 29.1387 -
 29.1388 -    if (SDL_Display != NULL) {
 29.1389 -        /* Clean up OpenGL */
 29.1390 -        if (this->gl_data->gl_active == 1) {
 29.1391 -            CGX_GL_Quit(this);
 29.1392 -        }
 29.1393 -        /* Start shutting down the windows */
 29.1394 -        D(bug("Destroying image...\n"));
 29.1395 -        CGX_DestroyImage(this, this->screen);
 29.1396 -        D(bug("Destroying window...\n"));
 29.1397 -        CGX_DestroyWindow(this, this->screen);
 29.1398 -// Otherwise SDL_VideoQuit will try to free it!
 29.1399 -        SDL_VideoSurface = NULL;
 29.1400 -
 29.1401 -        CGX_FreeVideoModes(this);
 29.1402 -
 29.1403 -        /* Free that blank cursor */
 29.1404 -        if (SDL_BlankCursor != NULL) {
 29.1405 -            FreeMem(SDL_BlankCursor, 16);
 29.1406 -            SDL_BlankCursor = NULL;
 29.1407 -        }
 29.1408 -
 29.1409 -        /* Close the X11 graphics connection */
 29.1410 -        this->hidden->same_format = 0;
 29.1411 -
 29.1412 -        D(bug("Destroying screen...\n"));
 29.1413 -
 29.1414 -        if (GFX_Display != NULL)
 29.1415 -            DestroyScreen(this);
 29.1416 -
 29.1417 -        /* Close the X11 display connection */
 29.1418 -        SDL_Display = NULL;
 29.1419 -
 29.1420 -        /* Unload GL library after X11 shuts down */
 29.1421 -    }
 29.1422 -
 29.1423 -    D(bug("Closing libraries...\n"));
 29.1424 -
 29.1425 -    if (CyberGfxBase) {
 29.1426 -        CloseLibrary(CyberGfxBase);
 29.1427 -        CyberGfxBase = NULL;
 29.1428 -    }
 29.1429 -
 29.1430 -    if (IntuitionBase) {
 29.1431 -        CloseLibrary((struct Library *) IntuitionBase);
 29.1432 -        IntuitionBase = NULL;
 29.1433 -    }
 29.1434 -    if (GfxBase) {
 29.1435 -        CloseLibrary((struct Library *) GfxBase);
 29.1436 -        GfxBase = NULL;
 29.1437 -    }
 29.1438 -
 29.1439 -    if (this->screen && (this->screen->flags & SDL_HWSURFACE)) {
 29.1440 -        /* Direct screen access, no memory buffer */
 29.1441 -        this->screen->pixels = NULL;
 29.1442 -    }
 29.1443 -    D(bug("End of CGX_VideoQuit.\n"));
 29.1444 -
 29.1445 -}
 29.1446 -
 29.1447 -/* vi: set ts=4 sw=4 expandtab: */
    30.1 --- a/src/video/cybergfx/SDL_cgxvideo.h	Sun Oct 29 03:39:13 2006 +0000
    30.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.3 @@ -1,178 +0,0 @@
    30.4 -/*
    30.5 -    SDL - Simple DirectMedia Layer
    30.6 -    Copyright (C) 1997-2006 Sam Lantinga
    30.7 -
    30.8 -    This library is free software; you can redistribute it and/or
    30.9 -    modify it under the terms of the GNU Lesser General Public
   30.10 -    License as published by the Free Software Foundation; either
   30.11 -    version 2.1 of the License, or (at your option) any later version.
   30.12 -
   30.13 -    This library is distributed in the hope that it will be useful,
   30.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   30.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   30.16 -    Lesser General Public License for more details.
   30.17 -
   30.18 -    You should have received a copy of the GNU Lesser General Public
   30.19 -    License along with this library; if not, write to the Free Software
   30.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   30.21 -
   30.22 -    Sam Lantinga
   30.23 -    slouken@libsdl.org
   30.24 -*/
   30.25 -#include "SDL_config.h"
   30.26 -
   30.27 -#ifndef _SDL_cgxvideo_h
   30.28 -#define _SDL_cgxvideo_h
   30.29 -
   30.30 -
   30.31 -#include <exec/exec.h>
   30.32 -#include <cybergraphx/cybergraphics.h>
   30.33 -#include <graphics/scale.h>
   30.34 -#include <graphics/gfx.h>
   30.35 -#include <intuition/intuition.h>
   30.36 -#if defined(__SASC) || defined(STORMC4_WOS)
   30.37 -#include <proto/exec.h>
   30.38 -#include <proto/cybergraphics.h>
   30.39 -#include <proto/graphics.h>
   30.40 -#include <proto/intuition.h>
   30.41 -#include <proto/console.h>
   30.42 -#else
   30.43 -#include <inline/exec.h>
   30.44 -#include <inline/cybergraphics.h>
   30.45 -#include <inline/graphics.h>
   30.46 -#include <inline/intuition.h>
   30.47 -#include <inline/console.h>
   30.48 -#endif
   30.49 -
   30.50 -#include "SDL_mouse.h"
   30.51 -#include "../SDL_sysvideo.h"
   30.52 -#include "mydebug.h"
   30.53 -
   30.54 -#define USE_CGX_WRITELUTPIXEL
   30.55 -
   30.56 -/* Hidden "this" pointer for the video functions */
   30.57 -#define _THIS	SDL_VideoDevice *this
   30.58 -
   30.59 -/* Private display data */
   30.60 -struct SDL_PrivateVideoData
   30.61 -{
   30.62 -    struct Screen *Public_Display;      /* Used for events and window management */
   30.63 -    struct Screen *GFX_Display; /* Used for graphics and colormap stuff */
   30.64 -    Uint32 SDL_VisualUnused;    /* The visual used by our window */
   30.65 -    struct Window *SDL_Window;  /* Shared by both displays (no X security?) */
   30.66 -    unsigned char *BlankCursor; /* The invisible cursor */
   30.67 -
   30.68 -    char *SDL_windowid;         /* Flag: true if we have been passed a window */
   30.69 -
   30.70 -    /* The variables used for displaying graphics */
   30.71 -    Uint8 *Ximage;              /* The X image for our window */
   30.72 -    int swap_pixels;            /* Flag: true if display is swapped endian */
   30.73 -
   30.74 -    /* Support for internal mouse warping */
   30.75 -    struct
   30.76 -    {
   30.77 -        int x;
   30.78 -        int y;
   30.79 -    } mouse_last;
   30.80 -    struct
   30.81 -    {
   30.82 -        int numerator;
   30.83 -        int denominator;
   30.84 -        int threshold;
   30.85 -    } mouse_accel;
   30.86 -    int mouse_relative;
   30.87 -
   30.88 -    /* The current list of available video modes */
   30.89 -    SDL_Rect **modelist;
   30.90 -
   30.91 -    /* available visuals of interest to us, sorted deepest first */
   30.92 -    struct
   30.93 -    {
   30.94 -        Uint32 visual;
   30.95 -        int depth;              /* number of significant bits/pixel */
   30.96 -        int bpp;                /* pixel quantum in bits */
   30.97 -    } visuals[5];               /* at most entries for 8, 15, 16, 24 */
   30.98 -    int nvisuals;
   30.99 -
  30.100 -    Uint32 vis;                 /* current visual in use */
  30.101 -    int depth;                  /* current visual depth (not bpp) */
  30.102 -    int BytesPerPixel;
  30.103 -    int currently_fullscreen, same_format, dbuffer;
  30.104 -
  30.105 -    /* Automatic mode switching support (entering/leaving fullscreen) */
  30.106 -    Uint32 switch_waiting;
  30.107 -    Uint32 switch_time;
  30.108 -
  30.109 -    /* Prevent too many XSync() calls */
  30.110 -    int blit_queued;
  30.111 -
  30.112 -    /* Colormap handling */
  30.113 -    LONG Pens;
  30.114 -    Sint32 *XPixels;            /* A list of pixels that have been allocated, the size depends on the screen format */
  30.115 -    struct ScreenBuffer *SB[2];
  30.116 -    struct RastPort *RP;
  30.117 -    short *iconcolors;          /* List of colors used by the icon */
  30.118 -};
  30.119 -
  30.120 -/* Old variable names */
  30.121 -#define local_X11		(this->hidden->local_X11)
  30.122 -#define SDL_Display		(this->hidden->Public_Display)
  30.123 -#define GFX_Display		(this->hidden->GFX_Display)
  30.124 -#define SDL_Screen		DefaultScreen(this->hidden->Public_Display)
  30.125 -
  30.126 -#define SDL_Visual		(this->hidden->vis)
  30.127 -
  30.128 -#define SDL_Root		RootWindow(SDL_Display, SDL_Screen)
  30.129 -#define WMwindow		(this->hidden->WMwindow)
  30.130 -#define FSwindow		(this->hidden->FSwindow)
  30.131 -#define SDL_Window		(this->hidden->SDL_Window)
  30.132 -#define WM_DELETE_WINDOW	(this->hidden->WM_DELETE_WINDOW)
  30.133 -#define SDL_BlankCursor		(this->hidden->BlankCursor)
  30.134 -#define SDL_windowid		(this->hidden->SDL_windowid)
  30.135 -#define SDL_Ximage		(this->hidden->Ximage)
  30.136 -#define SDL_GC			(this->hidden->gc)
  30.137 -#define swap_pixels		(this->hidden->swap_pixels)
  30.138 -#define mouse_last		(this->hidden->mouse_last)
  30.139 -#define mouse_accel		(this->hidden->mouse_accel)
  30.140 -#define mouse_relative		(this->hidden->mouse_relative)
  30.141 -#define SDL_modelist		(this->hidden->modelist)
  30.142 -#define SDL_RastPort		(this->hidden->RP)
  30.143 -#define saved_mode		(this->hidden->saved_mode)
  30.144 -#define saved_view		(this->hidden->saved_view)
  30.145 -#define currently_fullscreen	(this->hidden->currently_fullscreen)
  30.146 -#define blit_queued		(this->hidden->blit_queued)
  30.147 -#define SDL_DisplayColormap	(this->hidden->GFX_Display->ViewPort.ColorMap)
  30.148 -#define SDL_XPixels		(this->hidden->XPixels)
  30.149 -#define SDL_iconcolors		(this->hidden->iconcolors)
  30.150 -
  30.151 -/* Used to get the X cursor from a window-manager specific cursor */
  30.152 -// extern Cursor SDL_GetWMXCursor(WMcursor *cursor);
  30.153 -
  30.154 -extern int CGX_CreateWindow(_THIS, SDL_Surface * screen,
  30.155 -                            int w, int h, int bpp, Uint32 flags);
  30.156 -extern int CGX_ResizeWindow(_THIS,
  30.157 -                            SDL_Surface * screen, int w, int h, Uint32 flags);
  30.158 -
  30.159 -extern void CGX_DestroyWindow(_THIS, SDL_Surface * screen);
  30.160 -
  30.161 -extern struct Library *CyberGfxBase;
  30.162 -extern struct IntuitionBase *IntuitionBase;
  30.163 -extern struct GfxBase *GfxBase;
  30.164 -extern struct ExecBase *SysBase;
  30.165 -extern struct DosLibrary *DOSBase;
  30.166 -
  30.167 -struct private_hwdata
  30.168 -{
  30.169 -    struct BitMap *bmap;
  30.170 -    APTR lock;
  30.171 -    struct SDL_VideoDevice *videodata;
  30.172 -    APTR mask;
  30.173 -    int allocated;
  30.174 -};
  30.175 -
  30.176 -int CGX_CheckHWBlit(_THIS, SDL_Surface * src, SDL_Surface * dst);
  30.177 -int CGX_FillHWRect(_THIS, SDL_Surface * dst, SDL_Rect * dstrect,
  30.178 -                   Uint32 color);
  30.179 -int CGX_SetHWColorKey(_THIS, SDL_Surface * surface, Uint32 key);
  30.180 -#endif /* _SDL_x11video_h */
  30.181 -/* vi: set ts=4 sw=4 expandtab: */
    31.1 --- a/src/video/cybergfx/SDL_cgxwm.c	Sun Oct 29 03:39:13 2006 +0000
    31.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.3 @@ -1,69 +0,0 @@
    31.4 -/*
    31.5 -    SDL - Simple DirectMedia Layer
    31.6 -    Copyright (C) 1997-2006 Sam Lantinga
    31.7 -
    31.8 -    This library is free software; you can redistribute it and/or
    31.9 -    modify it under the terms of the GNU Lesser General Public
   31.10 -    License as published by the Free Software Foundation; either
   31.11 -    version 2.1 of the License, or (at your option) any later version.
   31.12 -
   31.13 -    This library is distributed in the hope that it will be useful,
   31.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   31.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   31.16 -    Lesser General Public License for more details.
   31.17 -
   31.18 -    You should have received a copy of the GNU Lesser General Public
   31.19 -    License along with this library; if not, write to the Free Software
   31.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   31.21 -
   31.22 -    Sam Lantinga
   31.23 -    slouken@libsdl.org
   31.24 -*/
   31.25 -#include "SDL_config.h"
   31.26 -
   31.27 -#include "SDL_version.h"
   31.28 -#include "SDL_timer.h"
   31.29 -#include "SDL_video.h"
   31.30 -#include "SDL_syswm.h"
   31.31 -#include "../../events/SDL_events_c.h"
   31.32 -#include "../SDL_pixels_c.h"
   31.33 -#include "SDL_cgxmodes_c.h"
   31.34 -#include "SDL_cgxwm_c.h"
   31.35 -
   31.36 -/* This is necessary for working properly with Enlightenment, etc. */
   31.37 -#define USE_ICON_WINDOW
   31.38 -
   31.39 -void
   31.40 -CGX_SetIcon(_THIS, SDL_Surface * icon, Uint8 * mask)
   31.41 -{
   31.42 -/* Not yet implemented */
   31.43 -}
   31.44 -
   31.45 -void
   31.46 -CGX_SetCaption(_THIS, const char *title, const char *icon)
   31.47 -{
   31.48 -    if (SDL_Window)
   31.49 -        SetWindowTitles(SDL_Window, (char *) title, NULL);
   31.50 -}
   31.51 -
   31.52 -/* Iconify the window */
   31.53 -int
   31.54 -CGX_IconifyWindow(_THIS)
   31.55 -{
   31.56 -/* Not yet implemented */
   31.57 -    return 0;
   31.58 -}
   31.59 -
   31.60 -int
   31.61 -CGX_GetWMInfo(_THIS, SDL_SysWMinfo * info)
   31.62 -{
   31.63 -    if (info->version.major <= SDL_MAJOR_VERSION) {
   31.64 -        return (1);
   31.65 -    } else {
   31.66 -        SDL_SetError("Application not compiled with SDL %d.%d\n",
   31.67 -                     SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
   31.68 -        return (-1);
   31.69 -    }
   31.70 -}
   31.71 -
   31.72 -/* vi: set ts=4 sw=4 expandtab: */
    32.1 --- a/src/video/cybergfx/SDL_cgxwm_c.h	Sun Oct 29 03:39:13 2006 +0000
    32.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.3 @@ -1,33 +0,0 @@
    32.4 -/*
    32.5 -    SDL - Simple DirectMedia Layer
    32.6 -    Copyright (C) 1997-2006 Sam Lantinga
    32.7 -
    32.8 -    This library is free software; you can redistribute it and/or
    32.9 -    modify it under the terms of the GNU Lesser General Public
   32.10 -    License as published by the Free Software Foundation; either
   32.11 -    version 2.1 of the License, or (at your option) any later version.
   32.12 -
   32.13 -    This library is distributed in the hope that it will be useful,
   32.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   32.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   32.16 -    Lesser General Public License for more details.
   32.17 -
   32.18 -    You should have received a copy of the GNU Lesser General Public
   32.19 -    License along with this library; if not, write to the Free Software
   32.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   32.21 -
   32.22 -    Sam Lantinga
   32.23 -    slouken@libsdl.org
   32.24 -*/
   32.25 -#include "SDL_config.h"
   32.26 -
   32.27 -#include "SDL_cgxvideo.h"
   32.28 -
   32.29 -/* Functions to be exported */
   32.30 -extern void CGX_SetCaption(_THIS, const char *title, const char *icon);
   32.31 -extern void CGX_SetIcon(_THIS, SDL_Surface * icon, Uint8 * mask);
   32.32 -extern int CGX_IconifyWindow(_THIS);
   32.33 -extern SDL_GrabMode CGX_GrabInputNoLock(_THIS, SDL_GrabMode mode);
   32.34 -extern SDL_GrabMode CGX_GrabInput(_THIS, SDL_GrabMode mode);
   32.35 -extern int CGX_GetWMInfo(_THIS, SDL_SysWMinfo * info);
   32.36 -/* vi: set ts=4 sw=4 expandtab: */
    33.1 --- a/test/testplatform.c	Sun Oct 29 03:39:13 2006 +0000
    33.2 +++ b/test/testplatform.c	Sun Oct 29 04:09:17 2006 +0000
    33.3 @@ -160,8 +160,6 @@
    33.4          printf("This system is running %s\n",
    33.5  #if __AIX__
    33.6                 "AIX"
    33.7 -#elif __AMIGA__
    33.8 -               "AmigaOS"
    33.9  #elif __BEOS__
   33.10                 "BeOS"
   33.11  #elif __BSDI__