Bug 1931425 - Limit how often moz-label's #setStyles runs r=reusable-components-revie...
[gecko.git] / widget / windows / WinTextEventDispatcherListener.h
blobd799d0b2803c3ff9396136cfe44f99802f3b5b18
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 #ifndef WinTextEventDispatcherListener_h_
7 #define WinTextEventDispatcherListener_h_
9 #include "mozilla/Attributes.h"
10 #include "mozilla/StaticPtr.h"
11 #include "mozilla/TextEventDispatcherListener.h"
13 namespace mozilla {
14 namespace widget {
16 /**
17 * On Windows, it's enough TextEventDispatcherListener to be a singleton
18 * because we have only one input context per process (IMM can create
19 * multiple IM context but we don't support such behavior).
22 class WinTextEventDispatcherListener final
23 : public TextEventDispatcherListener {
24 public:
25 static WinTextEventDispatcherListener* GetInstance();
26 static void Shutdown();
28 NS_DECL_ISUPPORTS
30 NS_IMETHOD NotifyIME(TextEventDispatcher* aTextEventDispatcher,
31 const IMENotification& aNotification) override;
32 NS_IMETHOD_(IMENotificationRequests) GetIMENotificationRequests() override;
33 NS_IMETHOD_(void)
34 OnRemovedFrom(TextEventDispatcher* aTextEventDispatcher) override;
35 NS_IMETHOD_(void)
36 WillDispatchKeyboardEvent(TextEventDispatcher* aTextEventDispatcher,
37 WidgetKeyboardEvent& aKeyboardEvent,
38 uint32_t aIndexOfKeypress, void* aData) override;
40 private:
41 WinTextEventDispatcherListener();
42 virtual ~WinTextEventDispatcherListener();
44 static StaticRefPtr<WinTextEventDispatcherListener> sInstance;
47 } // namespace widget
48 } // namespace mozilla
50 #endif // #ifndef WinTextEventDispatcherListener_h_