[haiku-commits] haiku: hrev53408 - src/servers/input headers/os/app

  • From: Stephan Aßmus <superstippi@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 27 Aug 2019 02:49:46 -0400 (EDT)

hrev53408 adds 1 changeset to branch 'master'
old head: 19f8517fc3909c1c8df394c9694fc546d942f244
new head: b9d9c282fd135d57db47a12c0a44fe0d6d5a6beb
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=b9d9c282fd13+%5E19f8517fc390

----------------------------------------------------------------------------

b9d9c282fd13: input_server: Notify apps of new key map
  
  Define a new message, B_KEY_MAP_LOADED, that is broadcast to applications by
  the Input Server each time a key map is loaded. This allows apps that cache
  key-map data to know when their copy has become stale.
  
  Change InputServer::HandleGetSetKeyMap() so it returns an error in the event
  loading even the system (fallback) key map fails.
  
  Change-Id: Icc6c884f695ca59c687d83c680bb2fb467dd90cc
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/1741
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

                                      [ Simon South <simon@xxxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev53408
Commit:      b9d9c282fd135d57db47a12c0a44fe0d6d5a6beb
URL:         https://git.haiku-os.org/haiku/commit/?id=b9d9c282fd13
Author:      Simon South <simon@xxxxxxxxxxxxxx>
Date:        Sun Aug 25 01:26:23 2019 UTC
Committer:   Stephan Aßmus <superstippi@xxxxxx>
Commit-Date: Tue Aug 27 06:49:37 2019 UTC

----------------------------------------------------------------------------

2 files changed, 17 insertions(+), 4 deletions(-)
headers/os/app/AppDefs.h          |  1 +
src/servers/input/InputServer.cpp | 20 ++++++++++++++++----

----------------------------------------------------------------------------

diff --git a/headers/os/app/AppDefs.h b/headers/os/app/AppDefs.h
index 0533c327cb..d8624b7e93 100644
--- a/headers/os/app/AppDefs.h
+++ b/headers/os/app/AppDefs.h
@@ -38,6 +38,7 @@ enum {
        B_KEY_UP                                        = '_KYU',
        B_UNMAPPED_KEY_DOWN                     = '_UKD',
        B_UNMAPPED_KEY_UP                       = '_UKU',
+       B_KEY_MAP_LOADED                        = '_KML',
        B_LAYOUT_WINDOW                         = '_LAY',
        B_MODIFIERS_CHANGED                     = '_MCH',
        B_MINIMIZE                                      = '_WMN',
diff --git a/src/servers/input/InputServer.cpp 
b/src/servers/input/InputServer.cpp
index 0dc4ab46c6..b994ef485c 100644
--- a/src/servers/input/InputServer.cpp
+++ b/src/servers/input/InputServer.cpp
@@ -932,21 +932,33 @@ InputServer::HandleGetSetKeyMap(BMessage* message, 
BMessage* reply)
 {
        CALLED();
 
+       status_t status;
        if (message->what == IS_GET_KEY_MAP) {
-               status_t status = reply->AddData("keymap", B_ANY_TYPE, &fKeys, 
sizeof(fKeys));
+               status = reply->AddData("keymap", B_ANY_TYPE, &fKeys, 
sizeof(fKeys));
                if (status == B_OK)
                        status = reply->AddData("key_buffer", B_ANY_TYPE, 
fChars, fCharsSize);
 
                return status;
        }
 
-       if (_LoadKeymap() != B_OK)
-               _LoadSystemKeymap();
+       status = _LoadKeymap();
+       if (status != B_OK) {
+               status = _LoadSystemKeymap();
+               if (status != B_OK)
+                       return status;
+       }
 
        BMessage msg(IS_CONTROL_DEVICES);
        msg.AddInt32("type", B_KEYBOARD_DEVICE);
        msg.AddInt32("code", B_KEY_MAP_CHANGED);
-       return fAddOnManager->PostMessage(&msg);
+       status = fAddOnManager->PostMessage(&msg);
+
+       if (status == B_OK) {
+               BMessage appMsg(B_KEY_MAP_LOADED);
+               be_roster->Broadcast(&appMsg);
+       }
+
+       return status;
 }
 
 


Other related posts:

  • » [haiku-commits] haiku: hrev53408 - src/servers/input headers/os/app - Stephan Aßmus