mirror of https://github.com/encounter/SDL.git
os2: integrate the port into main tree.
This commit is contained in:
parent
20db1471e5
commit
d27238751f
17
Makefile.os2
17
Makefile.os2
|
@ -12,6 +12,7 @@ LNKFILE = $(LIBNAME).lnk
|
|||
|
||||
INCPATH = -I"$(%WATCOM)/h/os2" -I"$(%WATCOM)/h"
|
||||
INCPATH+= -Iinclude
|
||||
INCPATH+= -I"src/core/os2" -I"src/core/os2/geniconv"
|
||||
|
||||
LIBM = libm.lib
|
||||
LIBS = mmpm2.lib libuls.lib libconv.lib $(LIBM)
|
||||
|
@ -26,6 +27,12 @@ CFLAGS+= $(INCPATH)
|
|||
# building SDL itself (for DECLSPEC):
|
||||
CFLAGS+= -DBUILD_SDL
|
||||
|
||||
# Debug options:
|
||||
# - debug messages from OS/2 related code to stdout:
|
||||
#CFLAGS+= -DOS2DEBUG
|
||||
# - debug messages from OS/2 code via SDL_LogDebug():
|
||||
#CFLAGS+= -DOS2DEBUG=2
|
||||
|
||||
MSRCS= e_atan2.c e_exp.c e_fmod.c e_log10.c e_log.c e_pow.c e_rem_pio2.c e_sqrt.c &
|
||||
k_cos.c k_rem_pio2.c k_sin.c k_tan.c &
|
||||
s_atan.c s_copysign.c s_cos.c s_fabs.c s_floor.c s_scalbn.c s_sin.c s_tan.c
|
||||
|
@ -58,6 +65,11 @@ SRCS+= SDL_dummysensor.c
|
|||
SRCS+= SDL_locale.c SDL_syslocale.c
|
||||
SRCS+= SDL_url.c SDL_sysurl.c
|
||||
|
||||
SRCS+= SDL_os2.c geniconv.c os2cp.c os2iconv.c sys2utf8.c
|
||||
SRCS+= SDL_os2audio.c
|
||||
SRCS+= SDL_os2video.c SDL_os2util.c SDL_os2dive.c SDL_os2vman.c &
|
||||
SDL_os2mouse.c SDL_os2messagebox.c
|
||||
|
||||
SRCS+= SDL_dynapi.c
|
||||
|
||||
OBJS = $(SRCS:.c=.obj)
|
||||
|
@ -68,7 +80,7 @@ MOBJS= $(MSRCS:.c=.obj)
|
|||
|
||||
.c: ./src;./src/dynapi;./src/audio;./src/cpuinfo;./src/events;./src/file;./src/haptic;./src/joystick;./src/power;./src/render;./src/render/software;./src/sensor;./src/stdlib;./src/thread;./src/timer;./src/video;./src/video/yuv2rgb;./src/atomic;./src/audio/disk;
|
||||
.c: ./src/haptic/dummy;./src/joystick/dummy;./src/audio/dummy;./src/video/dummy;./src/sensor/dummy;
|
||||
.c: ./src/loadso/dummy;./src/filesystem/dummy;./src/timer/dummy;./src/thread/generic;
|
||||
.c: ./src/core/os2;./src/core/os2/geniconv;./src/audio/os2;./src/loadso/os2;./src/filesystem/os2;./src/thread/os2;./src/timer/os2;./src/video/os2;
|
||||
.c: ./src/locale/;./src/locale/unix;./src/misc;./src/misc/dummy;
|
||||
|
||||
all: $(DLLFILE) $(LIBFILE) .symbolic
|
||||
|
@ -84,6 +96,9 @@ $(LIBFILE): $(DLLFILE)
|
|||
.c.obj:
|
||||
wcc386 $(CFLAGS) -fo=$^@ $<
|
||||
|
||||
SDL_syscond.obj: "src/thread/generic/SDL_syscond.c"
|
||||
wcc386 $(CFLAGS) -fo=$^@ $<
|
||||
|
||||
SDL_cpuinfo.obj: SDL_cpuinfo.c
|
||||
wcc386 $(CFLAGS) -wcd=200 -fo=$^@ $<
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
#define SDL_AUDIO_DRIVER_DISK 1
|
||||
#define SDL_AUDIO_DRIVER_OS2 1
|
||||
|
||||
#define SDL_POWER_DISABLED 1
|
||||
#define SDL_JOYSTICK_DISABLED 1
|
||||
|
@ -34,6 +35,7 @@
|
|||
|
||||
#define SDL_SENSOR_DUMMY 1
|
||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||
#define SDL_VIDEO_DRIVER_OS2 1
|
||||
|
||||
/* Enable OpenGL support */
|
||||
/* #undef SDL_VIDEO_OPENGL */
|
||||
|
@ -41,10 +43,10 @@
|
|||
/* Enable Vulkan support */
|
||||
/* #undef SDL_VIDEO_VULKAN */
|
||||
|
||||
#define SDL_LOADSO_DISABLED 1
|
||||
#define SDL_THREADS_DISABLED 1
|
||||
#define SDL_TIMERS_DISABLED 1
|
||||
#define SDL_FILESYSTEM_DUMMY 1
|
||||
#define SDL_THREAD_OS2 1
|
||||
#define SDL_LOADSO_OS2 1
|
||||
#define SDL_TIMER_OS2 1
|
||||
#define SDL_FILESYSTEM_OS2 1
|
||||
|
||||
/* Enable assembly routines */
|
||||
#define SDL_ASSEMBLY_ROUTINES 1
|
||||
|
|
|
@ -106,6 +106,11 @@ typedef void *EGLSurface;
|
|||
#if defined(SDL_VIDEO_DRIVER_VIVANTE)
|
||||
#include "SDL_egl.h"
|
||||
#endif
|
||||
|
||||
#if defined(SDL_VIDEO_DRIVER_OS2)
|
||||
#define INCL_WIN
|
||||
#include <os2.h>
|
||||
#endif
|
||||
#endif /* SDL_PROTOTYPES_ONLY */
|
||||
|
||||
|
||||
|
@ -186,6 +191,16 @@ struct SDL_SysWMmsg
|
|||
int dummy;
|
||||
/* No Vivante window events yet */
|
||||
} vivante;
|
||||
#endif
|
||||
#if defined(SDL_VIDEO_DRIVER_OS2)
|
||||
struct
|
||||
{
|
||||
BOOL fFrame; /**< TRUE if hwnd is a frame window */
|
||||
HWND hwnd; /**< The window receiving the message */
|
||||
ULONG msg; /**< The message identifier */
|
||||
MPARAM mp1; /**< The first first message parameter */
|
||||
MPARAM mp2; /**< The second first message parameter */
|
||||
} os2;
|
||||
#endif
|
||||
/* Can't have an empty union */
|
||||
int dummy;
|
||||
|
@ -280,6 +295,14 @@ struct SDL_SysWMinfo
|
|||
} android;
|
||||
#endif
|
||||
|
||||
#if defined(SDL_VIDEO_DRIVER_OS2)
|
||||
struct
|
||||
{
|
||||
HWND hwnd; /**< The window handle */
|
||||
HWND hwndFrame; /**< The frame window handle */
|
||||
} os2;
|
||||
#endif
|
||||
|
||||
#if defined(SDL_VIDEO_DRIVER_VIVANTE)
|
||||
struct
|
||||
{
|
||||
|
|
17
src/SDL.c
17
src/SDL.c
|
@ -27,6 +27,12 @@
|
|||
#elif !defined(__WINRT__)
|
||||
#include <unistd.h> /* For _exit(), etc. */
|
||||
#endif
|
||||
#if defined(__OS2__)
|
||||
#include "core/os2/SDL_os2.h"
|
||||
#endif
|
||||
#if SDL_THREAD_OS2
|
||||
#include "thread/os2/SDL_systls_c.h"
|
||||
#endif
|
||||
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
#include <emscripten.h>
|
||||
|
@ -159,6 +165,10 @@ SDL_InitSubSystem(Uint32 flags)
|
|||
flags |= SDL_INIT_EVENTS;
|
||||
}
|
||||
|
||||
#if SDL_THREAD_OS2
|
||||
SDL_OS2TLSAlloc(); /* thread/os2/SDL_systls.c */
|
||||
#endif
|
||||
|
||||
#if SDL_VIDEO_DRIVER_WINDOWS
|
||||
if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) {
|
||||
if (SDL_HelperWindowCreate() < 0) {
|
||||
|
@ -294,6 +304,13 @@ SDL_Init(Uint32 flags)
|
|||
void
|
||||
SDL_QuitSubSystem(Uint32 flags)
|
||||
{
|
||||
#if SDL_THREAD_OS2
|
||||
SDL_OS2TLSFree(); /* thread/os2/SDL_systls.c */
|
||||
#endif
|
||||
#if defined(__OS2__)
|
||||
SDL_OS2Quit();
|
||||
#endif
|
||||
|
||||
/* Shut down requested initialized subsystems */
|
||||
#if !SDL_SENSOR_DISABLED
|
||||
if ((flags & SDL_INIT_SENSOR)) {
|
||||
|
|
|
@ -104,6 +104,9 @@ static const AudioBootStrap *const bootstrap[] = {
|
|||
#if SDL_AUDIO_DRIVER_JACK
|
||||
&JACK_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_OS2
|
||||
&OS2AUDIO_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_DISK
|
||||
&DISKAUDIO_bootstrap,
|
||||
#endif
|
||||
|
|
|
@ -207,6 +207,7 @@ extern AudioBootStrap openslES_bootstrap;
|
|||
extern AudioBootStrap ANDROIDAUDIO_bootstrap;
|
||||
extern AudioBootStrap PSPAUDIO_bootstrap;
|
||||
extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap;
|
||||
extern AudioBootStrap OS2AUDIO_bootstrap;
|
||||
|
||||
#endif /* SDL_sysaudio_h_ */
|
||||
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
#ifdef __WIN32__
|
||||
#include "../core/windows/SDL_windows.h" // For GetDoubleClickTime()
|
||||
#endif
|
||||
#if defined(__OS2__)
|
||||
#define INCL_WIN
|
||||
#include <os2.h>
|
||||
#endif
|
||||
|
||||
/* #define DEBUG_MOUSE */
|
||||
|
||||
|
@ -54,6 +58,8 @@ SDL_MouseDoubleClickTimeChanged(void *userdata, const char *name, const char *ol
|
|||
} else {
|
||||
#ifdef __WIN32__
|
||||
mouse->double_click_time = GetDoubleClickTime();
|
||||
#elif defined(__OS2__)
|
||||
mouse->double_click_time = WinQuerySysValue(HWND_DESKTOP, SV_DBLCLKTIME);
|
||||
#else
|
||||
mouse->double_click_time = 500;
|
||||
#endif
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
#include "psp/SDL_systhread_c.h"
|
||||
#elif SDL_THREAD_STDCPP
|
||||
#include "stdcpp/SDL_systhread_c.h"
|
||||
#elif SDL_THREAD_OS2
|
||||
#include "os2/SDL_systhread_c.h"
|
||||
#else
|
||||
#error Need thread implementation for this platform
|
||||
#include "generic/SDL_systhread_c.h"
|
||||
|
|
|
@ -436,6 +436,8 @@ extern VideoBootStrap VIVANTE_bootstrap;
|
|||
extern VideoBootStrap Emscripten_bootstrap;
|
||||
extern VideoBootStrap QNX_bootstrap;
|
||||
extern VideoBootStrap OFFSCREEN_bootstrap;
|
||||
extern VideoBootStrap OS2DIVE_bootstrap;
|
||||
extern VideoBootStrap OS2VMAN_bootstrap;
|
||||
|
||||
extern SDL_VideoDevice *SDL_GetVideoDevice(void);
|
||||
extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode);
|
||||
|
|
|
@ -112,6 +112,10 @@ static VideoBootStrap *bootstrap[] = {
|
|||
#if SDL_VIDEO_DRIVER_OFFSCREEN
|
||||
&OFFSCREEN_bootstrap,
|
||||
#endif
|
||||
#if SDL_VIDEO_DRIVER_OS2
|
||||
&OS2DIVE_bootstrap,
|
||||
&OS2VMAN_bootstrap,
|
||||
#endif
|
||||
#if SDL_VIDEO_DRIVER_DUMMY
|
||||
&DUMMY_bootstrap,
|
||||
#endif
|
||||
|
@ -3926,9 +3930,11 @@ SDL_IsScreenKeyboardShown(SDL_Window *window)
|
|||
#if SDL_VIDEO_DRIVER_HAIKU
|
||||
#include "haiku/SDL_bmessagebox.h"
|
||||
#endif
|
||||
#if SDL_VIDEO_DRIVER_OS2
|
||||
#include "os2/SDL_os2messagebox.h"
|
||||
#endif
|
||||
|
||||
|
||||
#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT || SDL_VIDEO_DRIVER_COCOA || SDL_VIDEO_DRIVER_UIKIT || SDL_VIDEO_DRIVER_X11 || SDL_VIDEO_DRIVER_HAIKU
|
||||
#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT || SDL_VIDEO_DRIVER_COCOA || SDL_VIDEO_DRIVER_UIKIT || SDL_VIDEO_DRIVER_X11 || SDL_VIDEO_DRIVER_HAIKU || SDL_VIDEO_DRIVER_OS2
|
||||
static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype)
|
||||
{
|
||||
SDL_SysWMinfo info;
|
||||
|
@ -4027,6 +4033,13 @@ SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
|||
HAIKU_ShowMessageBox(messageboxdata, buttonid) == 0) {
|
||||
retval = 0;
|
||||
}
|
||||
#endif
|
||||
#if SDL_VIDEO_DRIVER_OS2
|
||||
if (retval == -1 &&
|
||||
SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_OS2) &&
|
||||
OS2_ShowMessageBox(messageboxdata, buttonid) == 0) {
|
||||
retval = 0;
|
||||
}
|
||||
#endif
|
||||
if (retval == -1) {
|
||||
SDL_SetError("No message system available");
|
||||
|
|
|
@ -13,7 +13,7 @@ TARGETS = testatomic.exe testdisplayinfo.exe testbounds.exe testdraw2.exe &
|
|||
testviewport.exe testwm2.exe torturethread.exe checkkeys.exe &
|
||||
controllermap.exe testhaptic.exe testqsort.exe testresample.exe &
|
||||
testaudioinfo.exe testaudiocapture.exe loopwave.exe loopwavequeue.exe &
|
||||
testyuv.exe testgl2.exe testvulkan.exe testautomation.exe
|
||||
testyuv.exe testgl2.exe testvulkan.exe testnative.exe testautomation.exe
|
||||
|
||||
# SDL2test.lib sources (../src/test)
|
||||
|
||||
|
@ -69,6 +69,10 @@ testautomation.exe: $(TAOBJS)
|
|||
@%make $(TESTLIB)
|
||||
wlink SYS os2v2 libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@
|
||||
|
||||
testnative.exe: testnative.obj testnativeos2.obj
|
||||
@%make $(TESTLIB)
|
||||
wlink SYS os2v2 libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@
|
||||
|
||||
testoverlay2.exe: testoverlay2.obj testyuv_cvt.obj
|
||||
@%make $(TESTLIB)
|
||||
wlink SYS os2v2 libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@
|
||||
|
|
|
@ -31,6 +31,9 @@ static NativeWindowFactory *factories[] = {
|
|||
#endif
|
||||
#ifdef TEST_NATIVE_COCOA
|
||||
&CocoaWindowFactory,
|
||||
#endif
|
||||
#ifdef TEST_NATIVE_OS2
|
||||
&OS2WindowFactory,
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
|
|
@ -44,3 +44,8 @@ extern NativeWindowFactory X11WindowFactory;
|
|||
#define TEST_NATIVE_COCOA
|
||||
extern NativeWindowFactory CocoaWindowFactory;
|
||||
#endif
|
||||
|
||||
#ifdef SDL_VIDEO_DRIVER_OS2
|
||||
#define TEST_NATIVE_OS2
|
||||
extern NativeWindowFactory OS2WindowFactory;
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue