aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-08-04 22:08:03 +0200
committerDavid Robillard <d@drobilla.net>2019-09-03 08:34:39 +0200
commit59359e4f3d81231e7c665aa53ceeba7de0671d95 (patch)
treebf471b3f58724a5ef4a701dfefac1b905207eb52
parent4c6ac6b1c3e9f7ac04b5f6ba0b30eb8eacfcce9c (diff)
downloadpugl-59359e4f3d81231e7c665aa53ceeba7de0671d95.tar.gz
pugl-59359e4f3d81231e7c665aa53ceeba7de0671d95.tar.bz2
pugl-59359e4f3d81231e7c665aa53ceeba7de0671d95.zip
Make event handler return a status
Currently unused, but this is to leave open the possibility of event propagation or better errror handling.
-rw-r--r--pugl/pugl.h2
-rw-r--r--test/pugl_cairo_test.c4
-rw-r--r--test/pugl_test.c8
3 files changed, 10 insertions, 4 deletions
diff --git a/pugl/pugl.h b/pugl/pugl.h
index 4cf4d7f..51c86a1 100644
--- a/pugl/pugl.h
+++ b/pugl/pugl.h
@@ -740,7 +740,7 @@ puglLeaveContext(PuglView* view, bool drawing);
/**
A function called when an event occurs.
*/
-typedef void (*PuglEventFunc)(PuglView* view, const PuglEvent* event);
+typedef PuglStatus (*PuglEventFunc)(PuglView* view, const PuglEvent* event);
/**
Set the function to call when an event occurs.
diff --git a/test/pugl_cairo_test.c b/test/pugl_cairo_test.c
index 3a36e53..23c2b4e 100644
--- a/test/pugl_cairo_test.c
+++ b/test/pugl_cairo_test.c
@@ -146,7 +146,7 @@ onClose(PuglView* view)
quit = 1;
}
-static void
+static PuglStatus
onEvent(PuglView* view, const PuglEvent* event)
{
switch (event->type) {
@@ -179,6 +179,8 @@ onEvent(PuglView* view, const PuglEvent* event)
break;
default: break;
}
+
+ return PUGL_SUCCESS;
}
int
diff --git a/test/pugl_test.c b/test/pugl_test.c
index 740ebcd..ee58cf8 100644
--- a/test/pugl_test.c
+++ b/test/pugl_test.c
@@ -185,7 +185,7 @@ onKeyPress(PuglView* view, const PuglEventKey* event)
}
}
-static void
+static PuglStatus
onParentEvent(PuglView* view, const PuglEvent* event)
{
PuglTestApp* app = (PuglTestApp*)puglGetHandle(view);
@@ -230,9 +230,11 @@ onParentEvent(PuglView* view, const PuglEvent* event)
default:
break;
}
+
+ return PUGL_SUCCESS;
}
-static void
+static PuglStatus
onEvent(PuglView* view, const PuglEvent* event)
{
PuglTestApp* app = (PuglTestApp*)puglGetHandle(view);
@@ -273,6 +275,8 @@ onEvent(PuglView* view, const PuglEvent* event)
default:
break;
}
+
+ return PUGL_SUCCESS;
}
int