summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorerg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-13 00:40:18 +0000
committererg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-13 00:40:18 +0000
commit611b6f634dbdbc87a40810cc60f5713f4d5eb434 (patch)
tree3527b445dbc7533661085934789412f8e5a02b89 /ui
parent28da5d89c77bd784454dc9a59b4ecce67346b6cc (diff)
downloadchromium_src-611b6f634dbdbc87a40810cc60f5713f4d5eb434.zip
chromium_src-611b6f634dbdbc87a40810cc60f5713f4d5eb434.tar.gz
chromium_src-611b6f634dbdbc87a40810cc60f5713f4d5eb434.tar.bz2
content: Split web_drag_dest_gtk.cc into chrome/ and content/ parts.
This patch doesn't move web_drag_dest_gtk.cc into content/, but does remove all dependencies on chrome/ code. - Split out a delegate interface and move it - cross platform code from chrome/.../bookmark_node_data.cc is moved to ui/.../bookmark_format.h - gtk_util.cc has some layers split into gtk_screen_utils.cc. BUG=none TEST=none Review URL: http://codereview.chromium.org/8196001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105216 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/base/gtk/gtk_screen_utils.cc27
-rw-r--r--ui/base/gtk/gtk_screen_utils.h26
-rw-r--r--ui/ui.gyp2
3 files changed, 55 insertions, 0 deletions
diff --git a/ui/base/gtk/gtk_screen_utils.cc b/ui/base/gtk/gtk_screen_utils.cc
new file mode 100644
index 0000000..177b94c
--- /dev/null
+++ b/ui/base/gtk/gtk_screen_utils.cc
@@ -0,0 +1,27 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/base/gtk/gtk_screen_utils.h"
+
+namespace ui {
+
+bool IsScreenComposited() {
+ GdkScreen* screen = gdk_screen_get_default();
+ return gdk_screen_is_composited(screen) == TRUE;
+}
+
+gfx::Point ScreenPoint(GtkWidget* widget) {
+ int x, y;
+ gdk_display_get_pointer(gtk_widget_get_display(widget), NULL, &x, &y,
+ NULL);
+ return gfx::Point(x, y);
+}
+
+gfx::Point ClientPoint(GtkWidget* widget) {
+ int x, y;
+ gtk_widget_get_pointer(widget, &x, &y);
+ return gfx::Point(x, y);
+}
+
+} // namespace ui
diff --git a/ui/base/gtk/gtk_screen_utils.h b/ui/base/gtk/gtk_screen_utils.h
new file mode 100644
index 0000000..8262eb4
--- /dev/null
+++ b/ui/base/gtk/gtk_screen_utils.h
@@ -0,0 +1,26 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_BASE_GTK_GTK_SCREEN_UTILS_H_
+#define UI_BASE_GTK_GTK_SCREEN_UTILS_H_
+
+#include <gtk/gtk.h>
+
+#include "ui/base/ui_export.h"
+#include "ui/gfx/point.h"
+
+namespace ui {
+
+// Returns true if the screen is composited, false otherwise.
+UI_EXPORT bool IsScreenComposited();
+
+// Get the current location of the mouse cursor relative to the screen.
+UI_EXPORT gfx::Point ScreenPoint(GtkWidget* widget);
+
+// Get the current location of the mouse cursor relative to the widget.
+UI_EXPORT gfx::Point ClientPoint(GtkWidget* widget);
+
+} // namespace ui
+
+#endif // UI_BASE_GTK_GTK_SCREEN_UTILS_H_
diff --git a/ui/ui.gyp b/ui/ui.gyp
index b8b7de6..e69790e 100644
--- a/ui/ui.gyp
+++ b/ui/ui.gyp
@@ -113,6 +113,8 @@
'base/gtk/gtk_im_context_util.cc',
'base/gtk/gtk_im_context_util.h',
'base/gtk/gtk_hig_constants.h',
+ 'base/gtk/gtk_screen_utils.cc',
+ 'base/gtk/gtk_screen_utils.h',
'base/gtk/gtk_signal.h',
'base/gtk/gtk_signal_registrar.cc',
'base/gtk/gtk_signal_registrar.h',