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

Unified Diff: base/message_pump_glib_x.cc

Issue 5110011: A non-GTK version of menus for touchui. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: '' Created 10 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 | « no previous file | chrome/browser/ui/views/wrench_menu.cc » ('j') | views/focus/accelerator_handler_touch.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_pump_glib_x.cc
diff --git a/base/message_pump_glib_x.cc b/base/message_pump_glib_x.cc
index 78c179933d00a7e5a70d0d94c3675fe7b9dd1379..d673e5062dd82c35e882e649cf0119cc25ab86db 100644
--- a/base/message_pump_glib_x.cc
+++ b/base/message_pump_glib_x.cc
@@ -85,6 +85,12 @@ MessagePumpGlibX::~MessagePumpGlibX() {
bool MessagePumpGlibX::RunOnce(GMainContext* context, bool block) {
GdkDisplay* gdisp = gdk_display_get_default();
Display* display = GDK_DISPLAY_XDISPLAY(gdisp);
+ static gboolean (*gdkdispatcher)(GSource*, GSourceFunc, void*) = NULL;
Evan Martin 2010/11/22 20:43:26 Is this really the best place for this state? Why
sadrul 2010/11/22 21:23:06 The default GDK event dispatcher should not change
+
+ if (!gdkdispatcher && gdksource_) {
+ gdkdispatcher = gdksource_->source_funcs->dispatch;
+ }
+
if (XPending(display)) {
XEvent xev;
XPeekEvent(display, &xev);
@@ -95,6 +101,14 @@ bool MessagePumpGlibX::RunOnce(GMainContext* context, bool block) {
) {
XNextEvent(display, &xev);
+#if defined(HAVE_XINPUT2)
+ bool have_cookie = false;
+ if (xev.type == GenericEvent &&
+ XGetEventData(xev.xgeneric.display, &xev.xcookie)) {
+ have_cookie = true;
+ }
+#endif
+
bool processed = static_cast<MessagePumpGlibXDispatcher*>
(GetDispatcher())->Dispatch(&xev);
@@ -106,12 +120,22 @@ bool MessagePumpGlibX::RunOnce(GMainContext* context, bool block) {
// impossible to use the omnibox at the moment. However, this will
// eventually be removed once the omnibox code is updated for touchui.
XPutBackEvent(display, &xev);
+ if (gdksource_)
+ gdksource_->source_funcs->dispatch = gdkdispatcher;
g_main_context_iteration(context, FALSE);
}
+
+#if defined(HAVE_XINPUT2)
+ if (have_cookie) {
+ XFreeEventData(xev.xgeneric.display, &xev.xcookie);
+ }
+#endif
} else {
// TODO(sad): A couple of extra events can still sneak in during this.
// Those should be sent back to the X queue from the dispatcher
// EventDispatcherX.
+ if (gdksource_)
+ gdksource_->source_funcs->dispatch = gdkdispatcher;
g_main_context_iteration(context, FALSE);
}
}
« no previous file with comments | « no previous file | chrome/browser/ui/views/wrench_menu.cc » ('j') | views/focus/accelerator_handler_touch.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698