diff options
Diffstat (limited to 'pugl')
-rw-r--r-- | pugl/pugl.h | 16 | ||||
-rw-r--r-- | pugl/pugl_osx.m | 12 | ||||
-rw-r--r-- | pugl/pugl_win.cpp | 10 | ||||
-rw-r--r-- | pugl/pugl_x11.c | 4 |
4 files changed, 21 insertions, 21 deletions
diff --git a/pugl/pugl.h b/pugl/pugl.h index 34b2eb0..145f346 100644 --- a/pugl/pugl.h +++ b/pugl/pugl.h @@ -1,5 +1,5 @@ /* - Copyright 2012-2016 David Robillard <http://drobilla.net> + Copyright 2012-2019 David Robillard <http://drobilla.net> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -223,8 +223,8 @@ typedef struct { double y; /**< View-relative Y coordinate. */ double x_root; /**< Root-relative X coordinate. */ double y_root; /**< Root-relative Y coordinate. */ - unsigned state; /**< Bitwise OR of PuglMod flags. */ - unsigned button; /**< 1-relative button number. */ + uint32_t state; /**< Bitwise OR of PuglMod flags. */ + uint32_t button; /**< 1-relative button number. */ } PuglEventButton; /** @@ -293,8 +293,8 @@ typedef struct { double y; /**< View-relative Y coordinate. */ double x_root; /**< Root-relative X coordinate. */ double y_root; /**< Root-relative Y coordinate. */ - unsigned state; /**< Bitwise OR of PuglMod flags. */ - unsigned keycode; /**< Raw key code. */ + uint32_t state; /**< Bitwise OR of PuglMod flags. */ + uint32_t keycode; /**< Raw key code. */ uint32_t character; /**< Unicode character code, or 0. */ PuglKey special; /**< Special key, or 0. */ uint8_t utf8[8]; /**< UTF-8 string. */ @@ -313,7 +313,7 @@ typedef struct { double y; /**< View-relative Y coordinate. */ double x_root; /**< Root-relative X coordinate. */ double y_root; /**< Root-relative Y coordinate. */ - unsigned state; /**< Bitwise OR of PuglMod flags. */ + uint32_t state; /**< Bitwise OR of PuglMod flags. */ PuglCrossingMode mode; /**< Reason for crossing. */ } PuglEventCrossing; @@ -329,7 +329,7 @@ typedef struct { double y; /**< View-relative Y coordinate. */ double x_root; /**< Root-relative X coordinate. */ double y_root; /**< Root-relative Y coordinate. */ - unsigned state; /**< Bitwise OR of PuglMod flags. */ + uint32_t state; /**< Bitwise OR of PuglMod flags. */ bool is_hint; /**< True iff this event is a motion hint. */ bool focus; /**< True iff this is the focused window. */ } PuglEventMotion; @@ -352,7 +352,7 @@ typedef struct { double y; /**< View-relative Y coordinate. */ double x_root; /**< Root-relative X coordinate. */ double y_root; /**< Root-relative Y coordinate. */ - unsigned state; /**< Bitwise OR of PuglMod flags. */ + uint32_t state; /**< Bitwise OR of PuglMod flags. */ double dx; /**< Scroll X distance in lines. */ double dy; /**< Scroll Y distance in lines. */ } PuglEventScroll; diff --git a/pugl/pugl_osx.m b/pugl/pugl_osx.m index 39be7f0..12905d3 100644 --- a/pugl/pugl_osx.m +++ b/pugl/pugl_osx.m @@ -37,7 +37,7 @@ struct PuglInternalsImpl { PuglOpenGLView* glview; id window; NSEvent* nextEvent; - unsigned mods; + uint32_t mods; #ifdef PUGL_HAVE_CAIRO cairo_surface_t* surface; cairo_t* cr; @@ -233,12 +233,12 @@ struct PuglInternalsImpl { return YES; } -static unsigned +static uint32_t getModifiers(PuglView* view, NSEvent* ev) { const unsigned modifierFlags = [ev modifierFlags]; - unsigned mods = 0; + uint32_t mods = 0; mods |= (modifierFlags & NSShiftKeyMask) ? PUGL_MOD_SHIFT : 0; mods |= (modifierFlags & NSControlKeyMask) ? PUGL_MOD_CTRL : 0; mods |= (modifierFlags & NSAlternateKeyMask) ? PUGL_MOD_ALT : 0; @@ -359,7 +359,7 @@ keySymToSpecial(PuglView* view, NSEvent* ev) rloc.x, [[NSScreen mainScreen] frame].size.height - rloc.y, getModifiers(puglview, event), - (unsigned)[event buttonNumber] + 1 + (uint32_t)[event buttonNumber] + 1 }; puglDispatchEvent(puglview, (PuglEvent*)&ev); } @@ -378,7 +378,7 @@ keySymToSpecial(PuglView* view, NSEvent* ev) rloc.x, [[NSScreen mainScreen] frame].size.height - rloc.y, getModifiers(puglview, event), - (unsigned)[event buttonNumber] + 1 + (uint32_t)[event buttonNumber] + 1 }; puglDispatchEvent(puglview, (PuglEvent*)&ev); [self updateTrackingAreas]; @@ -486,7 +486,7 @@ keySymToSpecial(PuglView* view, NSEvent* ev) - (void) flagsChanged:(NSEvent*)event { - const unsigned mods = getModifiers(puglview, event); + const uint32_t mods = getModifiers(puglview, event); PuglEventType type = PUGL_NOTHING; PuglKey special = 0; diff --git a/pugl/pugl_win.cpp b/pugl/pugl_win.cpp index 048c0c3..b5c4e10 100644 --- a/pugl/pugl_win.cpp +++ b/pugl/pugl_win.cpp @@ -268,10 +268,10 @@ keySymToSpecial(int sym) return (PuglKey)0; } -static unsigned int +static uint32_t getModifiers() { - unsigned int mods = 0; + uint32_t mods = 0; mods |= (GetKeyState(VK_SHIFT) < 0) ? PUGL_MOD_SHIFT : 0; mods |= (GetKeyState(VK_CONTROL) < 0) ? PUGL_MOD_CTRL : 0; mods |= (GetKeyState(VK_MENU) < 0) ? PUGL_MOD_ALT : 0; @@ -323,10 +323,10 @@ initScrollEvent(PuglEvent* event, PuglView* view, LPARAM lParam, WPARAM wParam) event->scroll.dy = 0; } -static unsigned int +static uint32_t utf16_to_code_point(const wchar_t* input, size_t input_size) { - unsigned int code_unit = *input; + uint32_t code_unit = *input; // Equiv. range check between 0xD800 to 0xDBFF inclusive if ((code_unit & 0xFC00) == 0xD800) { if (input_size < 2) { @@ -334,7 +334,7 @@ utf16_to_code_point(const wchar_t* input, size_t input_size) return 0xFFFD; // replacement character } - unsigned int code_unit_2 = *++input; + uint32_t code_unit_2 = *++input; // Equiv. range check between 0xDC00 to 0xDFFF inclusive if ((code_unit_2 & 0xFC00) == 0xDC00) { return (code_unit << 10) + code_unit_2 - 0x35FDC00; diff --git a/pugl/pugl_x11.c b/pugl/pugl_x11.c index 6315759..6563805 100644 --- a/pugl/pugl_x11.c +++ b/pugl/pugl_x11.c @@ -275,10 +275,10 @@ translateKey(PuglView* view, XEvent* xevent, PuglEvent* event) event->key.keycode = xevent->xkey.keycode; } -static unsigned +static uint32_t translateModifiers(unsigned xstate) { - unsigned state = 0; + uint32_t state = 0; state |= (xstate & ShiftMask) ? PUGL_MOD_SHIFT : 0; state |= (xstate & ControlMask) ? PUGL_MOD_CTRL : 0; state |= (xstate & Mod1Mask) ? PUGL_MOD_ALT : 0; |