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

Unified Diff: base/message_loop/message_pump_x11.cc

Issue 23880006: gtk: Allow building both the X11 and Gtk message-pumps for gtk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge Created 7 years, 3 months 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 | « base/message_loop/message_pump_x11.h ('k') | chromeos/display/output_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop/message_pump_x11.cc
diff --git a/base/message_loop/message_pump_aurax11.cc b/base/message_loop/message_pump_x11.cc
similarity index 81%
rename from base/message_loop/message_pump_aurax11.cc
rename to base/message_loop/message_pump_x11.cc
index 54be49f65f9cf6e1cf087642c90885dd9885cbc5..7e780b2aba629df75cce34f4cbd477dea24db4cf 100644
--- a/base/message_loop/message_pump_aurax11.cc
+++ b/base/message_loop/message_pump_x11.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/message_loop/message_pump_aurax11.h"
+#include "base/message_loop/message_pump_x11.h"
#include <glib.h>
#include <X11/X.h>
@@ -17,7 +17,7 @@ namespace base {
namespace {
gboolean XSourcePrepare(GSource* source, gint* timeout_ms) {
- if (XPending(MessagePumpAuraX11::GetDefaultXDisplay()))
+ if (XPending(MessagePumpX11::GetDefaultXDisplay()))
*timeout_ms = 0;
else
*timeout_ms = -1;
@@ -25,13 +25,13 @@ gboolean XSourcePrepare(GSource* source, gint* timeout_ms) {
}
gboolean XSourceCheck(GSource* source) {
- return XPending(MessagePumpAuraX11::GetDefaultXDisplay());
+ return XPending(MessagePumpX11::GetDefaultXDisplay());
}
gboolean XSourceDispatch(GSource* source,
GSourceFunc unused_func,
gpointer data) {
- MessagePumpAuraX11* pump = static_cast<MessagePumpAuraX11*>(data);
+ MessagePumpX11* pump = static_cast<MessagePumpX11*>(data);
return pump->DispatchXEvents();
}
@@ -43,18 +43,18 @@ GSourceFuncs XSourceFuncs = {
};
// The connection is essentially a global that's accessed through a static
-// method and destroyed whenever ~MessagePumpAuraX11() is called. We do this
+// method and destroyed whenever ~MessagePumpX11() is called. We do this
// for historical reasons so user code can call
// MessagePumpForUI::GetDefaultXDisplay() where MessagePumpForUI is a typedef
// to whatever type in the current build.
//
// TODO(erg): This can be changed to something more sane like
-// MessagePumpAuraX11::Current()->display() once MessagePumpGtk goes away.
+// MessagePumpX11::Current()->display() once MessagePumpGtk goes away.
Display* g_xdisplay = NULL;
int g_xinput_opcode = -1;
bool InitializeXInput2Internal() {
- Display* display = MessagePumpAuraX11::GetDefaultXDisplay();
+ Display* display = MessagePumpX11::GetDefaultXDisplay();
if (!display)
return false;
@@ -103,7 +103,7 @@ bool InitializeXInput2() {
}
bool InitializeXkb() {
- Display* display = MessagePumpAuraX11::GetDefaultXDisplay();
+ Display* display = MessagePumpX11::GetDefaultXDisplay();
if (!display)
return false;
@@ -128,7 +128,7 @@ bool InitializeXkb() {
} // namespace
-MessagePumpAuraX11::MessagePumpAuraX11() : MessagePumpGlib(),
+MessagePumpX11::MessagePumpX11() : MessagePumpGlib(),
x_source_(NULL) {
InitializeXInput2();
InitializeXkb();
@@ -139,7 +139,7 @@ MessagePumpAuraX11::MessagePumpAuraX11() : MessagePumpGlib(),
x_root_window_ = DefaultRootWindow(g_xdisplay);
}
-MessagePumpAuraX11::~MessagePumpAuraX11() {
+MessagePumpX11::~MessagePumpX11() {
g_source_destroy(x_source_);
g_source_unref(x_source_);
XCloseDisplay(g_xdisplay);
@@ -147,52 +147,54 @@ MessagePumpAuraX11::~MessagePumpAuraX11() {
}
// static
-Display* MessagePumpAuraX11::GetDefaultXDisplay() {
+Display* MessagePumpX11::GetDefaultXDisplay() {
if (!g_xdisplay)
g_xdisplay = XOpenDisplay(NULL);
return g_xdisplay;
}
// static
-bool MessagePumpAuraX11::HasXInput2() {
+bool MessagePumpX11::HasXInput2() {
return InitializeXInput2();
}
+#if !defined(TOOLKIT_GTK)
// static
-MessagePumpAuraX11* MessagePumpAuraX11::Current() {
+MessagePumpX11* MessagePumpX11::Current() {
MessageLoopForUI* loop = MessageLoopForUI::current();
- return static_cast<MessagePumpAuraX11*>(loop->pump_ui());
+ return static_cast<MessagePumpX11*>(loop->pump_ui());
}
+#endif
-void MessagePumpAuraX11::AddDispatcherForWindow(
+void MessagePumpX11::AddDispatcherForWindow(
MessagePumpDispatcher* dispatcher,
unsigned long xid) {
dispatchers_.insert(std::make_pair(xid, dispatcher));
}
-void MessagePumpAuraX11::RemoveDispatcherForWindow(unsigned long xid) {
+void MessagePumpX11::RemoveDispatcherForWindow(unsigned long xid) {
dispatchers_.erase(xid);
}
-void MessagePumpAuraX11::AddDispatcherForRootWindow(
+void MessagePumpX11::AddDispatcherForRootWindow(
MessagePumpDispatcher* dispatcher) {
root_window_dispatchers_.AddObserver(dispatcher);
}
-void MessagePumpAuraX11::RemoveDispatcherForRootWindow(
+void MessagePumpX11::RemoveDispatcherForRootWindow(
MessagePumpDispatcher* dispatcher) {
root_window_dispatchers_.RemoveObserver(dispatcher);
}
-void MessagePumpAuraX11::AddObserver(MessagePumpObserver* observer) {
+void MessagePumpX11::AddObserver(MessagePumpObserver* observer) {
observers_.AddObserver(observer);
}
-void MessagePumpAuraX11::RemoveObserver(MessagePumpObserver* observer) {
+void MessagePumpX11::RemoveObserver(MessagePumpObserver* observer) {
observers_.RemoveObserver(observer);
}
-bool MessagePumpAuraX11::DispatchXEvents() {
+bool MessagePumpX11::DispatchXEvents() {
Display* display = GetDefaultXDisplay();
DCHECK(display);
MessagePumpDispatcher* dispatcher =
@@ -209,7 +211,7 @@ bool MessagePumpAuraX11::DispatchXEvents() {
return TRUE;
}
-void MessagePumpAuraX11::BlockUntilWindowMapped(unsigned long xid) {
+void MessagePumpX11::BlockUntilWindowMapped(unsigned long xid) {
XEvent event;
Display* display = GetDefaultXDisplay();
@@ -226,7 +228,7 @@ void MessagePumpAuraX11::BlockUntilWindowMapped(unsigned long xid) {
} while (event.type != MapNotify);
}
-void MessagePumpAuraX11::InitXSource() {
+void MessagePumpX11::InitXSource() {
// CHECKs are to help track down crbug.com/113106.
CHECK(!x_source_);
Display* display = GetDefaultXDisplay();
@@ -243,7 +245,7 @@ void MessagePumpAuraX11::InitXSource() {
g_source_attach(x_source_, g_main_context_default());
}
-bool MessagePumpAuraX11::ProcessXEvent(MessagePumpDispatcher* dispatcher,
+bool MessagePumpX11::ProcessXEvent(MessagePumpDispatcher* dispatcher,
XEvent* xev) {
bool should_quit = false;
@@ -268,7 +270,7 @@ bool MessagePumpAuraX11::ProcessXEvent(MessagePumpDispatcher* dispatcher,
return should_quit;
}
-bool MessagePumpAuraX11::WillProcessXEvent(XEvent* xevent) {
+bool MessagePumpX11::WillProcessXEvent(XEvent* xevent) {
if (!observers().might_have_observers())
return false;
ObserverListBase<MessagePumpObserver>::Iterator it(observers());
@@ -280,18 +282,18 @@ bool MessagePumpAuraX11::WillProcessXEvent(XEvent* xevent) {
return false;
}
-void MessagePumpAuraX11::DidProcessXEvent(XEvent* xevent) {
+void MessagePumpX11::DidProcessXEvent(XEvent* xevent) {
FOR_EACH_OBSERVER(MessagePumpObserver, observers(), DidProcessEvent(xevent));
}
-MessagePumpDispatcher* MessagePumpAuraX11::GetDispatcherForXEvent(
+MessagePumpDispatcher* MessagePumpX11::GetDispatcherForXEvent(
const NativeEvent& xev) const {
::Window x_window = FindEventTarget(xev);
DispatchersMap::const_iterator it = dispatchers_.find(x_window);
return it != dispatchers_.end() ? it->second : NULL;
}
-bool MessagePumpAuraX11::Dispatch(const NativeEvent& xev) {
+bool MessagePumpX11::Dispatch(const NativeEvent& xev) {
// MappingNotify events (meaning that the keyboard or pointer buttons have
// been remapped) aren't associated with a window; send them to all
// dispatchers.
« no previous file with comments | « base/message_loop/message_pump_x11.h ('k') | chromeos/display/output_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698