diff options
-rw-r--r-- | examples/pugl_window_demo.c | 5 | ||||
-rw-r--r-- | examples/rects.h | 2 | ||||
-rw-r--r-- | pugl/detail/x11.c | 13 |
3 files changed, 11 insertions, 9 deletions
diff --git a/examples/pugl_window_demo.c b/examples/pugl_window_demo.c index b406416..9343c9c 100644 --- a/examples/pugl_window_demo.c +++ b/examples/pugl_window_demo.c @@ -49,6 +49,8 @@ typedef struct { bool verbose; } PuglTestApp; +static const double pad = 64.0; + static void onDisplay(PuglView* view) { @@ -200,10 +202,9 @@ main(int argc, char** argv) puglSetClassName(app.world, "Pugl Test"); PuglStatus st = PUGL_SUCCESS; - for (size_t i = 0; i < 2; ++i) { + for (unsigned i = 0; i < 2; ++i) { CubeView* cube = &app.cubes[i]; PuglView* view = cube->view; - static const double pad = 64.0; const PuglRect frame = {pad + (128.0 + pad) * i, pad + (128.0 + pad) * i, 512.0, diff --git a/examples/rects.h b/examples/rects.h index 0a7e5fa..f760226 100644 --- a/examples/rects.h +++ b/examples/rects.h @@ -70,7 +70,7 @@ moveRect(Rect* const rect, const float frameHeight, const double time) { - const float normal = index / (float)numRects; + const float normal = (float)index / (float)numRects; const float offset[2] = {normal * 128.0f, normal * 128.0f}; rect->pos[0] = (frameWidth - rect->size[0] + offset[0]) * diff --git a/pugl/detail/x11.c b/pugl/detail/x11.c index 987f55f..da7b23d 100644 --- a/pugl/detail/x11.c +++ b/pugl/detail/x11.c @@ -534,7 +534,7 @@ translateEvent(PuglView* view, XEvent xevent) break; case MotionNotify: event.type = PUGL_MOTION; - event.motion.time = xevent.xmotion.time / 1e3; + event.motion.time = (double)xevent.xmotion.time / 1e3; event.motion.x = xevent.xmotion.x; event.motion.y = xevent.xmotion.y; event.motion.xRoot = xevent.xmotion.x_root; @@ -545,7 +545,7 @@ translateEvent(PuglView* view, XEvent xevent) case ButtonPress: if (xevent.xbutton.button >= 4 && xevent.xbutton.button <= 7) { event.type = PUGL_SCROLL; - event.scroll.time = xevent.xbutton.time / 1e3; + event.scroll.time = (double)xevent.xbutton.time / 1e3; event.scroll.x = xevent.xbutton.x; event.scroll.y = xevent.xbutton.y; event.scroll.xRoot = xevent.xbutton.x_root; @@ -567,7 +567,7 @@ translateEvent(PuglView* view, XEvent xevent) event.button.type = ((xevent.type == ButtonPress) ? PUGL_BUTTON_PRESS : PUGL_BUTTON_RELEASE); - event.button.time = xevent.xbutton.time / 1e3; + event.button.time = (double)xevent.xbutton.time / 1e3; event.button.x = xevent.xbutton.x; event.button.y = xevent.xbutton.y; event.button.xRoot = xevent.xbutton.x_root; @@ -581,7 +581,7 @@ translateEvent(PuglView* view, XEvent xevent) event.type = ((xevent.type == KeyPress) ? PUGL_KEY_PRESS : PUGL_KEY_RELEASE); - event.key.time = xevent.xkey.time / 1e3; + event.key.time = (double)xevent.xkey.time / 1e3; event.key.x = xevent.xkey.x; event.key.y = xevent.xkey.y; event.key.xRoot = xevent.xkey.x_root; @@ -594,7 +594,7 @@ translateEvent(PuglView* view, XEvent xevent) event.type = ((xevent.type == EnterNotify) ? PUGL_POINTER_IN : PUGL_POINTER_OUT); - event.crossing.time = xevent.xcrossing.time / 1e3; + event.crossing.time = (double)xevent.xcrossing.time / 1e3; event.crossing.x = xevent.xcrossing.x; event.crossing.y = xevent.xcrossing.y; event.crossing.xRoot = xevent.xcrossing.x_root; @@ -1063,7 +1063,8 @@ puglGetTime(const PuglWorld* world) { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - return ((double)ts.tv_sec + ts.tv_nsec / 1000000000.0) - world->startTime; + return ((double)ts.tv_sec + (double)ts.tv_nsec / 1000000000.0) - + world->startTime; } PuglStatus |