diff options
author | David Robillard <d@drobilla.net> | 2021-04-28 14:34:00 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-05-03 14:22:29 -0400 |
commit | 66e589325d13e4efc195a80125805df4b0996a97 (patch) | |
tree | 1dc3bc1f85f93061017bf1a5acf3d7d40038275d /src/x11.c | |
parent | d5d4dce2ef46b239c3eae3030c85e79897dbf9c2 (diff) | |
download | pugl-66e589325d13e4efc195a80125805df4b0996a97.tar.gz pugl-66e589325d13e4efc195a80125805df4b0996a97.tar.bz2 pugl-66e589325d13e4efc195a80125805df4b0996a97.zip |
Fix questionable event casts
I don't think there is any UB actually happening here, but some of these were
casting to a pointer of a larger type, which is problematic. Unfortunately, it
makes for quite a bit of tedious verbosity, but I don't see a decent way around
that in C99.
Diffstat (limited to 'src/x11.c')
-rw-r--r-- | src/x11.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -1043,8 +1043,7 @@ handleTimerEvent(PuglWorld* world, XEvent xevent) if (world->impl->timers[i].alarm == notify->alarm) { PuglEvent event = {{PUGL_TIMER, 0}}; event.timer.id = world->impl->timers[i].id; - puglDispatchEvent(world->impl->timers[i].view, - (const PuglEvent*)&event); + puglDispatchEvent(world->impl->timers[i].view, &event); } } @@ -1129,7 +1128,10 @@ puglDispatchX11Events(PuglWorld* world) (double)attrs.width, (double)attrs.height}; - puglDispatchEvent(view, (const PuglEvent*)&configure); + PuglEvent configureEvent; + configureEvent.configure = configure; + + puglDispatchEvent(view, &configureEvent); puglDispatchEvent(view, &event); } else { // Dispatch event to application immediately @@ -1206,7 +1208,9 @@ puglPostRedisplayRect(PuglView* view, PuglRect rect) mergeExposeEvents(&view->impl->pendingExpose.expose, &event); } else if (view->visible) { // Not dispatching events, send an X expose so we wake up next time - return puglSendEvent(view, (const PuglEvent*)&event); + PuglEvent exposeEvent = {{PUGL_EXPOSE, 0}}; + exposeEvent.expose = event; + return puglSendEvent(view, &exposeEvent); } return PUGL_SUCCESS; |