Index: ui/base/x/events_x.cc |
diff --git a/ui/base/x/events_x.cc b/ui/base/x/events_x.cc |
index 966fec275141e06a768c3e9da254b5010621cee8..b5d62df0cdda90b22d385a6c2e9c95d5104e66f4 100644 |
--- a/ui/base/x/events_x.cc |
+++ b/ui/base/x/events_x.cc |
@@ -8,6 +8,9 @@ |
#include <X11/extensions/XInput2.h> |
#include "base/logging.h" |
+#if !defined(TOOLKIT_USES_GTK) |
sky
2011/11/22 00:28:33
nit: conditional includes after non-conditional in
oshima
2011/11/22 01:36:10
Done.
|
+#include "base/message_pump_x.h" |
+#endif |
#include "ui/base/keycodes/keyboard_code_conversion_x.h" |
#include "ui/base/touch/touch_factory.h" |
#include "ui/gfx/point.h" |
@@ -356,12 +359,24 @@ float GetTouchForce(const base::NativeEvent& native_event) { |
} |
base::NativeEvent CreateNoopEvent() { |
- static XEvent* noop = new XEvent(); |
- noop->xclient.type = ClientMessage; |
- noop->xclient.display = NULL; |
- noop->xclient.window = None; |
- noop->xclient.message_type = 0; |
- noop->xclient.format = 0; |
+ static XEvent* noop = NULL; |
+ if (!noop) { |
+ noop = new XEvent(); |
+ noop->xclient.type = ClientMessage; |
+ noop->xclient.display = NULL; |
Daniel Erat
2011/11/22 00:25:32
just memset it to 0 first? that way you don't nee
oshima
2011/11/22 01:36:10
Actually this wasn't necessary. constructor should
|
+ noop->xclient.window = None; |
+ noop->xclient.format = 8; |
+ } |
+ // TODO(oshima): Remove ifdef once gtk is removed from views. |
+#if defined(TOOLKIT_USES_GTK) |
+ NOTREACHED(); |
+#else |
+ // Make sure we use atom from current xdisplay, which may |
+ // change during the test. |
+ noop->xclient.message_type = XInternAtom( |
+ base::MessagePumpX::GetDefaultXDisplay(), |
+ "noop", False); |
+#endif |
return noop; |
} |