aboutsummaryrefslogtreecommitdiffstats
path: root/pugl
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-03-01 11:18:37 +0100
committerDavid Robillard <d@drobilla.net>2020-03-01 20:32:25 +0100
commitd7f0b78c32bc8da9461b8abed8722d15ddb0360a (patch)
tree226ca9487285b8f90577c31113960f7addfe393e /pugl
parent56bdfc8c7827cfc2ebf151553a23bdeea55883a6 (diff)
downloadpugl-d7f0b78c32bc8da9461b8abed8722d15ddb0360a.tar.gz
pugl-d7f0b78c32bc8da9461b8abed8722d15ddb0360a.tar.bz2
pugl-d7f0b78c32bc8da9461b8abed8722d15ddb0360a.zip
Put PuglEventAny member of PuglEvent first for easy initialization
Diffstat (limited to 'pugl')
-rw-r--r--pugl/detail/mac.m9
-rw-r--r--pugl/detail/x11.c2
-rw-r--r--pugl/pugl.h2
3 files changed, 5 insertions, 8 deletions
diff --git a/pugl/detail/mac.m b/pugl/detail/mac.m
index ca2cb7c..36499c0 100644
--- a/pugl/detail/mac.m
+++ b/pugl/detail/mac.m
@@ -643,8 +643,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
{
(void)sender;
- PuglEvent ev = { 0 };
- ev.type = PUGL_CLOSE;
+ const PuglEvent ev = {{PUGL_CLOSE, 0}};
puglDispatchEvent(window->puglview, &ev);
return YES;
}
@@ -666,8 +665,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
wrapperView->urgentTimer = NULL;
}
- PuglEvent ev = { 0 };
- ev.type = PUGL_FOCUS_IN;
+ PuglEvent ev = {{PUGL_FOCUS_IN, 0}};
ev.focus.grab = false;
puglDispatchEvent(window->puglview, &ev);
}
@@ -676,8 +674,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
{
(void)notification;
- PuglEvent ev = { 0 };
- ev.type = PUGL_FOCUS_OUT;
+ PuglEvent ev = {{PUGL_FOCUS_OUT, 0}};
ev.focus.grab = false;
puglDispatchEvent(window->puglview, &ev);
}
diff --git a/pugl/detail/x11.c b/pugl/detail/x11.c
index 38f10d0..9156c57 100644
--- a/pugl/detail/x11.c
+++ b/pugl/detail/x11.c
@@ -409,7 +409,7 @@ translateEvent(PuglView* view, XEvent xevent)
{
const PuglX11Atoms* atoms = &view->world->impl->atoms;
- PuglEvent event = {0};
+ PuglEvent event = {{PUGL_NOTHING, 0}};
event.any.flags = xevent.xany.send_event ? PUGL_IS_SEND_EVENT : 0;
switch (xevent.type) {
diff --git a/pugl/pugl.h b/pugl/pugl.h
index 0bd8b47..b5b6d25 100644
--- a/pugl/pugl.h
+++ b/pugl/pugl.h
@@ -411,8 +411,8 @@ typedef struct {
either be cast to the appropriate type, or the union members used.
*/
typedef union {
- PuglEventType type; ///< Event type
PuglEventAny any; ///< Valid for all event types
+ PuglEventType type; ///< Event type
PuglEventButton button; ///< PUGL_BUTTON_PRESS, PUGL_BUTTON_RELEASE
PuglEventConfigure configure; ///< PUGL_CONFIGURE
PuglEventExpose expose; ///< PUGL_EXPOSE