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

Side by Side Diff: chrome/browser/automation/ui_controls_linux.cc

Issue 7850026: Aura under Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: First version that links (and crashes) Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 new EventWaiter(task, wait_type, 1); 240 new EventWaiter(task, wait_type, 1);
241 return rv; 241 return rv;
242 } 242 }
243 243
244 bool SendMouseClick(MouseButton type) { 244 bool SendMouseClick(MouseButton type) {
245 return SendMouseEvents(type, UP | DOWN); 245 return SendMouseEvents(type, UP | DOWN);
246 } 246 }
247 247
248 #if defined(TOOLKIT_VIEWS) 248 #if defined(TOOLKIT_VIEWS)
249 249
250 #if defined(OS_LINUX) 250 #if defined(OS_LINUX) && !defined(USE_AURA)
251 void OnConfigure(GtkWidget* gtk_widget, GdkEvent* event, gpointer data) { 251 void OnConfigure(GtkWidget* gtk_widget, GdkEvent* event, gpointer data) {
252 views::Widget* widget = static_cast<views::Widget*>(data); 252 views::Widget* widget = static_cast<views::Widget*>(data);
253 gfx::Rect actual = widget->GetWindowScreenBounds(); 253 gfx::Rect actual = widget->GetWindowScreenBounds();
254 gfx::Rect desired = widget->GetRootView()->bounds(); 254 gfx::Rect desired = widget->GetRootView()->bounds();
255 if (actual.size() == desired.size()) 255 if (actual.size() == desired.size())
256 MessageLoop::current()->Quit(); 256 MessageLoop::current()->Quit();
257 } 257 }
258 258
259 void SynchronizeWidgetSize(views::Widget* widget) { 259 void SynchronizeWidgetSize(views::Widget* widget) {
260 // If the actual window size and desired window size 260 // If the actual window size and desired window size
261 // are different, wait until the window is resized 261 // are different, wait until the window is resized
262 // to desired size. 262 // to desired size.
263 gfx::Rect actual = widget->GetWindowScreenBounds(); 263 gfx::Rect actual = widget->GetWindowScreenBounds();
264 gfx::Rect desired = widget->GetRootView()->bounds(); 264 gfx::Rect desired = widget->GetRootView()->bounds();
265 if (actual.size() != desired.size()) { 265 if (actual.size() != desired.size()) {
266 // Listen to configure-event that is emitted when an window gets 266 // Listen to configure-event that is emitted when an window gets
267 // resized. 267 // resized.
268 GtkWidget* gtk_widget = widget->GetNativeView(); 268 GtkWidget* gtk_widget = widget->GetNativeView();
269 g_signal_connect(gtk_widget, "configure-event", 269 g_signal_connect(gtk_widget, "configure-event",
270 G_CALLBACK(&OnConfigure), widget); 270 G_CALLBACK(&OnConfigure), widget);
271 MessageLoop::current()->Run(); 271 MessageLoop::current()->Run();
272 } 272 }
273 } 273 }
274 #endif 274 #endif
275 275
276 void MoveMouseToCenterAndPress(views::View* view, MouseButton button, 276 void MoveMouseToCenterAndPress(views::View* view, MouseButton button,
277 int state, Task* task) { 277 int state, Task* task) {
278 #if defined(OS_LINUX) 278 #if defined(OS_LINUX) && !defined(USE_AURA)
279 // X is asynchronous and we need to wait until the window gets 279 // X is asynchronous and we need to wait until the window gets
280 // resized to desired size. 280 // resized to desired size.
281 SynchronizeWidgetSize(view->GetWidget()); 281 SynchronizeWidgetSize(view->GetWidget());
282 #endif 282 #endif
283 283
284 gfx::Point view_center(view->width() / 2, view->height() / 2); 284 gfx::Point view_center(view->width() / 2, view->height() / 2);
285 views::View::ConvertPointToScreen(view, &view_center); 285 views::View::ConvertPointToScreen(view, &view_center);
286 SendMouseMoveNotifyWhenDone(view_center.x(), view_center.y(), 286 SendMouseMoveNotifyWhenDone(view_center.x(), view_center.y(),
287 new ClickTask(button, state, task)); 287 new ClickTask(button, state, task));
288 } 288 }
289 #else 289 #else
290 void MoveMouseToCenterAndPress(GtkWidget* widget, 290 void MoveMouseToCenterAndPress(GtkWidget* widget,
291 MouseButton button, 291 MouseButton button,
292 int state, 292 int state,
293 Task* task) { 293 Task* task) {
294 gfx::Rect bounds = gtk_util::GetWidgetScreenBounds(widget); 294 gfx::Rect bounds = gtk_util::GetWidgetScreenBounds(widget);
295 SendMouseMoveNotifyWhenDone(bounds.x() + bounds.width() / 2, 295 SendMouseMoveNotifyWhenDone(bounds.x() + bounds.width() / 2,
296 bounds.y() + bounds.height() / 2, 296 bounds.y() + bounds.height() / 2,
297 new ClickTask(button, state, task)); 297 new ClickTask(button, state, task));
298 } 298 }
299 #endif 299 #endif
300 300
301 } // namespace ui_controls 301 } // namespace ui_controls
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/bookmarks/bookmark_folder_editor_controller.cc » ('j') | chrome/browser/ui/gtk/gtk_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698