diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-12 00:43:26 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-12 00:43:26 +0000 |
commit | aff5ed9e45b7fbffbffa00f0e550637c213f2089 (patch) | |
tree | 7673f1b701b4e3e080706c595f6aca85280f48e4 /base | |
parent | 21135343949a5cfe529ee0194b6f84baf00411e2 (diff) | |
download | chromium_src-aff5ed9e45b7fbffbffa00f0e550637c213f2089.zip chromium_src-aff5ed9e45b7fbffbffa00f0e550637c213f2089.tar.gz chromium_src-aff5ed9e45b7fbffbffa00f0e550637c213f2089.tar.bz2 |
Remove obsolete DisableGtkMessagePump
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/8216036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104962 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/message_pump_x.cc | 61 | ||||
-rw-r--r-- | base/message_pump_x.h | 6 |
2 files changed, 19 insertions, 48 deletions
diff --git a/base/message_pump_x.cc b/base/message_pump_x.cc index 4feab2d..8c4dd2c 100644 --- a/base/message_pump_x.cc +++ b/base/message_pump_x.cc @@ -46,20 +46,16 @@ GSourceFuncs XSourceFuncs = { // The opcode used for checking events. int xiopcode = -1; -// When the GTK/GDK event processing is disabled, the message-pump opens a -// connection to the display and owns it. -Display* g_xdisplay = NULL; - #if defined(TOOLKIT_USES_GTK) -// A flag to disable GTK's message pump. This is intermediate step -// to remove gtk and will be removed once migration is complete. -bool use_gtk_message_pump = true; - gboolean PlaceholderDispatch(GSource* source, GSourceFunc cb, gpointer data) { return TRUE; } +#else +// If the GTK/GDK event processing is not present, the message-pump opens a +// connection to the display and owns it. +Display* g_xdisplay = NULL; #endif // defined(TOOLKIT_USES_GTK) void InitializeXInput2(void) { @@ -110,14 +106,9 @@ MessagePumpX::MessagePumpX() : MessagePumpGlib(), x_source_(NULL) { InitializeXInput2(); #if defined(TOOLKIT_USES_GTK) - if (use_gtk_message_pump) { - gdk_window_add_filter(NULL, &GdkEventFilter, this); - gdk_event_handler_set(&EventDispatcherX, this, NULL); - } else { - InitXSource(); - } - if (use_gtk_message_pump) - InitializeEventsToCapture(); + gdk_window_add_filter(NULL, &GdkEventFilter, this); + gdk_event_handler_set(&EventDispatcherX, this, NULL); + InitializeEventsToCapture(); #else InitXSource(); #endif @@ -125,38 +116,27 @@ MessagePumpX::MessagePumpX() : MessagePumpGlib(), MessagePumpX::~MessagePumpX() { #if defined(TOOLKIT_USES_GTK) - if (use_gtk_message_pump) { - gdk_window_remove_filter(NULL, &GdkEventFilter, this); - gdk_event_handler_set(reinterpret_cast<GdkEventFunc>(gtk_main_do_event), - this, NULL); - return; - } -#endif - + gdk_window_remove_filter(NULL, &GdkEventFilter, this); + gdk_event_handler_set(reinterpret_cast<GdkEventFunc>(gtk_main_do_event), + this, NULL); +#else g_source_destroy(x_source_); g_source_unref(x_source_); XCloseDisplay(g_xdisplay); g_xdisplay = NULL; -} - -#if defined(TOOLKIT_USES_GTK) -// static -void MessagePumpX::DisableGtkMessagePump() { - use_gtk_message_pump = false; -} #endif +} // static Display* MessagePumpX::GetDefaultXDisplay() { #if defined(TOOLKIT_USES_GTK) - if (use_gtk_message_pump) { - static GdkDisplay* display = gdk_display_get_default(); - return display ? GDK_DISPLAY_XDISPLAY(display) : NULL; - } -#endif + static GdkDisplay* display = gdk_display_get_default(); + return display ? GDK_DISPLAY_XDISPLAY(display) : NULL; +#else if (!g_xdisplay) g_xdisplay = XOpenDisplay(NULL); return g_xdisplay; +#endif } // static @@ -179,7 +159,7 @@ void MessagePumpX::InitXSource() { bool MessagePumpX::ShouldCaptureXEvent(XEvent* xev) { return #if defined(TOOLKIT_USES_GTK) - (!use_gtk_message_pump || capture_x_events_[xev->type]) && + capture_x_events_[xev->type] && #endif (xev->type != GenericEvent || xev->xcookie.extension == xiopcode); } @@ -227,7 +207,7 @@ bool MessagePumpX::RunOnce(GMainContext* context, bool block) { if (ProcessXEvent(&xev)) return true; #if defined(TOOLKIT_USES_GTK) - } else if (use_gtk_message_pump && gdksource_) { + } else if (gdksource_) { // 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. @@ -239,7 +219,7 @@ bool MessagePumpX::RunOnce(GMainContext* context, bool block) { bool retvalue; #if defined(TOOLKIT_USES_GTK) - if (gdksource_ && use_gtk_message_pump) { + if (gdksource_) { // Replace the dispatch callback of the GDK event source temporarily so that // it doesn't read events from X. gboolean (*cb)(GSource*, GSourceFunc, void*) = @@ -290,14 +270,11 @@ GdkFilterReturn MessagePumpX::GdkEventFilter(GdkXEvent* gxevent, pump->ProcessXEvent(xev); return GDK_FILTER_REMOVE; } - CHECK(use_gtk_message_pump) << "GdkEvent:" << gevent->type; return GDK_FILTER_CONTINUE; } void MessagePumpX::EventDispatcherX(GdkEvent* event, gpointer data) { MessagePumpX* pump_x = reinterpret_cast<MessagePumpX*>(data); - CHECK(use_gtk_message_pump) << "GdkEvent:" << event->type; - if (!pump_x->gdksource_) { pump_x->gdksource_ = g_main_current_source(); if (pump_x->gdksource_) diff --git a/base/message_pump_x.h b/base/message_pump_x.h index 39d7d9c..231100d 100644 --- a/base/message_pump_x.h +++ b/base/message_pump_x.h @@ -52,12 +52,6 @@ class BASE_EXPORT MessagePumpX : public MessagePumpGlib { // Overridden from MessagePumpGlib: virtual bool RunOnce(GMainContext* context, bool block) OVERRIDE; -#if defined(TOOLKIT_USES_GTK) - // Disables Gtk/Gdk event pumping. This will be used when - // NativeWidgetX is enabled. - static void DisableGtkMessagePump(); -#endif - // Returns default X Display. static Display* GetDefaultXDisplay(); |