diff options
Diffstat (limited to 'webkit/glue/plugins/webplugin_delegate_impl_gtk.cc')
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl_gtk.cc | 55 |
1 files changed, 16 insertions, 39 deletions
diff --git a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc index f583876..49670fc 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc @@ -38,7 +38,7 @@ using WebKit::WebMouseEvent; WebPluginDelegate* WebPluginDelegate::Create( const FilePath& filename, const std::string& mime_type, - gfx::NativeView containing_view) { + gfx::PluginWindowHandle containing_view) { scoped_refptr<NPAPI::PluginLib> plugin = NPAPI::PluginLib::CreatePluginLib(filename); if (plugin.get() == NULL) @@ -54,7 +54,7 @@ WebPluginDelegate* WebPluginDelegate::Create( } WebPluginDelegateImpl::WebPluginDelegateImpl( - gfx::NativeView containing_view, + gfx::PluginWindowHandle containing_view, NPAPI::PluginInstance *instance) : windowed_handle_(0), @@ -263,63 +263,40 @@ bool WebPluginDelegateImpl::WindowedCreatePlugin() { return false; } - windowed_handle_ = gtk_plugin_container_new(); - gtk_container_add(GTK_CONTAINER(parent_), windowed_handle_); - gtk_widget_show(windowed_handle_); - gtk_widget_realize(windowed_handle_); - - window_.window = GINT_TO_POINTER( - gtk_socket_get_id(GTK_SOCKET(windowed_handle_))); + window_.window = reinterpret_cast<void*>(parent_); + // The remainder of the code expects windowed_handle_ to exist for + // windowed mode, despite not actually ever reaching through + // windowed_handle_. So let's set it to the one window handle we + // actually have available. + windowed_handle_ = parent_; if (!window_.ws_info) window_.ws_info = new NPSetWindowCallbackStruct; NPSetWindowCallbackStruct* extra = static_cast<NPSetWindowCallbackStruct*>(window_.ws_info); - extra->display = GDK_WINDOW_XDISPLAY(windowed_handle_->window); - GdkVisual* visual = gdk_drawable_get_visual(windowed_handle_->window); - extra->visual = GDK_VISUAL_XVISUAL(visual); - extra->depth = visual->depth; - extra->colormap = GDK_COLORMAP_XCOLORMAP(gdk_drawable_get_colormap(windowed_handle_->window)); + extra->display = GDK_DISPLAY(); + extra->visual = DefaultVisual(GDK_DISPLAY(), 0); + extra->depth = DefaultDepth(GDK_DISPLAY(), 0); + extra->colormap = DefaultColormap(GDK_DISPLAY(), 0); return true; } void WebPluginDelegateImpl::WindowedDestroyWindow() { - if (windowed_handle_ != NULL) { - gtk_widget_destroy(windowed_handle_); - windowed_handle_ = NULL; - } + // We have no window to destroy; see comment in WindowedCreatePlugin + // where windowed_handle_ is set. + windowed_handle_ = 0; } bool WebPluginDelegateImpl::WindowedReposition( const gfx::Rect& window_rect, const gfx::Rect& clip_rect) { - if (!windowed_handle_) { - NOTREACHED(); - return false; - } - - if (window_rect_ == window_rect && clip_rect_ == clip_rect) + if (window_rect == window_rect_ && clip_rect == clip_rect_) return false; - // We only set the plugin's size here. Its position is moved elsewhere, which - // allows the window moves/scrolling/clipping to be synchronized with the page - // and other windows. - if (window_rect.size() != window_rect_.size()) { - gtk_plugin_container_set_size(windowed_handle_, window_rect.width(), - window_rect.height()); - GtkAllocation allocation = { 0, 0, - window_rect.width(), window_rect.height() }; - gtk_widget_size_allocate(windowed_handle_, &allocation); - } - window_rect_ = window_rect; clip_rect_ = clip_rect; - // TODO(deanm): Is this really needed? - // Ensure that the entire window gets repainted. - gtk_widget_queue_draw(windowed_handle_); - return true; } |