diff options
author | David Robillard <d@drobilla.net> | 2021-05-25 12:07:17 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-05-25 12:12:59 -0400 |
commit | e6183b3dbe6b83d642cad1dfb296083ce8c53360 (patch) | |
tree | 60ec2f11586489bcd81364654d6964d399484596 /src | |
parent | 040e94b26395451b78f5cbe0b7f208afcf28af1b (diff) | |
download | pugl-e6183b3dbe6b83d642cad1dfb296083ce8c53360.tar.gz pugl-e6183b3dbe6b83d642cad1dfb296083ce8c53360.tar.bz2 pugl-e6183b3dbe6b83d642cad1dfb296083ce8c53360.zip |
Rename event structs in a more readable style
Aside from reading more naturally, this avoids clashes with types that are not
events, like PuglEventFlags. This is also more consistent with the C++
bindings, where "EventExpose" would be quite strange, for example.
Apologies for the noise. Aliases to the old names will be preserved in the
deprecated API like other things for a short while.
Diffstat (limited to 'src')
-rw-r--r-- | src/implementation.c | 4 | ||||
-rw-r--r-- | src/mac.m | 28 | ||||
-rw-r--r-- | src/mac_cairo.m | 4 | ||||
-rw-r--r-- | src/mac_gl.m | 4 | ||||
-rw-r--r-- | src/stub.h | 4 | ||||
-rw-r--r-- | src/types.h | 6 | ||||
-rw-r--r-- | src/win.c | 8 | ||||
-rw-r--r-- | src/win.h | 4 | ||||
-rw-r--r-- | src/win_cairo.c | 4 | ||||
-rw-r--r-- | src/win_gl.c | 4 | ||||
-rw-r--r-- | src/win_stub.c | 4 | ||||
-rw-r--r-- | src/x11.c | 4 | ||||
-rw-r--r-- | src/x11_cairo.c | 4 | ||||
-rw-r--r-- | src/x11_gl.c | 4 |
14 files changed, 43 insertions, 43 deletions
diff --git a/src/implementation.c b/src/implementation.c index d7763a7..5ef3ce9 100644 --- a/src/implementation.c +++ b/src/implementation.c @@ -356,9 +356,9 @@ puglDecodeUTF8(const uint8_t* buf) } static inline bool -puglMustConfigure(PuglView* view, const PuglEventConfigure* configure) +puglMustConfigure(PuglView* view, const PuglConfigureEvent* configure) { - return memcmp(configure, &view->lastConfigure, sizeof(PuglEventConfigure)); + return memcmp(configure, &view->lastConfigure, sizeof(PuglConfigureEvent)); } void @@ -157,7 +157,7 @@ updateViewRect(PuglView* view) - (void)setIsVisible:(BOOL)flag { if (flag && !puglview->visible) { - const PuglEventConfigure ev = { + const PuglConfigureEvent ev = { PUGL_CONFIGURE, 0, puglview->frame.x, @@ -197,7 +197,7 @@ updateViewRect(PuglView* view) if (reshaped) { updateViewRect(puglview); - const PuglEventConfigure ev = { + const PuglConfigureEvent ev = { PUGL_CONFIGURE, 0, puglview->frame.x, @@ -216,7 +216,7 @@ updateViewRect(PuglView* view) return; } - const PuglEventExpose ev = { + const PuglExposeEvent ev = { PUGL_EXPOSE, 0, rect.origin.x * scaleFactor, @@ -362,7 +362,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type) { const NSPoint wloc = [view eventLocation:event]; const NSPoint rloc = [NSEvent mouseLocation]; - const PuglEventCrossing ev = { + const PuglCrossingEvent ev = { type, 0, [event timestamp], @@ -403,7 +403,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type) { const NSPoint wloc = [self eventLocation:event]; const NSPoint rloc = [NSEvent mouseLocation]; - const PuglEventMotion ev = { + const PuglMotionEvent ev = { PUGL_MOTION, 0, [event timestamp], @@ -438,7 +438,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type) { const NSPoint wloc = [self eventLocation:event]; const NSPoint rloc = [NSEvent mouseLocation]; - const PuglEventButton ev = { + const PuglButtonEvent ev = { PUGL_BUTTON_PRESS, 0, [event timestamp], @@ -459,7 +459,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type) { const NSPoint wloc = [self eventLocation:event]; const NSPoint rloc = [NSEvent mouseLocation]; - const PuglEventButton ev = { + const PuglButtonEvent ev = { PUGL_BUTTON_RELEASE, 0, [event timestamp], @@ -512,7 +512,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type) : ((dy == 0.0 && dx < 0.0) ? PUGL_SCROLL_LEFT : PUGL_SCROLL_SMOOTH)))); - const PuglEventScroll ev = { + const PuglScrollEvent ev = { PUGL_SCROLL, 0, [event timestamp], @@ -544,7 +544,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type) const char* str = [[chars lowercaseString] UTF8String]; const uint32_t code = (spec ? spec : puglDecodeUTF8((const uint8_t*)str)); - const PuglEventKey ev = { + const PuglKeyEvent ev = { PUGL_KEY_PRESS, 0, [event timestamp], @@ -575,7 +575,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type) const char* str = [[chars lowercaseString] UTF8String]; const uint32_t code = (spec ? spec : puglDecodeUTF8((const uint8_t*)str)); - const PuglEventKey ev = { + const PuglKeyEvent ev = { PUGL_KEY_RELEASE, 0, [event timestamp], @@ -687,7 +687,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type) range:NSMakeRange(i, i + 1) remainingRange:nil]; - PuglEventText ev = { + PuglTextEvent ev = { PUGL_TEXT, 0, [event timestamp], @@ -734,7 +734,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type) const NSPoint wloc = [self eventLocation:event]; const NSPoint rloc = [NSEvent mouseLocation]; - const PuglEventKey ev = {type, + const PuglKeyEvent ev = {type, 0, [event timestamp], wloc.x, @@ -777,7 +777,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type) - (void)timerTick:(NSTimer*)userTimer { const NSNumber* userInfo = userTimer.userInfo; - const PuglEventTimer ev = {PUGL_TIMER, 0, userInfo.unsignedLongValue}; + const PuglTimerEvent ev = {PUGL_TIMER, 0, userInfo.unsignedLongValue}; PuglEvent timerEvent; timerEvent.timer = ev; @@ -1214,7 +1214,7 @@ dispatchClientEvent(PuglWorld* world, NSEvent* ev) PuglView* view = world->views[i]; PuglWrapperView* wrapper = view->impl->wrapperView; if ([wrapper window] == win && NSPointInRect(loc, [wrapper frame])) { - const PuglEventClient event = { + const PuglClientEvent event = { PUGL_CLIENT, 0, (uintptr_t)[ev data1], (uintptr_t)[ev data2]}; PuglEvent clientEvent; diff --git a/src/mac_cairo.m b/src/mac_cairo.m index 1c564a0..59e4bc1 100644 --- a/src/mac_cairo.m +++ b/src/mac_cairo.m @@ -90,7 +90,7 @@ puglMacCairoDestroy(PuglView* view) } static PuglStatus -puglMacCairoEnter(PuglView* view, const PuglEventExpose* expose) +puglMacCairoEnter(PuglView* view, const PuglExposeEvent* expose) { PuglCairoView* const drawView = (PuglCairoView*)view->impl->drawView; if (!expose) { @@ -118,7 +118,7 @@ puglMacCairoEnter(PuglView* view, const PuglEventExpose* expose) } static PuglStatus -puglMacCairoLeave(PuglView* view, const PuglEventExpose* expose) +puglMacCairoLeave(PuglView* view, const PuglExposeEvent* expose) { PuglCairoView* const drawView = (PuglCairoView*)view->impl->drawView; if (!expose) { diff --git a/src/mac_gl.m b/src/mac_gl.m index 24d3846..039dbbf 100644 --- a/src/mac_gl.m +++ b/src/mac_gl.m @@ -145,7 +145,7 @@ puglMacGlDestroy(PuglView* view) } static PuglStatus -puglMacGlEnter(PuglView* view, const PuglEventExpose* PUGL_UNUSED(expose)) +puglMacGlEnter(PuglView* view, const PuglExposeEvent* PUGL_UNUSED(expose)) { PuglOpenGLView* const drawView = (PuglOpenGLView*)view->impl->drawView; @@ -154,7 +154,7 @@ puglMacGlEnter(PuglView* view, const PuglEventExpose* PUGL_UNUSED(expose)) } static PuglStatus -puglMacGlLeave(PuglView* view, const PuglEventExpose* expose) +puglMacGlLeave(PuglView* view, const PuglExposeEvent* expose) { PuglOpenGLView* const drawView = (PuglOpenGLView*)view->impl->drawView; @@ -45,7 +45,7 @@ puglStubDestroy(PuglView* const view) } static inline PuglStatus -puglStubEnter(PuglView* const view, const PuglEventExpose* const expose) +puglStubEnter(PuglView* const view, const PuglExposeEvent* const expose) { (void)view; (void)expose; @@ -53,7 +53,7 @@ puglStubEnter(PuglView* const view, const PuglEventExpose* const expose) } static inline PuglStatus -puglStubLeave(PuglView* const view, const PuglEventExpose* const expose) +puglStubLeave(PuglView* const view, const PuglExposeEvent* const expose) { (void)view; (void)expose; diff --git a/src/types.h b/src/types.h index a618e8c..1f82486 100644 --- a/src/types.h +++ b/src/types.h @@ -59,7 +59,7 @@ struct PuglViewImpl { PuglNativeView parent; uintptr_t transientParent; PuglRect frame; - PuglEventConfigure lastConfigure; + PuglConfigureEvent lastConfigure; PuglHints hints; int defaultWidth; int defaultHeight; @@ -99,10 +99,10 @@ struct PuglBackendImpl { PuglStatus (*destroy)(PuglView*); /// Enter drawing context, for drawing if expose is non-null - PuglStatus (*enter)(PuglView*, const PuglEventExpose*); + PuglStatus (*enter)(PuglView*, const PuglExposeEvent*); /// Leave drawing context, after drawing if expose is non-null - PuglStatus (*leave)(PuglView*, const PuglEventExpose*); + PuglStatus (*leave)(PuglView*, const PuglExposeEvent*); /// Return the puglGetContext() handle for the application, if any void* (*getContext)(PuglView*); @@ -399,7 +399,7 @@ puglDecodeUTF16(const wchar_t* buf, const int len) } static void -initKeyEvent(PuglEventKey* event, +initKeyEvent(PuglKeyEvent* event, PuglView* view, bool press, WPARAM wParam, @@ -506,7 +506,7 @@ handleCrossing(PuglView* view, const PuglEventType type, POINT pos) POINT root_pos = pos; ClientToScreen(view->impl->hwnd, &root_pos); - const PuglEventCrossing ev = { + const PuglCrossingEvent ev = { type, 0, GetMessageTime() / 1e3, @@ -1270,7 +1270,7 @@ puglWinConfigure(PuglView* view) } PuglStatus -puglWinEnter(PuglView* view, const PuglEventExpose* expose) +puglWinEnter(PuglView* view, const PuglExposeEvent* expose) { if (expose) { PAINTSTRUCT ps; @@ -1281,7 +1281,7 @@ puglWinEnter(PuglView* view, const PuglEventExpose* expose) } PuglStatus -puglWinLeave(PuglView* view, const PuglEventExpose* expose) +puglWinLeave(PuglView* view, const PuglExposeEvent* expose) { if (expose) { PAINTSTRUCT ps; @@ -59,10 +59,10 @@ puglWinConfigure(PuglView* view); PUGL_API PuglStatus -puglWinEnter(PuglView* view, const PuglEventExpose* expose); +puglWinEnter(PuglView* view, const PuglExposeEvent* expose); PUGL_API PuglStatus -puglWinLeave(PuglView* view, const PuglEventExpose* expose); +puglWinLeave(PuglView* view, const PuglExposeEvent* expose); #endif // PUGL_DETAIL_WIN_H diff --git a/src/win_cairo.c b/src/win_cairo.c index c9b9703..abb06f5 100644 --- a/src/win_cairo.c +++ b/src/win_cairo.c @@ -117,7 +117,7 @@ puglWinCairoDestroy(PuglView* view) } static PuglStatus -puglWinCairoEnter(PuglView* view, const PuglEventExpose* expose) +puglWinCairoEnter(PuglView* view, const PuglExposeEvent* expose) { PuglStatus st = PUGL_SUCCESS; @@ -131,7 +131,7 @@ puglWinCairoEnter(PuglView* view, const PuglEventExpose* expose) } static PuglStatus -puglWinCairoLeave(PuglView* view, const PuglEventExpose* expose) +puglWinCairoLeave(PuglView* view, const PuglExposeEvent* expose) { PuglInternals* const impl = view->impl; PuglWinCairoSurface* const surface = (PuglWinCairoSurface*)impl->surface; diff --git a/src/win_gl.c b/src/win_gl.c index 1fda81a..529493f 100644 --- a/src/win_gl.c +++ b/src/win_gl.c @@ -266,7 +266,7 @@ puglWinGlDestroy(PuglView* view) } static PuglStatus -puglWinGlEnter(PuglView* view, const PuglEventExpose* expose) +puglWinGlEnter(PuglView* view, const PuglExposeEvent* expose) { PuglWinGlSurface* surface = (PuglWinGlSurface*)view->impl->surface; @@ -281,7 +281,7 @@ puglWinGlEnter(PuglView* view, const PuglEventExpose* expose) } static PuglStatus -puglWinGlLeave(PuglView* view, const PuglEventExpose* expose) +puglWinGlLeave(PuglView* view, const PuglExposeEvent* expose) { if (expose) { PAINTSTRUCT ps; diff --git a/src/win_stub.c b/src/win_stub.c index 6b0cb23..5ba4eb4 100644 --- a/src/win_stub.c +++ b/src/win_stub.c @@ -27,13 +27,13 @@ puglWinStubConfigure(PuglView* view) } static PuglStatus -puglWinStubEnter(PuglView* view, const PuglEventExpose* expose) +puglWinStubEnter(PuglView* view, const PuglExposeEvent* expose) { return puglWinEnter(view, expose); } static PuglStatus -puglWinStubLeave(PuglView* view, const PuglEventExpose* expose) +puglWinStubLeave(PuglView* view, const PuglExposeEvent* expose) { return puglWinLeave(view, expose); } @@ -971,7 +971,7 @@ puglWaitForEvent(PuglView* const view) #endif static void -mergeExposeEvents(PuglEventExpose* const dst, const PuglEventExpose* const src) +mergeExposeEvents(PuglExposeEvent* const dst, const PuglExposeEvent* const src) { if (!dst->type) { *dst = *src; @@ -1253,7 +1253,7 @@ puglPostRedisplay(PuglView* const view) PuglStatus puglPostRedisplayRect(PuglView* const view, const PuglRect rect) { - const PuglEventExpose event = { + const PuglExposeEvent event = { PUGL_EXPOSE, 0, rect.x, rect.y, rect.width, rect.height}; if (view->world->impl->dispatchingEvents) { diff --git a/src/x11_cairo.c b/src/x11_cairo.c index fa05bd1..6bb1254 100644 --- a/src/x11_cairo.c +++ b/src/x11_cairo.c @@ -93,7 +93,7 @@ puglX11CairoDestroy(PuglView* view) } static PuglStatus -puglX11CairoEnter(PuglView* view, const PuglEventExpose* expose) +puglX11CairoEnter(PuglView* view, const PuglExposeEvent* expose) { PuglInternals* const impl = view->impl; PuglX11CairoSurface* const surface = (PuglX11CairoSurface*)impl->surface; @@ -108,7 +108,7 @@ puglX11CairoEnter(PuglView* view, const PuglEventExpose* expose) } static PuglStatus -puglX11CairoLeave(PuglView* view, const PuglEventExpose* expose) +puglX11CairoLeave(PuglView* view, const PuglExposeEvent* expose) { PuglInternals* const impl = view->impl; PuglX11CairoSurface* const surface = (PuglX11CairoSurface*)impl->surface; diff --git a/src/x11_gl.c b/src/x11_gl.c index 34152de..8c061cd 100644 --- a/src/x11_gl.c +++ b/src/x11_gl.c @@ -110,7 +110,7 @@ puglX11GlConfigure(PuglView* view) } static PuglStatus -puglX11GlEnter(PuglView* view, const PuglEventExpose* PUGL_UNUSED(expose)) +puglX11GlEnter(PuglView* view, const PuglExposeEvent* PUGL_UNUSED(expose)) { PuglX11GlSurface* surface = (PuglX11GlSurface*)view->impl->surface; glXMakeCurrent(view->impl->display, view->impl->win, surface->ctx); @@ -118,7 +118,7 @@ puglX11GlEnter(PuglView* view, const PuglEventExpose* PUGL_UNUSED(expose)) } static PuglStatus -puglX11GlLeave(PuglView* view, const PuglEventExpose* expose) +puglX11GlLeave(PuglView* view, const PuglExposeEvent* expose) { if (expose && view->hints[PUGL_DOUBLE_BUFFER]) { glXSwapBuffers(view->impl->display, view->impl->win); |