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

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

Issue 7227027: GTK: More 2.18 goodness. Move from macros to real accessor functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove views/ 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 gtk_widget_add_events(widget, GDK_EXPOSURE_MASK | 113 gtk_widget_add_events(widget, GDK_EXPOSURE_MASK |
114 GDK_POINTER_MOTION_MASK | 114 GDK_POINTER_MOTION_MASK |
115 GDK_BUTTON_PRESS_MASK | 115 GDK_BUTTON_PRESS_MASK |
116 GDK_BUTTON_RELEASE_MASK | 116 GDK_BUTTON_RELEASE_MASK |
117 GDK_KEY_PRESS_MASK | 117 GDK_KEY_PRESS_MASK |
118 GDK_KEY_RELEASE_MASK | 118 GDK_KEY_RELEASE_MASK |
119 GDK_FOCUS_CHANGE_MASK | 119 GDK_FOCUS_CHANGE_MASK |
120 GDK_ENTER_NOTIFY_MASK | 120 GDK_ENTER_NOTIFY_MASK |
121 GDK_LEAVE_NOTIFY_MASK); 121 GDK_LEAVE_NOTIFY_MASK);
122 GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS); 122 gtk_widget_set_can_focus(widget, TRUE);
123 123
124 g_signal_connect(widget, "expose-event", 124 g_signal_connect(widget, "expose-event",
125 G_CALLBACK(OnExposeEvent), host_view); 125 G_CALLBACK(OnExposeEvent), host_view);
126 g_signal_connect(widget, "key-press-event", 126 g_signal_connect(widget, "key-press-event",
127 G_CALLBACK(OnKeyPressReleaseEvent), host_view); 127 G_CALLBACK(OnKeyPressReleaseEvent), host_view);
128 g_signal_connect(widget, "key-release-event", 128 g_signal_connect(widget, "key-release-event",
129 G_CALLBACK(OnKeyPressReleaseEvent), host_view); 129 G_CALLBACK(OnKeyPressReleaseEvent), host_view);
130 g_signal_connect(widget, "focus-in-event", 130 g_signal_connect(widget, "focus-in-event",
131 G_CALLBACK(OnFocusIn), host_view); 131 G_CALLBACK(OnFocusIn), host_view);
132 g_signal_connect(widget, "focus-out-event", 132 g_signal_connect(widget, "focus-out-event",
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 !host_view->is_popup_first_mouse_release_ && !click_in_popup) { 314 !host_view->is_popup_first_mouse_release_ && !click_in_popup) {
315 host_view->host_->Shutdown(); 315 host_view->host_->Shutdown();
316 return FALSE; 316 return FALSE;
317 } 317 }
318 event->x = x; 318 event->x = x;
319 event->y = y; 319 event->y = y;
320 } 320 }
321 321
322 // TODO(evanm): why is this necessary here but not in test shell? 322 // TODO(evanm): why is this necessary here but not in test shell?
323 // This logic is the same as GtkButton. 323 // This logic is the same as GtkButton.
324 if (event->type == GDK_BUTTON_PRESS && !GTK_WIDGET_HAS_FOCUS(widget)) 324 if (event->type == GDK_BUTTON_PRESS && !gtk_widget_has_focus(widget))
325 gtk_widget_grab_focus(widget); 325 gtk_widget_grab_focus(widget);
326 326
327 host_view->is_popup_first_mouse_release_ = false; 327 host_view->is_popup_first_mouse_release_ = false;
328 host_view->GetRenderWidgetHost()->ForwardMouseEvent( 328 host_view->GetRenderWidgetHost()->ForwardMouseEvent(
329 WebInputEventFactory::mouseEvent(event)); 329 WebInputEventFactory::mouseEvent(event));
330 330
331 // Although we did handle the mouse event, we need to let other handlers 331 // Although we did handle the mouse event, we need to let other handlers
332 // run (in particular the one installed by TabContentsViewGtk). 332 // run (in particular the one installed by TabContentsViewGtk).
333 return FALSE; 333 return FALSE;
334 } 334 }
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 688
689 void RenderWidgetHostViewGtk::Show() { 689 void RenderWidgetHostViewGtk::Show() {
690 gtk_widget_show(view_.get()); 690 gtk_widget_show(view_.get());
691 } 691 }
692 692
693 void RenderWidgetHostViewGtk::Hide() { 693 void RenderWidgetHostViewGtk::Hide() {
694 gtk_widget_hide(view_.get()); 694 gtk_widget_hide(view_.get());
695 } 695 }
696 696
697 bool RenderWidgetHostViewGtk::IsShowing() { 697 bool RenderWidgetHostViewGtk::IsShowing() {
698 // TODO(jcivelli): use gtk_widget_get_visible once we build with GTK 2.18. 698 return gtk_widget_get_visible(view_.get());
699 return (GTK_WIDGET_FLAGS(view_.get()) & GTK_VISIBLE) != 0;
700 } 699 }
701 700
702 gfx::Rect RenderWidgetHostViewGtk::GetViewBounds() const { 701 gfx::Rect RenderWidgetHostViewGtk::GetViewBounds() const {
703 GtkAllocation* alloc = &view_.get()->allocation; 702 GtkAllocation* alloc = &view_.get()->allocation;
704 return gfx::Rect(alloc->x, alloc->y, 703 return gfx::Rect(alloc->x, alloc->y,
705 requested_size_.width(), 704 requested_size_.width(),
706 requested_size_.height()); 705 requested_size_.height());
707 } 706 }
708 707
709 void RenderWidgetHostViewGtk::UpdateCursor(const WebCursor& cursor) { 708 void RenderWidgetHostViewGtk::UpdateCursor(const WebCursor& cursor) {
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 } 1187 }
1189 1188
1190 // static 1189 // static
1191 RenderWidgetHostView* 1190 RenderWidgetHostView*
1192 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( 1191 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView(
1193 gfx::NativeView widget) { 1192 gfx::NativeView widget) {
1194 gpointer user_data = g_object_get_data(G_OBJECT(widget), 1193 gpointer user_data = g_object_get_data(G_OBJECT(widget),
1195 kRenderWidgetHostViewKey); 1194 kRenderWidgetHostViewKey);
1196 return reinterpret_cast<RenderWidgetHostView*>(user_data); 1195 return reinterpret_cast<RenderWidgetHostView*>(user_data);
1197 } 1196 }
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