Use PLATFORM_WINDOWS (in preference to WIN32) for consistency with the other libraries
[ardour.git] / libs / fst / vstwin.c
index c07aaa09dcd01d7d7d8e8ff8be1aed348e7df4c7..27fb3cbead21af949eb87ed6361e4d21df356f61 100644 (file)
@@ -8,12 +8,10 @@
 
 #include <pthread.h>
 static UINT_PTR idle_timer_id   = 0;
-extern char *basename(char *path);
 
 #else /* linux + wine */
 
 #include <linux/limits.h> // PATH_MAX
-#include <libgen.h> // basename
 #include <winnt.h>
 #include <wine/exception.h>
 #include <pthread.h>
@@ -225,7 +223,7 @@ fst_new (void)
        fst->n_pending_keys = 0;
        fst->has_editor = 0;
 #ifdef PLATFORM_WINDOWS
-       fst->voffset = 36;
+       fst->voffset = 50;
        fst->hoffset = 0;
 #else /* linux + wine */
        fst->voffset = 24;
@@ -467,7 +465,7 @@ fst_move_window_into_view (VSTState* fst)
 {
        if (fst->windows_window) {
 #ifdef PLATFORM_WINDOWS
-               SetWindowPos ((HWND)(fst->windows_window), 0, fst->hoffset, fst->voffset, fst->width, fst->height, 0);
+               SetWindowPos ((HWND)(fst->windows_window), 0, fst->hoffset, fst->voffset, fst->width + fst->hoffset, fst->height + fst->voffset, 0);
 #else /* linux + wine */
                SetWindowPos ((HWND)(fst->windows_window), 0, 0, 0, fst->width + fst->hoffset, fst->height + fst->voffset, 0);
 #endif
@@ -491,9 +489,8 @@ fst_load (const char *path)
        if ((strlen(path)) && (NULL != (fhandle = fst_handle_new ())))
        {
                char* period;
-               fhandle->nameptr = strdup (path);
                fhandle->path = strdup (path);
-               fhandle->name = basename(fhandle->nameptr);
+               fhandle->name = g_path_get_basename(path);
                if ((period = strrchr (fhandle->name, '.'))) {
                        *period = '\0';
                }
@@ -504,10 +501,10 @@ fst_load (const char *path)
                        return NULL;
                }
 
-               fhandle->main_entry = (main_entry_t) GetProcAddress (fhandle->dll, "main");
+               fhandle->main_entry = (main_entry_t) GetProcAddress ((HMODULE)fhandle->dll, "main");
 
                if (fhandle->main_entry == 0) {
-                       if ((fhandle->main_entry = (main_entry_t) GetProcAddress (fhandle->dll, "VSTPluginMain"))) {
+                       if ((fhandle->main_entry = (main_entry_t) GetProcAddress ((HMODULE)fhandle->dll, "VSTPluginMain"))) {
                                fprintf(stderr, "VST >= 2.4 plugin '%s'\n", path);
                                //PBD::warning << path << _(": is a VST >= 2.4 - this plugin may or may not function correctly with this version of Ardour.") << endmsg;
                        }
@@ -542,9 +539,8 @@ fst_unload (VSTHandle** fhandle)
                (*fhandle)->path = NULL;
        }
 
-       if ((*fhandle)->nameptr) {
-               free ((*fhandle)->nameptr);
-               (*fhandle)->nameptr = NULL;
+       if ((*fhandle)->name) {
+               free ((*fhandle)->name);
                (*fhandle)->name = NULL;
        }