Browse Source

Several OSX fixes, needs testing

gh-pages
falkTX 10 years ago
parent
commit
23f6ab59fd
4 changed files with 67 additions and 44 deletions
  1. +59
    -40
      dgl/src/Window.cpp
  2. +4
    -0
      dgl/src/pugl/pugl_osx.m
  3. +2
    -2
      utils/generate-vst-bundles.sh
  4. +2
    -2
      utils/lv2-ttl-generator/GNUmakefile

+ 59
- 40
dgl/src/Window.cpp View File

@@ -77,7 +77,8 @@ struct Window::PrivateData {
xWindow(0), xWindow(0),
#elif defined(DISTRHO_OS_MAC) #elif defined(DISTRHO_OS_MAC)
fNeedsIdle(true), fNeedsIdle(true),
xWindow(nullptr),
mView(nullptr),
mWindow(nullptr),
#endif #endif
leakDetector_PrivateData() leakDetector_PrivateData()
{ {
@@ -103,7 +104,8 @@ struct Window::PrivateData {
xWindow(0), xWindow(0),
#elif defined(DISTRHO_OS_MAC) #elif defined(DISTRHO_OS_MAC)
fNeedsIdle(false), fNeedsIdle(false),
xWindow(nullptr),
mView(nullptr),
mWindow(nullptr),
#endif #endif
leakDetector_PrivateData() leakDetector_PrivateData()
{ {
@@ -117,7 +119,6 @@ struct Window::PrivateData {
#endif #endif
} }


#ifndef DISTRHO_OS_MAC // TODO not working yet
PrivateData(App& app, Window* const self, const intptr_t parentId) PrivateData(App& app, Window* const self, const intptr_t parentId)
: fApp(app), : fApp(app),
fSelf(self), fSelf(self),
@@ -136,7 +137,8 @@ struct Window::PrivateData {
xWindow(0), xWindow(0),
#elif defined(DISTRHO_OS_MAC) #elif defined(DISTRHO_OS_MAC)
fNeedsIdle(false), fNeedsIdle(false),
xWindow(nullptr),
mView(nullptr),
mWindow(nullptr),
#endif #endif
leakDetector_PrivateData() leakDetector_PrivateData()
{ {
@@ -160,7 +162,6 @@ struct Window::PrivateData {
fFirstInit = false; fFirstInit = false;
} }
} }
#endif


void init() void init()
{ {
@@ -190,8 +191,10 @@ struct Window::PrivateData {
hwnd = impl->hwnd; hwnd = impl->hwnd;
DISTRHO_SAFE_ASSERT(hwnd != 0); DISTRHO_SAFE_ASSERT(hwnd != 0);
#elif defined(DISTRHO_OS_MAC) #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) #elif defined(DISTRHO_OS_LINUX)
xDisplay = impl->display; xDisplay = impl->display;
xWindow = impl->win; xWindow = impl->win;
@@ -238,7 +241,8 @@ struct Window::PrivateData {
#if defined(DISTRHO_OS_WINDOWS) #if defined(DISTRHO_OS_WINDOWS)
hwnd = 0; hwnd = 0;
#elif defined(DISTRHO_OS_MAC) #elif defined(DISTRHO_OS_MAC)
xWindow = nullptr;
mView = nullptr;
mWindow = nullptr;
#elif defined(DISTRHO_OS_LINUX) #elif defined(DISTRHO_OS_LINUX)
xDisplay = nullptr; xDisplay = nullptr;
xWindow = 0; xWindow = 0;
@@ -339,9 +343,12 @@ struct Window::PrivateData {
SetActiveWindow(hwnd); SetActiveWindow(hwnd);
SetFocus(hwnd); SetFocus(hwnd);
#elif defined(DISTRHO_OS_MAC) #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) #elif defined(DISTRHO_OS_LINUX)
XRaiseWindow(xDisplay, xWindow); XRaiseWindow(xDisplay, xWindow);
XSetInputFocus(xDisplay, xWindow, RevertToPointerRoot, CurrentTime); XSetInputFocus(xDisplay, xWindow, RevertToPointerRoot, CurrentTime);
@@ -380,9 +387,19 @@ struct Window::PrivateData {
UpdateWindow(hwnd); UpdateWindow(hwnd);
#elif defined(DISTRHO_OS_MAC) #elif defined(DISTRHO_OS_MAC)
if (yesNo) if (yesNo)
[xWindow setIsVisible:YES];
{
if (mWindow != nullptr)
[mWindow setIsVisible:YES];
else
[mView setHidden:NO];
}
else else
[xWindow setIsVisible:NO];
{
if (mWindow != nullptr)
[mWindow setIsVisible:NO];
else
[mView setHidden:YES];
}
#elif defined(DISTRHO_OS_LINUX) #elif defined(DISTRHO_OS_LINUX)
if (yesNo) if (yesNo)
XMapRaised(xDisplay, xWindow); XMapRaised(xDisplay, xWindow);
@@ -423,6 +440,12 @@ struct Window::PrivateData {


fResizable = yesNo; fResizable = yesNo;


#ifdef CARLA_OS_MAC
// FIXME?
const uint flags(yesNo ? (NSViewWidthSizable|NSViewHeightSizable) : 0x0);
[mView setAutoresizingMask:flags];
#endif

setSize(fWidth, fHeight, true); setSize(fWidth, fHeight, true);
} }


@@ -461,18 +484,19 @@ struct Window::PrivateData {
if (! forced) if (! forced)
UpdateWindow(hwnd); UpdateWindow(hwnd);
#elif defined(DISTRHO_OS_MAC) #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 # 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 # endif
}
#elif defined(DISTRHO_OS_LINUX) #elif defined(DISTRHO_OS_LINUX)
XResizeWindow(xDisplay, xWindow, width, height); XResizeWindow(xDisplay, xWindow, width, height);


@@ -508,12 +532,15 @@ struct Window::PrivateData {
#if defined(DISTRHO_OS_WINDOWS) #if defined(DISTRHO_OS_WINDOWS)
SetWindowTextA(hwnd, title); SetWindowTextA(hwnd, title);
#elif defined(DISTRHO_OS_MAC) #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) #elif defined(DISTRHO_OS_LINUX)
XStoreName(xDisplay, xWindow, title); XStoreName(xDisplay, xWindow, title);
#endif #endif
@@ -817,8 +844,9 @@ struct Window::PrivateData {
Display* xDisplay; Display* xDisplay;
::Window xWindow; ::Window xWindow;
#elif defined(DISTRHO_OS_MAC) #elif defined(DISTRHO_OS_MAC)
bool fNeedsIdle;
id xWindow;
bool fNeedsIdle;
PuglOpenGLView* mView;
id mWindow;
#endif #endif


// ------------------------------------------------------------------- // -------------------------------------------------------------------
@@ -881,16 +909,7 @@ Window::Window(App& app, Window& parent)
: pData(new PrivateData(app, this, parent)) {} : pData(new PrivateData(app, this, parent)) {}


Window::Window(App& app, intptr_t parentId) Window::Window(App& app, intptr_t parentId)
#ifndef DISTRHO_OS_MAC // TODO not working yet
: pData(new PrivateData(app, this, parentId)) {} : pData(new PrivateData(app, this, parentId)) {}
#else
: pData(new PrivateData(app, this))
{
show();
// unused
return; (void)parentId;
}
#endif


Window::~Window() Window::~Window()
{ {


+ 4
- 0
dgl/src/pugl/pugl_osx.m View File

@@ -125,6 +125,8 @@ puglDisplay(PuglView* view)
{ {
colorBits = numColorBits; colorBits = numColorBits;
depthBits = numDepthBits; depthBits = numDepthBits;
puglview = nil;
trackingArea = nil;


NSOpenGLPixelFormatAttribute pixelAttribs[16] = { NSOpenGLPixelFormatAttribute pixelAttribs[16] = {
NSOpenGLPFADoubleBuffer, NSOpenGLPFADoubleBuffer,
@@ -372,6 +374,8 @@ puglCreateWindow(PuglView* view, const char* title)
[impl->glview setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable]; [impl->glview setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
} }


[impl->glview setBoundsSize:NSMakeSize(impl->glview->puglview->width, impl->glview->puglview->height)];

if (view->parent) { if (view->parent) {
NSView* pview = (NSView*)view->parent; NSView* pview = (NSView*)view->parent;
[pview addSubview:impl->glview]; [pview addSubview:impl->glview];


+ 2
- 2
utils/generate-vst-bundles.sh View File

@@ -11,12 +11,12 @@ fi


PWD=`pwd` PWD=`pwd`


if [ ! -d /Developer ]; then
if [ ! -d /System/Library ]; then
echo "This doesn't seem to be OSX, please stop!" echo "This doesn't seem to be OSX, please stop!"
exit 0 exit 0
fi fi


rm -r *.vst/
rm -rf *.vst/


PLUGINS=`ls | grep vst.dylib` PLUGINS=`ls | grep vst.dylib`




+ 2
- 2
utils/lv2-ttl-generator/GNUmakefile View File

@@ -9,10 +9,10 @@ build: ../lv2_ttl_generator
endif endif


../lv2_ttl_generator: lv2_ttl_generator.c ../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 ../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 touch ../lv2_ttl_generator


clean: clean:


Loading…
Cancel
Save