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 "content/browser/renderer_host/render_widget_host_view_gtk.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_gtk.h" |
6 | 6 |
7 // If this gets included after the gtk headers, then a bunch of compiler | 7 // If this gets included after the gtk headers, then a bunch of compiler |
8 // errors happen because of a "#define Status int" in Xlib.h, which interacts | 8 // errors happen because of a "#define Status int" in Xlib.h, which interacts |
9 // badly with net::URLRequestStatus::Status. | 9 // badly with net::URLRequestStatus::Status. |
10 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 | 719 |
720 void RenderWidgetHostViewGtk::Hide() { | 720 void RenderWidgetHostViewGtk::Hide() { |
721 gtk_widget_hide(view_.get()); | 721 gtk_widget_hide(view_.get()); |
722 } | 722 } |
723 | 723 |
724 bool RenderWidgetHostViewGtk::IsShowing() { | 724 bool RenderWidgetHostViewGtk::IsShowing() { |
725 return gtk_widget_get_visible(view_.get()); | 725 return gtk_widget_get_visible(view_.get()); |
726 } | 726 } |
727 | 727 |
728 gfx::Rect RenderWidgetHostViewGtk::GetViewBounds() const { | 728 gfx::Rect RenderWidgetHostViewGtk::GetViewBounds() const { |
729 GtkAllocation* alloc = &view_.get()->allocation; | 729 GdkWindow* gdk_window = view_.get()->window; |
730 return gfx::Rect(alloc->x, alloc->y, | 730 if (!gdk_window) |
731 requested_size_.width(), | 731 return gfx::Rect(requested_size_); |
732 requested_size_.height()); | 732 GdkRectangle window_rect; |
| 733 gdk_window_get_origin(gdk_window, &window_rect.x, &window_rect.y); |
| 734 return gfx::Rect(window_rect.x, window_rect.y, |
| 735 requested_size_.width(), requested_size_.height()); |
733 } | 736 } |
734 | 737 |
735 void RenderWidgetHostViewGtk::UpdateCursor(const WebCursor& cursor) { | 738 void RenderWidgetHostViewGtk::UpdateCursor(const WebCursor& cursor) { |
736 // Optimize the common case, where the cursor hasn't changed. | 739 // Optimize the common case, where the cursor hasn't changed. |
737 // However, we can switch between different pixmaps, so only on the | 740 // However, we can switch between different pixmaps, so only on the |
738 // non-pixmap branch. | 741 // non-pixmap branch. |
739 if (current_cursor_.GetCursorType() != GDK_CURSOR_IS_PIXMAP && | 742 if (current_cursor_.GetCursorType() != GDK_CURSOR_IS_PIXMAP && |
740 current_cursor_.GetCursorType() == cursor.GetCursorType()) { | 743 current_cursor_.GetCursorType() == cursor.GetCursorType()) { |
741 return; | 744 return; |
742 } | 745 } |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1249 last_mouse_down_ = temp; | 1252 last_mouse_down_ = temp; |
1250 } | 1253 } |
1251 | 1254 |
1252 // static | 1255 // static |
1253 void RenderWidgetHostView::GetDefaultScreenInfo( | 1256 void RenderWidgetHostView::GetDefaultScreenInfo( |
1254 WebKit::WebScreenInfo* results) { | 1257 WebKit::WebScreenInfo* results) { |
1255 GdkWindow* gdk_window = | 1258 GdkWindow* gdk_window = |
1256 gdk_display_get_default_group(gdk_display_get_default()); | 1259 gdk_display_get_default_group(gdk_display_get_default()); |
1257 GetScreenInfoFromNativeWindow(gdk_window, results); | 1260 GetScreenInfoFromNativeWindow(gdk_window, results); |
1258 } | 1261 } |
OLD | NEW |