| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 static gboolean OnFocusOut(GtkWidget* widget, GdkEventFocus* focus, | 193 static gboolean OnFocusOut(GtkWidget* widget, GdkEventFocus* focus, |
| 194 RenderWidgetHostViewGtk* host_view) { | 194 RenderWidgetHostViewGtk* host_view) { |
| 195 // Whenever we lose focus, set the cursor back to that of our parent window, | 195 // Whenever we lose focus, set the cursor back to that of our parent window, |
| 196 // which should be the default arrow. | 196 // which should be the default arrow. |
| 197 gdk_window_set_cursor(widget->window, NULL); | 197 gdk_window_set_cursor(widget->window, NULL); |
| 198 // If we are showing a context menu, maintain the illusion that webkit has | 198 // If we are showing a context menu, maintain the illusion that webkit has |
| 199 // focus. | 199 // focus. |
| 200 if (!host_view->is_showing_context_menu_) | 200 if (!host_view->is_showing_context_menu_) |
| 201 host_view->GetRenderWidgetHost()->Blur(); | 201 host_view->GetRenderWidgetHost()->Blur(); |
| 202 | 202 |
| 203 // Prevents us from stealing input context focus in OnGrabNotify() handler. |
| 204 host_view->was_focused_before_grab_ = false; |
| 205 |
| 203 // Disable the GtkIMContext object. | 206 // Disable the GtkIMContext object. |
| 204 host_view->im_context_->OnFocusOut(); | 207 host_view->im_context_->OnFocusOut(); |
| 205 | 208 |
| 206 return TRUE; | 209 return TRUE; |
| 207 } | 210 } |
| 208 | 211 |
| 209 // Called when we are shadowed or unshadowed by a keyboard grab (which will | 212 // Called when we are shadowed or unshadowed by a keyboard grab (which will |
| 210 // occur for activatable popups, such as dropdown menus). Popup windows do not | 213 // occur for activatable popups, such as dropdown menus). Popup windows do not |
| 211 // take focus, so we never get a focus out or focus in event when they are | 214 // take focus, so we never get a focus out or focus in event when they are |
| 212 // shown, and must rely on this signal instead. | 215 // shown, and must rely on this signal instead. |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1057 } | 1060 } |
| 1058 | 1061 |
| 1059 // static | 1062 // static |
| 1060 RenderWidgetHostView* | 1063 RenderWidgetHostView* |
| 1061 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( | 1064 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( |
| 1062 gfx::NativeView widget) { | 1065 gfx::NativeView widget) { |
| 1063 gpointer user_data = g_object_get_data(G_OBJECT(widget), | 1066 gpointer user_data = g_object_get_data(G_OBJECT(widget), |
| 1064 kRenderWidgetHostViewKey); | 1067 kRenderWidgetHostViewKey); |
| 1065 return reinterpret_cast<RenderWidgetHostView*>(user_data); | 1068 return reinterpret_cast<RenderWidgetHostView*>(user_data); |
| 1066 } | 1069 } |
| OLD | NEW |