2 * DISTRHO Plugin Framework (DPF)
3 * Copyright (C) 2012-2022 Filipe Coelho <falktx@falktx.com>
5 * Permission to use, copy, modify, and/or distribute this software for any purpose with
6 * or without fee is hereby granted, provided that the above copyright notice and this
7 * permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
10 * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
11 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
12 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
13 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #ifndef DGL_PUGL_HPP_INCLUDED
18 #define DGL_PUGL_HPP_INCLUDED
20 #include "../Base.hpp"
22 /* we will include all header files used in pugl.h in their C++ friendly form, then pugl stuff in custom namespace */
24 #ifdef DISTRHO_PROPER_CPP11_SUPPORT
34 #define PUGL_DISABLE_DEPRECATED
35 #define PUGL_NO_INCLUDE_GL_H
36 #define PUGL_NO_INCLUDE_GLU_H
38 #ifndef DISTRHO_OS_MAC
42 #include "pugl-upstream/include/pugl/pugl.h"
44 // --------------------------------------------------------------------------------------------------------------------
46 // DGL specific, expose backend enter
47 bool puglBackendEnter(PuglView
* view
);
49 // DGL specific, expose backend leave
50 bool puglBackendLeave(PuglView
* view
);
52 // DGL specific, assigns backend that matches current DGL build
53 void puglSetMatchingBackendForCurrentBuild(PuglView
* view
);
55 // bring view window into the foreground, aka "raise" window
56 void puglRaiseWindow(PuglView
* view
);
58 // get scale factor from parent window if possible, fallback to puglGetScaleFactor
59 double puglGetScaleFactorFromParent(const PuglView
* view
);
61 // combined puglSetSizeHint using PUGL_MIN_SIZE, PUGL_MIN_ASPECT and PUGL_MAX_ASPECT
62 PuglStatus
puglSetGeometryConstraints(PuglView
* view
, uint width
, uint height
, bool aspect
);
64 // set view as resizable (or not) during runtime
65 void puglSetResizable(PuglView
* view
, bool resizable
);
67 // set window size while also changing default
68 PuglStatus
puglSetSizeAndDefault(PuglView
* view
, uint width
, uint height
);
70 // DGL specific, build-specific drawing prepare
71 void puglOnDisplayPrepare(PuglView
* view
);
73 // DGL specific, build-specific fallback resize
74 void puglFallbackOnResize(PuglView
* view
);
76 #if defined(DISTRHO_OS_MAC)
78 // macOS specific, add another view's window as child
79 PuglStatus
puglMacOSAddChildWindow(PuglView
* view
, PuglView
* child
);
81 // macOS specific, remove another view's window as child
82 PuglStatus
puglMacOSRemoveChildWindow(PuglView
* view
, PuglView
* child
);
84 // macOS specific, center view based on parent coordinates (if there is one)
85 void puglMacOSShowCentered(PuglView
* view
);
87 #elif defined(DISTRHO_OS_WASM)
91 #elif defined(DISTRHO_OS_WINDOWS)
93 // win32 specific, call ShowWindow with SW_RESTORE
94 void puglWin32RestoreWindow(PuglView
* view
);
96 // win32 specific, center view based on parent coordinates (if there is one)
97 void puglWin32ShowCentered(PuglView
* view
);
99 #elif defined(HAVE_X11)
101 #define DGL_USING_X11
103 // X11 specific, update world without triggering exposure evente
104 PuglStatus
puglX11UpdateWithoutExposures(PuglWorld
* world
);
106 // X11 specific, set dialog window type and pid hints
107 void puglX11SetWindowTypeAndPID(const PuglView
* view
, bool isStandalone
);
111 // --------------------------------------------------------------------------------------------------------------------
113 #ifndef DISTRHO_OS_MAC
117 #endif // DGL_PUGL_HPP_INCLUDED