Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.h

Issue 335923004: aura-linux: Fixes super/hyper/meta key support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.h
diff --git a/chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.h b/chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.h
index 098a76892a83bb9ef83a4a1d99b94d4e556d7c0a..1ff7a4602c1e750858f4ae177bf2cbc0d7294712 100644
--- a/chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.h
+++ b/chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_UI_LIBGTK2UI_X11_INPUT_METHOD_CONTEXT_IMPL_GTK2_H_
#include "base/containers/hash_tables.h"
+#include "base/event_types.h"
#include "base/gtest_prod_util.h"
#include "base/strings/string16.h"
#include "ui/base/glib/glib_integers.h"
@@ -13,6 +14,7 @@
#include "ui/base/ime/linux/linux_input_method_context.h"
#include "ui/gfx/rect.h"
+typedef union _GdkEvent GdkEvent;
typedef struct _GdkDrawable GdkWindow;
typedef struct _GtkIMContext GtkIMContext;
@@ -34,9 +36,25 @@ class X11InputMethodContextImplGtk2 : public ui::LinuxInputMethodContext {
virtual void OnCaretBoundsChanged(const gfx::Rect& caret_bounds) OVERRIDE;
private:
+ // Resets the cache of X modifier keycodes.
+ // TODO(yukishiino): We should call this method whenever X keyboard mapping
+ // changes, for example when a user switched to another keyboard layout.
+ void ResetXModifierKeycodesCache();
+
+ // Constructs a GdkEventKey from a XKeyEvent and returns it. Otherwise,
+ // returns NULL. The returned GdkEvent must be freed by gdk_event_free.
+ GdkEvent* GdkEventFromNativeEvent(const base::NativeEvent& native_event);
+
// Returns true if the hardware |keycode| is assigned to a modifier key.
bool IsKeycodeModifierKey(unsigned int keycode) const;
+ // Returns true if one of |keycodes| is pressed. |keybits| is a bit vector
+ // returned by XQueryKeymap, and |num_keys| is the number of keys in
+ // |keybits|.
+ bool IsAnyOfKeycodesPressed(const std::vector<int>& keycodes,
+ const char* keybits,
+ int num_keys) const;
+
// GtkIMContext event handlers. They are shared among |gtk_context_simple_|
// and |gtk_multicontext_|.
CHROMEG_CALLBACK_1(X11InputMethodContextImplGtk2, void, OnCommit,
@@ -70,6 +88,11 @@ class X11InputMethodContextImplGtk2 : public ui::LinuxInputMethodContext {
// A set of hardware keycodes of modifier keys.
base::hash_set<unsigned int> modifier_keycodes_;
+ // A list of keycodes of each modifier key.
+ std::vector<int> meta_keycodes_;
+ std::vector<int> super_keycodes_;
+ std::vector<int> hyper_keycodes_;
+
// The helper class to trap GTK+'s "commit" signal for direct input key
// events.
//
« no previous file with comments | « no previous file | chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698