Skip to content

Commit 0907136

Browse files
committed
SDL3: key: runtime issues fixes
1 parent 1f49d26 commit 0907136

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src_c/key.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,11 @@ static const struct {
389389
{1073742054, "right alt"}, /* K_RALT */
390390
{1073742055, "right meta"}, /* K_RGUI, K_RMETA, K_RSUPER */
391391
{1073742081, "alt gr"}, /* K_MODE */
392-
{1073742094, "AC Back"}, /* K_AC_BACK */
392+
#if SDL_VERSION_ATLEAST(3, 0, 0)
393+
{1073742106, "AC Back"}, /* K_AC_BACK */
394+
#else
395+
{1073742094, "AC Back"}, /* K_AC_BACK */
396+
#endif
393397
};
394398

395399
/* Get name from keycode using pygame compat table */

test/key_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
# keys that are not tested for const-name match
1010
SKIPPED_KEYS = {"K_UNKNOWN"}
11+
SKIPPED_KEYS_NEW = {"K_MODE"}
1112

1213
# This is the expected compat output
1314
KEY_NAME_COMPAT = {
@@ -286,7 +287,8 @@ def test_name_and_key_code(self):
286287
# This is a test for an implementation detail of name with use_compat=False
287288
# If this test breaks in the future for any key, it is safe to put skips on
288289
# failing keys (the implementation detail is documented as being unreliable)
289-
self.assertEqual(pygame.key.key_code(alt_name), const_val)
290+
if const_name not in SKIPPED_KEYS_NEW:
291+
self.assertEqual(pygame.key.key_code(alt_name), const_val)
290292

291293
self.assertRaises(TypeError, pygame.key.name, "fizzbuzz")
292294
self.assertRaises(TypeError, pygame.key.key_code, pygame.K_a)

0 commit comments

Comments
 (0)