From 174e6fb602c364177c93a4ca970fcce64cec37e2 Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 2 Jan 2013 07:37:17 +0000 Subject: [PATCH] mingw DPT/pugl fixes --- .../distrho/DistrhoPluginCarla.cpp | 12 +++++++++++- c++/distrho-plugin-toolkit/DistrhoUIOpenGL.h | 18 +++++++++++++----- .../DistrhoUIOpenGLExt.h | 1 + .../src/DistrhoUIOpenGLExt.cpp | 6 ++++++ .../src/pugl/pugl_win.cpp | 6 +++--- 5 files changed, 34 insertions(+), 9 deletions(-) diff --git a/c++/carla-native/distrho/DistrhoPluginCarla.cpp b/c++/carla-native/distrho/DistrhoPluginCarla.cpp index 7a0469d..aa5d627 100644 --- a/c++/carla-native/distrho/DistrhoPluginCarla.cpp +++ b/c++/carla-native/distrho/DistrhoPluginCarla.cpp @@ -47,7 +47,7 @@ public: : QDialog(nullptr), m_host(host), m_plugin(plugin), - ui(this, winId(), setParameterCallback, setStateCallback, uiEditParameterCallback, uiSendNoteCallback, uiResizeCallback) + ui(this, realWinId(), setParameterCallback, setStateCallback, uiEditParameterCallback, uiSendNoteCallback, uiResizeCallback) { setFixedSize(ui.getWidth(), ui.getHeight()); setWindowTitle("TEST GUI"); @@ -57,6 +57,16 @@ public: { } + intptr_t realWinId() const + { + WId wId = winId(); +#if DISTRHO_OS_WINDOWS + return (intptr_t)static_cast(wId); +#else + return wId; +#endif + } + // --------------------------------------------- void carla_show(const bool yesNo) diff --git a/c++/distrho-plugin-toolkit/DistrhoUIOpenGL.h b/c++/distrho-plugin-toolkit/DistrhoUIOpenGL.h index 50168d4..caa84b1 100644 --- a/c++/distrho-plugin-toolkit/DistrhoUIOpenGL.h +++ b/c++/distrho-plugin-toolkit/DistrhoUIOpenGL.h @@ -30,6 +30,14 @@ # include #endif +#if defined(GL_BGR_EXT) && ! defined(GL_BGR) +# define GL_BGR GL_BGR_EXT +#endif + +#if defined(GL_BGRA_EXT) && ! defined(GL_BGRA) +# define GL_BGRA GL_BGRA_EXT +#endif + START_NAMESPACE_DISTRHO // ------------------------------------------------- @@ -68,11 +76,11 @@ enum Key { KEY_SUPER }; -enum Mod { - MOD_SHIFT = 1 << 0, /**< Shift key */ - MOD_CTRL = 1 << 1, /**< Control key */ - MOD_ALT = 1 << 2, /**< Alt/Option key */ - MOD_SUPER = 1 << 3 /**< Mod4/Command/Windows key */ +enum Modifier { + MODIFIER_SHIFT = 1 << 0, /**< Shift key */ + MODIFIER_CTRL = 1 << 1, /**< Control key */ + MODIFIER_ALT = 1 << 2, /**< Alt/Option key */ + MODIFIER_SUPER = 1 << 3 /**< Mod4/Command/Windows key */ }; // ------------------------------------------------- diff --git a/c++/distrho-plugin-toolkit/DistrhoUIOpenGLExt.h b/c++/distrho-plugin-toolkit/DistrhoUIOpenGLExt.h index b710acb..92f4866 100644 --- a/c++/distrho-plugin-toolkit/DistrhoUIOpenGLExt.h +++ b/c++/distrho-plugin-toolkit/DistrhoUIOpenGLExt.h @@ -23,6 +23,7 @@ #ifdef DISTRHO_UI_OPENGL #include "DistrhoUIOpenGL.h" +#include START_NAMESPACE_DISTRHO diff --git a/c++/distrho-plugin-toolkit/src/DistrhoUIOpenGLExt.cpp b/c++/distrho-plugin-toolkit/src/DistrhoUIOpenGLExt.cpp index 07aa360..0c80a2d 100644 --- a/c++/distrho-plugin-toolkit/src/DistrhoUIOpenGLExt.cpp +++ b/c++/distrho-plugin-toolkit/src/DistrhoUIOpenGLExt.cpp @@ -697,6 +697,12 @@ public: XSetTransientForHint(display, thisWindow, parentWindow); XMapRaised(display, thisWindow); +#else + return; + + // unused + (void)parentView; + (void)parentSize; #endif } diff --git a/c++/distrho-plugin-toolkit/src/pugl/pugl_win.cpp b/c++/distrho-plugin-toolkit/src/pugl/pugl_win.cpp index 2e5a3a6..5448e29 100644 --- a/c++/distrho-plugin-toolkit/src/pugl/pugl_win.cpp +++ b/c++/distrho-plugin-toolkit/src/pugl/pugl_win.cpp @@ -74,7 +74,7 @@ puglCreate(PuglNativeWindow parent, impl->hwnd = CreateWindow( "Pugl", title, - WS_VISIBLE | (parent ? WS_CHILD : (WS_POPUPWINDOW | WS_CAPTION)), + (addToDesktop ? WS_VISIBLE : 0) | (parent ? WS_CHILD : (WS_POPUPWINDOW | WS_CAPTION)), 0, 0, width, height, (HWND)parent, NULL, NULL, NULL); if (!impl->hwnd) { @@ -109,6 +109,7 @@ puglCreate(PuglNativeWindow parent, return view; // unused + (void)resizable; (void)addToDesktop; (void)x11Display; } @@ -213,7 +214,6 @@ setModifiers(PuglView* view) static LRESULT handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam) { - MSG msg; PAINTSTRUCT ps; PuglKey key; @@ -270,7 +270,7 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam) break; } // else nobreak case WM_KEYUP: - if (key = keySymToSpecial(wParam)) { + if ((key = keySymToSpecial(wParam))) { if (view->specialFunc) { view->specialFunc(view, message == WM_KEYDOWN, key); }