From f0cca0af9210f7e22d695648bd20aa336437394a Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 1 Jan 2018 12:50:22 +0100 Subject: [PATCH] Misc changes --- dgl/Makefile | 3 --- dgl/src/NanoVG.cpp | 12 +++++++++++- dgl/src/Window.cpp | 33 ++++++++++++++++++++++++--------- dgl/src/pugl/pugl_osx.m | 15 ++++++++------- distrho/DistrhoUtils.hpp | 4 ++-- 5 files changed, 45 insertions(+), 22 deletions(-) diff --git a/dgl/Makefile b/dgl/Makefile index fc61422b..aa694c63 100644 --- a/dgl/Makefile +++ b/dgl/Makefile @@ -15,9 +15,6 @@ LINK_FLAGS += $(DGL_LIBS) ifneq ($(MACOS_OLD),true) # needed by sofd right now, fix later BUILD_CXX_FLAGS += -Wno-type-limits -fpermissive - -# needed by stb_image -BUILD_CXX_FLAGS += -Wno-misleading-indentation -Wno-shift-negative-value endif # -------------------------------------------------------------- diff --git a/dgl/src/NanoVG.cpp b/dgl/src/NanoVG.cpp index 0fcb29f9..2b9f0d4a 100644 --- a/dgl/src/NanoVG.cpp +++ b/dgl/src/NanoVG.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2016 Filipe Coelho + * Copyright (C) 2012-2018 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this @@ -972,8 +972,18 @@ END_NAMESPACE_DGL #undef final +#if defined(__GNUC__) && (__GNUC__ >= 6) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmisleading-indentation" +# pragma GCC diagnostic ignored "-Wshift-negative-value" +#endif + extern "C" { #include "nanovg/nanovg.c" } +#if defined(__GNUC__) && (__GNUC__ >= 6) +# pragma GCC diagnostic pop +#endif + // ----------------------------------------------------------------------- diff --git a/dgl/src/Window.cpp b/dgl/src/Window.cpp index 2ed4c1fa..85975f67 100644 --- a/dgl/src/Window.cpp +++ b/dgl/src/Window.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2016 Filipe Coelho + * Copyright (C) 2012-2018 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this @@ -25,6 +25,11 @@ #include "pugl/pugl.h" +#if defined(__GNUC__) && (__GNUC__ >= 7) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wimplicit-fallthrough" +#endif + #if defined(DISTRHO_OS_WINDOWS) # include "pugl/pugl_win.cpp" #elif defined(DISTRHO_OS_MAC) @@ -37,6 +42,10 @@ extern "C" { } #endif +#if defined(__GNUC__) && (__GNUC__ >= 7) +# pragma GCC diagnostic pop +#endif + #include "ApplicationPrivateData.hpp" #include "WidgetPrivateData.hpp" #include "../StandaloneWindow.hpp" @@ -123,11 +132,14 @@ struct Window::PrivateData { #if defined(DISTRHO_OS_WINDOWS) // TODO #elif defined(DISTRHO_OS_MAC) - // TODO - //[parentImpl->window orderWindow:NSWindowBelow relativeTo:[[mView window] windowNumber]]; + [parentImpl->window orderWindow:NSWindowBelow relativeTo:[[mView window] windowNumber]]; #else XSetTransientForHint(xDisplay, xWindow, parentImpl->win); #endif + return; + + // maybe unused + (void)parentImpl; } PrivateData(Application& app, Window* const self, const intptr_t parentId) @@ -392,11 +404,7 @@ struct Window::PrivateData { SetFocus(hwnd); #elif defined(DISTRHO_OS_MAC) if (mWindow != nullptr) - { - // TODO - //[NSApp activateIgnoringOtherApps:YES]; - //[mWindow makeKeyAndOrderFront:mWindow]; - } + [mWindow makeKeyWindow]; #else XRaiseWindow(xDisplay, xWindow); XSetInputFocus(xDisplay, xWindow, RevertToPointerRoot, CurrentTime); @@ -615,10 +623,17 @@ struct Window::PrivateData { void setTransientWinId(const uintptr_t winId) { + DISTRHO_SAFE_ASSERT_RETURN(winId != 0,); + #if defined(DISTRHO_OS_WINDOWS) // TODO #elif defined(DISTRHO_OS_MAC) - // TODO + NSWindow* const window = [NSApp windowWithWindowNumber:winId]; + DISTRHO_SAFE_ASSERT_RETURN(window != nullptr,); + + [window addChildWindow:mWindow + ordered:NSWindowAbove]; + [mWindow makeKeyWindow]; #else XSetTransientForHint(xDisplay, xWindow, static_cast< ::Window>(winId)); #endif diff --git a/dgl/src/pugl/pugl_osx.m b/dgl/src/pugl/pugl_osx.m index b4d64be2..fb848791 100644 --- a/dgl/src/pugl/pugl_osx.m +++ b/dgl/src/pugl/pugl_osx.m @@ -441,13 +441,11 @@ void puglLeaveContext(PuglView* view, bool flush) { #ifdef PUGL_HAVE_GL - if (view->ctx_type == PUGL_GL) { - if (flush) { - if (view->impl->glview->doubleBuffered) { - [[view->impl->glview openGLContext] flushBuffer]; - } else { - glFlush(); - } + if (view->ctx_type == PUGL_GL && flush) { + if (view->impl->glview->doubleBuffered) { + [[view->impl->glview openGLContext] flushBuffer]; + } else { + glFlush(); } //[NSOpenGLContext clearCurrentContext]; } @@ -575,4 +573,7 @@ void* puglGetContext(PuglView* view) { return NULL; + + // unused + (void)view; } diff --git a/distrho/DistrhoUtils.hpp b/distrho/DistrhoUtils.hpp index bd2eefff..ee2cb571 100644 --- a/distrho/DistrhoUtils.hpp +++ b/distrho/DistrhoUtils.hpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2016 Filipe Coelho + * Copyright (C) 2012-2018 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this @@ -33,7 +33,7 @@ # include #endif -#if defined(DISTRHO_OS_MAC) && ! defined(CARLA_OS_MAC) && ! (defined(DISTRHO_PROPER_CPP11_SUPPORT) && defined(__clang__)) +#if defined(DISTRHO_OS_MAC) && ! defined(CARLA_OS_MAC) && ! defined(DISTRHO_PROPER_CPP11_SUPPORT) namespace std { inline float fmin(float __x, float __y) { return __builtin_fminf(__x, __y); }