| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/renderer_host/render_widget_host_view_gtk.h" | 5 #include "chrome/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 URLRequestStatus::Status. | 9 // badly with URLRequestStatus::Status. |
| 10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 G_CALLBACK(ButtonPressReleaseEvent), host_view); | 78 G_CALLBACK(ButtonPressReleaseEvent), host_view); |
| 79 g_signal_connect(widget, "button-release-event", | 79 g_signal_connect(widget, "button-release-event", |
| 80 G_CALLBACK(ButtonPressReleaseEvent), host_view); | 80 G_CALLBACK(ButtonPressReleaseEvent), host_view); |
| 81 g_signal_connect(widget, "motion-notify-event", | 81 g_signal_connect(widget, "motion-notify-event", |
| 82 G_CALLBACK(MouseMoveEvent), host_view); | 82 G_CALLBACK(MouseMoveEvent), host_view); |
| 83 // Connect after so that we are called after the handler installed by the | 83 // Connect after so that we are called after the handler installed by the |
| 84 // TabContentsView which handles zoom events. | 84 // TabContentsView which handles zoom events. |
| 85 g_signal_connect_after(widget, "scroll-event", | 85 g_signal_connect_after(widget, "scroll-event", |
| 86 G_CALLBACK(MouseScrollEvent), host_view); | 86 G_CALLBACK(MouseScrollEvent), host_view); |
| 87 | 87 |
| 88 // Create GtkIMContext wrapper object. | |
| 89 host_view->im_context_.reset(new GtkIMContextWrapper(host_view)); | |
| 90 | |
| 91 return widget; | 88 return widget; |
| 92 } | 89 } |
| 93 | 90 |
| 94 private: | 91 private: |
| 95 static gboolean SizeAllocate(GtkWidget* widget, GtkAllocation* allocation, | 92 static gboolean SizeAllocate(GtkWidget* widget, GtkAllocation* allocation, |
| 96 RenderWidgetHostViewGtk* host_view) { | 93 RenderWidgetHostViewGtk* host_view) { |
| 97 host_view->GetRenderWidgetHost()->WasResized(); | 94 host_view->GetRenderWidgetHost()->WasResized(); |
| 98 return FALSE; | 95 return FALSE; |
| 99 } | 96 } |
| 100 | 97 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 was_focused_before_grab_(false) { | 290 was_focused_before_grab_(false) { |
| 294 host_->set_view(this); | 291 host_->set_view(this); |
| 295 } | 292 } |
| 296 | 293 |
| 297 RenderWidgetHostViewGtk::~RenderWidgetHostViewGtk() { | 294 RenderWidgetHostViewGtk::~RenderWidgetHostViewGtk() { |
| 298 view_.Destroy(); | 295 view_.Destroy(); |
| 299 } | 296 } |
| 300 | 297 |
| 301 void RenderWidgetHostViewGtk::InitAsChild() { | 298 void RenderWidgetHostViewGtk::InitAsChild() { |
| 302 view_.Own(RenderWidgetHostViewGtkWidget::CreateNewWidget(this)); | 299 view_.Own(RenderWidgetHostViewGtkWidget::CreateNewWidget(this)); |
| 300 // |im_context_| must be created after creating |view_| widget. |
| 301 im_context_.reset(new GtkIMContextWrapper(this)); |
| 303 plugin_container_manager_.set_host_widget(view_.get()); | 302 plugin_container_manager_.set_host_widget(view_.get()); |
| 304 gtk_widget_show(view_.get()); | 303 gtk_widget_show(view_.get()); |
| 305 } | 304 } |
| 306 | 305 |
| 307 void RenderWidgetHostViewGtk::InitAsPopup( | 306 void RenderWidgetHostViewGtk::InitAsPopup( |
| 308 RenderWidgetHostView* parent_host_view, const gfx::Rect& pos) { | 307 RenderWidgetHostView* parent_host_view, const gfx::Rect& pos) { |
| 309 parent_host_view_ = parent_host_view; | 308 parent_host_view_ = parent_host_view; |
| 310 parent_ = parent_host_view->GetNativeView(); | 309 parent_ = parent_host_view->GetNativeView(); |
| 311 GtkWidget* popup = gtk_window_new(GTK_WINDOW_POPUP); | 310 GtkWidget* popup = gtk_window_new(GTK_WINDOW_POPUP); |
| 312 view_.Own(RenderWidgetHostViewGtkWidget::CreateNewWidget(this)); | 311 view_.Own(RenderWidgetHostViewGtkWidget::CreateNewWidget(this)); |
| 312 // |im_context_| must be created after creating |view_| widget. |
| 313 im_context_.reset(new GtkIMContextWrapper(this)); |
| 313 plugin_container_manager_.set_host_widget(view_.get()); | 314 plugin_container_manager_.set_host_widget(view_.get()); |
| 314 gtk_container_add(GTK_CONTAINER(popup), view_.get()); | 315 gtk_container_add(GTK_CONTAINER(popup), view_.get()); |
| 315 | 316 |
| 316 // If we are not activatable, we don't want to grab keyboard input, | 317 // If we are not activatable, we don't want to grab keyboard input, |
| 317 // and webkit will manage our destruction. | 318 // and webkit will manage our destruction. |
| 318 if (activatable()) { | 319 if (activatable()) { |
| 319 // Grab all input for the app. If a click lands outside the bounds of the | 320 // Grab all input for the app. If a click lands outside the bounds of the |
| 320 // popup, WebKit will notice and destroy us. Before doing this we need | 321 // popup, WebKit will notice and destroy us. Before doing this we need |
| 321 // to ensure that the the popup is added to the browser's window group, | 322 // to ensure that the the popup is added to the browser's window group, |
| 322 // to allow for the grabs to work correctly. | 323 // to allow for the grabs to work correctly. |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 | 622 |
| 622 void RenderWidgetHostViewGtk::CreatePluginContainer( | 623 void RenderWidgetHostViewGtk::CreatePluginContainer( |
| 623 gfx::PluginWindowHandle id) { | 624 gfx::PluginWindowHandle id) { |
| 624 plugin_container_manager_.CreatePluginContainer(id); | 625 plugin_container_manager_.CreatePluginContainer(id); |
| 625 } | 626 } |
| 626 | 627 |
| 627 void RenderWidgetHostViewGtk::DestroyPluginContainer( | 628 void RenderWidgetHostViewGtk::DestroyPluginContainer( |
| 628 gfx::PluginWindowHandle id) { | 629 gfx::PluginWindowHandle id) { |
| 629 plugin_container_manager_.DestroyPluginContainer(id); | 630 plugin_container_manager_.DestroyPluginContainer(id); |
| 630 } | 631 } |
| OLD | NEW |