|
|
@@ -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() |
|
|
|
{ |
|
|
|