commit 0bff606f51cdb07b00456e996ac95047b47e9f02
parent dcb7c09f68dc56460e88bad0eceea3d8c5e89117
Author: falkTX <falktx@gmail.com>
Date: Fri, 25 Apr 2014 21:21:29 +0100
Fixing
Diffstat:
14 files changed, 54 insertions(+), 57 deletions(-)
diff --git a/dgl/App.hpp b/dgl/App.hpp
@@ -56,7 +56,7 @@ private:
void _oneShown();
void _oneHidden();
- DISTRHO_LEAK_DETECTOR(App)
+ DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(App)
};
// -----------------------------------------------------------------------
diff --git a/dgl/CairoWidget.hpp b/dgl/CairoWidget.hpp
@@ -198,7 +198,7 @@ private:
cairo_surface_t* fSurface;
GLuint fTextureId;
- DISTRHO_LEAK_DETECTOR(CairoWidget)
+ DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CairoWidget)
};
// -----------------------------------------------------------------------
diff --git a/dgl/ImageAboutWindow.hpp b/dgl/ImageAboutWindow.hpp
@@ -48,7 +48,7 @@ protected:
private:
Image fImgBackground;
- DISTRHO_LEAK_DETECTOR(ImageAboutWindow)
+ DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ImageAboutWindow)
};
// -----------------------------------------------------------------------
diff --git a/dgl/Makefile b/dgl/Makefile
@@ -16,7 +16,6 @@ LINK_FLAGS += $(DGL_LIBS)
OBJS = \
src/App.cpp.o \
- src/Base.cpp.o \
src/Image.cpp.o \
src/ImageAboutWindow.cpp.o \
src/ImageButton.cpp.o \
diff --git a/dgl/StandaloneWindow.hpp b/dgl/StandaloneWindow.hpp
@@ -71,7 +71,7 @@ protected:
App fApp;
Window fWindow;
- DISTRHO_LEAK_DETECTOR(StandaloneWindow)
+ DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(StandaloneWindow)
};
// -----------------------------------------------------------------------
diff --git a/dgl/Widget.hpp b/dgl/Widget.hpp
@@ -98,7 +98,7 @@ private:
friend class CairoWidget;
friend class Window;
- DISTRHO_LEAK_DETECTOR(Widget)
+ DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Widget)
};
// -----------------------------------------------------------------------
diff --git a/dgl/Window.hpp b/dgl/Window.hpp
@@ -78,7 +78,7 @@ private:
void _removeWidget(Widget* const widget);
void _idle();
- DISTRHO_LEAK_DETECTOR(Window)
+ DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Window)
};
// -----------------------------------------------------------------------
diff --git a/dgl/src/App.cpp b/dgl/src/App.cpp
@@ -68,7 +68,7 @@ void App::exec()
while (pData->doLoop)
{
idle();
- msleep(10);
+ d_msleep(10);
}
}
diff --git a/dgl/src/Window.cpp b/dgl/src/Window.cpp
@@ -27,16 +27,16 @@
#include "pugl/pugl.h"
-#if defined(DGL_OS_WINDOWS)
+#if defined(DISTRHO_OS_WINDOWS)
# include "pugl/pugl_win.cpp"
-#elif defined(DGL_OS_MAC)
+#elif defined(DISTRHO_OS_MAC)
# include "pugl/pugl_osx_extended.h"
extern "C" {
struct PuglViewImpl {
int width;
int height;
};}
-#elif defined(DGL_OS_LINUX)
+#elif defined(DISTRHO_OS_LINUX)
# include <sys/types.h>
# include <unistd.h>
extern "C" {
@@ -80,12 +80,12 @@ public:
fVisible(false),
fResizable(true),
fUsingEmbed(false),
-#if defined(DGL_OS_WINDOWS)
+#if defined(DISTRHO_OS_WINDOWS)
hwnd(0)
-#elif defined(DGL_OS_LINUX)
+#elif defined(DISTRHO_OS_LINUX)
xDisplay(nullptr),
xWindow(0)
-#elif defined(DGL_OS_MAC)
+#elif defined(DISTRHO_OS_MAC)
fNeedsIdle(true)
#else
_dummy('\0')
@@ -104,12 +104,12 @@ public:
fResizable(true),
fUsingEmbed(false),
fModal(parent.pData),
-#if defined(DGL_OS_WINDOWS)
+#if defined(DISTRHO_OS_WINDOWS)
hwnd(0)
-#elif defined(DGL_OS_LINUX)
+#elif defined(DISTRHO_OS_LINUX)
xDisplay(nullptr),
xWindow(0)
-#elif defined(DGL_OS_MAC)
+#elif defined(DISTRHO_OS_MAC)
fNeedsIdle(false)
#else
_dummy('\0')
@@ -118,7 +118,7 @@ public:
DBG("Creating window with parent..."); DBGF;
init();
-#ifdef DGL_OS_LINUX
+#ifdef DISTRHO_OS_LINUX
const PuglInternals* const parentImpl(parent.pData->fView->impl);
XSetTransientForHint(xDisplay, xWindow, parentImpl->win);
@@ -133,12 +133,12 @@ public:
fVisible(parentId != 0),
fResizable(parentId == 0),
fUsingEmbed(parentId != 0),
-#if defined(DGL_OS_WINDOWS)
+#if defined(DISTRHO_OS_WINDOWS)
hwnd(0)
-#elif defined(DGL_OS_LINUX)
+#elif defined(DISTRHO_OS_LINUX)
xDisplay(nullptr),
xWindow(0)
-#elif defined(DGL_OS_MAC)
+#elif defined(DISTRHO_OS_MAC)
fNeedsIdle(false)
#else
_dummy('\0')
@@ -181,11 +181,11 @@ public:
puglSetReshapeFunc(fView, onReshapeCallback);
puglSetCloseFunc(fView, onCloseCallback);
-#if defined(DGL_OS_WINDOWS)
+#if defined(DISTRHO_OS_WINDOWS)
PuglInternals* impl = fView->impl;
hwnd = impl->hwnd;
assert(hwnd != 0);
-#elif defined(DGL_OS_LINUX)
+#elif defined(DISTRHO_OS_LINUX)
PuglInternals* impl = fView->impl;
xDisplay = impl->display;
xWindow = impl->win;
@@ -228,9 +228,9 @@ public:
fView = nullptr;
}
-#if defined(DGL_OS_WINDOWS)
+#if defined(DISTRHO_OS_WINDOWS)
hwnd = 0;
-#elif defined(DGL_OS_LINUX)
+#elif defined(DISTRHO_OS_LINUX)
xDisplay = nullptr;
xWindow = 0;
#endif
@@ -262,7 +262,7 @@ public:
for (; fVisible && fModal.enabled;)
{
idle();
- msleep(10);
+ d_msleep(10);
}
exec_fini();
@@ -278,13 +278,13 @@ public:
void focus()
{
DBG("Window focus\n");
-#if defined(DGL_OS_WINDOWS)
+#if defined(DISTRHO_OS_WINDOWS)
SetForegroundWindow(hwnd);
SetActiveWindow(hwnd);
SetFocus(hwnd);
-#elif defined(DGL_OS_MAC)
+#elif defined(DISTRHO_OS_MAC)
puglImplFocus(fView);
-#elif defined(DGL_OS_LINUX)
+#elif defined(DISTRHO_OS_LINUX)
XRaiseWindow(xDisplay, xWindow);
XSetInputFocus(xDisplay, xWindow, RevertToPointerRoot, CurrentTime);
XFlush(xDisplay);
@@ -324,16 +324,16 @@ public:
if (yesNo && fFirstInit)
setSize(static_cast<unsigned int>(fView->width), static_cast<unsigned int>(fView->height), true);
-#if defined(DGL_OS_WINDOWS)
+#if defined(DISTRHO_OS_WINDOWS)
if (yesNo)
ShowWindow(hwnd, fFirstInit ? SW_SHOWNORMAL : SW_RESTORE);
else
ShowWindow(hwnd, SW_HIDE);
UpdateWindow(hwnd);
-#elif defined(DGL_OS_MAC)
+#elif defined(DISTRHO_OS_MAC)
puglImplSetVisible(fView, yesNo);
-#elif defined(DGL_OS_LINUX)
+#elif defined(DISTRHO_OS_LINUX)
if (yesNo)
XMapRaised(xDisplay, xWindow);
else
@@ -417,7 +417,7 @@ public:
DBGp("Window setSize called %s, size %i %i\n", forced ? "(forced)" : "(not forced)", width, height);
-#if defined(DGL_OS_WINDOWS)
+#if defined(DISTRHO_OS_WINDOWS)
int winFlags = WS_POPUPWINDOW | WS_CAPTION;
if (fResizable)
@@ -430,9 +430,9 @@ public:
if (! forced)
UpdateWindow(hwnd);
-#elif defined(DGL_OS_MAC)
+#elif defined(DISTRHO_OS_MAC)
puglImplSetSize(fView, width, height, forced);
-#elif defined(DGL_OS_LINUX)
+#elif defined(DISTRHO_OS_LINUX)
XResizeWindow(xDisplay, xWindow, width, height);
if (! fResizable)
@@ -464,18 +464,18 @@ public:
{
DBGp("Window setTitle \"%s\"\n", title);
-#if defined(DGL_OS_WINDOWS)
+#if defined(DISTRHO_OS_WINDOWS)
SetWindowTextA(hwnd, title);
-#elif defined(DGL_OS_MAC)
+#elif defined(DISTRHO_OS_MAC)
puglImplSetTitle(fView, title);
-#elif defined(DGL_OS_LINUX)
+#elif defined(DISTRHO_OS_LINUX)
XStoreName(xDisplay, xWindow, title);
#endif
}
void setTransientWinId(const intptr_t winId)
{
-#if defined(DGL_OS_LINUX)
+#if defined(DISTRHO_OS_LINUX)
XSetTransientForHint(xDisplay, xWindow, static_cast< ::Window>(winId));
#else
return;
@@ -522,7 +522,7 @@ public:
{
puglProcessEvents(fView);
-#ifdef DGL_OS_MAC
+#ifdef DISTRHO_OS_MAC
if (fNeedsIdle)
puglImplIdle(fView);
#endif
@@ -547,7 +547,7 @@ public:
fModal.enabled = true;
fModal.parent->fModal.childFocus = this;
-#ifdef DGL_OS_WINDOWS
+#ifdef DISTRHO_OS_WINDOWS
// Center this window
PuglInternals* const parentImpl = fModal.parent->fView->impl;
@@ -744,12 +744,12 @@ private:
}
} fModal;
-#if defined(DGL_OS_WINDOWS)
+#if defined(DISTRHO_OS_WINDOWS)
HWND hwnd;
-#elif defined(DGL_OS_LINUX)
+#elif defined(DISTRHO_OS_LINUX)
Display* xDisplay;
::Window xWindow;
-#elif defined(DGL_OS_MAC)
+#elif defined(DISTRHO_OS_MAC)
bool fNeedsIdle;
#else
char _dummy;
diff --git a/distrho/DistrhoPlugin.hpp b/distrho/DistrhoPlugin.hpp
@@ -17,7 +17,7 @@
#ifndef DISTRHO_PLUGIN_HPP_INCLUDED
#define DISTRHO_PLUGIN_HPP_INCLUDED
-#include "DistrhoUtils.hpp"
+#include "extra/d_string.hpp"
#include "src/DistrhoPluginChecks.h"
#include <cmath>
diff --git a/distrho/DistrhoUI.hpp b/distrho/DistrhoUI.hpp
@@ -17,7 +17,7 @@
#ifndef DISTRHO_UI_HPP_INCLUDED
#define DISTRHO_UI_HPP_INCLUDED
-#include "DistrhoUtils.hpp"
+#include "extra/d_leakdetector.hpp"
#include "src/DistrhoPluginChecks.h"
#include "../dgl/Widget.hpp"
@@ -89,7 +89,7 @@ private:
PrivateData* const pData;
friend class UIExporter;
- DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Plugin)
+ DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(UI)
};
// -----------------------------------------------------------------------
diff --git a/distrho/DistrhoUtils.hpp b/distrho/DistrhoUtils.hpp
@@ -63,6 +63,9 @@ long d_cconst(const int a, const int b, const int c, const int d) noexcept
return (a << 24) | (b << 16) | (c << 8) | (d << 0);
}
+static inline
+void d_pass() noexcept {}
+
// -----------------------------------------------------------------------
// string print functions
@@ -164,10 +167,5 @@ void d_msleep(const uint msecs)
}
// -----------------------------------------------------------------------
-// we always need this class
-
-#include "extra/d_string.hpp"
-
-// -----------------------------------------------------------------------
#endif // DISTRHO_UTILS_HPP_INCLUDED
diff --git a/distrho/src/DistrhoDefines.h b/distrho/src/DistrhoDefines.h
@@ -67,10 +67,10 @@
#endif
/* Define DISTRHO_SAFE_ASSERT* */
-#define DISTRHO_SAFE_ASSERT(cond) if (cond) pass(); else d_safe_assert(#cond, __FILE__, __LINE__);
-#define DISTRHO_SAFE_ASSERT_BREAK(cond) if (cond) pass(); else { d_safe_assert(#cond, __FILE__, __LINE__); break; }
-#define DISTRHO_SAFE_ASSERT_CONTINUE(cond) if (cond) pass(); else { d_safe_assert(#cond, __FILE__, __LINE__); continue; }
-#define DISTRHO_SAFE_ASSERT_RETURN(cond, ret) if (cond) pass(); else { d_safe_assert(#cond, __FILE__, __LINE__); return ret; }
+#define DISTRHO_SAFE_ASSERT(cond) if (cond) d_pass(); else d_safe_assert(#cond, __FILE__, __LINE__);
+#define DISTRHO_SAFE_ASSERT_BREAK(cond) if (cond) d_pass(); else { d_safe_assert(#cond, __FILE__, __LINE__); break; }
+#define DISTRHO_SAFE_ASSERT_CONTINUE(cond) if (cond) d_pass(); else { d_safe_assert(#cond, __FILE__, __LINE__); continue; }
+#define DISTRHO_SAFE_ASSERT_RETURN(cond, ret) if (cond) d_pass(); else { d_safe_assert(#cond, __FILE__, __LINE__); return ret; }
/* Define DISTRHO_SAFE_EXCEPTION */
#define DISTRHO_SAFE_EXCEPTION(msg) catch(...) { d_safe_exception(msg, __FILE__, __LINE__); }
diff --git a/examples/nekobi-ui.cpp b/examples/nekobi-ui.cpp
@@ -45,7 +45,7 @@ int main()
{
gui.idle();
app.idle();
- msleep(10);
+ d_msleep(10);
}
return 0;