Advertisement
Guest User

Untitled

a guest
Sep 24th, 2021
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.52 KB | None | 0 0
  1. ~/Desktop/sources/keymap/haiku> git diff
  2. diff --git a/src/bin/keymap/Keymap.cpp b/src/bin/keymap/Keymap.cpp
  3. index 5a1ad0c5a0..08c3ac3b97 100644
  4. --- a/src/bin/keymap/Keymap.cpp
  5. +++ b/src/bin/keymap/Keymap.cpp
  6. @@ -958,7 +958,7 @@ Keymap::_SaveSourceText(FILE* file)
  7.         }
  8.  #endif
  9.  
  10. -       for (int i = 0; i < 128; i++) {
  11. +       for (int i = 0; i < 256; i++) {
  12.                 char normalKey[32];
  13.                 char shiftKey[32];
  14.                 char controlKey[32];
  15. diff --git a/src/kits/shared/Keymap.cpp b/src/kits/shared/Keymap.cpp
  16. index 9a77e6f602..1c7315074b 100644
  17. --- a/src/kits/shared/Keymap.cpp
  18. +++ b/src/kits/shared/Keymap.cpp
  19. @@ -349,7 +349,7 @@ BKeymap::GetChars(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey,
  20.         *numBytes = 0;
  21.         *chars = NULL;
  22.  
  23. -       if (keyCode > 128 || fChars == NULL)
  24. +       if (keyCode > 256 || fChars == NULL)
  25.                 return;
  26.  
  27. :...skipping...
  28. diff --git a/src/bin/keymap/Keymap.cpp b/src/bin/keymap/Keymap.cpp
  29. index 5a1ad0c5a0..08c3ac3b97 100644
  30. --- a/src/bin/keymap/Keymap.cpp
  31. +++ b/src/bin/keymap/Keymap.cpp
  32. @@ -958,7 +958,7 @@ Keymap::_SaveSourceText(FILE* file)
  33.         }
  34.  #endif
  35.  
  36. -       for (int i = 0; i < 128; i++) {
  37. +       for (int i = 0; i < 256; i++) {
  38.                 char normalKey[32];
  39.                 char shiftKey[32];
  40.                 char controlKey[32];
  41. diff --git a/src/kits/shared/Keymap.cpp b/src/kits/shared/Keymap.cpp
  42. index 9a77e6f602..1c7315074b 100644
  43. --- a/src/kits/shared/Keymap.cpp
  44. +++ b/src/kits/shared/Keymap.cpp
  45. @@ -349,7 +349,7 @@ BKeymap::GetChars(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey,
  46.         *numBytes = 0;
  47.         *chars = NULL;
  48.  
  49. -       if (keyCode > 128 || fChars == NULL)
  50. +       if (keyCode > 256 || fChars == NULL)
  51.                 return;
  52.  
  53.         // here we take NUMLOCK into account
  54. @@ -460,7 +460,7 @@ BKeymap::GetModifiedCharacters(const char* in, int32 inModifiers,
  55.         if (in == NULL || *in == '\0' || _outList == NULL)
  56.                 return B_BAD_VALUE;
  57.  
  58. -       for(uint32 i = 0; i < 128; i++) {
  59. +       for(uint32 i = 0; i < 256; i++) {
  60.                 int32 inOffset = Offset(i, inModifiers);
  61.                 size_t sizeIn = fChars[inOffset++];
  62.                 if (sizeIn == 0 || memcmp(in, fChars + inOffset, sizeIn) != 0) {
  63. @@ -520,7 +520,7 @@ BKeymap::Offset(uint32 keyCode, uint32 modifiers, uint32* _table) const
  64.         int32 offset;
  65.         uint32 table;
  66.  
  67. -       if (keyCode >= 128)
  68. +       if (keyCode >= 256)
  69.                 return -1;
  70.  
  71.         switch (modifiers & kModifierKeys) {
  72. diff --git a/src/preferences/keymap/Keymap.cpp b/src/preferences/keymap/Keymap.cpp
  73. index 2da93a902e..a0ecfc34a4 100644
  74. --- a/src/preferences/keymap/Keymap.cpp
  75. +++ b/src/preferences/keymap/Keymap.cpp
  76. @@ -103,7 +103,7 @@ Keymap::DumpKeymap()
  77.         // Caps, Caps+shift, Caps+option, and Caps+option+shift keys.
  78.         puts("Key #\tn\ts\tc\to\tos\tC\tCs\tCo\tCos\n");
  79.  
  80. -       for (uint8 i = 0; i < 128; i++) {
  81. +       for (uint8 i = 0; i < 256; i++) {
  82.                 printf(" 0x%02x\t", i);
  83.                 print_key(fChars, fKeys.normal_map[i]);
  84.                 print_key(fChars, fKeys.shift_map[i]);
  85. diff --git a/src/tests/kits/shared/KeymapTest.cpp b/src/tests/kits/shared/KeymapTest.cpp
  86. index fe1a21ea8c..80f6b335f1 100644
  87. --- a/src/tests/kits/shared/KeymapTest.cpp
  88. +++ b/src/tests/kits/shared/KeymapTest.cpp
  89. @@ -70,7 +70,7 @@ KeymapTest::TestGetChars()
  90.         CPPUNIT_ASSERT(keymap != NULL);
  91.  
  92.         // Test each of the keymap's character tables
  93. -       typedef std::map<uint32, int32(*)[128]> table_map_t;
  94. +       typedef std::map<uint32, int32(*)[256]> table_map_t;
  95.         table_map_t tables;
  96.         tables[0] = &keymap->normal_map;
  97.         tables[B_SHIFT_KEY] = &keymap->shift_map;
  98. @@ -86,11 +86,11 @@ KeymapTest::TestGetChars()
  99.         for (table_map_t::const_iterator p = tables.begin();
  100.                  p != tables.end(); p++) {
  101.                 const uint32 modifiers = (*p).first;
  102. -               const int32(*table)[128] = (*p).second;
  103. +               const int32(*table)[256] = (*p).second;
  104.  
  105.                 // Test, for every keycode, that the result from BKeymap::GetChars()
  106.                 // matches what we find in our our own copy of the keymap
  107. -               for (uint32 keycode = 0; keycode < 128; keycode++) {
  108. +               for (uint32 keycode = 0; keycode < 256; keycode++) {
  109.                         char* mapChars = &charArray[(*table)[keycode]];
  110.  
  111.                         // If the keycode isn't mapped, try again without the Option key
  112.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement