diff --git a/dgl/src/WindowPrivateData.cpp b/dgl/src/WindowPrivateData.cpp index 6a9467d5..b1bfc7c5 100644 --- a/dgl/src/WindowPrivateData.cpp +++ b/dgl/src/WindowPrivateData.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2021 Filipe Coelho + * Copyright (C) 2012-2022 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 @@ -378,7 +378,7 @@ void Window::PrivateData::focus() if (! isEmbed) puglRaiseWindow(view); -#ifdef HAVE_X11 +#if defined(HAVE_X11) && !defined(DISTRHO_OS_MAC) && !defined(DISTRHO_OS_WINDOWS) puglX11GrabFocus(view); #else puglGrabFocus(view); @@ -765,7 +765,7 @@ PuglStatus Window::PrivateData::puglEventCallback(PuglView* const view, const Pu ///< View created, a #PuglEventCreate case PUGL_CREATE: -#ifdef HAVE_X11 +#if defined(HAVE_X11) && !defined(DISTRHO_OS_MAC) && !defined(DISTRHO_OS_WINDOWS) if (! pData->isEmbed) puglX11SetWindowTypeAndPID(view, pData->appData->isStandalone); #endif diff --git a/dgl/src/pugl.cpp b/dgl/src/pugl.cpp index 5492493f..ae99221c 100644 --- a/dgl/src/pugl.cpp +++ b/dgl/src/pugl.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2021 Filipe Coelho + * Copyright (C) 2012-2022 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 @@ -459,7 +459,8 @@ void puglFallbackOnResize(PuglView* const view) #endif } -#ifdef DISTRHO_OS_MAC +#if defined(DISTRHO_OS_MAC) + // -------------------------------------------------------------------------------------------------------------------- // macOS specific, allow standalone window to gain focus @@ -537,9 +538,9 @@ void puglMacOSShowCentered(PuglView* const view) } // -------------------------------------------------------------------------------------------------------------------- -#endif -#ifdef DISTRHO_OS_WINDOWS +#elif defined(DISTRHO_OS_WINDOWS) + // -------------------------------------------------------------------------------------------------------------------- // win32 specific, call ShowWindow with SW_RESTORE @@ -616,9 +617,9 @@ void puglWin32SetWindowResizable(PuglView* const view, const bool resizable) } // -------------------------------------------------------------------------------------------------------------------- -#endif -#ifdef HAVE_X11 +#elif defined(HAVE_X11) + // -------------------------------------------------------------------------------------------------------------------- // X11 specific, safer way to grab focus @@ -666,6 +667,7 @@ void puglX11SetWindowTypeAndPID(const PuglView* const view, const bool isStandal } // -------------------------------------------------------------------------------------------------------------------- + #endif // HAVE_X11 #ifndef DISTRHO_OS_MAC diff --git a/dgl/src/pugl.hpp b/dgl/src/pugl.hpp index afa0cf05..30613ea6 100644 --- a/dgl/src/pugl.hpp +++ b/dgl/src/pugl.hpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2021 Filipe Coelho + * Copyright (C) 2012-2022 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 @@ -99,7 +99,8 @@ puglOnDisplayPrepare(PuglView* view); PUGL_API void puglFallbackOnResize(PuglView* view); -#ifdef DISTRHO_OS_MAC +#if defined(DISTRHO_OS_MAC) + // macOS specific, allow standalone window to gain focus PUGL_API void puglMacOSActivateApp(); @@ -115,9 +116,9 @@ puglMacOSRemoveChildWindow(PuglView* view, PuglView* child); // macOS specific, center view based on parent coordinates (if there is one) PUGL_API void puglMacOSShowCentered(PuglView* view); -#endif -#ifdef DISTRHO_OS_WINDOWS +#elif defined(DISTRHO_OS_WINDOWS) + // win32 specific, call ShowWindow with SW_RESTORE PUGL_API void puglWin32RestoreWindow(PuglView* view); @@ -129,9 +130,9 @@ puglWin32ShowCentered(PuglView* view); // win32 specific, set or unset WS_SIZEBOX style flag PUGL_API void puglWin32SetWindowResizable(PuglView* view, bool resizable); -#endif -#ifdef HAVE_X11 +#elif defined(HAVE_X11) + // X11 specific, safer way to grab focus PUGL_API PuglStatus puglX11GrabFocus(const PuglView* view); @@ -139,6 +140,7 @@ puglX11GrabFocus(const PuglView* view); // X11 specific, set dialog window type and pid hints PUGL_API void puglX11SetWindowTypeAndPID(const PuglView* view, bool isStandalone); + #endif PUGL_END_DECLS