Bug 1869647 - Mark hasStorageAccess.sub.https.window.html as intermittent after wpt...
[gecko.git] / widget / gtk / NativeKeyBindings.h
blob1d0c528621934f30a8018aceb25a69bb0ce63ea8
1 /* -*- Mode: C++; tab-width: 2; 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 NativeKeyBindings_h
7 #define NativeKeyBindings_h
9 #include "mozilla/Attributes.h"
10 #include "mozilla/EventForwards.h"
11 #include "nsIWidget.h"
13 #include <glib.h> // for guint
15 using GtkWidget = struct _GtkWidget;
17 namespace mozilla {
18 enum class NativeKeyBindingsType : uint8_t;
20 class WritingMode;
21 template <typename T>
22 class Maybe;
24 namespace widget {
26 class NativeKeyBindings final {
27 public:
28 static NativeKeyBindings* GetInstance(NativeKeyBindingsType aType);
29 static void Shutdown();
31 /**
32 * GetEditCommandsForTests() returns commands performed in native widget
33 * in typical environment. I.e., this does NOT refer customized shortcut
34 * key mappings of the environment.
36 static void GetEditCommandsForTests(NativeKeyBindingsType aType,
37 const WidgetKeyboardEvent& aEvent,
38 const Maybe<WritingMode>& aWritingMode,
39 nsTArray<CommandInt>& aCommands);
41 void Init(NativeKeyBindingsType aType);
43 void GetEditCommands(const WidgetKeyboardEvent& aEvent,
44 const Maybe<WritingMode>& aWritingMode,
45 nsTArray<CommandInt>& aCommands);
47 private:
48 ~NativeKeyBindings();
50 bool GetEditCommandsInternal(const WidgetKeyboardEvent& aEvent,
51 nsTArray<CommandInt>& aCommands, guint aKeyval);
53 GtkWidget* mNativeTarget;
55 static NativeKeyBindings* sInstanceForSingleLineEditor;
56 static NativeKeyBindings* sInstanceForMultiLineEditor;
59 } // namespace widget
60 } // namespace mozilla
62 #endif // NativeKeyBindings_h