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

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

Issue 6588075: Remove fake mouse move hack. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 160 }
161 161
162 // We return TRUE because we did handle the event. If it turns out webkit 162 // We return TRUE because we did handle the event. If it turns out webkit
163 // can't handle the event, we'll deal with it in 163 // can't handle the event, we'll deal with it in
164 // RenderView::UnhandledKeyboardEvent(). 164 // RenderView::UnhandledKeyboardEvent().
165 return TRUE; 165 return TRUE;
166 } 166 }
167 167
168 static gboolean OnFocusIn(GtkWidget* widget, GdkEventFocus* focus, 168 static gboolean OnFocusIn(GtkWidget* widget, GdkEventFocus* focus,
169 RenderWidgetHostViewGtk* host_view) { 169 RenderWidgetHostViewGtk* host_view) {
170 int x, y;
171 gtk_widget_get_pointer(widget, &x, &y);
172 // http://crbug.com/13389
173 // If the cursor is in the render view, fake a mouse move event so that
174 // webkit updates its state. Otherwise webkit might think the cursor is
175 // somewhere it's not.
176 if (x >= 0 && y >= 0 && x < widget->allocation.width &&
177 y < widget->allocation.height) {
178 WebKit::WebMouseEvent fake_event;
179 fake_event.timeStampSeconds = base::Time::Now().ToDoubleT();
180 fake_event.modifiers = 0;
181 fake_event.windowX = fake_event.x = x;
182 fake_event.windowY = fake_event.y = y;
183 gdk_window_get_origin(widget->window, &x, &y);
184 fake_event.globalX = fake_event.x + x;
185 fake_event.globalY = fake_event.y + y;
186 fake_event.type = WebKit::WebInputEvent::MouseMove;
187 fake_event.button = WebKit::WebMouseEvent::ButtonNone;
188 host_view->GetRenderWidgetHost()->ForwardMouseEvent(fake_event);
189 }
190
191 host_view->ShowCurrentCursor(); 170 host_view->ShowCurrentCursor();
192 host_view->GetRenderWidgetHost()->GotFocus(); 171 host_view->GetRenderWidgetHost()->GotFocus();
193 172
194 // The only way to enable a GtkIMContext object is to call its focus in 173 // The only way to enable a GtkIMContext object is to call its focus in
195 // handler. 174 // handler.
196 host_view->im_context_->OnFocusIn(); 175 host_view->im_context_->OnFocusIn();
197 176
198 return TRUE; 177 return TRUE;
199 } 178 }
200 179
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 } 1111 }
1133 1112
1134 // static 1113 // static
1135 RenderWidgetHostView* 1114 RenderWidgetHostView*
1136 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( 1115 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView(
1137 gfx::NativeView widget) { 1116 gfx::NativeView widget) {
1138 gpointer user_data = g_object_get_data(G_OBJECT(widget), 1117 gpointer user_data = g_object_get_data(G_OBJECT(widget),
1139 kRenderWidgetHostViewKey); 1118 kRenderWidgetHostViewKey);
1140 return reinterpret_cast<RenderWidgetHostView*>(user_data); 1119 return reinterpret_cast<RenderWidgetHostView*>(user_data);
1141 } 1120 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698