diff options
author | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-15 22:45:12 +0000 |
---|---|---|
committer | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-15 22:45:12 +0000 |
commit | 5842d8ebc01af6b6862f12754047ad45c32471af (patch) | |
tree | a0bb7a1e605898fafa8dbe70a7986e2ed861acf0 | |
parent | 45731e3cf5381b461ea7a72b3d63ff28a26ff64b (diff) | |
download | chromium_src-5842d8ebc01af6b6862f12754047ad45c32471af.zip chromium_src-5842d8ebc01af6b6862f12754047ad45c32471af.tar.gz chromium_src-5842d8ebc01af6b6862f12754047ad45c32471af.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
Review URL: http://codereview.chromium.org/7390001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92764 0039d316-1c4b-4281-b951-d872f2087c98
-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..7868643 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:" << event->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; |