diff options
author | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-15 23:46:12 +0000 |
---|---|---|
committer | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-15 23:46:12 +0000 |
commit | 3c52ba7a44c24fed4cc3991e9ceae0f366323521 (patch) | |
tree | 51812e5f3e0a88ba6e14d6854c66db6b9207ff7f /base | |
parent | c5ca4531a4c62fc4a40041973dc4d4114cefc97f (diff) | |
download | chromium_src-3c52ba7a44c24fed4cc3991e9ceae0f366323521.zip chromium_src-3c52ba7a44c24fed4cc3991e9ceae0f366323521.tar.gz chromium_src-3c52ba7a44c24fed4cc3991e9ceae0f366323521.tar.bz2 |
use MessageLoop::GetDisplay to get X's Display to make message_pump_x less GTK/GDK dependent.
Add log message to CHECK. I've seen visiblity notify passing through there.
BUG=none
TEST=none
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=92764
Review URL: http://codereview.chromium.org/7390001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92770 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/message_pump_x.cc | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/base/message_pump_x.cc b/base/message_pump_x.cc index d6975c4..7cf4630 100644 --- a/base/message_pump_x.cc +++ b/base/message_pump_x.cc @@ -12,6 +12,7 @@ #endif #include "base/basictypes.h" +#include "base/message_loop.h" namespace { @@ -99,12 +100,10 @@ bool MessagePumpX::ProcessXEvent(XEvent* xev) { } bool MessagePumpX::RunOnce(GMainContext* context, bool block) { - GdkDisplay* gdisp = gdk_display_get_default(); - if (!gdisp || !GetDispatcher()) + Display* display = MessageLoopForUI::current()->GetDisplay(); + if (!display || !GetDispatcher()) return g_main_context_iteration(context, block); - Display* display = GDK_DISPLAY_XDISPLAY(gdisp); - if (XPending(display)) { XEvent xev; XPeekEvent(display, &xev); @@ -153,7 +152,7 @@ GdkFilterReturn MessagePumpX::GdkEventFilter(GdkXEvent* gxevent, pump->ProcessXEvent(xev); return GDK_FILTER_REMOVE; } - + CHECK(use_gtk_message_pump) << "GdkEvent:" << gevent->type; return GDK_FILTER_CONTINUE; } @@ -169,7 +168,7 @@ bool MessagePumpX::WillProcessXEvent(XEvent* xevent) { void MessagePumpX::EventDispatcherX(GdkEvent* event, gpointer data) { MessagePumpX* pump_x = reinterpret_cast<MessagePumpX*>(data); - CHECK(use_gtk_message_pump); + CHECK(use_gtk_message_pump) << "GdkEvent:" << event->type; if (!pump_x->gdksource_) { pump_x->gdksource_ = g_main_current_source(); @@ -210,21 +209,20 @@ void MessagePumpX::InitializeEventsToCapture(void) { #if defined(HAVE_XINPUT2) void MessagePumpX::InitializeXInput2(void) { - GdkDisplay* display = gdk_display_get_default(); + Display* display = MessageLoopForUI::current()->GetDisplay(); if (!display) return; - Display* xdisplay = GDK_DISPLAY_XDISPLAY(display); int event, err; - if (!XQueryExtension(xdisplay, "XInputExtension", &xiopcode_, &event, &err)) { + if (!XQueryExtension(display, "XInputExtension", &xiopcode_, &event, &err)) { VLOG(1) << "X Input extension not available."; xiopcode_ = -1; return; } int major = 2, minor = 0; - if (XIQueryVersion(xdisplay, &major, &minor) == BadRequest) { + if (XIQueryVersion(display, &major, &minor) == BadRequest) { VLOG(1) << "XInput2 not supported in the server."; xiopcode_ = -1; return; |