Huw Davies : winemac: Update the keyboard layout data immediately after changing the input source.

Alexandre Julliard julliard at winehq.org
Mon Oct 24 15:57:55 CDT 2016


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Mon Oct 24 10:15:18 2016 +0100

winemac: Update the keyboard layout data immediately after changing the input source.

It would eventually get updated by the keyboard changed event, but
only after the message queue was pumped.

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

---

 dlls/winemac.drv/cocoa_app.m | 3 ++-
 dlls/winemac.drv/keyboard.c  | 8 ++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m
index dced704..0eaea57 100644
--- a/dlls/winemac.drv/cocoa_app.m
+++ b/dlls/winemac.drv/cocoa_app.m
@@ -2426,7 +2426,8 @@ void macdrv_get_input_source_info(CFDataRef* uchr, CGEventSourceKeyboardType* ke
 
             *keyboard_type = [WineApplicationController sharedController].keyboardType;
             *is_iso = (KBGetLayoutType(*keyboard_type) == kKeyboardISO);
-            *input_source = TISCopyCurrentKeyboardInputSource();
+            if (input_source)
+                *input_source = TISCopyCurrentKeyboardInputSource();
         }
     });
 }
diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c
index 6680e6b..3e0ebbf 100644
--- a/dlls/winemac.drv/keyboard.c
+++ b/dlls/winemac.drv/keyboard.c
@@ -1186,7 +1186,15 @@ HKL CDECL macdrv_ActivateKeyboardLayout(HKL hkl, UINT flags)
             if (macdrv_select_input_source(layout->input_source))
             {
                 oldHkl = thread_data->active_keyboard_layout;
+                if (thread_data->keyboard_layout_uchr)
+                    CFRelease(thread_data->keyboard_layout_uchr);
+
+                macdrv_get_input_source_info(&thread_data->keyboard_layout_uchr, &thread_data->keyboard_type,
+                                             &thread_data->iso_keyboard, NULL);
                 thread_data->active_keyboard_layout = hkl;
+                thread_data->dead_key_state = 0;
+
+                macdrv_compute_keyboard_layout(thread_data);
             }
             break;
         }




More information about the wine-cvs mailing list