os/2: port from SDL2-2.0.4 to SDL2-2.0.5: changes to SDL_os2audio.c, SDL_os2video.c, os2/SDL_systhread.c in order to accomodate SDL2-2.0.5 changes. - audio: WaitDone() is gone, CloseDevice() interface changes. - events / video: DropFile() changes: SDL_DROPBEGIN and SDL_DROPCOMPLETE events, window IDs for drops. - thread: struct SDL_Thread->stacksize
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
diff --git a/src/audio/os2/SDL_os2audio.c b/src/audio/os2/SDL_os2audio.c
index 9da0add..bf40fb8 100644
--- a/src/audio/os2/SDL_os2audio.c
+++ b/src/audio/os2/SDL_os2audio.c
@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -209,13 +209,6 @@ static void OS2_PlayDevice(_THIS)
pAData->ulNextBuf = (pAData->ulNextBuf + 1) % pAData->cMixBuffers;
}
-static void OS2_WaitDone(_THIS)
-{
- PSDL_PrivateAudioData pAData = (PSDL_PrivateAudioData)this->hidden;
-
- DosWaitEventSem( pAData->hevBuf, 3000 );
-}
-
static void OS2_CloseDevice(_THIS)
{
PSDL_PrivateAudioData pAData = (PSDL_PrivateAudioData)this->hidden;
@@ -264,7 +257,6 @@ static void OS2_CloseDevice(_THIS)
DosCloseEventSem( pAData->hevBuf );
SDL_free( pAData );
- this->hidden = NULL;
}
static int OS2_OpenDevice(_THIS, void *handle, const char *devname,
@@ -314,7 +306,6 @@ static int OS2_OpenDevice(_THIS, void *handle, const char *devname,
if ( ulRC != MCIERR_SUCCESS )
{
stMCIAmpOpen.usDeviceID = (USHORT)~0;
- OS2_CloseDevice( this );
return _MCIError( "MCI_OPEN", ulRC );
}
pAData->usDeviceId = stMCIAmpOpen.usDeviceID;
@@ -338,7 +329,6 @@ static int OS2_OpenDevice(_THIS, void *handle, const char *devname,
MCI_WAIT | MCI_SET_OFF | MCI_SET_ITEM,
&stMCIAmpSet, 0 );
-
// Set record volume.
stMCIAmpSet.ulLevel = _getEnvULong( "SDL_AUDIO_RECVOL", 100, 90 );
stMCIAmpSet.ulItem = MCI_AMP_SET_AUDIO;
@@ -394,7 +384,6 @@ static int OS2_OpenDevice(_THIS, void *handle, const char *devname,
if ( ulRC != MCIERR_SUCCESS )
{
pAData->stMCIMixSetup.ulBitsPerSample = 0;
- OS2_CloseDevice( this );
return _MCIError( "MCI_MIXSETUP", ulRC );
}
@@ -412,7 +401,6 @@ static int OS2_OpenDevice(_THIS, void *handle, const char *devname,
MCI_WAIT | MCI_ALLOCATE_MEMORY, &stMCIBuffer, 0 );
if ( ulRC != MCIERR_SUCCESS )
{
- OS2_CloseDevice( this );
return _MCIError( "MCI_BUFFER", ulRC );
}
pAData->cMixBuffers = stMCIBuffer.ulNumBuffers;
@@ -452,11 +440,12 @@ static int OS2_Init(SDL_AudioDriverImpl * impl)
impl->OpenDevice = OS2_OpenDevice;
impl->PlayDevice = OS2_PlayDevice;
impl->WaitDevice = OS2_WaitDevice;
- impl->WaitDone = OS2_WaitDone;
impl->GetDeviceBuf = OS2_GetDeviceBuf;
impl->CloseDevice = OS2_CloseDevice;
-// [Digi]: SDL 2.0 does not support recording yet (2016-02-24).
+// TODO: IMPLEMENT CAPTURE SUPPORT:
+// impl->CaptureFromDevice = ;
+// impl->FlushCapture = ;
// impl->HasCaptureSupport = SDL_TRUE;
return 1; /* this audio target is available. */
diff --git a/src/thread/os2/SDL_systhread.c b/src/thread/os2/SDL_systhread.c
index 878aa60..64d5d6f 100644
--- a/src/thread/os2/SDL_systhread.c
+++ b/src/thread/os2/SDL_systhread.c
@@ -74,14 +74,24 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args,
if ( pThreadParms == NULL )
return SDL_OutOfMemory();
- // Save the function which we will have to call to clear the RTL of calling app!
- pThreadParms->pfnCurrentEndThread = pfnEndThread;
+ if (thread->stacksize == 0)
+ thread->stacksize = 65536;
+
// Also save the real parameters we have to pass to thread function
pThreadParms->args = args;
- // Start the thread using the runtime library of calling app!
- thread->handle = (SYS_ThreadHandle)
- ( (size_t) pfnBeginThread( RunThread, NULL, 65535, pThreadParms ) );
+ if (pfnBeginThread) {
+ // Save the function which we will have to call to clear the RTL of calling app!
+ pThreadParms->pfnCurrentEndThread = pfnEndThread;
+ // Start the thread using the runtime library of calling app!
+ thread->handle = (SYS_ThreadHandle)
+ pfnBeginThread( RunThread, NULL, thread->stacksize, pThreadParms );
+ }
+ else {
+ pThreadParms->pfnCurrentEndThread = _endthread;
+ thread->handle = (SYS_ThreadHandle)
+ _beginthread( RunThread, NULL, thread->stacksize, pThreadParms );
+ }
if ( thread->handle == -1 )
return SDL_SetError( "Not enough resources to create thread" );
diff --git a/src/video/os2/SDL_os2video.c b/src/video/os2/SDL_os2video.c
index cf9d6f2..ad5d655 100644
--- a/src/video/os2/SDL_os2video.c
+++ b/src/video/os2/SDL_os2video.c
@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -428,7 +428,7 @@ static MRESULT _wmDrop(PWINDATA pWinData, PDRAGINFO pDragInfo)
// Send to SDL full file name converted to UTF-8.
pcFName = OS2_SysToUTF8( acFName );
- SDL_SendDropFile( pcFName );
+ SDL_SendDropFile( pWinData->window, pcFName );
SDL_free( pcFName );
// Notify a source that a drag operation is complete.
@@ -442,6 +442,8 @@ static MRESULT _wmDrop(PWINDATA pWinData, PDRAGINFO pDragInfo)
DrgDeleteDraginfoStrHandles( pDragInfo );
DrgFreeDraginfo( pDragInfo );
+ SDL_SendDropComplete( pWinData->window );
+
return (MRESULT)FALSE;
}