diff options
Diffstat (limited to 'pugl')
-rw-r--r-- | pugl/pugl.h | 10 | ||||
-rw-r--r-- | pugl/pugl_osx.m | 27 | ||||
-rw-r--r-- | pugl/pugl_win.c | 2 | ||||
-rw-r--r-- | pugl/pugl_x11.c | 5 |
4 files changed, 13 insertions, 31 deletions
diff --git a/pugl/pugl.h b/pugl/pugl.h index 0953238..84887e7 100644 --- a/pugl/pugl.h +++ b/pugl/pugl.h @@ -205,7 +205,6 @@ typedef enum { */ typedef struct { PuglEventType type; /**< Event type. */ - PuglView* view; /**< View that received this event. */ uint32_t flags; /**< Bitwise OR of PuglEventFlag values. */ } PuglEventAny; @@ -216,7 +215,6 @@ typedef struct { */ typedef struct { PuglEventType type; /**< PUGL_BUTTON_PRESS or PUGL_BUTTON_RELEASE. */ - PuglView* view; /**< View that received this event. */ uint32_t flags; /**< Bitwise OR of PuglEventFlag values. */ double time; /**< Time in seconds. */ double x; /**< View-relative X coordinate. */ @@ -232,7 +230,6 @@ typedef struct { */ typedef struct { PuglEventType type; /**< PUGL_CONFIGURE. */ - PuglView* view; /**< View that received this event. */ uint32_t flags; /**< Bitwise OR of PuglEventFlag values. */ double x; /**< New parent-relative X coordinate. */ double y; /**< New parent-relative Y coordinate. */ @@ -245,7 +242,6 @@ typedef struct { */ typedef struct { PuglEventType type; /**< PUGL_EXPOSE. */ - PuglView* view; /**< View that received this event. */ uint32_t flags; /**< Bitwise OR of PuglEventFlag values. */ double x; /**< View-relative X coordinate. */ double y; /**< View-relative Y coordinate. */ @@ -259,7 +255,6 @@ typedef struct { */ typedef struct { PuglEventType type; /**< PUGL_CLOSE. */ - PuglView* view; /**< View that received this event. */ uint32_t flags; /**< Bitwise OR of PuglEventFlag values. */ } PuglEventClose; @@ -286,7 +281,6 @@ typedef struct { */ typedef struct { PuglEventType type; /**< PUGL_KEY_PRESS or PUGL_KEY_RELEASE. */ - PuglView* view; /**< View that received this event. */ uint32_t flags; /**< Bitwise OR of PuglEventFlag values. */ double time; /**< Time in seconds. */ double x; /**< View-relative X coordinate. */ @@ -306,7 +300,6 @@ typedef struct { */ typedef struct { PuglEventType type; /**< PUGL_ENTER_NOTIFY or PUGL_LEAVE_NOTIFY. */ - PuglView* view; /**< View that received this event. */ uint32_t flags; /**< Bitwise OR of PuglEventFlag values. */ double time; /**< Time in seconds. */ double x; /**< View-relative X coordinate. */ @@ -322,7 +315,6 @@ typedef struct { */ typedef struct { PuglEventType type; /**< PUGL_MOTION_NOTIFY. */ - PuglView* view; /**< View that received this event. */ uint32_t flags; /**< Bitwise OR of PuglEventFlag values. */ double time; /**< Time in seconds. */ double x; /**< View-relative X coordinate. */ @@ -345,7 +337,6 @@ typedef struct { */ typedef struct { PuglEventType type; /**< PUGL_SCROLL. */ - PuglView* view; /**< View that received this event. */ uint32_t flags; /**< Bitwise OR of PuglEventFlag values. */ double time; /**< Time in seconds. */ double x; /**< View-relative X coordinate. */ @@ -362,7 +353,6 @@ typedef struct { */ typedef struct { PuglEventType type; /**< PUGL_FOCUS_IN or PUGL_FOCUS_OUT. */ - PuglView* view; /**< View that received this event. */ uint32_t flags; /**< Bitwise OR of PuglEventFlag values. */ bool grab; /**< True iff this is a grab/ungrab event. */ } PuglEventFocus; diff --git a/pugl/pugl_osx.m b/pugl/pugl_osx.m index 45d0fb1..cdaa131 100644 --- a/pugl/pugl_osx.m +++ b/pugl/pugl_osx.m @@ -154,7 +154,6 @@ struct PuglInternalsImpl { const NSRect bounds = [self bounds]; const PuglEventConfigure ev = { PUGL_CONFIGURE, - puglview, 0, bounds.origin.x, bounds.origin.y, @@ -181,7 +180,6 @@ struct PuglInternalsImpl { { const PuglEventExpose ev = { PUGL_EXPOSE, - puglview, 0, rect.origin.x, rect.origin.y, @@ -284,7 +282,6 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type) const NSPoint rloc = [NSEvent mouseLocation]; const PuglEventCrossing ev = { type, - view->puglview, 0, [event timestamp], wloc.x, @@ -313,7 +310,6 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type) const NSPoint rloc = [NSEvent mouseLocation]; const PuglEventMotion ev = { PUGL_MOTION_NOTIFY, - puglview, 0, [event timestamp], wloc.x, @@ -348,7 +344,6 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type) const NSPoint rloc = [NSEvent mouseLocation]; const PuglEventButton ev = { PUGL_BUTTON_PRESS, - puglview, 0, [event timestamp], wloc.x, @@ -367,7 +362,6 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type) const NSPoint rloc = [NSEvent mouseLocation]; const PuglEventButton ev = { PUGL_BUTTON_RELEASE, - puglview, 0, [event timestamp], wloc.x, @@ -406,7 +400,6 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type) const NSPoint rloc = [NSEvent mouseLocation]; const PuglEventScroll ev = { PUGL_SCROLL, - puglview, 0, [event timestamp], wloc.x, @@ -433,7 +426,6 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type) const uint32_t code = puglDecodeUTF8((const uint8_t*)str); PuglEventKey ev = { PUGL_KEY_PRESS, - puglview, 0, [event timestamp], wloc.x, @@ -459,7 +451,6 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type) const char* str = [chars UTF8String]; PuglEventKey ev = { PUGL_KEY_RELEASE, - puglview, 0, [event timestamp], wloc.x, @@ -502,7 +493,6 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type) const NSPoint rloc = [NSEvent mouseLocation]; PuglEventKey ev = { type, - puglview, 0, [event timestamp], wloc.x, @@ -581,8 +571,9 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type) - (BOOL) windowShouldClose:(id)sender { - const PuglEventClose ev = { PUGL_CLOSE, window->puglview, 0 }; - puglDispatchEvent(window->puglview, (const PuglEvent*)&ev); + PuglEvent ev = { 0 }; + ev.type = PUGL_CLOSE; + puglDispatchEvent(window->puglview, &ev); return YES; } @@ -594,14 +585,18 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type) glview->urgentTimer = NULL; } - const PuglEventFocus ev = { PUGL_FOCUS_IN, window->puglview, 0, false }; - puglDispatchEvent(window->puglview, (const PuglEvent*)&ev); + PuglEvent ev = { 0 }; + ev.type = PUGL_FOCUS_IN; + ev.focus.grab = false; + puglDispatchEvent(window->puglview, &ev); } - (void) windowDidResignKey:(NSNotification*)notification { - const PuglEventFocus ev = { PUGL_FOCUS_OUT, window->puglview, 0, false }; - puglDispatchEvent(window->puglview, (const PuglEvent*)&ev); + PuglEvent ev = { 0 }; + ev.type = PUGL_FOCUS_OUT; + ev.focus.grab = false; + puglDispatchEvent(window->puglview, &ev); } @end diff --git a/pugl/pugl_win.c b/pugl/pugl_win.c index e9fecac..9d5b124 100644 --- a/pugl/pugl_win.c +++ b/pugl/pugl_win.c @@ -636,7 +636,6 @@ handleCrossing(PuglView* view, const PuglEventType type, POINT pos) const PuglEventCrossing ev = { type, - view, 0, GetMessageTime() / 1e3, (double)pos.x, @@ -670,7 +669,6 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam) memset(&event, 0, sizeof(event)); event.any.type = PUGL_NOTHING; - event.any.view = view; if (InSendMessageEx(dummy_ptr)) { event.any.flags |= PUGL_IS_SEND_EVENT; } diff --git a/pugl/pugl_x11.c b/pugl/pugl_x11.c index 3bd94df..59fb29c 100644 --- a/pugl/pugl_x11.c +++ b/pugl/pugl_x11.c @@ -296,9 +296,8 @@ translateModifiers(const unsigned xstate) static PuglEvent translateEvent(PuglView* view, XEvent xevent) { - PuglEvent event = {0}; - event.any.view = view; - event.any.flags |= xevent.xany.send_event ? PUGL_IS_SEND_EVENT : 0; + PuglEvent event = {0}; + event.any.flags = xevent.xany.send_event ? PUGL_IS_SEND_EVENT : 0; switch (xevent.type) { case ClientMessage: |