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

Side by Side Diff: ui/base/gtk/gtk_screen_util.cc

Issue 231733005: Delete the GTK+ port of Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remerge to ToT Created 6 years, 8 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/base/gtk/gtk_screen_util.h"
6
7 #include "base/logging.h"
8
9 namespace ui {
10
11 bool IsScreenComposited() {
12 GdkScreen* screen = gdk_screen_get_default();
13 return gdk_screen_is_composited(screen) == TRUE;
14 }
15
16 gfx::Point ScreenPoint(GtkWidget* widget) {
17 int x, y;
18 gdk_display_get_pointer(gtk_widget_get_display(widget), NULL, &x, &y,
19 NULL);
20 return gfx::Point(x, y);
21 }
22
23 gfx::Point ClientPoint(GtkWidget* widget) {
24 int x, y;
25 gtk_widget_get_pointer(widget, &x, &y);
26 return gfx::Point(x, y);
27 }
28
29 gfx::Vector2d GetWidgetScreenOffset(GtkWidget* widget) {
30 GdkWindow* window = gtk_widget_get_window(widget);
31
32 if (!window) {
33 NOTREACHED() << "Must only be called on realized widgets.";
34 return gfx::Vector2d(0, 0);
35 }
36
37 gint x, y;
38 gdk_window_get_origin(window, &x, &y);
39
40 if (!gtk_widget_get_has_window(widget)) {
41 GtkAllocation allocation;
42 gtk_widget_get_allocation(widget, &allocation);
43 x += allocation.x;
44 y += allocation.y;
45 }
46
47 return gfx::Vector2d(x, y);
48 }
49
50 gfx::Rect GetWidgetScreenBounds(GtkWidget* widget) {
51 GtkAllocation allocation;
52 gtk_widget_get_allocation(widget, &allocation);
53
54 return gfx::Rect(PointAtOffsetFromOrigin(GetWidgetScreenOffset(widget)),
55 gfx::Size(allocation.width, allocation.height));
56 }
57
58 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698