| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 } | 237 } |
| 238 | 238 |
| 239 static gboolean OnFocusOut(GtkWidget* widget, | 239 static gboolean OnFocusOut(GtkWidget* widget, |
| 240 GdkEventFocus* focus, | 240 GdkEventFocus* focus, |
| 241 RenderWidgetHostViewGtk* host_view) { | 241 RenderWidgetHostViewGtk* host_view) { |
| 242 // Whenever we lose focus, set the cursor back to that of our parent window, | 242 // Whenever we lose focus, set the cursor back to that of our parent window, |
| 243 // which should be the default arrow. | 243 // which should be the default arrow. |
| 244 gdk_window_set_cursor(gtk_widget_get_window(widget), NULL); | 244 gdk_window_set_cursor(gtk_widget_get_window(widget), NULL); |
| 245 // If we are showing a context menu, maintain the illusion that webkit has | 245 // If we are showing a context menu, maintain the illusion that webkit has |
| 246 // focus. | 246 // focus. |
| 247 if (!host_view->is_showing_context_menu_) { | 247 if (!host_view->showing_context_menu()) { |
| 248 host_view->GetRenderWidgetHost()->SetActive(false); | 248 host_view->GetRenderWidgetHost()->SetActive(false); |
| 249 host_view->GetRenderWidgetHost()->Blur(); | 249 host_view->GetRenderWidgetHost()->Blur(); |
| 250 } | 250 } |
| 251 | 251 |
| 252 // Prevents us from stealing input context focus in OnGrabNotify() handler. | 252 // Prevents us from stealing input context focus in OnGrabNotify() handler. |
| 253 host_view->was_imcontext_focused_before_grab_ = false; | 253 host_view->was_imcontext_focused_before_grab_ = false; |
| 254 | 254 |
| 255 // Disable the GtkIMContext object. | 255 // Disable the GtkIMContext object. |
| 256 host_view->im_context_->OnFocusOut(); | 256 host_view->im_context_->OnFocusOut(); |
| 257 | 257 |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 } | 559 } |
| 560 | 560 |
| 561 DISALLOW_IMPLICIT_CONSTRUCTORS(RenderWidgetHostViewGtkWidget); | 561 DISALLOW_IMPLICIT_CONSTRUCTORS(RenderWidgetHostViewGtkWidget); |
| 562 }; | 562 }; |
| 563 | 563 |
| 564 RenderWidgetHostViewGtk::RenderWidgetHostViewGtk(RenderWidgetHost* widget_host) | 564 RenderWidgetHostViewGtk::RenderWidgetHostViewGtk(RenderWidgetHost* widget_host) |
| 565 : host_(widget_host), | 565 : host_(widget_host), |
| 566 about_to_validate_and_paint_(false), | 566 about_to_validate_and_paint_(false), |
| 567 is_hidden_(false), | 567 is_hidden_(false), |
| 568 is_loading_(false), | 568 is_loading_(false), |
| 569 is_showing_context_menu_(false), | |
| 570 parent_(NULL), | 569 parent_(NULL), |
| 571 is_popup_first_mouse_release_(true), | 570 is_popup_first_mouse_release_(true), |
| 572 was_imcontext_focused_before_grab_(false), | 571 was_imcontext_focused_before_grab_(false), |
| 573 do_x_grab_(false), | 572 do_x_grab_(false), |
| 574 is_fullscreen_(false), | 573 is_fullscreen_(false), |
| 575 destroy_handler_id_(0), | 574 destroy_handler_id_(0), |
| 576 dragged_at_horizontal_edge_(0), | 575 dragged_at_horizontal_edge_(0), |
| 577 dragged_at_vertical_edge_(0), | 576 dragged_at_vertical_edge_(0), |
| 578 compositing_surface_(gfx::kNullPluginWindow), | 577 compositing_surface_(gfx::kNullPluginWindow), |
| 579 last_mouse_down_(NULL) { | 578 last_mouse_down_(NULL) { |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 gtk_clipboard_set_text( | 925 gtk_clipboard_set_text( |
| 927 x_clipboard, utf8_selection.c_str(), utf8_selection.length()); | 926 x_clipboard, utf8_selection.c_str(), utf8_selection.length()); |
| 928 } | 927 } |
| 929 | 928 |
| 930 void RenderWidgetHostViewGtk::SelectionBoundsChanged( | 929 void RenderWidgetHostViewGtk::SelectionBoundsChanged( |
| 931 const gfx::Rect& start_rect, | 930 const gfx::Rect& start_rect, |
| 932 const gfx::Rect& end_rect) { | 931 const gfx::Rect& end_rect) { |
| 933 im_context_->UpdateCaretBounds(start_rect.Union(end_rect)); | 932 im_context_->UpdateCaretBounds(start_rect.Union(end_rect)); |
| 934 } | 933 } |
| 935 | 934 |
| 936 void RenderWidgetHostViewGtk::ShowingContextMenu(bool showing) { | |
| 937 is_showing_context_menu_ = showing; | |
| 938 } | |
| 939 | |
| 940 #if !defined(TOOLKIT_VIEWS) | 935 #if !defined(TOOLKIT_VIEWS) |
| 941 GtkWidget* RenderWidgetHostViewGtk::BuildInputMethodsGtkMenu() { | 936 GtkWidget* RenderWidgetHostViewGtk::BuildInputMethodsGtkMenu() { |
| 942 return im_context_->BuildInputMethodsGtkMenu(); | 937 return im_context_->BuildInputMethodsGtkMenu(); |
| 943 } | 938 } |
| 944 #endif | 939 #endif |
| 945 | 940 |
| 946 gboolean RenderWidgetHostViewGtk::OnWindowStateEvent( | 941 gboolean RenderWidgetHostViewGtk::OnWindowStateEvent( |
| 947 GtkWidget* widget, | 942 GtkWidget* widget, |
| 948 GdkEventWindowState* event) { | 943 GdkEventWindowState* event) { |
| 949 if (is_fullscreen_) { | 944 if (is_fullscreen_) { |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1409 return new RenderWidgetHostViewGtk(widget); | 1404 return new RenderWidgetHostViewGtk(widget); |
| 1410 } | 1405 } |
| 1411 | 1406 |
| 1412 // static | 1407 // static |
| 1413 void RenderWidgetHostView::GetDefaultScreenInfo( | 1408 void RenderWidgetHostView::GetDefaultScreenInfo( |
| 1414 WebKit::WebScreenInfo* results) { | 1409 WebKit::WebScreenInfo* results) { |
| 1415 GdkWindow* gdk_window = | 1410 GdkWindow* gdk_window = |
| 1416 gdk_display_get_default_group(gdk_display_get_default()); | 1411 gdk_display_get_default_group(gdk_display_get_default()); |
| 1417 content::GetScreenInfoFromNativeWindow(gdk_window, results); | 1412 content::GetScreenInfoFromNativeWindow(gdk_window, results); |
| 1418 } | 1413 } |
| OLD | NEW |