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/. */ 5 6 #ifndef WinTextEventDispatcherListener_h_ 7 #define WinTextEventDispatcherListener_h_ 8 9 #include "mozilla/Attributes.h" 10 #include "mozilla/StaticPtr.h" 11 #include "mozilla/TextEventDispatcherListener.h" 12 13 namespace mozilla { 14 namespace widget { 15 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). 20 */ 21 22 class WinTextEventDispatcherListener final 23 : public TextEventDispatcherListener { 24 public: 25 static WinTextEventDispatcherListener* GetInstance(); 26 static void Shutdown(); 27 28 NS_DECL_ISUPPORTS 29 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; 39 40 private: 41 WinTextEventDispatcherListener(); 42 virtual ~WinTextEventDispatcherListener(); 43 44 static StaticRefPtr<WinTextEventDispatcherListener> sInstance; 45 }; 46 47 } // namespace widget 48 } // namespace mozilla 49 50 #endif // #ifndef WinTextEventDispatcherListener_h_ 51