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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 2686723003: Use correct timestamp for generated mouse events on Mac. (Closed)
Patch Set: fix Created 3 years, 10 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
« no previous file with comments | « no previous file | ui/base/cocoa/tool_tip_base_view.mm » ('j') | 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) 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_mac.h" 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #import <Carbon/Carbon.h> 7 #import <Carbon/Carbon.h>
8 #import <objc/runtime.h> 8 #import <objc/runtime.h>
9 #include <OpenGL/gl.h> 9 #include <OpenGL/gl.h>
10 #include <QuartzCore/QuartzCore.h> 10 #include <QuartzCore/QuartzCore.h>
(...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 1160
1161 // Create a fake mouse event to inform the render widget that the mouse 1161 // Create a fake mouse event to inform the render widget that the mouse
1162 // left or entered. 1162 // left or entered.
1163 NSWindow* window = [cocoa_view_ window]; 1163 NSWindow* window = [cocoa_view_ window];
1164 // TODO(asvitkine): If the location outside of the event stream doesn't 1164 // TODO(asvitkine): If the location outside of the event stream doesn't
1165 // correspond to the current event (due to delayed event processing), then 1165 // correspond to the current event (due to delayed event processing), then
1166 // this may result in a cursor flicker if there are later mouse move events 1166 // this may result in a cursor flicker if there are later mouse move events
1167 // in the pipeline. Find a way to use the mouse location from the event that 1167 // in the pipeline. Find a way to use the mouse location from the event that
1168 // dismissed the context menu. 1168 // dismissed the context menu.
1169 NSPoint location = [window mouseLocationOutsideOfEventStream]; 1169 NSPoint location = [window mouseLocationOutsideOfEventStream];
1170 NSTimeInterval event_time = [[NSApp currentEvent] timestamp];
1170 NSEvent* event = [NSEvent mouseEventWithType:NSMouseMoved 1171 NSEvent* event = [NSEvent mouseEventWithType:NSMouseMoved
1171 location:location 1172 location:location
1172 modifierFlags:0 1173 modifierFlags:0
1173 timestamp:0 1174 timestamp:event_time
1174 windowNumber:window_number() 1175 windowNumber:window_number()
1175 context:nil 1176 context:nil
1176 eventNumber:0 1177 eventNumber:0
1177 clickCount:0 1178 clickCount:0
1178 pressure:0]; 1179 pressure:0];
1179 WebMouseEvent web_event = WebMouseEventBuilder::Build(event, cocoa_view_); 1180 WebMouseEvent web_event = WebMouseEventBuilder::Build(event, cocoa_view_);
1180 if (showing) 1181 if (showing)
1181 web_event.setType(WebInputEvent::MouseLeave); 1182 web_event.setType(WebInputEvent::MouseLeave);
1182 ForwardMouseEvent(web_event); 1183 ForwardMouseEvent(web_event);
1183 } 1184 }
(...skipping 2270 matching lines...) Expand 10 before | Expand all | Expand 10 after
3454 3455
3455 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3456 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3456 // regions that are not draggable. (See ControlRegionView in 3457 // regions that are not draggable. (See ControlRegionView in
3457 // native_app_window_cocoa.mm). This requires the render host view to be 3458 // native_app_window_cocoa.mm). This requires the render host view to be
3458 // draggable by default. 3459 // draggable by default.
3459 - (BOOL)mouseDownCanMoveWindow { 3460 - (BOOL)mouseDownCanMoveWindow {
3460 return YES; 3461 return YES;
3461 } 3462 }
3462 3463
3463 @end 3464 @end
OLDNEW
« no previous file with comments | « no previous file | ui/base/cocoa/tool_tip_base_view.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698