aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-05-03 10:28:41 -0400
committerDavid Robillard <d@drobilla.net>2023-05-03 10:38:23 -0400
commit4ded4f3b2ed4a28eba420c80d1be21f5b76f485c (patch)
tree6f07480c0dcff789370e93014e964ca051071908
parent7a1d0239a6eecf99532d9a1ce8859eec876a142e (diff)
downloadpugl-4ded4f3b2ed4a28eba420c80d1be21f5b76f485c.tar.gz
pugl-4ded4f3b2ed4a28eba420c80d1be21f5b76f485c.tar.bz2
pugl-4ded4f3b2ed4a28eba420c80d1be21f5b76f485c.zip
Fix mismatched types in ternary expressions
-rw-r--r--src/win.c23
-rw-r--r--src/x11.c11
2 files changed, 18 insertions, 16 deletions
diff --git a/src/win.c b/src/win.c
index 4abed87..bb5796c 100644
--- a/src/win.c
+++ b/src/win.c
@@ -450,11 +450,11 @@ static uint32_t
getModifiers(void)
{
// clang-format off
- return (((GetKeyState(VK_SHIFT) < 0) ? PUGL_MOD_SHIFT : 0U) |
- ((GetKeyState(VK_CONTROL) < 0) ? PUGL_MOD_CTRL : 0U) |
- ((GetKeyState(VK_MENU) < 0) ? PUGL_MOD_ALT : 0U) |
- ((GetKeyState(VK_LWIN) < 0) ? PUGL_MOD_SUPER : 0U) |
- ((GetKeyState(VK_RWIN) < 0) ? PUGL_MOD_SUPER : 0U));
+ return (((GetKeyState(VK_SHIFT) < 0) ? (uint32_t)PUGL_MOD_SHIFT : 0U) |
+ ((GetKeyState(VK_CONTROL) < 0) ? (uint32_t)PUGL_MOD_CTRL : 0U) |
+ ((GetKeyState(VK_MENU) < 0) ? (uint32_t)PUGL_MOD_ALT : 0U) |
+ ((GetKeyState(VK_LWIN) < 0) ? (uint32_t)PUGL_MOD_SUPER : 0U) |
+ ((GetKeyState(VK_RWIN) < 0) ? (uint32_t)PUGL_MOD_SUPER : 0U));
// clang-format on
}
@@ -614,12 +614,13 @@ handleConfigure(PuglView* view, PuglEvent* event)
event->configure.height = (PuglSpan)height;
event->configure.style =
- ((view->impl->mapped ? PUGL_VIEW_STYLE_MAPPED : 0U) |
- (view->resizing ? PUGL_VIEW_STYLE_RESIZING : 0U) |
- (view->impl->fullscreen ? PUGL_VIEW_STYLE_FULLSCREEN : 0U) |
- (view->impl->minimized ? PUGL_VIEW_STYLE_HIDDEN : 0U) |
- (view->impl->maximized ? (PUGL_VIEW_STYLE_TALL | PUGL_VIEW_STYLE_WIDE)
- : 0U));
+ ((view->impl->mapped ? (unsigned)PUGL_VIEW_STYLE_MAPPED : 0U) |
+ (view->resizing ? (unsigned)PUGL_VIEW_STYLE_RESIZING : 0U) |
+ (view->impl->fullscreen ? (unsigned)PUGL_VIEW_STYLE_FULLSCREEN : 0U) |
+ (view->impl->minimized ? (unsigned)PUGL_VIEW_STYLE_HIDDEN : 0U) |
+ (view->impl->maximized
+ ? (unsigned)(PUGL_VIEW_STYLE_TALL | PUGL_VIEW_STYLE_WIDE)
+ : 0U));
return rect;
}
diff --git a/src/x11.c b/src/x11.c
index 22c71d5..85c1296 100644
--- a/src/x11.c
+++ b/src/x11.c
@@ -848,7 +848,8 @@ translateKey(PuglView* const view, XEvent* const xevent, PuglEvent* const event)
const PuglKey special = keySymToSpecial(sym);
event->key.key =
- ((special || ufound <= 0) ? special : puglDecodeUTF8((const uint8_t*)ustr));
+ ((special || ufound <= 0) ? special
+ : (PuglKey)puglDecodeUTF8((const uint8_t*)ustr));
if (xevent->type == KeyPress && !filter && !special && view->impl->xic) {
// Lookup shifted key for possible text event
@@ -871,10 +872,10 @@ translateKey(PuglView* const view, XEvent* const xevent, PuglEvent* const event)
static uint32_t
translateModifiers(const unsigned xstate)
{
- return (((xstate & ShiftMask) ? PUGL_MOD_SHIFT : 0U) |
- ((xstate & ControlMask) ? PUGL_MOD_CTRL : 0U) |
- ((xstate & Mod1Mask) ? PUGL_MOD_ALT : 0U) |
- ((xstate & Mod4Mask) ? PUGL_MOD_SUPER : 0U));
+ return (((xstate & ShiftMask) ? (uint32_t)PUGL_MOD_SHIFT : 0U) |
+ ((xstate & ControlMask) ? (uint32_t)PUGL_MOD_CTRL : 0U) |
+ ((xstate & Mod1Mask) ? (uint32_t)PUGL_MOD_ALT : 0U) |
+ ((xstate & Mod4Mask) ? (uint32_t)PUGL_MOD_SUPER : 0U));
}
static PuglStatus