<rdar://problem/8553040> REGRESSION (WebKit2): Safari status text doesn't change...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 31 Dec 2011 20:44:44 +0000 (20:44 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 31 Dec 2011 20:44:44 +0000 (20:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=75404

Reviewed by Jon Honeycutt.

* UIProcess/API/mac/WKView.mm:
(-[WKView dealloc]): Remove the flags changed event monitor.
(-[WKView _postFakeMouseMovedEventForFlagsChangedEvent:]): Added. Similarly to
-[WebHTMLView _postFlagsChangedEvent:], creates a mouse moved event and passes it to
-mouseMoved:.
(-[WKView initWithFrame:contextRef:pageGroupRef:]): Create a local event monitor for flags
changed events.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@103859 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/mac/WKView.mm

index 385a76077748ad0eb48c3a7e4e375c1cd83251cd..94d204844a5d104f35f77b2765214559a0753b62 100644 (file)
@@ -1,3 +1,18 @@
+2011-12-31  Dan Bernstein  <mitz@apple.com>
+
+        <rdar://problem/8553040> REGRESSION (WebKit2): Safari status text doesn't change when you change the modifier keys without moving the mouse
+        https://bugs.webkit.org/show_bug.cgi?id=75404
+
+        Reviewed by Jon Honeycutt.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView dealloc]): Remove the flags changed event monitor.
+        (-[WKView _postFakeMouseMovedEventForFlagsChangedEvent:]): Added. Similarly to
+        -[WebHTMLView _postFlagsChangedEvent:], creates a mouse moved event and passes it to
+        -mouseMoved:.
+        (-[WKView initWithFrame:contextRef:pageGroupRef:]): Create a local event monitor for flags
+        changed events.
+
 2011-12-31  Dan Bernstein  <mitz@apple.com>
 
         <rdar://problem/8750356> REGRESSION (WebKit2): Printing a subframe containing a PDF prints the on-screen view instead of the entire PDF document
index 54a31e91f7b71f44b9bf92e683a10f4dd015b507..3241372dac64c11e070f14f6313ab92fd2f5ea87 100644 (file)
@@ -118,12 +118,13 @@ struct WKViewInterpretKeyEventsParameters {
 };
 
 @interface WKView ()
+- (void)_accessibilityRegisterUIProcessTokens;
+- (void)_disableComplexTextInputIfNecessary;
 - (float)_intrinsicDeviceScaleFactor;
+- (void)_postFakeMouseMovedEventForFlagsChangedEvent:(NSEvent *)flagsChangedEvent;
 - (void)_setDrawingAreaSize:(NSSize)size;
 - (void)_setPluginComplexTextInputState:(PluginComplexTextInputState)pluginComplexTextInputState;
-- (void)_disableComplexTextInputIfNecessary;
 - (BOOL)_shouldUseTiledDrawingArea;
-- (void)_accessibilityRegisterUIProcessTokens;
 @end
 
 @interface WKViewData : NSObject {
@@ -169,6 +170,7 @@ struct WKViewInterpretKeyEventsParameters {
     BOOL _ignoringMouseDraggedEvents;
     BOOL _dragHasStarted;
 
+    id _flagsChangedEventMonitor;
 #if ENABLE(GESTURE_EVENTS)
     id _endGestureMonitor;
 #endif
@@ -223,6 +225,7 @@ struct WKViewInterpretKeyEventsParameters {
 - (void)dealloc
 {
     _data->_page->close();
+    [NSEvent removeMonitor:_data->_flagsChangedEventMonitor];
 
     ASSERT(!_data->_inSecureInputState);
 
@@ -2067,6 +2070,14 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
     return hitView;
 }
 
+- (void)_postFakeMouseMovedEventForFlagsChangedEvent:(NSEvent *)flagsChangedEvent
+{
+    NSEvent *fakeEvent = [NSEvent mouseEventWithType:NSMouseMoved location:[[flagsChangedEvent window] convertScreenToBase:[NSEvent mouseLocation]]
+        modifierFlags:[flagsChangedEvent modifierFlags] timestamp:[flagsChangedEvent timestamp] windowNumber:[flagsChangedEvent windowNumber]
+        context:[flagsChangedEvent context] eventNumber:0 clickCount:0 pressure:0];
+    [self mouseMoved:fakeEvent];
+}
+
 - (NSInteger)conversationIdentifier
 {
     return (NSInteger)self;
@@ -2692,6 +2703,10 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
 #endif
     _data->_mouseDownEvent = nil;
     _data->_ignoringMouseDraggedEvents = NO;
+    _data->_flagsChangedEventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSFlagsChangedMask handler:^(NSEvent *flagsChangedEvent) {
+        [self _postFakeMouseMovedEventForFlagsChangedEvent:flagsChangedEvent];
+        return flagsChangedEvent;
+    }];
 
     [self _registerDraggedTypes];