aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bindings/cpp/include/pugl/pugl.hpp92
-rw-r--r--doc/c/event-loop.rst8
-rw-r--r--doc/c/events.rst10
-rw-r--r--doc/c/shutting-down.rst2
-rw-r--r--examples/pugl_cairo_demo.c2
-rw-r--r--examples/pugl_embed_demo.c2
-rw-r--r--examples/pugl_window_demo.c2
-rw-r--r--include/pugl/pugl.h177
-rw-r--r--src/implementation.c4
-rw-r--r--src/mac.m28
-rw-r--r--src/mac_cairo.m4
-rw-r--r--src/mac_gl.m4
-rw-r--r--src/stub.h4
-rw-r--r--src/types.h6
-rw-r--r--src/win.c8
-rw-r--r--src/win.h4
-rw-r--r--src/win_cairo.c4
-rw-r--r--src/win_gl.c4
-rw-r--r--src/win_stub.c4
-rw-r--r--src/x11.c4
-rw-r--r--src/x11_cairo.c4
-rw-r--r--src/x11_gl.c4
-rw-r--r--test/test_cairo.c2
-rw-r--r--test/test_gl.c4
-rw-r--r--test/test_timer.c2
-rw-r--r--test/test_vulkan.c2
26 files changed, 224 insertions, 167 deletions
diff --git a/bindings/cpp/include/pugl/pugl.hpp b/bindings/cpp/include/pugl/pugl.hpp
index 4eebdac..69ea0eb 100644
--- a/bindings/cpp/include/pugl/pugl.hpp
+++ b/bindings/cpp/include/pugl/pugl.hpp
@@ -117,74 +117,74 @@ using EventFlag = PuglEventFlag; ///< @copydoc PuglEventFlag
using EventFlags = PuglEventFlags; ///< @copydoc PuglEventFlags
using CrossingMode = PuglCrossingMode; ///< @copydoc PuglCrossingMode
-/// @copydoc PuglEventCreate
-using CreateEvent = Event<PUGL_CREATE, PuglEventCreate>;
+/// @copydoc PuglCreateEvent
+using CreateEvent = Event<PUGL_CREATE, PuglCreateEvent>;
-/// @copydoc PuglEventDestroy
-using DestroyEvent = Event<PUGL_DESTROY, PuglEventDestroy>;
+/// @copydoc PuglDestroyEvent
+using DestroyEvent = Event<PUGL_DESTROY, PuglDestroyEvent>;
-/// @copydoc PuglEventConfigure
-using ConfigureEvent = Event<PUGL_CONFIGURE, PuglEventConfigure>;
+/// @copydoc PuglConfigureEvent
+using ConfigureEvent = Event<PUGL_CONFIGURE, PuglConfigureEvent>;
-/// @copydoc PuglEventMap
-using MapEvent = Event<PUGL_MAP, PuglEventMap>;
+/// @copydoc PuglMapEvent
+using MapEvent = Event<PUGL_MAP, PuglMapEvent>;
-/// @copydoc PuglEventUnmap
-using UnmapEvent = Event<PUGL_UNMAP, PuglEventUnmap>;
+/// @copydoc PuglUnmapEvent
+using UnmapEvent = Event<PUGL_UNMAP, PuglUnmapEvent>;
-/// @copydoc PuglEventUpdate
-using UpdateEvent = Event<PUGL_UPDATE, PuglEventUpdate>;
+/// @copydoc PuglUpdateEvent
+using UpdateEvent = Event<PUGL_UPDATE, PuglUpdateEvent>;
-/// @copydoc PuglEventExpose
-using ExposeEvent = Event<PUGL_EXPOSE, PuglEventExpose>;
+/// @copydoc PuglExposeEvent
+using ExposeEvent = Event<PUGL_EXPOSE, PuglExposeEvent>;
-/// @copydoc PuglEventClose
-using CloseEvent = Event<PUGL_CLOSE, PuglEventClose>;
+/// @copydoc PuglCloseEvent
+using CloseEvent = Event<PUGL_CLOSE, PuglCloseEvent>;
-/// @copydoc PuglEventFocus
-using FocusInEvent = Event<PUGL_FOCUS_IN, PuglEventFocus>;
+/// @copydoc PuglFocusEvent
+using FocusInEvent = Event<PUGL_FOCUS_IN, PuglFocusEvent>;
-/// @copydoc PuglEventFocus
-using FocusOutEvent = Event<PUGL_FOCUS_OUT, PuglEventFocus>;
+/// @copydoc PuglFocusEvent
+using FocusOutEvent = Event<PUGL_FOCUS_OUT, PuglFocusEvent>;
-/// @copydoc PuglEventKey
-using KeyPressEvent = Event<PUGL_KEY_PRESS, PuglEventKey>;
+/// @copydoc PuglKeyEvent
+using KeyPressEvent = Event<PUGL_KEY_PRESS, PuglKeyEvent>;
-/// @copydoc PuglEventKey
-using KeyReleaseEvent = Event<PUGL_KEY_RELEASE, PuglEventKey>;
+/// @copydoc PuglKeyEvent
+using KeyReleaseEvent = Event<PUGL_KEY_RELEASE, PuglKeyEvent>;
-/// @copydoc PuglEventText
-using TextEvent = Event<PUGL_TEXT, PuglEventText>;
+/// @copydoc PuglTextEvent
+using TextEvent = Event<PUGL_TEXT, PuglTextEvent>;
-/// @copydoc PuglEventCrossing
-using PointerInEvent = Event<PUGL_POINTER_IN, PuglEventCrossing>;
+/// @copydoc PuglCrossingEvent
+using PointerInEvent = Event<PUGL_POINTER_IN, PuglCrossingEvent>;
-/// @copydoc PuglEventCrossing
-using PointerOutEvent = Event<PUGL_POINTER_OUT, PuglEventCrossing>;
+/// @copydoc PuglCrossingEvent
+using PointerOutEvent = Event<PUGL_POINTER_OUT, PuglCrossingEvent>;
-/// @copydoc PuglEventButton
-using ButtonPressEvent = Event<PUGL_BUTTON_PRESS, PuglEventButton>;
+/// @copydoc PuglButtonEvent
+using ButtonPressEvent = Event<PUGL_BUTTON_PRESS, PuglButtonEvent>;
-/// @copydoc PuglEventButton
-using ButtonReleaseEvent = Event<PUGL_BUTTON_RELEASE, PuglEventButton>;
+/// @copydoc PuglButtonEvent
+using ButtonReleaseEvent = Event<PUGL_BUTTON_RELEASE, PuglButtonEvent>;
-/// @copydoc PuglEventMotion
-using MotionEvent = Event<PUGL_MOTION, PuglEventMotion>;
+/// @copydoc PuglMotionEvent
+using MotionEvent = Event<PUGL_MOTION, PuglMotionEvent>;
-/// @copydoc PuglEventScroll
-using ScrollEvent = Event<PUGL_SCROLL, PuglEventScroll>;
+/// @copydoc PuglScrollEvent
+using ScrollEvent = Event<PUGL_SCROLL, PuglScrollEvent>;
-/// @copydoc PuglEventClient
-using ClientEvent = Event<PUGL_CLIENT, PuglEventClient>;
+/// @copydoc PuglClientEvent
+using ClientEvent = Event<PUGL_CLIENT, PuglClientEvent>;
-/// @copydoc PuglEventTimer
-using TimerEvent = Event<PUGL_TIMER, PuglEventTimer>;
+/// @copydoc PuglTimerEvent
+using TimerEvent = Event<PUGL_TIMER, PuglTimerEvent>;
-/// @copydoc PuglEventLoopEnter
-using LoopEnterEvent = Event<PUGL_LOOP_ENTER, PuglEventLoopEnter>;
+/// @copydoc PuglLoopEnterEvent
+using LoopEnterEvent = Event<PUGL_LOOP_ENTER, PuglLoopEnterEvent>;
-/// @copydoc PuglEventLoopLeave
-using LoopLeaveEvent = Event<PUGL_LOOP_LEAVE, PuglEventLoopLeave>;
+/// @copydoc PuglLoopLeaveEvent
+using LoopLeaveEvent = Event<PUGL_LOOP_LEAVE, PuglLoopLeaveEvent>;
/**
@}
diff --git a/doc/c/event-loop.rst b/doc/c/event-loop.rst
index 3b9915f..be4e315 100644
--- a/doc/c/event-loop.rst
+++ b/doc/c/event-loop.rst
@@ -25,10 +25,10 @@ Redrawing
Occasional redrawing can be requested by calling :func:`puglPostRedisplay` or :func:`puglPostRedisplayRect`.
After these are called,
-a :struct:`PuglEventExpose` will be dispatched on the next call to :func:`puglUpdate`.
+a :struct:`PuglExposeEvent` will be dispatched on the next call to :func:`puglUpdate`.
For continuous redrawing,
-call :func:`puglPostRedisplay` while handling a :struct:`PuglEventUpdate` event.
+call :func:`puglPostRedisplay` while handling a :struct:`PuglUpdateEvent` event.
This event is sent just before views are redrawn,
so it can be used as a hook to expand the update region right before the view is exposed.
Anything else that needs to be done every frame can be handled similarly.
@@ -88,10 +88,10 @@ has displayed the window menu.
This means that :func:`puglUpdate` will block until the resize is finished,
or the menu is closed.
-Pugl dispatches :struct:`PuglEventLoopEnter` and :struct:`PuglEventLoopLeave` events to notify the application of this situation.
+Pugl dispatches :struct:`PuglLoopEnterEvent` and :struct:`PuglLoopLeaveEvent` events to notify the application of this situation.
If you want to continuously redraw during resizing on these platforms,
you can schedule a timer with :func:`puglStartTimer` when the recursive loop is entered,
-and post redisplays when handling the :struct:`PuglEventTimer`.
+and post redisplays when handling the :struct:`PuglTimerEvent`.
Be sure to remove the timer with :func:`puglStopTimer` when the recursive loop is finished.
On X11, there are no recursive event loops,
diff --git a/doc/c/events.rst b/doc/c/events.rst
index bf964db..86f7c63 100644
--- a/doc/c/events.rst
+++ b/doc/c/events.rst
@@ -60,7 +60,7 @@ and handles exposure internally to provide optimized and consistent behavior acr
Cairo Context
-------------
-A Cairo context is created for each :struct:`PuglEventExpose`,
+A Cairo context is created for each :struct:`PuglExposeEvent`,
and only exists during the handling of that event.
Null is returned by :func:`puglGetContext` at any other time.
@@ -69,10 +69,10 @@ OpenGL Context
The OpenGL context is only active during the handling of these events:
-- :struct:`PuglEventCreate`
-- :struct:`PuglEventDestroy`
-- :struct:`PuglEventConfigure`
-- :struct:`PuglEventExpose`
+- :struct:`PuglCreateEvent`
+- :struct:`PuglDestroyEvent`
+- :struct:`PuglConfigureEvent`
+- :struct:`PuglExposeEvent`
As always, drawing is only possible during an expose.
diff --git a/doc/c/shutting-down.rst b/doc/c/shutting-down.rst
index dfb56cd..a04c771 100644
--- a/doc/c/shutting-down.rst
+++ b/doc/c/shutting-down.rst
@@ -6,7 +6,7 @@ Shutting Down
#############
When a view is closed,
-it will receive a :struct:`PuglEventClose`.
+it will receive a :struct:`PuglCloseEvent`.
An application may also set a flag based on user input or other conditions,
which can be used to break out of the main loop and stop calling :func:`puglUpdate`.
diff --git a/examples/pugl_cairo_demo.c b/examples/pugl_cairo_demo.c
index 67bc13c..1d998a8 100644
--- a/examples/pugl_cairo_demo.c
+++ b/examples/pugl_cairo_demo.c
@@ -124,7 +124,7 @@ postButtonRedisplay(PuglView* view)
}
static void
-onDisplay(PuglTestApp* app, PuglView* view, const PuglEventExpose* event)
+onDisplay(PuglTestApp* app, PuglView* view, const PuglExposeEvent* event)
{
cairo_t* cr = (cairo_t*)puglGetContext(view);
diff --git a/examples/pugl_embed_demo.c b/examples/pugl_embed_demo.c
index 677b94f..311ab3b 100644
--- a/examples/pugl_embed_demo.c
+++ b/examples/pugl_embed_demo.c
@@ -112,7 +112,7 @@ swapFocus(PuglTestApp* app)
}
static void
-onKeyPress(PuglView* view, const PuglEventKey* event, const char* prefix)
+onKeyPress(PuglView* view, const PuglKeyEvent* event, const char* prefix)
{
PuglTestApp* app = (PuglTestApp*)puglGetHandle(view);
PuglRect frame = puglGetFrame(view);
diff --git a/examples/pugl_window_demo.c b/examples/pugl_window_demo.c
index f7d5b2c..1e38aa1 100644
--- a/examples/pugl_window_demo.c
+++ b/examples/pugl_window_demo.c
@@ -72,7 +72,7 @@ onDisplay(PuglView* view)
}
static void
-onKeyPress(PuglView* view, const PuglEventKey* event)
+onKeyPress(PuglView* view, const PuglKeyEvent* event)
{
PuglWorld* world = puglGetWorld(view);
PuglTestApp* app = (PuglTestApp*)puglGetWorldHandle(world);
diff --git a/include/pugl/pugl.h b/include/pugl/pugl.h
index d5fbdff..6e783e7 100644
--- a/include/pugl/pugl.h
+++ b/include/pugl/pugl.h
@@ -107,7 +107,7 @@ typedef uint32_t PuglMods;
/**
Keyboard key codepoints.
- All keys are identified by a Unicode code point in PuglEventKey::key. This
+ All keys are identified by a Unicode code point in PuglKeyEvent::key. This
enumeration defines constants for special keys that do not have a standard
code point, and some convenience constants for control characters. Note
that all keys are handled in the same way, this enumeration is just for
@@ -169,29 +169,29 @@ typedef enum {
/// The type of a PuglEvent
typedef enum {
PUGL_NOTHING, ///< No event
- PUGL_CREATE, ///< View created, a #PuglEventCreate
- PUGL_DESTROY, ///< View destroyed, a #PuglEventDestroy
- PUGL_CONFIGURE, ///< View moved/resized, a #PuglEventConfigure
- PUGL_MAP, ///< View made visible, a #PuglEventMap
- PUGL_UNMAP, ///< View made invisible, a #PuglEventUnmap
- PUGL_UPDATE, ///< View ready to draw, a #PuglEventUpdate
- PUGL_EXPOSE, ///< View must be drawn, a #PuglEventExpose
- PUGL_CLOSE, ///< View will be closed, a #PuglEventClose
- PUGL_FOCUS_IN, ///< Keyboard focus entered view, a #PuglEventFocus
- PUGL_FOCUS_OUT, ///< Keyboard focus left view, a #PuglEventFocus
- PUGL_KEY_PRESS, ///< Key pressed, a #PuglEventKey
- PUGL_KEY_RELEASE, ///< Key released, a #PuglEventKey
- PUGL_TEXT, ///< Character entered, a #PuglEventText
- PUGL_POINTER_IN, ///< Pointer entered view, a #PuglEventCrossing
- PUGL_POINTER_OUT, ///< Pointer left view, a #PuglEventCrossing
- PUGL_BUTTON_PRESS, ///< Mouse button pressed, a #PuglEventButton
- PUGL_BUTTON_RELEASE, ///< Mouse button released, a #PuglEventButton
- PUGL_MOTION, ///< Pointer moved, a #PuglEventMotion
- PUGL_SCROLL, ///< Scrolled, a #PuglEventScroll
- PUGL_CLIENT, ///< Custom client message, a #PuglEventClient
- PUGL_TIMER, ///< Timer triggered, a #PuglEventTimer
- PUGL_LOOP_ENTER, ///< Recursive loop entered, a #PuglEventLoopEnter
- PUGL_LOOP_LEAVE, ///< Recursive loop left, a #PuglEventLoopLeave
+ PUGL_CREATE, ///< View created, a #PuglCreateEvent
+ PUGL_DESTROY, ///< View destroyed, a #PuglDestroyEvent
+ PUGL_CONFIGURE, ///< View moved/resized, a #PuglConfigureEvent
+ PUGL_MAP, ///< View made visible, a #PuglMapEvent
+ PUGL_UNMAP, ///< View made invisible, a #PuglUnmapEvent
+ PUGL_UPDATE, ///< View ready to draw, a #PuglUpdateEvent
+ PUGL_EXPOSE, ///< View must be drawn, a #PuglExposeEvent
+ PUGL_CLOSE, ///< View will be closed, a #PuglCloseEvent
+ PUGL_FOCUS_IN, ///< Keyboard focus entered view, a #PuglFocusEvent
+ PUGL_FOCUS_OUT, ///< Keyboard focus left view, a #PuglFocusEvent
+ PUGL_KEY_PRESS, ///< Key pressed, a #PuglKeyEvent
+ PUGL_KEY_RELEASE, ///< Key released, a #PuglKeyEvent
+ PUGL_TEXT, ///< Character entered, a #PuglTextEvent
+ PUGL_POINTER_IN, ///< Pointer entered view, a #PuglCrossingEvent
+ PUGL_POINTER_OUT, ///< Pointer left view, a #PuglCrossingEvent
+ PUGL_BUTTON_PRESS, ///< Mouse button pressed, a #PuglButtonEvent
+ PUGL_BUTTON_RELEASE, ///< Mouse button released, a #PuglButtonEvent
+ PUGL_MOTION, ///< Pointer moved, a #PuglMotionEvent
+ PUGL_SCROLL, ///< Scrolled, a #PuglScrollEvent
+ PUGL_CLIENT, ///< Custom client message, a #PuglClientEvent
+ PUGL_TIMER, ///< Timer triggered, a #PuglTimerEvent
+ PUGL_LOOP_ENTER, ///< Recursive loop entered, a #PuglLoopEnterEvent
+ PUGL_LOOP_LEAVE, ///< Recursive loop left, a #PuglLoopLeaveEvent
} PuglEventType;
/// Common flags for all event types
@@ -203,7 +203,7 @@ typedef enum {
/// Bitwise OR of #PuglEventFlag values
typedef uint32_t PuglEventFlags;
-/// Reason for a PuglEventCrossing
+/// Reason for a PuglCrossingEvent
typedef enum {
PUGL_CROSSING_NORMAL, ///< Crossing due to pointer motion
PUGL_CROSSING_GRAB, ///< Crossing due to a grab
@@ -213,7 +213,7 @@ typedef enum {
/**
Scroll direction.
- Describes the direction of a #PuglEventScroll along with whether the scroll
+ Describes the direction of a #PuglScrollEvent along with whether the scroll
is a "smooth" scroll. The discrete directions are for devices like mouse
wheels with constrained axes, while a smooth scroll is for those with
arbitrary scroll direction freedom, like some touchpads.
@@ -230,7 +230,7 @@ typedef enum {
typedef struct {
PuglEventType type; ///< Event type
PuglEventFlags flags; ///< Bitwise OR of #PuglEventFlag values
-} PuglEventAny;
+} PuglAnyEvent;
/**
View create event.
@@ -241,12 +241,12 @@ typedef struct {
This event type has no extra fields.
*/
-typedef PuglEventAny PuglEventCreate;
+typedef PuglAnyEvent PuglCreateEvent;
/**
View destroy event.
- This event is the counterpart to #PuglEventCreate, and it is sent when the
+ This event is the counterpart to #PuglCreateEvent, and it is sent when the
view is being destroyed. This is typically used for tearing down the
graphics system, or otherwise freeing any resources allocated when the
create event was handled.
@@ -256,7 +256,7 @@ typedef PuglEventAny PuglEventCreate;
This event type has no extra fields.
*/
-typedef PuglEventAny PuglEventDestroy;
+typedef PuglAnyEvent PuglDestroyEvent;
/**
View resize or move event.
@@ -273,7 +273,7 @@ typedef struct {
double y; ///< New parent-relative Y coordinate
double width; ///< New width
double height; ///< New height
-} PuglEventConfigure;
+} PuglConfigureEvent;
/**
View show event.
@@ -282,7 +282,7 @@ typedef struct {
This event type has no extra fields.
*/
-typedef PuglEventAny PuglEventMap;
+typedef PuglAnyEvent PuglMapEvent;
/**
View hide event.
@@ -292,7 +292,7 @@ typedef PuglEventAny PuglEventMap;
This event type has no extra fields.
*/
-typedef PuglEventAny PuglEventUnmap;
+typedef PuglAnyEvent PuglUnmapEvent;
/**
View update event.
@@ -303,7 +303,7 @@ typedef PuglEventAny PuglEventUnmap;
example, to continuously animate, a view calls puglPostRedisplay() when an
update event is received, and it will then shortly receive an expose event.
*/
-typedef PuglEventAny PuglEventUpdate;
+typedef PuglAnyEvent PuglUpdateEvent;
/**
Expose event for when a region must be redrawn.
@@ -319,7 +319,7 @@ typedef struct {
double y; ///< View-relative Y coordinate
double width; ///< Width of exposed region
double height; ///< Height of exposed region
-} PuglEventExpose;
+} PuglExposeEvent;
/**
View close event.
@@ -329,7 +329,7 @@ typedef struct {
This event type has no extra fields.
*/
-typedef PuglEventAny PuglEventClose;
+typedef PuglAnyEvent PuglCloseEvent;
/**
Keyboard focus event.
@@ -341,7 +341,7 @@ typedef struct {
PuglEventType type; ///< #PUGL_FOCUS_IN or #PUGL_FOCUS_OUT
PuglEventFlags flags; ///< Bitwise OR of #PuglEventFlag values
PuglCrossingMode mode; ///< Reason for focus change
-} PuglEventFocus;
+} PuglFocusEvent;
/**
Key press or release event.
@@ -371,7 +371,7 @@ typedef struct {
PuglMods state; ///< Bitwise OR of #PuglMod flags
uint32_t keycode; ///< Raw key code
uint32_t key; ///< Unshifted Unicode character code, or 0
-} PuglEventKey;
+} PuglKeyEvent;
/**
Character input event.
@@ -396,7 +396,7 @@ typedef struct {
uint32_t keycode; ///< Raw key code
uint32_t character; ///< Unicode character code
char string[8]; ///< UTF-8 string
-} PuglEventText;
+} PuglTextEvent;
/**
Pointer enter or leave event.
@@ -415,7 +415,7 @@ typedef struct {
double yRoot; ///< Root-relative Y coordinate
PuglMods state; ///< Bitwise OR of #PuglMod flags
PuglCrossingMode mode; ///< Reason for crossing
-} PuglEventCrossing;
+} PuglCrossingEvent;
/**
Button press or release event.
@@ -430,7 +430,7 @@ typedef struct {
double yRoot; ///< Root-relative Y coordinate
PuglMods state; ///< Bitwise OR of #PuglMod flags
uint32_t button; ///< Button number starting from 1
-} PuglEventButton;
+} PuglButtonEvent;
/**
Pointer motion event.
@@ -444,7 +444,7 @@ typedef struct {
double xRoot; ///< Root-relative X coordinate
double yRoot; ///< Root-relative Y coordinate
PuglMods state; ///< Bitwise OR of #PuglMod flags
-} PuglEventMotion;
+} PuglMotionEvent;
/**
Scroll event.
@@ -467,7 +467,7 @@ typedef struct {
PuglScrollDirection direction; ///< Scroll direction
double dx; ///< Scroll X distance in lines
double dy; ///< Scroll Y distance in lines
-} PuglEventScroll;
+} PuglScrollEvent;
/**
Custom client message event.
@@ -481,7 +481,7 @@ typedef struct {
PuglEventFlags flags; ///< Bitwise OR of #PuglEventFlag values
uintptr_t data1; ///< Client-specific data
uintptr_t data2; ///< Client-specific data
-} PuglEventClient;
+} PuglClientEvent;
/**
Timer event.
@@ -497,7 +497,7 @@ typedef struct {
PuglEventType type; ///< #PUGL_TIMER
PuglEventFlags flags; ///< Bitwise OR of #PuglEventFlag values
uintptr_t id; ///< Timer ID
-} PuglEventTimer;
+} PuglTimerEvent;
/**
Recursive loop enter event.
@@ -519,7 +519,7 @@ typedef struct {
This event type has no extra fields.
*/
-typedef PuglEventAny PuglEventLoopEnter;
+typedef PuglAnyEvent PuglLoopEnterEvent;
/**
Recursive loop leave event.
@@ -529,7 +529,7 @@ typedef PuglEventAny PuglEventLoopEnter;
This event type has no extra fields.
*/
-typedef PuglEventAny PuglEventLoopLeave;
+typedef PuglAnyEvent PuglLoopLeaveEvent;
/**
View event.
@@ -543,19 +543,19 @@ typedef PuglEventAny PuglEventLoopLeave;
and #PUGL_EXPOSE, but only enabled for drawing for #PUGL_EXPOSE.
*/
typedef union {
- PuglEventAny any; ///< Valid for all event types
+ PuglAnyEvent 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
- PuglEventKey key; ///< #PUGL_KEY_PRESS, #PUGL_KEY_RELEASE
- PuglEventText text; ///< #PUGL_TEXT
- PuglEventCrossing crossing; ///< #PUGL_POINTER_IN, #PUGL_POINTER_OUT
- PuglEventMotion motion; ///< #PUGL_MOTION
- PuglEventScroll scroll; ///< #PUGL_SCROLL
- PuglEventFocus focus; ///< #PUGL_FOCUS_IN, #PUGL_FOCUS_OUT
- PuglEventClient client; ///< #PUGL_CLIENT
- PuglEventTimer timer; ///< #PUGL_TIMER
+ PuglButtonEvent button; ///< #PUGL_BUTTON_PRESS, #PUGL_BUTTON_RELEASE
+ PuglConfigureEvent configure; ///< #PUGL_CONFIGURE
+ PuglExposeEvent expose; ///< #PUGL_EXPOSE
+ PuglKeyEvent key; ///< #PUGL_KEY_PRESS, #PUGL_KEY_RELEASE
+ PuglTextEvent text; ///< #PUGL_TEXT
+ PuglCrossingEvent crossing; ///< #PUGL_POINTER_IN, #PUGL_POINTER_OUT
+ PuglMotionEvent motion; ///< #PUGL_MOTION
+ PuglScrollEvent scroll; ///< #PUGL_SCROLL
+ PuglFocusEvent focus; ///< #PUGL_FOCUS_IN, #PUGL_FOCUS_OUT
+ PuglClientEvent client; ///< #PUGL_CLIENT
+ PuglTimerEvent timer; ///< #PUGL_TIMER
} PuglEvent;
/**
@@ -1208,7 +1208,7 @@ puglRequestAttention(PuglView* view);
/**
Activate a repeating timer event.
- This starts a timer which will send a #PuglEventTimer to `view` every
+ This starts a timer which will send a #PuglTimerEvent to `view` every
`timeout` seconds. This can be used to perform some action in a view at a
regular interval with relatively low frequency. Note that the frequency of
timer events may be limited by how often puglUpdate() is called.
@@ -1280,6 +1280,63 @@ puglSendEvent(PuglView* view, const PuglEvent* event);
@{
*/
+PUGL_DEPRECATED_BY("PuglCreateEvent")
+typedef PuglCreateEvent PuglEventCreate;
+
+PUGL_DEPRECATED_BY("PuglDestroyEvent")
+typedef PuglDestroyEvent PuglEventDestroy;
+
+PUGL_DEPRECATED_BY("PuglConfigureEvent")
+typedef PuglConfigureEvent PuglEventConfigure;
+
+PUGL_DEPRECATED_BY("PuglMapEvent")
+typedef PuglMapEvent PuglEventMap;
+
+PUGL_DEPRECATED_BY("PuglUnmapEvent")
+typedef PuglUnmapEvent PuglEventUnmap;
+
+PUGL_DEPRECATED_BY("PuglUpdateEvent")
+typedef PuglUpdateEvent PuglEventUpdate;
+
+PUGL_DEPRECATED_BY("PuglExposeEvent")
+typedef PuglExposeEvent PuglEventExpose;
+
+PUGL_DEPRECATED_BY("PuglCloseEvent")
+typedef PuglCloseEvent PuglEventClose;
+
+PUGL_DEPRECATED_BY("PuglFocusEvent")
+typedef PuglFocusEvent PuglEventFocus;
+
+PUGL_DEPRECATED_BY("PuglKeyEvent")
+typedef PuglKeyEvent PuglEventKey;
+
+PUGL_DEPRECATED_BY("PuglTextEvent")
+typedef PuglTextEvent PuglEventText;
+
+PUGL_DEPRECATED_BY("PuglCrossingEvent")
+typedef PuglCrossingEvent PuglEventCrossing;
+
+PUGL_DEPRECATED_BY("PuglButtonEvent")
+typedef PuglButtonEvent PuglEventButton;
+
+PUGL_DEPRECATED_BY("PuglMotionEvent")
+typedef PuglMotionEvent PuglEventMotion;
+
+PUGL_DEPRECATED_BY("PuglScrollEvent")
+typedef PuglScrollEvent PuglEventScroll;
+
+PUGL_DEPRECATED_BY("PuglClientEvent")
+typedef PuglClientEvent PuglEventClient;
+
+PUGL_DEPRECATED_BY("PuglTimerEvent")
+typedef PuglTimerEvent PuglEventTimer;
+
+PUGL_DEPRECATED_BY("PuglLoopEnterEvent")
+typedef PuglLoopEnterEvent PuglEventLoopEnter;
+
+PUGL_DEPRECATED_BY("PuglLoopLeaveEvent")
+typedef PuglLoopLeaveEvent PuglEventLoopLeave;
+
/**
A native window handle.
diff --git a/src/implementation.c b/src/implementation.c
index d7763a7..5ef3ce9 100644
--- a/src/implementation.c
+++ b/src/implementation.c
@@ -356,9 +356,9 @@ puglDecodeUTF8(const uint8_t* buf)
}
static inline bool
-puglMustConfigure(PuglView* view, const PuglEventConfigure* configure)
+puglMustConfigure(PuglView* view, const PuglConfigureEvent* configure)
{
- return memcmp(configure, &view->lastConfigure, sizeof(PuglEventConfigure));
+ return memcmp(configure, &view->lastConfigure, sizeof(PuglConfigureEvent));
}
void
diff --git a/src/mac.m b/src/mac.m
index 60ea6c8..316da37 100644
--- a/src/mac.m
+++ b/src/mac.m
@@ -157,7 +157,7 @@ updateViewRect(PuglView* view)
- (void)setIsVisible:(BOOL)flag
{
if (flag && !puglview->visible) {
- const PuglEventConfigure ev = {
+ const PuglConfigureEvent ev = {
PUGL_CONFIGURE,
0,
puglview->frame.x,
@@ -197,7 +197,7 @@ updateViewRect(PuglView* view)
if (reshaped) {
updateViewRect(puglview);
- const PuglEventConfigure ev = {
+ const PuglConfigureEvent ev = {
PUGL_CONFIGURE,
0,
puglview->frame.x,
@@ -216,7 +216,7 @@ updateViewRect(PuglView* view)
return;
}
- const PuglEventExpose ev = {
+ const PuglExposeEvent ev = {
PUGL_EXPOSE,
0,
rect.origin.x * scaleFactor,
@@ -362,7 +362,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
{
const NSPoint wloc = [view eventLocation:event];
const NSPoint rloc = [NSEvent mouseLocation];
- const PuglEventCrossing ev = {
+ const PuglCrossingEvent ev = {
type,
0,
[event timestamp],
@@ -403,7 +403,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
{
const NSPoint wloc = [self eventLocation:event];
const NSPoint rloc = [NSEvent mouseLocation];
- const PuglEventMotion ev = {
+ const PuglMotionEvent ev = {
PUGL_MOTION,
0,
[event timestamp],
@@ -438,7 +438,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
{
const NSPoint wloc = [self eventLocation:event];
const NSPoint rloc = [NSEvent mouseLocation];
- const PuglEventButton ev = {
+ const PuglButtonEvent ev = {
PUGL_BUTTON_PRESS,
0,
[event timestamp],
@@ -459,7 +459,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
{
const NSPoint wloc = [self eventLocation:event];
const NSPoint rloc = [NSEvent mouseLocation];
- const PuglEventButton ev = {
+ const PuglButtonEvent ev = {
PUGL_BUTTON_RELEASE,
0,
[event timestamp],
@@ -512,7 +512,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
: ((dy == 0.0 && dx < 0.0) ? PUGL_SCROLL_LEFT
: PUGL_SCROLL_SMOOTH))));
- const PuglEventScroll ev = {
+ const PuglScrollEvent ev = {
PUGL_SCROLL,
0,
[event timestamp],
@@ -544,7 +544,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
const char* str = [[chars lowercaseString] UTF8String];
const uint32_t code = (spec ? spec : puglDecodeUTF8((const uint8_t*)str));
- const PuglEventKey ev = {
+ const PuglKeyEvent ev = {
PUGL_KEY_PRESS,
0,
[event timestamp],
@@ -575,7 +575,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
const char* str = [[chars lowercaseString] UTF8String];
const uint32_t code = (spec ? spec : puglDecodeUTF8((const uint8_t*)str));
- const PuglEventKey ev = {
+ const PuglKeyEvent ev = {
PUGL_KEY_RELEASE,
0,
[event timestamp],
@@ -687,7 +687,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
range:NSMakeRange(i, i + 1)
remainingRange:nil];
- PuglEventText ev = {
+ PuglTextEvent ev = {
PUGL_TEXT,
0,
[event timestamp],
@@ -734,7 +734,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
const NSPoint wloc = [self eventLocation:event];
const NSPoint rloc = [NSEvent mouseLocation];
- const PuglEventKey ev = {type,
+ const PuglKeyEvent ev = {type,
0,
[event timestamp],
wloc.x,
@@ -777,7 +777,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
- (void)timerTick:(NSTimer*)userTimer
{
const NSNumber* userInfo = userTimer.userInfo;
- const PuglEventTimer ev = {PUGL_TIMER, 0, userInfo.unsignedLongValue};
+ const PuglTimerEvent ev = {PUGL_TIMER, 0, userInfo.unsignedLongValue};
PuglEvent timerEvent;
timerEvent.timer = ev;
@@ -1214,7 +1214,7 @@ dispatchClientEvent(PuglWorld* world, NSEvent* ev)
PuglView* view = world->views[i];
PuglWrapperView* wrapper = view->impl->wrapperView;
if ([wrapper window] == win && NSPointInRect(loc, [wrapper frame])) {
- const PuglEventClient event = {
+ const PuglClientEvent event = {
PUGL_CLIENT, 0, (uintptr_t)[ev data1], (uintptr_t)[ev data2]};
PuglEvent clientEvent;
diff --git a/src/mac_cairo.m b/src/mac_cairo.m
index 1c564a0..59e4bc1 100644
--- a/src/mac_cairo.m
+++ b/src/mac_cairo.m
@@ -90,7 +90,7 @@ puglMacCairoDestroy(PuglView* view)
}
static PuglStatus
-puglMacCairoEnter(PuglView* view, const PuglEventExpose* expose)
+puglMacCairoEnter(PuglView* view, const PuglExposeEvent* expose)
{
PuglCairoView* const drawView = (PuglCairoView*)view->impl->drawView;
if (!expose) {
@@ -118,7 +118,7 @@ puglMacCairoEnter(PuglView* view, const PuglEventExpose* expose)
}
static PuglStatus
-puglMacCairoLeave(PuglView* view, const PuglEventExpose* expose)
+puglMacCairoLeave(PuglView* view, const PuglExposeEvent* expose)
{
PuglCairoView* const drawView = (PuglCairoView*)view->impl->drawView;
if (!expose) {
diff --git a/src/mac_gl.m b/src/mac_gl.m
index 24d3846..039dbbf 100644
--- a/src/mac_gl.m
+++ b/src/mac_gl.m
@@ -145,7 +145,7 @@ puglMacGlDestroy(PuglView* view)
}
static PuglStatus
-puglMacGlEnter(PuglView* view, const PuglEventExpose* PUGL_UNUSED(expose))
+puglMacGlEnter(PuglView* view, const PuglExposeEvent* PUGL_UNUSED(expose))
{
PuglOpenGLView* const drawView = (PuglOpenGLView*)view->impl->drawView;
@@ -154,7 +154,7 @@ puglMacGlEnter(PuglView* view, const PuglEventExpose* PUGL_UNUSED(expose))
}
static PuglStatus
-puglMacGlLeave(PuglView* view, const PuglEventExpose* expose)
+puglMacGlLeave(PuglView* view, const PuglExposeEvent* expose)
{
PuglOpenGLView* const drawView = (PuglOpenGLView*)view->impl->drawView;
diff --git a/src/stub.h b/src/stub.h
index 8b864da..4ade84c 100644
--- a/src/stub.h
+++ b/src/stub.h
@@ -45,7 +45,7 @@ puglStubDestroy(PuglView* const view)
}
static inline PuglStatus
-puglStubEnter(PuglView* const view, const PuglEventExpose* const expose)
+puglStubEnter(PuglView* const view, const PuglExposeEvent* const expose)
{
(void)view;
(void)expose;
@@ -53,7 +53,7 @@ puglStubEnter(PuglView* const view, const PuglEventExpose* const expose)
}
static inline PuglStatus
-puglStubLeave(PuglView* const view, const PuglEventExpose* const expose)
+puglStubLeave(PuglView* const view, const PuglExposeEvent* const expose)
{
(void)view;
(void)expose;
diff --git a/src/types.h b/src/types.h
index a618e8c..1f82486 100644
--- a/src/types.h
+++ b/src/types.h
@@ -59,7 +59,7 @@ struct PuglViewImpl {
PuglNativeView parent;
uintptr_t transientParent;
PuglRect frame;
- PuglEventConfigure lastConfigure;
+ PuglConfigureEvent lastConfigure;
PuglHints hints;
int defaultWidth;
int defaultHeight;
@@ -99,10 +99,10 @@ struct PuglBackendImpl {
PuglStatus (*destroy)(PuglView*);
/// Enter drawing context, for drawing if expose is non-null
- PuglStatus (*enter)(PuglView*, const PuglEventExpose*);
+ PuglStatus (*enter)(PuglView*, const PuglExposeEvent*);
/// Leave drawing context, after drawing if expose is non-null
- PuglStatus (*leave)(PuglView*, const PuglEventExpose*);
+ PuglStatus (*leave)(PuglView*, const PuglExposeEvent*);
/// Return the puglGetContext() handle for the application, if any
void* (*getContext)(PuglView*);
diff --git a/src/win.c b/src/win.c
index 0510536..190a87c 100644
--- a/src/win.c
+++ b/src/win.c
@@ -399,7 +399,7 @@ puglDecodeUTF16(const wchar_t* buf, const int len)
}
static void
-initKeyEvent(PuglEventKey* event,
+initKeyEvent(PuglKeyEvent* event,
PuglView* view,
bool press,
WPARAM wParam,
@@ -506,7 +506,7 @@ handleCrossing(PuglView* view, const PuglEventType type, POINT pos)
POINT root_pos = pos;
ClientToScreen(view->impl->hwnd, &root_pos);
- const PuglEventCrossing ev = {
+ const PuglCrossingEvent ev = {
type,
0,
GetMessageTime() / 1e3,
@@ -1270,7 +1270,7 @@ puglWinConfigure(PuglView* view)
}
PuglStatus
-puglWinEnter(PuglView* view, const PuglEventExpose* expose)
+puglWinEnter(PuglView* view, const PuglExposeEvent* expose)
{
if (expose) {
PAINTSTRUCT ps;
@@ -1281,7 +1281,7 @@ puglWinEnter(PuglView* view, const PuglEventExpose* expose)
}
PuglStatus
-puglWinLeave(PuglView* view, const PuglEventExpose* expose)
+puglWinLeave(PuglView* view, const PuglExposeEvent* expose)
{
if (expose) {
PAINTSTRUCT ps;
diff --git a/src/win.h b/src/win.h
index cf6e19b..fcd92df 100644
--- a/src/win.h
+++ b/src/win.h
@@ -59,10 +59,10 @@ puglWinConfigure(PuglView* view);
PUGL_API
PuglStatus
-puglWinEnter(PuglView* view, const PuglEventExpose* expose);
+puglWinEnter(PuglView* view, const PuglExposeEvent* expose);
PUGL_API
PuglStatus
-puglWinLeave(PuglView* view, const PuglEventExpose* expose);
+puglWinLeave(PuglView* view, const PuglExposeEvent* expose);
#endif // PUGL_DETAIL_WIN_H
diff --git a/src/win_cairo.c b/src/win_cairo.c
index c9b9703..abb06f5 100644
--- a/src/win_cairo.c
+++ b/src/win_cairo.c
@@ -117,7 +117,7 @@ puglWinCairoDestroy(PuglView* view)
}
static PuglStatus
-puglWinCairoEnter(PuglView* view, const PuglEventExpose* expose)
+puglWinCairoEnter(PuglView* view, const PuglExposeEvent* expose)
{
PuglStatus st = PUGL_SUCCESS;
@@ -131,7 +131,7 @@ puglWinCairoEnter(PuglView* view, const PuglEventExpose* expose)
}
static PuglStatus
-puglWinCairoLeave(PuglView* view, const PuglEventExpose* expose)
+puglWinCairoLeave(PuglView* view, const PuglExposeEvent* expose)
{
PuglInternals* const impl = view->impl;
PuglWinCairoSurface* const surface = (PuglWinCairoSurface*)impl->surface;
diff --git a/src/win_gl.c b/src/win_gl.c
index 1fda81a..529493f 100644
--- a/src/win_gl.c
+++ b/src/win_gl.c
@@ -266,7 +266,7 @@ puglWinGlDestroy(PuglView* view)
}
static PuglStatus
-puglWinGlEnter(PuglView* view, const PuglEventExpose* expose)
+puglWinGlEnter(PuglView* view, const PuglExposeEvent* expose)
{
PuglWinGlSurface* surface = (PuglWinGlSurface*)view->impl->surface;
@@ -281,7 +281,7 @@ puglWinGlEnter(PuglView* view, const PuglEventExpose* expose)
}
static PuglStatus
-puglWinGlLeave(PuglView* view, const PuglEventExpose* expose)
+puglWinGlLeave(PuglView* view, const PuglExposeEvent* expose)
{
if (expose) {
PAINTSTRUCT ps;
diff --git a/src/win_stub.c b/src/win_stub.c
index 6b0cb23..5ba4eb4 100644
--- a/src/win_stub.c
+++ b/src/win_stub.c
@@ -27,13 +27,13 @@ puglWinStubConfigure(PuglView* view)
}
static PuglStatus
-puglWinStubEnter(PuglView* view, const PuglEventExpose* expose)
+puglWinStubEnter(PuglView* view, const PuglExposeEvent* expose)
{
return puglWinEnter(view, expose);
}
static PuglStatus
-puglWinStubLeave(PuglView* view, const PuglEventExpose* expose)
+puglWinStubLeave(PuglView* view, const PuglExposeEvent* expose)
{
return puglWinLeave(view, expose);
}
diff --git a/src/x11.c b/src/x11.c
index bd7d808..c95edff 100644
--- a/src/x11.c
+++ b/src/x11.c
@@ -971,7 +971,7 @@ puglWaitForEvent(PuglView* const view)
#endif
static void
-mergeExposeEvents(PuglEventExpose* const dst, const PuglEventExpose* const src)
+mergeExposeEvents(PuglExposeEvent* const dst, const PuglExposeEvent* const src)
{
if (!dst->type) {
*dst = *src;
@@ -1253,7 +1253,7 @@ puglPostRedisplay(PuglView* const view)
PuglStatus
puglPostRedisplayRect(PuglView* const view, const PuglRect rect)
{
- const PuglEventExpose event = {
+ const PuglExposeEvent event = {
PUGL_EXPOSE, 0, rect.x, rect.y, rect.width, rect.height};
if (view->world->impl->dispatchingEvents) {
diff --git a/src/x11_cairo.c b/src/x11_cairo.c
index fa05bd1..6bb1254 100644
--- a/src/x11_cairo.c
+++ b/src/x11_cairo.c
@@ -93,7 +93,7 @@ puglX11CairoDestroy(PuglView* view)
}
static PuglStatus
-puglX11CairoEnter(PuglView* view, const PuglEventExpose* expose)
+puglX11CairoEnter(PuglView* view, const PuglExposeEvent* expose)
{
PuglInternals* const impl = view->impl;
PuglX11CairoSurface* const surface = (PuglX11CairoSurface*)impl->surface;
@@ -108,7 +108,7 @@ puglX11CairoEnter(PuglView* view, const PuglEventExpose* expose)
}
static PuglStatus
-puglX11CairoLeave(PuglView* view, const PuglEventExpose* expose)
+puglX11CairoLeave(PuglView* view, const PuglExposeEvent* expose)
{
PuglInternals* const impl = view->impl;
PuglX11CairoSurface* const surface = (PuglX11CairoSurface*)impl->surface;
diff --git a/src/x11_gl.c b/src/x11_gl.c
index 34152de..8c061cd 100644
--- a/src/x11_gl.c
+++ b/src/x11_gl.c
@@ -110,7 +110,7 @@ puglX11GlConfigure(PuglView* view)
}
static PuglStatus
-puglX11GlEnter(PuglView* view, const PuglEventExpose* PUGL_UNUSED(expose))
+puglX11GlEnter(PuglView* view, const PuglExposeEvent* PUGL_UNUSED(expose))
{
PuglX11GlSurface* surface = (PuglX11GlSurface*)view->impl->surface;
glXMakeCurrent(view->impl->display, view->impl->win, surface->ctx);
@@ -118,7 +118,7 @@ puglX11GlEnter(PuglView* view, const PuglEventExpose* PUGL_UNUSED(expose))
}
static PuglStatus
-puglX11GlLeave(PuglView* view, const PuglEventExpose* expose)
+puglX11GlLeave(PuglView* view, const PuglExposeEvent* expose)
{
if (expose && view->hints[PUGL_DOUBLE_BUFFER]) {
glXSwapBuffers(view->impl->display, view->impl->win);
diff --git a/test/test_cairo.c b/test/test_cairo.c
index 077b4c3..2e14121 100644
--- a/test/test_cairo.c
+++ b/test/test_cairo.c
@@ -36,7 +36,7 @@ typedef struct {
} PuglTest;
static void
-onExpose(PuglView* const view, const PuglEventExpose* const event)
+onExpose(PuglView* const view, const PuglExposeEvent* const event)
{
cairo_t* const cr = (cairo_t*)puglGetContext(view);
diff --git a/test/test_gl.c b/test/test_gl.c
index 297f81c..a339939 100644
--- a/test/test_gl.c
+++ b/test/test_gl.c
@@ -34,7 +34,7 @@ typedef struct {
} PuglTest;
static void
-onConfigure(PuglView* const view, const PuglEventConfigure* const event)
+onConfigure(PuglView* const view, const PuglConfigureEvent* const event)
{
(void)view;
@@ -48,7 +48,7 @@ onConfigure(PuglView* const view, const PuglEventConfigure* const event)
}
static void
-onExpose(PuglView* const view, const PuglEventExpose* const event)
+onExpose(PuglView* const view, const PuglExposeEvent* const event)
{
(void)view;
(void)event;
diff --git a/test/test_timer.c b/test/test_timer.c
index 69143a9..686a078 100644
--- a/test/test_timer.c
+++ b/test/test_timer.c
@@ -61,7 +61,7 @@ typedef struct {
} PuglTest;
static void
-onTimer(PuglView* const view, const PuglEventTimer* const event)
+onTimer(PuglView* const view, const PuglTimerEvent* const event)
{
PuglTest* const test = (PuglTest*)puglGetHandle(view);
const double time = puglGetTime(puglGetWorld(view));
diff --git a/test/test_vulkan.c b/test/test_vulkan.c
index 5ab6ab8..f0f582e 100644
--- a/test/test_vulkan.c
+++ b/test/test_vulkan.c
@@ -74,7 +74,7 @@ pushString(const char*** const array,
}
static void
-onExpose(PuglView* const view, const PuglEventExpose* const event)
+onExpose(PuglView* const view, const PuglExposeEvent* const event)
{
(void)view;
(void)event;