aboutsummaryrefslogtreecommitdiffstats
path: root/pugl
diff options
context:
space:
mode:
Diffstat (limited to 'pugl')
-rw-r--r--pugl/detail/mac.m6
-rw-r--r--pugl/detail/win.c6
-rw-r--r--pugl/detail/x11.c6
-rw-r--r--pugl/pugl.h41
4 files changed, 34 insertions, 25 deletions
diff --git a/pugl/detail/mac.m b/pugl/detail/mac.m
index 8a0f0c2..bd1fdcf 100644
--- a/pugl/detail/mac.m
+++ b/pugl/detail/mac.m
@@ -271,12 +271,12 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
- (void) mouseEntered:(NSEvent*)event
{
- handleCrossing(self, event, PUGL_ENTER_NOTIFY);
+ handleCrossing(self, event, PUGL_POINTER_IN);
}
- (void) mouseExited:(NSEvent*)event
{
- handleCrossing(self, event, PUGL_LEAVE_NOTIFY);
+ handleCrossing(self, event, PUGL_POINTER_OUT);
}
- (void) mouseMoved:(NSEvent*)event
@@ -284,7 +284,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
const NSPoint wloc = [self eventLocation:event];
const NSPoint rloc = [NSEvent mouseLocation];
const PuglEventMotion ev = {
- PUGL_MOTION_NOTIFY,
+ PUGL_MOTION,
0,
[event timestamp],
wloc.x,
diff --git a/pugl/detail/win.c b/pugl/detail/win.c
index 7678607..4606d60 100644
--- a/pugl/detail/win.c
+++ b/pugl/detail/win.c
@@ -617,12 +617,12 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam)
tme.hwndTrack = view->impl->hwnd;
TrackMouseEvent(&tme);
- handleCrossing(view, PUGL_ENTER_NOTIFY, pt);
+ handleCrossing(view, PUGL_POINTER_IN, pt);
view->impl->mouseTracked = true;
}
ClientToScreen(view->impl->hwnd, &pt);
- event.motion.type = PUGL_MOTION_NOTIFY;
+ event.motion.type = PUGL_MOTION;
event.motion.time = GetMessageTime() / 1e3;
event.motion.x = GET_X_LPARAM(lParam);
event.motion.y = GET_Y_LPARAM(lParam);
@@ -634,7 +634,7 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam)
case WM_MOUSELEAVE:
GetCursorPos(&pt);
ScreenToClient(view->impl->hwnd, &pt);
- handleCrossing(view, PUGL_LEAVE_NOTIFY, pt);
+ handleCrossing(view, PUGL_POINTER_OUT, pt);
view->impl->mouseTracked = false;
break;
case WM_LBUTTONDOWN:
diff --git a/pugl/detail/x11.c b/pugl/detail/x11.c
index 9613dfb..1511b7b 100644
--- a/pugl/detail/x11.c
+++ b/pugl/detail/x11.c
@@ -493,7 +493,7 @@ translateEvent(PuglView* view, XEvent xevent)
event.expose.count = xevent.xexpose.count;
break;
case MotionNotify:
- event.type = PUGL_MOTION_NOTIFY;
+ event.type = PUGL_MOTION;
event.motion.time = xevent.xmotion.time / 1e3;
event.motion.x = xevent.xmotion.x;
event.motion.y = xevent.xmotion.y;
@@ -552,8 +552,8 @@ translateEvent(PuglView* view, XEvent xevent)
case EnterNotify:
case LeaveNotify:
event.type = ((xevent.type == EnterNotify)
- ? PUGL_ENTER_NOTIFY
- : PUGL_LEAVE_NOTIFY);
+ ? PUGL_POINTER_IN
+ : PUGL_POINTER_OUT);
event.crossing.time = xevent.xcrossing.time / 1e3;
event.crossing.x = xevent.xcrossing.x;
event.crossing.y = xevent.xcrossing.y;
diff --git a/pugl/pugl.h b/pugl/pugl.h
index 8e20f35..0d0f3b6 100644
--- a/pugl/pugl.h
+++ b/pugl/pugl.h
@@ -42,6 +42,16 @@
# define PUGL_API
#endif
+#ifndef PUGL_DISABLE_DEPRECATED
+# if defined(__clang__)
+# define PUGL_DEPRECATED_BY(rep) __attribute__((deprecated("", rep)))
+# elif defined(__GNUC__)
+# define PUGL_DEPRECATED_BY(rep) __attribute__((deprecated("Use " rep)))
+# else
+# define PUGL_DEPRECATED_BY(rep)
+# endif
+#endif
+
#ifdef __cplusplus
# define PUGL_BEGIN_DECLS extern "C" {
# define PUGL_END_DECLS }
@@ -179,14 +189,21 @@ typedef enum {
PUGL_KEY_PRESS, ///< Key pressed, a #PuglEventKey
PUGL_KEY_RELEASE, ///< Key released, a #PuglEventKey
PUGL_TEXT, ///< Character entered, a #PuglEventText
- PUGL_ENTER_NOTIFY, ///< Pointer entered view, a #PuglEventCrossing
- PUGL_LEAVE_NOTIFY, ///< Pointer left view, a #PuglEventCrossing
- PUGL_MOTION_NOTIFY, ///< Pointer moved, a #PuglEventMotion
+ PUGL_POINTER_IN, ///< Pointer entered view, a #PuglEventCrossing
+ PUGL_POINTER_OUT, ///< Pointer left view, a #PuglEventCrossing
+ PUGL_MOTION, ///< Pointer moved, a #PuglEventMotion
PUGL_SCROLL, ///< Scrolled, a #PuglEventScroll
PUGL_FOCUS_IN, ///< Keyboard focus entered view, a #PuglEventFocus
PUGL_FOCUS_OUT, ///< Keyboard focus left view, a #PuglEventFocus
PUGL_CLIENT, ///< Custom client message, a #PuglEventClient
- PUGL_TIMER ///< Timer triggered, a #PuglEventTimer
+ PUGL_TIMER, ///< Timer triggered, a #PuglEventTimer
+
+#ifndef PUGL_DISABLE_DEPRECATED
+ PUGL_ENTER_NOTIFY PUGL_DEPRECATED_BY("PUGL_POINTER_IN") = PUGL_POINTER_IN,
+ PUGL_LEAVE_NOTIFY PUGL_DEPRECATED_BY("PUGL_POINTER_OUT") = PUGL_POINTER_OUT,
+ PUGL_MOTION_NOTIFY PUGL_DEPRECATED_BY("PUGL_MOTION") = PUGL_MOTION,
+#endif
+
} PuglEventType;
/**
@@ -330,7 +347,7 @@ typedef struct {
window edge), as described by the #mode field.
*/
typedef struct {
- PuglEventType type; ///< #PUGL_ENTER_NOTIFY or #PUGL_LEAVE_NOTIFY
+ PuglEventType type; ///< #PUGL_POINTER_IN or #PUGL_POINTER_OUT
PuglEventFlags flags; ///< Bitwise OR of #PuglEventFlag values
double time; ///< Time in seconds
double x; ///< View-relative X coordinate
@@ -345,7 +362,7 @@ typedef struct {
Pointer motion event.
*/
typedef struct {
- PuglEventType type; ///< #PUGL_MOTION_NOTIFY
+ PuglEventType type; ///< #PUGL_MOTION
PuglEventFlags flags; ///< Bitwise OR of #PuglEventFlag values
double time; ///< Time in seconds
double x; ///< View-relative X coordinate
@@ -440,8 +457,8 @@ typedef union {
PuglEventExpose expose; ///< #PUGL_EXPOSE
PuglEventKey key; ///< #PUGL_KEY_PRESS, #PUGL_KEY_RELEASE
PuglEventText text; ///< #PUGL_TEXT
- PuglEventCrossing crossing; ///< #PUGL_ENTER_NOTIFY, #PUGL_LEAVE_NOTIFY
- PuglEventMotion motion; ///< #PUGL_MOTION_NOTIFY
+ 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
@@ -1114,14 +1131,6 @@ puglSendEvent(PuglView* view, const PuglEvent* event);
@{
*/
-#if defined(__clang__)
-# define PUGL_DEPRECATED_BY(name) __attribute__((deprecated("", name)))
-#elif defined(__GNUC__)
-# define PUGL_DEPRECATED_BY(name) __attribute__((deprecated("Use " name)))
-#else
-# define PUGL_DEPRECATED_BY(name)
-#endif
-
/**
Create a Pugl application and view.