Updated OS/2 build, yay!
authorSam Lantinga <slouken@libsdl.org>
Sun, 26 Feb 2006 19:30:21 +0000
changeset 1442e3242177fe4a
parent 1441 b9f034536fa0
child 1443 9ebbbb4ae53b
Updated OS/2 build, yay!
Makefile.in
README.OS2
Watcom-OS2.zip
Watcom.mif
include/SDL_config.h
include/SDL_config.h.minimal
include/SDL_config_os2.h
include/SDL_thread.h
setvars.cmd
src/Makefile.wat
src/audio/Makefile.wat
src/audio/SDL_audio.c
src/audio/SDL_mixer.c
src/audio/SDL_mixer_MMX_VC.c
src/audio/SDL_mixer_MMX_VC.h
src/cdrom/Makefile.wat
src/cdrom/os2/SDL_syscdrom.c
src/cpuinfo/Makefile.wat
src/cpuinfo/SDL_cpuinfo.c
src/events/Makefile.wat
src/events/SDL_mouse.c
src/file/Makefile.wat
src/joystick/Makefile.wat
src/joystick/os2/SDL_sysjoystick.c
src/thread/Makefile.wat
src/thread/os2/SDL_systhread.c
src/timer/Makefile.wat
src/video/Makefile.wat
src/video/SDL_stretch.c
src/video/os2fslib/SDL_os2fslib.c
src/video/os2fslib/SDL_os2fslib.h
test/Makefile.wat
     1.1 --- a/Makefile.in	Sun Feb 26 13:42:00 2006 +0000
     1.2 +++ b/Makefile.in	Sun Feb 26 19:30:21 2006 +0000
     1.3 @@ -36,7 +36,7 @@
     1.4  SDLMAIN_SOURCES = @SDLMAIN_SOURCES@
     1.5  SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@
     1.6  
     1.7 -DIST = acinclude.m4 autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS CWprojects.sea.bin docs docs.html EpocBuildFiles.zip include INSTALL Makefile.dc Makefile.in MPWmake.sea.bin PBProjects.tar.gz README* sdl-config.in sdl.m4 SDL.qpg.in SDL.spec SDL.spec.in setvars.cmd src test TODO VisualCE.zip VisualC.html VisualC.zip Watcom.mif WhatsNew Xcode21.tar.gz Xcode.tar.gz XcodeUniversal.tar.gz
     1.8 +DIST = acinclude.m4 autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS CWprojects.sea.bin docs docs.html EpocBuildFiles.zip include INSTALL Makefile.dc Makefile.in MPWmake.sea.bin PBProjects.tar.gz README* sdl-config.in sdl.m4 SDL.qpg.in SDL.spec SDL.spec.in src test TODO VisualCE.zip VisualC.html VisualC.zip Watcom-OS2.zip WhatsNew Xcode21.tar.gz Xcode.tar.gz XcodeUniversal.tar.gz
     1.9  
    1.10  LT_AGE      = @LT_AGE@
    1.11  LT_CURRENT  = @LT_CURRENT@
     2.1 --- a/README.OS2	Sun Feb 26 13:42:00 2006 +0000
     2.2 +++ b/README.OS2	Sun Feb 26 19:30:21 2006 +0000
     2.3 @@ -3,7 +3,7 @@
     2.4  SDL on OS/2
     2.5  ===========
     2.6  
     2.7 -Last updated on Oct 02, 2005.
     2.8 +Last updated on Feb. 26, 2006.
     2.9  
    2.10  
    2.11  1. How to compile?
    2.12 @@ -16,6 +16,11 @@
    2.13  - The FSLib library
    2.14    (ftp://ftp.netlabs.org/pub/SDL)
    2.15  
    2.16 +First of all, you have to put the OS/2-specific Watcom makefiles into the
    2.17 +source code tree by unzipping the file Watcom-OS2.zip here.  This will
    2.18 +result in a Watcom.mif and a setvars.cmd file in this folder, and several
    2.19 +Makefile.wat files in the src\ folder and in some of its subfolders.
    2.20 +
    2.21  Please edit the second, fourth and fifth lines of setvars.cmd file
    2.22  to set the folders where the toolkit, the OW compiler and the FSLib are. 
    2.23  You won't need NASM yet (The Netwide Assembler), you can leave that line.
    2.24 @@ -107,7 +112,59 @@
    2.25  
    2.26  
    2.27  
    2.28 -6. Next steps...
    2.29 +6. Proportional windows
    2.30 +-----------------------
    2.31 +
    2.32 +For some SDL applications it can be handy to have proportional windows, so
    2.33 +the windows will keep their aspect ratio when resized.
    2.34 +This can be achieved in two ways:
    2.35 +
    2.36 +- Before starting the given SDL application, set the
    2.37 +  SDL_USE_PROPORTIONAL_WINDOW environment variable to something, e.g.:
    2.38 +
    2.39 +  SET SDL_USE_PROPORTIONAL_WINDOW=1
    2.40 +  dosbox.exe
    2.41 +
    2.42 +- If you have a HOME environment variable set, then SDL will look for a file
    2.43 +  in there called ".sdl.proportionals". If that file contains the name of the
    2.44 +  currently running SDL executable, then that process will have proportional
    2.45 +  windows automatically.
    2.46 +
    2.47 +  Please note that this file is created automatically with default values
    2.48 +  at the first run.
    2.49 +
    2.50 +
    2.51 +
    2.52 +7. Audio in SDL applications
    2.53 +----------------------------
    2.54 +
    2.55 +Audio effects are one of the most important features in games. Creating audio
    2.56 +effects in sync with the game and without hickups and pauses in the audio are
    2.57 +very important things.
    2.58 +
    2.59 +However there are multithreaded SDL applications that have tight loops as their
    2.60 +main logic loop. This kills performance in OS/2, and takes too much CPU from
    2.61 +other threads in the same process, for example from the thread to create the 
    2.62 +sound effects.
    2.63 +
    2.64 +For this reason, the OS/2 port of SDL can be instructed to run the audio thread
    2.65 +in high priority, which makes sure that there will be enough time for the 
    2.66 +processing of the audio data.
    2.67 +
    2.68 +At default, SDL/2 runs the audio thread at ForegroundServer+0 priority. Well 
    2.69 +written and well behaving SDL applications should work well in this mode.
    2.70 +For other applications, you can tell SDL/2 to run the audio thread at 
    2.71 +TimeCritical priority by setting an env.variable before starting the SDL app:
    2.72 +
    2.73 +    SET SDL_USE_TIMECRITICAL_AUDIO=1
    2.74 +
    2.75 +Please note that this is a bit risky, because if the SDL application runs a
    2.76 +tight infinite loop in this thread, this will make the whole system 
    2.77 +unresponsive, so use it with care, and only for applications that need it!
    2.78 +
    2.79 +
    2.80 +
    2.81 +8. Next steps...
    2.82  ----------------
    2.83  
    2.84  Things to do:
    2.85 @@ -119,7 +176,7 @@
    2.86  
    2.87  
    2.88  
    2.89 -7. Contacts
    2.90 +9. Contacts
    2.91  -----------
    2.92  
    2.93     You can contact the developers for bugs:
    2.94 @@ -131,3 +188,90 @@
    2.95     Notice however that SDL/2 is 'in development' stage so ... if you want to help,
    2.96  please, be our guest and contact us!
    2.97  
    2.98 +
    2.99 +
   2.100 +10. Changelog of the OS/2 port
   2.101 +------------------------------
   2.102 +
   2.103 +Version 1.2 - 2006-02-26  - Doodle
   2.104 + - Updated the official SDL version with the OS/2 specific changes.
   2.105 + - Added support for real unicode keycode conversion.
   2.106 +
   2.107 +Version 1.2.7 - 2006-01-20  - Doodle
   2.108 + - Added support for selectively using timecritical priority for
   2.109 +   audio threads by SDL_USE_TIMECRITICAL_AUDIO environment variable.
   2.110 +   (e.g.: 
   2.111 +    SET SDL_USE_TIMECRITICAL_AUDIO=1
   2.112 +    dosbox.exe
   2.113 +   )
   2.114 +
   2.115 +Version 1.2.7 - 2005-12-22  - Doodle
   2.116 + - Added support for proportional SDL windows.
   2.117 +   There are two ways to have proportional (aspect-keeping) windows for
   2.118 +   a given SDL application: Either set the SDL_USE_PROPORTIONAL_WINDOW
   2.119 +   environment variable to something before starting the application
   2.120 +   (e.g.: 
   2.121 +    SET SDL_USE_PROPORTIONAL_WINDOW=1
   2.122 +    dosbox.exe
   2.123 +   )
   2.124 +   or, if you have the HOME environment variable set, then SDL.DLL will
   2.125 +   create a file in that directory called .sdl.proportionals, and you can
   2.126 +   put there the name of executable files that will be automatically made
   2.127 +   proportional.
   2.128 +
   2.129 +Version 1.2.7 - 2005-10-14  - Doodle
   2.130 + - Enabled Exception handler code in FSLib to be able to restore original
   2.131 +   desktop video mode in case the application crashes.
   2.132 + - Added the missing FSLib_Uninitialize() call into SDL.
   2.133 +   (The lack of it did not cause problems, but it's cleaner this way.)
   2.134 + - Fixed a mouse problem in Fullscreen mode where any mouse click
   2.135 +   re-centered the mouse.
   2.136 +
   2.137 +Version 1.2.7 - 2005-10-09  - Doodle
   2.138 + - Implemented window icon support
   2.139 +
   2.140 +Version 1.2.7 - 2005-10-03  - Doodle
   2.141 + - Reworked semaphore support again
   2.142 + - Tuned thread priorities
   2.143 +
   2.144 +Version 1.2.7 - 2005-10-02  - Doodle
   2.145 + - Added support for custom mouse pointers
   2.146 + - Fixed WM_CLOSE processing: give a chance to SDL app to ask user...
   2.147 + - Added support for MMX-accelerated audio mixers
   2.148 + - Other small fixes
   2.149 +
   2.150 +Version 1.2.7 - 2005-09-12  - Doodle
   2.151 + - Small fixes for DosBox incorporated into public release
   2.152 + - Fixed semaphore support (SDL_syssem.c)
   2.153 + - Fixed FSLib to have good clipping in scaled window mode,
   2.154 +   and to prevent occasional desktop freezes.
   2.155 +
   2.156 +Version 1.2.7 - 2004-09-08a - Caetano
   2.157 +	- Improved joystick support (general verifications about hardware).
   2.158 +	- Added support up to 8 buttons in 2 axes joysticks and 6 buttons in 3 axes joysticks.
   2.159 +	- Added support to environment variable SDL_OS2_JOYSTICK to specify a joystick.
   2.160 +	- Improved Joystick test to handle every type of joystick and display only relevant information.
   2.161 +	- Merged with Doodle 2004-09-08
   2.162 +	- Little tid up in README.OS2
   2.163 +	- Added explanation about SDL_OS2_JOYSTICK environment variable on README.OS2
   2.164 +
   2.165 +Version 1.2.7 - 2004-09-07 - Caetano
   2.166 +	- Merged with changes in headers for GCC compiling.
   2.167 +	- Added Joystick support using basic IBM GAME$ support, allowing it to work with all joystick drivers since OS/2 2.1.
   2.168 +	- Improved joystick detection (hacked!). OS/2 do not allow real joystick detection, so... 
   2.169 +	- Modified makefile in test to compile "testjoystick". Anyway, it's useless, since it seems to cause a lot of trouble in OS/2 (because os video routines, not Joystick support).
   2.170 +	- Created separated Joystick test program to test only joystick functions.
   2.171 +	- Improved joystick auto-centering.
   2.172 +	- Improved the coordinate correction routine to use two scale factors for each axis.
   2.173 +
   2.174 +Version 1.2.7 - 2004-07-05 - Caetano
   2.175 +	- Corrected the time returned by status in CDROM support (it was incorrect)
   2.176 +	- Added the testcdrom.c and corrected the linking directive (it was causing an error)
   2.177 +
   2.178 +Version 1.2.7 - 2004-07-02a - Caetano
   2.179 +	- Corrected a little problem in a comment at SDL-1.2.7\test\torturethread.c, line 18 (missing */, nested comment)
   2.180 +	- Added CDROM support to tree (SDL-1.2.7\src\cdrom\os2\SDL_syscdrom.c)
   2.181 +	- Modified makefile (SDL-1.2.7\src\makefiles.wat and SDL-1.2.7\watcom.mif) to build with CDROM support
   2.182 +	- Added the "extra" SDL_types.h forgotten in 2004-07-02 version.
   2.183 +
   2.184 +<End-Of-File>
     3.1 Binary file Watcom-OS2.zip has changed
     4.1 --- a/Watcom.mif	Sun Feb 26 13:42:00 2006 +0000
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,33 +0,0 @@
     4.4 -#=============================================================================
     4.5 -#             This file contains the common includes for the
     4.6 -#               Watcom makefiles to build SDL.DLL for OS/2
     4.7 -#
     4.8 -#
     4.9 -#=============================================================================
    4.10 -
    4.11 -# Create debug build or not?
    4.12 -#debug_build=defined
    4.13 -
    4.14 -# Special flags for building SDL
    4.15 -SDLCFlags = -dBUILD_SDL -dCHECK_LEAKS
    4.16 -
    4.17 -#
    4.18 -#==============================================================================
    4.19 -#
    4.20 -
    4.21 -!ifdef debug_build
    4.22 -debugflags = -d2 -dDEBUG_BUILD
    4.23 -!else
    4.24 -debugflags =
    4.25 -!endif
    4.26 -
    4.27 -cflags = -zq $(debugflags) -bd -bm -bt=OS2 -5s -fpi -sg -otexan -wx -ei $(SDLCFlags) $(ExtraCFlags)
    4.28 -
    4.29 -.extensions:
    4.30 -.extensions: .lib .dll .obj .c .asm
    4.31 -
    4.32 -.c.obj : .AUTODEPEND
    4.33 -    wcc386 $[* $(cflags)
    4.34 -
    4.35 -.asm.obj : .AUTODEPEND
    4.36 -    nasm -t -O2 -f obj -I$(%include) $[*.asm
     5.1 --- a/include/SDL_config.h	Sun Feb 26 13:42:00 2006 +0000
     5.2 +++ b/include/SDL_config.h	Sun Feb 26 19:30:21 2006 +0000
     5.3 @@ -36,6 +36,8 @@
     5.4  #include "SDL_config_macosx.h"
     5.5  #elif defined(__WIN32__)
     5.6  #include "SDL_config_win32.h"
     5.7 +#elif defined(__OS2__)
     5.8 +#include "SDL_config_os2.h"
     5.9  #else
    5.10  /* This is the minimal configuration that can be used to build SDL */
    5.11  
     6.1 --- a/include/SDL_config.h.minimal	Sun Feb 26 13:42:00 2006 +0000
     6.2 +++ b/include/SDL_config.h.minimal	Sun Feb 26 19:30:21 2006 +0000
     6.3 @@ -36,6 +36,8 @@
     6.4  #include "SDL_config_macosx.h"
     6.5  #elif defined(__WIN32__)
     6.6  #include "SDL_config_win32.h"
     6.7 +#elif defined(__OS2__)
     6.8 +#include "SDL_config_os2.h"
     6.9  #else
    6.10  /* This is the minimal configuration that can be used to build SDL */
    6.11  
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/include/SDL_config_os2.h	Sun Feb 26 19:30:21 2006 +0000
     7.3 @@ -0,0 +1,136 @@
     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_os2_h
    7.27 +#define _SDL_config_os2_h
    7.28 +
    7.29 +/* This is a set of defines to configure the SDL features */
    7.30 +
    7.31 +typedef signed char         int8_t;
    7.32 +typedef unsigned char       uint8_t;
    7.33 +typedef signed short        int16_t;
    7.34 +typedef unsigned short      uint16_t;
    7.35 +typedef signed int          int32_t;
    7.36 +typedef unsigned int        uint32_t;
    7.37 +typedef unsigned int        size_t;
    7.38 +typedef unsigned long       uintptr_t;
    7.39 +typedef signed long long    int64_t;
    7.40 +typedef unsigned long long  uint64_t;
    7.41 +
    7.42 +#define SDL_HAS_64BIT_TYPE	1
    7.43 +
    7.44 +/* Use Watcom's LIBC */
    7.45 +#define HAVE_LIBC 1
    7.46 +
    7.47 +/* Useful headers */
    7.48 +#define HAVE_SYS_TYPES_H 1
    7.49 +#define HAVE_STDIO_H 1
    7.50 +#define STDC_HEADERS 1
    7.51 +#define HAVE_STDLIB_H 1
    7.52 +#define HAVE_STDARG_H 1
    7.53 +#define HAVE_MALLOC_H 1
    7.54 +#define HAVE_MEMORY_H 1
    7.55 +#define HAVE_STRING_H 1
    7.56 +#define HAVE_STRINGS_H 1
    7.57 +#define HAVE_INTTYPES_H 1
    7.58 +#define HAVE_STDINT_H 1
    7.59 +#define HAVE_CTYPE_H 1
    7.60 +#define HAVE_MATH_H 1
    7.61 +#define HAVE_SIGNAL_H 1
    7.62 +
    7.63 +/* C library functions */
    7.64 +#define HAVE_MALLOC 1
    7.65 +#define HAVE_CALLOC 1
    7.66 +#define HAVE_REALLOC 1
    7.67 +#define HAVE_FREE 1
    7.68 +#define HAVE_ALLOCA 1
    7.69 +#define HAVE_GETENV 1
    7.70 +#define HAVE_PUTENV 1
    7.71 +#define HAVE_UNSETENV 1
    7.72 +#define HAVE_QSORT 1
    7.73 +#define HAVE_ABS 1
    7.74 +#define HAVE_BCOPY 1
    7.75 +#define HAVE_MEMSET 1
    7.76 +#define HAVE_MEMCPY 1
    7.77 +#define HAVE_MEMMOVE 1
    7.78 +#define HAVE_MEMCMP 1
    7.79 +#define HAVE_STRLEN 1
    7.80 +#define HAVE_STRLCPY 1
    7.81 +#define HAVE_STRLCAT 1
    7.82 +#define HAVE_STRDUP 1
    7.83 +#define HAVE__STRREV 1
    7.84 +#define HAVE__STRUPR 1
    7.85 +#define HAVE__STRLWR 1
    7.86 +#define HAVE_INDEX 1
    7.87 +#define HAVE_RINDEX 1
    7.88 +#define HAVE_STRCHR 1
    7.89 +#define HAVE_STRRCHR 1
    7.90 +#define HAVE_STRSTR 1
    7.91 +#define HAVE_ITOA 1
    7.92 +#define HAVE__LTOA 1
    7.93 +#define HAVE__UITOA 1
    7.94 +#define HAVE__ULTOA 1
    7.95 +#define HAVE_STRTOL 1
    7.96 +#define HAVE__I64TOA 1
    7.97 +#define HAVE__UI64TOA 1
    7.98 +#define HAVE_STRTOLL 1
    7.99 +#define HAVE_STRTOD 1
   7.100 +#define HAVE_ATOI 1
   7.101 +#define HAVE_ATOF 1
   7.102 +#define HAVE_STRCMP 1
   7.103 +#define HAVE_STRNCMP 1
   7.104 +#define HAVE_STRICMP 1
   7.105 +#define HAVE_STRCASECMP 1
   7.106 +#define HAVE_SSCANF 1
   7.107 +#define HAVE_SNPRINTF 1
   7.108 +#define HAVE_VSNPRINTF 1
   7.109 +#define HAVE_SETJMP 1
   7.110 +#define HAVE_CLOCK_GETTIME 1
   7.111 +
   7.112 +/* Enable various audio drivers */
   7.113 +#define SDL_AUDIO_DRIVER_DART	1
   7.114 +
   7.115 +/* Enable various cdrom drivers */
   7.116 +#define SDL_CDROM_OS2	1
   7.117 +
   7.118 +/* Enable various input drivers */
   7.119 +#define SDL_JOYSTICK_OS2	1
   7.120 +
   7.121 +/* Enable various shared object loading systems */
   7.122 +#define SDL_LOADSO_OS2	1
   7.123 +
   7.124 +/* Enable various threading systems */
   7.125 +#define SDL_THREAD_OS2	1
   7.126 +
   7.127 +/* Enable various timer systems */
   7.128 +#define SDL_TIMER_OS2	1
   7.129 +
   7.130 +/* Enable various video drivers */
   7.131 +#define SDL_VIDEO_DRIVER_OS2FS	1
   7.132 +
   7.133 +/* Enable OpenGL support */
   7.134 +/* Nothing here yet for OS/2... :( */
   7.135 +
   7.136 +/* Enable assembly routines where available */
   7.137 +#define SDL_ASSEMBLY_ROUTINES	1
   7.138 +
   7.139 +#endif /* _SDL_config_os2_h */
     8.1 --- a/include/SDL_thread.h	Sun Feb 26 13:42:00 2006 +0000
     8.2 +++ b/include/SDL_thread.h	Sun Feb 26 19:30:21 2006 +0000
     8.3 @@ -65,8 +65,8 @@
     8.4  #endif
     8.5  
     8.6  #ifdef __OS2__
     8.7 -typedef int (__cdecl *pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void *arg); 
     8.8 -typedef void (__cdecl *pfnSDL_CurrentEndThread)(void);
     8.9 +typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void *arg); 
    8.10 +typedef void (*pfnSDL_CurrentEndThread)(void);
    8.11  #else
    8.12  #ifdef __GNUC__
    8.13  #include <stdint.h>
     9.1 --- a/setvars.cmd	Sun Feb 26 13:42:00 2006 +0000
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,16 +0,0 @@
     9.4 -@ECHO OFF
     9.5 -SET WATCOM=d:\watcom
     9.6 -SET NASM=d:\nasm
     9.7 -SET OS2TK=d:\os2tk45
     9.8 -SET FSLIB=d:\watcom\projects\FSLib
     9.9 -
    9.10 -SET PATH=%WATCOM%\BINP;%WATCOM%\BINW;%os2tk%\bin;%NASM%;%PATH%
    9.11 -SET INCLUDE=%WATCOM%\H;%WATCOM%\H\OS2
    9.12 -SET FINCLUDE=%WATCOM%\SRC\FORTRAN
    9.13 -SET EDPATH=%WATCOM%\EDDAT
    9.14 -SET HELP=%WATCOM%\BINP\HELP;%HELP%
    9.15 -SET BOOKSHELF=%WATCOM%\BINP\HELP;%BOOKSHELF%
    9.16 -SET BEGINLIBPATH=%WATCOM%\BINP\DLL
    9.17 -
    9.18 -cmd
    9.19 -
    10.1 --- a/src/Makefile.wat	Sun Feb 26 13:42:00 2006 +0000
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,132 +0,0 @@
    10.4 -#=============================================================================
    10.5 -#          This is a Watcom makefile to build SDL.DLL for OS/2
    10.6 -#
    10.7 -#
    10.8 -#=============================================================================
    10.9 -
   10.10 -dllname=SDL
   10.11 -
   10.12 -audioobjs = audio\SDL_audio.obj audio\SDL_audiocvt.obj audio\SDL_audiomem.obj &
   10.13 -            audio\SDL_mixer.obj audio\SDL_mixer_MMX_VC.obj audio\SDL_wave.obj &
   10.14 -            audio\SDL_dart.obj
   10.15 -cdromobjs = cdrom\SDL_cdrom.obj cdrom\SDL_syscdrom.obj
   10.16 -cpuinfoobjs = cpuinfo\SDL_cpuinfo.obj
   10.17 -endianobjs = endian\SDL_endian.obj
   10.18 -eventsobjs = events\SDL_active.obj events\SDL_events.obj events\SDL_expose.obj &
   10.19 -             events\SDL_keyboard.obj events\SDL_mouse.obj events\SDL_quit.obj &
   10.20 -             events\SDL_resize.obj
   10.21 -fileobjs = file\SDL_rwops.obj
   10.22 -hermesobjs = hermes\mmx_main.obj hermes\mmxp2_32.obj hermes\x86_main.obj &
   10.23 -             hermes\x86p_16.obj hermes\x86p_32.obj
   10.24 -joystickobjs = joystick\SDL_joystick.obj joystick\SDL_sysjoystick.obj
   10.25 -threadobjs = thread\SDL_thread.obj thread\SDL_sysmutex.obj &
   10.26 -             thread\SDL_syssem.obj thread\SDL_systhread.obj &
   10.27 -             thread\SDL_syscond.obj
   10.28 -timerobjs = timer\SDL_timer.obj timer\SDL_systimer.obj
   10.29 -videoobjs = video\SDL_blit.obj video\SDL_blit_0.obj video\SDL_blit_1.obj &
   10.30 -            video\SDL_blit_A.obj video\SDL_blit_N.obj video\SDL_bmp.obj &
   10.31 -            video\SDL_cursor.obj video\SDL_gamma.obj video\SDL_pixels.obj &
   10.32 -            video\SDL_RLEaccel.obj video\SDL_stretch.obj video\SDL_surface.obj &
   10.33 -            video\SDL_video.obj video\SDL_yuv.obj video\SDL_yuv_mmx.obj &
   10.34 -            video\SDL_yuv_sw.obj video\SDL_os2fslib.obj
   10.35 -
   10.36 -object_files= SDL.obj SDL_error.obj SDL_fatal.obj SDL_getenv.obj &
   10.37 -              SDL_loadso.obj $(audioobjs) $(cpuinfoobjs) $(endianobjs) &
   10.38 -              $(eventsobjs) $(fileobjs) $(joystickobjs) &
   10.39 -              $(threadobjs) $(timerobjs) $(videoobjs) $(cdromobjs)
   10.40 -	      
   10.41 -
   10.42 -# Extra stuffs to pass to C compiler:
   10.43 -ExtraCFlags=
   10.44 -
   10.45 -#
   10.46 -#==============================================================================
   10.47 -#
   10.48 -!include ..\Watcom.mif
   10.49 -
   10.50 -.before
   10.51 -    @set include=$(%os2tk)\h;$(%include);../include;./thread;./thread/os2;./video;./cdrom;./cdrom/os2;./joystick;./joystick/os2;
   10.52 -
   10.53 -all : check_subdir_objects $(dllname).dll $(dllname).lib
   10.54 -
   10.55 -$(dllname).dll : $(dllname).lnk $(object_files)
   10.56 -    wlink @$(dllname)
   10.57 -
   10.58 -check_subdir_objects: .always .symbolic
   10.59 -    @cd audio
   10.60 -    @wmake -h -f Makefile.wat
   10.61 -    @cd ..\cdrom
   10.62 -    @wmake -h -f Makefile.wat
   10.63 -    @cd ..\cpuinfo
   10.64 -    @wmake -h -f Makefile.wat
   10.65 -    @cd ..\endian
   10.66 -    @wmake -h -f Makefile.wat
   10.67 -    @cd ..\events
   10.68 -    @wmake -h -f Makefile.wat
   10.69 -    @cd ..\file
   10.70 -    @wmake -h -f Makefile.wat
   10.71 -    @cd ..\joystick
   10.72 -    @wmake -h -f Makefile.wat
   10.73 -    @cd ..\thread
   10.74 -    @wmake -h -f Makefile.wat
   10.75 -    @cd ..\timer
   10.76 -    @wmake -h -f Makefile.wat
   10.77 -    @cd ..\video
   10.78 -    @wmake -h -f Makefile.wat
   10.79 -    @cd ..
   10.80 -
   10.81 -$(dllname).lnk :
   10.82 -    @echo Creating linker file ($(dllname).lnk)...
   10.83 -    @echo $#============================================================================= >$^@
   10.84 -    @echo $#              This is a linker file to build SDL.DLL for OS/2 >>$^@
   10.85 -    @echo $# >>$^@
   10.86 -    @echo $# Generated automatically by Makefile.wat >>$^@
   10.87 -    @echo $#============================================================================= >>$^@
   10.88 -    @echo SYSTEM 386 LX DLL INITINSTANCE TERMINSTANCE >>$^@
   10.89 -    @echo NAME $^& >>$^@
   10.90 -    @for %i in ($(object_files)) do @echo FILE %i >>$^@
   10.91 -    @echo LIBPATH %os2tk%\lib >>$^@
   10.92 -    @echo LIBPATH %fslib% >>$^@
   10.93 -    @echo LIB mmpm2.lib >>$^@
   10.94 -    @echo LIB fslib.lib >>$^@
   10.95 -    @echo OPTION QUIET >>$^@
   10.96 -    @echo OPTION MAP=$^&.map >>$^@
   10.97 -    @echo OPTION DESCRIPTION 'Simple DirectMedia Layer v1.2.7' >>$^@
   10.98 -    @echo OPTION ELIMINATE >>$^@
   10.99 -    @echo OPTION MANYAUTODATA >>$^@
  10.100 -    @echo OPTION OSNAME='OS/2 and eComStation' >>$^@
  10.101 -    @echo OPTION SHOWDEAD >>$^@
  10.102 -    @echo Linker file created!
  10.103 -
  10.104 -$(dllname).lib : $(dllname).dll
  10.105 -    implib $(dllname).lib $(dllname).dll
  10.106 -
  10.107 -clean : .SYMBOLIC
  10.108 -    @if exist *.dll del *.dll
  10.109 -    @if exist *.lib del *.lib
  10.110 -    @if exist *.obj del *.obj
  10.111 -    @if exist *.lnk del *.lnk
  10.112 -    @if exist *.map del *.map
  10.113 -    @if exist *.res del *.res
  10.114 -    @if exist *.lst del *.lst
  10.115 -    @cd audio
  10.116 -    @wmake -h -f Makefile.wat clean
  10.117 -    @cd ..\cdrom
  10.118 -    @wmake -h -f Makefile.wat clean
  10.119 -    @cd ..\cpuinfo
  10.120 -    @wmake -h -f Makefile.wat clean
  10.121 -    @cd ..\endian
  10.122 -    @wmake -h -f Makefile.wat clean
  10.123 -    @cd ..\events
  10.124 -    @wmake -h -f Makefile.wat clean
  10.125 -    @cd ..\file
  10.126 -    @wmake -h -f Makefile.wat clean
  10.127 -    @cd ..\joystick
  10.128 -    @wmake -h -f Makefile.wat clean
  10.129 -    @cd ..\thread
  10.130 -    @wmake -h -f Makefile.wat clean
  10.131 -    @cd ..\timer
  10.132 -    @wmake -h -f Makefile.wat clean
  10.133 -    @cd ..\video
  10.134 -    @wmake -h -f Makefile.wat clean
  10.135 -    @cd ..
    11.1 --- a/src/audio/Makefile.wat	Sun Feb 26 13:42:00 2006 +0000
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,27 +0,0 @@
    11.4 -#=============================================================================
    11.5 -#          This is a Watcom makefile to build SDL.DLL for OS/2
    11.6 -#
    11.7 -# Makefile for DART (audio support)
    11.8 -#=============================================================================
    11.9 -
   11.10 -object_files= SDL_audio.obj SDL_audiocvt.obj SDL_audiomem.obj SDL_mixer.obj SDL_mixer_MMX_VC.obj SDL_wave.obj SDL_dart.obj
   11.11 -ExtraCFlags=-dUSE_ASM_MIXER_VC -dUSE_DOSSETPRIORITY
   11.12 -
   11.13 -#
   11.14 -#==============================================================================
   11.15 -#
   11.16 -!include ..\..\Watcom.mif
   11.17 -
   11.18 -.before
   11.19 -    set include=$(%os2tk)\h;$(%include);../../include;./dart
   11.20 -
   11.21 -all : $(object_files)
   11.22 -
   11.23 -SDL_dart.obj: .AUTODEPEND
   11.24 -    wcc386 dart\SDL_dart.c $(cflags)
   11.25 -
   11.26 -clean : .SYMBOLIC
   11.27 -        @if exist *.obj del *.obj
   11.28 -        @if exist *.map del *.map
   11.29 -        @if exist *.res del *.res
   11.30 -        @if exist *.lst del *.lst
    12.1 --- a/src/audio/SDL_audio.c	Sun Feb 26 13:42:00 2006 +0000
    12.2 +++ b/src/audio/SDL_audio.c	Sun Feb 26 19:30:21 2006 +0000
    12.3 @@ -181,10 +181,20 @@
    12.4          // Increase the priority of this thread to make sure that
    12.5          // the audio will be continuous all the time!
    12.6  #ifdef USE_DOSSETPRIORITY
    12.7 +        if (SDL_getenv("SDL_USE_TIMECRITICAL_AUDIO"))
    12.8 +        {
    12.9  #ifdef DEBUG_BUILD
   12.10 -        printf("[SDL_RunAudio] : Setting priority to ForegroundServer+0! (TID%d)\n", SDL_ThreadID());
   12.11 +          printf("[SDL_RunAudio] : Setting priority to TimeCritical+0! (TID%d)\n", SDL_ThreadID());
   12.12  #endif
   12.13 -        DosSetPriority(PRTYS_THREAD, PRTYC_FOREGROUNDSERVER, 0, 0);
   12.14 +          DosSetPriority(PRTYS_THREAD, PRTYC_TIMECRITICAL, 0, 0);
   12.15 +        }
   12.16 +        else
   12.17 +        {
   12.18 +#ifdef DEBUG_BUILD
   12.19 +          printf("[SDL_RunAudio] : Setting priority to ForegroundServer+0! (TID%d)\n", SDL_ThreadID());
   12.20 +#endif
   12.21 +          DosSetPriority(PRTYS_THREAD, PRTYC_FOREGROUNDSERVER, 0, 0);
   12.22 +        }
   12.23  #endif
   12.24  #endif
   12.25  
    13.1 --- a/src/audio/SDL_mixer.c	Sun Feb 26 13:42:00 2006 +0000
    13.2 +++ b/src/audio/SDL_mixer.c	Sun Feb 26 19:30:21 2006 +0000
    13.3 @@ -134,8 +134,7 @@
    13.4  				SDL_MixAudio_MMX_S8((char*)dst,(char*)src,(unsigned int)len,(int)volume);
    13.5  			}
    13.6  			else
    13.7 -#endif
    13.8 -#if defined(_MSC_VER) && defined(M_I86) && defined(SDL_ASSEMBLY_ROUTINES)
    13.9 +#elif ((defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)) && defined(SDL_ASSEMBLY_ROUTINES)
   13.10  			if (SDL_HasMMX())
   13.11  			{
   13.12  				SDL_MixAudio_MMX_S8_VC((char*)dst,(char*)src,(unsigned int)len,(int)volume);
   13.13 @@ -180,8 +179,8 @@
   13.14  			{
   13.15  				SDL_MixAudio_MMX_S16((char*)dst,(char*)src,(unsigned int)len,(int)volume);
   13.16  			}
   13.17 -			else
   13.18 -#elif defined(USE_ASM_MIXER_VC)
   13.19 +                        else
   13.20 +#elif ((defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)) && defined(SDL_ASSEMBLY_ROUTINES)
   13.21  			if (SDL_HasMMX())
   13.22  			{
   13.23  				SDL_MixAudio_MMX_S16_VC((char*)dst,(char*)src,(unsigned int)len,(int)volume);
    14.1 --- a/src/audio/SDL_mixer_MMX_VC.c	Sun Feb 26 13:42:00 2006 +0000
    14.2 +++ b/src/audio/SDL_mixer_MMX_VC.c	Sun Feb 26 19:30:21 2006 +0000
    14.3 @@ -23,7 +23,7 @@
    14.4  
    14.5  #include "SDL_mixer_MMX_VC.h"
    14.6  
    14.7 -#if defined(_MSC_VER) && defined(M_I86) && defined(SDL_ASSEMBLY_ROUTINES)
    14.8 +#if ((defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)) && defined(SDL_ASSEMBLY_ROUTINES)
    14.9  // MMX assembler version of SDL_MixAudio for signed little endian 16 bit samples and signed 8 bit samples
   14.10  // Copyright 2002 Stephane Marchesin (stephane.marchesin@wanadoo.fr)
   14.11  // Converted to Intel ASM notation by Cth
    15.1 --- a/src/audio/SDL_mixer_MMX_VC.h	Sun Feb 26 13:42:00 2006 +0000
    15.2 +++ b/src/audio/SDL_mixer_MMX_VC.h	Sun Feb 26 19:30:21 2006 +0000
    15.3 @@ -21,7 +21,7 @@
    15.4  */
    15.5  #include "SDL_config.h"
    15.6  
    15.7 -#if defined(_MSC_VER) && defined(M_I86) && defined(SDL_ASSEMBLY_ROUTINES)
    15.8 +#if ((defined(_MSC_VER) && defined(M_I86)) || (defined(__WATCOMC__))) && defined(SDL_ASSEMBLY_ROUTINES)
    15.9  // headers for MMX assembler version of SDL_MixAudio
   15.10  // Copyright 2002 Stephane Marchesin (stephane.marchesin@wanadoo.fr)
   15.11  // Converted to Intel ASM notation by Cth
    16.1 --- a/src/cdrom/Makefile.wat	Sun Feb 26 13:42:00 2006 +0000
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,30 +0,0 @@
    16.4 -#=============================================================================
    16.5 -#          This is a Watcom makefile to build SDL.DLL for OS/2
    16.6 -#
    16.7 -# Makefile for OS/2 System CDROM support
    16.8 -#=============================================================================
    16.9 -
   16.10 -object_files=SDL_syscdrom.obj SDL_cdrom.obj
   16.11 -ExtraCFlags=
   16.12 -
   16.13 -#
   16.14 -#==============================================================================
   16.15 -#
   16.16 -!include ..\..\Watcom.mif
   16.17 -
   16.18 -.before
   16.19 -    set include=$(%os2tk)\h;$(%include);../../include;./os2;../;
   16.20 -
   16.21 -all : $(object_files)
   16.22 -
   16.23 -SDL_syscdrom.obj : .AUTODEPEND
   16.24 -    wcc386 os2\SDL_syscdrom.c $(cflags)
   16.25 -
   16.26 -SDL_cdrom.obj : .AUTODEPEND
   16.27 -    wcc386 SDL_cdrom.c $(cflags)
   16.28 -
   16.29 -clean : .SYMBOLIC
   16.30 -        @if exist *.obj del *.obj
   16.31 -        @if exist *.map del *.map
   16.32 -        @if exist *.res del *.res
   16.33 -        @if exist *.lst del *.lst
    17.1 --- a/src/cdrom/os2/SDL_syscdrom.c	Sun Feb 26 13:42:00 2006 +0000
    17.2 +++ b/src/cdrom/os2/SDL_syscdrom.c	Sun Feb 26 19:30:21 2006 +0000
    17.3 @@ -293,7 +293,7 @@
    17.4  	if (msp.ulReturn == MCI_MODE_PAUSE)
    17.5  		{
    17.6  		mgp.hwndCallback = (HWND)NULL;		// None
    17.7 -		mciSendCommand(cdrom->id,MCI_RESUME,NULL,&mgp, 0);
    17.8 +		mciSendCommand(cdrom->id,MCI_RESUME,0,&mgp, 0);
    17.9  		}
   17.10  	}
   17.11  /* Now play it. */
   17.12 @@ -338,7 +338,7 @@
   17.13  	if (msp.ulReturn == MCI_MODE_PAUSE)
   17.14  		{
   17.15  		mgp.hwndCallback = (HWND)NULL;		// None
   17.16 -		mciSendCommand(cdrom->id,MCI_RESUME,NULL,&mgp, 0);
   17.17 +		mciSendCommand(cdrom->id,MCI_RESUME,0,&mgp, 0);
   17.18  		}
   17.19  	}
   17.20  /* Now stops the media */
    18.1 --- a/src/cpuinfo/Makefile.wat	Sun Feb 26 13:42:00 2006 +0000
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,27 +0,0 @@
    18.4 -#=============================================================================
    18.5 -#          This is a Watcom makefile to build SDL.DLL for OS/2
    18.6 -#
    18.7 -# Makefile for cpuinfo
    18.8 -#=============================================================================
    18.9 -
   18.10 -object_files=SDL_cpuinfo.obj
   18.11 -
   18.12 -# We have to define the following so the assembly parts can be
   18.13 -# compiled by Watcom, too!
   18.14 -ExtraCFlags=-d_MSC_VER
   18.15 -
   18.16 -#
   18.17 -#==============================================================================
   18.18 -#
   18.19 -!include ..\..\Watcom.mif
   18.20 -
   18.21 -.before
   18.22 -    set include=$(%os2tk)\h;$(%include);../../include
   18.23 -
   18.24 -all : $(object_files)
   18.25 -
   18.26 -clean : .SYMBOLIC
   18.27 -        @if exist *.obj del *.obj
   18.28 -        @if exist *.map del *.map
   18.29 -        @if exist *.res del *.res
   18.30 -        @if exist *.lst del *.lst
    19.1 --- a/src/cpuinfo/SDL_cpuinfo.c	Sun Feb 26 13:42:00 2006 +0000
    19.2 +++ b/src/cpuinfo/SDL_cpuinfo.c	Sun Feb 26 19:30:21 2006 +0000
    19.3 @@ -96,7 +96,7 @@
    19.4  	:
    19.5  	: "%rax", "%rcx"
    19.6  	);
    19.7 -#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_X86_))
    19.8 +#elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
    19.9  	__asm {
   19.10          pushfd                      ; Get original EFLAGS
   19.11          pop     eax
   19.12 @@ -165,7 +165,7 @@
   19.13  	:
   19.14  	: "%eax", "%ecx", "%edx", "%edi"
   19.15  	);
   19.16 -#elif defined(_MSC_VER)  && (defined(_M_IX86) || defined(_X86_))
   19.17 +#elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
   19.18  	__asm {
   19.19          xor     eax, eax            ; Set up for CPUID instruction
   19.20          cpuid                       ; Get and save vendor ID
   19.21 @@ -217,7 +217,7 @@
   19.22  	:
   19.23  	: "%eax", "%ecx", "%edx", "%edi"
   19.24  	);
   19.25 -#elif defined(_MSC_VER)  && (defined(_M_IX86) || defined(_X86_))
   19.26 +#elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
   19.27  	__asm {
   19.28          mov     eax,80000000h       ; Query for extended functions
   19.29          cpuid                       ; Get extended function limit
    20.1 --- a/src/events/Makefile.wat	Sun Feb 26 13:42:00 2006 +0000
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,24 +0,0 @@
    20.4 -#=============================================================================
    20.5 -#          This is a Watcom makefile to build SDL.DLL for OS/2
    20.6 -#
    20.7 -# Makefile for events
    20.8 -#=============================================================================
    20.9 -
   20.10 -object_files=SDL_active.obj SDL_events.obj SDL_expose.obj SDL_keyboard.obj SDL_mouse.obj SDL_quit.obj SDL_resize.obj
   20.11 -ExtraCFlags=-dUSE_DOSSETPRIORITY
   20.12 -
   20.13 -#
   20.14 -#==============================================================================
   20.15 -#
   20.16 -!include ..\..\Watcom.mif
   20.17 -
   20.18 -.before
   20.19 -    set include=$(%os2tk)\h;$(%include);../../include;../timer;../joystick;../video;
   20.20 -
   20.21 -all : $(object_files)
   20.22 -
   20.23 -clean : .SYMBOLIC
   20.24 -        @if exist *.obj del *.obj
   20.25 -        @if exist *.map del *.map
   20.26 -        @if exist *.res del *.res
   20.27 -        @if exist *.lst del *.lst
    21.1 --- a/src/events/SDL_mouse.c	Sun Feb 26 13:42:00 2006 +0000
    21.2 +++ b/src/events/SDL_mouse.c	Sun Feb 26 19:30:21 2006 +0000
    21.3 @@ -176,7 +176,7 @@
    21.4  	SDL_MouseY = Y;
    21.5  	SDL_DeltaX += Xrel;
    21.6  	SDL_DeltaY += Yrel;
    21.7 -	SDL_MoveCursor(SDL_MouseX, SDL_MouseY);
    21.8 +        SDL_MoveCursor(SDL_MouseX, SDL_MouseY);
    21.9  
   21.10  	/* Post the event, if desired */
   21.11  	posted = 0;
    22.1 --- a/src/file/Makefile.wat	Sun Feb 26 13:42:00 2006 +0000
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,24 +0,0 @@
    22.4 -#=============================================================================
    22.5 -#          This is a Watcom makefile to build SDL.DLL for OS/2
    22.6 -#
    22.7 -# Makefile for file
    22.8 -#=============================================================================
    22.9 -
   22.10 -object_files=SDL_rwops.obj
   22.11 -ExtraCFlags=
   22.12 -
   22.13 -#
   22.14 -#==============================================================================
   22.15 -#
   22.16 -!include ..\..\Watcom.mif
   22.17 -
   22.18 -.before
   22.19 -    set include=$(%os2tk)\h;$(%include);../../include
   22.20 -
   22.21 -all : $(object_files)
   22.22 -
   22.23 -clean : .SYMBOLIC
   22.24 -        @if exist *.obj del *.obj
   22.25 -        @if exist *.map del *.map
   22.26 -        @if exist *.res del *.res
   22.27 -        @if exist *.lst del *.lst
    23.1 --- a/src/joystick/Makefile.wat	Sun Feb 26 13:42:00 2006 +0000
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,27 +0,0 @@
    23.4 -#=============================================================================
    23.5 -#          This is a Watcom makefile to build SDL.DLL for OS/2
    23.6 -#
    23.7 -# Makefile for joystick (using the dummy joystick driver)
    23.8 -#=============================================================================
    23.9 -
   23.10 -object_files=SDL_joystick.obj SDL_sysjoystick.obj
   23.11 -ExtraCFlags=
   23.12 -
   23.13 -#
   23.14 -#==============================================================================
   23.15 -#
   23.16 -!include ..\..\Watcom.mif
   23.17 -
   23.18 -.before
   23.19 -    set include=$(%os2tk)\h;$(%include);../../include;./os2;../;../events;
   23.20 -
   23.21 -all : $(object_files)
   23.22 -
   23.23 -SDL_sysjoystick.obj: .AUTODEPEND
   23.24 -    wcc386 os2\SDL_sysjoystick.c $(cflags)
   23.25 -
   23.26 -clean : .SYMBOLIC
   23.27 -        @if exist *.obj del *.obj
   23.28 -        @if exist *.map del *.map
   23.29 -        @if exist *.res del *.res
   23.30 -        @if exist *.lst del *.lst
    24.1 --- a/src/joystick/os2/SDL_sysjoystick.c	Sun Feb 26 13:42:00 2006 +0000
    24.2 +++ b/src/joystick/os2/SDL_sysjoystick.c	Sun Feb 26 19:30:21 2006 +0000
    24.3 @@ -32,6 +32,7 @@
    24.4  #include "joyos2.h"
    24.5  
    24.6  #include "SDL_joystick.h"
    24.7 +#include "SDL_events.h"
    24.8  #include "../SDL_sysjoystick.h"
    24.9  #include "../SDL_joystick_c.h"
   24.10  
   24.11 @@ -50,7 +51,7 @@
   24.12  #define JOY_BUTTON_FLAG(n) (1<<n)
   24.13  
   24.14  /* Joystick data... hold information about detected devices */
   24.15 -struct _SYS_JoyData
   24.16 +typedef struct SYS_JoyData_s
   24.17  {
   24.18  Sint8					id;								// Device ID
   24.19  char					szDeviceName[MAX_JOYNAME];	// Device Name
   24.20 @@ -62,7 +63,9 @@
   24.21  int					axes_med[MAX_AXES];			// medium callibration value for axes
   24.22  int					axes_max[MAX_AXES];			// maximum callibration value for axes
   24.23  int					buttoncalc[4];					// Used for buttons 5, 6, 7 and 8.
   24.24 -} SYS_JoyData[MAX_JOYSTICKS];
   24.25 +} SYS_JoyData_t, *SYS_JoyData_p;
   24.26 +
   24.27 +SYS_JoyData_t SYS_JoyData[MAX_JOYSTICKS];
   24.28  
   24.29  
   24.30  /* Structure used to convert data from OS/2 driver format to SDL format */
   24.31 @@ -292,16 +295,16 @@
   24.32  			}
   24.33  		/* Hack to define Joystick Port Names */
   24.34  		if ( numdevs > maxdevs ) numdevs = maxdevs;
   24.35 -		for (i=0; i<numdevs; i++) {
   24.36 -			SDL_snprintf (SYS_JoyData[i].szDeviceName, SDL_arraysize(szDeviceName), "Default Joystick %c", 'A'+SYS_JoyData[i].id);
   24.37 -		}
   24.38 +		for (i=0; i<numdevs; i++)
   24.39 +                  SDL_snprintf (SYS_JoyData[i].szDeviceName, SDL_arraysize(SYS_JoyData[i].szDeviceName), "Default Joystick %c", 'A'+SYS_JoyData[i].id);
   24.40 +
   24.41 +                }
   24.42  	}
   24.43  /* Return the number of devices found */
   24.44  return(numdevs);
   24.45  }
   24.46  
   24.47  
   24.48 -
   24.49  /***********************************************************/
   24.50  /* Function to get the device-dependent name of a joystick */
   24.51  /***********************************************************/
    25.1 --- a/src/thread/Makefile.wat	Sun Feb 26 13:42:00 2006 +0000
    25.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.3 @@ -1,36 +0,0 @@
    25.4 -#=============================================================================
    25.5 -#          This is a Watcom makefile to build SDL.DLL for OS/2
    25.6 -#
    25.7 -# Makefile for threading
    25.8 -#=============================================================================
    25.9 -
   25.10 -object_files=SDL_thread.obj SDL_sysmutex.obj SDL_syssem.obj SDL_systhread.obj SDL_syscond.obj
   25.11 -ExtraCFlags=
   25.12 -
   25.13 -#
   25.14 -#==============================================================================
   25.15 -#
   25.16 -!include ..\..\Watcom.mif
   25.17 -
   25.18 -.before
   25.19 -    set include=$(%os2tk)\h;$(%include);../../include;./os2;../;
   25.20 -
   25.21 -all : $(object_files)
   25.22 -
   25.23 -SDL_sysmutex.obj: .AUTODEPEND
   25.24 -    wcc386 os2\SDL_sysmutex.c $(cflags)
   25.25 -
   25.26 -SDL_syssem.obj: .AUTODEPEND
   25.27 -    wcc386 os2\SDL_syssem.c $(cflags)
   25.28 -
   25.29 -SDL_systhread.obj: .AUTODEPEND
   25.30 -    wcc386 os2\SDL_systhread.c $(cflags)
   25.31 -
   25.32 -SDL_syscond.obj: .AUTODEPEND
   25.33 -    wcc386 os2\SDL_syscond.c $(cflags)
   25.34 -
   25.35 -clean : .SYMBOLIC
   25.36 -        @if exist *.obj del *.obj
   25.37 -        @if exist *.map del *.map
   25.38 -        @if exist *.res del *.res
   25.39 -        @if exist *.lst del *.lst
    26.1 --- a/src/thread/os2/SDL_systhread.c	Sun Feb 26 13:42:00 2006 +0000
    26.2 +++ b/src/thread/os2/SDL_systhread.c	Sun Feb 26 19:30:21 2006 +0000
    26.3 @@ -30,6 +30,7 @@
    26.4  
    26.5  #include "SDL_thread.h"
    26.6  #include "../SDL_systhread.h"
    26.7 +#include "../SDL_thread_c.h"
    26.8  
    26.9  typedef struct ThreadStartParms
   26.10  {
    27.1 --- a/src/timer/Makefile.wat	Sun Feb 26 13:42:00 2006 +0000
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,27 +0,0 @@
    27.4 -#=============================================================================
    27.5 -#          This is a Watcom makefile to build SDL.DLL for OS/2
    27.6 -#
    27.7 -# Makefile for timers
    27.8 -#=============================================================================
    27.9 -
   27.10 -object_files=SDL_timer.obj SDL_systimer.obj
   27.11 -ExtraCFlags=
   27.12 -
   27.13 -#
   27.14 -#==============================================================================
   27.15 -#
   27.16 -!include ..\..\Watcom.mif
   27.17 -
   27.18 -.before
   27.19 -    set include=$(%os2tk)\h;$(%include);../../include;./os2;../;
   27.20 -
   27.21 -all : $(object_files)
   27.22 -
   27.23 -SDL_systimer.obj: .AUTODEPEND
   27.24 -    wcc386 os2\SDL_systimer.c $(cflags)
   27.25 -
   27.26 -clean : .SYMBOLIC
   27.27 -        @if exist *.obj del *.obj
   27.28 -        @if exist *.map del *.map
   27.29 -        @if exist *.res del *.res
   27.30 -        @if exist *.lst del *.lst
    28.1 --- a/src/video/Makefile.wat	Sun Feb 26 13:42:00 2006 +0000
    28.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.3 @@ -1,27 +0,0 @@
    28.4 -#=============================================================================
    28.5 -#          This is a Watcom makefile to build SDL.DLL for OS/2
    28.6 -#
    28.7 -# Makefile for threading
    28.8 -#=============================================================================
    28.9 -
   28.10 -object_files=SDL_blit.obj SDL_blit_0.obj SDL_blit_1.obj SDL_blit_A.obj SDL_blit_N.obj SDL_bmp.obj SDL_cursor.obj SDL_gamma.obj SDL_pixels.obj SDL_RLEaccel.obj SDL_stretch.obj SDL_surface.obj SDL_video.obj SDL_yuv.obj SDL_yuv_mmx.obj SDL_yuv_sw.obj SDL_os2fslib.obj
   28.11 -ExtraCFlags=-dUSE_DOSSETPRIORITY
   28.12 -
   28.13 -#
   28.14 -#==============================================================================
   28.15 -#
   28.16 -!include ..\..\Watcom.mif
   28.17 -
   28.18 -.before
   28.19 -    set include=$(%os2tk)\h;$(%include);../../include;../;./os2;../events;../hermes;$(%FSLIB);
   28.20 -
   28.21 -all : $(object_files)
   28.22 -
   28.23 -SDL_os2fslib.obj : .AUTODEPEND
   28.24 -    wcc386 os2fslib\SDL_os2fslib.c $(cflags)
   28.25 -
   28.26 -clean : .SYMBOLIC
   28.27 -        @if exist *.obj del *.obj
   28.28 -        @if exist *.map del *.map
   28.29 -        @if exist *.res del *.res
   28.30 -        @if exist *.lst del *.lst
    29.1 --- a/src/video/SDL_stretch.c	Sun Feb 26 13:42:00 2006 +0000
    29.2 +++ b/src/video/SDL_stretch.c	Sun Feb 26 19:30:21 2006 +0000
    29.3 @@ -35,6 +35,7 @@
    29.4  */
    29.5  
    29.6  #if ((defined(_MFC_VER) && defined(_M_IX86)/* && !defined(_WIN32_WCE) still needed? */) || \
    29.7 +     defined(__WATCOMC__) || \
    29.8       (defined(__GNUC__) && defined(__i386__))) && SDL_ASSEMBLY_ROUTINES
    29.9  #define USE_ASM_STRETCH
   29.10  #endif
   29.11 @@ -281,8 +282,7 @@
   29.12  			: "=&D" (u1), "=&S" (u2)
   29.13  			: "0" (dstp), "1" (srcp), "r" (copy_row)
   29.14  			: "memory" );
   29.15 -#else
   29.16 -#ifdef _MSC_VER
   29.17 +#elif defined(_MSC_VER) || defined(__WATCOMC__)
   29.18  		{ void *code = copy_row;
   29.19  			__asm {
   29.20  				push edi
   29.21 @@ -299,7 +299,6 @@
   29.22  #else
   29.23  #error Need inline assembly for this compiler
   29.24  #endif
   29.25 -#endif /* __GNUC__ */
   29.26  			break;
   29.27  		}
   29.28  #else
    30.1 --- a/src/video/os2fslib/SDL_os2fslib.c	Sun Feb 26 13:42:00 2006 +0000
    30.2 +++ b/src/video/os2fslib/SDL_os2fslib.c	Sun Feb 26 19:30:21 2006 +0000
    30.3 @@ -21,6 +21,11 @@
    30.4  */
    30.5  #include "SDL_config.h"
    30.6  
    30.7 +#define _ULS_CALLCONV_
    30.8 +#define CALLCONV _System
    30.9 +#include <unidef.h>                    // Unicode API
   30.10 +#include <uconv.h>                     // Unicode API (codepage conversion)
   30.11 +
   30.12  #include <process.h>
   30.13  #include <time.h>
   30.14  
   30.15 @@ -115,8 +120,8 @@
   30.16  //
   30.17  /////////////////////////////////////////////////////////////////////
   30.18  static BOOL SetAccessableWindowPos(HWND hwnd, HWND hwndInsertBehind,
   30.19 -				   LONG x, LONG y,
   30.20 -				   LONG cx, LONG cy,
   30.21 +                                   LONG x, LONG y,
   30.22 +                                   LONG cx, LONG cy,
   30.23                                     ULONG fl)
   30.24  {
   30.25    SWP swpDesktop, swp;
   30.26 @@ -169,6 +174,58 @@
   30.27    return WinSetWindowPos(hwnd, hwndInsertBehind, x, y, cx, cy, fl);
   30.28  }
   30.29  
   30.30 +static UniChar NativeCharToUniChar(int chcode)
   30.31 +{
   30.32 +  UniChar ucResult = (UniChar) chcode;
   30.33 +  int rc;
   30.34 +  UconvObject ucoTemp;
   30.35 +  char     achFrom[2];
   30.36 +  char     *pchFrom;
   30.37 +  size_t   iFromCount;
   30.38 +  UniChar  aucTo[10];
   30.39 +  UniChar  *pucTo;
   30.40 +  size_t   iToCount;
   30.41 +  size_t   iNonIdentical;
   30.42 +
   30.43 +  // Create unicode convert object
   30.44 +  rc = UniCreateUconvObject(L"", &ucoTemp);
   30.45 +  if (rc!=ULS_SUCCESS)
   30.46 +  {
   30.47 +    // Could not create convert object!
   30.48 +    return ucResult;
   30.49 +  }
   30.50 +
   30.51 +  // Convert language code string to unicode string
   30.52 +  achFrom[0] = (char) chcode;
   30.53 +  achFrom[1] = 0;
   30.54 +  iFromCount = sizeof(char) * 2;
   30.55 +  iToCount = sizeof(UniChar) * 2;
   30.56 +  pucTo = &(aucTo[0]);
   30.57 +  pchFrom = &(achFrom[0]);
   30.58 +
   30.59 +  rc = UniUconvToUcs(ucoTemp,
   30.60 +                     &pchFrom,
   30.61 +                     &iFromCount,
   30.62 +                     &pucTo,
   30.63 +                     &iToCount,
   30.64 +                     &iNonIdentical);
   30.65 +
   30.66 +  if (rc!=ULS_SUCCESS)
   30.67 +  {
   30.68 +    // Could not convert language code to UCS string!
   30.69 +    UniFreeUconvObject(ucoTemp);
   30.70 +    return ucResult;
   30.71 +  }
   30.72 +
   30.73 +  UniFreeUconvObject(ucoTemp);
   30.74 +
   30.75 +#ifdef DEBUG_BUILD
   30.76 +  printf("%02x converted to %02x\n", (int) chcode, (int) (aucTo[0]));
   30.77 +#endif
   30.78 +
   30.79 +  return aucTo[0];
   30.80 +}
   30.81 +
   30.82  /////////////////////////////////////////////////////////////////////
   30.83  //
   30.84  // TranslateKey
   30.85 @@ -184,10 +241,8 @@
   30.86  
   30.87    if (iPressed && SDL_TranslateUNICODE)
   30.88    {
   30.89 -    // TODO:
   30.90 -    // Implement real unicode conversion!
   30.91      if (chcode)
   30.92 -      keysym->unicode = chcode;
   30.93 +      keysym->unicode = NativeCharToUniChar(chcode);
   30.94      else
   30.95        keysym->unicode = vkey;
   30.96    }
   30.97 @@ -207,74 +262,74 @@
   30.98      switch (keysym->sym)
   30.99      {
  30.100        case SDLK_BACKQUOTE:
  30.101 -	keysym->sym = '~';
  30.102 -	break;
  30.103 +        keysym->sym = '~';
  30.104 +        break;
  30.105        case SDLK_1:
  30.106 -	keysym->sym = SDLK_EXCLAIM;
  30.107 -	break;
  30.108 +        keysym->sym = SDLK_EXCLAIM;
  30.109 +        break;
  30.110        case SDLK_2:
  30.111 -	keysym->sym = SDLK_AT;
  30.112 -	break;
  30.113 +        keysym->sym = SDLK_AT;
  30.114 +        break;
  30.115        case SDLK_3:
  30.116 -	keysym->sym = SDLK_HASH;
  30.117 -	break;
  30.118 +        keysym->sym = SDLK_HASH;
  30.119 +        break;
  30.120        case SDLK_4:
  30.121 -	keysym->sym = SDLK_DOLLAR;
  30.122 -	break;
  30.123 +        keysym->sym = SDLK_DOLLAR;
  30.124 +        break;
  30.125        case SDLK_5:
  30.126 -	keysym->sym = '%';
  30.127 -	break;
  30.128 +        keysym->sym = '%';
  30.129 +        break;
  30.130        case SDLK_6:
  30.131 -	keysym->sym = SDLK_CARET;
  30.132 -	break;
  30.133 +        keysym->sym = SDLK_CARET;
  30.134 +        break;
  30.135        case SDLK_7:
  30.136 -	keysym->sym = SDLK_AMPERSAND;
  30.137 -	break;
  30.138 +        keysym->sym = SDLK_AMPERSAND;
  30.139 +        break;
  30.140        case SDLK_8:
  30.141 -	keysym->sym = SDLK_ASTERISK;
  30.142 -	break;
  30.143 +        keysym->sym = SDLK_ASTERISK;
  30.144 +        break;
  30.145        case SDLK_9:
  30.146 -	keysym->sym = SDLK_LEFTPAREN;
  30.147 -	break;
  30.148 +        keysym->sym = SDLK_LEFTPAREN;
  30.149 +        break;
  30.150        case SDLK_0:
  30.151 -	keysym->sym = SDLK_RIGHTPAREN;
  30.152 -	break;
  30.153 +        keysym->sym = SDLK_RIGHTPAREN;
  30.154 +        break;
  30.155        case SDLK_MINUS:
  30.156 -	keysym->sym = SDLK_UNDERSCORE;
  30.157 -	break;
  30.158 +        keysym->sym = SDLK_UNDERSCORE;
  30.159 +        break;
  30.160        case SDLK_PLUS:
  30.161 -	keysym->sym = SDLK_EQUALS;
  30.162 -	break;
  30.163 +        keysym->sym = SDLK_EQUALS;
  30.164 +        break;
  30.165  
  30.166        case SDLK_LEFTBRACKET:
  30.167 -	keysym->sym = '{';
  30.168 -	break;
  30.169 +        keysym->sym = '{';
  30.170 +        break;
  30.171        case SDLK_RIGHTBRACKET:
  30.172 -	keysym->sym = '}';
  30.173 -	break;
  30.174 +        keysym->sym = '}';
  30.175 +        break;
  30.176  
  30.177        case SDLK_SEMICOLON:
  30.178 -	keysym->sym = SDLK_COLON;
  30.179 -	break;
  30.180 +        keysym->sym = SDLK_COLON;
  30.181 +        break;
  30.182        case SDLK_QUOTE:
  30.183 -	keysym->sym = SDLK_QUOTEDBL;
  30.184 -	break;
  30.185 +        keysym->sym = SDLK_QUOTEDBL;
  30.186 +        break;
  30.187        case SDLK_BACKSLASH:
  30.188 -	keysym->sym = '|';
  30.189 -	break;
  30.190 +        keysym->sym = '|';
  30.191 +        break;
  30.192  
  30.193        case SDLK_COMMA:
  30.194 -	keysym->sym = SDLK_LESS;
  30.195 -	break;
  30.196 +        keysym->sym = SDLK_LESS;
  30.197 +        break;
  30.198        case SDLK_PERIOD:
  30.199 -	keysym->sym = SDLK_GREATER;
  30.200 -	break;
  30.201 +        keysym->sym = SDLK_GREATER;
  30.202 +        break;
  30.203        case SDLK_SLASH:
  30.204 -	keysym->sym = SDLK_QUESTION;
  30.205 -	break;
  30.206 +        keysym->sym = SDLK_QUESTION;
  30.207 +        break;
  30.208  
  30.209        default:
  30.210 -	break;
  30.211 +        break;
  30.212      }
  30.213    }
  30.214    return keysym;
  30.215 @@ -283,33 +338,33 @@
  30.216  #define CONVERTMOUSEPOSITION()  \
  30.217          /* We have to inverse the mouse position, because every non-os/2 system */                                                \
  30.218          /* has a coordinate system where the (0;0) is the top-left corner,      */                                                \
  30.219 -	/* while on os/2 it's the bottom left corner!                           */                                                \
  30.220 -	if (FSLib_QueryFSMode(hwnd))                                                                                              \
  30.221 -	{                                                                                                                         \
  30.222 -	  /* We're in FS mode!                                                        */                                          \
  30.223 -	  /* In FS mode our window is as big as fullscreen mode, but not necessary as */                                          \
  30.224 -	  /* big as the source buffer (can be bigger)                                 */                                          \
  30.225 +        /* while on os/2 it's the bottom left corner!                           */                                                \
  30.226 +        if (FSLib_QueryFSMode(hwnd))                                                                                              \
  30.227 +        {                                                                                                                         \
  30.228 +          /* We're in FS mode!                                                        */                                          \
  30.229 +          /* In FS mode our window is as big as fullscreen mode, but not necessary as */                                          \
  30.230 +          /* big as the source buffer (can be bigger)                                 */                                          \
  30.231            /* So, limit mouse pos to source buffer size!                               */                                          \
  30.232 -	  if (ppts->x<0) ppts->x = 0;                                                                                             \
  30.233 -	  if (ppts->y<0) ppts->y = 0;                                                                                             \
  30.234 -	  if (ppts->x>=pVideo->hidden->SrcBufferDesc.uiXResolution) ppts->x = pVideo->hidden->SrcBufferDesc.uiXResolution-1;      \
  30.235 +          if (ppts->x<0) ppts->x = 0;                                                                                             \
  30.236 +          if (ppts->y<0) ppts->y = 0;                                                                                             \
  30.237 +          if (ppts->x>=pVideo->hidden->SrcBufferDesc.uiXResolution) ppts->x = pVideo->hidden->SrcBufferDesc.uiXResolution-1;      \
  30.238            if (ppts->y>=pVideo->hidden->SrcBufferDesc.uiYResolution) ppts->y = pVideo->hidden->SrcBufferDesc.uiYResolution-1;      \
  30.239            pVideo->hidden->iSkipWMMOUSEMOVE++; /* Don't take next WM_MOUSEMOVE into account!  */                                   \
  30.240            ptl.x = ppts->x; ptl.y = ppts->y;                                                                                       \
  30.241            WinMapWindowPoints(pVideo->hidden->hwndClient, HWND_DESKTOP, &ptl, 1);                                                  \
  30.242 -	  WinSetPointerPos(HWND_DESKTOP, ptl.x, ptl.y);                                                                           \
  30.243 -	  /* Then convert OS/2 position to SDL position */                                                                        \
  30.244 +          WinSetPointerPos(HWND_DESKTOP, ptl.x, ptl.y);                                                                           \
  30.245 +          /* Then convert OS/2 position to SDL position */                                                                        \
  30.246            ppts->y = pVideo->hidden->SrcBufferDesc.uiYResolution - ppts->y - 1;                                                    \
  30.247 -	} else                                                                                                                    \
  30.248 -	{                                                                                                                         \
  30.249 -	  SWP swpClient;                                                                                                          \
  30.250 +        } else                                                                                                                    \
  30.251 +        {                                                                                                                         \
  30.252 +          SWP swpClient;                                                                                                          \
  30.253            /* We're in windowed mode! */                                                                                           \
  30.254 -	  WinQueryWindowPos(pVideo->hidden->hwndClient, &swpClient);                                                              \
  30.255 +          WinQueryWindowPos(pVideo->hidden->hwndClient, &swpClient);                                                              \
  30.256            /* Convert OS/2 mouse position to SDL position, and also scale it! */                                                   \
  30.257 -	  (ppts->x) = (ppts->x) * pVideo->hidden->SrcBufferDesc.uiXResolution / swpClient.cx;                                       \
  30.258 -	  (ppts->y) = (ppts->y) * pVideo->hidden->SrcBufferDesc.uiYResolution / swpClient.cy;                                       \
  30.259 -	  (ppts->y) = pVideo->hidden->SrcBufferDesc.uiYResolution - (ppts->y)  - 1;                                                 \
  30.260 -	}
  30.261 +          (ppts->x) = (ppts->x) * pVideo->hidden->SrcBufferDesc.uiXResolution / swpClient.cx;                                       \
  30.262 +          (ppts->y) = (ppts->y) * pVideo->hidden->SrcBufferDesc.uiYResolution / swpClient.cy;                                       \
  30.263 +          (ppts->y) = pVideo->hidden->SrcBufferDesc.uiYResolution - (ppts->y)  - 1;                                                 \
  30.264 +        }
  30.265  
  30.266  
  30.267  
  30.268 @@ -351,9 +406,9 @@
  30.269          */
  30.270  
  30.271          // If it's not repeated, then let's see if its pressed or released!
  30.272 -	if (SHORT1FROMMP(mp1) & KC_KEYUP)
  30.273 -	{
  30.274 -	  // A key has been released
  30.275 +        if (SHORT1FROMMP(mp1) & KC_KEYUP)
  30.276 +        {
  30.277 +          // A key has been released
  30.278            SDL_keysym keysym;
  30.279  
  30.280  #ifdef DEBUG_BUILD
  30.281 @@ -362,10 +417,10 @@
  30.282  
  30.283            // One problem is with F1, which gets only the keyup message because
  30.284            // it is a system key.
  30.285 -	  // So, when we get keyup message, we simulate keydown too!
  30.286 -	  // UPDATE:
  30.287 -	  //  This problem should be solved now, that the accelerator keys are
  30.288 -	  //  disabled for this window!
  30.289 +          // So, when we get keyup message, we simulate keydown too!
  30.290 +          // UPDATE:
  30.291 +          //  This problem should be solved now, that the accelerator keys are
  30.292 +          //  disabled for this window!
  30.293            /*
  30.294            if (SHORT2FROMMP(mp2)==VK_F1)
  30.295            {
  30.296 @@ -373,45 +428,45 @@
  30.297                                                             SHORT1FROMMP(mp2), // Character code
  30.298                                                             CHAR4FROMMP(mp1),  // HW Scan code
  30.299                                                             &keysym,0));
  30.300 -	  }*/
  30.301 +          }*/
  30.302  
  30.303            SDL_PrivateKeyboard(SDL_RELEASED, TranslateKey(SHORT2FROMMP(mp2), // VK_ code
  30.304 -							 SHORT1FROMMP(mp2), // Character code
  30.305 -							 CHAR4FROMMP(mp1),  // HW Scan code
  30.306 +                                                         SHORT1FROMMP(mp2), // Character code
  30.307 +                                                         CHAR4FROMMP(mp1),  // HW Scan code
  30.308                                                           &keysym,0));
  30.309            
  30.310 -	} else
  30.311 -	{
  30.312 +        } else
  30.313 +        {
  30.314            // A key has been pressed
  30.315            SDL_keysym keysym;
  30.316  
  30.317  #ifdef DEBUG_BUILD
  30.318  //          printf("WM_CHAR, keydown, code is [0x%0x]\n", CHAR4FROMMP(mp1)); // HW scan code
  30.319  #endif
  30.320 -	  // Check for fastkeys: ALT+HOME to toggle FS mode
  30.321 +          // Check for fastkeys: ALT+HOME to toggle FS mode
  30.322            //                     ALT+END to close app
  30.323 -	  if ((SHORT1FROMMP(mp1) & KC_ALT) &&
  30.324 -	      (SHORT2FROMMP(mp2) == VK_HOME))
  30.325 -	  {
  30.326 +          if ((SHORT1FROMMP(mp1) & KC_ALT) &&
  30.327 +              (SHORT2FROMMP(mp2) == VK_HOME))
  30.328 +          {
  30.329  #ifdef DEBUG_BUILD
  30.330 -	    printf(" Pressed ALT+HOME!\n"); fflush(stdout);
  30.331 +            printf(" Pressed ALT+HOME!\n"); fflush(stdout);
  30.332  #endif
  30.333 -	    // Only switch between fullscreen and back if it's not
  30.334 -	    // a resizable mode!
  30.335 +            // Only switch between fullscreen and back if it's not
  30.336 +            // a resizable mode!
  30.337              if (
  30.338                  (!pVideo->hidden->pSDLSurface) ||
  30.339                  ((pVideo->hidden->pSDLSurface)
  30.340                   && ((pVideo->hidden->pSDLSurface->flags & SDL_RESIZABLE)==0)
  30.341                  )
  30.342                 )
  30.343 -	      FSLib_ToggleFSMode(hwnd, !FSLib_QueryFSMode(hwnd));
  30.344 +              FSLib_ToggleFSMode(hwnd, !FSLib_QueryFSMode(hwnd));
  30.345  #ifdef DEBUG_BUILD
  30.346              else
  30.347 -	      printf(" Resizable mode, so discarding ALT+HOME!\n"); fflush(stdout);
  30.348 +              printf(" Resizable mode, so discarding ALT+HOME!\n"); fflush(stdout);
  30.349  #endif
  30.350 -	  } else
  30.351 -	  if ((SHORT1FROMMP(mp1) & KC_ALT) &&
  30.352 -	      (SHORT2FROMMP(mp2) == VK_END))
  30.353 +          } else
  30.354 +          if ((SHORT1FROMMP(mp1) & KC_ALT) &&
  30.355 +              (SHORT2FROMMP(mp2) == VK_END))
  30.356            {
  30.357  #ifdef DEBUG_BUILD
  30.358              printf(" Pressed ALT+END!\n"); fflush(stdout);
  30.359 @@ -421,32 +476,32 @@
  30.360              // wait for it to be processed!
  30.361              SDL_PrivateQuit();
  30.362              WinPostMsg(hwnd, WM_QUIT, 0, 0);
  30.363 -	  } else
  30.364 +          } else
  30.365            {
  30.366              
  30.367 -	    SDL_PrivateKeyboard(SDL_PRESSED, TranslateKey(SHORT2FROMMP(mp2), // VK_ code
  30.368 -							  SHORT1FROMMP(mp2), // Character code
  30.369 -							  CHAR4FROMMP(mp1),  // HW Scan code
  30.370 +            SDL_PrivateKeyboard(SDL_PRESSED, TranslateKey(SHORT2FROMMP(mp2), // VK_ code
  30.371 +                                                          SHORT1FROMMP(mp2), // Character code
  30.372 +                                                          CHAR4FROMMP(mp1),  // HW Scan code
  30.373                                                            &keysym,1));
  30.374              
  30.375 -	  }
  30.376 -	}
  30.377 +          }
  30.378 +        }
  30.379        }
  30.380        return (MRESULT) TRUE;
  30.381  
  30.382      case WM_TRANSLATEACCEL:
  30.383        {
  30.384 -	PQMSG pqmsg;
  30.385 -	pqmsg = (PQMSG) mp1;
  30.386 -	if (mp1)
  30.387 -	{
  30.388 -	  if (pqmsg->msg == WM_CHAR)
  30.389 -	  {
  30.390 -	    // WM_CHAR message!
  30.391 -	    // Let's filter the ALT keypress and all other acceleration keys!
  30.392 -	    return (MRESULT) FALSE;
  30.393 -	  }
  30.394 -	}
  30.395 +        PQMSG pqmsg;
  30.396 +        pqmsg = (PQMSG) mp1;
  30.397 +        if (mp1)
  30.398 +        {
  30.399 +          if (pqmsg->msg == WM_CHAR)
  30.400 +          {
  30.401 +            // WM_CHAR message!
  30.402 +            // Let's filter the ALT keypress and all other acceleration keys!
  30.403 +            return (MRESULT) FALSE;
  30.404 +          }
  30.405 +        }
  30.406          break; // Default processing (pass to parent until frame control)
  30.407        }
  30.408  
  30.409 @@ -560,7 +615,7 @@
  30.410  #ifdef DEBUG_BUILD
  30.411        else
  30.412        {
  30.413 -	printf("WM_PAINT : No pVideo!\n"); fflush(stdout);
  30.414 +        printf("WM_PAINT : No pVideo!\n"); fflush(stdout);
  30.415        }
  30.416  #endif
  30.417        WinEndPaint(ps);
  30.418 @@ -573,14 +628,14 @@
  30.419      case WM_SIZE:
  30.420        {
  30.421  #ifdef DEBUG_BUILD
  30.422 -	printf("WM_SIZE : (%d %d)\n",
  30.423 -	       SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)); fflush(stdout);
  30.424 +        printf("WM_SIZE : (%d %d)\n",
  30.425 +               SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)); fflush(stdout);
  30.426  #endif
  30.427          iWindowSizeX = SHORT1FROMMP(mp2);
  30.428          iWindowSizeY = SHORT2FROMMP(mp2);
  30.429          bWindowResized = 1;
  30.430  
  30.431 -	// Make sure the window will be redrawn
  30.432 +        // Make sure the window will be redrawn
  30.433          WinInvalidateRegion(hwnd, NULL, TRUE);
  30.434        }
  30.435        break;
  30.436 @@ -591,9 +646,9 @@
  30.437  #endif
  30.438        if ((int)mp1 == FSLN_TOGGLEFSMODE)
  30.439        {
  30.440 -	// FS mode changed, reblit image!
  30.441 -	pVideo = FSLib_GetUserParm(hwnd);
  30.442 -	if (pVideo)
  30.443 +        // FS mode changed, reblit image!
  30.444 +        pVideo = FSLib_GetUserParm(hwnd);
  30.445 +        if (pVideo)
  30.446          {
  30.447            if (!pVideo->hidden->pSDLSurface)
  30.448            {
  30.449 @@ -651,7 +706,7 @@
  30.450                DosReleaseMutexSem(pVideo->hidden->hmtxUseSrcBuffer);
  30.451              }
  30.452            }
  30.453 -	}
  30.454 +        }
  30.455        }
  30.456        return (MPARAM) 1;
  30.457  
  30.458 @@ -670,12 +725,12 @@
  30.459            if ((pVideo->hidden->iMouseVisible) && (!bMouseCaptured))
  30.460              WinSetPointer(HWND_DESKTOP, WinQuerySysPointer(HWND_DESKTOP, SPTR_ARROW, FALSE));
  30.461            else
  30.462 -	    WinSetPointer(HWND_DESKTOP, NULL);
  30.463 -
  30.464 -	  if (bMouseCapturable)
  30.465 -	  {
  30.466 +            WinSetPointer(HWND_DESKTOP, NULL);
  30.467 +
  30.468 +          if (bMouseCapturable)
  30.469 +          {
  30.470              // Re-capture the mouse, if we captured it before!
  30.471 -	    WinSetCapture(HWND_DESKTOP, hwnd);
  30.472 +            WinSetCapture(HWND_DESKTOP, hwnd);
  30.473              bMouseCaptured = 1;
  30.474              {
  30.475                SWP swpClient;
  30.476 @@ -689,18 +744,18 @@
  30.477                                 ptl.x + swpClient.cx/2,
  30.478                                 ptl.y + swpClient.cy/2);
  30.479              }
  30.480 -	  }
  30.481 +          }
  30.482          } else
  30.483          {
  30.484            // Went out of focus
  30.485 -	  WinSetPointer(HWND_DESKTOP, WinQuerySysPointer(HWND_DESKTOP, SPTR_ARROW, FALSE));
  30.486 -
  30.487 -	  if (bMouseCaptured)
  30.488 -	  {
  30.489 +          WinSetPointer(HWND_DESKTOP, WinQuerySysPointer(HWND_DESKTOP, SPTR_ARROW, FALSE));
  30.490 +
  30.491 +          if (bMouseCaptured)
  30.492 +          {
  30.493              // Release the mouse
  30.494 -	    WinSetCapture(HWND_DESKTOP, hwnd);
  30.495 +            WinSetCapture(HWND_DESKTOP, hwnd);
  30.496              bMouseCaptured = 0;
  30.497 -	  }
  30.498 +          }
  30.499          }
  30.500        }
  30.501  #ifdef DEBUG_BUILD
  30.502 @@ -717,16 +772,16 @@
  30.503        pVideo = FSLib_GetUserParm(hwnd);
  30.504        if (pVideo)
  30.505        {
  30.506 -	SDL_PrivateMouseButton(SDL_PRESSED,
  30.507 +        SDL_PrivateMouseButton(SDL_PRESSED,
  30.508                                 SDL_BUTTON_LEFT,
  30.509                                 0, 0); // Don't report mouse movement!
  30.510  
  30.511 -	if (bMouseCapturable)
  30.512 -	{
  30.513 -	  // We should capture the mouse!
  30.514 -	  if (!bMouseCaptured)
  30.515 -	  {
  30.516 -	    WinSetCapture(HWND_DESKTOP, hwnd);
  30.517 +        if (bMouseCapturable)
  30.518 +        {
  30.519 +          // We should capture the mouse!
  30.520 +          if (!bMouseCaptured)
  30.521 +          {
  30.522 +            WinSetCapture(HWND_DESKTOP, hwnd);
  30.523              WinSetPointer(HWND_DESKTOP, NULL);
  30.524              bMouseCaptured = 1;
  30.525              {
  30.526 @@ -741,8 +796,8 @@
  30.527                                 ptl.x + swpClient.cx/2,
  30.528                                 ptl.y + swpClient.cy/2);
  30.529              }
  30.530 -	  }
  30.531 -	}
  30.532 +          }
  30.533 +        }
  30.534        }
  30.535        break;
  30.536      case WM_BUTTON1UP:
  30.537 @@ -761,16 +816,16 @@
  30.538        pVideo = FSLib_GetUserParm(hwnd);
  30.539        if (pVideo)
  30.540        {
  30.541 -	SDL_PrivateMouseButton(SDL_PRESSED,
  30.542 +        SDL_PrivateMouseButton(SDL_PRESSED,
  30.543                                 SDL_BUTTON_RIGHT,
  30.544                                 0, 0); // Don't report mouse movement!
  30.545  
  30.546 -	if (bMouseCapturable)
  30.547 -	{
  30.548 -	  // We should capture the mouse!
  30.549 -	  if (!bMouseCaptured)
  30.550 -	  {
  30.551 -	    WinSetCapture(HWND_DESKTOP, hwnd);
  30.552 +        if (bMouseCapturable)
  30.553 +        {
  30.554 +          // We should capture the mouse!
  30.555 +          if (!bMouseCaptured)
  30.556 +          {
  30.557 +            WinSetCapture(HWND_DESKTOP, hwnd);
  30.558              WinSetPointer(HWND_DESKTOP, NULL);
  30.559              bMouseCaptured = 1;
  30.560              {
  30.561 @@ -785,8 +840,8 @@
  30.562                                 ptl.x + swpClient.cx/2,
  30.563                                 ptl.y + swpClient.cy/2);
  30.564              }
  30.565 -	  }
  30.566 -	}
  30.567 +          }
  30.568 +        }
  30.569  
  30.570        }
  30.571        break;
  30.572 @@ -810,12 +865,12 @@
  30.573                                 SDL_BUTTON_MIDDLE,
  30.574                                 0, 0); // Don't report mouse movement!
  30.575          
  30.576 -	if (bMouseCapturable)
  30.577 -	{
  30.578 -	  // We should capture the mouse!
  30.579 -	  if (!bMouseCaptured)
  30.580 -	  {
  30.581 -	    WinSetCapture(HWND_DESKTOP, hwnd);
  30.582 +        if (bMouseCapturable)
  30.583 +        {
  30.584 +          // We should capture the mouse!
  30.585 +          if (!bMouseCaptured)
  30.586 +          {
  30.587 +            WinSetCapture(HWND_DESKTOP, hwnd);
  30.588              WinSetPointer(HWND_DESKTOP, NULL);
  30.589              bMouseCaptured = 1;
  30.590              {
  30.591 @@ -830,8 +885,8 @@
  30.592                                 ptl.x + swpClient.cx/2,
  30.593                                 ptl.y + swpClient.cy/2);
  30.594              }
  30.595 -	  }
  30.596 -	}
  30.597 +          }
  30.598 +        }
  30.599        }
  30.600        break;
  30.601      case WM_BUTTON3UP:
  30.602 @@ -858,19 +913,19 @@
  30.603            POINTS *ppts = (POINTS *) (&mp1);
  30.604            POINTL ptl;
  30.605  
  30.606 -          CONVERTMOUSEPOSITION();
  30.607 -
  30.608            if (bMouseCaptured)
  30.609            {
  30.610              SWP swpClient;
  30.611 +
  30.612 +            WinQueryWindowPos(pVideo->hidden->hwndClient, &swpClient);
  30.613 +
  30.614              // Send relative mouse position, and re-center the mouse
  30.615              // Reposition the mouse to the center of the screen/window
  30.616              SDL_PrivateMouseMotion(0, // Buttons not changed
  30.617                                     1, // Relative position
  30.618 -                                   ppts->x - (pVideo->hidden->SrcBufferDesc.uiXResolution/2),
  30.619 -                                   ppts->y+1 - (pVideo->hidden->SrcBufferDesc.uiYResolution/2));
  30.620 -
  30.621 -            WinQueryWindowPos(pVideo->hidden->hwndClient, &swpClient);
  30.622 +                                   ppts->x - (swpClient.cx/2),
  30.623 +                                   (swpClient.cy/2) - ppts->y);
  30.624 +
  30.625              ptl.x = 0; ptl.y = 0;
  30.626              WinMapWindowPoints(pVideo->hidden->hwndClient, HWND_DESKTOP, &ptl, 1);
  30.627              pVideo->hidden->iSkipWMMOUSEMOVE++; /* Don't take next WM_MOUSEMOVE into account!  */
  30.628 @@ -880,6 +935,8 @@
  30.629                               ptl.y + swpClient.cy/2);
  30.630            } else
  30.631            {
  30.632 +            CONVERTMOUSEPOSITION();
  30.633 +
  30.634              // Send absolute mouse position
  30.635              SDL_PrivateMouseMotion(0, // Buttons not changed
  30.636                                     0, // Absolute position
  30.637 @@ -986,6 +1043,98 @@
  30.638  
  30.639  /////////////////////////////////////////////////////////////////////
  30.640  //
  30.641 +// FrameWndProc
  30.642 +//
  30.643 +// This is the message processing window procedure for the
  30.644 +// frame window of SDLWindowClass.
  30.645 +//
  30.646 +/////////////////////////////////////////////////////////////////////
  30.647 +static MRESULT EXPENTRY FrameWndProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  30.648 +{
  30.649 +  PFNWP pOldFrameProc;
  30.650 +  MRESULT result;
  30.651 +  PTRACKINFO ti;
  30.652 +  int cx, cy, ncx, ncy;
  30.653 +  RECTL rclTemp;
  30.654 +  PSWP pswpTemp;
  30.655 +
  30.656 +  SDL_VideoDevice *pVideo = NULL;
  30.657 +
  30.658 +  pVideo = (SDL_VideoDevice *) WinQueryWindowULong(hwnd, QWL_USER);
  30.659 +
  30.660 +  pOldFrameProc = pVideo->hidden->pfnOldFrameProc;
  30.661 +
  30.662 +  if ((pVideo->hidden->bProportionalResize) &&
  30.663 +      (msg==WM_ADJUSTWINDOWPOS) &&
  30.664 +      (!FSLib_QueryFSMode(pVideo->hidden->hwndClient))
  30.665 +     )
  30.666 +  {
  30.667 +    pswpTemp = (PSWP) mp1;
  30.668 +
  30.669 +    /* Resizing? */
  30.670 +    if (pswpTemp->fl & SWP_SIZE)
  30.671 +    {
  30.672 +      /* Calculate client size */
  30.673 +      rclTemp.xLeft = pswpTemp->x;
  30.674 +      rclTemp.xRight = pswpTemp->x + pswpTemp->cx;
  30.675 +      rclTemp.yBottom = pswpTemp->y;
  30.676 +      rclTemp.yTop = pswpTemp->y + pswpTemp->cy;
  30.677 +      WinCalcFrameRect(hwnd, &rclTemp, TRUE);
  30.678 +
  30.679 +      ncx = cx = rclTemp.xRight - rclTemp.xLeft;
  30.680 +      ncy = cy = rclTemp.yTop - rclTemp.yBottom;
  30.681 +
  30.682 +      /* Calculate new size to keep it proportional */
  30.683 +
  30.684 +      if ((pVideo->hidden->ulResizingFlag & TF_LEFT) || (pVideo->hidden->ulResizingFlag & TF_RIGHT))
  30.685 +      {
  30.686 +        /* The window is resized horizontally */
  30.687 +        ncy = pVideo->hidden->SrcBufferDesc.uiYResolution * cx / pVideo->hidden->SrcBufferDesc.uiXResolution;
  30.688 +      } else
  30.689 +      if ((pVideo->hidden->ulResizingFlag & TF_TOP) || (pVideo->hidden->ulResizingFlag & TF_BOTTOM))
  30.690 +      {
  30.691 +        /* The window is resized vertically */
  30.692 +        ncx = pVideo->hidden->SrcBufferDesc.uiXResolution * cy / pVideo->hidden->SrcBufferDesc.uiYResolution;
  30.693 +      }
  30.694 +
  30.695 +      /* Calculate back frame coordinates */
  30.696 +      rclTemp.xLeft = pswpTemp->x;
  30.697 +      rclTemp.xRight = pswpTemp->x + ncx;
  30.698 +      rclTemp.yBottom = pswpTemp->y;
  30.699 +      rclTemp.yTop = pswpTemp->y + ncy;
  30.700 +      WinCalcFrameRect(hwnd, &rclTemp, FALSE);
  30.701 +
  30.702 +      /* Store new size/position info */
  30.703 +      pswpTemp->cx = rclTemp.xRight - rclTemp.xLeft;
  30.704 +
  30.705 +      if (!(pVideo->hidden->ulResizingFlag & TF_TOP))
  30.706 +      {
  30.707 +        pswpTemp->y = pswpTemp->y + pswpTemp->cy - (rclTemp.yTop - rclTemp.yBottom);
  30.708 +        pswpTemp->cy = rclTemp.yTop - rclTemp.yBottom;
  30.709 +      } else
  30.710 +      {
  30.711 +        pswpTemp->cy = rclTemp.yTop - rclTemp.yBottom;
  30.712 +      }
  30.713 +    }
  30.714 +  }
  30.715 +
  30.716 +  result = (*pOldFrameProc)(hwnd, msg, mp1, mp2);
  30.717 +
  30.718 +  if ((pVideo->hidden->bProportionalResize) && (msg==WM_QUERYTRACKINFO))
  30.719 +  {
  30.720 +    ti = (PTRACKINFO) mp2;
  30.721 +
  30.722 +    /* Store the direction of resizing */
  30.723 +    if ((ti->fs & TF_LEFT) || (ti->fs & TF_RIGHT) ||
  30.724 +        (ti->fs & TF_TOP) || (ti->fs & TF_BOTTOM))
  30.725 +      pVideo->hidden->ulResizingFlag = ti->fs;
  30.726 +  }
  30.727 +
  30.728 +  return result;
  30.729 +}
  30.730 +
  30.731 +/////////////////////////////////////////////////////////////////////
  30.732 +//
  30.733  // PMThreadFunc
  30.734  //
  30.735  // This function implements the PM-Thread, which initializes the
  30.736 @@ -1037,7 +1186,7 @@
  30.737                              &(pVideo->hidden->SrcBufferDesc),
  30.738                              WndProc,
  30.739                              &(pVideo->hidden->hwndClient),
  30.740 -			    &(pVideo->hidden->hwndFrame));
  30.741 +                            &(pVideo->hidden->hwndFrame));
  30.742  
  30.743  #ifdef DEBUG_BUILD
  30.744      printf("[PMThreadFunc] : FSLib_CreateWindow() rc = %d\n", rc);
  30.745 @@ -1085,6 +1234,11 @@
  30.746                               (rectl.yTop-rectl.yBottom),
  30.747                               SWP_SIZE | SWP_ACTIVATE | SWP_SHOW | SWP_MOVE);
  30.748  
  30.749 +      // Subclass frame procedure and store old window proc address
  30.750 +      pVideo->hidden->pfnOldFrameProc =
  30.751 +        WinSubclassWindow(pVideo->hidden->hwndFrame, FrameWndProc);
  30.752 +      WinSetWindowULong(pVideo->hidden->hwndFrame, QWL_USER, (ULONG) pVideo);
  30.753 +
  30.754  #ifdef DEBUG_BUILD
  30.755        printf("[PMThreadFunc] : Entering message loop\n"); fflush(stdout);
  30.756  #endif
  30.757 @@ -1814,7 +1968,7 @@
  30.758    hmqerror = WinGetLastError(hab);
  30.759  
  30.760    WinSetWindowPos(_this->hidden->hwndFrame, HWND_TOP,
  30.761 -		 0, 0, 0, 0, SWP_MINIMIZE);
  30.762 +                 0, 0, 0, 0, SWP_MINIMIZE);
  30.763  
  30.764    // Now destroy the message queue, if we've created it!
  30.765    if (ERRORIDERROR(hmqerror)==0)
  30.766 @@ -2139,7 +2293,7 @@
  30.767   should take care of cleaning up the current mode.
  30.768   */
  30.769  static SDL_Surface *os2fslib_SetVideoMode(_THIS, SDL_Surface *current,
  30.770 -					  int width, int height, int bpp, Uint32 flags)
  30.771 +                                          int width, int height, int bpp, Uint32 flags)
  30.772  {
  30.773    static int bFirstCall = 1;
  30.774    FSLib_VideoMode_p pModeInfo, pModeInfoFound;
  30.775 @@ -2475,7 +2629,7 @@
  30.776            pRect->h = pFSMode->uiYResolution;
  30.777  #ifdef DEBUG_BUILD
  30.778  //          printf("!!! Seems to be good!\n");
  30.779 -//	  printf("F: %dx%d\n", pRect->w, pRect->h);
  30.780 +//        printf("F: %dx%d\n", pRect->w, pRect->h);
  30.781  #endif
  30.782            // And insert into list of pRects
  30.783            if (!(_this->hidden->pListModesResult))
  30.784 @@ -2489,7 +2643,7 @@
  30.785              if (_this->hidden->pListModesResult)
  30.786              {
  30.787                _this->hidden->pListModesResult[0] = pRect;
  30.788 -	      _this->hidden->pListModesResult[1] = NULL;
  30.789 +              _this->hidden->pListModesResult[1] = NULL;
  30.790              } else
  30.791              {
  30.792                SDL_free(pRect);
  30.793 @@ -2601,6 +2755,83 @@
  30.794    _this->hidden->fInFocus = 0;
  30.795    _this->hidden->iSkipWMMOUSEMOVE = 0;
  30.796    _this->hidden->iMouseVisible = 1;
  30.797 +
  30.798 +  if (getenv("SDL_USE_PROPORTIONAL_WINDOW"))
  30.799 +    _this->hidden->bProportionalResize = 1;
  30.800 +  else
  30.801 +  {
  30.802 +    PPIB pib;
  30.803 +    PTIB tib;
  30.804 +    char *pchFileName, *pchTemp;
  30.805 +    char achConfigFile[CCHMAXPATH];
  30.806 +    FILE *hFile;
  30.807 +
  30.808 +    /* No environment variable to have proportional window.
  30.809 +     * Ok, let's check if this executable is in config file!
  30.810 +     */
  30.811 +    _this->hidden->bProportionalResize = 0;
  30.812 +
  30.813 +    DosGetInfoBlocks(&tib, &pib);
  30.814 +    pchTemp = pchFileName = pib->pib_pchcmd;
  30.815 +    while (*pchTemp)
  30.816 +    {
  30.817 +      if (*pchTemp=='\\')
  30.818 +        pchFileName = pchTemp+1;
  30.819 +      pchTemp++;
  30.820 +    }
  30.821 +    if (getenv("HOME"))
  30.822 +    {
  30.823 +      sprintf(achConfigFile, "%s\\.sdl.proportionals", getenv("HOME"));
  30.824 +      hFile = fopen(achConfigFile, "rt");
  30.825 +      if (!hFile)
  30.826 +      {
  30.827 +        /* Seems like the file cannot be opened or does not exist.
  30.828 +         * Let's try to create it with defaults!
  30.829 +         */
  30.830 +        hFile = fopen(achConfigFile, "wt");
  30.831 +        if (hFile)
  30.832 +        {
  30.833 +          fprintf(hFile, "; This file is a config file of SDL/2, containing\n");
  30.834 +          fprintf(hFile, "; the list of executables that must have proportional\n");
  30.835 +          fprintf(hFile, "; windows.\n");
  30.836 +          fprintf(hFile, ";\n");
  30.837 +          fprintf(hFile, "; You can add executable filenames into this file,\n");
  30.838 +          fprintf(hFile, "; one under the other. If SDL finds that a given\n");
  30.839 +          fprintf(hFile, "; program is in this list, then that application\n");
  30.840 +          fprintf(hFile, "; will have proportional windows, just like if\n");
  30.841 +          fprintf(hFile, "; the SET SDL_USE_PROPORTIONAL_WINDOW env. variable\n");
  30.842 +          fprintf(hFile, "; would have been set for that process.\n");
  30.843 +          fprintf(hFile, ";\n");
  30.844 +          fprintf(hFile, "\n");
  30.845 +          fprintf(hFile, "dosbox.exe\n");
  30.846 +          fclose(hFile);
  30.847 +        }
  30.848 +
  30.849 +        hFile = fopen(achConfigFile, "rt");
  30.850 +      }
  30.851 +
  30.852 +      if (hFile)
  30.853 +      {
  30.854 +        while (fgets(achConfigFile, sizeof(achConfigFile), hFile))
  30.855 +        {
  30.856 +          /* Cut \n from end of string */
  30.857 +
  30.858 +          while (achConfigFile[strlen(achConfigFile)-1] == '\n')
  30.859 +            achConfigFile[strlen(achConfigFile)-1] = 0;
  30.860 +
  30.861 +          /* Compare... */
  30.862 +          if (stricmp(achConfigFile, pchFileName)==0)
  30.863 +          {
  30.864 +            /* Found it in config file! */
  30.865 +            _this->hidden->bProportionalResize = 1;
  30.866 +            break;
  30.867 +          }
  30.868 +        }
  30.869 +        fclose(hFile);
  30.870 +      }
  30.871 +    }
  30.872 +  }
  30.873 +
  30.874    DosCreateMutexSem(NULL, &(_this->hidden->hmtxUseSrcBuffer), 0, FALSE);
  30.875  
  30.876    // Now create our window with a default size
  30.877 @@ -2777,7 +3008,7 @@
  30.878  }
  30.879  
  30.880  VideoBootStrap OS2FSLib_bootstrap = {
  30.881 -  	"os2fslib", "OS/2 Video Output using FSLib",
  30.882 -	os2fslib_Available, os2fslib_CreateDevice
  30.883 +        "os2fslib", "OS/2 Video Output using FSLib",
  30.884 +        os2fslib_Available, os2fslib_CreateDevice
  30.885  };
  30.886  
    31.1 --- a/src/video/os2fslib/SDL_os2fslib.h	Sun Feb 26 13:42:00 2006 +0000
    31.2 +++ b/src/video/os2fslib/SDL_os2fslib.h	Sun Feb 26 19:30:21 2006 +0000
    31.3 @@ -57,8 +57,15 @@
    31.4    int                 fInFocus;         // True if we're in focus!
    31.5    int                 iSkipWMMOUSEMOVE; // Number of WM_MOUSEMOVE messages to skip!
    31.6    int                 iMouseVisible;    //
    31.7 +
    31.8 +  PFNWP               pfnOldFrameProc;  // Old window frame procedure
    31.9 +  int                 bProportionalResize; // 0: No proportional resizing
   31.10 +                                           // 1: Do proportional resizing
   31.11 +  ULONG               ulResizingFlag;   // First resizing flag value
   31.12  };
   31.13  
   31.14 +/* OS/2 specific backdoor function to be able to set FrameControlFlags of */
   31.15 +/* the SDL window before creating it. */
   31.16  extern DECLSPEC void SDLCALL SDL_OS2FSLIB_SetFCFToUse(ULONG ulFCF);
   31.17  
   31.18  #endif /* _SDL_os2fslib_h */
    32.1 --- a/test/Makefile.wat	Sun Feb 26 13:42:00 2006 +0000
    32.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.3 @@ -1,52 +0,0 @@
    32.4 -#=============================================================================
    32.5 -#          This is a Watcom makefile to build SDL.DLL for OS/2
    32.6 -#
    32.7 -# Makefile for test applications
    32.8 -#=============================================================================
    32.9 -
   32.10 -# Create debug build or not?
   32.11 -debug_build=defined
   32.12 -
   32.13 -#-----------------------------------------------------------------------------
   32.14 -# The next part is somewhat general, for creation of EXE files.
   32.15 -#-----------------------------------------------------------------------------
   32.16 -
   32.17 -cflags = $(debugflags) -bm -bt=OS2 -5 -fpi -sg -otexan -wx -ei
   32.18 -
   32.19 -.before
   32.20 -    set include=$(%os2tk)\h;$(%include);../include
   32.21 -
   32.22 -.extensions:
   32.23 -.extensions: .exe .obj .c
   32.24 -
   32.25 -all :   testalpha.exe     &
   32.26 -        testbitmap.exe    &
   32.27 -        testcdrom.exe     &
   32.28 -        testcpuinfo.exe   &
   32.29 -        testjoystick.exe  &
   32.30 -        testkeys.exe      &
   32.31 -        testlock.exe      &
   32.32 -        testsem.exe       &
   32.33 -        testsprite.exe    &
   32.34 -        testtimer.exe     &
   32.35 -        testtypes.exe     &
   32.36 -        testver.exe       &
   32.37 -        testvidinfo.exe   &
   32.38 -        testwin.exe       &
   32.39 -        testwm.exe        &
   32.40 -        threadwin.exe     &
   32.41 -        torturethread.exe &
   32.42 -        checkkeys.exe
   32.43 -
   32.44 -.c.obj : .AUTODEPEND
   32.45 -    wcc386 -zq -bm -5s -ei -oteaxan -wx $[* $(cflags)
   32.46 -
   32.47 -.obj.exe : .AUTODEPEND
   32.48 -    wlink system os2v2 F $* L ..\src\sdl.lib name $@ op quiet
   32.49 -
   32.50 -clean : .SYMBOLIC
   32.51 -        @if exist *.exe del *.exe
   32.52 -        @if exist *.obj del *.obj
   32.53 -        @if exist *.map del *.map
   32.54 -        @if exist *.res del *.res
   32.55 -        @if exist *.lst del *.lst