summaryrefslogtreecommitdiff
path: root/pugl
diff options
context:
space:
mode:
Diffstat (limited to 'pugl')
-rw-r--r--pugl/event.h40
-rw-r--r--pugl/pugl_osx.m14
-rw-r--r--pugl/pugl_win.cpp8
-rw-r--r--pugl/pugl_x11.c7
4 files changed, 38 insertions, 31 deletions
diff --git a/pugl/event.h b/pugl/event.h
index 731e045..2c48369 100644
--- a/pugl/event.h
+++ b/pugl/event.h
@@ -49,6 +49,10 @@ typedef enum {
PUGL_FOCUS_OUT
} PuglEventType;
+typedef enum {
+ PUGL_IS_SEND_EVENT = 1
+} PuglEventFlag;
+
/**
Reason for a PuglEventCrossing.
*/
@@ -64,7 +68,7 @@ typedef enum {
typedef struct {
PuglEventType type; /**< Event type. */
PuglView* view; /**< View that received this event. */
- bool send_event; /**< True iff event was sent explicitly. */
+ uint32_t flags; /**< Bitwise OR of PuglEventFlag values. */
} PuglEventAny;
/**
@@ -75,7 +79,7 @@ typedef struct {
typedef struct {
PuglEventType type; /**< PUGL_BUTTON_PRESS or PUGL_BUTTON_RELEASE. */
PuglView* view; /**< View that received this event. */
- bool send_event; /**< True iff event was sent explicitly. */
+ uint32_t flags; /**< Bitwise OR of PuglEventFlag values. */
uint32_t time; /**< Time in milliseconds. */
double x; /**< View-relative X coordinate. */
double y; /**< View-relative Y coordinate. */
@@ -91,7 +95,7 @@ typedef struct {
typedef struct {
PuglEventType type; /**< PUGL_CONFIGURE. */
PuglView* view; /**< View that received this event. */
- bool send_event; /**< True iff event was sent explicitly. */
+ uint32_t flags; /**< Bitwise OR of PuglEventFlag values. */
double x; /**< New parent-relative X coordinate. */
double y; /**< New parent-relative Y coordinate. */
double width; /**< New width. */
@@ -104,7 +108,7 @@ typedef struct {
typedef struct {
PuglEventType type; /**< PUGL_EXPOSE. */
PuglView* view; /**< View that received this event. */
- bool send_event; /**< True iff event was sent explicitly. */
+ uint32_t flags; /**< Bitwise OR of PuglEventFlag values. */
double x; /**< View-relative X coordinate. */
double y; /**< View-relative Y coordinate. */
double width; /**< Width of exposed region. */
@@ -136,7 +140,7 @@ typedef struct {
typedef struct {
PuglEventType type; /**< PUGL_KEY_PRESS or PUGL_KEY_RELEASE. */
PuglView* view; /**< View that received this event. */
- bool send_event; /**< True iff event was sent explicitly. */
+ uint32_t flags; /**< Bitwise OR of PuglEventFlag values. */
uint32_t time; /**< Time in milliseconds. */
double x; /**< View-relative X coordinate. */
double y; /**< View-relative Y coordinate. */
@@ -154,16 +158,16 @@ typedef struct {
Pointer crossing event (enter and leave).
*/
typedef struct {
- PuglEventType type; /**< PUGL_ENTER_NOTIFY or PUGL_LEAVE_NOTIFY. */
- PuglView* view; /**< View that received this event. */
- bool send_event; /**< True iff event was sent explicitly. */
- uint32_t time; /**< Time in milliseconds. */
- double x; /**< View-relative X coordinate. */
- double y; /**< View-relative Y coordinate. */
- double x_root; /**< Root-relative X coordinate. */
- double y_root; /**< Root-relative Y coordinate. */
- unsigned state; /**< Bitwise OR of PuglMod flags. */
- PuglCrossingMode mode; /**< Reason for crossing. */
+ PuglEventType type; /**< PUGL_ENTER_NOTIFY or PUGL_LEAVE_NOTIFY. */
+ PuglView* view; /**< View that received this event. */
+ uint32_t flags; /**< Bitwise OR of PuglEventFlag values. */
+ uint32_t time; /**< Time in milliseconds. */
+ double x; /**< View-relative X coordinate. */
+ double y; /**< View-relative Y coordinate. */
+ double x_root; /**< Root-relative X coordinate. */
+ double y_root; /**< Root-relative Y coordinate. */
+ unsigned state; /**< Bitwise OR of PuglMod flags. */
+ PuglCrossingMode mode; /**< Reason for crossing. */
} PuglEventCrossing;
/**
@@ -172,7 +176,7 @@ typedef struct {
typedef struct {
PuglEventType type; /**< PUGL_MOTION_NOTIFY. */
PuglView* view; /**< View that received this event. */
- bool send_event; /**< True iff event was sent explicitly. */
+ uint32_t flags; /**< Bitwise OR of PuglEventFlag values. */
uint32_t time; /**< Time in milliseconds. */
double x; /**< View-relative X coordinate. */
double y; /**< View-relative Y coordinate. */
@@ -195,7 +199,7 @@ typedef struct {
typedef struct {
PuglEventType type; /**< PUGL_SCROLL. */
PuglView* view; /**< View that received this event. */
- bool send_event; /**< True iff event was sent explicitly. */
+ uint32_t flags; /**< Bitwise OR of PuglEventFlag values. */
uint32_t time; /**< Time in milliseconds. */
double x; /**< View-relative X coordinate. */
double y; /**< View-relative Y coordinate. */
@@ -212,7 +216,7 @@ typedef struct {
typedef struct {
PuglEventType type; /**< PUGL_FOCUS_IN or PUGL_FOCUS_OUT. */
PuglView* view; /**< View that received this event. */
- bool send_event; /**< True iff event was sent explicitly. */
+ 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 1d9e408..7888c6c 100644
--- a/pugl/pugl_osx.m
+++ b/pugl/pugl_osx.m
@@ -182,7 +182,7 @@ puglDisplay(PuglView* view)
const PuglEventConfigure ev = {
PUGL_CONFIGURE,
puglview,
- false,
+ 0,
bounds.origin.x,
bounds.origin.y,
bounds.size.width,
@@ -276,7 +276,7 @@ getModifiers(PuglView* view, NSEvent* ev)
const PuglEventMotion ev = {
PUGL_MOTION_NOTIFY,
puglview,
- false,
+ 0,
[event timestamp],
wloc.x,
puglview->height - wloc.y,
@@ -306,7 +306,7 @@ getModifiers(PuglView* view, NSEvent* ev)
const PuglEventButton ev = {
PUGL_BUTTON_PRESS,
puglview,
- false,
+ 0,
[event timestamp],
wloc.x,
puglview->height - wloc.y,
@@ -325,7 +325,7 @@ getModifiers(PuglView* view, NSEvent* ev)
const PuglEventButton ev = {
PUGL_BUTTON_RELEASE,
puglview,
- false,
+ 0,
[event timestamp],
wloc.x,
puglview->height - wloc.y,
@@ -357,7 +357,7 @@ getModifiers(PuglView* view, NSEvent* ev)
const PuglEventScroll ev = {
PUGL_SCROLL,
puglview,
- false,
+ 0,
[event timestamp],
wloc.x,
puglview->height - wloc.y,
@@ -384,7 +384,7 @@ getModifiers(PuglView* view, NSEvent* ev)
PuglEventKey ev = {
PUGL_KEY_PRESS,
puglview,
- false,
+ 0,
[event timestamp],
wloc.x,
puglview->height - wloc.y,
@@ -410,7 +410,7 @@ getModifiers(PuglView* view, NSEvent* ev)
const PuglEventKey ev = {
PUGL_KEY_RELEASE,
puglview,
- false,
+ 0,
[event timestamp],
wloc.x,
puglview->height - wloc.y,
diff --git a/pugl/pugl_win.cpp b/pugl/pugl_win.cpp
index 1b303db..b834143 100644
--- a/pugl/pugl_win.cpp
+++ b/pugl/pugl_win.cpp
@@ -469,9 +469,11 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam)
memset(&event, 0, sizeof(event));
- event.any.type = PUGL_NOTHING;
- event.any.view = view;
- event.any.send_event = InSendMessageEx(dummy_ptr);
+ event.any.type = PUGL_NOTHING;
+ event.any.view = view;
+ if (InSendMessageEx(dummy_ptr)) {
+ event.any.flags |= PUGL_IS_SEND_EVENT;
+ }
setModifiers(view);
switch (message) {
diff --git a/pugl/pugl_x11.c b/pugl/pugl_x11.c
index e6d240c..5cd4373 100644
--- a/pugl/pugl_x11.c
+++ b/pugl/pugl_x11.c
@@ -453,8 +453,10 @@ translateEvent(PuglView* view, XEvent xevent)
PuglEvent event;
memset(&event, 0, sizeof(event));
- event.any.view = view;
- event.any.send_event = xevent.xany.send_event;
+ event.any.view = view;
+ if (xevent.xany.send_event) {
+ event.any.flags |= PUGL_IS_SEND_EVENT;
+ }
switch (xevent.type) {
case ConfigureNotify:
@@ -676,7 +678,6 @@ puglProcessEvents(PuglView* view)
if (view->redisplay) {
expose_event.expose.type = PUGL_EXPOSE;
expose_event.expose.view = view;
- expose_event.expose.send_event = true;
expose_event.expose.x = 0;
expose_event.expose.y = 0;
expose_event.expose.width = view->width;