diff options
author | David Robillard <d@drobilla.net> | 2020-07-05 15:01:13 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-07-05 18:47:39 +0200 |
commit | 90abfef17294c1b382f43007d984b93c200efa9d (patch) | |
tree | d8290397997ac31d7f9b9b565cd16ee88c11f937 | |
parent | 6c2460414082b989487abcad2ca2018a16ecdbd7 (diff) |
Replace isHint bool with a flag
I don't have any particular future use case in mind, but I think the concept
makes sense for general events and it seems it could be useful for things like
gestures as well. Also fixes another padding warning in the API.
-rw-r--r-- | pugl/detail/mac.m | 1 | ||||
-rw-r--r-- | pugl/detail/win.c | 1 | ||||
-rw-r--r-- | pugl/detail/x11.c | 4 | ||||
-rw-r--r-- | pugl/pugl.h | 4 |
4 files changed, 5 insertions, 5 deletions
diff --git a/pugl/detail/mac.m b/pugl/detail/mac.m index 50c52c5..23671ae 100644 --- a/pugl/detail/mac.m +++ b/pugl/detail/mac.m @@ -379,7 +379,6 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type) rloc.x, [[NSScreen mainScreen] frame].size.height - rloc.y, getModifiers(event), - 0, }; puglDispatchEvent(puglview, (const PuglEvent*)&ev); diff --git a/pugl/detail/win.c b/pugl/detail/win.c index ee690c4..7ec02ab 100644 --- a/pugl/detail/win.c +++ b/pugl/detail/win.c @@ -639,7 +639,6 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam) event.motion.xRoot = pt.x; event.motion.yRoot = pt.y; event.motion.state = getModifiers(); - event.motion.isHint = false; break; case WM_MOUSELEAVE: GetCursorPos(&pt); diff --git a/pugl/detail/x11.c b/pugl/detail/x11.c index b06f940..c2e7f6a 100644 --- a/pugl/detail/x11.c +++ b/pugl/detail/x11.c @@ -573,7 +573,9 @@ translateEvent(PuglView* view, XEvent xevent) event.motion.xRoot = xevent.xmotion.x_root; event.motion.yRoot = xevent.xmotion.y_root; event.motion.state = translateModifiers(xevent.xmotion.state); - event.motion.isHint = (xevent.xmotion.is_hint == NotifyHint); + if (xevent.xmotion.is_hint == NotifyHint) { + event.motion.flags |= PUGL_IS_HINT; + } break; case ButtonPress: if (xevent.xbutton.button >= 4 && xevent.xbutton.button <= 7) { diff --git a/pugl/pugl.h b/pugl/pugl.h index 8c0bd6d..c32a17d 100644 --- a/pugl/pugl.h +++ b/pugl/pugl.h @@ -221,7 +221,8 @@ typedef enum { Common flags for all event types. */ typedef enum { - PUGL_IS_SEND_EVENT = 1 ///< Event is synthetic + PUGL_IS_SEND_EVENT = 1, ///< Event is synthetic + PUGL_IS_HINT = 2 ///< Event is a hint (not direct user input) } PuglEventFlag; /** @@ -474,7 +475,6 @@ typedef struct { double xRoot; ///< Root-relative X coordinate double yRoot; ///< Root-relative Y coordinate PuglMods state; ///< Bitwise OR of #PuglMod flags - bool isHint; ///< True iff this event is a motion hint } PuglEventMotion; /** |