| 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 "app/event_synthesis_gtk.h" | 10 #include "app/event_synthesis_gtk.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 gdk_event_put(event); | 90 gdk_event_put(event); |
| 91 gdk_event_free(event); | 91 gdk_event_free(event); |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace | 94 } // namespace |
| 95 | 95 |
| 96 namespace ui_controls { | 96 namespace ui_controls { |
| 97 | 97 |
| 98 bool SendKeyPress(gfx::NativeWindow window, | 98 bool SendKeyPress(gfx::NativeWindow window, |
| 99 app::KeyboardCode key, | 99 ui::KeyboardCode key, |
| 100 bool control, bool shift, bool alt, bool command) { | 100 bool control, bool shift, bool alt, bool command) { |
| 101 DCHECK(command == false); // No command key on Linux | 101 DCHECK(command == false); // No command key on Linux |
| 102 GdkWindow* event_window = NULL; | 102 GdkWindow* event_window = NULL; |
| 103 GtkWidget* grab_widget = gtk_grab_get_current(); | 103 GtkWidget* grab_widget = gtk_grab_get_current(); |
| 104 if (grab_widget) { | 104 if (grab_widget) { |
| 105 // If there is a grab, send all events to the grabbed widget. | 105 // If there is a grab, send all events to the grabbed widget. |
| 106 event_window = grab_widget->window; | 106 event_window = grab_widget->window; |
| 107 } else if (window) { | 107 } else if (window) { |
| 108 event_window = GTK_WIDGET(window)->window; | 108 event_window = GTK_WIDGET(window)->window; |
| 109 } else { | 109 } else { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 130 iter != events.end(); ++iter) { | 130 iter != events.end(); ++iter) { |
| 131 gdk_event_put(*iter); | 131 gdk_event_put(*iter); |
| 132 // gdk_event_put appends a copy of the event. | 132 // gdk_event_put appends a copy of the event. |
| 133 gdk_event_free(*iter); | 133 gdk_event_free(*iter); |
| 134 } | 134 } |
| 135 | 135 |
| 136 return true; | 136 return true; |
| 137 } | 137 } |
| 138 | 138 |
| 139 bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, | 139 bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, |
| 140 app::KeyboardCode key, | 140 ui::KeyboardCode key, |
| 141 bool control, bool shift, | 141 bool control, bool shift, |
| 142 bool alt, bool command, | 142 bool alt, bool command, |
| 143 Task* task) { | 143 Task* task) { |
| 144 DCHECK(command == false); // No command key on Linux | 144 DCHECK(command == false); // No command key on Linux |
| 145 int release_count = 1; | 145 int release_count = 1; |
| 146 if (control) | 146 if (control) |
| 147 release_count++; | 147 release_count++; |
| 148 if (shift) | 148 if (shift) |
| 149 release_count++; | 149 release_count++; |
| 150 if (alt) | 150 if (alt) |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 int state, | 259 int state, |
| 260 Task* task) { | 260 Task* task) { |
| 261 gfx::Rect bounds = gtk_util::GetWidgetScreenBounds(widget); | 261 gfx::Rect bounds = gtk_util::GetWidgetScreenBounds(widget); |
| 262 SendMouseMoveNotifyWhenDone(bounds.x() + bounds.width() / 2, | 262 SendMouseMoveNotifyWhenDone(bounds.x() + bounds.width() / 2, |
| 263 bounds.y() + bounds.height() / 2, | 263 bounds.y() + bounds.height() / 2, |
| 264 new ClickTask(button, state, task)); | 264 new ClickTask(button, state, task)); |
| 265 } | 265 } |
| 266 #endif | 266 #endif |
| 267 | 267 |
| 268 } // namespace ui_controls | 268 } // namespace ui_controls |
| OLD | NEW |