Signed-off-by: falkTX <falktx@falktx.com>pull/452/head
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* DISTRHO Plugin Framework (DPF) | * DISTRHO Plugin Framework (DPF) | ||||
* Copyright (C) 2012-2022 Filipe Coelho <falktx@falktx.com> | |||||
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com> | |||||
* | * | ||||
* Permission to use, copy, modify, and/or distribute this software for any purpose with | * 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 | * or without fee is hereby granted, provided that the above copyright notice and this | ||||
@@ -186,7 +186,7 @@ private: | |||||
struct PrivateData; | struct PrivateData; | ||||
PrivateData* const pData; | PrivateData* const pData; | ||||
DISTRHO_LEAK_DETECTOR(SliderEventHandler) | |||||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SliderEventHandler) | |||||
}; | }; | ||||
// -------------------------------------------------------------------------------------------------------------------- | // -------------------------------------------------------------------------------------------------------------------- | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* DISTRHO Plugin Framework (DPF) | * DISTRHO Plugin Framework (DPF) | ||||
* Copyright (C) 2012-2023 Filipe Coelho <falktx@falktx.com> | |||||
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com> | |||||
* Copyright (C) 2019-2021 Jean Pierre Cimalando <jp-dev@inbox.ru> | * Copyright (C) 2019-2021 Jean Pierre Cimalando <jp-dev@inbox.ru> | ||||
* | * | ||||
* Permission to use, copy, modify, and/or distribute this software for any purpose with | * Permission to use, copy, modify, and/or distribute this software for any purpose with | ||||
@@ -438,9 +438,9 @@ void CairoImage::loadFromMemory(const char* const rdata, const Size<uint>& s, co | |||||
for (int w = 0; w < width; ++w) | for (int w = 0; w < width; ++w) | ||||
{ | { | ||||
const uchar a = urdata[h*width*4+w*4+3]; | const uchar a = urdata[h*width*4+w*4+3]; | ||||
newdata[h*width*4+w*4+0] = (urdata[h*width*4+w*4+0] * a) >> 8; | |||||
newdata[h*width*4+w*4+1] = (urdata[h*width*4+w*4+1] * a) >> 8; | |||||
newdata[h*width*4+w*4+2] = (urdata[h*width*4+w*4+2] * a) >> 8; | |||||
newdata[h*width*4+w*4+0] = static_cast<uchar>((urdata[h*width*4+w*4+0] * a) >> 8); | |||||
newdata[h*width*4+w*4+1] = static_cast<uchar>((urdata[h*width*4+w*4+1] * a) >> 8); | |||||
newdata[h*width*4+w*4+2] = static_cast<uchar>((urdata[h*width*4+w*4+2] * a) >> 8); | |||||
newdata[h*width*4+w*4+3] = a; | newdata[h*width*4+w*4+3] = a; | ||||
} | } | ||||
} | } | ||||
@@ -465,9 +465,9 @@ void CairoImage::loadFromMemory(const char* const rdata, const Size<uint>& s, co | |||||
for (int w = 0; w < width; ++w) | for (int w = 0; w < width; ++w) | ||||
{ | { | ||||
const uchar a = urdata[h*width*4+w*4+3]; | const uchar a = urdata[h*width*4+w*4+3]; | ||||
newdata[h*width*4+w*4+0] = (urdata[h*width*4+w*4+2] * a) >> 8; | |||||
newdata[h*width*4+w*4+1] = (urdata[h*width*4+w*4+1] * a) >> 8; | |||||
newdata[h*width*4+w*4+2] = (urdata[h*width*4+w*4+0] * a) >> 8; | |||||
newdata[h*width*4+w*4+0] = static_cast<uchar>((urdata[h*width*4+w*4+2] * a) >> 8); | |||||
newdata[h*width*4+w*4+1] = static_cast<uchar>((urdata[h*width*4+w*4+1] * a) >> 8); | |||||
newdata[h*width*4+w*4+2] = static_cast<uchar>((urdata[h*width*4+w*4+0] * a) >> 8); | |||||
newdata[h*width*4+w*4+3] = a; | newdata[h*width*4+w*4+3] = a; | ||||
} | } | ||||
} | } | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* DISTRHO Plugin Framework (DPF) | * DISTRHO Plugin Framework (DPF) | ||||
* Copyright (C) 2012-2022 Filipe Coelho <falktx@falktx.com> | |||||
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com> | |||||
* | * | ||||
* Permission to use, copy, modify, and/or distribute this software for any purpose with | * 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 | * or without fee is hereby granted, provided that the above copyright notice and this | ||||
@@ -419,7 +419,7 @@ struct KnobEventHandler::PrivateData { | |||||
if ((state & kKnobStateDragging) == 0x0) | if ((state & kKnobStateDragging) == 0x0) | ||||
return false; | return false; | ||||
float movDiff; | |||||
double movDiff; | |||||
switch (orientation) | switch (orientation) | ||||
{ | { | ||||
@@ -431,8 +431,8 @@ struct KnobEventHandler::PrivateData { | |||||
break; | break; | ||||
case Both: | case Both: | ||||
{ | { | ||||
const float movDiffX = ev.pos.getX() / scaleFactor - lastX; | |||||
const float movDiffY = lastY - ev.pos.getY() / scaleFactor; | |||||
const double movDiffX = ev.pos.getX() / scaleFactor - lastX; | |||||
const double movDiffY = lastY - ev.pos.getY() / scaleFactor; | |||||
movDiff = std::abs(movDiffX) > std::abs(movDiffY) ? movDiffX : movDiffY; | movDiff = std::abs(movDiffX) > std::abs(movDiffY) ? movDiffX : movDiffY; | ||||
} | } | ||||
break; | break; | ||||
@@ -444,7 +444,7 @@ struct KnobEventHandler::PrivateData { | |||||
return true; | return true; | ||||
const float divisor = (ev.mod & kModifierControl) ? accel * 10.f : accel; | const float divisor = (ev.mod & kModifierControl) ? accel * 10.f : accel; | ||||
valueTmp += (maximum - minimum) / divisor * movDiff; | |||||
valueTmp += (maximum - minimum) / divisor * static_cast<float>(movDiff); | |||||
if (usingLog) | if (usingLog) | ||||
valueTmp = logscale(valueTmp); | valueTmp = logscale(valueTmp); | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* DISTRHO Plugin Framework (DPF) | * DISTRHO Plugin Framework (DPF) | ||||
* Copyright (C) 2012-2022 Filipe Coelho <falktx@falktx.com> | |||||
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com> | |||||
* | * | ||||
* Permission to use, copy, modify, and/or distribute this software for any purpose with | * 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 | * or without fee is hereby granted, provided that the above copyright notice and this | ||||
@@ -35,8 +35,8 @@ uint Layout<true>::setAbsolutePos(int x, const int y, const uint padding) | |||||
SubWidgetWithSizeHint& s(*it); | SubWidgetWithSizeHint& s(*it); | ||||
maxHeight = std::max(maxHeight, s.widget->getHeight()); | maxHeight = std::max(maxHeight, s.widget->getHeight()); | ||||
s.widget->setAbsolutePos(x, y); | s.widget->setAbsolutePos(x, y); | ||||
x += s.widget->getWidth(); | |||||
x += padding; | |||||
x += static_cast<int>(s.widget->getWidth()); | |||||
x += static_cast<int>(padding); | |||||
} | } | ||||
return maxHeight; | return maxHeight; | ||||
@@ -52,8 +52,8 @@ uint Layout<false>::setAbsolutePos(const int x, int y, const uint padding) | |||||
SubWidgetWithSizeHint& s(*it); | SubWidgetWithSizeHint& s(*it); | ||||
maxWidth = std::max(maxWidth, s.widget->getWidth()); | maxWidth = std::max(maxWidth, s.widget->getWidth()); | ||||
s.widget->setAbsolutePos(x, y); | s.widget->setAbsolutePos(x, y); | ||||
y += s.widget->getHeight(); | |||||
y += padding; | |||||
y += static_cast<int>(s.widget->getHeight()); | |||||
y += static_cast<int>(padding); | |||||
} | } | ||||
return maxWidth; | return maxWidth; | ||||
@@ -78,7 +78,7 @@ void Layout<true>::setSize(const uint width, const uint padding) | |||||
} | } | ||||
if (const size_t numWidgets = widgets.size()) | if (const size_t numWidgets = widgets.size()) | ||||
nonFixedWidth -= padding * (numWidgets - 1); | |||||
nonFixedWidth -= padding * static_cast<uint>(numWidgets - 1); | |||||
const uint widthPerWidget = numDynamiclySizedWidgets != 0 ? nonFixedWidth / numDynamiclySizedWidgets : 0; | const uint widthPerWidget = numDynamiclySizedWidgets != 0 ? nonFixedWidth / numDynamiclySizedWidgets : 0; | ||||
@@ -111,7 +111,7 @@ void Layout<false>::setSize(const uint height, const uint padding) | |||||
} | } | ||||
if (const size_t numWidgets = widgets.size()) | if (const size_t numWidgets = widgets.size()) | ||||
nonFixedHeight -= padding * (numWidgets - 1); | |||||
nonFixedHeight -= padding * static_cast<uint>(numWidgets - 1); | |||||
const uint heightPerWidget = numDynamiclySizedWidgets != 0 ? nonFixedHeight / numDynamiclySizedWidgets : 0; | const uint heightPerWidget = numDynamiclySizedWidgets != 0 ? nonFixedHeight / numDynamiclySizedWidgets : 0; | ||||
@@ -138,8 +138,8 @@ void HorizontallyStackedVerticalLayout::setAbsolutePos(int x, const int y, const | |||||
for (VerticalLayoutIterator it=items.begin(), end=items.end(); it != end; ++it) | for (VerticalLayoutIterator it=items.begin(), end=items.end(); it != end; ++it) | ||||
{ | { | ||||
VerticalLayout* l(*it); | VerticalLayout* l(*it); | ||||
x += l->setAbsolutePos(x, y, padding); | |||||
x += padding; | |||||
x += static_cast<int>(l->setAbsolutePos(x, y, padding)); | |||||
x += static_cast<int>(padding); | |||||
} | } | ||||
} | } | ||||
@@ -157,9 +157,9 @@ Size<uint> VerticallyStackedHorizontalLayout::adjustSize(const uint padding) | |||||
uint width = 0; | uint width = 0; | ||||
uint height = 0; | uint height = 0; | ||||
for (SubWidgetWithSizeHintIterator it=l->widgets.begin(), end=l->widgets.end(); it != end; ++it) | |||||
for (SubWidgetWithSizeHintIterator it2=l->widgets.begin(), end2=l->widgets.end(); it2 != end2; ++it2) | |||||
{ | { | ||||
SubWidgetWithSizeHint& s(*it); | |||||
SubWidgetWithSizeHint& s(*it2); | |||||
if (width != 0) | if (width != 0) | ||||
width += padding; | width += padding; | ||||
@@ -191,8 +191,8 @@ void VerticallyStackedHorizontalLayout::setAbsolutePos(const int x, int y, const | |||||
for (HorizontalLayoutIterator it=items.begin(), end=items.end(); it != end; ++it) | for (HorizontalLayoutIterator it=items.begin(), end=items.end(); it != end; ++it) | ||||
{ | { | ||||
HorizontalLayout* l(*it); | HorizontalLayout* l(*it); | ||||
y += l->setAbsolutePos(x, y, padding); | |||||
y += padding; | |||||
y += static_cast<int>(l->setAbsolutePos(x, y, padding)); | |||||
y += static_cast<int>(padding); | |||||
} | } | ||||
} | } | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* DISTRHO Plugin Framework (DPF) | * DISTRHO Plugin Framework (DPF) | ||||
* Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com> | |||||
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com> | |||||
* | * | ||||
* Permission to use, copy, modify, and/or distribute this software for any purpose with | * 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 | * or without fee is hereby granted, provided that the above copyright notice and this | ||||
@@ -691,12 +691,12 @@ void SubWidget::PrivateData::display(const uint width, const uint height, const | |||||
const int w = static_cast<int>(self->getWidth()); | const int w = static_cast<int>(self->getWidth()); | ||||
const int h = static_cast<int>(self->getHeight()); | const int h = static_cast<int>(self->getHeight()); | ||||
if (viewportScaleFactor != 0.0 && viewportScaleFactor != 1.0) | |||||
if (d_isNotZero(viewportScaleFactor) && d_isNotEqual(viewportScaleFactor, 1.0)) | |||||
{ | { | ||||
glViewport(x, | glViewport(x, | ||||
-static_cast<int>(height * viewportScaleFactor - height + absolutePos.getY() + 0.5), | |||||
static_cast<int>(width * viewportScaleFactor + 0.5), | |||||
static_cast<int>(height * viewportScaleFactor + 0.5)); | |||||
-d_roundToIntPositive(height * viewportScaleFactor - height + absolutePos.getY()), | |||||
d_roundToIntPositive(width * viewportScaleFactor), | |||||
d_roundToIntPositive(height * viewportScaleFactor)); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
@@ -712,16 +712,16 @@ void SubWidget::PrivateData::display(const uint width, const uint height, const | |||||
else | else | ||||
{ | { | ||||
// set viewport pos | // set viewport pos | ||||
glViewport(static_cast<int>(absolutePos.getX() * autoScaleFactor + 0.5), | |||||
-static_cast<int>(absolutePos.getY() * autoScaleFactor + 0.5), | |||||
glViewport(d_roundToIntPositive(absolutePos.getX() * autoScaleFactor), | |||||
-d_roundToIntPositive(absolutePos.getY() * autoScaleFactor), | |||||
static_cast<int>(width), | static_cast<int>(width), | ||||
static_cast<int>(height)); | static_cast<int>(height)); | ||||
// then cut the outer bounds | // then cut the outer bounds | ||||
glScissor(static_cast<int>(absolutePos.getX() * autoScaleFactor + 0.5), | |||||
static_cast<int>(height - (self->getHeight() + absolutePos.getY()) * autoScaleFactor + 0.5), | |||||
static_cast<int>(self->getWidth() * autoScaleFactor + 0.5), | |||||
static_cast<int>(self->getHeight() * autoScaleFactor + 0.5)); | |||||
glScissor(d_roundToIntPositive(absolutePos.getX() * autoScaleFactor), | |||||
d_roundToIntPositive(height - (static_cast<int>(self->getHeight()) + absolutePos.getY()) * autoScaleFactor), | |||||
d_roundToIntPositive(self->getWidth() * autoScaleFactor), | |||||
d_roundToIntPositive(self->getHeight() * autoScaleFactor)); | |||||
glEnable(GL_SCISSOR_TEST); | glEnable(GL_SCISSOR_TEST); | ||||
needsDisableScissor = true; | needsDisableScissor = true; | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* DISTRHO Plugin Framework (DPF) | * DISTRHO Plugin Framework (DPF) | ||||
* Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com> | |||||
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com> | |||||
* | * | ||||
* Permission to use, copy, modify, and/or distribute this software for any purpose with | * 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 | * or without fee is hereby granted, provided that the above copyright notice and this | ||||
@@ -71,7 +71,7 @@ Rectangle<uint> SubWidget::getConstrainedAbsoluteArea() const noexcept | |||||
const int y = getAbsoluteY(); | const int y = getAbsoluteY(); | ||||
if (x >= 0 && y >= 0) | if (x >= 0 && y >= 0) | ||||
return Rectangle<uint>(x, y, getSize()); | |||||
return Rectangle<uint>(static_cast<uint>(x), static_cast<uint>(y), getSize()); | |||||
const int xOffset = std::min(0, x); | const int xOffset = std::min(0, x); | ||||
const int yOffset = std::min(0, y); | const int yOffset = std::min(0, y); | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* DISTRHO Plugin Framework (DPF) | * DISTRHO Plugin Framework (DPF) | ||||
* Copyright (C) 2012-2023 Filipe Coelho <falktx@falktx.com> | |||||
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com> | |||||
* | * | ||||
* Permission to use, copy, modify, and/or distribute this software for any purpose with | * 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 | * or without fee is hereby granted, provided that the above copyright notice and this | ||||
@@ -269,10 +269,10 @@ void Window::setSize(uint width, uint height) | |||||
uint minWidth = pData->minWidth; | uint minWidth = pData->minWidth; | ||||
uint minHeight = pData->minHeight; | uint minHeight = pData->minHeight; | ||||
if (pData->autoScaling && scaleFactor != 1.0) | |||||
if (pData->autoScaling && d_isNotEqual(scaleFactor, 1.0)) | |||||
{ | { | ||||
minWidth *= scaleFactor; | |||||
minHeight *= scaleFactor; | |||||
minWidth = d_roundToUnsignedInt(minWidth * scaleFactor); | |||||
minHeight = d_roundToUnsignedInt(minHeight * scaleFactor); | |||||
} | } | ||||
// handle geometry constraints here | // handle geometry constraints here | ||||
@@ -293,10 +293,10 @@ void Window::setSize(uint width, uint height) | |||||
{ | { | ||||
// fix width | // fix width | ||||
if (reqRatio > ratio) | if (reqRatio > ratio) | ||||
width = static_cast<uint>(height * ratio + 0.5); | |||||
width = d_roundToUnsignedInt(height * ratio); | |||||
// fix height | // fix height | ||||
else | else | ||||
height = static_cast<uint>(static_cast<double>(width) / ratio + 0.5); | |||||
height = d_roundToUnsignedInt(static_cast<double>(width) / ratio); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -430,10 +430,10 @@ void Window::repaint(const Rectangle<uint>& rect) noexcept | |||||
{ | { | ||||
const double autoScaleFactor = pData->autoScaleFactor; | const double autoScaleFactor = pData->autoScaleFactor; | ||||
prect.x *= autoScaleFactor; | |||||
prect.y *= autoScaleFactor; | |||||
prect.width *= autoScaleFactor; | |||||
prect.height *= autoScaleFactor; | |||||
prect.x = static_cast<PuglCoord>(prect.x * autoScaleFactor); | |||||
prect.y = static_cast<PuglCoord>(prect.y * autoScaleFactor); | |||||
prect.width = static_cast<PuglSpan>(prect.width * autoScaleFactor + 0.5); | |||||
prect.height = static_cast<PuglSpan>(prect.height * autoScaleFactor + 0.5); | |||||
} | } | ||||
puglPostRedisplayRect(pData->view, prect); | puglPostRedisplayRect(pData->view, prect); | ||||
} | } | ||||
@@ -479,8 +479,8 @@ void Window::setGeometryConstraints(uint minimumWidth, | |||||
if (automaticallyScale && scaleFactor != 1.0) | if (automaticallyScale && scaleFactor != 1.0) | ||||
{ | { | ||||
minimumWidth *= scaleFactor; | |||||
minimumHeight *= scaleFactor; | |||||
minimumWidth = d_roundToUnsignedInt(minimumWidth * scaleFactor); | |||||
minimumHeight = d_roundToUnsignedInt(minimumHeight * scaleFactor); | |||||
} | } | ||||
puglSetGeometryConstraints(pData->view, minimumWidth, minimumHeight, keepAspectRatio); | puglSetGeometryConstraints(pData->view, minimumWidth, minimumHeight, keepAspectRatio); | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* DISTRHO Plugin Framework (DPF) | * DISTRHO Plugin Framework (DPF) | ||||
* Copyright (C) 2012-2023 Filipe Coelho <falktx@falktx.com> | |||||
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com> | |||||
* | * | ||||
* Permission to use, copy, modify, and/or distribute this software for any purpose with | * 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 | * or without fee is hereby granted, provided that the above copyright notice and this | ||||
@@ -270,18 +270,18 @@ void Window::PrivateData::initPre(const uint width, const uint height, const boo | |||||
puglSetViewHint(view, PUGL_RESIZABLE, resizable ? PUGL_TRUE : PUGL_FALSE); | puglSetViewHint(view, PUGL_RESIZABLE, resizable ? PUGL_TRUE : PUGL_FALSE); | ||||
puglSetViewHint(view, PUGL_IGNORE_KEY_REPEAT, PUGL_FALSE); | puglSetViewHint(view, PUGL_IGNORE_KEY_REPEAT, PUGL_FALSE); | ||||
#if DGL_USE_RGBA | |||||
#if defined(DGL_USE_RGBA) && DGL_USE_RGBA | |||||
puglSetViewHint(view, PUGL_DEPTH_BITS, 24); | puglSetViewHint(view, PUGL_DEPTH_BITS, 24); | ||||
#else | |||||
#else | |||||
puglSetViewHint(view, PUGL_DEPTH_BITS, 16); | puglSetViewHint(view, PUGL_DEPTH_BITS, 16); | ||||
#endif | |||||
#endif | |||||
puglSetViewHint(view, PUGL_STENCIL_BITS, 8); | puglSetViewHint(view, PUGL_STENCIL_BITS, 8); | ||||
// PUGL_SAMPLES ?? | // PUGL_SAMPLES ?? | ||||
puglSetEventFunc(view, puglEventCallback); | puglSetEventFunc(view, puglEventCallback); | ||||
// setting default size triggers system-level calls, do it last | // setting default size triggers system-level calls, do it last | ||||
puglSetSizeHint(view, PUGL_DEFAULT_SIZE, width, height); | |||||
puglSetSizeHint(view, PUGL_DEFAULT_SIZE, static_cast<PuglSpan>(width), static_cast<PuglSpan>(height)); | |||||
} | } | ||||
bool Window::PrivateData::initPost() | bool Window::PrivateData::initPost() | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* DISTRHO Plugin Framework (DPF) | * DISTRHO Plugin Framework (DPF) | ||||
* Copyright (C) 2012-2023 Filipe Coelho <falktx@falktx.com> | |||||
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com> | |||||
* | * | ||||
* Permission to use, copy, modify, and/or distribute this software for any purpose with | * 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 | * or without fee is hereby granted, provided that the above copyright notice and this | ||||
@@ -181,7 +181,14 @@ START_NAMESPACE_DGL | |||||
# include "pugl-upstream/src/win_vulkan.c" | # include "pugl-upstream/src/win_vulkan.c" | ||||
# endif | # endif | ||||
#elif defined(HAVE_X11) | #elif defined(HAVE_X11) | ||||
# if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic push | |||||
# pragma GCC diagnostic ignored "-Wsign-conversion" | |||||
# endif | |||||
# include "pugl-upstream/src/x11.c" | # include "pugl-upstream/src/x11.c" | ||||
# if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic pop | |||||
# endif | |||||
# include "pugl-upstream/src/x11_stub.c" | # include "pugl-upstream/src/x11_stub.c" | ||||
# ifdef DGL_CAIRO | # ifdef DGL_CAIRO | ||||
# include "pugl-upstream/src/x11_cairo.c" | # include "pugl-upstream/src/x11_cairo.c" | ||||
@@ -277,13 +284,13 @@ void puglRaiseWindow(PuglView* const view) | |||||
PuglStatus puglSetGeometryConstraints(PuglView* const view, const uint width, const uint height, const bool aspect) | PuglStatus puglSetGeometryConstraints(PuglView* const view, const uint width, const uint height, const bool aspect) | ||||
{ | { | ||||
view->sizeHints[PUGL_MIN_SIZE].width = width; | |||||
view->sizeHints[PUGL_MIN_SIZE].height = height; | |||||
view->sizeHints[PUGL_MIN_SIZE].width = static_cast<PuglSpan>(width); | |||||
view->sizeHints[PUGL_MIN_SIZE].height = static_cast<PuglSpan>(height); | |||||
if (aspect) | if (aspect) | ||||
{ | { | ||||
view->sizeHints[PUGL_FIXED_ASPECT].width = width; | |||||
view->sizeHints[PUGL_FIXED_ASPECT].height = height; | |||||
view->sizeHints[PUGL_FIXED_ASPECT].width = static_cast<PuglSpan>(width); | |||||
view->sizeHints[PUGL_FIXED_ASPECT].height = static_cast<PuglSpan>(height); | |||||
} | } | ||||
#if defined(DISTRHO_OS_HAIKU) | #if defined(DISTRHO_OS_HAIKU) | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* DISTRHO Plugin Framework (DPF) | * DISTRHO Plugin Framework (DPF) | ||||
* Copyright (C) 2012-2023 Filipe Coelho <falktx@falktx.com> | |||||
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com> | |||||
* | * | ||||
* Permission to use, copy, modify, and/or distribute this software for any purpose with | * 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 | * or without fee is hereby granted, provided that the above copyright notice and this | ||||
@@ -566,7 +566,7 @@ struct ParameterEnumerationValues { | |||||
When using this constructor the pointer to @values MUST have been statically declared.@n | When using this constructor the pointer to @values MUST have been statically declared.@n | ||||
It will not be automatically deleted later. | It will not be automatically deleted later. | ||||
*/ | */ | ||||
constexpr ParameterEnumerationValues(uint32_t c, bool r, ParameterEnumerationValue* v) noexcept | |||||
constexpr ParameterEnumerationValues(uint8_t c, bool r, ParameterEnumerationValue* v) noexcept | |||||
: count(c), | : count(c), | ||||
restrictedMode(r), | restrictedMode(r), | ||||
values(v), | values(v), | ||||
@@ -578,6 +578,8 @@ struct ParameterEnumerationValues { | |||||
if (deleteLater) | if (deleteLater) | ||||
delete[] values; | delete[] values; | ||||
} | } | ||||
DISTRHO_DECLARE_NON_COPYABLE(ParameterEnumerationValues) | |||||
}; | }; | ||||
/** | /** | ||||
@@ -669,6 +671,7 @@ struct Parameter { | |||||
shortName(), | shortName(), | ||||
symbol(), | symbol(), | ||||
unit(), | unit(), | ||||
description(), | |||||
ranges(), | ranges(), | ||||
enumValues(), | enumValues(), | ||||
designation(kParameterDesignationNull), | designation(kParameterDesignationNull), | ||||
@@ -684,6 +687,7 @@ struct Parameter { | |||||
shortName(), | shortName(), | ||||
symbol(s), | symbol(s), | ||||
unit(u), | unit(u), | ||||
description(), | |||||
ranges(def, min, max), | ranges(def, min, max), | ||||
enumValues(), | enumValues(), | ||||
designation(kParameterDesignationNull), | designation(kParameterDesignationNull), | ||||
@@ -702,6 +706,7 @@ struct Parameter { | |||||
shortName(), | shortName(), | ||||
symbol(s), | symbol(s), | ||||
unit(u), | unit(u), | ||||
description(), | |||||
ranges(def, min, max), | ranges(def, min, max), | ||||
enumValues(evcount, true, ev), | enumValues(evcount, true, ev), | ||||
designation(kParameterDesignationNull), | designation(kParameterDesignationNull), | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* DISTRHO Plugin Framework (DPF) | * DISTRHO Plugin Framework (DPF) | ||||
* Copyright (C) 2012-2023 Filipe Coelho <falktx@falktx.com> | |||||
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com> | |||||
* | * | ||||
* Permission to use, copy, modify, and/or distribute this software for any purpose with | * 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 | * or without fee is hereby granted, provided that the above copyright notice and this | ||||
@@ -310,7 +310,7 @@ uint32_t d_nextPowerOf2(uint32_t size) noexcept | |||||
} | } | ||||
/** | /** | ||||
Round a floating point number to integer. | |||||
Round a floating point number to an integer. | |||||
Fast operation for values known to be 0 or positive. | Fast operation for values known to be 0 or positive. | ||||
*/ | */ | ||||
template<typename T> | template<typename T> | ||||
@@ -321,7 +321,18 @@ int32_t d_roundToIntPositive(const T& value) | |||||
} | } | ||||
/** | /** | ||||
Round a floating point number to integer. | |||||
Round a floating point number to an unsigned integer. | |||||
Fast operation for values known to be 0 or positive. | |||||
*/ | |||||
template<typename T> | |||||
static inline constexpr | |||||
uint32_t d_roundToUnsignedInt(const T& value) | |||||
{ | |||||
return static_cast<uint32_t>(value + static_cast<T>(0.5)); | |||||
} | |||||
/** | |||||
Round a floating point number to an integer. | |||||
Fast operation for values known to be 0 or negative. | Fast operation for values known to be 0 or negative. | ||||
*/ | */ | ||||
template<typename T> | template<typename T> | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* DISTRHO Plugin Framework (DPF) | * DISTRHO Plugin Framework (DPF) | ||||
* Copyright (C) 2012-2023 Filipe Coelho <falktx@falktx.com> | |||||
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com> | |||||
* | * | ||||
* Permission to use, copy, modify, and/or distribute this software for any purpose with | * 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 | * or without fee is hereby granted, provided that the above copyright notice and this | ||||
@@ -47,7 +47,22 @@ | |||||
#ifdef HAVE_X11 | #ifdef HAVE_X11 | ||||
# define DBLCLKTME 400 | # define DBLCLKTME 400 | ||||
# include "sofd/libsofd.h" | # include "sofd/libsofd.h" | ||||
# if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic push | |||||
# pragma GCC diagnostic ignored "-Wcast-qual" | |||||
# pragma GCC diagnostic ignored "-Wconversion" | |||||
# pragma GCC diagnostic ignored "-Wfloat-conversion" | |||||
# pragma GCC diagnostic ignored "-Wshadow" | |||||
# pragma GCC diagnostic ignored "-Wsign-conversion" | |||||
# pragma GCC diagnostic ignored "-Wstrict-overflow" | |||||
# endif | |||||
# include "sofd/libsofd.c" | # include "sofd/libsofd.c" | ||||
# if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic pop | |||||
# endif | |||||
# undef HAVE_MNTENT | |||||
# undef MAX | |||||
# undef MIN | |||||
#endif | #endif | ||||
#ifdef FILE_BROWSER_DIALOG_DGL_NAMESPACE | #ifdef FILE_BROWSER_DIALOG_DGL_NAMESPACE | ||||
@@ -329,6 +344,16 @@ struct FileBrowserData { | |||||
#else // DISTRHO_OS_WINDOWS | #else // DISTRHO_OS_WINDOWS | ||||
FileBrowserData(const bool save) | FileBrowserData(const bool save) | ||||
: selectedFile(nullptr) | : selectedFile(nullptr) | ||||
#ifdef DISTRHO_OS_MAC | |||||
, nsBasePanel(nullptr) | |||||
, nsOpenPanel(nullptr) | |||||
#endif | |||||
#ifdef HAVE_DBUS | |||||
, dbuscon(nullptr) | |||||
#endif | |||||
#ifdef HAVE_X11 | |||||
, x11display(nullptr) | |||||
#endif | |||||
{ | { | ||||
#ifdef DISTRHO_OS_MAC | #ifdef DISTRHO_OS_MAC | ||||
if (save) | if (save) | ||||
@@ -393,6 +418,8 @@ struct FileBrowserData { | |||||
std::free(const_cast<char*>(selectedFile)); | std::free(const_cast<char*>(selectedFile)); | ||||
selectedFile = nullptr; | selectedFile = nullptr; | ||||
} | } | ||||
DISTRHO_DECLARE_NON_COPYABLE(FileBrowserData) | |||||
}; | }; | ||||
// -------------------------------------------------------------------------------------------------------------------- | // -------------------------------------------------------------------------------------------------------------------- | ||||
@@ -590,7 +617,8 @@ FileBrowserHandle fileBrowserCreate(const bool isEmbed, | |||||
dbus_message_iter_open_container(&dict, DBUS_TYPE_VARIANT, "ay", &variant); | dbus_message_iter_open_container(&dict, DBUS_TYPE_VARIANT, "ay", &variant); | ||||
dbus_message_iter_open_container(&variant, DBUS_TYPE_ARRAY, "y", &variantArray); | dbus_message_iter_open_container(&variant, DBUS_TYPE_ARRAY, "y", &variantArray); | ||||
dbus_message_iter_append_fixed_array(&variantArray, DBUS_TYPE_BYTE, | dbus_message_iter_append_fixed_array(&variantArray, DBUS_TYPE_BYTE, | ||||
¤t_folder_val, startDir.length()+1); | |||||
¤t_folder_val, | |||||
static_cast<int>(startDir.length() + 1)); | |||||
dbus_message_iter_close_container(&variant, &variantArray); | dbus_message_iter_close_container(&variant, &variantArray); | ||||
dbus_message_iter_close_container(&dict, &variant); | dbus_message_iter_close_container(&dict, &variant); | ||||
dbus_message_iter_close_container(&array, &dict); | dbus_message_iter_close_container(&array, &dict); | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* DISTRHO Plugin Framework (DPF) | * DISTRHO Plugin Framework (DPF) | ||||
* Copyright (C) 2012-2023 Filipe Coelho <falktx@falktx.com> | |||||
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com> | |||||
* | * | ||||
* Permission to use, copy, modify, and/or distribute this software for any purpose with | * 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 | * or without fee is hereby granted, provided that the above copyright notice and this | ||||
@@ -1607,11 +1607,7 @@ static void VST_FUNCTION_INTERFACE vst_processReplacingCallback(vst_effect* cons | |||||
END_NAMESPACE_DISTRHO | END_NAMESPACE_DISTRHO | ||||
DISTRHO_PLUGIN_EXPORT | DISTRHO_PLUGIN_EXPORT | ||||
#if defined(DISTRHO_OS_MAC) || defined(DISTRHO_OS_WASM) || defined(DISTRHO_OS_WINDOWS) | |||||
const vst_effect* VSTPluginMain(vst_host_callback audioMaster); | |||||
#else | |||||
const vst_effect* VSTPluginMain(vst_host_callback audioMaster) asm ("main"); | |||||
#endif | |||||
const vst_effect* VSTPluginMain(vst_host_callback); | |||||
DISTRHO_PLUGIN_EXPORT | DISTRHO_PLUGIN_EXPORT | ||||
const vst_effect* VSTPluginMain(const vst_host_callback audioMaster) | const vst_effect* VSTPluginMain(const vst_host_callback audioMaster) | ||||
@@ -1735,4 +1731,15 @@ const vst_effect* VSTPluginMain(const vst_host_callback audioMaster) | |||||
return effect; | return effect; | ||||
} | } | ||||
#if !(defined(DISTRHO_OS_MAC) || defined(DISTRHO_OS_WASM) || defined(DISTRHO_OS_WINDOWS)) | |||||
DISTRHO_PLUGIN_EXPORT | |||||
const vst_effect* VSTPluginMainCompat(vst_host_callback) asm ("main"); | |||||
DISTRHO_PLUGIN_EXPORT | |||||
const vst_effect* VSTPluginMainCompat(const vst_host_callback audioMaster) | |||||
{ | |||||
return VSTPluginMain(audioMaster); | |||||
} | |||||
#endif | |||||
// -------------------------------------------------------------------------------------------------------------------- | // -------------------------------------------------------------------------------------------------------------------- |