Browse Source

Some small win32 fixing, still not quite there yet

tags/1.9.8
falkTX 7 years ago
parent
commit
e6ee1b36f1
2 changed files with 14 additions and 19 deletions
  1. +1
    -1
      source/backend/plugin/CarlaPluginVST2.cpp
  2. +13
    -18
      source/utils/CarlaPluginUI.cpp

+ 1
- 1
source/backend/plugin/CarlaPluginVST2.cpp View File

@@ -453,7 +453,7 @@ public:
CARLA_SAFE_ASSERT_INT2(width > 1 && height > 1, width, height);

if (width > 1 && height > 1)
fUI.window->setSize(static_cast<uint>(width), static_cast<uint>(height), false);
fUI.window->setSize(static_cast<uint>(width), static_cast<uint>(height), true);
}

fUI.window->show();


+ 13
- 18
source/utils/CarlaPluginUI.cpp View File

@@ -327,8 +327,6 @@ private:

#define PUGL_LOCAL_CLOSE_MSG (WM_USER + 50)

static HINSTANCE hInstance = NULL;

static LRESULT CALLBACK wndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);

class WindowsPluginUI : public CarlaPluginUI
@@ -347,6 +345,8 @@ public:
_snprintf(classNameBuf, sizeof(classNameBuf), "CaWin_%d-%d", std::rand(), ++wc_count);
classNameBuf[sizeof(classNameBuf)-1] = '\0';

const HINSTANCE hInstance = GetModuleHandleA(nullptr);

carla_zeroStruct(fWindowClass);
fWindowClass.style = CS_OWNDC;
fWindowClass.lpfnWndProc = wndProc;
@@ -366,7 +366,7 @@ public:

fWindow = CreateWindowEx(WS_EX_TOPMOST,
classNameBuf, "Carla Plugin UI", winFlags,
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL);

if (! fWindow) {
@@ -435,17 +435,12 @@ public:
break;
}

DispatchMessage(&msg);
DispatchMessageA(&msg);
}

fIsIdling = false;
}

LRESULT handleMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
return DefWindowProc(fWindow, message, wParam, lParam);
}

LRESULT checkAndHandleMessage(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if (fWindow == hwnd)
@@ -461,7 +456,7 @@ public:
}
}

return DefWindowProc(hwnd, message, wParam, lParam);
return DefWindowProcA(hwnd, message, wParam, lParam);
}

void focus() override
@@ -524,25 +519,25 @@ private:

LRESULT CALLBACK wndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
WindowsPluginUI* ui = (WindowsPluginUI*)GetWindowLongPtr(hwnd, GWLP_USERDATA);

switch (message)
{
case WM_CREATE:
PostMessage(hwnd, WM_SHOWWINDOW, TRUE, 0);
return 0;

case WM_CLOSE:
PostMessage(hwnd, PUGL_LOCAL_CLOSE_MSG, wParam, lParam);
return 0;

#if 0
case WM_CREATE:
PostMessage(hwnd, WM_SHOWWINDOW, TRUE, 0);
return 0;

case WM_DESTROY:
return 0;
#endif

default:
if (ui != nullptr)
if (WindowsPluginUI* const ui = (WindowsPluginUI*)GetWindowLongPtr(hwnd, GWLP_USERDATA))
return ui->checkAndHandleMessage(hwnd, message, wParam, lParam);
return DefWindowProc(hwnd, message, wParam, lParam);
return DefWindowProcA(hwnd, message, wParam, lParam);
}
}
#endif // CARLA_OS_WIN


Loading…
Cancel
Save