Bug 1861709 replace AudioCallbackDriver::ThreadRunning() assertions that mean to...
[gecko.git] / widget / windows / WinTextEventDispatcherListener.cpp
blobaeed8be01b2578a6c4347c3be9ed7b81fc98f31a
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"
9 #include "nsWindow.h"
10 #include "WinIMEHandler.h"
11 #include "WinTextEventDispatcherListener.h"
13 namespace mozilla {
14 namespace widget {
16 StaticRefPtr<WinTextEventDispatcherListener>
17 WinTextEventDispatcherListener::sInstance;
19 // static
20 WinTextEventDispatcherListener* WinTextEventDispatcherListener::GetInstance() {
21 if (!sInstance) {
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() {}
36 NS_IMETHODIMP
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();
52 NS_IMETHODIMP_(void)
53 WinTextEventDispatcherListener::OnRemovedFrom(
54 TextEventDispatcher* aTextEventDispatcher) {
55 // XXX When input transaction is being stolen by add-on, what should we do?
58 NS_IMETHODIMP_(void)
59 WinTextEventDispatcherListener::WillDispatchKeyboardEvent(
60 TextEventDispatcher* aTextEventDispatcher,
61 WidgetKeyboardEvent& aKeyboardEvent, uint32_t aIndexOfKeypress,
62 void* aData) {
63 static_cast<NativeKey*>(aData)->WillDispatchKeyboardEvent(aKeyboardEvent,
64 aIndexOfKeypress);
67 } // namespace widget
68 } // namespace mozilla