aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2025-02-01 02:00:09 -0500
committerDavid Robillard <d@drobilla.net>2025-02-01 02:00:09 -0500
commit7e6440ac9b44de40def9ff9711e34f4f4c826896 (patch)
tree59d46db4fb38f96c08c5a72f096c1ed52d443d65 /src
parente266f484e231bbad5399323cde97199e2a3d2da3 (diff)
downloadpugl-7e6440ac9b44de40def9ff9711e34f4f4c826896.tar.gz
pugl-7e6440ac9b44de40def9ff9711e34f4f4c826896.tar.bz2
pugl-7e6440ac9b44de40def9ff9711e34f4f4c826896.zip
Consistently use unsigned literals for event flags
Diffstat (limited to 'src')
-rw-r--r--src/internal.c2
-rw-r--r--src/mac.m32
-rw-r--r--src/win.c12
-rw-r--r--src/x11.c18
4 files changed, 32 insertions, 32 deletions
diff --git a/src/internal.c b/src/internal.c
index 38a595a..36152c1 100644
--- a/src/internal.c
+++ b/src/internal.c
@@ -247,7 +247,7 @@ puglDispatchSimpleEvent(PuglView* view, const PuglEventType type)
type == PUGL_UPDATE || type == PUGL_CLOSE || type == PUGL_LOOP_ENTER ||
type == PUGL_LOOP_LEAVE);
- const PuglEvent event = {{type, 0}};
+ const PuglEvent event = {{type, 0U}};
return puglDispatchEvent(view, &event);
}
diff --git a/src/mac.m b/src/mac.m
index 5f9d71e..74241d6 100644
--- a/src/mac.m
+++ b/src/mac.m
@@ -200,7 +200,7 @@ dispatchCurrentChildViewConfiguration(PuglView* const view)
const PuglConfigureEvent ev = {
PUGL_CONFIGURE,
- 0,
+ 0U,
(PuglCoord)framePx.origin.x,
(PuglCoord)framePx.origin.y,
(PuglSpan)framePx.size.width,
@@ -250,7 +250,7 @@ dispatchCurrentChildViewConfiguration(PuglView* const view)
const PuglConfigureEvent ev = {
PUGL_CONFIGURE,
- 0,
+ 0U,
(PuglCoord)contentPx.origin.x,
(PuglCoord)(screenHeight - contentPx.origin.y - contentPx.size.height),
(PuglSpan)contentPx.size.width,
@@ -332,7 +332,7 @@ dispatchCurrentChildViewConfiguration(PuglView* const view)
const PuglExposeEvent ev = {
PUGL_EXPOSE,
- 0,
+ 0U,
(PuglCoord)(rect.origin.x * scaleFactor),
(PuglCoord)viewY,
(PuglSpan)(rect.size.width * scaleFactor),
@@ -497,7 +497,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
const NSPoint rloc = [NSEvent mouseLocation];
const PuglCrossingEvent ev = {
type,
- 0,
+ 0U,
[event timestamp],
wloc.x,
wloc.y,
@@ -538,7 +538,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
const NSPoint rloc = [NSEvent mouseLocation];
const PuglMotionEvent ev = {
PUGL_MOTION,
- 0,
+ 0U,
[event timestamp],
wloc.x,
wloc.y,
@@ -573,7 +573,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
const NSPoint rloc = [NSEvent mouseLocation];
const PuglButtonEvent ev = {
PUGL_BUTTON_PRESS,
- 0,
+ 0U,
[event timestamp],
wloc.x,
wloc.y,
@@ -594,7 +594,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
const NSPoint rloc = [NSEvent mouseLocation];
const PuglButtonEvent ev = {
PUGL_BUTTON_RELEASE,
- 0,
+ 0U,
[event timestamp],
wloc.x,
wloc.y,
@@ -653,7 +653,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
const PuglScrollEvent ev = {
PUGL_SCROLL,
- 0,
+ 0U,
[event timestamp],
wloc.x,
wloc.y,
@@ -685,7 +685,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
const PuglKeyEvent ev = {
PUGL_KEY_PRESS,
- 0,
+ 0U,
[event timestamp],
wloc.x,
wloc.y,
@@ -716,7 +716,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
const PuglKeyEvent ev = {
PUGL_KEY_RELEASE,
- 0,
+ 0U,
[event timestamp],
wloc.x,
wloc.y,
@@ -828,7 +828,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
PuglTextEvent ev = {
PUGL_TEXT,
- 0,
+ 0U,
[event timestamp],
wloc.x,
wloc.y,
@@ -878,7 +878,7 @@ flagDiffers(const uint32_t lhs, const uint32_t rhs, const uint32_t mask)
const bool release = [event type] == NSEventTypeKeyUp;
const PuglKeyEvent ev = {release ? PUGL_KEY_RELEASE : PUGL_KEY_PRESS,
- 0,
+ 0U,
[event timestamp],
wloc.x,
wloc.y,
@@ -920,7 +920,7 @@ flagDiffers(const uint32_t lhs, const uint32_t rhs, const uint32_t mask)
- (void)timerTick:(NSTimer*)userTimer
{
const NSNumber* userInfo = userTimer.userInfo;
- const PuglTimerEvent ev = {PUGL_TIMER, 0, userInfo.unsignedLongValue};
+ const PuglTimerEvent ev = {PUGL_TIMER, 0U, userInfo.unsignedLongValue};
PuglEvent timerEvent;
timerEvent.timer = ev;
@@ -985,7 +985,7 @@ flagDiffers(const uint32_t lhs, const uint32_t rhs, const uint32_t mask)
{
(void)notification;
- PuglEvent ev = {{PUGL_FOCUS_IN, 0}};
+ PuglEvent ev = {{PUGL_FOCUS_IN, 0U}};
ev.focus.mode = PUGL_CROSSING_NORMAL;
puglDispatchEvent(window->puglview, &ev);
}
@@ -994,7 +994,7 @@ flagDiffers(const uint32_t lhs, const uint32_t rhs, const uint32_t mask)
{
(void)notification;
- PuglEvent ev = {{PUGL_FOCUS_OUT, 0}};
+ PuglEvent ev = {{PUGL_FOCUS_OUT, 0U}};
ev.focus.mode = PUGL_CROSSING_NORMAL;
puglDispatchEvent(window->puglview, &ev);
}
@@ -1873,7 +1873,7 @@ puglPaste(PuglView* const view)
{
const PuglDataOfferEvent offer = {
PUGL_DATA_OFFER,
- 0,
+ 0U,
puglGetTime(view->world),
};
diff --git a/src/win.c b/src/win.c
index 129c780..99f47fb 100644
--- a/src/win.c
+++ b/src/win.c
@@ -675,7 +675,7 @@ handleCrossing(PuglView* view, const PuglEventType type, POINT pos)
const PuglCrossingEvent ev = {
type,
- 0,
+ 0U,
GetMessageTime() / 1e3,
(double)pos.x,
(double)pos.y,
@@ -685,7 +685,7 @@ handleCrossing(PuglView* view, const PuglEventType type, POINT pos)
PUGL_CROSSING_NORMAL,
};
- PuglEvent crossingEvent = {{type, 0}};
+ PuglEvent crossingEvent = {{type, 0U}};
crossingEvent.crossing = ev;
puglDispatchEvent(view, &crossingEvent);
}
@@ -735,7 +735,7 @@ constrainAspect(const PuglView* const view,
static LRESULT
handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam)
{
- PuglEvent event = {{PUGL_NOTHING, 0}};
+ PuglEvent event = {{PUGL_NOTHING, 0U}};
RECT rect = {0, 0, 0, 0};
POINT pt = {0, 0};
MINMAXINFO* mmi = NULL;
@@ -797,7 +797,7 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam)
break;
case WM_TIMER:
if (wParam >= PUGL_USER_TIMER_MIN) {
- PuglEvent ev = {{PUGL_TIMER, 0}};
+ PuglEvent ev = {{PUGL_TIMER, 0U}};
ev.timer.id = wParam - PUGL_USER_TIMER_MIN;
puglDispatchEvent(view, &ev);
}
@@ -1393,7 +1393,7 @@ puglAcceptOffer(PuglView* const view,
const PuglDataEvent data = {
PUGL_DATA,
- 0,
+ 0U,
GetMessageTime() / 1e3,
0,
};
@@ -1498,7 +1498,7 @@ puglPaste(PuglView* const view)
{
const PuglDataOfferEvent offer = {
PUGL_DATA_OFFER,
- 0,
+ 0U,
GetMessageTime() / 1e3,
};
diff --git a/src/x11.c b/src/x11.c
index f60528b..b8e042c 100644
--- a/src/x11.c
+++ b/src/x11.c
@@ -1000,7 +1000,7 @@ translateClientMessage(PuglView* const view, XClientMessageEvent message)
{
Display* const display = view->world->impl->display;
const PuglX11Atoms* const atoms = &view->world->impl->atoms;
- PuglEvent event = {{PUGL_NOTHING, 0}};
+ PuglEvent event = {{PUGL_NOTHING, 0U}};
if (message.message_type == atoms->WM_PROTOCOLS) {
const Atom protocol = (Atom)message.data.l[0];
@@ -1083,7 +1083,7 @@ getCurrentConfiguration(PuglView* const view)
}
// Build a configure event based on the current window configuration
- PuglEvent configureEvent = {{PUGL_CONFIGURE, 0}};
+ PuglEvent configureEvent = {{PUGL_CONFIGURE, 0U}};
configureEvent.configure.x = (PuglCoord)x;
configureEvent.configure.y = (PuglCoord)y;
configureEvent.configure.width = (PuglSpan)attrs.width;
@@ -1114,7 +1114,7 @@ translatePropertyNotify(PuglView* const view, XPropertyEvent message)
{
const PuglInternals* const impl = view->impl;
const PuglX11Atoms* const atoms = &view->world->impl->atoms;
- PuglEvent event = {{PUGL_NOTHING, 0}};
+ PuglEvent event = {{PUGL_NOTHING, 0U}};
if (message.atom == atoms->NET_WM_STATE) {
// Get all the current states set in the window hints
@@ -1164,7 +1164,7 @@ translatePropertyNotify(PuglView* const view, XPropertyEvent message)
static PuglEvent
translateEvent(PuglView* const view, XEvent xevent)
{
- PuglEvent event = {{PUGL_NOTHING, 0}};
+ PuglEvent event = {{PUGL_NOTHING, 0U}};
event.any.flags = xevent.xany.send_event ? PUGL_IS_SEND_EVENT : 0;
switch (xevent.type) {
@@ -1586,7 +1586,7 @@ handleSelectionNotify(const PuglWorld* const world,
Display* const display = view->world->impl->display;
const Atom selection = event->selection;
PuglX11Clipboard* const board = getX11SelectionClipboard(view, selection);
- PuglEvent puglEvent = {{PUGL_NOTHING, 0}};
+ PuglEvent puglEvent = {{PUGL_NOTHING, 0U}};
if (event->target == atoms->TARGETS) {
// Notification of available datatypes
@@ -1596,7 +1596,7 @@ handleSelectionNotify(const PuglWorld* const world,
view, event->requestor, event->property, &numFormats, &formats) &&
!setClipboardFormats(view, board, numFormats, formats)) {
const PuglDataOfferEvent offer = {
- PUGL_DATA_OFFER, 0, (double)event->time / 1e3};
+ PUGL_DATA_OFFER, 0U, (double)event->time / 1e3};
puglEvent.offer = offer;
board->acceptedFormatIndex = UINT32_MAX;
@@ -1727,7 +1727,7 @@ handleTimerEvent(PuglWorld* const world, const XEvent xevent)
for (size_t i = 0; i < world->impl->numTimers; ++i) {
if (world->impl->timers[i].alarm == notify->alarm) {
- PuglEvent event = {{PUGL_TIMER, 0}};
+ PuglEvent event = {{PUGL_TIMER, 0U}};
event.timer.id = world->impl->timers[i].id;
puglDispatchEvent(world->impl->timers[i].view, &event);
}
@@ -1899,14 +1899,14 @@ puglObscureRegion(PuglView* const view,
const PuglSpan cw = MIN(view->lastConfigure.width, (PuglSpan)width);
const PuglSpan ch = MIN(view->lastConfigure.height, (PuglSpan)height);
- const PuglExposeEvent event = {PUGL_EXPOSE, 0, cx, cy, cw, ch};
+ const PuglExposeEvent event = {PUGL_EXPOSE, 0U, cx, cy, cw, ch};
if (view->world->impl->dispatchingEvents) {
// Currently dispatching events, add/expand expose for the loop end
mergeExposeEvents(&view->impl->pendingExpose.expose, &event);
} else if (view->impl->win) {
// Not dispatching events, send an X expose so we wake up next time
- PuglEvent exposeEvent = {{PUGL_EXPOSE, 0}};
+ PuglEvent exposeEvent = {{PUGL_EXPOSE, 0U}};
exposeEvent.expose = event;
return puglSendEvent(view, &exposeEvent);
}