commit aedfb9c8ee5f241708466aec2dbcd3d6fafc732d
parent 602a75efe10fcb783fc4f55029c5b0d74a8e926e
Author: falkTX <falktx@gmail.com>
Date: Tue, 2 Oct 2018 08:25:19 +0200
Merge branch 'pugl-update' of github.com:DISTRHO/DPF into pugl-update
Diffstat:
6 files changed, 38 insertions(+), 10 deletions(-)
diff --git a/dgl/Window.hpp b/dgl/Window.hpp
@@ -98,8 +98,6 @@ public:
bool isResizable() const noexcept;
void setResizable(bool yesNo);
- void setGeometryConstraints(uint width, uint height, bool aspect);
-
uint getWidth() const noexcept;
uint getHeight() const noexcept;
Size<uint> getSize() const noexcept;
@@ -109,11 +107,15 @@ public:
const char* getTitle() const noexcept;
void setTitle(const char* title);
+ void setGeometryConstraints(uint width, uint height, bool aspect);
void setTransientWinId(uintptr_t winId);
double getScaling() const noexcept;
void setScaling(double scaling) noexcept;
+ bool getIgnoringKeyRepeat() const noexcept;
+ void setIgnoringKeyRepeat(bool ignore) noexcept;
+
Application& getApp() const noexcept;
intptr_t getWindowId() const noexcept;
diff --git a/dgl/src/Window.cpp b/dgl/src/Window.cpp
@@ -710,6 +710,18 @@ struct Window::PrivateData {
// -------------------------------------------------------------------
+ bool getIgnoringKeyRepeat() const noexcept
+ {
+ return fView->ignoreKeyRepeat;
+ }
+
+ void setIgnoringKeyRepeat(bool ignore) noexcept
+ {
+ puglIgnoreKeyRepeat(fView, ignore);
+ }
+
+ // -------------------------------------------------------------------
+
void addWidget(Widget* const widget)
{
fWidgets.push_back(widget);
@@ -1333,6 +1345,16 @@ void Window::setScaling(double scaling) noexcept
pData->setScaling(scaling);
}
+bool Window::getIgnoringKeyRepeat() const noexcept
+{
+ return pData->getIgnoringKeyRepeat();
+}
+
+void Window::setIgnoringKeyRepeat(bool ignore) noexcept
+{
+ pData->setIgnoringKeyRepeat(ignore);
+}
+
Application& Window::getApp() const noexcept
{
return pData->fApp;
diff --git a/distrho/src/DistrhoPluginChecks.h b/distrho/src/DistrhoPluginChecks.h
@@ -126,7 +126,8 @@
// -----------------------------------------------------------------------
// Enable full state if plugin exports presets
-#if DISTRHO_PLUGIN_WANT_PROGRAMS && DISTRHO_PLUGIN_WANT_STATE
+#if DISTRHO_PLUGIN_WANT_PROGRAMS && DISTRHO_PLUGIN_WANT_STATE && ! DISTRHO_PLUGIN_WANT_FULL_STATE
+# warning Plugins with programs and state need to implement full state API
# undef DISTRHO_PLUGIN_WANT_FULL_STATE
# define DISTRHO_PLUGIN_WANT_FULL_STATE 1
#endif
diff --git a/distrho/src/DistrhoPluginLV2.cpp b/distrho/src/DistrhoPluginLV2.cpp
@@ -613,7 +613,6 @@ public:
fEventsOutData.initIfNeeded(fURIDs.atomSequence);
LV2_Atom_Event* aev;
- uint32_t offset = fEventsOutData.offset;
const uint32_t capacity = fEventsOutData.capacity;
for (uint32_t i=0, count=fPlugin.getStateCount(); i < count; ++i)
@@ -635,8 +634,11 @@ public:
// set msg size (key + value + separator + 2x null terminator)
const size_t msgSize(key.length()+value.length()+3);
- if (sizeof(LV2_Atom_Event) + msgSize > capacity - offset)
+ if (sizeof(LV2_Atom_Event) + msgSize > capacity - fEventsOutData.offset)
+ {
+ d_stdout("Sending key '%s' to UI failed, out of space", key.buffer());
break;
+ }
// reserve msg space
// FIXME create a large enough buffer beforehand
@@ -644,15 +646,15 @@ public:
std::memset(msgBuf, 0, msgSize);
// write key and value in atom bufer
- std::memcpy(msgBuf, key.buffer(), key.length());
- std::memcpy(msgBuf+(key.length()+1), value.buffer(), value.length());
+ std::memcpy(msgBuf, key.buffer(), key.length()+1);
+ std::memcpy(msgBuf+(key.length()+1), value.buffer(), value.length()+1);
// put data
- aev = (LV2_Atom_Event*)(LV2_ATOM_CONTENTS(LV2_Atom_Sequence, fEventsOutData.port) + offset);
+ aev = (LV2_Atom_Event*)(LV2_ATOM_CONTENTS(LV2_Atom_Sequence, fEventsOutData.port) + fEventsOutData.offset);
aev->time.frames = 0;
aev->body.type = fURIDs.distrhoState;
aev->body.size = msgSize;
- std::memcpy(LV2_ATOM_BODY(&aev->body), msgBuf, msgSize-1);
+ std::memcpy(LV2_ATOM_BODY(&aev->body), msgBuf, msgSize);
fEventsOutData.growBy(lv2_atom_pad_size(sizeof(LV2_Atom_Event) + msgSize));
diff --git a/distrho/src/DistrhoUIDSSI.cpp b/distrho/src/DistrhoUIDSSI.cpp
@@ -194,7 +194,7 @@ protected:
uint8_t mdata[4] = {
0,
- channel + (velocity != 0 ? 0x90 : 0x80),
+ static_cast<uint8_t>(channel + (velocity != 0 ? 0x90 : 0x80)),
note,
velocity
};
diff --git a/examples/States/DistrhoPluginInfo.h b/examples/States/DistrhoPluginInfo.h
@@ -27,5 +27,6 @@
#define DISTRHO_PLUGIN_NUM_OUTPUTS 2
#define DISTRHO_PLUGIN_WANT_PROGRAMS 1
#define DISTRHO_PLUGIN_WANT_STATE 1
+#define DISTRHO_PLUGIN_WANT_FULL_STATE 1
#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED