Browse Source

Fix build with strict flags

gh-pages
falkTX 11 years ago
parent
commit
2b52fd4c26
8 changed files with 55 additions and 55 deletions
  1. +1
    -1
      dgl/App.hpp
  2. +1
    -1
      dgl/Base.hpp
  3. +1
    -1
      dgl/src/Base.cpp
  4. +3
    -3
      dgl/src/ImageAboutWindow.cpp
  5. +2
    -2
      dgl/src/ImageKnob.cpp
  6. +2
    -2
      dgl/src/ImageSlider.cpp
  7. +37
    -37
      dgl/src/Window.cpp
  8. +8
    -8
      dgl/src/pugl/pugl_x11.c

+ 1
- 1
dgl/App.hpp View File

@@ -31,7 +31,7 @@ public:
class IdleCallback class IdleCallback
{ {
public: public:
~IdleCallback() {}
virtual ~IdleCallback() {}
virtual void idleCallback() = 0; virtual void idleCallback() = 0;
}; };




+ 1
- 1
dgl/Base.hpp View File

@@ -54,7 +54,7 @@
#define END_NAMESPACE_DGL } #define END_NAMESPACE_DGL }
#define USE_NAMESPACE_DGL using namespace DGL_NAMESPACE; #define USE_NAMESPACE_DGL using namespace DGL_NAMESPACE;


#if DGL_OS_MAC
#ifdef DGL_OS_MAC
# include <OpenGL/gl.h> # include <OpenGL/gl.h>
#else #else
# include <GL/gl.h> # include <GL/gl.h>


+ 1
- 1
dgl/src/Base.cpp View File

@@ -16,7 +16,7 @@


#include "../Base.hpp" #include "../Base.hpp"


#if DGL_OS_WINDOWS
#ifdef DGL_OS_WINDOWS
# include <windows.h> # include <windows.h>
#else #else
# include <unistd.h> # include <unistd.h>


+ 3
- 3
dgl/src/ImageAboutWindow.cpp View File

@@ -26,7 +26,7 @@ ImageAboutWindow::ImageAboutWindow(App& app, Window& parent, const Image& image)
fImgBackground(image) fImgBackground(image)
{ {
Window::setResizable(false); 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"); Window::setTitle("About");
} }


@@ -36,14 +36,14 @@ ImageAboutWindow::ImageAboutWindow(Widget* widget, const Image& image)
fImgBackground(image) fImgBackground(image)
{ {
Window::setResizable(false); 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"); Window::setTitle("About");
} }


void ImageAboutWindow::setImage(const Image& image) void ImageAboutWindow::setImage(const Image& image)
{ {
fImgBackground = 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() void ImageAboutWindow::onDisplay()


+ 2
- 2
dgl/src/ImageKnob.cpp View File

@@ -224,8 +224,8 @@ void ImageKnob::onDisplay()
const GLint w2 = getWidth()/2; const GLint w2 = getWidth()/2;
const GLint h2 = getHeight()/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); glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f); glTexCoord2f(0.0f, 0.0f);


+ 2
- 2
dgl/src/ImageSlider.cpp View File

@@ -163,11 +163,11 @@ void ImageSlider::onDisplay()
if (fStartPos.getX() == fEndPos.getX()) if (fStartPos.getX() == fEndPos.getX())
{ {
x = fStartPos.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()) 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(); y = fStartPos.getY();
} }
else else


+ 37
- 37
dgl/src/Window.cpp View File

@@ -24,16 +24,16 @@


#include "pugl/pugl.h" #include "pugl/pugl.h"


#if DGL_OS_WINDOWS
#if defined(DGL_OS_WINDOWS)
# include "pugl/pugl_win.cpp" # include "pugl/pugl_win.cpp"
#elif DGL_OS_MAC
#elif defined(DGL_OS_MAC)
# include "pugl/pugl_osx_extended.h" # include "pugl/pugl_osx_extended.h"
extern "C" { extern "C" {
struct PuglViewImpl { struct PuglViewImpl {
int width; int width;
int height; int height;
};} };}
#elif DGL_OS_LINUX
#elif defined(DGL_OS_LINUX)
extern "C" { extern "C" {
# include "pugl/pugl_x11.c" # include "pugl/pugl_x11.c"
} }
@@ -75,9 +75,9 @@ public:
fVisible(false), fVisible(false),
fResizable(true), fResizable(true),
fUsingEmbed(false), fUsingEmbed(false),
#if DGL_OS_WINDOWS
#if defined(DGL_OS_WINDOWS)
hwnd(0) hwnd(0)
#elif DGL_OS_LINUX
#elif defined(DGL_OS_LINUX)
xDisplay(nullptr), xDisplay(nullptr),
xWindow(0) xWindow(0)
#else #else
@@ -97,9 +97,9 @@ public:
fResizable(true), fResizable(true),
fUsingEmbed(false), fUsingEmbed(false),
fModal(parent.pData), fModal(parent.pData),
#if DGL_OS_WINDOWS
#if defined(DGL_OS_WINDOWS)
hwnd(0) hwnd(0)
#elif DGL_OS_LINUX
#elif defined(DGL_OS_LINUX)
xDisplay(nullptr), xDisplay(nullptr),
xWindow(0) xWindow(0)
#else #else
@@ -109,7 +109,7 @@ public:
DBG("Creating window with parent..."); DBGF; DBG("Creating window with parent..."); DBGF;
init(); init();


#if DGL_OS_LINUX
#ifdef DGL_OS_LINUX
const PuglInternals* const parentImpl(parent.pData->fView->impl); const PuglInternals* const parentImpl(parent.pData->fView->impl);


XSetTransientForHint(xDisplay, xWindow, parentImpl->win); XSetTransientForHint(xDisplay, xWindow, parentImpl->win);
@@ -124,9 +124,9 @@ public:
fVisible(parentId != 0), fVisible(parentId != 0),
fResizable(parentId == 0), fResizable(parentId == 0),
fUsingEmbed(parentId != 0), fUsingEmbed(parentId != 0),
#if DGL_OS_WINDOWS
#if defined(DGL_OS_WINDOWS)
hwnd(0) hwnd(0)
#elif DGL_OS_LINUX
#elif defined(DGL_OS_LINUX)
xDisplay(nullptr), xDisplay(nullptr),
xWindow(0) xWindow(0)
#else #else
@@ -170,11 +170,11 @@ public:
puglSetReshapeFunc(fView, onReshapeCallback); puglSetReshapeFunc(fView, onReshapeCallback);
puglSetCloseFunc(fView, onCloseCallback); puglSetCloseFunc(fView, onCloseCallback);


#if DGL_OS_WINDOWS
#if defined(DGL_OS_WINDOWS)
PuglInternals* impl = fView->impl; PuglInternals* impl = fView->impl;
hwnd = impl->hwnd; hwnd = impl->hwnd;
assert(hwnd != 0); assert(hwnd != 0);
#elif DGL_OS_LINUX
#elif defined(DGL_OS_LINUX)
PuglInternals* impl = fView->impl; PuglInternals* impl = fView->impl;
xDisplay = impl->display; xDisplay = impl->display;
xWindow = impl->win; xWindow = impl->win;
@@ -208,9 +208,9 @@ public:
fView = nullptr; fView = nullptr;
} }


#if DGL_OS_WINDOWS
#if defined(DGL_OS_WINDOWS)
hwnd = 0; hwnd = 0;
#elif DGL_OS_LINUX
#elif defined(DGL_OS_LINUX)
xDisplay = nullptr; xDisplay = nullptr;
xWindow = 0; xWindow = 0;
#endif #endif
@@ -263,13 +263,13 @@ public:
void focus() void focus()
{ {
DBG("Window focus\n"); DBG("Window focus\n");
#if DGL_OS_WINDOWS
#if defined(DGL_OS_WINDOWS)
SetForegroundWindow(hwnd); SetForegroundWindow(hwnd);
SetActiveWindow(hwnd); SetActiveWindow(hwnd);
SetFocus(hwnd); SetFocus(hwnd);
#elif DGL_OS_MAC
#elif defined(DGL_OS_MAC)
puglImplFocus(fView); puglImplFocus(fView);
#elif DGL_OS_LINUX
#elif defined(DGL_OS_LINUX)
XRaiseWindow(xDisplay, xWindow); XRaiseWindow(xDisplay, xWindow);
XSetInputFocus(xDisplay, xWindow, RevertToPointerRoot, CurrentTime); XSetInputFocus(xDisplay, xWindow, RevertToPointerRoot, CurrentTime);
XFlush(xDisplay); XFlush(xDisplay);
@@ -307,18 +307,18 @@ public:
fVisible = yesNo; fVisible = yesNo;


if (yesNo && fFirstInit) 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) if (yesNo)
ShowWindow(hwnd, fFirstInit ? SW_SHOWNORMAL : SW_RESTORE); ShowWindow(hwnd, fFirstInit ? SW_SHOWNORMAL : SW_RESTORE);
else else
ShowWindow(hwnd, SW_HIDE); ShowWindow(hwnd, SW_HIDE);


UpdateWindow(hwnd); UpdateWindow(hwnd);
#elif DGL_OS_MAC
#elif defined(DGL_OS_MAC)
puglImplSetVisible(fView, yesNo); puglImplSetVisible(fView, yesNo);
#elif DGL_OS_LINUX
#elif defined(DGL_OS_LINUX)
if (yesNo) if (yesNo)
XMapRaised(xDisplay, xWindow); XMapRaised(xDisplay, xWindow);
else else
@@ -363,7 +363,7 @@ public:


fResizable = yesNo; 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; 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)"); 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; int winFlags = WS_POPUPWINDOW | WS_CAPTION;


if (fResizable) if (fResizable)
@@ -415,9 +415,9 @@ public:


if (! forced) if (! forced)
UpdateWindow(hwnd); UpdateWindow(hwnd);
#elif DGL_OS_MAC
#elif defined(DGL_OS_MAC)
puglImplSetSize(fView, width, height, forced); puglImplSetSize(fView, width, height, forced);
#elif DGL_OS_LINUX
#elif defined(DGL_OS_LINUX)
XResizeWindow(xDisplay, xWindow, width, height); XResizeWindow(xDisplay, xWindow, width, height);


if (! fResizable) if (! fResizable)
@@ -426,10 +426,10 @@ public:
memset(&sizeHints, 0, sizeof(sizeHints)); memset(&sizeHints, 0, sizeof(sizeHints));


sizeHints.flags = PMinSize|PMaxSize; 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); XSetNormalHints(xDisplay, xWindow, &sizeHints);
} }
@@ -447,11 +447,11 @@ public:
{ {
DBGp("Window setTitle \"%s\"\n", title); DBGp("Window setTitle \"%s\"\n", title);


#if DGL_OS_WINDOWS
#if defined(DGL_OS_WINDOWS)
SetWindowTextA(hwnd, title); SetWindowTextA(hwnd, title);
#elif DGL_OS_MAC
#elif defined(DGL_OS_MAC)
puglImplSetTitle(fView, title); puglImplSetTitle(fView, title);
#elif DGL_OS_LINUX
#elif defined(DGL_OS_LINUX)
XStoreName(xDisplay, xWindow, title); XStoreName(xDisplay, xWindow, title);
#endif #endif
} }
@@ -512,7 +512,7 @@ public:
fModal.enabled = true; fModal.enabled = true;
fModal.parent->fModal.childFocus = this; fModal.parent->fModal.childFocus = this;


#if DGL_OS_WINDOWS
#ifdef DGL_OS_WINDOWS
// Center this window // Center this window
PuglInternals* const parentImpl = fModal.parent->fView->impl; PuglInternals* const parentImpl = fModal.parent->fView->impl;


@@ -708,9 +708,9 @@ private:
} }
} fModal; } fModal;


#if DGL_OS_WINDOWS
#if defined(DGL_OS_WINDOWS)
HWND hwnd; HWND hwnd;
#elif DGL_OS_LINUX
#elif defined(DGL_OS_LINUX)
Display* xDisplay; Display* xDisplay;
::Window xWindow; ::Window xWindow;
#else #else


+ 8
- 8
dgl/src/pugl/pugl_x11.c View File

@@ -123,7 +123,7 @@ puglCreate(PuglNativeWindow parent,


impl->win = XCreateWindow( impl->win = XCreateWindow(
impl->display, xParent, 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); CWBorderPixel | CWColormap | CWEventMask, &attr);


XSizeHints sizeHints; XSizeHints sizeHints;
@@ -175,7 +175,7 @@ puglDestroy(PuglView* view)
free(view); free(view);
} }


void
static void
puglReshape(PuglView* view, int width, int height) puglReshape(PuglView* view, int width, int height)
{ {
glXMakeCurrent(view->impl->display, view->impl->win, view->impl->ctx); glXMakeCurrent(view->impl->display, view->impl->win, view->impl->ctx);
@@ -190,7 +190,7 @@ puglReshape(PuglView* view, int width, int height)
view->height = height; view->height = height;
} }


void
static void
puglDisplay(PuglView* view) puglDisplay(PuglView* view)
{ {
glXMakeCurrent(view->impl->display, view->impl->win, view->impl->ctx); glXMakeCurrent(view->impl->display, view->impl->win, view->impl->ctx);
@@ -247,9 +247,9 @@ keySymToSpecial(KeySym sym)
} }


static void 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 = 0;
view->mods |= (xstate & ShiftMask) ? PUGL_MOD_SHIFT : 0; view->mods |= (xstate & ShiftMask) ? PUGL_MOD_SHIFT : 0;
@@ -275,7 +275,7 @@ dispatchKey(PuglView* view, XEvent* event, bool press)
if (special && view->specialFunc) { if (special && view->specialFunc) {
view->specialFunc(view, press, special); view->specialFunc(view, press, special);
} else if (!special && view->keyboardFunc) { } 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 && if (view->mouseFunc &&
(event.xbutton.button < 4 || event.xbutton.button > 7)) { (event.xbutton.button < 4 || event.xbutton.button > 7)) {
view->mouseFunc(view, view->mouseFunc(view,
event.xbutton.button, event.type == ButtonPress,
(int)event.xbutton.button, event.type == ButtonPress,
event.xbutton.x, event.xbutton.y); event.xbutton.x, event.xbutton.y);
} }
break; break;
@@ -393,5 +393,5 @@ puglPostRedisplay(PuglView* view)
PuglNativeWindow PuglNativeWindow
puglGetNativeWindow(PuglView* view) puglGetNativeWindow(PuglView* view)
{ {
return view->impl->win;
return (PuglNativeWindow)view->impl->win;
} }

Loading…
Cancel
Save