commit 23f6ab59fde5ed8dfa29712b775c7714b2b8b984
parent d362fed0020b0ba78b452b709b7e9ebb1334c2f8
Author: falkTX <falktx@gmail.com>
Date: Sat, 11 Oct 2014 12:55:25 +0100
Several OSX fixes, needs testing
Diffstat:
4 files changed, 67 insertions(+), 44 deletions(-)
diff --git a/dgl/src/Window.cpp b/dgl/src/Window.cpp
@@ -77,7 +77,8 @@ struct Window::PrivateData {
xWindow(0),
#elif defined(DISTRHO_OS_MAC)
fNeedsIdle(true),
- xWindow(nullptr),
+ mView(nullptr),
+ mWindow(nullptr),
#endif
leakDetector_PrivateData()
{
@@ -103,7 +104,8 @@ struct Window::PrivateData {
xWindow(0),
#elif defined(DISTRHO_OS_MAC)
fNeedsIdle(false),
- xWindow(nullptr),
+ mView(nullptr),
+ mWindow(nullptr),
#endif
leakDetector_PrivateData()
{
@@ -117,7 +119,6 @@ struct Window::PrivateData {
#endif
}
-#ifndef DISTRHO_OS_MAC // TODO not working yet
PrivateData(App& app, Window* const self, const intptr_t parentId)
: fApp(app),
fSelf(self),
@@ -136,7 +137,8 @@ struct Window::PrivateData {
xWindow(0),
#elif defined(DISTRHO_OS_MAC)
fNeedsIdle(false),
- xWindow(nullptr),
+ mView(nullptr),
+ mWindow(nullptr),
#endif
leakDetector_PrivateData()
{
@@ -160,7 +162,6 @@ struct Window::PrivateData {
fFirstInit = false;
}
}
-#endif
void init()
{
@@ -190,8 +191,10 @@ struct Window::PrivateData {
hwnd = impl->hwnd;
DISTRHO_SAFE_ASSERT(hwnd != 0);
#elif defined(DISTRHO_OS_MAC)
- xWindow = impl->window;
- DISTRHO_SAFE_ASSERT(xWindow != nullptr);
+ mView = impl->glview;
+ mWindow = impl->window;
+ DISTRHO_SAFE_ASSERT(mView != nullptr);
+ DISTRHO_SAFE_ASSERT(fUsingEmbed || mWindow != nullptr);
#elif defined(DISTRHO_OS_LINUX)
xDisplay = impl->display;
xWindow = impl->win;
@@ -238,7 +241,8 @@ struct Window::PrivateData {
#if defined(DISTRHO_OS_WINDOWS)
hwnd = 0;
#elif defined(DISTRHO_OS_MAC)
- xWindow = nullptr;
+ mView = nullptr;
+ mWindow = nullptr;
#elif defined(DISTRHO_OS_LINUX)
xDisplay = nullptr;
xWindow = 0;
@@ -339,9 +343,12 @@ struct Window::PrivateData {
SetActiveWindow(hwnd);
SetFocus(hwnd);
#elif defined(DISTRHO_OS_MAC)
- // TODO
- //[NSApp activateIgnoringOtherApps:YES];
- //[xWindow makeKeyAndOrderFront:xWindow];
+ if (mWindow != nullptr)
+ {
+ // TODO
+ //[NSApp activateIgnoringOtherApps:YES];
+ //[mWindow makeKeyAndOrderFront:mWindow];
+ }
#elif defined(DISTRHO_OS_LINUX)
XRaiseWindow(xDisplay, xWindow);
XSetInputFocus(xDisplay, xWindow, RevertToPointerRoot, CurrentTime);
@@ -380,9 +387,19 @@ struct Window::PrivateData {
UpdateWindow(hwnd);
#elif defined(DISTRHO_OS_MAC)
if (yesNo)
- [xWindow setIsVisible:YES];
+ {
+ if (mWindow != nullptr)
+ [mWindow setIsVisible:YES];
+ else
+ [mView setHidden:NO];
+ }
else
- [xWindow setIsVisible:NO];
+ {
+ if (mWindow != nullptr)
+ [mWindow setIsVisible:NO];
+ else
+ [mView setHidden:YES];
+ }
#elif defined(DISTRHO_OS_LINUX)
if (yesNo)
XMapRaised(xDisplay, xWindow);
@@ -423,6 +440,12 @@ struct Window::PrivateData {
fResizable = yesNo;
+#ifdef CARLA_OS_MAC
+ // FIXME?
+ const uint flags(yesNo ? (NSViewWidthSizable|NSViewHeightSizable) : 0x0);
+ [mView setAutoresizingMask:flags];
+#endif
+
setSize(fWidth, fHeight, true);
}
@@ -461,18 +484,19 @@ struct Window::PrivateData {
if (! forced)
UpdateWindow(hwnd);
#elif defined(DISTRHO_OS_MAC)
- [xWindow setContentSize:NSMakeSize(width, height)];
+ [mView setBoundsSize:NSMakeSize(width, height)];
+
+ if (mWindow != nullptr)
+ {
+ [mWindow setContentSize:NSMakeSize(width, height)];
# if 0
- NSRect frame = [xWindow frame];
- frame.origin.y -= height - frame.size.height;
- frame.size.width = width;
- frame.size.height = height+20;
-
- //if (forced)
- // [xWindow setFrame:frame];
- //else
- [xWindow setFrame:frame display:YES animate:NO];
+ NSRect frame = [mWindow frame];
+ frame.origin.y -= height - frame.size.height;
+ frame.size.width = width;
+ frame.size.height = height+20;
+ [mWindow setFrame:frame display:YES animate:NO];
# endif
+ }
#elif defined(DISTRHO_OS_LINUX)
XResizeWindow(xDisplay, xWindow, width, height);
@@ -508,12 +532,15 @@ struct Window::PrivateData {
#if defined(DISTRHO_OS_WINDOWS)
SetWindowTextA(hwnd, title);
#elif defined(DISTRHO_OS_MAC)
- NSString* titleString = [[NSString alloc]
- initWithBytes:title
- length:strlen(title)
- encoding:NSUTF8StringEncoding];
-
- [xWindow setTitle:titleString];
+ if (mWindow != nullptr)
+ {
+ NSString* titleString = [[NSString alloc]
+ initWithBytes:title
+ length:strlen(title)
+ encoding:NSUTF8StringEncoding];
+
+ [mWindow setTitle:titleString];
+ }
#elif defined(DISTRHO_OS_LINUX)
XStoreName(xDisplay, xWindow, title);
#endif
@@ -817,8 +844,9 @@ struct Window::PrivateData {
Display* xDisplay;
::Window xWindow;
#elif defined(DISTRHO_OS_MAC)
- bool fNeedsIdle;
- id xWindow;
+ bool fNeedsIdle;
+ PuglOpenGLView* mView;
+ id mWindow;
#endif
// -------------------------------------------------------------------
@@ -881,16 +909,7 @@ Window::Window(App& app, Window& parent)
: pData(new PrivateData(app, this, parent)) {}
Window::Window(App& app, intptr_t parentId)
-#ifndef DISTRHO_OS_MAC // TODO not working yet
: pData(new PrivateData(app, this, parentId)) {}
-#else
- : pData(new PrivateData(app, this))
-{
- show();
- // unused
- return; (void)parentId;
-}
-#endif
Window::~Window()
{
diff --git a/dgl/src/pugl/pugl_osx.m b/dgl/src/pugl/pugl_osx.m
@@ -125,6 +125,8 @@ puglDisplay(PuglView* view)
{
colorBits = numColorBits;
depthBits = numDepthBits;
+ puglview = nil;
+ trackingArea = nil;
NSOpenGLPixelFormatAttribute pixelAttribs[16] = {
NSOpenGLPFADoubleBuffer,
@@ -372,6 +374,8 @@ puglCreateWindow(PuglView* view, const char* title)
[impl->glview setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
}
+ [impl->glview setBoundsSize:NSMakeSize(impl->glview->puglview->width, impl->glview->puglview->height)];
+
if (view->parent) {
NSView* pview = (NSView*)view->parent;
[pview addSubview:impl->glview];
diff --git a/utils/generate-vst-bundles.sh b/utils/generate-vst-bundles.sh
@@ -11,12 +11,12 @@ fi
PWD=`pwd`
-if [ ! -d /Developer ]; then
+if [ ! -d /System/Library ]; then
echo "This doesn't seem to be OSX, please stop!"
exit 0
fi
-rm -r *.vst/
+rm -rf *.vst/
PLUGINS=`ls | grep vst.dylib`
diff --git a/utils/lv2-ttl-generator/GNUmakefile b/utils/lv2-ttl-generator/GNUmakefile
@@ -9,10 +9,10 @@ build: ../lv2_ttl_generator
endif
../lv2_ttl_generator: lv2_ttl_generator.c
- $(CXX) lv2_ttl_generator.c -o ../lv2_ttl_generator -ldl
+ $(CC) lv2_ttl_generator.c -o ../lv2_ttl_generator -ldl
../lv2_ttl_generator.exe: lv2_ttl_generator.c
- $(CXX) lv2_ttl_generator.c -o ../lv2_ttl_generator.exe -static
+ $(CC) lv2_ttl_generator.c -o ../lv2_ttl_generator.exe -static
touch ../lv2_ttl_generator
clean: