summaryrefslogtreecommitdiffstats
path: root/views/widget/native_widget_gtk.cc
diff options
context:
space:
mode:
Diffstat (limited to 'views/widget/native_widget_gtk.cc')
-rw-r--r--views/widget/native_widget_gtk.cc28
1 files changed, 13 insertions, 15 deletions
diff --git a/views/widget/native_widget_gtk.cc b/views/widget/native_widget_gtk.cc
index 564bb46..634a754 100644
--- a/views/widget/native_widget_gtk.cc
+++ b/views/widget/native_widget_gtk.cc
@@ -1331,10 +1331,6 @@ bool NativeWidgetGtk::ConvertPointFromAncestor(
return false;
}
-gfx::Rect NativeWidgetGtk::GetWorkAreaBoundsInScreen() const {
- return gfx::Screen::GetMonitorWorkAreaNearestWindow(GetNativeView());
-}
-
////////////////////////////////////////////////////////////////////////////////
// NativeWidgetGtk, protected:
@@ -2136,20 +2132,22 @@ bool Widget::ConvertRect(const Widget* source,
DCHECK(target);
DCHECK(rect);
- // TODO(oshima): Add check if source and target belongs to the same
- // screen.
-
- if (source == target)
+ GtkWidget* source_widget = source->GetNativeView();
+ GtkWidget* target_widget = target->GetNativeView();
+ if (source_widget == target_widget)
return true;
- if (!source || !target)
- return false;
- gfx::Point source_point = source->GetWindowScreenBounds().origin();
- gfx::Point target_point = target->GetWindowScreenBounds().origin();
+ if (!source_widget || !target_widget)
+ return false;
- rect->set_origin(
- source_point.Subtract(target_point).Add(rect->origin()));
- return true;
+ GdkRectangle gdk_rect = rect->ToGdkRectangle();
+ if (gtk_widget_translate_coordinates(source_widget, target_widget,
+ gdk_rect.x, gdk_rect.y,
+ &gdk_rect.x, &gdk_rect.y)) {
+ *rect = gdk_rect;
+ return true;
+ }
+ return false;
}
namespace internal {