| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 } | 96 } |
| 97 | 97 |
| 98 bool MovedToCenter(const WebKit::WebMouseEvent& mouse_event, | 98 bool MovedToCenter(const WebKit::WebMouseEvent& mouse_event, |
| 99 const gfx::Point& center) { | 99 const gfx::Point& center) { |
| 100 return mouse_event.globalX == center.x() && | 100 return mouse_event.globalX == center.x() && |
| 101 mouse_event.globalY == center.y(); | 101 mouse_event.globalY == center.y(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // namespace | 104 } // namespace |
| 105 | 105 |
| 106 using content::RenderWidgetHostImpl; |
| 106 using content::RenderWidgetHostView; | 107 using content::RenderWidgetHostView; |
| 107 using content::RenderWidgetHostViewPort; | 108 using content::RenderWidgetHostViewPort; |
| 108 using WebKit::WebInputEventFactory; | 109 using WebKit::WebInputEventFactory; |
| 109 using WebKit::WebMouseWheelEvent; | 110 using WebKit::WebMouseWheelEvent; |
| 110 | 111 |
| 111 // This class is a simple convenience wrapper for Gtk functions. It has only | 112 // This class is a simple convenience wrapper for Gtk functions. It has only |
| 112 // static methods. | 113 // static methods. |
| 113 class RenderWidgetHostViewGtkWidget { | 114 class RenderWidgetHostViewGtkWidget { |
| 114 public: | 115 public: |
| 115 static GtkWidget* CreateNewWidget(RenderWidgetHostViewGtk* host_view) { | 116 static GtkWidget* CreateNewWidget(RenderWidgetHostViewGtk* host_view) { |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 web_event.deltaX += GetPendingScrollDelta(false, event->state); | 566 web_event.deltaX += GetPendingScrollDelta(false, event->state); |
| 566 } | 567 } |
| 567 RenderWidgetHostImpl::From( | 568 RenderWidgetHostImpl::From( |
| 568 host_view->GetRenderWidgetHost())->ForwardWheelEvent(web_event); | 569 host_view->GetRenderWidgetHost())->ForwardWheelEvent(web_event); |
| 569 return FALSE; | 570 return FALSE; |
| 570 } | 571 } |
| 571 | 572 |
| 572 DISALLOW_IMPLICIT_CONSTRUCTORS(RenderWidgetHostViewGtkWidget); | 573 DISALLOW_IMPLICIT_CONSTRUCTORS(RenderWidgetHostViewGtkWidget); |
| 573 }; | 574 }; |
| 574 | 575 |
| 575 RenderWidgetHostViewGtk::RenderWidgetHostViewGtk(RenderWidgetHost* widget_host) | 576 RenderWidgetHostViewGtk::RenderWidgetHostViewGtk( |
| 577 content::RenderWidgetHost* widget_host) |
| 576 : host_(RenderWidgetHostImpl::From(widget_host)), | 578 : host_(RenderWidgetHostImpl::From(widget_host)), |
| 577 about_to_validate_and_paint_(false), | 579 about_to_validate_and_paint_(false), |
| 578 is_hidden_(false), | 580 is_hidden_(false), |
| 579 is_loading_(false), | 581 is_loading_(false), |
| 580 parent_(NULL), | 582 parent_(NULL), |
| 581 is_popup_first_mouse_release_(true), | 583 is_popup_first_mouse_release_(true), |
| 582 was_imcontext_focused_before_grab_(false), | 584 was_imcontext_focused_before_grab_(false), |
| 583 do_x_grab_(false), | 585 do_x_grab_(false), |
| 584 is_fullscreen_(false), | 586 is_fullscreen_(false), |
| 585 destroy_handler_id_(0), | 587 destroy_handler_id_(0), |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 gtk_container_add(GTK_CONTAINER(window), view_.get()); | 667 gtk_container_add(GTK_CONTAINER(window), view_.get()); |
| 666 | 668 |
| 667 // Try to move and resize the window to cover the screen in case the window | 669 // Try to move and resize the window to cover the screen in case the window |
| 668 // manager doesn't support _NET_WM_STATE_FULLSCREEN. | 670 // manager doesn't support _NET_WM_STATE_FULLSCREEN. |
| 669 GdkScreen* screen = gtk_window_get_screen(window); | 671 GdkScreen* screen = gtk_window_get_screen(window); |
| 670 gfx::Rect bounds( | 672 gfx::Rect bounds( |
| 671 0, 0, gdk_screen_get_width(screen), gdk_screen_get_height(screen)); | 673 0, 0, gdk_screen_get_width(screen), gdk_screen_get_height(screen)); |
| 672 DoPopupOrFullscreenInit(window, bounds); | 674 DoPopupOrFullscreenInit(window, bounds); |
| 673 } | 675 } |
| 674 | 676 |
| 675 RenderWidgetHost* RenderWidgetHostViewGtk::GetRenderWidgetHost() const { | 677 content::RenderWidgetHost* |
| 678 RenderWidgetHostViewGtk::GetRenderWidgetHost() const { |
| 676 return host_; | 679 return host_; |
| 677 } | 680 } |
| 678 | 681 |
| 679 void RenderWidgetHostViewGtk::DidBecomeSelected() { | 682 void RenderWidgetHostViewGtk::DidBecomeSelected() { |
| 680 if (!is_hidden_) | 683 if (!is_hidden_) |
| 681 return; | 684 return; |
| 682 | 685 |
| 683 if (tab_switch_paint_time_.is_null()) | 686 if (tab_switch_paint_time_.is_null()) |
| 684 tab_switch_paint_time_ = base::TimeTicks::Now(); | 687 tab_switch_paint_time_ = base::TimeTicks::Now(); |
| 685 is_hidden_ = false; | 688 is_hidden_ = false; |
| (...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1410 unlocked_mouse_position_.SetPoint(event->windowX, event->windowY); | 1413 unlocked_mouse_position_.SetPoint(event->windowX, event->windowY); |
| 1411 unlocked_global_mouse_position_.SetPoint(event->globalX, event->globalY); | 1414 unlocked_global_mouse_position_.SetPoint(event->globalX, event->globalY); |
| 1412 } | 1415 } |
| 1413 } | 1416 } |
| 1414 | 1417 |
| 1415 //////////////////////////////////////////////////////////////////////////////// | 1418 //////////////////////////////////////////////////////////////////////////////// |
| 1416 // RenderWidgetHostView, public: | 1419 // RenderWidgetHostView, public: |
| 1417 | 1420 |
| 1418 // static | 1421 // static |
| 1419 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( | 1422 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( |
| 1420 RenderWidgetHost* widget) { | 1423 content::RenderWidgetHost* widget) { |
| 1421 return new RenderWidgetHostViewGtk(widget); | 1424 return new RenderWidgetHostViewGtk(widget); |
| 1422 } | 1425 } |
| 1423 | 1426 |
| 1424 // static | 1427 // static |
| 1425 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( | 1428 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( |
| 1426 WebKit::WebScreenInfo* results) { | 1429 WebKit::WebScreenInfo* results) { |
| 1427 GdkWindow* gdk_window = | 1430 GdkWindow* gdk_window = |
| 1428 gdk_display_get_default_group(gdk_display_get_default()); | 1431 gdk_display_get_default_group(gdk_display_get_default()); |
| 1429 content::GetScreenInfoFromNativeWindow(gdk_window, results); | 1432 content::GetScreenInfoFromNativeWindow(gdk_window, results); |
| 1430 } | 1433 } |
| OLD | NEW |