[PATCH 1/2] winemac: Move the logic for posting a KEYBOARD_CHANGED event if the keyboard type changes into the setter of the keyboardType property.

Ken Thomases ken at codeweavers.com
Mon May 15 17:17:46 CDT 2017


Signed-off-by: Ken Thomases <ken at codeweavers.com>
---
 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 @@ - (void) windowGotFocus:(WineWindow*)window;
 
     - (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 @@ - (void) keyboardSelectionDidChange
         }
     }
 
+    - (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 @@ - (void) postKey:(uint16_t)keyCode
         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];
 
-- 
2.10.2




More information about the wine-patches mailing list