diff --git a/widget/windows/nsBidiKeyboard.cpp b/widget/windows/nsBidiKeyboard.cpp index bb8407b553e9..c186679d9378 100644 --- a/widget/windows/nsBidiKeyboard.cpp +++ b/widget/windows/nsBidiKeyboard.cpp @@ -7,6 +7,10 @@ #include #include "nsBidiKeyboard.h" #include "prmem.h" +#include "nsServiceManagerUtils.h" +#include "nsTArray.h" +#include "nsContentUtils.h" +#include "mozilla/dom/ContentParent.h" #include NS_IMPL_ISUPPORTS(nsBidiKeyboard, nsIBidiKeyboard) @@ -177,3 +181,24 @@ bool nsBidiKeyboard::IsRTLLanguage(HKL aLocale) (sizeof(localesig)/sizeof(WCHAR))) && (localesig.lsUsb[3] & 0x08000000)); } + +//static +void +nsBidiKeyboard::OnLayoutChange() +{ + nsCOMPtr bidiKeyboard = nsContentUtils::GetBidiKeyboard(); + if (!bidiKeyboard) { + return; + } + + bool rtl; + if (NS_FAILED(bidiKeyboard->IsLangRTL(&rtl))) { + return; + } + + nsTArray children; + mozilla::dom::ContentParent::GetAll(children); + for (uint32_t i = 0; i < children.Length(); i++) { + children[i]->SendBidiKeyboardNotify(rtl); + } +} diff --git a/widget/windows/nsBidiKeyboard.h b/widget/windows/nsBidiKeyboard.h index 378e760773e5..b3b56f48f6fe 100644 --- a/widget/windows/nsBidiKeyboard.h +++ b/widget/windows/nsBidiKeyboard.h @@ -19,6 +19,8 @@ public: nsBidiKeyboard(); + static void OnLayoutChange(); + protected: nsresult SetupBidiKeyboards(); diff --git a/widget/windows/nsWidgetFactory.cpp b/widget/windows/nsWidgetFactory.cpp index 55c414d1e6aa..ca12658cd30f 100644 --- a/widget/windows/nsWidgetFactory.cpp +++ b/widget/windows/nsWidgetFactory.cpp @@ -190,7 +190,7 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = { { &kNS_WIN_JUMPLISTSHORTCUT_CID, false, nullptr, JumpListShortcutConstructor }, { &kNS_WINDOWS_UIUTILS_CID, false, nullptr, WindowsUIUtilsConstructor }, { &kNS_DRAGSERVICE_CID, false, nullptr, nsDragServiceConstructor, Module::MAIN_PROCESS_ONLY }, - { &kNS_BIDIKEYBOARD_CID, false, nullptr, nsBidiKeyboardConstructor }, + { &kNS_BIDIKEYBOARD_CID, false, nullptr, nsBidiKeyboardConstructor, Module::MAIN_PROCESS_ONLY }, { &kNS_TASKBARPREVIEWCALLBACK_CID, false, nullptr, TaskbarPreviewCallbackConstructor }, #ifdef NS_PRINTING { &kNS_PRINTSETTINGSSERVICE_CID, false, nullptr, nsPrintOptionsWinConstructor }, @@ -224,7 +224,7 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = { { "@mozilla.org/windows-jumplistshortcut;1", &kNS_WIN_JUMPLISTSHORTCUT_CID }, { "@mozilla.org/windows-ui-utils;1", &kNS_WINDOWS_UIUTILS_CID }, { "@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID, Module::MAIN_PROCESS_ONLY }, - { "@mozilla.org/widget/bidikeyboard;1", &kNS_BIDIKEYBOARD_CID }, + { "@mozilla.org/widget/bidikeyboard;1", &kNS_BIDIKEYBOARD_CID, Module::MAIN_PROCESS_ONLY }, { "@mozilla.org/widget/taskbar-preview-callback;1", &kNS_TASKBARPREVIEWCALLBACK_CID }, #ifdef NS_PRINTING { "@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID }, diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index d8dc5ca98a1f..d3382232a104 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -134,6 +134,7 @@ #include "mozilla/TextEvents.h" // For WidgetKeyboardEvent #include "mozilla/TextEventDispatcherListener.h" #include "nsThemeConstants.h" +#include "nsBidiKeyboard.h" #include "nsIGfxInfo.h" #include "nsUXThemeConstants.h" @@ -5515,6 +5516,7 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam, case WM_INPUTLANGCHANGE: KeyboardLayout::GetInstance()-> OnLayoutChange(reinterpret_cast(lParam)); + nsBidiKeyboard::OnLayoutChange(); result = false; // always pass to child window break;