Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_view_gtk.cc

Issue 7484035: Reapplies r91761. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 net::URLRequestStatus::Status. 9 // badly with net::URLRequestStatus::Status.
10 #include "chrome/common/render_messages.h" 10 #include "chrome/common/render_messages.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 gtk_widget_add_events(widget, GDK_EXPOSURE_MASK | 114 gtk_widget_add_events(widget, GDK_EXPOSURE_MASK |
115 GDK_POINTER_MOTION_MASK | 115 GDK_POINTER_MOTION_MASK |
116 GDK_BUTTON_PRESS_MASK | 116 GDK_BUTTON_PRESS_MASK |
117 GDK_BUTTON_RELEASE_MASK | 117 GDK_BUTTON_RELEASE_MASK |
118 GDK_KEY_PRESS_MASK | 118 GDK_KEY_PRESS_MASK |
119 GDK_KEY_RELEASE_MASK | 119 GDK_KEY_RELEASE_MASK |
120 GDK_FOCUS_CHANGE_MASK | 120 GDK_FOCUS_CHANGE_MASK |
121 GDK_ENTER_NOTIFY_MASK | 121 GDK_ENTER_NOTIFY_MASK |
122 GDK_LEAVE_NOTIFY_MASK); 122 GDK_LEAVE_NOTIFY_MASK);
123 GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS); 123 gtk_widget_set_can_focus(widget, TRUE);
124 124
125 g_signal_connect(widget, "expose-event", 125 g_signal_connect(widget, "expose-event",
126 G_CALLBACK(OnExposeEvent), host_view); 126 G_CALLBACK(OnExposeEvent), host_view);
127 g_signal_connect(widget, "key-press-event", 127 g_signal_connect(widget, "key-press-event",
128 G_CALLBACK(OnKeyPressReleaseEvent), host_view); 128 G_CALLBACK(OnKeyPressReleaseEvent), host_view);
129 g_signal_connect(widget, "key-release-event", 129 g_signal_connect(widget, "key-release-event",
130 G_CALLBACK(OnKeyPressReleaseEvent), host_view); 130 G_CALLBACK(OnKeyPressReleaseEvent), host_view);
131 g_signal_connect(widget, "focus-in-event", 131 g_signal_connect(widget, "focus-in-event",
132 G_CALLBACK(OnFocusIn), host_view); 132 G_CALLBACK(OnFocusIn), host_view);
133 g_signal_connect(widget, "focus-out-event", 133 g_signal_connect(widget, "focus-out-event",
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 !host_view->is_popup_first_mouse_release_ && !click_in_popup) { 315 !host_view->is_popup_first_mouse_release_ && !click_in_popup) {
316 host_view->host_->Shutdown(); 316 host_view->host_->Shutdown();
317 return FALSE; 317 return FALSE;
318 } 318 }
319 event->x = x; 319 event->x = x;
320 event->y = y; 320 event->y = y;
321 } 321 }
322 322
323 // TODO(evanm): why is this necessary here but not in test shell? 323 // TODO(evanm): why is this necessary here but not in test shell?
324 // This logic is the same as GtkButton. 324 // This logic is the same as GtkButton.
325 if (event->type == GDK_BUTTON_PRESS && !GTK_WIDGET_HAS_FOCUS(widget)) 325 if (event->type == GDK_BUTTON_PRESS && !gtk_widget_has_focus(widget))
326 gtk_widget_grab_focus(widget); 326 gtk_widget_grab_focus(widget);
327 327
328 host_view->is_popup_first_mouse_release_ = false; 328 host_view->is_popup_first_mouse_release_ = false;
329 host_view->GetRenderWidgetHost()->ForwardMouseEvent( 329 host_view->GetRenderWidgetHost()->ForwardMouseEvent(
330 WebInputEventFactory::mouseEvent(event)); 330 WebInputEventFactory::mouseEvent(event));
331 331
332 // Although we did handle the mouse event, we need to let other handlers 332 // Although we did handle the mouse event, we need to let other handlers
333 // run (in particular the one installed by TabContentsViewGtk). 333 // run (in particular the one installed by TabContentsViewGtk).
334 return FALSE; 334 return FALSE;
335 } 335 }
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 689
690 void RenderWidgetHostViewGtk::Show() { 690 void RenderWidgetHostViewGtk::Show() {
691 gtk_widget_show(view_.get()); 691 gtk_widget_show(view_.get());
692 } 692 }
693 693
694 void RenderWidgetHostViewGtk::Hide() { 694 void RenderWidgetHostViewGtk::Hide() {
695 gtk_widget_hide(view_.get()); 695 gtk_widget_hide(view_.get());
696 } 696 }
697 697
698 bool RenderWidgetHostViewGtk::IsShowing() { 698 bool RenderWidgetHostViewGtk::IsShowing() {
699 // TODO(jcivelli): use gtk_widget_get_visible once we build with GTK 2.18. 699 return gtk_widget_get_visible(view_.get());
700 return (GTK_WIDGET_FLAGS(view_.get()) & GTK_VISIBLE) != 0;
701 } 700 }
702 701
703 gfx::Rect RenderWidgetHostViewGtk::GetViewBounds() const { 702 gfx::Rect RenderWidgetHostViewGtk::GetViewBounds() const {
704 GtkAllocation* alloc = &view_.get()->allocation; 703 GtkAllocation* alloc = &view_.get()->allocation;
705 return gfx::Rect(alloc->x, alloc->y, 704 return gfx::Rect(alloc->x, alloc->y,
706 requested_size_.width(), 705 requested_size_.width(),
707 requested_size_.height()); 706 requested_size_.height());
708 } 707 }
709 708
710 void RenderWidgetHostViewGtk::UpdateCursor(const WebCursor& cursor) { 709 void RenderWidgetHostViewGtk::UpdateCursor(const WebCursor& cursor) {
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 } 1183 }
1185 1184
1186 // static 1185 // static
1187 RenderWidgetHostView* 1186 RenderWidgetHostView*
1188 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( 1187 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView(
1189 gfx::NativeView widget) { 1188 gfx::NativeView widget) {
1190 gpointer user_data = g_object_get_data(G_OBJECT(widget), 1189 gpointer user_data = g_object_get_data(G_OBJECT(widget),
1191 kRenderWidgetHostViewKey); 1190 kRenderWidgetHostViewKey);
1192 return reinterpret_cast<RenderWidgetHostView*>(user_data); 1191 return reinterpret_cast<RenderWidgetHostView*>(user_data);
1193 } 1192 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/gtk_key_bindings_handler.cc ('k') | chrome/browser/ui/browser_list_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698