Removed EPOC port from the 1.3 branch.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 15 Jun 2007 15:54:07 +0000
changeset 21269c9c49b18693
parent 2125 fab12febc0f9
child 2127 3bcc26b74e42
Removed EPOC port from the 1.3 branch.
EpocBuildFiles.zip
Makefile.in
README.Epoc
docs/html/sdlenvvars.html
include/SDL_config.h.in
src/main/epoc/SDL_main.cpp
src/thread/epoc/SDL_sysmutex.cpp
src/thread/epoc/SDL_syssem.cpp
src/thread/epoc/SDL_systhread.cpp
src/thread/epoc/SDL_systhread_c.h
src/timer/epoc/SDL_systimer.cpp
src/video/epoc/SDL_epocevents.cpp
src/video/epoc/SDL_epocevents_c.h
src/video/epoc/SDL_epocvideo.cpp
src/video/epoc/SDL_epocvideo.h
     1.1 Binary file EpocBuildFiles.zip has changed
     2.1 --- a/Makefile.in	Fri Jun 15 12:27:43 2007 +0000
     2.2 +++ b/Makefile.in	Fri Jun 15 15:54:07 2007 +0000
     2.3 @@ -38,7 +38,7 @@
     2.4  SDLMAIN_SOURCES = @SDLMAIN_SOURCES@
     2.5  SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@
     2.6  
     2.7 -DIST = acinclude.m4 autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS docs docs.html EpocBuildFiles.zip include INSTALL Makefile.dc Makefile.minimal Makefile.in README* sdl-config.in sdl.m4 sdl.pc.in SDL.qpg.in SDL.spec SDL.spec.in src test TODO VisualCE.zip VisualC.html VisualC.zip Watcom-OS2.zip Watcom-Win32.zip WhatsNew Xcode.tar.gz
     2.8 +DIST = acinclude.m4 autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS docs docs.html include INSTALL Makefile.dc Makefile.minimal Makefile.in README* sdl-config.in sdl.m4 sdl.pc.in SDL.qpg.in SDL.spec SDL.spec.in src test TODO VisualCE.zip VisualC.html VisualC.zip Watcom-OS2.zip Watcom-Win32.zip WhatsNew Xcode.tar.gz
     2.9  
    2.10  HDRS = SDL.h SDL_audio.h SDL_cdrom.h SDL_compat.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_pixels.h SDL_platform.h SDL_quit.h SDL_rwops.h SDL_stdinc.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h
    2.11  
     3.1 --- a/README.Epoc	Fri Jun 15 12:27:43 2007 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,75 +0,0 @@
     3.4 -
     3.5 -==============================================================================
     3.6 -Using the Simple DirectMedia Layer with EPOC/SymbianOS 6.0
     3.7 -==============================================================================
     3.8 -
     3.9 -==============================================================================
    3.10 -I.  Building the Simple DirectMedia Layer libraries:
    3.11 -
    3.12 -  You can get Symbian SDK from: 
    3.13 -    http://www.symbian.com.
    3.14 - 
    3.15 -  First create "Epoc" directory under SDL main directory and unpack 
    3.16 -  EpocBuildFiles.zip in it.
    3.17 -   
    3.18 -  To build the librarys goto "epoc" directory and type:
    3.19 -    bldmake bldfiles
    3.20 -    abld makefile vc6 (for creating Microsoft Visual C++ makefiles)
    3.21 -    abld build wins udeb (building for wins emulator)
    3.22 -    abld build armi urel (building for real device)
    3.23 -
    3.24 -==============================================================================
    3.25 -II. Building the Simple DirectMedia Layer programs:
    3.26 -
    3.27 -  Building SDL test programs is easy once you have built the libraries:
    3.28 -    abld test build wins udeb
    3.29 -    abld test build armi urel
    3.30 -
    3.31 -  Supported real screen resolutions
    3.32 -    320 x 200 x  8 bit
    3.33 -    320 x 200 x 12 bit
    3.34 -    640 x 200 x  8 bit
    3.35 -    640 x 200 x 12 bit
    3.36 -  Supported "emulated" screen resolutions 
    3.37 -    640 x 400 x  8 bit
    3.38 -    640 x 400 x 12 bit
    3.39 -    640 x 480 x  8 bit
    3.40 -    640 x 480 x 12 bit
    3.41 -  "Emulated" resolutions are implemented by by shrinking the screen vertically 
    3.42 -  i.e. only every second scanline is drawn. This is mainly ment to be used for 
    3.43 -  testing quick ports of programs. Using faked resolutions is a waste of memory 
    3.44 -  and cpu power!
    3.45 -
    3.46 -==============================================================================
    3.47 -III. Running test programs
    3.48 -
    3.49 -  Copy executable to the device and run it from the File manager.   The Esc 
    3.50 -  key quits demo programs. In Crystal, Exe programs do not appear in task list 
    3.51 -  nor in Extras :-(. Test programs are tested in Nokia 9210 Communicator.
    3.52 -
    3.53 -  Special keys used in SDL:
    3.54 -    The Caps lock key enables or disables the virtual cursor. 
    3.55 -    Function keys are mapped as follows: 
    3.56 -    F1=chr+q, F2=chr+w,..., F8=chr+i, 
    3.57 -    F9=chr+a,..., F12=chr+d.
    3.58 -
    3.59 -==============================================================================
    3.60 -IV.  Enjoy! :)
    3.61 -
    3.62 -  If you have a project you'd like me to know about, or want to ask questions,
    3.63 -  go ahead and join the SDL developer's mailing list by sending e-mail to:
    3.64 -
    3.65 -	sdl-request@libsdl.org
    3.66 -
    3.67 -  and put "subscribe" into the subject of the message. Or alternatively you
    3.68 -  can use the web interface:
    3.69 -
    3.70 -	http://www.libsdl.org/mailman/listinfo/sdl
    3.71 -
    3.72 -  You can find more info about Epoc version of SDL from Hannu Viitala's 
    3.73 -  homepage
    3.74 -    http://www.mbnet.fi/~haviital
    3.75 -  
    3.76 -==============================================================================
    3.77 -
    3.78 -
     4.1 --- a/docs/html/sdlenvvars.html	Fri Jun 15 12:27:43 2007 +0000
     4.2 +++ b/docs/html/sdlenvvars.html	Fri Jun 15 15:54:07 2007 +0000
     4.3 @@ -436,21 +436,6 @@
     4.4  VALIGN="TOP"
     4.5  ><TT
     4.6  CLASS="LITERAL"
     4.7 ->epoc</TT
     4.8 -></TD
     4.9 -><TD
    4.10 -ALIGN="LEFT"
    4.11 -VALIGN="TOP"
    4.12 -><P
    4.13 ->(Epoc)</P
    4.14 -></TD
    4.15 -></TR
    4.16 -><TR
    4.17 -><TD
    4.18 -ALIGN="LEFT"
    4.19 -VALIGN="TOP"
    4.20 -><TT
    4.21 -CLASS="LITERAL"
    4.22  >dummy</TT
    4.23  ></TD
    4.24  ><TD
     5.1 --- a/include/SDL_config.h.in	Fri Jun 15 12:27:43 2007 +0000
     5.2 +++ b/include/SDL_config.h.in	Fri Jun 15 15:54:07 2007 +0000
     5.3 @@ -221,7 +221,6 @@
     5.4  /* Enable various threading systems */
     5.5  #undef SDL_THREAD_BEOS
     5.6  #undef SDL_THREAD_DC
     5.7 -#undef SDL_THREAD_EPOC
     5.8  #undef SDL_THREAD_OS2
     5.9  #undef SDL_THREAD_PTH
    5.10  #undef SDL_THREAD_PTHREAD
    5.11 @@ -234,7 +233,6 @@
    5.12  #undef SDL_TIMER_BEOS
    5.13  #undef SDL_TIMER_DC
    5.14  #undef SDL_TIMER_DUMMY
    5.15 -#undef SDL_TIMER_EPOC
    5.16  #undef SDL_TIMER_MINT
    5.17  #undef SDL_TIMER_OS2
    5.18  #undef SDL_TIMER_RISCOS
    5.19 @@ -248,7 +246,6 @@
    5.20  #undef SDL_VIDEO_DRIVER_DC
    5.21  #undef SDL_VIDEO_DRIVER_DIRECTFB
    5.22  #undef SDL_VIDEO_DRIVER_DUMMY
    5.23 -#undef SDL_VIDEO_DRIVER_EPOC
    5.24  #undef SDL_VIDEO_DRIVER_FBCON
    5.25  #undef SDL_VIDEO_DRIVER_GAPI
    5.26  #undef SDL_VIDEO_DRIVER_GEM
     6.1 --- a/src/main/epoc/SDL_main.cpp	Fri Jun 15 12:27:43 2007 +0000
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,129 +0,0 @@
     6.4 -/*
     6.5 -    SDL - Simple DirectMedia Layer
     6.6 -    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga
     6.7 -
     6.8 -    This library is free software; you can redistribute it and/or
     6.9 -    modify it under the terms of the GNU Library General Public
    6.10 -    License as published by the Free Software Foundation; either
    6.11 -    version 2 of the License, or (at your option) any later version.
    6.12 -
    6.13 -    This library is distributed in the hope that it will be useful,
    6.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    6.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    6.16 -    Library General Public License for more details.
    6.17 -
    6.18 -    You should have received a copy of the GNU Library General Public
    6.19 -    License along with this library; if not, write to the Free
    6.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    6.21 -
    6.22 -    Sam Lantinga
    6.23 -    slouken@libsdl.org
    6.24 -*/
    6.25 -
    6.26 -/*
    6.27 -    SDL_main.cpp
    6.28 -    The Epoc executable startup functions 
    6.29 -
    6.30 -    Epoc version by Hannu Viitala (hannu.j.viitala@mbnet.fi)
    6.31 -*/
    6.32 -
    6.33 -#include <e32std.h>
    6.34 -#include <e32def.h>
    6.35 -#include <e32svr.h>
    6.36 -#include <e32base.h>
    6.37 -#include <estlib.h>
    6.38 -#include <stdlib.h>
    6.39 -#include <stdio.h>
    6.40 -#include <w32std.h>
    6.41 -#include <apgtask.h>
    6.42 -
    6.43 -#include "SDL_error.h"
    6.44 -
    6.45 -#ifndef EXPORT_C
    6.46 -# ifdef __VC32__
    6.47 -#  define IMPORT_C __declspec(dllexport)
    6.48 -#  define EXPORT_C __declspec(dllexport)
    6.49 -# endif
    6.50 -# ifdef __GCC32__
    6.51 -#  define IMPORT_C
    6.52 -#  define EXPORT_C __declspec(dllexport)
    6.53 -# endif
    6.54 -#endif
    6.55 -
    6.56 -#if defined(__WINS__)
    6.57 -#include <estw32.h>
    6.58 -IMPORT_C void RegisterWsExe(const TDesC &aName);
    6.59 -#endif
    6.60 -
    6.61 -/* The prototype for the application's main() function */
    6.62 -#define main	SDL_main
    6.63 -extern "C" int main (int argc, char *argv[], char *envp[]);
    6.64 -extern "C" void exit (int ret);
    6.65 -
    6.66 -
    6.67 -/* Epoc main function */
    6.68 -
    6.69 -GLDEF_C TInt E32Main() 
    6.70 -    {
    6.71 -    /*  Get the clean-up stack */
    6.72 -	CTrapCleanup* cleanup = CTrapCleanup::New();
    6.73 -
    6.74 -    #if defined(__WINS__)
    6.75 -    /* arrange for access to Win32 stdin/stdout/stderr */
    6.76 -   	RWin32Stream::StartServer();	
    6.77 -    #endif
    6.78 -
    6.79 -    /* Arrange for multi-threaded operation */
    6.80 -	SpawnPosixServerThread();	
    6.81 -
    6.82 -    /* Get args and environment */
    6.83 -	int argc=0;
    6.84 -	char** argv=0;
    6.85 -	char** envp=0;
    6.86 -	__crt0(argc,argv,envp);	
    6.87 -
    6.88 -    #if defined(__WINS__)
    6.89 -	/* Cause the graphical Window Server to come into existence */
    6.90 -	RSemaphore sem;
    6.91 -	sem.CreateGlobal(_L("WsExeSem"),0);
    6.92 -	RegisterWsExe(sem.FullName());
    6.93 -    #endif
    6.94 -
    6.95 -
    6.96 -    /* Start the application! */
    6.97 -
    6.98 -    /* Create stdlib */
    6.99 -    _REENT;
   6.100 -
   6.101 -    /* Set process and thread priority */
   6.102 -    RThread currentThread;
   6.103 -
   6.104 -    currentThread.Rename(_L("SdlProgram"));
   6.105 -    currentThread.SetProcessPriority(EPriorityLow);
   6.106 -    currentThread.SetPriority(EPriorityMuchLess);
   6.107 -
   6.108 -    /* Call stdlib main */
   6.109 -    int ret = main(argc, argv, envp); /* !! process exits here if there is "exit()" in main! */	
   6.110 -
   6.111 -    /* Call exit */
   6.112 -    exit(ret); /* !! process exits here! */			
   6.113 -
   6.114 -    /* Free resources and return */
   6.115 -    CloseSTDLIB();
   6.116 -   	delete cleanup;									
   6.117 -    return(KErrNone);
   6.118 -    }
   6.119 -
   6.120 -/* Epoc dll entry point */
   6.121 -#if defined(__WINS__)
   6.122 -GLDEF_C TInt E32Dll(TDllReason)
   6.123 -	{
   6.124 -	return(KErrNone);
   6.125 -	}
   6.126 -
   6.127 -EXPORT_C TInt WinsMain(TAny *)
   6.128 -	{
   6.129 -    E32Main();
   6.130 -	return KErrNone;
   6.131 -	}
   6.132 -#endif
     7.1 --- a/src/thread/epoc/SDL_sysmutex.cpp	Fri Jun 15 12:27:43 2007 +0000
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,105 +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 -#include "SDL_config.h"
    7.26 -
    7.27 -/*
    7.28 -    SDL_sysmutex.cpp
    7.29 -
    7.30 -    Epoc version by Markus Mertama (w@iki.fi)
    7.31 -*/
    7.32 -
    7.33 -
    7.34 -/* Mutex functions using the Win32 API */
    7.35 -
    7.36 -#include<e32std.h>
    7.37 -
    7.38 -#include "SDL_error.h"
    7.39 -#include "SDL_mutex.h"
    7.40 -
    7.41 -
    7.42 -
    7.43 -struct SDL_mutex
    7.44 -    {
    7.45 -    TInt handle;
    7.46 -    };
    7.47 -
    7.48 -extern TInt CreateUnique(TInt (*aFunc)(const TDesC& aName, TAny*, TAny*), TAny*, TAny*);
    7.49 -
    7.50 -TInt NewMutex(const TDesC& aName, TAny* aPtr1, TAny*)
    7.51 -    {
    7.52 -    return ((RMutex*)aPtr1)->CreateGlobal(aName);
    7.53 -    }
    7.54 -
    7.55 -/* Create a mutex */
    7.56 -SDL_mutex *SDL_CreateMutex(void)
    7.57 -{
    7.58 -    RMutex rmutex;
    7.59 -
    7.60 -    TInt status = CreateUnique(NewMutex, &rmutex, NULL);
    7.61 -	if(status != KErrNone)
    7.62 -	    {
    7.63 -			SDL_SetError("Couldn't create mutex");
    7.64 -		}
    7.65 -    SDL_mutex* mutex = new /*(ELeave)*/ SDL_mutex;
    7.66 -    mutex->handle = rmutex.Handle();
    7.67 -	return(mutex);
    7.68 -}
    7.69 -
    7.70 -/* Free the mutex */
    7.71 -void SDL_DestroyMutex(SDL_mutex *mutex)
    7.72 -{
    7.73 -	if ( mutex ) 
    7.74 -	{
    7.75 -    RMutex rmutex;
    7.76 -    rmutex.SetHandle(mutex->handle);
    7.77 -	rmutex.Signal();
    7.78 -	rmutex.Close();
    7.79 -	delete(mutex);
    7.80 -    mutex = NULL;
    7.81 -	}
    7.82 -}
    7.83 -
    7.84 -/* Lock the mutex */
    7.85 -int SDL_mutexP(SDL_mutex *mutex)
    7.86 -{
    7.87 -	if ( mutex == NULL ) {
    7.88 -		SDL_SetError("Passed a NULL mutex");
    7.89 -		return -1;
    7.90 -	}
    7.91 -    RMutex rmutex;
    7.92 -    rmutex.SetHandle(mutex->handle);
    7.93 -	rmutex.Wait(); 
    7.94 -	return(0);
    7.95 -}
    7.96 -
    7.97 -/* Unlock the mutex */
    7.98 -int SDL_mutexV(SDL_mutex *mutex)
    7.99 -{
   7.100 -	if ( mutex == NULL ) {
   7.101 -		SDL_SetError("Passed a NULL mutex");
   7.102 -		return -1;
   7.103 -	}
   7.104 -	RMutex rmutex;
   7.105 -    rmutex.SetHandle(mutex->handle);
   7.106 -	rmutex.Signal();
   7.107 -	return(0);
   7.108 -}
     8.1 --- a/src/thread/epoc/SDL_syssem.cpp	Fri Jun 15 12:27:43 2007 +0000
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,193 +0,0 @@
     8.4 -/*
     8.5 -    SDL - Simple DirectMedia Layer
     8.6 -    Copyright (C) 1997-2006 Sam Lantinga
     8.7 -
     8.8 -    This library is free software; you can redistribute it and/or
     8.9 -    modify it under the terms of the GNU Lesser General Public
    8.10 -    License as published by the Free Software Foundation; either
    8.11 -    version 2.1 of the License, or (at your option) any later version.
    8.12 -
    8.13 -    This library is distributed in the hope that it will be useful,
    8.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    8.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    8.16 -    Lesser General Public License for more details.
    8.17 -
    8.18 -    You should have received a copy of the GNU Lesser General Public
    8.19 -    License along with this library; if not, write to the Free Software
    8.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    8.21 -
    8.22 -    Sam Lantinga
    8.23 -    slouken@libsdl.org
    8.24 -*/
    8.25 -#include "SDL_config.h"
    8.26 -
    8.27 -/*
    8.28 -    SDL_syssem.cpp
    8.29 -
    8.30 -    Epoc version by Markus Mertama  (w@iki.fi)
    8.31 -*/
    8.32 -
    8.33 -/* Semaphore functions using the Win32 API */
    8.34 -
    8.35 -#include <e32std.h>
    8.36 -
    8.37 -#include "SDL_error.h"
    8.38 -#include "SDL_thread.h"
    8.39 -
    8.40 -
    8.41 -#define SDL_MUTEX_TIMEOUT -2
    8.42 -
    8.43 -struct SDL_semaphore
    8.44 - {
    8.45 - TInt handle;
    8.46 - TInt count;
    8.47 - };
    8.48 -
    8.49 -extern TInt CreateUnique(TInt (*aFunc)(const TDesC& aName, TAny*, TAny*), TAny*, TAny*);
    8.50 -extern TInt NewThread(const TDesC& aName, TAny* aPtr1, TAny* aPtr2);
    8.51 -
    8.52 -TInt NewSema(const TDesC& aName, TAny* aPtr1, TAny* aPtr2) 
    8.53 -    {
    8.54 -    TInt value = *((TInt*) aPtr2);
    8.55 -    return ((RSemaphore*)aPtr1)->CreateGlobal(aName, value);
    8.56 -    }
    8.57 -
    8.58 -/* Create a semaphore */
    8.59 -SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
    8.60 -{
    8.61 -   RSemaphore s;
    8.62 -   TInt status = CreateUnique(NewSema, &s, &initial_value);
    8.63 -   if(status != KErrNone)
    8.64 -	 {
    8.65 -			SDL_SetError("Couldn't create semaphore");
    8.66 -	}
    8.67 -    SDL_semaphore* sem = new /*(ELeave)*/ SDL_semaphore;  
    8.68 -    sem->handle = s.Handle();
    8.69 -	sem->count = initial_value;
    8.70 -	return(sem);
    8.71 -}
    8.72 -
    8.73 -/* Free the semaphore */
    8.74 -void SDL_DestroySemaphore(SDL_sem *sem)
    8.75 -{
    8.76 -	if ( sem ) 
    8.77 -	{
    8.78 -    RSemaphore sema;
    8.79 -    sema.SetHandle(sem->handle);
    8.80 -	sema.Signal(sema.Count());
    8.81 -    sema.Close();
    8.82 -    delete sem;
    8.83 -	sem = NULL;
    8.84 -	}
    8.85 -}
    8.86 -
    8.87 -
    8.88 -  struct TInfo
    8.89 -    {
    8.90 -        TInfo(TInt aTime, TInt aHandle) : 
    8.91 -        iTime(aTime), iHandle(aHandle), iVal(0) {}
    8.92 -        TInt iTime;
    8.93 -        TInt iHandle;
    8.94 -        TInt iVal; 
    8.95 -    };
    8.96 -
    8.97 -TBool ThreadRun(TAny* aInfo)
    8.98 -    {
    8.99 -        TInfo* info = STATIC_CAST(TInfo*, aInfo);
   8.100 -        User::After(info->iTime);
   8.101 -        RSemaphore sema;
   8.102 -        sema.SetHandle(info->iHandle);
   8.103 -        sema.Signal();
   8.104 -        info->iVal = SDL_MUTEX_TIMEOUT;
   8.105 -        return 0;
   8.106 -    }
   8.107 -    
   8.108 -  
   8.109 -    
   8.110 -    
   8.111 -void _WaitAll(SDL_sem *sem)
   8.112 -    {
   8.113 -       //since SemTryWait may changed the counter.
   8.114 -       //this may not be atomic, but hopes it works.
   8.115 -    RSemaphore sema;
   8.116 -    sema.SetHandle(sem->handle);
   8.117 -    sema.Wait();
   8.118 -    while(sem->count < 0)
   8.119 -        {
   8.120 -        sema.Wait();
   8.121 -        }    
   8.122 -    }
   8.123 -
   8.124 -int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
   8.125 -{
   8.126 -	if ( ! sem ) {
   8.127 -		SDL_SetError("Passed a NULL sem");
   8.128 -		return -1;
   8.129 -	}
   8.130 -
   8.131 -	if ( timeout == SDL_MUTEX_MAXWAIT )
   8.132 -	    {
   8.133 -	    _WaitAll(sem);
   8.134 -		return SDL_MUTEX_MAXWAIT;
   8.135 -	    } 
   8.136 -	
   8.137 -	
   8.138 -	RThread thread;
   8.139 -	
   8.140 -	TInfo* info = new (ELeave)TInfo(timeout, sem->handle);
   8.141 -	
   8.142 -    TInt status = CreateUnique(NewThread, &thread, info);
   8.143 -  
   8.144 -	if(status != KErrNone)
   8.145 -	    return status;
   8.146 -	
   8.147 -	thread.Resume();
   8.148 -	
   8.149 -	_WaitAll(sem);
   8.150 -	
   8.151 -	if(thread.ExitType() == EExitPending)
   8.152 -	    {
   8.153 -	        thread.Kill(SDL_MUTEX_TIMEOUT);
   8.154 -	    }
   8.155 -	
   8.156 -	thread.Close();
   8.157 -	
   8.158 -	return info->iVal;
   8.159 -}
   8.160 -
   8.161 -int SDL_SemTryWait(SDL_sem *sem)
   8.162 -{
   8.163 -    if(sem->count > 0)
   8.164 -        {
   8.165 -        sem->count--;
   8.166 -        }
   8.167 -    return SDL_MUTEX_TIMEOUT;
   8.168 -}
   8.169 -
   8.170 -int SDL_SemWait(SDL_sem *sem)
   8.171 -{
   8.172 -	return SDL_SemWaitTimeout(sem, SDL_MUTEX_MAXWAIT);
   8.173 -}
   8.174 -
   8.175 -/* Returns the current count of the semaphore */
   8.176 -Uint32 SDL_SemValue(SDL_sem *sem)
   8.177 -{
   8.178 -	if ( ! sem ) {
   8.179 -		SDL_SetError("Passed a NULL sem");
   8.180 -		return 0;
   8.181 -	}
   8.182 -	return sem->count;
   8.183 -}
   8.184 -
   8.185 -int SDL_SemPost(SDL_sem *sem)
   8.186 -{
   8.187 -	if ( ! sem ) {
   8.188 -		SDL_SetError("Passed a NULL sem");
   8.189 -		return -1;
   8.190 -	}
   8.191 -	sem->count++;
   8.192 -    RSemaphore sema;
   8.193 -    sema.SetHandle(sem->handle);
   8.194 -	sema.Signal();
   8.195 -	return 0;
   8.196 -}
     9.1 --- a/src/thread/epoc/SDL_systhread.cpp	Fri Jun 15 12:27:43 2007 +0000
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,124 +0,0 @@
     9.4 -/*
     9.5 -    SDL - Simple DirectMedia Layer
     9.6 -    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  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 Library General Public
    9.10 -    License as published by the Free Software Foundation; either
    9.11 -    version 2 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 -    Library General Public License for more details.
    9.17 -
    9.18 -    You should have received a copy of the GNU Library General Public
    9.19 -    License along with this library; if not, write to the Free
    9.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    9.21 -
    9.22 -    Sam Lantinga
    9.23 -    slouken@libsdl.org
    9.24 -*/
    9.25 -#include "SDL_config.h"
    9.26 -
    9.27 -/*
    9.28 -    SDL_systhread.cpp
    9.29 -    Epoc thread management routines for SDL
    9.30 -
    9.31 -    Epoc version by Markus Mertama  (w@iki.fi)
    9.32 -*/
    9.33 -
    9.34 -
    9.35 -extern "C" {
    9.36 -#undef NULL
    9.37 -#include "SDL_error.h"
    9.38 -#include "SDL_thread.h"
    9.39 -#include "../SDL_systhread.h"
    9.40 -    };
    9.41 -
    9.42 -#include <e32std.h>
    9.43 -
    9.44 -
    9.45 -static int object_count;
    9.46 -
    9.47 -int RunThread(TAny* data)
    9.48 -{
    9.49 -	SDL_RunThread(data);
    9.50 -	return(0);
    9.51 -}
    9.52 -
    9.53 -
    9.54 -TInt NewThread(const TDesC& aName, TAny* aPtr1, TAny* aPtr2)
    9.55 -    {
    9.56 -    return ((RThread*)(aPtr1))->Create(aName,
    9.57 -            RunThread,
    9.58 -            KDefaultStackSize,
    9.59 -            NULL,
    9.60 -            aPtr2);
    9.61 -    }
    9.62 -
    9.63 -int CreateUnique(TInt (*aFunc)(const TDesC& aName, TAny*, TAny*), TAny* aPtr1, TAny* aPtr2)
    9.64 -    {
    9.65 -    TBuf<16> name;
    9.66 -    TInt status = KErrNone;
    9.67 -    do
    9.68 -        {
    9.69 -        object_count++;
    9.70 -        name.Format(_L("SDL_%x"), object_count);
    9.71 -        status = aFunc(name, aPtr1, aPtr2);
    9.72 -        }
    9.73 -        while(status == KErrAlreadyExists);
    9.74 -    return status;
    9.75 -    }
    9.76 -
    9.77 -
    9.78 -int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
    9.79 -{
    9.80 -    RThread rthread;
    9.81 -   
    9.82 -    TInt status = CreateUnique(NewThread, &rthread, args);
    9.83 -    if (status != KErrNone) 
    9.84 -    {
    9.85 -        delete(((RThread*)(thread->handle)));
    9.86 -        thread->handle = NULL;
    9.87 -		SDL_SetError("Not enough resources to create thread");
    9.88 -		return(-1);
    9.89 -	}
    9.90 -	rthread.Resume();
    9.91 -    thread->handle = rthread.Handle();
    9.92 -	return(0);
    9.93 -}
    9.94 -
    9.95 -void SDL_SYS_SetupThread(void)
    9.96 -{
    9.97 -	return;
    9.98 -}
    9.99 -
   9.100 -Uint32 SDL_ThreadID(void)
   9.101 -{
   9.102 -    RThread current;
   9.103 -    TThreadId id = current.Id();
   9.104 -	return id;
   9.105 -}
   9.106 -
   9.107 -void SDL_SYS_WaitThread(SDL_Thread *thread)
   9.108 -{
   9.109 -    RUndertaker taker;
   9.110 -    taker.Create();
   9.111 -    TRequestStatus status;
   9.112 -    taker.Logon(status, thread->handle);
   9.113 -    User::WaitForRequest(status);
   9.114 -    taker.Close();
   9.115 -}
   9.116 -
   9.117 -/* WARNING: This function is really a last resort.
   9.118 - * Threads should be signaled and then exit by themselves.
   9.119 - * TerminateThread() doesn't perform stack and DLL cleanup.
   9.120 - */
   9.121 -void SDL_SYS_KillThread(SDL_Thread *thread)
   9.122 -{
   9.123 -    RThread rthread;
   9.124 -    rthread.SetHandle(thread->handle);
   9.125 -	rthread.Kill(0);
   9.126 -	rthread.Close();
   9.127 -}
    10.1 --- a/src/thread/epoc/SDL_systhread_c.h	Fri Jun 15 12:27:43 2007 +0000
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,31 +0,0 @@
    10.4 -/*
    10.5 -    SDL - Simple DirectMedia Layer
    10.6 -    Copyright (C) 1997-2004 Sam Lantinga
    10.7 -
    10.8 -    This library is free software; you can redistribute it and/or
    10.9 -    modify it under the terms of the GNU Library General Public
   10.10 -    License as published by the Free Software Foundation; either
   10.11 -    version 2 of the License, or (at your option) any later version.
   10.12 -
   10.13 -    This library is distributed in the hope that it will be useful,
   10.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   10.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   10.16 -    Library General Public License for more details.
   10.17 -
   10.18 -    You should have received a copy of the GNU Library General Public
   10.19 -    License along with this library; if not, write to the Free
   10.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   10.21 -
   10.22 -    Sam Lantinga
   10.23 -    slouken@libsdl.org
   10.24 -*/
   10.25 -#include "SDL_config.h"
   10.26 -
   10.27 -/*
   10.28 -    SDL_systhread_c.h
   10.29 -
   10.30 -    Epoc version by Markus Mertama (w@iki.fi)
   10.31 -*/
   10.32 -
   10.33 -typedef int SYS_ThreadHandle;
   10.34 -/* vi: set ts=4 sw=4 expandtab: */
    11.1 --- a/src/timer/epoc/SDL_systimer.cpp	Fri Jun 15 12:27:43 2007 +0000
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,116 +0,0 @@
    11.4 -/*
    11.5 -    SDL - Simple DirectMedia Layer
    11.6 -    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  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 Library General Public
   11.10 -    License as published by the Free Software Foundation; either
   11.11 -    version 2 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 -    Library General Public License for more details.
   11.17 -
   11.18 -    You should have received a copy of the GNU Library General Public
   11.19 -    License along with this library; if not, write to the Free
   11.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   11.21 -
   11.22 -    Sam Lantinga
   11.23 -    slouken@libsdl.org
   11.24 -*/
   11.25 -#include "SDL_config.h"
   11.26 -
   11.27 -#ifdef SDL_TIMER_EPOC
   11.28 -
   11.29 -/*
   11.30 -    SDL_systimer.cpp
   11.31 -
   11.32 -    Epoc version by Hannu Viitala (hannu.j.viitala@mbnet.fi)
   11.33 -*/
   11.34 -
   11.35 -#include <e32std.h>
   11.36 -#include <e32hal.h>
   11.37 -
   11.38 -extern "C" {
   11.39 -#include "SDL_error.h"
   11.40 -#include "SDL_thread.h"
   11.41 -#include "SDL_timer.h"
   11.42 -#include "../SDL_timer_c.h"
   11.43 -
   11.44 -static TUint start = 0;
   11.45 -static TInt tickPeriodMilliSeconds;
   11.46 -
   11.47 -
   11.48 -void SDL_StartTicks(void)
   11.49 -{
   11.50 -	/* Set first ticks value */
   11.51 -    start = User::TickCount();
   11.52 -
   11.53 -    TTimeIntervalMicroSeconds32 period;
   11.54 -	TInt tmp = UserHal::TickPeriod(period);
   11.55 -    tickPeriodMilliSeconds = period.Int() / 1000;
   11.56 -}
   11.57 -
   11.58 -Uint32 SDL_GetTicks(void)
   11.59 -{
   11.60 -    TUint deltaTics = User::TickCount() - start;
   11.61 -	return(deltaTics * tickPeriodMilliSeconds); 
   11.62 -}
   11.63 -
   11.64 -void SDL_Delay(Uint32 ms)
   11.65 -{
   11.66 -     
   11.67 -    User::After(TTimeIntervalMicroSeconds32(ms*1000));
   11.68 -}
   11.69 -
   11.70 -/* Data to handle a single periodic alarm */
   11.71 -static int timer_alive = 0;
   11.72 -static SDL_Thread *timer = NULL;
   11.73 -
   11.74 -static int RunTimer(void *unused)
   11.75 -{
   11.76 -	Uint32 ms;
   11.77 -
   11.78 -	while ( timer_alive ) {
   11.79 -		if ( SDL_timer_running ) {
   11.80 -			SDL_ThreadedTimerCheck();
   11.81 -		}
   11.82 -		SDL_Delay(10);
   11.83 -	}
   11.84 -	return(0);
   11.85 -}
   11.86 -
   11.87 -/* This is only called if the event thread is not running */
   11.88 -int SDL_SYS_TimerInit(void)
   11.89 -{
   11.90 -	timer_alive = 1;
   11.91 -	timer = SDL_CreateThread(RunTimer, NULL);
   11.92 -	if ( timer == NULL )
   11.93 -		return(-1);
   11.94 -	return(SDL_SetTimerThreaded(1));
   11.95 -}
   11.96 -
   11.97 -void SDL_SYS_TimerQuit(void)
   11.98 -{
   11.99 -	timer_alive = 0;
  11.100 -	if ( timer ) {
  11.101 -		SDL_WaitThread(timer, NULL);
  11.102 -		timer = NULL;
  11.103 -	}
  11.104 -}
  11.105 -
  11.106 -int SDL_SYS_StartTimer(void)
  11.107 -{
  11.108 -	SDL_SetError("Internal logic error: Epoc uses threaded timer");
  11.109 -	return(-1);
  11.110 -}
  11.111 -
  11.112 -void SDL_SYS_StopTimer(void)
  11.113 -{
  11.114 -	return;
  11.115 -}
  11.116 -
  11.117 -}; // extern "C"
  11.118 -
  11.119 -#endif /* SDL_TIMER_EPOC */
    12.1 --- a/src/video/epoc/SDL_epocevents.cpp	Fri Jun 15 12:27:43 2007 +0000
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,419 +0,0 @@
    12.4 -/*
    12.5 -    SDL - Simple DirectMedia Layer
    12.6 -    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  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 Library General Public
   12.10 -    License as published by the Free Software Foundation; either
   12.11 -    version 2 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 -    Library General Public License for more details.
   12.17 -
   12.18 -    You should have received a copy of the GNU Library General Public
   12.19 -    License along with this library; if not, write to the Free
   12.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   12.21 -
   12.22 -    Sam Lantinga
   12.23 -    slouken@libsdl.org
   12.24 -*/
   12.25 -#include "SDL_config.h"
   12.26 -
   12.27 -/*
   12.28 -    SDL_epocevents.cpp
   12.29 -    Handle the event stream, converting Epoc events into SDL events
   12.30 -
   12.31 -    Epoc version by Hannu Viitala (hannu.j.viitala@mbnet.fi)
   12.32 -*/
   12.33 -
   12.34 -
   12.35 -#include <stdio.h>
   12.36 -#undef NULL
   12.37 -
   12.38 -extern "C" {
   12.39 -#include "SDL_error.h"
   12.40 -#include "SDL_video.h"
   12.41 -#include "SDL_keysym.h"
   12.42 -#include "SDL_keyboard.h"
   12.43 -#include "SDL_timer.h"
   12.44 -#include "../../events/SDL_events_c.h"
   12.45 -}; /* extern "C" */
   12.46 -
   12.47 -#include "SDL_epocvideo.h"
   12.48 -#include "SDL_epocevents_c.h"
   12.49 -
   12.50 -#include <hal.h>
   12.51 -
   12.52 -extern "C" {
   12.53 -/* The translation tables from a console scancode to a SDL keysym */
   12.54 -static SDLKey keymap[MAX_SCANCODE];
   12.55 -static SDL_keysym *TranslateKey(int scancode, SDL_keysym *keysym);
   12.56 -}; /* extern "C" */
   12.57 -
   12.58 -TBool isCursorVisible = ETrue;
   12.59 -
   12.60 -int EPOC_HandleWsEvent(_THIS, const TWsEvent& aWsEvent)
   12.61 -{
   12.62 -    int posted = 0;
   12.63 -    SDL_keysym keysym;
   12.64 -
   12.65 -
   12.66 -    switch (aWsEvent.Type()) {
   12.67 -    
   12.68 -    case EEventPointer: /* Mouse pointer events */
   12.69 -    {
   12.70 -        const TPointerEvent* pointerEvent = aWsEvent.Pointer();
   12.71 -        TPoint mousePos = pointerEvent->iPosition;
   12.72 -
   12.73 -        //SDL_TRACE1("SDL: EPOC_HandleWsEvent, pointerEvent->iType=%d", pointerEvent->iType); //!!
   12.74 -
   12.75 -        if (Private->EPOC_ShrinkedHeight) {
   12.76 -            mousePos.iY <<= 1; /* Scale y coordinate to shrinked screen height */
   12.77 -        }
   12.78 -		posted += SDL_PrivateMouseMotion(0, 0, mousePos.iX, mousePos.iY); /* Absolute position on screen */
   12.79 -        if (pointerEvent->iType==TPointerEvent::EButton1Down) {
   12.80 -            posted += SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_LEFT, 0, 0);
   12.81 -        }
   12.82 -        else if (pointerEvent->iType==TPointerEvent::EButton1Up) {
   12.83 -			posted += SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_LEFT, 0, 0);
   12.84 -        }
   12.85 -        else if (pointerEvent->iType==TPointerEvent::EButton2Down) {
   12.86 -            posted += SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_RIGHT, 0, 0);
   12.87 -        }
   12.88 -        else if (pointerEvent->iType==TPointerEvent::EButton2Up) {
   12.89 -			posted += SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_RIGHT, 0, 0);
   12.90 -        }
   12.91 -	    //!!posted += SDL_PrivateKeyboard(SDL_PRESSED, TranslateKey(aWsEvent.Key()->iScanCode, &keysym));
   12.92 -        break;
   12.93 -    }
   12.94 -    
   12.95 -    case EEventKeyDown: /* Key events */
   12.96 -    {
   12.97 -       (void*)TranslateKey(aWsEvent.Key()->iScanCode, &keysym);
   12.98 -        
   12.99 -        /* Special handling */
  12.100 -        switch((int)keysym.sym) {
  12.101 -        case SDLK_CAPSLOCK:
  12.102 -            if (!isCursorVisible) {
  12.103 -                /* Enable virtual cursor */
  12.104 -	            HAL::Set(HAL::EMouseState, HAL::EMouseState_Visible);
  12.105 -            }
  12.106 -            else {
  12.107 -                /* Disable virtual cursor */
  12.108 -                HAL::Set(HAL::EMouseState, HAL::EMouseState_Invisible);
  12.109 -            }
  12.110 -            isCursorVisible = !isCursorVisible;
  12.111 -            break;
  12.112 -        }
  12.113 -        
  12.114 -	    posted += SDL_PrivateKeyboard(SDL_PRESSED, &keysym);
  12.115 -        break;
  12.116 -	} 
  12.117 -
  12.118 -    case EEventKeyUp: /* Key events */
  12.119 -    {
  12.120 -	    posted += SDL_PrivateKeyboard(SDL_RELEASED, TranslateKey(aWsEvent.Key()->iScanCode, &keysym));
  12.121 -        break;
  12.122 -	} 
  12.123 -    
  12.124 -    case EEventFocusGained: /* SDL window got focus */
  12.125 -    {
  12.126 -        //Private->EPOC_IsWindowFocused = ETrue;
  12.127 -        /* Draw window background and screen buffer */
  12.128 -        RedrawWindowL(_this);  
  12.129 -        break;
  12.130 -    }
  12.131 -
  12.132 -    case EEventFocusLost: /* SDL window lost focus */
  12.133 -    {
  12.134 -        //Private->EPOC_IsWindowFocused = EFalse;
  12.135 -
  12.136 -        // Wait and eat events until focus is gained again
  12.137 -        /*
  12.138 -	    while (ETrue) {
  12.139 -            Private->EPOC_WsSession.EventReady(&Private->EPOC_WsEventStatus);
  12.140 -            User::WaitForRequest(Private->EPOC_WsEventStatus);
  12.141 -		    Private->EPOC_WsSession.GetEvent(Private->EPOC_WsEvent);
  12.142 -            TInt eventType = Private->EPOC_WsEvent.Type();
  12.143 -		    Private->EPOC_WsEventStatus = KRequestPending;
  12.144 -		    //Private->EPOC_WsSession.EventReady(&Private->EPOC_WsEventStatus);
  12.145 -            if (eventType == EEventFocusGained) {
  12.146 -                RedrawWindowL(_this);
  12.147 -                break;
  12.148 -            }
  12.149 -	    }
  12.150 -        */
  12.151 -        break;
  12.152 -    }
  12.153 -
  12.154 -    case EEventModifiersChanged: 
  12.155 -    {
  12.156 -	    TModifiersChangedEvent* modEvent = aWsEvent.ModifiersChanged();
  12.157 -        TUint modstate = KMOD_NONE;
  12.158 -        if (modEvent->iModifiers == EModifierLeftShift)
  12.159 -            modstate |= KMOD_LSHIFT;
  12.160 -        if (modEvent->iModifiers == EModifierRightShift)
  12.161 -            modstate |= KMOD_RSHIFT;
  12.162 -        if (modEvent->iModifiers == EModifierLeftCtrl)
  12.163 -            modstate |= KMOD_LCTRL;
  12.164 -        if (modEvent->iModifiers == EModifierRightCtrl)
  12.165 -            modstate |= KMOD_RCTRL;
  12.166 -        if (modEvent->iModifiers == EModifierLeftAlt)
  12.167 -            modstate |= KMOD_LALT;
  12.168 -        if (modEvent->iModifiers == EModifierRightAlt)
  12.169 -            modstate |= KMOD_RALT;
  12.170 -        if (modEvent->iModifiers == EModifierLeftFunc)
  12.171 -            modstate |= KMOD_LMETA;
  12.172 -        if (modEvent->iModifiers == EModifierRightFunc)
  12.173 -            modstate |= KMOD_RMETA;
  12.174 -        if (modEvent->iModifiers == EModifierCapsLock)
  12.175 -            modstate |= KMOD_CAPS;
  12.176 -        SDL_SetModState(STATIC_CAST(SDLMod,(modstate | KMOD_LSHIFT)));
  12.177 -        break;
  12.178 -    }
  12.179 -    default:            
  12.180 -        break;
  12.181 -	} 
  12.182 -	
  12.183 -    return posted;
  12.184 -}
  12.185 -
  12.186 -extern "C" {
  12.187 -
  12.188 -void EPOC_PumpEvents(_THIS)
  12.189 -{
  12.190 -    int posted = 0; // !! Do we need this?
  12.191 -    //Private->EPOC_WsSession.EventReady(&Private->EPOC_WsEventStatus);
  12.192 -	while (Private->EPOC_WsEventStatus != KRequestPending) {
  12.193 -
  12.194 -		Private->EPOC_WsSession.GetEvent(Private->EPOC_WsEvent);
  12.195 -		posted = EPOC_HandleWsEvent(_this, Private->EPOC_WsEvent);
  12.196 -		Private->EPOC_WsEventStatus = KRequestPending;
  12.197 -		Private->EPOC_WsSession.EventReady(&Private->EPOC_WsEventStatus);
  12.198 -	}
  12.199 -}
  12.200 -
  12.201 -
  12.202 -void EPOC_InitOSKeymap(_THIS)
  12.203 -{
  12.204 -	int i;
  12.205 -
  12.206 -	/* Initialize the key translation table */
  12.207 -	for ( i=0; i<SDL_TABLESIZE(keymap); ++i )
  12.208 -		keymap[i] = SDLK_UNKNOWN;
  12.209 -
  12.210 -
  12.211 -	/* Numbers */
  12.212 -	for ( i = 0; i<32; ++i ){
  12.213 -		keymap[' ' + i] = (SDLKey)(SDLK_SPACE+i);
  12.214 -	}
  12.215 -	/* e.g. Alphabet keys */
  12.216 -	for ( i = 0; i<32; ++i ){
  12.217 -		keymap['A' + i] = (SDLKey)(SDLK_a+i);
  12.218 -	}
  12.219 -
  12.220 -	keymap[EStdKeyBackspace]    = SDLK_BACKSPACE;
  12.221 -	keymap[EStdKeyTab]          = SDLK_TAB;
  12.222 -	keymap[EStdKeyEnter]        = SDLK_RETURN;
  12.223 -	keymap[EStdKeyEscape]       = SDLK_ESCAPE;
  12.224 -   	keymap[EStdKeySpace]        = SDLK_SPACE;
  12.225 -   	keymap[EStdKeyPause]        = SDLK_PAUSE;
  12.226 -   	keymap[EStdKeyHome]         = SDLK_HOME;
  12.227 -   	keymap[EStdKeyEnd]          = SDLK_END;
  12.228 -   	keymap[EStdKeyPageUp]       = SDLK_PAGEUP;
  12.229 -   	keymap[EStdKeyPageDown]     = SDLK_PAGEDOWN;
  12.230 -	keymap[EStdKeyDelete]       = SDLK_DELETE;
  12.231 -	keymap[EStdKeyUpArrow]      = SDLK_UP;
  12.232 -	keymap[EStdKeyDownArrow]    = SDLK_DOWN;
  12.233 -	keymap[EStdKeyLeftArrow]    = SDLK_LEFT;
  12.234 -	keymap[EStdKeyRightArrow]   = SDLK_RIGHT;
  12.235 -	keymap[EStdKeyCapsLock]     = SDLK_CAPSLOCK;
  12.236 -	keymap[EStdKeyLeftShift]    = SDLK_LSHIFT;
  12.237 -	keymap[EStdKeyRightShift]   = SDLK_RSHIFT;
  12.238 -	keymap[EStdKeyLeftAlt]      = SDLK_LALT;
  12.239 -	keymap[EStdKeyRightAlt]     = SDLK_RALT;
  12.240 -	keymap[EStdKeyLeftCtrl]     = SDLK_LCTRL;
  12.241 -	keymap[EStdKeyRightCtrl]    = SDLK_RCTRL;
  12.242 -	keymap[EStdKeyLeftFunc]     = SDLK_LMETA;
  12.243 -	keymap[EStdKeyRightFunc]    = SDLK_RMETA;
  12.244 -	keymap[EStdKeyInsert]       = SDLK_INSERT;
  12.245 -	keymap[EStdKeyComma]        = SDLK_COMMA;
  12.246 -	keymap[EStdKeyFullStop]     = SDLK_PERIOD;
  12.247 -	keymap[EStdKeyForwardSlash] = SDLK_SLASH;
  12.248 -	keymap[EStdKeyBackSlash]    = SDLK_BACKSLASH;
  12.249 -	keymap[EStdKeySemiColon]    = SDLK_SEMICOLON;
  12.250 -	keymap[EStdKeySingleQuote]  = SDLK_QUOTE;
  12.251 -	keymap[EStdKeyHash]         = SDLK_HASH;
  12.252 -	keymap[EStdKeySquareBracketLeft]    = SDLK_LEFTBRACKET;
  12.253 -	keymap[EStdKeySquareBracketRight]   = SDLK_RIGHTBRACKET;
  12.254 -	keymap[EStdKeyMinus]        = SDLK_MINUS;
  12.255 -	keymap[EStdKeyEquals]       = SDLK_EQUALS;
  12.256 -
  12.257 -   	keymap[EStdKeyF1]          = SDLK_F1;  /* chr + q */
  12.258 -   	keymap[EStdKeyF2]          = SDLK_F2;  /* chr + w */
  12.259 -   	keymap[EStdKeyF3]          = SDLK_F3;  /* chr + e */
  12.260 -   	keymap[EStdKeyF4]          = SDLK_F4;  /* chr + r */
  12.261 -   	keymap[EStdKeyF5]          = SDLK_F5;  /* chr + t */
  12.262 -   	keymap[EStdKeyF6]          = SDLK_F6;  /* chr + y */
  12.263 -   	keymap[EStdKeyF7]          = SDLK_F7;  /* chr + i */
  12.264 -   	keymap[EStdKeyF8]          = SDLK_F8;  /* chr + o */
  12.265 -
  12.266 -   	keymap[EStdKeyF9]          = SDLK_F9;  /* chr + a */
  12.267 -   	keymap[EStdKeyF10]         = SDLK_F10; /* chr + s */
  12.268 -   	keymap[EStdKeyF11]         = SDLK_F11; /* chr + d */
  12.269 -   	keymap[EStdKeyF12]         = SDLK_F12; /* chr + f */
  12.270 -
  12.271 -    /* !!TODO
  12.272 -	EStdKeyNumLock=0x1b,
  12.273 -	EStdKeyScrollLock=0x1c,
  12.274 -
  12.275 -	EStdKeyNkpForwardSlash=0x84,
  12.276 -	EStdKeyNkpAsterisk=0x85,
  12.277 -	EStdKeyNkpMinus=0x86,
  12.278 -	EStdKeyNkpPlus=0x87,
  12.279 -	EStdKeyNkpEnter=0x88,
  12.280 -	EStdKeyNkp1=0x89,
  12.281 -	EStdKeyNkp2=0x8a,
  12.282 -	EStdKeyNkp3=0x8b,
  12.283 -	EStdKeyNkp4=0x8c,
  12.284 -	EStdKeyNkp5=0x8d,
  12.285 -	EStdKeyNkp6=0x8e,
  12.286 -	EStdKeyNkp7=0x8f,
  12.287 -	EStdKeyNkp8=0x90,
  12.288 -	EStdKeyNkp9=0x91,
  12.289 -	EStdKeyNkp0=0x92,
  12.290 -	EStdKeyNkpFullStop=0x93,
  12.291 -    EStdKeyMenu=0x94,
  12.292 -    EStdKeyBacklightOn=0x95,
  12.293 -    EStdKeyBacklightOff=0x96,
  12.294 -    EStdKeyBacklightToggle=0x97,
  12.295 -    EStdKeyIncContrast=0x98,
  12.296 -    EStdKeyDecContrast=0x99,
  12.297 -    EStdKeySliderDown=0x9a,
  12.298 -    EStdKeySliderUp=0x9b,
  12.299 -    EStdKeyDictaphonePlay=0x9c,
  12.300 -    EStdKeyDictaphoneStop=0x9d,
  12.301 -    EStdKeyDictaphoneRecord=0x9e,
  12.302 -    EStdKeyHelp=0x9f,
  12.303 -    EStdKeyOff=0xa0,
  12.304 -    EStdKeyDial=0xa1,
  12.305 -    EStdKeyIncVolume=0xa2,
  12.306 -    EStdKeyDecVolume=0xa3,
  12.307 -    EStdKeyDevice0=0xa4,
  12.308 -    EStdKeyDevice1=0xa5,
  12.309 -    EStdKeyDevice2=0xa6,
  12.310 -    EStdKeyDevice3=0xa7,
  12.311 -    EStdKeyDevice4=0xa8,
  12.312 -    EStdKeyDevice5=0xa9,
  12.313 -    EStdKeyDevice6=0xaa,
  12.314 -    EStdKeyDevice7=0xab,
  12.315 -    EStdKeyDevice8=0xac,
  12.316 -    EStdKeyDevice9=0xad,
  12.317 -    EStdKeyDeviceA=0xae,
  12.318 -    EStdKeyDeviceB=0xaf,
  12.319 -    EStdKeyDeviceC=0xb0,
  12.320 -    EStdKeyDeviceD=0xb1,
  12.321 -    EStdKeyDeviceE=0xb2,
  12.322 -    EStdKeyDeviceF=0xb3,
  12.323 -    EStdKeyApplication0=0xb4,
  12.324 -    EStdKeyApplication1=0xb5,
  12.325 -    EStdKeyApplication2=0xb6,
  12.326 -    EStdKeyApplication3=0xb7,
  12.327 -    EStdKeyApplication4=0xb8,
  12.328 -    EStdKeyApplication5=0xb9,
  12.329 -    EStdKeyApplication6=0xba,
  12.330 -    EStdKeyApplication7=0xbb,
  12.331 -    EStdKeyApplication8=0xbc,
  12.332 -    EStdKeyApplication9=0xbd,
  12.333 -    EStdKeyApplicationA=0xbe,
  12.334 -    EStdKeyApplicationB=0xbf,
  12.335 -    EStdKeyApplicationC=0xc0,
  12.336 -    EStdKeyApplicationD=0xc1,
  12.337 -    EStdKeyApplicationE=0xc2,
  12.338 -    EStdKeyApplicationF=0xc3,
  12.339 -    EStdKeyYes=0xc4,
  12.340 -    EStdKeyNo=0xc5,
  12.341 -    EStdKeyIncBrightness=0xc6,
  12.342 -    EStdKeyDecBrightness=0xc7, 
  12.343 -    EStdKeyCaseOpen=0xc8,
  12.344 -    EStdKeyCaseClose=0xc9
  12.345 -    */
  12.346 -
  12.347 -}
  12.348 -
  12.349 -
  12.350 -
  12.351 -static SDL_keysym *TranslateKey(int scancode, SDL_keysym *keysym)
  12.352 -{
  12.353 -    char debug[256];
  12.354 -    //SDL_TRACE1("SDL: TranslateKey, scancode=%d", scancode); //!!
  12.355 -
  12.356 -	/* Set the keysym information */ 
  12.357 -
  12.358 -	keysym->scancode = scancode;
  12.359 -
  12.360 -    if ((scancode >= MAX_SCANCODE) && 
  12.361 -        ((scancode - ENonCharacterKeyBase + 0x0081) >= MAX_SCANCODE)) {
  12.362 -        SDL_SetError("Too big scancode");
  12.363 -        keysym->scancode = SDLK_UNKNOWN;
  12.364 -	    keysym->mod = KMOD_NONE; 
  12.365 -        return keysym;
  12.366 -    }
  12.367 -
  12.368 -	keysym->mod = SDL_GetModState(); //!!Is this right??
  12.369 -
  12.370 -    /* Handle function keys: F1, F2, F3 ... */
  12.371 -    if (keysym->mod & KMOD_META) {
  12.372 -        if (scancode >= 'A' && scancode < ('A' + 24)) { /* first 32 alphapet keys */
  12.373 -            switch(scancode) {
  12.374 -                case 'Q': scancode = EStdKeyF1; break;
  12.375 -                case 'W': scancode = EStdKeyF2; break;
  12.376 -                case 'E': scancode = EStdKeyF3; break;
  12.377 -                case 'R': scancode = EStdKeyF4; break;
  12.378 -                case 'T': scancode = EStdKeyF5; break;
  12.379 -                case 'Y': scancode = EStdKeyF6; break;
  12.380 -                case 'U': scancode = EStdKeyF7; break;
  12.381 -                case 'I': scancode = EStdKeyF8; break;
  12.382 -                case 'A': scancode = EStdKeyF9; break;
  12.383 -                case 'S': scancode = EStdKeyF10; break;
  12.384 -                case 'D': scancode = EStdKeyF11; break;
  12.385 -                case 'F': scancode = EStdKeyF12; break;
  12.386 -            }
  12.387 -            keysym->sym = keymap[scancode];
  12.388 -        }
  12.389 -    }
  12.390 -
  12.391 -    if (scancode >= ENonCharacterKeyBase) {
  12.392 -        // Non character keys
  12.393 -	    keysym->sym = keymap[scancode - 
  12.394 -            ENonCharacterKeyBase + 0x0081]; // !!hard coded
  12.395 -    } else {
  12.396 -	    keysym->sym = keymap[scancode];
  12.397 -    }
  12.398 -
  12.399 -
  12.400 -	/* If UNICODE is on, get the UNICODE value for the key */
  12.401 -	keysym->unicode = 0;
  12.402 -
  12.403 -#if 0 // !!TODO:unicode
  12.404 -
  12.405 -	if ( SDL_TranslateUNICODE ) 
  12.406 -    {
  12.407 -		/* Populate the unicode field with the ASCII value */
  12.408 -		keysym->unicode = scancode;
  12.409 -	}
  12.410 -#endif
  12.411 -
  12.412 -    //!!
  12.413 -    //sprintf(debug, "SDL: TranslateKey: keysym->scancode=%d, keysym->sym=%d, keysym->mod=%d",
  12.414 -    //    keysym->scancode, keysym->sym, keysym->mod);
  12.415 -    //SDL_TRACE(debug); //!!
  12.416 -
  12.417 -	return(keysym);
  12.418 -}
  12.419 -
  12.420 -}; /* extern "C" */
  12.421 -
  12.422 -
    13.1 --- a/src/video/epoc/SDL_epocevents_c.h	Fri Jun 15 12:27:43 2007 +0000
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,48 +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 -/*
   13.28 -    SDL_epocevents_c.h
   13.29 -    Handle the event stream, converting Epoc events into SDL events
   13.30 -
   13.31 -    Epoc version by Hannu Viitala (hannu.j.viitala@mbnet.fi)
   13.32 -*/
   13.33 -
   13.34 -
   13.35 -extern "C"
   13.36 -{
   13.37 -#include "../SDL_sysvideo.h"
   13.38 -};
   13.39 -
   13.40 -#define MAX_SCANCODE 255
   13.41 -
   13.42 -/* Variables and functions exported by SDL_sysevents.c to other parts 
   13.43 -   of the native video subsystem (SDL_sysvideo.c)
   13.44 -*/
   13.45 -
   13.46 -extern "C"
   13.47 -{
   13.48 -    extern void EPOC_InitOSKeymap(_THIS);
   13.49 -    extern void EPOC_PumpEvents(_THIS);
   13.50 -};
   13.51 -/* vi: set ts=4 sw=4 expandtab: */
    14.1 --- a/src/video/epoc/SDL_epocvideo.cpp	Fri Jun 15 12:27:43 2007 +0000
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,697 +0,0 @@
    14.4 -/*
    14.5 -    SDL - Simple DirectMedia Layer
    14.6 -    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  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 Library General Public
   14.10 -    License as published by the Free Software Foundation; either
   14.11 -    version 2 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 -    Library General Public License for more details.
   14.17 -
   14.18 -    You should have received a copy of the GNU Library General Public
   14.19 -    License along with this library; if not, write to the Free
   14.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   14.21 -
   14.22 -    Sam Lantinga
   14.23 -    slouken@libsdl.org
   14.24 -*/
   14.25 -#include "SDL_config.h"
   14.26 -
   14.27 -/*
   14.28 -    SDL_epocvideo.cpp
   14.29 -    Epoc based SDL video driver implementation
   14.30 -
   14.31 -    Epoc version by Hannu Viitala (hannu.j.viitala@mbnet.fi)
   14.32 -*/
   14.33 -
   14.34 -extern "C" {
   14.35 -#include "SDL_timer.h"
   14.36 -#include "SDL_video.h"
   14.37 -#undef NULL
   14.38 -#include "../SDL_pixels_c.h"
   14.39 -};
   14.40 -
   14.41 -#include "SDL_epocvideo.h"
   14.42 -#include "SDL_epocevents_c.h"
   14.43 -
   14.44 -#include <hal.h>
   14.45 -#include <coedef.h>
   14.46 -
   14.47 -/* For debugging */
   14.48 -
   14.49 -void RDebug_Print_b(char* error_str, void* param)
   14.50 -    {
   14.51 -    TBuf8<128> error8((TUint8*)error_str);
   14.52 -    TBuf<128> error;
   14.53 -    error.Copy(error8);
   14.54 -    if (param) //!! Do not work if the parameter is really 0!!
   14.55 -        RDebug::Print(error, param);
   14.56 -    else 
   14.57 -        RDebug::Print(error);
   14.58 -    }
   14.59 -
   14.60 -extern "C" void RDebug_Print(char* error_str, void* param)
   14.61 -    {
   14.62 -    RDebug_Print_b(error_str, param);
   14.63 -    }
   14.64 -
   14.65 -
   14.66 -int Debug_AvailMem2()
   14.67 -    {
   14.68 -    //User::CompressAllHeaps();
   14.69 -    TMemoryInfoV1Buf membuf; 
   14.70 -    User::LeaveIfError(UserHal::MemoryInfo(membuf));
   14.71 -    TMemoryInfoV1 minfo = membuf();
   14.72 -	return(minfo.iFreeRamInBytes);
   14.73 -    }
   14.74 -
   14.75 -extern "C" int Debug_AvailMem()
   14.76 -    {
   14.77 -    return(Debug_AvailMem2());
   14.78 -    }
   14.79 -
   14.80 -
   14.81 -extern "C" {
   14.82 -
   14.83 -/* Initialization/Query functions */
   14.84 -
   14.85 -static int EPOC_VideoInit(_THIS, SDL_PixelFormat *vformat);
   14.86 -static SDL_Rect **EPOC_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags);
   14.87 -static SDL_Surface *EPOC_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags);
   14.88 -static int EPOC_SetColors(_THIS, int firstcolor, int ncolors,
   14.89 -			  SDL_Color *colors);
   14.90 -static void EPOC_VideoQuit(_THIS);
   14.91 -
   14.92 -/* Hardware surface functions */
   14.93 -
   14.94 -static int EPOC_AllocHWSurface(_THIS, SDL_Surface *surface);
   14.95 -static int EPOC_LockHWSurface(_THIS, SDL_Surface *surface);
   14.96 -static int EPOC_FlipHWSurface(_THIS, SDL_Surface *surface);
   14.97 -static void EPOC_UnlockHWSurface(_THIS, SDL_Surface *surface);
   14.98 -static void EPOC_FreeHWSurface(_THIS, SDL_Surface *surface);
   14.99 -static void EPOC_DirectUpdate(_THIS, int numrects, SDL_Rect *rects);
  14.100 -
  14.101 -static int EPOC_Available(void);
  14.102 -static SDL_VideoDevice *EPOC_CreateDevice(int devindex);
  14.103 -
  14.104 -/* Mouse functions */
  14.105 -
  14.106 -static WMcursor *EPOC_CreateWMCursor(_THIS, Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
  14.107 -static void EPOC_FreeWMCursor(_THIS, WMcursor *cursor);
  14.108 -static int EPOC_ShowWMCursor(_THIS, WMcursor *cursor);
  14.109 -
  14.110 -
  14.111 -
  14.112 -/* !! Table for fast conversion from 8 bit to 12 bit */
  14.113 -static TUint16 EPOC_HWPalette_256_to_4k[256];
  14.114 -
  14.115 -VideoBootStrap EPOC_bootstrap = {
  14.116 -	"epoc", "EPOC system",
  14.117 -    EPOC_Available, EPOC_CreateDevice
  14.118 -};
  14.119 -
  14.120 -const TUint32 WindowClientHandle = 9210; //!!
  14.121 -
  14.122 -/* Epoc video driver bootstrap functions */
  14.123 -
  14.124 -static int EPOC_Available(void)
  14.125 -{
  14.126 -    return 1; /* Always available */
  14.127 -}
  14.128 -
  14.129 -static void EPOC_DeleteDevice(SDL_VideoDevice *device)
  14.130 -{
  14.131 -	SDL_free(device->hidden);
  14.132 -	SDL_free(device);
  14.133 -}
  14.134 -
  14.135 -static SDL_VideoDevice *EPOC_CreateDevice(int devindex)
  14.136 -{
  14.137 -	SDL_VideoDevice *device;
  14.138 -
  14.139 -	/* Allocate all variables that we free on delete */
  14.140 -	device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice));
  14.141 -	if ( device ) {
  14.142 -		SDL_memset(device, 0, (sizeof *device));
  14.143 -		device->hidden = (struct SDL_PrivateVideoData *)
  14.144 -				SDL_malloc((sizeof *device->hidden));
  14.145 -	}
  14.146 -	if ( (device == NULL) || (device->hidden == NULL) ) {
  14.147 -		SDL_OutOfMemory();
  14.148 -		if ( device ) {
  14.149 -			SDL_free(device);
  14.150 -		}
  14.151 -		return(0);
  14.152 -	}
  14.153 -	SDL_memset(device->hidden, 0, (sizeof *device->hidden));
  14.154 -
  14.155 -	/* Set the function pointers */
  14.156 -	device->VideoInit = EPOC_VideoInit;
  14.157 -	device->ListModes = EPOC_ListModes;
  14.158 -	device->SetVideoMode = EPOC_SetVideoMode;
  14.159 -	device->SetColors = EPOC_SetColors;
  14.160 -	device->UpdateRects = NULL;
  14.161 -	device->VideoQuit = EPOC_VideoQuit;
  14.162 -	device->AllocHWSurface = EPOC_AllocHWSurface;
  14.163 -	device->CheckHWBlit = NULL;
  14.164 -	device->FillHWRect = NULL;
  14.165 -	device->SetHWColorKey = NULL;
  14.166 -	device->SetHWAlpha = NULL;
  14.167 -	device->LockHWSurface = EPOC_LockHWSurface;
  14.168 -	device->UnlockHWSurface = EPOC_UnlockHWSurface;
  14.169 -	device->FlipHWSurface = EPOC_FlipHWSurface;
  14.170 -	device->FreeHWSurface = EPOC_FreeHWSurface;
  14.171 -	device->SetIcon = NULL;
  14.172 -	device->SetCaption = NULL;
  14.173 -	device->GetWMInfo = NULL;
  14.174 -	device->FreeWMCursor = EPOC_FreeWMCursor;
  14.175 -	device->CreateWMCursor = EPOC_CreateWMCursor;
  14.176 -	device->ShowWMCursor = EPOC_ShowWMCursor;
  14.177 -	device->WarpWMCursor = NULL;
  14.178 -	device->InitOSKeymap = EPOC_InitOSKeymap;
  14.179 -	device->PumpEvents = EPOC_PumpEvents;
  14.180 -	device->free = EPOC_DeleteDevice;
  14.181 -
  14.182 -	return device;
  14.183 -}
  14.184 -
  14.185 -
  14.186 -int GetBpp(TDisplayMode displaymode)
  14.187 -{
  14.188 -    TInt numColors = TDisplayModeUtils::NumDisplayModeColors(displaymode);
  14.189 -    TInt bitsPerPixel = 1;
  14.190 -    for (TInt32 i = 2; i < numColors; i <<= 1, bitsPerPixel++);
  14.191 -    return bitsPerPixel;    
  14.192 -}
  14.193 -
  14.194 -void ConstructWindowL(_THIS)
  14.195 -{
  14.196 -	TInt	error;
  14.197 -
  14.198 -	error = Private->EPOC_WsSession.Connect();
  14.199 -	User::LeaveIfError(error);
  14.200 -	Private->EPOC_WsScreen=new(ELeave) CWsScreenDevice(Private->EPOC_WsSession);
  14.201 -	User::LeaveIfError(Private->EPOC_WsScreen->Construct());
  14.202 -	User::LeaveIfError(Private->EPOC_WsScreen->CreateContext(Private->EPOC_WindowGc));
  14.203 -
  14.204 -	Private->EPOC_WsWindowGroup=RWindowGroup(Private->EPOC_WsSession);
  14.205 -	User::LeaveIfError(Private->EPOC_WsWindowGroup.Construct(WindowClientHandle));
  14.206 -	Private->EPOC_WsWindowGroup.SetOrdinalPosition(0);
  14.207 -
  14.208 -    //!!
  14.209 -    TBuf<32> winGroupName;
  14.210 -    winGroupName.Append(0);
  14.211 -    winGroupName.Append(0);
  14.212 -    winGroupName.Append(0);// uid
  14.213 -    winGroupName.Append(0);
  14.214 -    winGroupName.Append(_L("SDL")); // caption
  14.215 -    winGroupName.Append(0);
  14.216 -    winGroupName.Append(0); //doc name
  14.217 -	Private->EPOC_WsWindowGroup.SetName(winGroupName); //!!
  14.218 -
  14.219 -	Private->EPOC_WsWindow=RWindow(Private->EPOC_WsSession);
  14.220 -	User::LeaveIfError(Private->EPOC_WsWindow.Construct(Private->EPOC_WsWindowGroup,WindowClientHandle));
  14.221 -	Private->EPOC_WsWindow.SetBackgroundColor(KRgbWhite);
  14.222 -    Private->EPOC_WsWindow.Activate();
  14.223 -	Private->EPOC_WsWindow.SetSize(Private->EPOC_WsScreen->SizeInPixels()); 
  14.224 -	Private->EPOC_WsWindow.SetVisible(ETrue);
  14.225 -
  14.226 -    Private->EPOC_WsWindowGroupID = Private->EPOC_WsWindowGroup.Identifier();
  14.227 -    Private->EPOC_IsWindowFocused = EFalse;
  14.228 -}
  14.229 -
  14.230 -
  14.231 -int EPOC_VideoInit(_THIS, SDL_PixelFormat *vformat)
  14.232 -{
  14.233 -    // !!TODO:handle leave functions!
  14.234 -
  14.235 -    int i;
  14.236 -
  14.237 -	/* Initialize all variables that we clean on shutdown */   
  14.238 -
  14.239 -	for ( i=0; i<SDL_NUMMODES; ++i ) {
  14.240 -		Private->SDL_modelist[i] = (SDL_Rect *)SDL_malloc(sizeof(SDL_Rect));
  14.241 -		Private->SDL_modelist[i]->x = Private->SDL_modelist[i]->y = 0;
  14.242 -	}
  14.243 -	/* Modes sorted largest to smallest !!TODO:sorting order??*/
  14.244 -	Private->SDL_modelist[0]->w = 640; Private->SDL_modelist[0]->h = 200; 
  14.245 -	Private->SDL_modelist[1]->w = 320; Private->SDL_modelist[1]->h = 200;
  14.246 -	Private->SDL_modelist[2]->w = 640; Private->SDL_modelist[2]->h = 400; 
  14.247 -	Private->SDL_modelist[3]->w = 640; Private->SDL_modelist[3]->h = 480;
  14.248 -	Private->SDL_modelist[4] = NULL;
  14.249 -
  14.250 -    /* Construct Epoc window */
  14.251 -
  14.252 -    ConstructWindowL(_this);
  14.253 -
  14.254 -    /* Initialise Epoc frame buffer */
  14.255 -
  14.256 -    TDisplayMode displayMode = Private->EPOC_WsScreen->DisplayMode();
  14.257 -
  14.258 -    #ifndef __WINS__
  14.259 -
  14.260 -    TScreenInfoV01 screenInfo;
  14.261 -	TPckg<TScreenInfoV01> sInfo(screenInfo);
  14.262 -	UserSvr::ScreenInfo(sInfo);
  14.263 -
  14.264 -	Private->EPOC_ScreenSize		= screenInfo.iScreenSize; 
  14.265 -	Private->EPOC_DisplayMode		= displayMode;
  14.266 -    Private->EPOC_HasFrameBuffer	= screenInfo.iScreenAddressValid;
  14.267 -	Private->EPOC_FrameBuffer		= Private->EPOC_HasFrameBuffer ? (TUint8*) screenInfo.iScreenAddress : NULL;
  14.268 -	Private->EPOC_BytesPerPixel	    = ((GetBpp(displayMode)-1) / 8) + 1;
  14.269 -	Private->EPOC_BytesPerScanLine	= screenInfo.iScreenSize.iWidth * Private->EPOC_BytesPerPixel;
  14.270 -
  14.271 -    /* It seems that in SA1100 machines for 8bpp displays there is a 512 palette table at the 
  14.272 -     * beginning of the frame buffer. E.g. Series 7 and Netbook.
  14.273 -     * In 12 bpp machines the table has 16 entries.
  14.274 -	 */
  14.275 -	if (Private->EPOC_HasFrameBuffer && GetBpp(displayMode) == 8)
  14.276 -		Private->EPOC_FrameBuffer += 512;
  14.277 -	if (Private->EPOC_HasFrameBuffer && GetBpp(displayMode) == 12)
  14.278 -		Private->EPOC_FrameBuffer += 16 * 2;
  14.279 -
  14.280 -    #else /* defined __WINS__ */
  14.281 -    
  14.282 -    /* Create bitmap, device and context for screen drawing */
  14.283 -    Private->EPOC_ScreenSize        = Private->EPOC_WsScreen->SizeInPixels();
  14.284 -
  14.285 -	Private->EPOC_Bitmap = new (ELeave) CWsBitmap(Private->EPOC_WsSession);
  14.286 -	Private->EPOC_Bitmap->Create(Private->EPOC_ScreenSize, displayMode);
  14.287 -
  14.288 -	Private->EPOC_DisplayMode	    = displayMode;
  14.289 -    Private->EPOC_HasFrameBuffer    = ETrue;
  14.290 -    Private->EPOC_FrameBuffer       = NULL; /* Private->EPOC_Bitmap->DataAddress() can change any time */
  14.291 -	Private->EPOC_BytesPerPixel	    = ((GetBpp(displayMode)-1) / 8) + 1;
  14.292 -	Private->EPOC_BytesPerScanLine  = Private->EPOC_WsScreen->SizeInPixels().iWidth * Private->EPOC_BytesPerPixel;
  14.293 -
  14.294 -    #endif /* __WINS__ */
  14.295 -
  14.296 -    _this->info.current_w = Private->EPOC_ScreenSize.iWidth;
  14.297 -    _this->info.current_h = Private->EPOC_ScreenSize.iHeight;
  14.298 -
  14.299 -    /* The "best" video format should be returned to caller. */
  14.300 -
  14.301 -    vformat->BitsPerPixel       = /*!!GetBpp(displayMode) */ 8;
  14.302 -    vformat->BytesPerPixel      = /*!!Private->EPOC_BytesPerPixel*/ 1;
  14.303 -
  14.304 -    /* Activate events for me */
  14.305 -
  14.306 -	Private->EPOC_WsEventStatus = KRequestPending;
  14.307 -	Private->EPOC_WsSession.EventReady(&Private->EPOC_WsEventStatus);
  14.308 -	Private->EPOC_RedrawEventStatus = KRequestPending;
  14.309 -	Private->EPOC_WsSession.RedrawReady(&Private->EPOC_RedrawEventStatus);
  14.310 -    Private->EPOC_WsWindow.PointerFilter(EPointerFilterDrag, 0); 
  14.311 -
  14.312 -    Private->EPOC_ScreenOffset = 0;
  14.313 -
  14.314 -    //!! TODO: error handling
  14.315 -    //if (ret != KErrNone)
  14.316 -    //    return(-1);
  14.317 -    //else
  14.318 -	    return(0);
  14.319 -}
  14.320 -
  14.321 -
  14.322 -SDL_Rect **EPOC_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags)
  14.323 -{
  14.324 -    if (format->BitsPerPixel == 12 || format->BitsPerPixel == 8)
  14.325 -        return Private->SDL_modelist;
  14.326 -    return NULL;
  14.327 -}
  14.328 -
  14.329 -int EPOC_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
  14.330 -{
  14.331 -    for(int i = firstcolor; i < ncolors; i++) {
  14.332 -	    // 4k value: 000rgb
  14.333 -	    TUint16 color4K = 0;
  14.334 -        color4K |= (colors[i].r & 0x0000f0) << 4; 
  14.335 -	    color4K |= (colors[i].g & 0x0000f0);      
  14.336 -	    color4K |= (colors[i].b & 0x0000f0) >> 4;
  14.337 -        EPOC_HWPalette_256_to_4k[i] = color4K;
  14.338 -    }
  14.339 -	return(0);
  14.340 -}
  14.341 -
  14.342 -
  14.343 -SDL_Surface *EPOC_SetVideoMode(_THIS, SDL_Surface *current,
  14.344 -				int width, int height, int bpp, Uint32 flags)
  14.345 -{
  14.346 -    /* Check parameters */
  14.347 -    if (!((width == 640 && height == 200 && bpp == 12) ||
  14.348 -          (width == 640 && height == 400 && bpp == 12) || 
  14.349 -          (width == 640 && height == 480 && bpp == 12) || 
  14.350 -          (width == 320 && height == 200 && bpp == 12) || 
  14.351 -          (width == 640 && height == 200 && bpp == 8) ||
  14.352 -          (width == 640 && height == 400 && bpp == 8) || 
  14.353 -          (width == 640 && height == 480 && bpp == 8) || 
  14.354 -          (width == 320 && height == 200 && bpp == 8))) {
  14.355 -		SDL_SetError("Requested video mode is not supported");
  14.356 -        return NULL;
  14.357 -    }
  14.358 -
  14.359 -    if (current && current->pixels) {
  14.360 -        SDL_free(current->pixels);
  14.361 -        current->pixels = NULL;
  14.362 -    }
  14.363 -	if ( ! SDL_ReallocFormat(current, bpp, 0, 0, 0, 0) ) {
  14.364 -		return(NULL);
  14.365 -	}
  14.366 -
  14.367 -    /* Set up the new mode framebuffer */
  14.368 -    if (bpp == 8) 
  14.369 -	    current->flags = (SDL_FULLSCREEN|SDL_SWSURFACE|SDL_PREALLOC|SDL_HWPALETTE); 
  14.370 -    else // 12 bpp
  14.371 -	    current->flags = (SDL_FULLSCREEN|SDL_SWSURFACE|SDL_PREALLOC); 
  14.372 -	current->w = width;
  14.373 -	current->h = height;
  14.374 -    int numBytesPerPixel = ((bpp-1)>>3) + 1;   
  14.375 -	current->pitch = numBytesPerPixel * width; // Number of bytes in scanline 
  14.376 -	current->pixels = SDL_malloc(width * height * numBytesPerPixel);
  14.377 -	SDL_memset(current->pixels, 0, width * height * numBytesPerPixel);
  14.378 -
  14.379 -	/* Set the blit function */
  14.380 -	_this->UpdateRects = EPOC_DirectUpdate;
  14.381 -
  14.382 -    /* Must buffer height be shrinked to screen by 2 ? */
  14.383 -    if (current->h >= 400)
  14.384 -        Private->EPOC_ShrinkedHeight = ETrue;
  14.385 -
  14.386 -    /* Centralize game window on device screen  */
  14.387 -    Private->EPOC_ScreenOffset = (Private->EPOC_ScreenSize.iWidth - current->w) / 2;
  14.388 -
  14.389 -	/* We're done */
  14.390 -	return(current);
  14.391 -}
  14.392 -
  14.393 -void RedrawWindowL(_THIS)
  14.394 -{
  14.395 -    SDL_Rect fullScreen;
  14.396 -    fullScreen.x = 0;
  14.397 -    fullScreen.y = 0;
  14.398 -    fullScreen.w = _this->screen->w;
  14.399 -    fullScreen.h = _this->screen->h;
  14.400 -
  14.401 -#ifdef __WINS__
  14.402 -	    TBitmapUtil lock(Private->EPOC_Bitmap);	
  14.403 -        lock.Begin(TPoint(0,0)); // Lock bitmap heap
  14.404 -	    Private->EPOC_WindowGc->Activate(Private->EPOC_WsWindow);
  14.405 -#endif
  14.406 -
  14.407 -    if (fullScreen.w < Private->EPOC_ScreenSize.iWidth
  14.408 -        && fullScreen.w < Private->EPOC_ScreenSize.iWidth) {
  14.409 -        /* Draw blue stripes background */
  14.410 -#ifdef __WINS__
  14.411 -        TUint16* screenBuffer = (TUint16*)Private->EPOC_Bitmap->DataAddress();
  14.412 -#else
  14.413 -        TUint16* screenBuffer = (TUint16*)Private->EPOC_FrameBuffer;
  14.414 -#endif
  14.415 -        for (int y=0; y < Private->EPOC_ScreenSize.iHeight; y++) {
  14.416 -            for (int x=0; x < Private->EPOC_ScreenSize.iWidth; x++) {
  14.417 -                TUint16 color = ((x+y)>>1) & 0xf; /* Draw pattern */
  14.418 -                *screenBuffer++ = color;
  14.419 -            }
  14.420 -        }
  14.421 -    }
  14.422 -
  14.423 -
  14.424 -    /* Tell the system that something has been drawn */
  14.425 -	TRect  rect = TRect(Private->EPOC_WsWindow.Size());
  14.426 -  	Private->EPOC_WsWindow.Invalidate(rect);
  14.427 -
  14.428 -#ifdef __WINS__
  14.429 -	Private->EPOC_WsWindow.BeginRedraw(rect);
  14.430 -	Private->EPOC_WindowGc->BitBlt(TPoint(), Private->EPOC_Bitmap);
  14.431 -	Private->EPOC_WsWindow.EndRedraw();
  14.432 -	Private->EPOC_WindowGc->Deactivate();
  14.433 -    lock.End(); // Unlock bitmap heap
  14.434 -	Private->EPOC_WsSession.Flush();
  14.435 -#endif
  14.436 -
  14.437 -    /* Draw current buffer */
  14.438 -    EPOC_DirectUpdate(_this, 1, &fullScreen);
  14.439 -}
  14.440 -
  14.441 -
  14.442 -/* We don't actually allow hardware surfaces other than the main one */
  14.443 -static int EPOC_AllocHWSurface(_THIS, SDL_Surface *surface)
  14.444 -{
  14.445 -	return(-1);
  14.446 -}
  14.447 -static void EPOC_FreeHWSurface(_THIS, SDL_Surface *surface)
  14.448 -{
  14.449 -	return;
  14.450 -}
  14.451 -
  14.452 -static int EPOC_LockHWSurface(_THIS, SDL_Surface *surface)
  14.453 -{
  14.454 -	return(0);
  14.455 -}
  14.456 -static void EPOC_UnlockHWSurface(_THIS, SDL_Surface *surface)
  14.457 -{
  14.458 -	return;
  14.459 -}
  14.460 -
  14.461 -static int EPOC_FlipHWSurface(_THIS, SDL_Surface *surface)
  14.462 -{
  14.463 -	return(0);
  14.464 -}
  14.465 -
  14.466 -static void EPOC_DirectUpdate(_THIS, int numrects, SDL_Rect *rects)
  14.467 -{
  14.468 -    TInt focusWindowGroupId = Private->EPOC_WsSession.GetFocusWindowGroup();
  14.469 -    if (focusWindowGroupId != Private->EPOC_WsWindowGroupID) {
  14.470 -
  14.471 -        /* Force focus window to redraw again for cleaning away SDL screen graphics */
  14.472 -
  14.473 -  
  14.474 -        TInt pos = Private->EPOC_WsWindowGroup.OrdinalPosition();
  14.475 -        Private->EPOC_WsWindowGroup.SetOrdinalPosition(0, KMaxTInt);
  14.476 -       	TRect  rect = TRect(Private->EPOC_WsWindow.Size());
  14.477 -        Private->EPOC_WsWindow.Invalidate(rect);
  14.478 -        Private->EPOC_WsWindowGroup.SetOrdinalPosition(pos, ECoeWinPriorityNormal);
  14.479 -        
  14.480 -        /* If this is not the topmost window, wait here! Sleep for 1 second to give cpu to 
  14.481 -           multitasking and poll for being the topmost window.
  14.482 -        */
  14.483 -        while (Private->EPOC_WsSession.GetFocusWindowGroup() != Private->EPOC_WsWindowGroupID)
  14.484 -            SDL_Delay(1000);
  14.485 -
  14.486 -        RedrawWindowL(_this);  
  14.487 -    }
  14.488 -
  14.489 -	TInt i;
  14.490 -    TInt sourceNumBytesPerPixel = ((_this->screen->format->BitsPerPixel-1)>>3) + 1;   
  14.491 -    TInt targetNumBytesPerPixel = Private->EPOC_BytesPerPixel;   
  14.492 -    TInt fixedOffset = Private->EPOC_ScreenOffset;   
  14.493 -    TInt screenW = _this->screen->w;
  14.494 -    TInt screenH = _this->screen->h;
  14.495 -    TInt sourceScanlineLength = screenW;
  14.496 -    if (Private->EPOC_ShrinkedHeight) {  /* simulate 400 pixel height in 200 pixel screen */  
  14.497 -        sourceScanlineLength <<= 1; 
  14.498 -        screenH >>= 1;
  14.499 -    }
  14.500 -    TInt targetScanlineLength = Private->EPOC_ScreenSize.iWidth;
  14.501 -#ifdef __WINS__
  14.502 -	TBitmapUtil lock(Private->EPOC_Bitmap);	
  14.503 -    lock.Begin(TPoint(0,0)); // Lock bitmap heap
  14.504 -	Private->EPOC_WindowGc->Activate(Private->EPOC_WsWindow);
  14.505 -    TUint16* screenBuffer = (TUint16*)Private->EPOC_Bitmap->DataAddress();
  14.506 -#else
  14.507 -    TUint16* screenBuffer = (TUint16*)Private->EPOC_FrameBuffer;
  14.508 -#endif
  14.509 -
  14.510 -
  14.511 -	/* Render the rectangles in the list */
  14.512 -
  14.513 -	for ( i=0; i < numrects; ++i ) {
  14.514 -        SDL_Rect rect2;
  14.515 -        const SDL_Rect& currentRect = rects[i];
  14.516 -        rect2.x = currentRect.x;
  14.517 -        rect2.y = currentRect.y;
  14.518 -        rect2.w = currentRect.w;
  14.519 -        rect2.h = currentRect.h;
  14.520 -
  14.521 -        if (rect2.w <= 0 || rect2.h <= 0) /* sanity check */
  14.522 -            continue;
  14.523 -
  14.524 -        if (Private->EPOC_ShrinkedHeight) {  /* simulate 400 pixel height in 200 pixel screen */        
  14.525 -            rect2.y >>= 1;
  14.526 -            if (!(rect2.h >>= 1)) 
  14.527 -                rect2.h = 1; // always at least 1 pixel height!
  14.528 -        }
  14.529 -
  14.530 -        /* All variables are measured in pixels */
  14.531 -
  14.532 -        /* Check rects validity, i.e. upper and lower bounds */
  14.533 -        TInt maxX = Min(screenW - 1, rect2.x + rect2.w - 1);
  14.534 -        TInt maxY = Min(screenH - 1, rect2.y + rect2.h - 1);
  14.535 -        if (maxX < 0 || maxY < 0) /* sanity check */
  14.536 -            continue;
  14.537 -        maxY = Min(maxY, 199); 
  14.538 -
  14.539 -        TInt sourceRectWidth = maxX - rect2.x + 1;
  14.540 -        TInt sourceRectWidthInBytes = sourceRectWidth * sourceNumBytesPerPixel;
  14.541 -        TInt sourceRectHeight = maxY - rect2.y + 1;
  14.542 -        TInt sourceStartOffset = rect2.x + rect2.y * sourceScanlineLength;
  14.543 -        TInt targetStartOffset = fixedOffset + rect2.x + rect2.y * targetScanlineLength;   
  14.544 -        
  14.545 -        // !! Nokia9210 native mode: 12 bpp --> 12 bpp
  14.546 -        if (_this->screen->format->BitsPerPixel == 12) { 
  14.547 -	        TUint16* bitmapLine = (TUint16*)_this->screen->pixels + sourceStartOffset;
  14.548 -            TUint16* screenMemory = screenBuffer + targetStartOffset;
  14.549 -            for(TInt y = 0 ; y < sourceRectHeight ; y++) {
  14.550 -                __ASSERT_DEBUG(screenMemory < (screenBuffer 
  14.551 -                    + Private->EPOC_ScreenSize.iWidth * Private->EPOC_ScreenSize.iHeight), 
  14.552 -                    User::Panic(_L("SDL"), KErrCorrupt));
  14.553 -                __ASSERT_DEBUG(screenMemory >= screenBuffer, 
  14.554 -                    User::Panic(_L("SDL"), KErrCorrupt));
  14.555 -                __ASSERT_DEBUG(bitmapLine < ((TUint16*)_this->screen->pixels + 
  14.556 -                    + (_this->screen->w * _this->screen->h)), 
  14.557 -                    User::Panic(_L("SDL"), KErrCorrupt));
  14.558 -                __ASSERT_DEBUG(bitmapLine >=  (TUint16*)_this->screen->pixels, 
  14.559 -                    User::Panic(_L("SDL"), KErrCorrupt));
  14.560 -		        Mem::Copy(screenMemory, bitmapLine, sourceRectWidthInBytes);
  14.561 -		        bitmapLine += sourceScanlineLength;
  14.562 -		        screenMemory += targetScanlineLength;
  14.563 -            }
  14.564 -        }
  14.565 -        // !! 256 color paletted mode: 8 bpp  --> 12 bpp
  14.566 -        else { 
  14.567 -	        TUint8* bitmapLine = (TUint8*)_this->screen->pixels + sourceStartOffset;
  14.568 -            TUint16* screenMemory = screenBuffer + targetStartOffset;
  14.569 -            for(TInt y = 0 ; y < sourceRectHeight ; y++) {
  14.570 -                TUint8* bitmapPos = bitmapLine; /* 1 byte per pixel */
  14.571 -                TUint16* screenMemoryLinePos = screenMemory; /* 2 bytes per pixel */
  14.572 -                /* Convert each pixel from 256 palette to 4k color values */
  14.573 -                for(TInt x = 0 ; x < sourceRectWidth ; x++) {
  14.574 -                    __ASSERT_DEBUG(screenMemoryLinePos < (screenBuffer 
  14.575 -                        + (Private->EPOC_ScreenSize.iWidth * Private->EPOC_ScreenSize.iHeight)), 
  14.576 -                        User::Panic(_L("SDL"), KErrCorrupt));
  14.577 -                    __ASSERT_DEBUG(screenMemoryLinePos >= screenBuffer, 
  14.578 -                        User::Panic(_L("SDL"), KErrCorrupt));
  14.579 -                    __ASSERT_DEBUG(bitmapPos < ((TUint8*)_this->screen->pixels + 
  14.580 -                        + (_this->screen->w * _this->screen->h)), 
  14.581 -                        User::Panic(_L("SDL"), KErrCorrupt));
  14.582 -                    __ASSERT_DEBUG(bitmapPos >= (TUint8*)_this->screen->pixels, 
  14.583 -                        User::Panic(_L("SDL"), KErrCorrupt));
  14.584 -                    *screenMemoryLinePos = EPOC_HWPalette_256_to_4k[*bitmapPos];
  14.585 -                    bitmapPos++;
  14.586 -                    screenMemoryLinePos++;
  14.587 -                }
  14.588 -		        bitmapLine += sourceScanlineLength;
  14.589 -		        screenMemory += targetScanlineLength;
  14.590 -            }
  14.591 -	    }
  14.592 -
  14.593 -    }    
  14.594 -    
  14.595 -#ifdef __WINS__
  14.596 -
  14.597 -	TRect  rect = TRect(Private->EPOC_WsWindow.Size());
  14.598 -	Private->EPOC_WsWindow.Invalidate(rect);
  14.599 -	Private->EPOC_WsWindow.BeginRedraw(rect);
  14.600 -	Private->EPOC_WindowGc->BitBlt(TPoint(), Private->EPOC_Bitmap);
  14.601 -	Private->EPOC_WsWindow.EndRedraw();
  14.602 -	Private->EPOC_WindowGc->Deactivate();
  14.603 -    lock.End(); // Unlock bitmap heap
  14.604 -	Private->EPOC_WsSession.Flush();
  14.605 -
  14.606 -#endif
  14.607 -
  14.608 -    /* Update virtual cursor */
  14.609 -    //!!Private->EPOC_WsSession.SetPointerCursorPosition(Private->EPOC_WsSession.PointerCursorPosition());
  14.610 -
  14.611 -    return;
  14.612 -}
  14.613 -
  14.614 -
  14.615 -/* Note:  If we are terminated, this could be called in the middle of
  14.616 -   another SDL video routine -- notably UpdateRects.
  14.617 -*/
  14.618 -void EPOC_VideoQuit(_THIS)
  14.619 -{
  14.620 -	int i;
  14.621 -
  14.622 -	/* Free video mode lists */
  14.623 -	for ( i=0; i<SDL_NUMMODES; ++i ) {
  14.624 -		if ( Private->SDL_modelist[i] != NULL ) {
  14.625 -			SDL_free(Private->SDL_modelist[i]);
  14.626 -			Private->SDL_modelist[i] = NULL;
  14.627 -		}
  14.628 -	}
  14.629 -	
  14.630 -    if ( _this->screen && (_this->screen->flags & SDL_HWSURFACE) ) {
  14.631 -		/* Direct screen access, no memory buffer */
  14.632 -		_this->screen->pixels = NULL;
  14.633 -	}
  14.634 -
  14.635 -    if (_this->screen && _this->screen->pixels) {
  14.636 -        SDL_free(_this->screen->pixels);
  14.637 -        _this->screen->pixels = NULL;
  14.638 -    }
  14.639 -
  14.640 -    /* Free Epoc resources */
  14.641 -
  14.642 -    /* Disable events for me */
  14.643 -	if (Private->EPOC_WsEventStatus != KRequestPending)
  14.644 -		Private->EPOC_WsSession.EventReadyCancel();
  14.645 -	if (Private->EPOC_RedrawEventStatus != KRequestPending)
  14.646 -		Private->EPOC_WsSession.RedrawReadyCancel();
  14.647 -
  14.648 -    #ifdef __WINS__
  14.649 -	delete Private->EPOC_Bitmap;
  14.650 -	Private->EPOC_Bitmap = NULL;
  14.651 -    #endif
  14.652 -
  14.653 -	if (Private->EPOC_WsWindow.WsHandle())
  14.654 -		Private->EPOC_WsWindow.Close();
  14.655 -
  14.656 -	if (Private->EPOC_WsWindowGroup.WsHandle())
  14.657 -		Private->EPOC_WsWindowGroup.Close();
  14.658 -
  14.659 -	delete Private->EPOC_WindowGc;
  14.660 -	Private->EPOC_WindowGc = NULL;
  14.661 -
  14.662 -	delete Private->EPOC_WsScreen;
  14.663 -	Private->EPOC_WsScreen = NULL;
  14.664 -
  14.665 -	if (Private->EPOC_WsSession.WsHandle())
  14.666 -		Private->EPOC_WsSession.Close();
  14.667 -}
  14.668 -
  14.669 -
  14.670 -WMcursor *EPOC_CreateWMCursor(_THIS, Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y)
  14.671 -{
  14.672 -	return (WMcursor *) 9210; // it's ok to return something unuseful but true
  14.673 -}
  14.674 -
  14.675 -void EPOC_FreeWMCursor(_THIS, WMcursor *cursor)
  14.676 -{
  14.677 -    /* Disable virtual cursor */
  14.678 -    HAL::Set(HAL::EMouseState, HAL::EMouseState_Invisible);
  14.679 -    Private->EPOC_WsSession.SetPointerCursorMode(EPointerCursorNone);
  14.680 -}
  14.681 -
  14.682 -int EPOC_ShowWMCursor(_THIS, WMcursor *cursor)
  14.683 -{
  14.684 -
  14.685 -    if (cursor ==  (WMcursor *)9210) {
  14.686 -        /* Enable virtual cursor */
  14.687 -	    HAL::Set(HAL::EMouseState, HAL::EMouseState_Visible);
  14.688 -	    Private->EPOC_WsSession.SetPointerCursorMode(EPointerCursorNormal);
  14.689 -    }
  14.690 -    else {
  14.691 -        /* Disable virtual cursor */
  14.692 -        HAL::Set(HAL::EMouseState, HAL::EMouseState_Invisible);
  14.693 -        Private->EPOC_WsSession.SetPointerCursorMode(EPointerCursorNone);
  14.694 -    }
  14.695 -
  14.696 -	return(1);
  14.697 -}
  14.698 -
  14.699 -}; // extern "C"
  14.700 -
    15.1 --- a/src/video/epoc/SDL_epocvideo.h	Fri Jun 15 12:27:43 2007 +0000
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,94 +0,0 @@
    15.4 -/*
    15.5 -    SDL - Simple DirectMedia Layer
    15.6 -    Copyright (C) 1997-2004 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 Library General Public
   15.10 -    License as published by the Free Software Foundation; either
   15.11 -    version 2 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 -    Library General Public License for more details.
   15.17 -
   15.18 -    You should have received a copy of the GNU Library General Public
   15.19 -    License along with this library; if not, write to the Free
   15.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   15.21 -
   15.22 -    Sam Lantinga
   15.23 -    slouken@libsdl.org
   15.24 -*/
   15.25 -#include "SDL_config.h"
   15.26 -
   15.27 -/*
   15.28 -    SDL_epocvideo.h
   15.29 -    Epoc based SDL video driver implementation
   15.30 -
   15.31 -    Epoc version by Hannu Viitala (hannu.j.viitala@mbnet.fi)
   15.32 -*/
   15.33 -
   15.34 -#ifndef _SDL_epocvideo_h
   15.35 -#define _SDL_epocvideo_h
   15.36 -
   15.37 -extern "C"
   15.38 -{
   15.39 -#include "SDL_mouse.h"
   15.40 -#include "../SDL_sysvideo.h"
   15.41 -};
   15.42 -
   15.43 -#include <e32std.h>
   15.44 -#include <bitdev.h>
   15.45 -#include <w32std.h>
   15.46 -
   15.47 -/* Hidden "this" pointer for the video functions */
   15.48 -#define _THIS	SDL_VideoDevice *_this
   15.49 -#define Private	_this->hidden
   15.50 -
   15.51 -#define SDL_NUMMODES	4
   15.52 -
   15.53 -/* Private display data */
   15.54 -struct SDL_PrivateVideoData
   15.55 -{
   15.56 -
   15.57 -    SDL_Rect *SDL_modelist[SDL_NUMMODES + 1];
   15.58 -
   15.59 -    /* Epoc window server info */
   15.60 -
   15.61 -    RWsSession EPOC_WsSession;
   15.62 -    RWindowGroup EPOC_WsWindowGroup;
   15.63 -    TInt EPOC_WsWindowGroupID;
   15.64 -    RWindow EPOC_WsWindow;
   15.65 -    CWsScreenDevice *EPOC_WsScreen;
   15.66 -    CWindowGc *EPOC_WindowGc;
   15.67 -    TRequestStatus EPOC_WsEventStatus;
   15.68 -    TRequestStatus EPOC_RedrawEventStatus;
   15.69 -    TWsEvent EPOC_WsEvent;
   15.70 -    TWsRedrawEvent EPOC_RedrawEvent;
   15.71 -#ifdef __WINS__
   15.72 -    CWsBitmap *EPOC_Bitmap;
   15.73 -#endif
   15.74 -    TBool EPOC_IsWindowFocused; //!!Not used for anything yet!
   15.75 -
   15.76 -    /* Screen hardware frame buffer info */
   15.77 -
   15.78 -    TBool EPOC_HasFrameBuffer;
   15.79 -    TInt EPOC_BytesPerPixel;
   15.80 -    TInt EPOC_BytesPerScanLine;
   15.81 -    TDisplayMode EPOC_DisplayMode;
   15.82 -    TSize EPOC_ScreenSize;
   15.83 -    TUint8 *EPOC_FrameBuffer;   /* if NULL in HW we can't do direct screen access */
   15.84 -    TInt EPOC_ScreenOffset;
   15.85 -
   15.86 -    /* Simulate double screen height */
   15.87 -    TBool EPOC_ShrinkedHeight;
   15.88 -};
   15.89 -
   15.90 -extern "C"
   15.91 -{
   15.92 -    extern void RedrawWindowL(_THIS);
   15.93 -};
   15.94 -
   15.95 -
   15.96 -#endif /* _SDL_epocvideo_h */
   15.97 -/* vi: set ts=4 sw=4 expandtab: */