Ken Thomases : winemac: Move the logic for posting a KEYBOARD_CHANGED event if the keyboard type changes into the setter of the keyboardType property.

Alexandre Julliard julliard at winehq.org
Tue May 16 16:05:10 CDT 2017


Module: wine
Branch: master
Commit: 48548812fe221ecffad120071847b4210dac74fb
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=48548812fe221ecffad120071847b4210dac74fb

Author: Ken Thomases <ken at codeweavers.com>
Date:   Mon May 15 17:17:46 2017 -0500

winemac: Move the logic for posting a KEYBOARD_CHANGED event if the keyboard type changes into the setter of the keyboardType property.

Signed-off-by: Ken Thomases <ken at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winemac.drv/cocoa_app.h    |  1 -
 dlls/winemac.drv/cocoa_app.m    |  9 +++++++++
 dlls/winemac.drv/cocoa_window.m | 10 +---------
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/dlls/winemac.drv/cocoa_app.h b/dlls/winemac.drv/cocoa_app.h
index 6ca3fcb..1ca0bd7 100644
--- a/dlls/winemac.drv/cocoa_app.h
+++ b/dlls/winemac.drv/cocoa_app.h
@@ -116,7 +116,6 @@ enum {
 
     - (BOOL) waitUntilQueryDone:(int*)done timeout:(NSDate*)timeout processEvents:(BOOL)processEvents;
 
-    - (void) keyboardSelectionDidChange;
     - (void) noteKey:(uint16_t)keyCode pressed:(BOOL)pressed;
 
     - (void) window:(WineWindow*)window isBeingDragged:(BOOL)dragged;
diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m
index 4013e03..2325654 100644
--- a/dlls/winemac.drv/cocoa_app.m
+++ b/dlls/winemac.drv/cocoa_app.m
@@ -453,6 +453,15 @@ static NSString* WineLocalizedString(unsigned int stringID)
         }
     }
 
+    - (void) setKeyboardType:(CGEventSourceKeyboardType)newType
+    {
+        if (newType != keyboardType)
+        {
+            keyboardType = newType;
+            [self keyboardSelectionDidChange];
+        }
+    }
+
     - (void) enabledKeyboardInputSourcesChanged
     {
         macdrv_layout_list_needs_update = TRUE;
diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m
index a9290c3..2333c1f 100644
--- a/dlls/winemac.drv/cocoa_window.m
+++ b/dlls/winemac.drv/cocoa_window.m
@@ -1929,15 +1929,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
         event->key.time_ms   = [controller ticksForEventTime:[theEvent timestamp]];
 
         if ((cgevent = [theEvent CGEvent]))
-        {
-            CGEventSourceKeyboardType keyboardType = CGEventGetIntegerValueField(cgevent,
-                                                        kCGKeyboardEventKeyboardType);
-            if (keyboardType != controller.keyboardType)
-            {
-                controller.keyboardType = keyboardType;
-                [controller keyboardSelectionDidChange];
-            }
-        }
+            controller.keyboardType = CGEventGetIntegerValueField(cgevent, kCGKeyboardEventKeyboardType);
 
         [queue postEvent:event];
 




More information about the wine-cvs mailing list