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 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 parent_(NULL), | 575 parent_(NULL), |
576 is_popup_first_mouse_release_(true), | 576 is_popup_first_mouse_release_(true), |
577 was_imcontext_focused_before_grab_(false), | 577 was_imcontext_focused_before_grab_(false), |
578 do_x_grab_(false), | 578 do_x_grab_(false), |
579 is_fullscreen_(false), | 579 is_fullscreen_(false), |
580 destroy_handler_id_(0), | 580 destroy_handler_id_(0), |
581 dragged_at_horizontal_edge_(0), | 581 dragged_at_horizontal_edge_(0), |
582 dragged_at_vertical_edge_(0), | 582 dragged_at_vertical_edge_(0), |
583 compositing_surface_(gfx::kNullPluginWindow), | 583 compositing_surface_(gfx::kNullPluginWindow), |
584 last_mouse_down_(NULL) { | 584 last_mouse_down_(NULL) { |
585 host_ = static_cast<RenderWidgetHostImpl*>(widget_host); | 585 host_ = widget_host->AsRWHImpl(); |
586 host_->SetView(this); | 586 host_->SetView(this); |
587 } | 587 } |
588 | 588 |
589 RenderWidgetHostViewGtk::~RenderWidgetHostViewGtk() { | 589 RenderWidgetHostViewGtk::~RenderWidgetHostViewGtk() { |
590 UnlockMouse(); | 590 UnlockMouse(); |
591 set_last_mouse_down(NULL); | 591 set_last_mouse_down(NULL); |
592 view_.Destroy(); | 592 view_.Destroy(); |
593 } | 593 } |
594 | 594 |
595 void RenderWidgetHostViewGtk::InitAsChild( | 595 void RenderWidgetHostViewGtk::InitAsChild( |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 int gpu_host_id) { | 1028 int gpu_host_id) { |
1029 RenderWidgetHostImpl::AcknowledgePostSubBuffer(params.route_id, gpu_host_id); | 1029 RenderWidgetHostImpl::AcknowledgePostSubBuffer(params.route_id, gpu_host_id); |
1030 } | 1030 } |
1031 | 1031 |
1032 void RenderWidgetHostViewGtk::AcceleratedSurfaceSuspend() { | 1032 void RenderWidgetHostViewGtk::AcceleratedSurfaceSuspend() { |
1033 } | 1033 } |
1034 | 1034 |
1035 | 1035 |
1036 void RenderWidgetHostViewGtk::SetBackground(const SkBitmap& background) { | 1036 void RenderWidgetHostViewGtk::SetBackground(const SkBitmap& background) { |
1037 content::RenderWidgetHostViewBase::SetBackground(background); | 1037 content::RenderWidgetHostViewBase::SetBackground(background); |
1038 host_->Send(new ViewMsg_SetBackground(host_->routing_id(), background)); | 1038 host_->Send(new ViewMsg_SetBackground(host_->GetRoutingID(), background)); |
1039 } | 1039 } |
1040 | 1040 |
1041 void RenderWidgetHostViewGtk::ModifyEventForEdgeDragging( | 1041 void RenderWidgetHostViewGtk::ModifyEventForEdgeDragging( |
1042 GtkWidget* widget, GdkEventMotion* event) { | 1042 GtkWidget* widget, GdkEventMotion* event) { |
1043 // If the widget is aligned with an edge of the monitor its on and the user | 1043 // If the widget is aligned with an edge of the monitor its on and the user |
1044 // attempts to drag past that edge we track the number of times it has | 1044 // attempts to drag past that edge we track the number of times it has |
1045 // occurred, so that we can force the widget to scroll when it otherwise | 1045 // occurred, so that we can force the widget to scroll when it otherwise |
1046 // would be unable to, by modifying the (x,y) position in the drag | 1046 // would be unable to, by modifying the (x,y) position in the drag |
1047 // event that we forward on to webkit. If we get a move that's no longer a | 1047 // event that we forward on to webkit. If we get a move that's no longer a |
1048 // drag or a drag indicating the user is no longer at that edge we stop | 1048 // drag or a drag indicating the user is no longer at that edge we stop |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 } | 1089 } |
1090 dragged_at_horizontal_edge_ = new_dragged_at_horizontal_edge; | 1090 dragged_at_horizontal_edge_ = new_dragged_at_horizontal_edge; |
1091 dragged_at_vertical_edge_ = new_dragged_at_vertical_edge; | 1091 dragged_at_vertical_edge_ = new_dragged_at_vertical_edge; |
1092 } | 1092 } |
1093 | 1093 |
1094 void RenderWidgetHostViewGtk::Paint(const gfx::Rect& damage_rect) { | 1094 void RenderWidgetHostViewGtk::Paint(const gfx::Rect& damage_rect) { |
1095 TRACE_EVENT0("ui::gtk", "RenderWidgetHostViewGtk::Paint"); | 1095 TRACE_EVENT0("ui::gtk", "RenderWidgetHostViewGtk::Paint"); |
1096 | 1096 |
1097 // If the GPU process is rendering directly into the View, | 1097 // If the GPU process is rendering directly into the View, |
1098 // call the compositor directly. | 1098 // call the compositor directly. |
1099 RenderWidgetHostImpl* render_widget_host = | 1099 RenderWidgetHostImpl* render_widget_host = GetRenderWidgetHost()->AsRWHImpl(); |
1100 static_cast<RenderWidgetHostImpl*>(GetRenderWidgetHost()); | |
1101 if (render_widget_host->is_accelerated_compositing_active()) { | 1100 if (render_widget_host->is_accelerated_compositing_active()) { |
1102 host_->ScheduleComposite(); | 1101 host_->ScheduleComposite(); |
1103 return; | 1102 return; |
1104 } | 1103 } |
1105 | 1104 |
1106 GdkWindow* window = gtk_widget_get_window(view_.get()); | 1105 GdkWindow* window = gtk_widget_get_window(view_.get()); |
1107 DCHECK(!about_to_validate_and_paint_); | 1106 DCHECK(!about_to_validate_and_paint_); |
1108 | 1107 |
1109 invalid_rect_ = damage_rect; | 1108 invalid_rect_ = damage_rect; |
1110 about_to_validate_and_paint_ = true; | 1109 about_to_validate_and_paint_ = true; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 void RenderWidgetHostViewGtk::ForwardKeyboardEvent( | 1307 void RenderWidgetHostViewGtk::ForwardKeyboardEvent( |
1309 const NativeWebKeyboardEvent& event) { | 1308 const NativeWebKeyboardEvent& event) { |
1310 if (!host_) | 1309 if (!host_) |
1311 return; | 1310 return; |
1312 | 1311 |
1313 #if !defined(OS_CHROMEOS) | 1312 #if !defined(OS_CHROMEOS) |
1314 EditCommands edit_commands; | 1313 EditCommands edit_commands; |
1315 if (!event.skip_in_browser && | 1314 if (!event.skip_in_browser && |
1316 key_bindings_handler_->Match(event, &edit_commands)) { | 1315 key_bindings_handler_->Match(event, &edit_commands)) { |
1317 host_->Send(new ViewMsg_SetEditCommandsForNextKeyEvent( | 1316 host_->Send(new ViewMsg_SetEditCommandsForNextKeyEvent( |
1318 host_->routing_id(), edit_commands)); | 1317 host_->GetRoutingID(), edit_commands)); |
1319 NativeWebKeyboardEvent copy_event(event); | 1318 NativeWebKeyboardEvent copy_event(event); |
1320 copy_event.match_edit_command = true; | 1319 copy_event.match_edit_command = true; |
1321 host_->ForwardKeyboardEvent(copy_event); | 1320 host_->ForwardKeyboardEvent(copy_event); |
1322 return; | 1321 return; |
1323 } | 1322 } |
1324 #endif | 1323 #endif |
1325 | 1324 |
1326 host_->ForwardKeyboardEvent(event); | 1325 host_->ForwardKeyboardEvent(event); |
1327 } | 1326 } |
1328 | 1327 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1416 return new RenderWidgetHostViewGtk(widget); | 1415 return new RenderWidgetHostViewGtk(widget); |
1417 } | 1416 } |
1418 | 1417 |
1419 // static | 1418 // static |
1420 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( | 1419 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( |
1421 WebKit::WebScreenInfo* results) { | 1420 WebKit::WebScreenInfo* results) { |
1422 GdkWindow* gdk_window = | 1421 GdkWindow* gdk_window = |
1423 gdk_display_get_default_group(gdk_display_get_default()); | 1422 gdk_display_get_default_group(gdk_display_get_default()); |
1424 content::GetScreenInfoFromNativeWindow(gdk_window, results); | 1423 content::GetScreenInfoFromNativeWindow(gdk_window, results); |
1425 } | 1424 } |
OLD | NEW |