1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "KeyboardLayout.h"
7 #include "mozilla/TextEventDispatcher.h"
8 #include "mozilla/widget/IMEData.h"
10 #include "WinIMEHandler.h"
11 #include "WinTextEventDispatcherListener.h"
16 StaticRefPtr
<WinTextEventDispatcherListener
>
17 WinTextEventDispatcherListener::sInstance
;
20 WinTextEventDispatcherListener
* WinTextEventDispatcherListener::GetInstance() {
22 sInstance
= new WinTextEventDispatcherListener();
24 return sInstance
.get();
27 void WinTextEventDispatcherListener::Shutdown() { sInstance
= nullptr; }
29 NS_IMPL_ISUPPORTS(WinTextEventDispatcherListener
, TextEventDispatcherListener
,
30 nsISupportsWeakReference
)
32 WinTextEventDispatcherListener::WinTextEventDispatcherListener() {}
34 WinTextEventDispatcherListener::~WinTextEventDispatcherListener() {}
37 WinTextEventDispatcherListener::NotifyIME(
38 TextEventDispatcher
* aTextEventDispatcher
,
39 const IMENotification
& aNotification
) {
40 nsWindow
* window
= static_cast<nsWindow
*>(aTextEventDispatcher
->GetWidget());
41 if (NS_WARN_IF(!window
)) {
42 return NS_ERROR_FAILURE
;
44 return IMEHandler::NotifyIME(window
, aNotification
);
47 NS_IMETHODIMP_(IMENotificationRequests
)
48 WinTextEventDispatcherListener::GetIMENotificationRequests() {
49 return IMEHandler::GetIMENotificationRequests();
53 WinTextEventDispatcherListener::OnRemovedFrom(
54 TextEventDispatcher
* aTextEventDispatcher
) {
55 // XXX When input transaction is being stolen by add-on, what should we do?
59 WinTextEventDispatcherListener::WillDispatchKeyboardEvent(
60 TextEventDispatcher
* aTextEventDispatcher
,
61 WidgetKeyboardEvent
& aKeyboardEvent
, uint32_t aIndexOfKeypress
,
63 static_cast<NativeKey
*>(aData
)->WillDispatchKeyboardEvent(aKeyboardEvent
,
68 } // namespace mozilla