| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/automation/ui_controls.h" | 5 #include "chrome/browser/automation/ui_controls.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
| 9 | 9 |
| 10 #include "base/gfx/rect.h" | 10 #include "base/gfx/rect.h" |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 270 |
| 271 g_object_ref(event->button.window); | 271 g_object_ref(event->button.window); |
| 272 event->button.x = x; | 272 event->button.x = x; |
| 273 event->button.y = y; | 273 event->button.y = y; |
| 274 gint origin_x, origin_y; | 274 gint origin_x, origin_y; |
| 275 gdk_window_get_origin(event->button.window, &origin_x, &origin_y); | 275 gdk_window_get_origin(event->button.window, &origin_x, &origin_y); |
| 276 event->button.x_root = x + origin_x; | 276 event->button.x_root = x + origin_x; |
| 277 event->button.y_root = y + origin_y; | 277 event->button.y_root = y + origin_y; |
| 278 | 278 |
| 279 event->button.axes = NULL; | 279 event->button.axes = NULL; |
| 280 gdk_window_get_pointer(event->button.window, NULL, NULL, | 280 GdkModifierType modifier; |
| 281 reinterpret_cast<GdkModifierType*>(&event->button.state)); | 281 gdk_window_get_pointer(event->button.window, NULL, NULL, &modifier); |
| 282 event->button.state = modifier; |
| 282 event->button.button = type == LEFT ? 1 : (type == MIDDLE ? 2 : 3); | 283 event->button.button = type == LEFT ? 1 : (type == MIDDLE ? 2 : 3); |
| 283 event->button.device = gdk_device_get_core_pointer(); | 284 event->button.device = gdk_device_get_core_pointer(); |
| 284 | 285 |
| 285 event->button.type = GDK_BUTTON_PRESS; | 286 event->button.type = GDK_BUTTON_PRESS; |
| 286 if (state & DOWN) | 287 if (state & DOWN) |
| 287 gdk_event_put(event); | 288 gdk_event_put(event); |
| 288 | 289 |
| 289 // Also send a release event. | 290 // Also send a release event. |
| 290 GdkEvent* release_event = gdk_event_copy(event); | 291 GdkEvent* release_event = gdk_event_copy(event); |
| 291 release_event->button.type = GDK_BUTTON_RELEASE; | 292 release_event->button.type = GDK_BUTTON_RELEASE; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 int state, | 335 int state, |
| 335 Task* task) { | 336 Task* task) { |
| 336 gfx::Rect bounds = gtk_util::GetWidgetScreenBounds(widget); | 337 gfx::Rect bounds = gtk_util::GetWidgetScreenBounds(widget); |
| 337 SendMouseMoveNotifyWhenDone(bounds.x() + bounds.width() / 2, | 338 SendMouseMoveNotifyWhenDone(bounds.x() + bounds.width() / 2, |
| 338 bounds.y() + bounds.height() / 2, | 339 bounds.y() + bounds.height() / 2, |
| 339 new ClickTask(button, state, task)); | 340 new ClickTask(button, state, task)); |
| 340 } | 341 } |
| 341 #endif | 342 #endif |
| 342 | 343 |
| 343 } // namespace ui_controls | 344 } // namespace ui_controls |
| OLD | NEW |