virtualkeyboard: update keymap when it changed
load current keymap on start Change-Id: I1030cf5aaf9641f7e915f8fc10dec3144cab014f Reviewed-on: https://review.haiku-os.org/c/haiku/+/8904 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
@@ -59,5 +59,7 @@ status_t
|
||||
VirtualKeyboardInputDevice::Control(const char* name, void* cookie, uint32 command,
|
||||
BMessage* message)
|
||||
{
|
||||
if (command == B_KEY_MAP_CHANGED)
|
||||
fKeyboardWindow->PostMessage(kKeymapChange);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -51,9 +51,7 @@ VirtualKeyboardWindow::VirtualKeyboardWindow(BInputServerDevice* dev)
|
||||
_LoadLayouts(fLayoutMenu);
|
||||
_LoadFonts();
|
||||
|
||||
KeymapListItem* current = static_cast<KeymapListItem*>(fMapListView->LastItem());
|
||||
fCurrentKeymap.Load(current->EntryRef());
|
||||
|
||||
fCurrentKeymap.SetToCurrent();
|
||||
|
||||
fKeyboardView = new KeyboardLayoutView("Keyboard", fDevice);
|
||||
fKeyboardView->GetKeyboardLayout()->SetDefault();
|
||||
@@ -155,6 +153,10 @@ VirtualKeyboardWindow::_LoadFonts()
|
||||
void
|
||||
VirtualKeyboardWindow::MessageReceived(BMessage* message)
|
||||
{
|
||||
if (message->what == kKeymapChange) {
|
||||
fCurrentKeymap.SetToCurrent();
|
||||
fKeyboardView->SetKeymap(&fCurrentKeymap);
|
||||
}
|
||||
BWindow::MessageReceived(message);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@ class BDirectory;
|
||||
class BListView;
|
||||
class BMenu;
|
||||
|
||||
static const uint32 kKeymapChange = 'vKCG';
|
||||
|
||||
|
||||
class VirtualKeyboardWindow : public BWindow {
|
||||
public:
|
||||
VirtualKeyboardWindow(BInputServerDevice* dev);
|
||||
|
||||
Reference in New Issue
Block a user