diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c2cf4021..00bac561 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -84,6 +84,13 @@ jobs: run: | make clean >/dev/null make -j ${{ env.JOBS }} + - name: No deprecated methods allowed + env: + CFLAGS: -Werror + CXXFLAGS: -Werror -DDGL_ALLOW_DEPRECATED_METHODS=0 + run: | + make clean >/dev/null + make -j ${{ env.JOBS }} - name: No namespace env: CFLAGS: -Werror diff --git a/dgl/Geometry.hpp b/dgl/Geometry.hpp index c39eb815..ca930006 100644 --- a/dgl/Geometry.hpp +++ b/dgl/Geometry.hpp @@ -369,7 +369,7 @@ public: bool operator==(const Line& line) const noexcept; bool operator!=(const Line& line) const noexcept; - #ifdef DGL_ALLOW_DEPRECATED_METHODS + #if DGL_ALLOW_DEPRECATED_METHODS /** Draw this line using the current OpenGL state.@n DEPRECATED Please use draw(const GraphicsContext&) instead. @@ -487,7 +487,7 @@ public: bool operator==(const Circle& cir) const noexcept; bool operator!=(const Circle& cir) const noexcept; - #ifdef DGL_ALLOW_DEPRECATED_METHODS + #if DGL_ALLOW_DEPRECATED_METHODS /** Draw this circle using the current OpenGL state.@n DEPRECATED Please use draw(const GraphicsContext&) instead. @@ -580,7 +580,7 @@ public: bool operator==(const Triangle& tri) const noexcept; bool operator!=(const Triangle& tri) const noexcept; - #ifdef DGL_ALLOW_DEPRECATED_METHODS + #if DGL_ALLOW_DEPRECATED_METHODS /** Draw this triangle using the current OpenGL state.@n DEPRECATED Please use draw(const GraphicsContext&) instead. @@ -811,7 +811,7 @@ public: bool operator==(const Rectangle& size) const noexcept; bool operator!=(const Rectangle& size) const noexcept; - #ifdef DGL_ALLOW_DEPRECATED_METHODS + #if DGL_ALLOW_DEPRECATED_METHODS /** Draw this rectangle using the current OpenGL state.@n DEPRECATED Please use draw(const GraphicsContext&) instead. diff --git a/dgl/OpenGL.hpp b/dgl/OpenGL.hpp index 46d5aecb..03d0ad15 100644 --- a/dgl/OpenGL.hpp +++ b/dgl/OpenGL.hpp @@ -274,7 +274,7 @@ public: inline void drawAt(const GraphicsContext& context, int x, int y) { drawAt(context, Point(x, y)); } - #ifdef DGL_ALLOW_DEPRECATED_METHODS + #if DGL_ALLOW_DEPRECATED_METHODS /** Constructor using raw image data, specifying an OpenGL image format. @note @a rawData must remain valid for the lifetime of this Image. diff --git a/dgl/Window.hpp b/dgl/Window.hpp index 64d0f561..2a811b00 100644 --- a/dgl/Window.hpp +++ b/dgl/Window.hpp @@ -479,6 +479,7 @@ public: */ void setTransientParent(uintptr_t transientParentWindowHandle); + #if DGL_ALLOW_DEPRECATED_METHODS /** DEPRECATED Use isIgnoringKeyRepeat(). */ DISTRHO_DEPRECATED_BY("isIgnoringKeyRepeat()") inline bool getIgnoringKeyRepeat() const noexcept { return isIgnoringKeyRepeat(); } @@ -490,6 +491,7 @@ public: /** DEPRECATED Use runAsModal(bool). */ DISTRHO_DEPRECATED_BY("runAsModal(bool)") inline void exec(bool blockWait = false) { runAsModal(blockWait); } + #endif protected: /** @@ -528,12 +530,11 @@ protected: */ virtual void onFocus(bool focus, CrossingMode mode); - /** - A function called when the window is resized. - If there is a top-level widget associated with this window, its size will be set right after this function. - The default implementation sets up drawing context where necessary. - */ + #if DGL_ALLOW_DEPRECATED_METHODS + /** DEPRECATED DO NOT USE */ + DISTRHO_DEPRECATED virtual void onReshape(uint width, uint height); + #endif /** A function called when scale factor requested for this window changes. @@ -542,7 +543,7 @@ protected: */ virtual void onScaleFactorChanged(double scaleFactor); - #ifdef DGL_USE_FILE_BROWSER + #ifdef DGL_USE_FILE_BROWSER /** A function called when a path is selected by the user, as triggered by openFileBrowser(). This action happens after the user confirms the action, so the file browser dialog will be closed at this point. @@ -550,10 +551,12 @@ protected: */ virtual void onFileSelected(const char* filename); + #if DGL_ALLOW_DEPRECATED_METHODS /** DEPRECATED Use onFileSelected(). */ DISTRHO_DEPRECATED_BY("onFileSelected(const char*)") inline virtual void fileBrowserSelected(const char* filename) { return onFileSelected(filename); } #endif + #endif private: PrivateData* const pData; diff --git a/dgl/src/ApplicationPrivateData.cpp b/dgl/src/ApplicationPrivateData.cpp index ca0d27f9..3a145e9b 100644 --- a/dgl/src/ApplicationPrivateData.cpp +++ b/dgl/src/ApplicationPrivateData.cpp @@ -165,13 +165,11 @@ void Application::PrivateData::quit() isQuitting = true; - #ifndef DPF_TEST_APPLICATION_CPP for (WindowListReverseIterator rit = windows.rbegin(), rite = windows.rend(); rit != rite; ++rit) { DGL_NAMESPACE::Window* const window(*rit); window->close(); } - #endif } double Application::PrivateData::getTime() const diff --git a/dgl/src/Cairo.cpp b/dgl/src/Cairo.cpp index 3d1c5837..f0a5b307 100644 --- a/dgl/src/Cairo.cpp +++ b/dgl/src/Cairo.cpp @@ -93,7 +93,7 @@ void Line::draw(const GraphicsContext& context, const T width) cairo_stroke(handle); } -#ifdef DGL_ALLOW_DEPRECATED_METHODS +#if DGL_ALLOW_DEPRECATED_METHODS template void Line::draw() { @@ -101,13 +101,6 @@ void Line::draw() } #endif -template class Line; -template class Line; -template class Line; -template class Line; -template class Line; -template class Line; - // ----------------------------------------------------------------------- // Circle @@ -169,7 +162,7 @@ void Circle::drawOutline(const GraphicsContext& context, const T lineWidth) drawCircle(handle, fPos, fNumSegments, fSize, fSin, fCos, true); } -#ifdef DGL_ALLOW_DEPRECATED_METHODS +#if DGL_ALLOW_DEPRECATED_METHODS template void Circle::draw() { @@ -183,13 +176,6 @@ void Circle::drawOutline() } #endif -template class Circle; -template class Circle; -template class Circle; -template class Circle; -template class Circle; -template class Circle; - // ----------------------------------------------------------------------- // Triangle @@ -232,7 +218,7 @@ void Triangle::drawOutline(const GraphicsContext& context, const T lineWidth) drawTriangle(handle, pos1, pos2, pos3, true); } -#ifdef DGL_ALLOW_DEPRECATED_METHODS +#if DGL_ALLOW_DEPRECATED_METHODS template void Triangle::draw() { @@ -246,13 +232,6 @@ void Triangle::drawOutline() } #endif -template class Triangle; -template class Triangle; -template class Triangle; -template class Triangle; -template class Triangle; -template class Triangle; - // ----------------------------------------------------------------------- // Rectangle @@ -289,7 +268,7 @@ void Rectangle::drawOutline(const GraphicsContext& context, const T lineWidth drawRectangle(handle, *this, true); } -#ifdef DGL_ALLOW_DEPRECATED_METHODS +#if DGL_ALLOW_DEPRECATED_METHODS template void Rectangle::draw() { @@ -303,13 +282,6 @@ void Rectangle::drawOutline() } #endif -template class Rectangle; -template class Rectangle; -template class Rectangle; -template class Rectangle; -template class Rectangle; -template class Rectangle; - // ----------------------------------------------------------------------- // CairoImage @@ -877,4 +849,36 @@ void Window::PrivateData::endContext() // -------------------------------------------------------------------------------------------------------------------- +#ifndef DGL_GEOMETRY_CPP_INCLUDED +template class Line; +template class Line; +template class Line; +template class Line; +template class Line; +template class Line; + +template class Circle; +template class Circle; +template class Circle; +template class Circle; +template class Circle; +template class Circle; + +template class Triangle; +template class Triangle; +template class Triangle; +template class Triangle; +template class Triangle; +template class Triangle; + +template class Rectangle; +template class Rectangle; +template class Rectangle; +template class Rectangle; +template class Rectangle; +template class Rectangle; +#endif + +// -------------------------------------------------------------------------------------------------------------------- + END_NAMESPACE_DGL diff --git a/dgl/src/Geometry.cpp b/dgl/src/Geometry.cpp index eb8df6e5..3af7842c 100644 --- a/dgl/src/Geometry.cpp +++ b/dgl/src/Geometry.cpp @@ -23,6 +23,8 @@ #include "../Geometry.hpp" +#define DGL_GEOMETRY_CPP_INCLUDED + #include START_NAMESPACE_DGL diff --git a/dgl/src/OpenGL.cpp b/dgl/src/OpenGL.cpp index 989db626..5eac3eb3 100644 --- a/dgl/src/OpenGL.cpp +++ b/dgl/src/OpenGL.cpp @@ -125,7 +125,7 @@ OpenGLImage& OpenGLImage::operator=(const OpenGLImage& image) noexcept return *this; } -#ifdef DGL_ALLOW_DEPRECATED_METHODS +#if DGL_ALLOW_DEPRECATED_METHODS OpenGLImage::OpenGLImage(const char* const rdata, const uint w, const uint h, const GLenum fmt) : ImageBase(rdata, w, h, asDISTRHOImageFormat(fmt)), setupCalled(false), diff --git a/dgl/src/OpenGL2.cpp b/dgl/src/OpenGL2.cpp index 78e3be3e..bdfd900a 100644 --- a/dgl/src/OpenGL2.cpp +++ b/dgl/src/OpenGL2.cpp @@ -93,7 +93,7 @@ void Line::draw(const GraphicsContext&, const T width) drawLine(posStart, posEnd); } -#ifdef DGL_ALLOW_DEPRECATED_METHODS +#if DGL_ALLOW_DEPRECATED_METHODS template void Line::draw() { @@ -101,13 +101,6 @@ void Line::draw() } #endif -template class Line; -template class Line; -template class Line; -template class Line; -template class Line; -template class Line; - // -------------------------------------------------------------------------------------------------------------------- // Circle @@ -168,7 +161,7 @@ void Circle::drawOutline(const GraphicsContext& context, const T lineWidth) drawCircle(context, fPos, fNumSegments, fSize, fSin, fCos, true); } -#ifdef DGL_ALLOW_DEPRECATED_METHODS +#if DGL_ALLOW_DEPRECATED_METHODS template void Circle::draw() { @@ -182,13 +175,6 @@ void Circle::drawOutline() } #endif -template class Circle; -template class Circle; -template class Circle; -template class Circle; -template class Circle; -template class Circle; - // -------------------------------------------------------------------------------------------------------------------- // Triangle @@ -236,7 +222,7 @@ void Triangle::drawOutline(const GraphicsContext&, const T lineWidth) drawTriangle(pos1, pos2, pos3, true); } -#ifdef DGL_ALLOW_DEPRECATED_METHODS +#if DGL_ALLOW_DEPRECATED_METHODS template void Triangle::draw() { @@ -250,13 +236,6 @@ void Triangle::drawOutline() } #endif -template class Triangle; -template class Triangle; -template class Triangle; -template class Triangle; -template class Triangle; -template class Triangle; - // -------------------------------------------------------------------------------------------------------------------- // Rectangle @@ -290,13 +269,13 @@ static void drawRectangle(const Rectangle& rect, const bool outline) } template -void Rectangle::draw(const GraphicsContext& context) +void Rectangle::draw(const GraphicsContext&) { drawRectangle(*this, false); } template -void Rectangle::drawOutline(const GraphicsContext& context, const T lineWidth) +void Rectangle::drawOutline(const GraphicsContext&, const T lineWidth) { DISTRHO_SAFE_ASSERT_RETURN(lineWidth != 0,); @@ -304,7 +283,7 @@ void Rectangle::drawOutline(const GraphicsContext& context, const T lineWidth drawRectangle(*this, true); } -#ifdef DGL_ALLOW_DEPRECATED_METHODS +#if DGL_ALLOW_DEPRECATED_METHODS template void Rectangle::draw() { @@ -318,13 +297,6 @@ void Rectangle::drawOutline() } #endif -template class Rectangle; -template class Rectangle; -template class Rectangle; -template class Rectangle; -template class Rectangle; -template class Rectangle; - // -------------------------------------------------------------------------------------------------------------------- // OpenGLImage @@ -408,7 +380,7 @@ void OpenGLImage::drawAt(const GraphicsContext&, const Point& pos) drawOpenGLImage(*this, pos, textureId, setupCalled); } -#ifdef DGL_ALLOW_DEPRECATED_METHODS +#if DGL_ALLOW_DEPRECATED_METHODS void OpenGLImage::draw() { drawOpenGLImage(*this, Point(0, 0), textureId, setupCalled); @@ -559,6 +531,17 @@ void Window::PrivateData::destroyContext() void Window::PrivateData::startContext() { + const PuglArea size = puglGetSizeHint(view, PUGL_CURRENT_SIZE); + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glViewport(0, 0, static_cast(size.width), static_cast(size.height)); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0.0, static_cast(size.width), static_cast(size.height), 0.0, 0.0, 1.0); + glViewport(0, 0, static_cast(size.width), static_cast(size.height)); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); } void Window::PrivateData::endContext() @@ -567,4 +550,36 @@ void Window::PrivateData::endContext() // -------------------------------------------------------------------------------------------------------------------- +#ifndef DGL_GEOMETRY_CPP_INCLUDED +template class Line; +template class Line; +template class Line; +template class Line; +template class Line; +template class Line; + +template class Circle; +template class Circle; +template class Circle; +template class Circle; +template class Circle; +template class Circle; + +template class Triangle; +template class Triangle; +template class Triangle; +template class Triangle; +template class Triangle; +template class Triangle; + +template class Rectangle; +template class Rectangle; +template class Rectangle; +template class Rectangle; +template class Rectangle; +template class Rectangle; +#endif + +// -------------------------------------------------------------------------------------------------------------------- + END_NAMESPACE_DGL diff --git a/dgl/src/OpenGL3.cpp b/dgl/src/OpenGL3.cpp index 90497ec1..69b970ea 100644 --- a/dgl/src/OpenGL3.cpp +++ b/dgl/src/OpenGL3.cpp @@ -93,10 +93,12 @@ DGL_EXT(PFNGLVERTEXATTRIBPOINTERPROC, glVertexAttribPointer) // -------------------------------------------------------------------------------------------------------------------- +#if DGL_ALLOW_DEPRECATED_METHODS static void notImplemented(const char* const name) { d_stderr2("OpenGL3 function not implemented: %s", name); } +#endif // -------------------------------------------------------------------------------------------------------------------- // Color @@ -149,7 +151,7 @@ void Line::draw(const GraphicsContext& context, const T width) glBindBuffer(GL_ARRAY_BUFFER, 0); } -#ifdef DGL_ALLOW_DEPRECATED_METHODS +#if DGL_ALLOW_DEPRECATED_METHODS template void Line::draw() { @@ -157,13 +159,6 @@ void Line::draw() } #endif -template class Line; -template class Line; -template class Line; -template class Line; -template class Line; -template class Line; - // -------------------------------------------------------------------------------------------------------------------- // Circle @@ -260,7 +255,7 @@ void Circle::drawOutline(const GraphicsContext& context, const T lineWidth) drawCircle(context, fPos, fNumSegments, fSize, fSin, fCos, true); } -#ifdef DGL_ALLOW_DEPRECATED_METHODS +#if DGL_ALLOW_DEPRECATED_METHODS template void Circle::draw() { @@ -274,13 +269,6 @@ void Circle::drawOutline() } #endif -template class Circle; -template class Circle; -template class Circle; -template class Circle; -template class Circle; -template class Circle; - // -------------------------------------------------------------------------------------------------------------------- // Triangle @@ -344,7 +332,7 @@ void Triangle::drawOutline(const GraphicsContext& context, const T lineWidth) drawTriangle(context, pos1, pos2, pos3, true); } -#ifdef DGL_ALLOW_DEPRECATED_METHODS +#if DGL_ALLOW_DEPRECATED_METHODS template void Triangle::draw() { @@ -358,13 +346,6 @@ void Triangle::drawOutline() } #endif -template class Triangle; -template class Triangle; -template class Triangle; -template class Triangle; -template class Triangle; -template class Triangle; - // -------------------------------------------------------------------------------------------------------------------- // Rectangle @@ -424,7 +405,7 @@ void Rectangle::drawOutline(const GraphicsContext& context, const T lineWidth drawRectangle(context, *this, true); } -#ifdef DGL_ALLOW_DEPRECATED_METHODS +#if DGL_ALLOW_DEPRECATED_METHODS template void Rectangle::draw() { @@ -438,13 +419,6 @@ void Rectangle::drawOutline() } #endif -template class Rectangle; -template class Rectangle; -template class Rectangle; -template class Rectangle; -template class Rectangle; -template class Rectangle; - // -------------------------------------------------------------------------------------------------------------------- // OpenGLImage @@ -626,18 +600,18 @@ const char* OpenGLImage::getRawData() const noexcept } #endif -#ifdef DGL_ALLOW_DEPRECATED_METHODS +#if DGL_ALLOW_DEPRECATED_METHODS void OpenGLImage::draw() { notImplemented("OpenGLImage::draw"); } -void OpenGLImage::drawAt(const int x, const int y) +void OpenGLImage::drawAt(int, int) { notImplemented("OpenGLImage::drawAt"); } -void OpenGLImage::drawAt(const Point& pos) +void OpenGLImage::drawAt(const Point&) { notImplemented("OpenGLImage::drawAt"); } @@ -1013,6 +987,8 @@ void Window::PrivateData::startContext() gl3context.width = size.width; gl3context.height = size.height; glUseProgram(gl3context.program); + + glViewport(0, 0, static_cast(size.width), static_cast(size.height)); } void Window::PrivateData::endContext() @@ -1022,4 +998,36 @@ void Window::PrivateData::endContext() // -------------------------------------------------------------------------------------------------------------------- +#ifndef DGL_GEOMETRY_CPP_INCLUDED +template class Line; +template class Line; +template class Line; +template class Line; +template class Line; +template class Line; + +template class Circle; +template class Circle; +template class Circle; +template class Circle; +template class Circle; +template class Circle; + +template class Triangle; +template class Triangle; +template class Triangle; +template class Triangle; +template class Triangle; +template class Triangle; + +template class Rectangle; +template class Rectangle; +template class Rectangle; +template class Rectangle; +template class Rectangle; +template class Rectangle; +#endif + +// -------------------------------------------------------------------------------------------------------------------- + END_NAMESPACE_DGL diff --git a/dgl/src/Stub.cpp b/dgl/src/Stub.cpp index 93f54f4b..2fc1a166 100644 --- a/dgl/src/Stub.cpp +++ b/dgl/src/Stub.cpp @@ -70,12 +70,12 @@ void Color::setFor(const GraphicsContext&, bool) // Line template -void Line::draw(const GraphicsContext& context, T) +void Line::draw(const GraphicsContext&, T) { notImplemented("Line::draw"); } -#ifdef DGL_ALLOW_DEPRECATED_METHODS +#if DGL_ALLOW_DEPRECATED_METHODS template void Line::draw() { @@ -83,13 +83,6 @@ void Line::draw() } #endif -template class Line; -template class Line; -template class Line; -template class Line; -template class Line; -template class Line; - // -------------------------------------------------------------------------------------------------------------------- // Circle @@ -105,7 +98,7 @@ void Circle::drawOutline(const GraphicsContext&, T) notImplemented("Circle::drawOutline"); } -#ifdef DGL_ALLOW_DEPRECATED_METHODS +#if DGL_ALLOW_DEPRECATED_METHODS template void Circle::draw() { @@ -119,13 +112,6 @@ void Circle::drawOutline() } #endif -template class Circle; -template class Circle; -template class Circle; -template class Circle; -template class Circle; -template class Circle; - // -------------------------------------------------------------------------------------------------------------------- // Triangle @@ -141,7 +127,7 @@ void Triangle::drawOutline(const GraphicsContext&, T) notImplemented("Triangle::drawOutline"); } -#ifdef DGL_ALLOW_DEPRECATED_METHODS +#if DGL_ALLOW_DEPRECATED_METHODS template void Triangle::draw() { @@ -155,13 +141,6 @@ void Triangle::drawOutline() } #endif -template class Triangle; -template class Triangle; -template class Triangle; -template class Triangle; -template class Triangle; -template class Triangle; - // -------------------------------------------------------------------------------------------------------------------- // Rectangle @@ -177,7 +156,7 @@ void Rectangle::drawOutline(const GraphicsContext&, T) notImplemented("Rectangle::drawOutline"); } -#ifdef DGL_ALLOW_DEPRECATED_METHODS +#if DGL_ALLOW_DEPRECATED_METHODS template void Rectangle::draw() { @@ -191,13 +170,6 @@ void Rectangle::drawOutline() } #endif -template class Rectangle; -template class Rectangle; -template class Rectangle; -template class Rectangle; -template class Rectangle; -template class Rectangle; - // -------------------------------------------------------------------------------------------------------------------- void SubWidget::PrivateData::display(uint, uint, double) @@ -237,4 +209,36 @@ void Window::PrivateData::endContext() // -------------------------------------------------------------------------------------------------------------------- +#ifndef DGL_GEOMETRY_CPP_INCLUDED +template class Line; +template class Line; +template class Line; +template class Line; +template class Line; +template class Line; + +template class Circle; +template class Circle; +template class Circle; +template class Circle; +template class Circle; +template class Circle; + +template class Triangle; +template class Triangle; +template class Triangle; +template class Triangle; +template class Triangle; +template class Triangle; + +template class Rectangle; +template class Rectangle; +template class Rectangle; +template class Rectangle; +template class Rectangle; +template class Rectangle; +#endif + +// -------------------------------------------------------------------------------------------------------------------- + END_NAMESPACE_DGL diff --git a/dgl/src/TopLevelWidgetPrivateData.cpp b/dgl/src/TopLevelWidgetPrivateData.cpp index ebdce51f..adcd71bc 100644 --- a/dgl/src/TopLevelWidgetPrivateData.cpp +++ b/dgl/src/TopLevelWidgetPrivateData.cpp @@ -135,11 +135,6 @@ bool TopLevelWidget::PrivateData::scrollEvent(const ScrollEvent& ev) return selfw->pData->giveScrollEventForSubWidgets(rev); } -void TopLevelWidget::PrivateData::fallbackOnResize(const uint width, const uint height) -{ - puglFallbackOnResize(window.pData->view, width, height); -} - // ----------------------------------------------------------------------- END_NAMESPACE_DGL diff --git a/dgl/src/TopLevelWidgetPrivateData.hpp b/dgl/src/TopLevelWidgetPrivateData.hpp index 21060d2f..7cbf2c34 100644 --- a/dgl/src/TopLevelWidgetPrivateData.hpp +++ b/dgl/src/TopLevelWidgetPrivateData.hpp @@ -38,7 +38,6 @@ struct TopLevelWidget::PrivateData { bool mouseEvent(const MouseEvent& ev); bool motionEvent(const MotionEvent& ev); bool scrollEvent(const ScrollEvent& ev); - void fallbackOnResize(uint width, uint height); DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PrivateData) }; diff --git a/dgl/src/Vulkan.cpp b/dgl/src/Vulkan.cpp index 497d2cdf..7c07d9c5 100644 --- a/dgl/src/Vulkan.cpp +++ b/dgl/src/Vulkan.cpp @@ -76,7 +76,7 @@ void Line::draw(const GraphicsContext&, T) notImplemented("Line::draw"); } -#ifdef DGL_ALLOW_DEPRECATED_METHODS +#if DGL_ALLOW_DEPRECATED_METHODS template void Line::draw() { @@ -106,7 +106,7 @@ void Circle::drawOutline(const GraphicsContext&, T) notImplemented("Circle::drawOutline"); } -#ifdef DGL_ALLOW_DEPRECATED_METHODS +#if DGL_ALLOW_DEPRECATED_METHODS template void Circle::draw() { @@ -142,7 +142,7 @@ void Triangle::drawOutline(const GraphicsContext&, T) notImplemented("Triangle::drawOutline"); } -#ifdef DGL_ALLOW_DEPRECATED_METHODS +#if DGL_ALLOW_DEPRECATED_METHODS template void Triangle::draw() { @@ -178,7 +178,7 @@ void Rectangle::drawOutline(const GraphicsContext&, T) notImplemented("Rectangle::drawOutline"); } -#ifdef DGL_ALLOW_DEPRECATED_METHODS +#if DGL_ALLOW_DEPRECATED_METHODS template void Rectangle::draw() { @@ -289,8 +289,38 @@ void Window::PrivateData::endContext() { } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- -END_NAMESPACE_DGL +#ifndef DGL_GEOMETRY_CPP_INCLUDED +template class Line; +template class Line; +template class Line; +template class Line; +template class Line; +template class Line; -// ----------------------------------------------------------------------- +template class Circle; +template class Circle; +template class Circle; +template class Circle; +template class Circle; +template class Circle; + +template class Triangle; +template class Triangle; +template class Triangle; +template class Triangle; +template class Triangle; +template class Triangle; + +template class Rectangle; +template class Rectangle; +template class Rectangle; +template class Rectangle; +template class Rectangle; +template class Rectangle; +#endif + +// -------------------------------------------------------------------------------------------------------------------- + +END_NAMESPACE_DGL diff --git a/dgl/src/Window.cpp b/dgl/src/Window.cpp index 6f7562e2..01c285e0 100644 --- a/dgl/src/Window.cpp +++ b/dgl/src/Window.cpp @@ -397,12 +397,10 @@ Application& Window::getApp() const noexcept return pData->app; } -#ifndef DPF_TEST_WINDOW_CPP const GraphicsContext& Window::getGraphicsContext() const noexcept { return pData->getGraphicsContext(); } -#endif uintptr_t Window::getNativeWindowHandle() const noexcept { @@ -583,11 +581,11 @@ void Window::onFocus(bool, CrossingMode) { } -void Window::onReshape(const uint width, const uint height) +#if DGL_ALLOW_DEPRECATED_METHODS +void Window::onReshape(uint, uint) { - if (pData->view != nullptr) - puglFallbackOnResize(pData->view, width, height); } +#endif void Window::onScaleFactorChanged(double) { diff --git a/dgl/src/WindowPrivateData.cpp b/dgl/src/WindowPrivateData.cpp index d7a3c934..563d2b44 100644 --- a/dgl/src/WindowPrivateData.cpp +++ b/dgl/src/WindowPrivateData.cpp @@ -268,9 +268,7 @@ Window::PrivateData::~PrivateData() isVisible = false; } - #ifndef DPF_TEST_WINDOW_CPP destroyContext(); - #endif puglFreeView(view); } @@ -646,9 +644,7 @@ void Window::PrivateData::onPuglConfigure(const uint width, const uint height) DGL_DBGp("PUGL: onReshape : %d %d\n", width, height); - #ifndef DPF_TEST_WINDOW_CPP createContextIfNeeded(); - #endif if (autoScaling) { @@ -672,9 +668,27 @@ void Window::PrivateData::onPuglConfigure(const uint width, const uint height) autoScaling ? autoScaleFactor : scaleFactor); #endif + #if DGL_ALLOW_DEPRECATED_METHODS + #if defined(_MSC_VER) + #pragma warning(push) + #pragma warning(disable:4996) + #elif defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdeprecated-declarations" + #elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 460 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #endif self->onReshape(uwidth, uheight); + #if defined(_MSC_VER) + #pragma warning(pop) + #elif defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 460 + #pragma GCC diagnostic pop + #endif + #endif -#ifndef DPF_TEST_WINDOW_CPP FOR_EACH_TOP_LEVEL_WIDGET(it) { TopLevelWidget* const widget = *it; @@ -689,7 +703,6 @@ void Window::PrivateData::onPuglConfigure(const uint width, const uint height) */ ((Widget*)widget)->setSize(uwidth, uheight); } -#endif // always repaint after a resize puglObscureView(view); @@ -701,7 +714,6 @@ void Window::PrivateData::onPuglExpose() puglOnDisplayPrepare(view); -#ifndef DPF_TEST_WINDOW_CPP startContext(); FOR_EACH_TOP_LEVEL_WIDGET(it) @@ -721,7 +733,6 @@ void Window::PrivateData::onPuglExpose() } endContext(); -#endif } void Window::PrivateData::onPuglClose() @@ -774,7 +785,6 @@ void Window::PrivateData::onPuglKey(const Widget::KeyboardEvent& ev) if (modal.child != nullptr) return modal.child->focus(); -#ifndef DPF_TEST_WINDOW_CPP FOR_EACH_TOP_LEVEL_WIDGET_INV(rit) { TopLevelWidget* const widget(*rit); @@ -782,7 +792,6 @@ void Window::PrivateData::onPuglKey(const Widget::KeyboardEvent& ev) if (widget->isVisible() && widget->onKeyboard(ev)) break; } -#endif } void Window::PrivateData::onPuglText(const Widget::CharacterInputEvent& ev) @@ -792,7 +801,6 @@ void Window::PrivateData::onPuglText(const Widget::CharacterInputEvent& ev) if (modal.child != nullptr) return modal.child->focus(); -#ifndef DPF_TEST_WINDOW_CPP FOR_EACH_TOP_LEVEL_WIDGET_INV(rit) { TopLevelWidget* const widget(*rit); @@ -800,7 +808,6 @@ void Window::PrivateData::onPuglText(const Widget::CharacterInputEvent& ev) if (widget->isVisible() && widget->onCharacterInput(ev)) break; } -#endif } void Window::PrivateData::onPuglMouse(const Widget::MouseEvent& ev) @@ -810,7 +817,6 @@ void Window::PrivateData::onPuglMouse(const Widget::MouseEvent& ev) if (modal.child != nullptr) return modal.child->focus(); -#ifndef DPF_TEST_WINDOW_CPP FOR_EACH_TOP_LEVEL_WIDGET_INV(rit) { TopLevelWidget* const widget(*rit); @@ -818,7 +824,6 @@ void Window::PrivateData::onPuglMouse(const Widget::MouseEvent& ev) if (widget->isVisible() && widget->onMouse(ev)) break; } -#endif } void Window::PrivateData::onPuglMotion(const Widget::MotionEvent& ev) @@ -828,7 +833,6 @@ void Window::PrivateData::onPuglMotion(const Widget::MotionEvent& ev) if (modal.child != nullptr) return modal.child->focus(); -#ifndef DPF_TEST_WINDOW_CPP FOR_EACH_TOP_LEVEL_WIDGET_INV(rit) { TopLevelWidget* const widget(*rit); @@ -836,7 +840,6 @@ void Window::PrivateData::onPuglMotion(const Widget::MotionEvent& ev) if (widget->isVisible() && widget->onMotion(ev)) break; } -#endif } void Window::PrivateData::onPuglScroll(const Widget::ScrollEvent& ev) @@ -846,7 +849,6 @@ void Window::PrivateData::onPuglScroll(const Widget::ScrollEvent& ev) if (modal.child != nullptr) return modal.child->focus(); -#ifndef DPF_TEST_WINDOW_CPP FOR_EACH_TOP_LEVEL_WIDGET_INV(rit) { TopLevelWidget* const widget(*rit); @@ -854,7 +856,6 @@ void Window::PrivateData::onPuglScroll(const Widget::ScrollEvent& ev) if (widget->isVisible() && widget->onScroll(ev)) break; } -#endif } const void* Window::PrivateData::getClipboard(size_t& dataSize) diff --git a/dgl/src/pugl-upstream b/dgl/src/pugl-upstream index 5e2621d7..43c0944a 160000 --- a/dgl/src/pugl-upstream +++ b/dgl/src/pugl-upstream @@ -1 +1 @@ -Subproject commit 5e2621d714ddf1cb0f86e852f8ba5dffe04aa3a3 +Subproject commit 43c0944a2e28c6921bc827ac46f7215e5e59fe26 diff --git a/dgl/src/pugl.cpp b/dgl/src/pugl.cpp index f618e071..fda302d7 100644 --- a/dgl/src/pugl.cpp +++ b/dgl/src/pugl.cpp @@ -435,33 +435,6 @@ void puglOnDisplayPrepare(PuglView*) #endif } -// -------------------------------------------------------------------------------------------------------------------- -// DGL specific, build-specific fallback resize - -void puglFallbackOnResize(PuglView* const view, const uint width, const uint height) -{ - #ifdef DGL_OPENGL - #if defined(DGL_USE_OPENGL3) - glViewport(0, 0, static_cast(width), static_cast(height)); - #else - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glViewport(0, 0, static_cast(width), static_cast(height)); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0.0, static_cast(width), static_cast(height), 0.0, 0.0, 1.0); - glViewport(0, 0, static_cast(width), static_cast(height)); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - #endif - #else - // unused - (void)view; - (void)width; - (void)height; - #endif -} - // -------------------------------------------------------------------------------------------------------------------- #if defined(DISTRHO_OS_HAIKU) diff --git a/dgl/src/pugl.hpp b/dgl/src/pugl.hpp index 125707af..41dc36ab 100644 --- a/dgl/src/pugl.hpp +++ b/dgl/src/pugl.hpp @@ -84,9 +84,6 @@ PuglStatus puglSetSizeAndDefault(PuglView* view, uint width, uint height); // DGL specific, build-specific drawing prepare void puglOnDisplayPrepare(PuglView* view); -// DGL specific, build-specific fallback resize -void puglFallbackOnResize(PuglView* view, uint width, uint height); - #if defined(DISTRHO_OS_HAIKU) // nothing here yet diff --git a/distrho/DistrhoUI.hpp b/distrho/DistrhoUI.hpp index 77418403..2401197d 100644 --- a/distrho/DistrhoUI.hpp +++ b/distrho/DistrhoUI.hpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2025 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 @@ -291,19 +291,13 @@ protected: */ virtual void uiFocus(bool focus, DGL_NAMESPACE::CrossingMode mode); - /** - Window reshape function, called when the window is resized. - This function is for plugin UIs to be able to override Window::onReshape(uint, uint). - - The plugin UI size will be set right after this function. - The default implementation sets up the drawing context where necessary. - - You should almost never need to override this function. - The most common exception is custom OpenGL setup, but only really needed for custom OpenGL drawing code. - */ + #if DGL_ALLOW_DEPRECATED_METHODS + /** DEPRECATED DO NOT USE */ + DISTRHO_DEPRECATED virtual void uiReshape(uint width, uint height); + #endif -#if DISTRHO_UI_FILE_BROWSER + #if DISTRHO_UI_FILE_BROWSER /** Window file selected function, called when a path is selected by the user, as triggered by openFileBrowser(). This function is for plugin UIs to be able to override Window::onFileSelected(const char*). @@ -314,7 +308,7 @@ protected: If you need to use files as plugin state, please setup and use states with kStateIsFilenamePath instead. */ virtual void uiFileBrowserSelected(const char* filename); -#endif + #endif /* -------------------------------------------------------------------------------------------------------- * UI Resize Handling, internal */ diff --git a/distrho/src/DistrhoUI.cpp b/distrho/src/DistrhoUI.cpp index 0241b59c..09b4a4d0 100644 --- a/distrho/src/DistrhoUI.cpp +++ b/distrho/src/DistrhoUI.cpp @@ -560,11 +560,11 @@ void UI::uiFocus(bool, DGL_NAMESPACE::CrossingMode) { } -void UI::uiReshape(const uint width, const uint height) +#if DGL_ALLOW_DEPRECATED_METHODS +void UI::uiReshape(uint, uint) { - // NOTE this must be the same as Window::onReshape - pData->fallbackOnResize(width, height); } +#endif #if DISTRHO_UI_FILE_BROWSER void UI::uiFileBrowserSelected(const char*) diff --git a/distrho/src/DistrhoUIPrivateData.hpp b/distrho/src/DistrhoUIPrivateData.hpp index 108e76b6..7a1b4360 100644 --- a/distrho/src/DistrhoUIPrivateData.hpp +++ b/distrho/src/DistrhoUIPrivateData.hpp @@ -115,7 +115,9 @@ class PluginWindow : public DGL_NAMESPACE::Window { UI* const ui; bool initializing; + #if DGL_ALLOW_DEPRECATED_METHODS bool receivedReshapeDuringInit; + #endif public: explicit PluginWindow(UI* const uiPtr, @@ -130,8 +132,10 @@ public: DISTRHO_UI_USES_SIZE_REQUEST, false), ui(uiPtr), - initializing(true), - receivedReshapeDuringInit(false) + initializing(true) + #if DGL_ALLOW_DEPRECATED_METHODS + , receivedReshapeDuringInit(false) + #endif { if (pData->view == nullptr) return; @@ -159,12 +163,31 @@ public: initializing = false; puglBackendLeave(pData->view); + #if DGL_ALLOW_DEPRECATED_METHODS if (receivedReshapeDuringInit) { puglBackendEnter(pData->view); + #if defined(_MSC_VER) + #pragma warning(push) + #pragma warning(disable:4996) + #elif defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdeprecated-declarations" + #elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 460 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #endif ui->uiReshape(getWidth(), getHeight()); + #if defined(_MSC_VER) + #pragma warning(pop) + #elif defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 460 + #pragma GCC diagnostic pop + #endif puglBackendLeave(pData->view); } + #endif } // used for temporary windows (VST/CLAP get size without active/visible view) @@ -213,6 +236,17 @@ protected: ui->uiFocus(focus, mode); } + #if DGL_ALLOW_DEPRECATED_METHODS + #if defined(_MSC_VER) + #pragma warning(push) + #pragma warning(disable:4996) + #elif defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdeprecated-declarations" + #elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 460 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #endif void onReshape(const uint width, const uint height) override { DISTRHO_SAFE_ASSERT_RETURN(ui != nullptr,); @@ -225,6 +259,14 @@ protected: ui->uiReshape(width, height); } + #if defined(_MSC_VER) + #pragma warning(pop) + #elif defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 460 + #pragma GCC diagnostic pop + #endif + #endif void onScaleFactorChanged(const double scaleFactor) override { diff --git a/tests/Application.cpp b/tests/Application.cpp index 0b9bdb6d..1195c773 100644 --- a/tests/Application.cpp +++ b/tests/Application.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2025 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 @@ -15,11 +15,7 @@ */ #include "tests.hpp" - -#define DPF_TEST_APPLICATION_CPP -#include "dgl/src/pugl.cpp" -#include "dgl/src/Application.cpp" -#include "dgl/src/ApplicationPrivateData.cpp" +#include "dgl.cpp" START_NAMESPACE_DGL diff --git a/tests/Color.cpp b/tests/Color.cpp index 1e9ef873..1d24781e 100644 --- a/tests/Color.cpp +++ b/tests/Color.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2025 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 @@ -15,10 +15,7 @@ */ #include "tests.hpp" - -#define DPF_TEST_COLOR_CPP -#include "dgl/src/Application.cpp" -#include "dgl/src/ApplicationPrivateData.cpp" +#include "dgl.cpp" #include "dgl/src/Color.cpp" // -------------------------------------------------------------------------------------------------------------------- diff --git a/tests/Demo.cpp b/tests/Demo.cpp index d31c1c88..a276cca4 100644 --- a/tests/Demo.cpp +++ b/tests/Demo.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2025 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 @@ -15,6 +15,14 @@ */ #include "tests.hpp" +#include "dgl.cpp" +#include "dgl/src/Color.cpp" +#include "dgl/src/EventHandlers.cpp" +#include "dgl/src/ImageBase.cpp" +#ifdef DGL_OPENGL +#include "dgl/src/NanoVG.cpp" +#include "dgl/src/Resources.cpp" +#endif #include "widgets/ExampleColorWidget.hpp" #include "widgets/ExampleImagesWidget.hpp" @@ -29,15 +37,12 @@ #include "images_res/CatPics.cpp" #ifdef DGL_CAIRO -#include "../dgl/Cairo.hpp" typedef DGL_NAMESPACE::CairoImage DemoImage; #endif #ifdef DGL_OPENGL -#include "../dgl/OpenGL.hpp" typedef DGL_NAMESPACE::OpenGLImage DemoImage; #endif #ifdef DGL_VULKAN -#include "../dgl/Vulkan.hpp" typedef DGL_NAMESPACE::VulkanImage DemoImage; #endif diff --git a/tests/FileBrowserDialog.cpp b/tests/FileBrowserDialog.cpp index 29498e41..da0bc5f5 100644 --- a/tests/FileBrowserDialog.cpp +++ b/tests/FileBrowserDialog.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2025 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 @@ -15,8 +15,10 @@ */ #include "tests.hpp" - -#include "dgl/NanoVG.hpp" +#include "dgl.cpp" +#include "dgl/src/Color.cpp" +#include "dgl/src/NanoVG.cpp" +#include "dgl/src/Resources.cpp" START_NAMESPACE_DGL diff --git a/tests/Makefile b/tests/Makefile index 8ddd754f..cda9a433 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -4,6 +4,8 @@ # Created by falkTX # +export DEBUG = true + include ../Makefile.base.mk # --------------------------------------------------------------------------------------------------------------------- @@ -13,7 +15,7 @@ BUILD_CXX_FLAGS += $(DGL_FLAGS) -I.. -I../dgl/src/pugl-upstream/include -DDONT_S LINK_FLAGS += -lpthread # TODO fix within pugl -BUILD_CXX_FLAGS += -Wno-extra -Wno-missing-field-initializers +# BUILD_CXX_FLAGS += -Wno-extra -Wno-missing-field-initializers ifeq ($(MACOS),true) BUILD_CXX_FLAGS += -ObjC++ -DGL_SILENCE_DEPRECATION -Wno-deprecated-declarations @@ -29,7 +31,8 @@ MANUAL_TESTS += Demo.cairo endif ifeq ($(HAVE_OPENGL),true) -MANUAL_TESTS += Demo.opengl +MANUAL_TESTS += Demo.opengl2 +MANUAL_TESTS += Demo.opengl3 MANUAL_TESTS += FileBrowserDialog MANUAL_TESTS += NanoImage MANUAL_TESTS += NanoSubWidgets @@ -37,14 +40,13 @@ endif ifneq ($(WASM),true) UNIT_TESTS += Application +UNIT_TESTS += Window.stub ifeq ($(HAVE_CAIRO),true) UNIT_TESTS += Window.cairo endif ifeq ($(HAVE_OPENGL),true) -UNIT_TESTS += Window.opengl -endif -ifeq ($(HAVE_STUB),true) -UNIT_TESTS += Window.stub +UNIT_TESTS += Window.opengl2 +UNIT_TESTS += Window.opengl3 endif ifeq ($(HAVE_VULKAN),true) UNIT_TESTS += Window.vulkan @@ -103,11 +105,16 @@ clean: @echo "Compiling $< (Cairo)" $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) $(CAIRO_FLAGS) -DDGL_CAIRO -c -o $@ -../build/tests/%.cpp.opengl.o: %.cpp +../build/tests/%.cpp.opengl2.o: %.cpp -@mkdir -p ../build/tests - @echo "Compiling $< (OpenGL)" + @echo "Compiling $< (OpenGL2)" $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) $(OPENGL_FLAGS) -DDGL_OPENGL -c -o $@ +../build/tests/%.cpp.opengl3.o: %.cpp + -@mkdir -p ../build/tests + @echo "Compiling $< (OpenGL3)" + $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) $(OPENGL_FLAGS) -DDGL_OPENGL -DDGL_USE_OPENGL3 -c -o $@ + ../build/tests/%.cpp.stub.o: %.cpp -@mkdir -p ../build/tests @echo "Compiling $< (Stub)" @@ -129,7 +136,11 @@ clean: @echo "Linking $*" $(SILENT)$(CXX) $< $(LINK_FLAGS) $(DGL_SYSTEM_LIBS) $(CAIRO_LIBS) -o $@ -../build/tests/%.opengl$(APP_EXT): ../build/tests/%.cpp.opengl.o +../build/tests/%.opengl2$(APP_EXT): ../build/tests/%.cpp.opengl2.o + @echo "Linking $*" + $(SILENT)$(CXX) $< $(LINK_FLAGS) $(DGL_SYSTEM_LIBS) $(OPENGL_LIBS) -o $@ + +../build/tests/%.opengl3$(APP_EXT): ../build/tests/%.cpp.opengl3.o @echo "Linking $*" $(SILENT)$(CXX) $< $(LINK_FLAGS) $(DGL_SYSTEM_LIBS) $(OPENGL_LIBS) -o $@ @@ -144,34 +155,40 @@ clean: # --------------------------------------------------------------------------------------------------------------------- # linking steps (special, links against DGL static lib) -../build/tests/Demo.cairo$(APP_EXT): ../build/tests/Demo.cpp.cairo.o ../build/libdgl-cairo.a +../build/tests/Demo.cairo$(APP_EXT): ../build/tests/Demo.cpp.cairo.o @echo "Linking Demo (Cairo)" $(SILENT)$(CXX) $^ $(LINK_FLAGS) $(DGL_SYSTEM_LIBS) $(CAIRO_LIBS) -o $@ -../build/tests/Demo.opengl$(APP_EXT): ../build/tests/Demo.cpp.opengl.o ../build/libdgl-opengl.a +../build/tests/Demo.opengl2$(APP_EXT): ../build/tests/Demo.cpp.opengl2.o @echo "Linking Demo (OpenGL)" $(SILENT)$(CXX) $^ $(LINK_FLAGS) $(DGL_SYSTEM_LIBS) $(OPENGL_LIBS) -o $@ -../build/tests/Demo.vulkan$(APP_EXT): ../build/tests/Demo.cpp.vulkan.o ../build/libdgl-vulkan.a +../build/tests/Demo.opengl3$(APP_EXT): ../build/tests/Demo.cpp.opengl3.o @echo "Linking Demo (OpenGL)" + $(SILENT)$(CXX) $^ $(LINK_FLAGS) $(DGL_SYSTEM_LIBS) $(OPENGL_LIBS) -o $@ + +../build/tests/Demo.vulkan$(APP_EXT): ../build/tests/Demo.cpp.vulkan.o + @echo "Linking Demo (Vulkan)" $(SILENT)$(CXX) $^ $(LINK_FLAGS) $(DGL_SYSTEM_LIBS) $(VULKAN_LIBS) -o $@ -../build/tests/FileBrowserDialog$(APP_EXT): ../build/tests/FileBrowserDialog.cpp.o ../build/libdgl-opengl.a - @echo "Linking FileBrowserDialog (OpenGL)" +../build/tests/FileBrowserDialog$(APP_EXT): ../build/tests/FileBrowserDialog.cpp.o + @echo "Linking FileBrowserDialog (OpenGL2)" $(SILENT)$(CXX) $^ $(LINK_FLAGS) $(DGL_SYSTEM_LIBS) $(OPENGL_LIBS) -o $@ -../build/tests/NanoImage$(APP_EXT): ../build/tests/NanoImage.cpp.o ../build/libdgl-opengl.a - @echo "Linking NanoImage (OpenGL)" +../build/tests/NanoImage$(APP_EXT): ../build/tests/NanoImage.cpp.o + @echo "Linking NanoImage (OpenGL2)" $(SILENT)$(CXX) $^ $(LINK_FLAGS) $(DGL_SYSTEM_LIBS) $(OPENGL_LIBS) -o $@ -../build/tests/NanoSubWidgets$(APP_EXT): ../build/tests/NanoSubWidgets.cpp.o ../build/libdgl-opengl.a - @echo "Linking NanoSubWidgets (OpenGL)" +../build/tests/NanoSubWidgets$(APP_EXT): ../build/tests/NanoSubWidgets.cpp.o + @echo "Linking NanoSubWidgets (OpenGL2)" $(SILENT)$(CXX) $^ $(LINK_FLAGS) $(DGL_SYSTEM_LIBS) $(OPENGL_LIBS) -o $@ # --------------------------------------------------------------------------------------------------------------------- -.PHONY: Demo.opengl FileBrowserDialog NanoImage NanoSubWidgets - -include $(ALL_OBJS:%.o=%.d) +-include ../build/tests/Demo.cpp.cairo.d +-include ../build/tests/Demo.cpp.opengl2.d +-include ../build/tests/Demo.cpp.opengl3.d +-include ../build/tests/Demo.cpp.vulkan.d # --------------------------------------------------------------------------------------------------------------------- diff --git a/tests/NanoImage.cpp b/tests/NanoImage.cpp index 0b9c5ceb..843b61ce 100644 --- a/tests/NanoImage.cpp +++ b/tests/NanoImage.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2025 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 @@ -15,8 +15,10 @@ */ #include "tests.hpp" - -#include "dgl/NanoVG.hpp" +#include "dgl.cpp" +#include "dgl/src/Color.cpp" +#include "dgl/src/NanoVG.cpp" +#include "dgl/src/Resources.cpp" START_NAMESPACE_DGL diff --git a/tests/NanoSubWidgets.cpp b/tests/NanoSubWidgets.cpp index 3ee90854..a2bc7b46 100644 --- a/tests/NanoSubWidgets.cpp +++ b/tests/NanoSubWidgets.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2025 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 @@ -15,8 +15,10 @@ */ #include "tests.hpp" - -#include "../dgl/NanoVG.hpp" +#include "dgl.cpp" +#include "dgl/src/Color.cpp" +#include "dgl/src/NanoVG.cpp" +#include "dgl/src/Resources.cpp" START_NAMESPACE_DGL diff --git a/tests/Point.cpp b/tests/Point.cpp index 677c8f0c..16efeb1a 100644 --- a/tests/Point.cpp +++ b/tests/Point.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2025 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 @@ -15,11 +15,7 @@ */ #include "tests.hpp" - -#define DPF_TEST_POINT_CPP -#include "dgl/src/Application.cpp" -#include "dgl/src/ApplicationPrivateData.cpp" -#include "dgl/src/Geometry.cpp" +#include "dgl.cpp" // -------------------------------------------------------------------------------------------------------------------- diff --git a/tests/Window.cpp b/tests/Window.cpp index 32346d30..684e154e 100644 --- a/tests/Window.cpp +++ b/tests/Window.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2025 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 @@ -15,15 +15,9 @@ */ #include "tests.hpp" - -#define DPF_TEST_POINT_CPP -#define DPF_TEST_WINDOW_CPP -#include "dgl/src/pugl.cpp" -#include "dgl/src/Application.cpp" -#include "dgl/src/ApplicationPrivateData.cpp" -#include "dgl/src/Geometry.cpp" -#include "dgl/src/Window.cpp" -#include "dgl/src/WindowPrivateData.cpp" +#include "dgl.cpp" +#include "dgl/src/EventHandlers.cpp" +#include "dgl/src/ImageBase.cpp" // -------------------------------------------------------------------------------------------------------------------- diff --git a/tests/dgl.cpp b/tests/dgl.cpp new file mode 100644 index 00000000..6405ca8d --- /dev/null +++ b/tests/dgl.cpp @@ -0,0 +1,44 @@ +/* + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2025 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 + * permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD + * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER + * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "dgl/src/pugl.cpp" + +#include "dgl/src/Application.cpp" +#include "dgl/src/ApplicationPrivateData.cpp" +#include "dgl/src/Geometry.cpp" +#include "dgl/src/SubWidget.cpp" +#include "dgl/src/SubWidgetPrivateData.cpp" +#include "dgl/src/TopLevelWidget.cpp" +#include "dgl/src/TopLevelWidgetPrivateData.cpp" +#include "dgl/src/Widget.cpp" +#include "dgl/src/WidgetPrivateData.cpp" +#include "dgl/src/Window.cpp" +#include "dgl/src/WindowPrivateData.cpp" + +#if defined(DGL_CAIRO) +#include "dgl/src/Cairo.cpp" +#elif defined(DGL_OPENGL) +#include "dgl/src/OpenGL.cpp" +#ifdef DGL_USE_OPENGL3 +#include "dgl/src/OpenGL3.cpp" +#else +#include "dgl/src/OpenGL2.cpp" +#endif +#elif defined(DGL_VULKAN) +#include "dgl/src/Vulkan.cpp" +#else +#include "dgl/src/Stub.cpp" +#endif