| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/ui_controls/ui_controls.h" | 5 #include "ui/ui_controls/ui_controls.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "ui/base/gtk/gtk_screen_util.h" | 13 #include "ui/base/gtk/gtk_screen_util.h" |
| 14 #include "ui/base/gtk/event_synthesis_gtk.h" | 14 #include "ui/base/gtk/event_synthesis_gtk.h" |
| 15 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.h" |
| 16 | 16 |
| 17 #if defined(TOOLKIT_VIEWS) | |
| 18 #include "ui/views/view.h" | |
| 19 #include "ui/views/widget/widget.h" | |
| 20 #endif | |
| 21 | |
| 22 namespace { | 17 namespace { |
| 23 | 18 |
| 24 // static | 19 // static |
| 25 guint32 XTimeNow() { | 20 guint32 XTimeNow() { |
| 26 struct timespec ts; | 21 struct timespec ts; |
| 27 clock_gettime(CLOCK_MONOTONIC, &ts); | 22 clock_gettime(CLOCK_MONOTONIC, &ts); |
| 28 return ts.tv_sec * 1000 + ts.tv_nsec / 1000000; | 23 return ts.tv_sec * 1000 + ts.tv_nsec / 1000000; |
| 29 } | 24 } |
| 30 | 25 |
| 31 class EventWaiter : public MessageLoopForUI::Observer { | 26 class EventWaiter : public MessageLoopForUI::Observer { |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 wait_type = GDK_3BUTTON_PRESS; | 239 wait_type = GDK_3BUTTON_PRESS; |
| 245 } | 240 } |
| 246 new EventWaiter(task, wait_type, 1); | 241 new EventWaiter(task, wait_type, 1); |
| 247 return rv; | 242 return rv; |
| 248 } | 243 } |
| 249 | 244 |
| 250 bool SendMouseClick(MouseButton type) { | 245 bool SendMouseClick(MouseButton type) { |
| 251 return SendMouseEvents(type, UP | DOWN); | 246 return SendMouseEvents(type, UP | DOWN); |
| 252 } | 247 } |
| 253 | 248 |
| 254 #if defined(TOOLKIT_VIEWS) | |
| 255 void RunClosureAfterAllPendingUIEvents(const base::Closure& task) { | |
| 256 // Send noop event and run task. | |
| 257 int x, y; | |
| 258 gdk_window_at_pointer(&x, &y); | |
| 259 SendMouseMoveNotifyWhenDone(x, y, task); | |
| 260 } | |
| 261 #endif | |
| 262 | |
| 263 } // namespace ui_controls | 249 } // namespace ui_controls |
| OLD | NEW |