]> git.eshelyaron.com Git - emacs.git/commitdiff
Correctly handle key map updates on Haiku
authorPo Lu <luangruo@yahoo.com>
Sat, 12 Nov 2022 13:11:00 +0000 (13:11 +0000)
committerPo Lu <luangruo@yahoo.com>
Sat, 12 Nov 2022 13:11:00 +0000 (13:11 +0000)
* src/haiku_support.cc (MessageReceived): Handle
B_KEY_MAP_LOADED by clearing the previous keymap.

src/haiku_support.cc

index 0f8e26d0db485b72fcf7993e82dd144821039da4..3a982856777c2bdbbc7c1f9a783d4a7efd0a3e35 100644 (file)
@@ -653,6 +653,24 @@ public:
       Quit ();
     else if (msg->what == B_CLIPBOARD_CHANGED)
       haiku_write (CLIPBOARD_CHANGED_EVENT, &rq);
+    else if (msg->what == B_KEY_MAP_LOADED)
+      {
+       /* Install the new keymap.  Or rather, clear key_map -- Emacs
+          will fetch it again from the main thread the next time it
+          is needed.  */
+       if (key_map_lock.Lock ())
+         {
+           if (key_map)
+             free (key_map);
+
+           if (key_chars)
+             free (key_chars);
+
+           key_map = NULL;
+           key_chars = NULL;
+           key_map_lock.Unlock ();
+         }
+      }
     else
       BApplication::MessageReceived (msg);
   }