aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/meson.build7
-rw-r--r--meson/suppressions/meson.build1
-rw-r--r--src/win.c27
-rw-r--r--test/meson.build7
4 files changed, 30 insertions, 12 deletions
diff --git a/examples/meson.build b/examples/meson.build
index aa04e80..0c4f998 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -61,6 +61,13 @@ if get_option('warning_level') == 'everything' and is_variable('cpp')
'-Wno-old-style-cast',
'-Wno-switch-enum',
]
+ if host_machine.system() == 'windows'
+ example_cpp_args += [
+ '-Wno-deprecated-declarations',
+ '-Wno-format-nonliteral',
+ '-Wno-nonportable-system-include-path',
+ ]
+ endif
elif cpp.get_id() == 'gcc'
example_cpp_args += [
'-Wno-effc++',
diff --git a/meson/suppressions/meson.build b/meson/suppressions/meson.build
index 1e96de2..1f7171a 100644
--- a/meson/suppressions/meson.build
+++ b/meson/suppressions/meson.build
@@ -30,6 +30,7 @@ if cc.get_id() == 'clang'
if host_machine.system() == 'windows'
c_suppressions += [
+ '-Wno-cast-function-type',
'-Wno-deprecated-declarations',
'-Wno-format-nonliteral',
'-Wno-nonportable-system-include-path',
diff --git a/src/win.c b/src/win.c
index 73c8583..386ad3f 100644
--- a/src/win.c
+++ b/src/win.c
@@ -426,7 +426,7 @@ keyInRange(const WPARAM winSym,
const PuglKey puglMin)
{
return (winSym >= winMin && winSym <= winMax)
- ? (PuglKey)(puglMin + (winSym - winMin))
+ ? (PuglKey)((WPARAM)puglMin + (winSym - winMin))
: (PuglKey)0;
}
@@ -485,20 +485,23 @@ keySymToSpecial(const WPARAM sym, const bool ext)
return (PuglKey)0;
}
+static bool
+is_toggled(int vkey)
+{
+ return (unsigned)GetKeyState(vkey) & 1U;
+}
+
static uint32_t
getModifiers(void)
{
- // clang-format off
- 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) |
- ((GetKeyState(VK_NUMLOCK) & 1U) ? (uint32_t)PUGL_MOD_NUM_LOCK : 0U) |
- ((GetKeyState(VK_SCROLL) & 1U) ? (uint32_t)PUGL_MOD_SCROLL_LOCK : 0U) |
- ((GetKeyState(VK_CAPITAL) & 1U) ? (uint32_t)PUGL_MOD_CAPS_LOCK : 0U));
- // clang-format on
+ return ((uint32_t)(((GetKeyState(VK_SHIFT) < 0) ? PUGL_MOD_SHIFT : 0) |
+ ((GetKeyState(VK_CONTROL) < 0) ? PUGL_MOD_CTRL : 0) |
+ ((GetKeyState(VK_MENU) < 0) ? PUGL_MOD_ALT : 0) |
+ ((GetKeyState(VK_LWIN) < 0) ? PUGL_MOD_SUPER : 0) |
+ ((GetKeyState(VK_RWIN) < 0) ? PUGL_MOD_SUPER : 0) |
+ (is_toggled(VK_NUMLOCK) ? PUGL_MOD_NUM_LOCK : 0) |
+ (is_toggled(VK_SCROLL) ? PUGL_MOD_SCROLL_LOCK : 0) |
+ (is_toggled(VK_CAPITAL) ? PUGL_MOD_CAPS_LOCK : 0)));
}
static void
diff --git a/test/meson.build b/test/meson.build
index 791cf04..c47d3ee 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -208,6 +208,13 @@ elif is_variable('cpp')
'-Wno-switch-enum',
'-Wno-unused-macros', # Mac
]
+ if host_machine.system() == 'windows'
+ cpp_unified_args += [
+ '-Wno-cast-function-type',
+ '-Wno-deprecated-declarations',
+ '-Wno-nonportable-system-include-path',
+ ]
+ endif
elif cpp.get_id() == 'gcc'
cpp_unified_args += [
'-Wno-conditionally-supported',