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 "webkit/plugins/npapi/gtk_plugin_container_manager.h" | 5 #include "webkit/plugins/npapi/gtk_plugin_container_manager.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/base/gtk/gtk_compat.h" | 10 #include "ui/base/gtk/gtk_compat.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 if (!move.rects_valid) | 78 if (!move.rects_valid) |
79 return; | 79 return; |
80 | 80 |
81 // TODO(piman): if the widget hasn't been realized (e.g. the tab has been | 81 // TODO(piman): if the widget hasn't been realized (e.g. the tab has been |
82 // torn off and the parent gtk widget has been detached from the hierarchy), | 82 // torn off and the parent gtk widget has been detached from the hierarchy), |
83 // we lose the cutout information. | 83 // we lose the cutout information. |
84 if (gtk_widget_get_realized(widget)) { | 84 if (gtk_widget_get_realized(widget)) { |
85 GdkRectangle clip_rect = move.clip_rect.ToGdkRectangle(); | 85 GdkRectangle clip_rect = move.clip_rect.ToGdkRectangle(); |
86 GdkRegion* clip_region = gdk_region_rectangle(&clip_rect); | 86 GdkRegion* clip_region = gdk_region_rectangle(&clip_rect); |
87 gfx::SubtractRectanglesFromRegion(clip_region, move.cutout_rects); | 87 gfx::SubtractRectanglesFromRegion(clip_region, move.cutout_rects); |
88 gdk_window_shape_combine_region(widget->window, clip_region, 0, 0); | 88 gdk_window_shape_combine_region(gtk_widget_get_window(widget), |
| 89 clip_region, 0, 0); |
89 gdk_region_destroy(clip_region); | 90 gdk_region_destroy(clip_region); |
90 } | 91 } |
91 | 92 |
92 // Update the window position. Resizing is handled by WebPluginDelegate. | 93 // Update the window position. Resizing is handled by WebPluginDelegate. |
93 // TODO(deanm): Verify that we only need to move and not resize. | 94 // TODO(deanm): Verify that we only need to move and not resize. |
94 // TODO(evanm): we should cache the last shape and position and skip all | 95 // TODO(evanm): we should cache the last shape and position and skip all |
95 // of this business in the common case where nothing has changed. | 96 // of this business in the common case where nothing has changed. |
96 int current_x, current_y; | 97 int current_x, current_y; |
97 | 98 |
98 // Until the above TODO is resolved, we can grab the last position | 99 // Until the above TODO is resolved, we can grab the last position |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 GtkPluginContainerManager* plugin_container_manager = | 154 GtkPluginContainerManager* plugin_container_manager = |
154 static_cast<GtkPluginContainerManager*>(user_data); | 155 static_cast<GtkPluginContainerManager*>(user_data); |
155 | 156 |
156 gfx::PluginWindowHandle id = plugin_container_manager->MapWidgetToID(widget); | 157 gfx::PluginWindowHandle id = plugin_container_manager->MapWidgetToID(widget); |
157 if (id) | 158 if (id) |
158 gtk_socket_add_id(GTK_SOCKET(widget), id); | 159 gtk_socket_add_id(GTK_SOCKET(widget), id); |
159 } | 160 } |
160 | 161 |
161 } // namespace npapi | 162 } // namespace npapi |
162 } // namespace webkit | 163 } // namespace webkit |
OLD | NEW |