| OLD | NEW |
| 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/ui/gtk/gtk_util.h" | 5 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 6 | 6 |
| 7 #include <cairo/cairo.h> | 7 #include <cairo/cairo.h> |
| 8 #include <gdk/gdkx.h> | 8 #include <gdk/gdkx.h> |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 | 10 |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 | 465 |
| 466 gfx::Point GetWidgetScreenPosition(GtkWidget* widget) { | 466 gfx::Point GetWidgetScreenPosition(GtkWidget* widget) { |
| 467 if (!widget->window) { | 467 if (!widget->window) { |
| 468 NOTREACHED() << "Must only be called on realized widgets."; | 468 NOTREACHED() << "Must only be called on realized widgets."; |
| 469 return gfx::Point(0, 0); | 469 return gfx::Point(0, 0); |
| 470 } | 470 } |
| 471 | 471 |
| 472 gint x, y; | 472 gint x, y; |
| 473 gdk_window_get_origin(widget->window, &x, &y); | 473 gdk_window_get_origin(widget->window, &x, &y); |
| 474 | 474 |
| 475 if (!GTK_IS_WINDOW(widget)) { | 475 if (GTK_WIDGET_NO_WINDOW(widget)) { |
| 476 x += widget->allocation.x; | 476 x += widget->allocation.x; |
| 477 y += widget->allocation.y; | 477 y += widget->allocation.y; |
| 478 } | 478 } |
| 479 | 479 |
| 480 return gfx::Point(x, y); | 480 return gfx::Point(x, y); |
| 481 } | 481 } |
| 482 | 482 |
| 483 gfx::Rect GetWidgetScreenBounds(GtkWidget* widget) { | 483 gfx::Rect GetWidgetScreenBounds(GtkWidget* widget) { |
| 484 gfx::Point position = GetWidgetScreenPosition(widget); | 484 gfx::Point position = GetWidgetScreenPosition(widget); |
| 485 return gfx::Rect(position.x(), position.y(), | 485 return gfx::Rect(position.x(), position.y(), |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 | 1241 |
| 1242 void DoCopy(BrowserWindow* window) { | 1242 void DoCopy(BrowserWindow* window) { |
| 1243 DoCutCopyPaste(window, &RenderViewHost::Copy, "copy-clipboard"); | 1243 DoCutCopyPaste(window, &RenderViewHost::Copy, "copy-clipboard"); |
| 1244 } | 1244 } |
| 1245 | 1245 |
| 1246 void DoPaste(BrowserWindow* window) { | 1246 void DoPaste(BrowserWindow* window) { |
| 1247 DoCutCopyPaste(window, &RenderViewHost::Paste, "paste-clipboard"); | 1247 DoCutCopyPaste(window, &RenderViewHost::Paste, "paste-clipboard"); |
| 1248 } | 1248 } |
| 1249 | 1249 |
| 1250 } // namespace gtk_util | 1250 } // namespace gtk_util |
| OLD | NEW |