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
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 @@
     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 @@
     DosCloseEventSem( pAData->hevBuf );
 
   SDL_free( pAData );
-  this->hidden = NULL;
 }
 
 static int OS2_OpenDevice(_THIS, void *handle, const char *devname,
@@ -314,7 +306,6 @@
   if ( ulRC != MCIERR_SUCCESS )
   {
     stMCIAmpOpen.usDeviceID = (USHORT)~0;
-    OS2_CloseDevice( this );
     return _MCIError( "MCI_OPEN", ulRC );
   }
   pAData->usDeviceId = stMCIAmpOpen.usDeviceID;
@@ -338,7 +329,6 @@
                     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 @@
   if ( ulRC != MCIERR_SUCCESS )
   {
     pAData->stMCIMixSetup.ulBitsPerSample = 0;
-    OS2_CloseDevice( this );
     return _MCIError( "MCI_MIXSETUP", ulRC );
   }
 
@@ -412,7 +401,6 @@
                          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 @@
   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 @@
   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 @@
 
       // 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 @@
   DrgDeleteDraginfoStrHandles( pDragInfo );
   DrgFreeDraginfo( pDragInfo );
 
+  SDL_SendDropComplete( pWinData->window );
+
   return (MRESULT)FALSE;
 }