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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 static gboolean OnKeyPressReleaseEvent(GtkWidget* widget, | 206 static gboolean OnKeyPressReleaseEvent(GtkWidget* widget, |
207 GdkEventKey* event, | 207 GdkEventKey* event, |
208 RenderWidgetHostViewGtk* host_view) { | 208 RenderWidgetHostViewGtk* host_view) { |
209 // Force popups or fullscreen windows to close on Escape so they won't keep | 209 // Force popups or fullscreen windows to close on Escape so they won't keep |
210 // the keyboard grabbed or be stuck onscreen if the renderer is hanging. | 210 // the keyboard grabbed or be stuck onscreen if the renderer is hanging. |
211 bool should_close_on_escape = | 211 bool should_close_on_escape = |
212 (host_view->IsPopup() && host_view->NeedsInputGrab()) || | 212 (host_view->IsPopup() && host_view->NeedsInputGrab()) || |
213 host_view->is_fullscreen_; | 213 host_view->is_fullscreen_; |
214 if (should_close_on_escape && GDK_Escape == event->keyval) { | 214 if (should_close_on_escape && GDK_Escape == event->keyval) { |
215 host_view->host_->Shutdown(); | 215 host_view->host_->Shutdown(); |
216 } if (host_view->host_->KeyPressListenersHandleEvent(event)) { | 216 } if (host_view->host_ && |
| 217 host_view->host_->KeyPressListenersHandleEvent(event)) { |
217 return TRUE; | 218 return TRUE; |
218 } else { | 219 } else { |
219 // Send key event to input method. | 220 // Send key event to input method. |
220 host_view->im_context_->ProcessKeyEvent(event); | 221 host_view->im_context_->ProcessKeyEvent(event); |
221 } | 222 } |
222 | 223 |
223 // We return TRUE because we did handle the event. If it turns out webkit | 224 // We return TRUE because we did handle the event. If it turns out webkit |
224 // can't handle the event, we'll deal with it in | 225 // can't handle the event, we'll deal with it in |
225 // RenderView::UnhandledKeyboardEvent(). | 226 // RenderView::UnhandledKeyboardEvent(). |
226 return TRUE; | 227 return TRUE; |
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1434 return new RenderWidgetHostViewGtk(widget); | 1435 return new RenderWidgetHostViewGtk(widget); |
1435 } | 1436 } |
1436 | 1437 |
1437 // static | 1438 // static |
1438 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( | 1439 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( |
1439 WebKit::WebScreenInfo* results) { | 1440 WebKit::WebScreenInfo* results) { |
1440 GdkWindow* gdk_window = | 1441 GdkWindow* gdk_window = |
1441 gdk_display_get_default_group(gdk_display_get_default()); | 1442 gdk_display_get_default_group(gdk_display_get_default()); |
1442 content::GetScreenInfoFromNativeWindow(gdk_window, results); | 1443 content::GetScreenInfoFromNativeWindow(gdk_window, results); |
1443 } | 1444 } |
OLD | NEW |