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

Unified Diff: chrome/browser/chromeos/xinput_hierarchy_changed_event_listener_gtk.cc

Issue 8623005: aura: Add back XInputHierarchyChangedEventListener for aura and remove stubs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month 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 | « chrome/browser/chromeos/xinput_hierarchy_changed_event_listener_aura.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/xinput_hierarchy_changed_event_listener_gtk.cc
diff --git a/chrome/browser/chromeos/xinput_hierarchy_changed_event_listener_gtk.cc b/chrome/browser/chromeos/xinput_hierarchy_changed_event_listener_gtk.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d0aeba6aafb2fd6686fd7c885ad20a61a100fa71
--- /dev/null
+++ b/chrome/browser/chromeos/xinput_hierarchy_changed_event_listener_gtk.cc
@@ -0,0 +1,40 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h"
+
+#include <gdk/gdkx.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/XInput2.h>
+
+namespace chromeos {
+
+void XInputHierarchyChangedEventListener::Init() {
+ gdk_window_add_filter(NULL, GdkEventFilter, this);
+}
+
+void XInputHierarchyChangedEventListener::StopImpl() {
+ gdk_window_remove_filter(NULL, GdkEventFilter, this);
+}
+
+// static
+GdkFilterReturn XInputHierarchyChangedEventListener::GdkEventFilter(
+ GdkXEvent* gxevent, GdkEvent* gevent, gpointer data) {
+ XInputHierarchyChangedEventListener* listener =
+ static_cast<XInputHierarchyChangedEventListener*>(data);
+ XEvent* xevent = static_cast<XEvent*>(gxevent);
+
+ if (xevent->xcookie.type != GenericEvent)
+ return GDK_FILTER_CONTINUE;
+
+ if (!XGetEventData(xevent->xgeneric.display, &xevent->xcookie)) {
+ VLOG(1) << "XGetEventData failed";
+ return GDK_FILTER_CONTINUE;
+ }
+ bool processed = listener->ProcessedXEvent(xevent);
+ XFreeEventData(xevent->xgeneric.display, &xevent->xcookie);
+ return processed ? GDK_FILTER_REMOVE : GDK_FILTER_CONTINUE;
+}
+
+} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/xinput_hierarchy_changed_event_listener_aura.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698