| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_LIBGTKUI_X11_INPUT_METHOD_CONTEXT_IMPL_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_LIBGTKUI_X11_INPUT_METHOD_CONTEXT_IMPL_GTK_H_ |
| 6 #define CHROME_BROWSER_UI_LIBGTKUI_X11_INPUT_METHOD_CONTEXT_IMPL_GTK_H_ | 6 #define CHROME_BROWSER_UI_LIBGTKUI_X11_INPUT_METHOD_CONTEXT_IMPL_GTK_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 void Focus() override; | 36 void Focus() override; |
| 37 void Blur() override; | 37 void Blur() override; |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 // Resets the cache of X modifier keycodes. | 40 // Resets the cache of X modifier keycodes. |
| 41 // TODO(yukishiino): We should call this method whenever X keyboard mapping | 41 // TODO(yukishiino): We should call this method whenever X keyboard mapping |
| 42 // changes, for example when a user switched to another keyboard layout. | 42 // changes, for example when a user switched to another keyboard layout. |
| 43 void ResetXModifierKeycodesCache(); | 43 void ResetXModifierKeycodesCache(); |
| 44 | 44 |
| 45 // Constructs a GdkEventKey from a XKeyEvent and returns it. Otherwise, | 45 // Constructs a GdkEventKey from a XKeyEvent and returns it. Otherwise, |
| 46 // returns NULL. The returned GdkEvent must be freed by gdk_event_free. | 46 // returns nullptr. The returned GdkEvent must be freed by gdk_event_free. |
| 47 GdkEvent* GdkEventFromNativeEvent(const base::NativeEvent& native_event); | 47 GdkEvent* GdkEventFromNativeEvent(const base::NativeEvent& native_event); |
| 48 | 48 |
| 49 // Returns true if the hardware |keycode| is assigned to a modifier key. | 49 // Returns true if the hardware |keycode| is assigned to a modifier key. |
| 50 bool IsKeycodeModifierKey(unsigned int keycode) const; | 50 bool IsKeycodeModifierKey(unsigned int keycode) const; |
| 51 | 51 |
| 52 // Returns true if one of |keycodes| is pressed. |keybits| is a bit vector | 52 // Returns true if one of |keycodes| is pressed. |keybits| is a bit vector |
| 53 // returned by XQueryKeymap, and |num_keys| is the number of keys in | 53 // returned by XQueryKeymap, and |num_keys| is the number of keys in |
| 54 // |keybits|. | 54 // |keybits|. |
| 55 bool IsAnyOfKeycodesPressed(const std::vector<int>& keycodes, | 55 bool IsAnyOfKeycodesPressed(const std::vector<int>& keycodes, |
| 56 const char* keybits, | 56 const char* keybits, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 69 GtkIMContext*); | 69 GtkIMContext*); |
| 70 CHROMEG_CALLBACK_0(X11InputMethodContextImplGtk2, | 70 CHROMEG_CALLBACK_0(X11InputMethodContextImplGtk2, |
| 71 void, | 71 void, |
| 72 OnPreeditEnd, | 72 OnPreeditEnd, |
| 73 GtkIMContext*); | 73 GtkIMContext*); |
| 74 CHROMEG_CALLBACK_0(X11InputMethodContextImplGtk2, | 74 CHROMEG_CALLBACK_0(X11InputMethodContextImplGtk2, |
| 75 void, | 75 void, |
| 76 OnPreeditStart, | 76 OnPreeditStart, |
| 77 GtkIMContext*); | 77 GtkIMContext*); |
| 78 | 78 |
| 79 // A set of callback functions. Must not be NULL. | 79 // A set of callback functions. Must not be nullptr. |
| 80 ui::LinuxInputMethodContextDelegate* delegate_; | 80 ui::LinuxInputMethodContextDelegate* delegate_; |
| 81 | 81 |
| 82 // IME's input GTK context. | 82 // IME's input GTK context. |
| 83 GtkIMContext* gtk_context_; | 83 GtkIMContext* gtk_context_; |
| 84 | 84 |
| 85 gpointer gdk_last_set_client_window_; | 85 gpointer gdk_last_set_client_window_; |
| 86 | 86 |
| 87 // Last known caret bounds relative to the screen coordinates. | 87 // Last known caret bounds relative to the screen coordinates. |
| 88 gfx::Rect last_caret_bounds_; | 88 gfx::Rect last_caret_bounds_; |
| 89 | 89 |
| 90 // A set of hardware keycodes of modifier keys. | 90 // A set of hardware keycodes of modifier keys. |
| 91 base::hash_set<unsigned int> modifier_keycodes_; | 91 base::hash_set<unsigned int> modifier_keycodes_; |
| 92 | 92 |
| 93 // A list of keycodes of each modifier key. | 93 // A list of keycodes of each modifier key. |
| 94 std::vector<int> meta_keycodes_; | 94 std::vector<int> meta_keycodes_; |
| 95 std::vector<int> super_keycodes_; | 95 std::vector<int> super_keycodes_; |
| 96 std::vector<int> hyper_keycodes_; | 96 std::vector<int> hyper_keycodes_; |
| 97 | 97 |
| 98 DISALLOW_COPY_AND_ASSIGN(X11InputMethodContextImplGtk2); | 98 DISALLOW_COPY_AND_ASSIGN(X11InputMethodContextImplGtk2); |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 } // namespace libgtkui | 101 } // namespace libgtkui |
| 102 | 102 |
| 103 #endif // CHROME_BROWSER_UI_LIBGTKUI_X11_INPUT_METHOD_CONTEXT_IMPL_GTK_H_ | 103 #endif // CHROME_BROWSER_UI_LIBGTKUI_X11_INPUT_METHOD_CONTEXT_IMPL_GTK_H_ |
| OLD | NEW |