commit 2b52fd4c265fbe6b5b83edf6eae53ffe39753e8e
parent 54d7cfef14f41883e81fa463ee201956e0146199
Author: falkTX <falktx@gmail.com>
Date: Sat, 8 Feb 2014 20:20:25 +0000
Fix build with strict flags
Diffstat:
8 files changed, 55 insertions(+), 55 deletions(-)
diff --git a/dgl/App.hpp b/dgl/App.hpp
@@ -31,7 +31,7 @@ public:
class IdleCallback
{
public:
- ~IdleCallback() {}
+ virtual ~IdleCallback() {}
virtual void idleCallback() = 0;
};
diff --git a/dgl/Base.hpp b/dgl/Base.hpp
@@ -54,7 +54,7 @@
#define END_NAMESPACE_DGL }
#define USE_NAMESPACE_DGL using namespace DGL_NAMESPACE;
-#if DGL_OS_MAC
+#ifdef DGL_OS_MAC
# include <OpenGL/gl.h>
#else
# include <GL/gl.h>
diff --git a/dgl/src/Base.cpp b/dgl/src/Base.cpp
@@ -16,7 +16,7 @@
#include "../Base.hpp"
-#if DGL_OS_WINDOWS
+#ifdef DGL_OS_WINDOWS
# include <windows.h>
#else
# include <unistd.h>
diff --git a/dgl/src/ImageAboutWindow.cpp b/dgl/src/ImageAboutWindow.cpp
@@ -26,7 +26,7 @@ ImageAboutWindow::ImageAboutWindow(App& app, Window& parent, const Image& image)
fImgBackground(image)
{
Window::setResizable(false);
- Window::setSize(image.getWidth(), image.getHeight());
+ Window::setSize(static_cast<unsigned int>(image.getWidth()), static_cast<unsigned int>(image.getHeight()));
Window::setTitle("About");
}
@@ -36,14 +36,14 @@ ImageAboutWindow::ImageAboutWindow(Widget* widget, const Image& image)
fImgBackground(image)
{
Window::setResizable(false);
- Window::setSize(image.getWidth(), image.getHeight());
+ Window::setSize(static_cast<unsigned int>(image.getWidth()), static_cast<unsigned int>(image.getHeight()));
Window::setTitle("About");
}
void ImageAboutWindow::setImage(const Image& image)
{
fImgBackground = image;
- Window::setSize(image.getWidth(), image.getHeight());
+ Window::setSize(static_cast<unsigned int>(image.getWidth()), static_cast<unsigned int>(image.getHeight()));
}
void ImageAboutWindow::onDisplay()
diff --git a/dgl/src/ImageKnob.cpp b/dgl/src/ImageKnob.cpp
@@ -224,8 +224,8 @@ void ImageKnob::onDisplay()
const GLint w2 = getWidth()/2;
const GLint h2 = getHeight()/2;
- glTranslatef(getX()+w2, getY()+h2, 0.0f);
- glRotatef(normValue*fRotationAngle, 0.0f, 0.0f, 1.0f);
+ glTranslatef(static_cast<float>(getX()+w2), static_cast<float>(getY()+h2), 0.0f);
+ glRotatef(normValue*static_cast<float>(fRotationAngle), 0.0f, 0.0f, 1.0f);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);
diff --git a/dgl/src/ImageSlider.cpp b/dgl/src/ImageSlider.cpp
@@ -163,11 +163,11 @@ void ImageSlider::onDisplay()
if (fStartPos.getX() == fEndPos.getX())
{
x = fStartPos.getX();
- y = fEndPos.getY() - normValue*(fEndPos.getY()-fStartPos.getY());
+ y = fEndPos.getY() - static_cast<int>(normValue*static_cast<float>(fEndPos.getY()-fStartPos.getY()));
}
else if (fStartPos.getY() == fEndPos.getY())
{
- x = fEndPos.getX() - normValue*(fEndPos.getX()-fStartPos.getX());
+ x = fEndPos.getX() - static_cast<int>(normValue*static_cast<float>(fEndPos.getX()-fStartPos.getX()));
y = fStartPos.getY();
}
else
diff --git a/dgl/src/Window.cpp b/dgl/src/Window.cpp
@@ -24,16 +24,16 @@
#include "pugl/pugl.h"
-#if DGL_OS_WINDOWS
+#if defined(DGL_OS_WINDOWS)
# include "pugl/pugl_win.cpp"
-#elif DGL_OS_MAC
+#elif defined(DGL_OS_MAC)
# include "pugl/pugl_osx_extended.h"
extern "C" {
struct PuglViewImpl {
int width;
int height;
};}
-#elif DGL_OS_LINUX
+#elif defined(DGL_OS_LINUX)
extern "C" {
# include "pugl/pugl_x11.c"
}
@@ -75,9 +75,9 @@ public:
fVisible(false),
fResizable(true),
fUsingEmbed(false),
-#if DGL_OS_WINDOWS
+#if defined(DGL_OS_WINDOWS)
hwnd(0)
-#elif DGL_OS_LINUX
+#elif defined(DGL_OS_LINUX)
xDisplay(nullptr),
xWindow(0)
#else
@@ -97,9 +97,9 @@ public:
fResizable(true),
fUsingEmbed(false),
fModal(parent.pData),
-#if DGL_OS_WINDOWS
+#if defined(DGL_OS_WINDOWS)
hwnd(0)
-#elif DGL_OS_LINUX
+#elif defined(DGL_OS_LINUX)
xDisplay(nullptr),
xWindow(0)
#else
@@ -109,7 +109,7 @@ public:
DBG("Creating window with parent..."); DBGF;
init();
-#if DGL_OS_LINUX
+#ifdef DGL_OS_LINUX
const PuglInternals* const parentImpl(parent.pData->fView->impl);
XSetTransientForHint(xDisplay, xWindow, parentImpl->win);
@@ -124,9 +124,9 @@ public:
fVisible(parentId != 0),
fResizable(parentId == 0),
fUsingEmbed(parentId != 0),
-#if DGL_OS_WINDOWS
+#if defined(DGL_OS_WINDOWS)
hwnd(0)
-#elif DGL_OS_LINUX
+#elif defined(DGL_OS_LINUX)
xDisplay(nullptr),
xWindow(0)
#else
@@ -170,11 +170,11 @@ public:
puglSetReshapeFunc(fView, onReshapeCallback);
puglSetCloseFunc(fView, onCloseCallback);
-#if DGL_OS_WINDOWS
+#if defined(DGL_OS_WINDOWS)
PuglInternals* impl = fView->impl;
hwnd = impl->hwnd;
assert(hwnd != 0);
-#elif DGL_OS_LINUX
+#elif defined(DGL_OS_LINUX)
PuglInternals* impl = fView->impl;
xDisplay = impl->display;
xWindow = impl->win;
@@ -208,9 +208,9 @@ public:
fView = nullptr;
}
-#if DGL_OS_WINDOWS
+#if defined(DGL_OS_WINDOWS)
hwnd = 0;
-#elif DGL_OS_LINUX
+#elif defined(DGL_OS_LINUX)
xDisplay = nullptr;
xWindow = 0;
#endif
@@ -263,13 +263,13 @@ public:
void focus()
{
DBG("Window focus\n");
-#if DGL_OS_WINDOWS
+#if defined(DGL_OS_WINDOWS)
SetForegroundWindow(hwnd);
SetActiveWindow(hwnd);
SetFocus(hwnd);
-#elif DGL_OS_MAC
+#elif defined(DGL_OS_MAC)
puglImplFocus(fView);
-#elif DGL_OS_LINUX
+#elif defined(DGL_OS_LINUX)
XRaiseWindow(xDisplay, xWindow);
XSetInputFocus(xDisplay, xWindow, RevertToPointerRoot, CurrentTime);
XFlush(xDisplay);
@@ -307,18 +307,18 @@ public:
fVisible = yesNo;
if (yesNo && fFirstInit)
- setSize(fView->width, fView->height, true);
+ setSize(static_cast<unsigned int>(fView->width), static_cast<unsigned int>(fView->height), true);
-#if DGL_OS_WINDOWS
+#if defined(DGL_OS_WINDOWS)
if (yesNo)
ShowWindow(hwnd, fFirstInit ? SW_SHOWNORMAL : SW_RESTORE);
else
ShowWindow(hwnd, SW_HIDE);
UpdateWindow(hwnd);
-#elif DGL_OS_MAC
+#elif defined(DGL_OS_MAC)
puglImplSetVisible(fView, yesNo);
-#elif DGL_OS_LINUX
+#elif defined(DGL_OS_LINUX)
if (yesNo)
XMapRaised(xDisplay, xWindow);
else
@@ -363,7 +363,7 @@ public:
fResizable = yesNo;
- setSize(fView->width, fView->height, true);
+ setSize(static_cast<unsigned int>(fView->width), static_cast<unsigned int>(fView->height), true);
}
// -------------------------------------------------------------------
@@ -397,12 +397,12 @@ public:
return;
}
- fView->width = width;
- fView->height = height;
+ fView->width = static_cast<int>(width);
+ fView->height = static_cast<int>(height);
DBGp("Window setSize called %s\n", forced ? "(forced)" : "(not forced)");
-#if DGL_OS_WINDOWS
+#if defined(DGL_OS_WINDOWS)
int winFlags = WS_POPUPWINDOW | WS_CAPTION;
if (fResizable)
@@ -415,9 +415,9 @@ public:
if (! forced)
UpdateWindow(hwnd);
-#elif DGL_OS_MAC
+#elif defined(DGL_OS_MAC)
puglImplSetSize(fView, width, height, forced);
-#elif DGL_OS_LINUX
+#elif defined(DGL_OS_LINUX)
XResizeWindow(xDisplay, xWindow, width, height);
if (! fResizable)
@@ -426,10 +426,10 @@ public:
memset(&sizeHints, 0, sizeof(sizeHints));
sizeHints.flags = PMinSize|PMaxSize;
- sizeHints.min_width = width;
- sizeHints.min_height = height;
- sizeHints.max_width = width;
- sizeHints.max_height = height;
+ sizeHints.min_width = static_cast<int>(width);
+ sizeHints.min_height = static_cast<int>(height);
+ sizeHints.max_width = static_cast<int>(width);
+ sizeHints.max_height = static_cast<int>(height);
XSetNormalHints(xDisplay, xWindow, &sizeHints);
}
@@ -447,11 +447,11 @@ public:
{
DBGp("Window setTitle \"%s\"\n", title);
-#if DGL_OS_WINDOWS
+#if defined(DGL_OS_WINDOWS)
SetWindowTextA(hwnd, title);
-#elif DGL_OS_MAC
+#elif defined(DGL_OS_MAC)
puglImplSetTitle(fView, title);
-#elif DGL_OS_LINUX
+#elif defined(DGL_OS_LINUX)
XStoreName(xDisplay, xWindow, title);
#endif
}
@@ -512,7 +512,7 @@ public:
fModal.enabled = true;
fModal.parent->fModal.childFocus = this;
-#if DGL_OS_WINDOWS
+#ifdef DGL_OS_WINDOWS
// Center this window
PuglInternals* const parentImpl = fModal.parent->fView->impl;
@@ -708,9 +708,9 @@ private:
}
} fModal;
-#if DGL_OS_WINDOWS
+#if defined(DGL_OS_WINDOWS)
HWND hwnd;
-#elif DGL_OS_LINUX
+#elif defined(DGL_OS_LINUX)
Display* xDisplay;
::Window xWindow;
#else
diff --git a/dgl/src/pugl/pugl_x11.c b/dgl/src/pugl/pugl_x11.c
@@ -123,7 +123,7 @@ puglCreate(PuglNativeWindow parent,
impl->win = XCreateWindow(
impl->display, xParent,
- 0, 0, view->width, view->height, 0, vi->depth, InputOutput, vi->visual,
+ 0, 0, (unsigned int)view->width, (unsigned int)view->height, 0, vi->depth, InputOutput, vi->visual,
CWBorderPixel | CWColormap | CWEventMask, &attr);
XSizeHints sizeHints;
@@ -175,7 +175,7 @@ puglDestroy(PuglView* view)
free(view);
}
-void
+static void
puglReshape(PuglView* view, int width, int height)
{
glXMakeCurrent(view->impl->display, view->impl->win, view->impl->ctx);
@@ -190,7 +190,7 @@ puglReshape(PuglView* view, int width, int height)
view->height = height;
}
-void
+static void
puglDisplay(PuglView* view)
{
glXMakeCurrent(view->impl->display, view->impl->win, view->impl->ctx);
@@ -247,9 +247,9 @@ keySymToSpecial(KeySym sym)
}
static void
-setModifiers(PuglView* view, unsigned xstate, unsigned xtime)
+setModifiers(PuglView* view, unsigned xstate, unsigned long xtime)
{
- view->event_timestamp_ms = xtime;
+ view->event_timestamp_ms = (uint32_t)xtime;
view->mods = 0;
view->mods |= (xstate & ShiftMask) ? PUGL_MOD_SHIFT : 0;
@@ -275,7 +275,7 @@ dispatchKey(PuglView* view, XEvent* event, bool press)
if (special && view->specialFunc) {
view->specialFunc(view, press, special);
} else if (!special && view->keyboardFunc) {
- view->keyboardFunc(view, press, str[0]);
+ view->keyboardFunc(view, press, (uint32_t)str[0]);
}
}
@@ -332,7 +332,7 @@ puglProcessEvents(PuglView* view)
if (view->mouseFunc &&
(event.xbutton.button < 4 || event.xbutton.button > 7)) {
view->mouseFunc(view,
- event.xbutton.button, event.type == ButtonPress,
+ (int)event.xbutton.button, event.type == ButtonPress,
event.xbutton.x, event.xbutton.y);
}
break;
@@ -393,5 +393,5 @@ puglPostRedisplay(PuglView* view)
PuglNativeWindow
puglGetNativeWindow(PuglView* view)
{
- return view->impl->win;
+ return (PuglNativeWindow)view->impl->win;
}