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@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Ken Thomases 2017-05-15 17:17:46 -05:00 committed by Alexandre Julliard
parent 7a1142035d
commit 48548812fe
3 changed files with 10 additions and 10 deletions

View File

@ -116,7 +116,6 @@ - (void) windowGotFocus:(WineWindow*)window;
- (BOOL) waitUntilQueryDone:(int*)done timeout:(NSDate*)timeout processEvents:(BOOL)processEvents; - (BOOL) waitUntilQueryDone:(int*)done timeout:(NSDate*)timeout processEvents:(BOOL)processEvents;
- (void) keyboardSelectionDidChange;
- (void) noteKey:(uint16_t)keyCode pressed:(BOOL)pressed; - (void) noteKey:(uint16_t)keyCode pressed:(BOOL)pressed;
- (void) window:(WineWindow*)window isBeingDragged:(BOOL)dragged; - (void) window:(WineWindow*)window isBeingDragged:(BOOL)dragged;

View File

@ -453,6 +453,15 @@ - (void) keyboardSelectionDidChange
} }
} }
- (void) setKeyboardType:(CGEventSourceKeyboardType)newType
{
if (newType != keyboardType)
{
keyboardType = newType;
[self keyboardSelectionDidChange];
}
}
- (void) enabledKeyboardInputSourcesChanged - (void) enabledKeyboardInputSourcesChanged
{ {
macdrv_layout_list_needs_update = TRUE; macdrv_layout_list_needs_update = TRUE;

View File

@ -1929,15 +1929,7 @@ - (void) postKey:(uint16_t)keyCode
event->key.time_ms = [controller ticksForEventTime:[theEvent timestamp]]; event->key.time_ms = [controller ticksForEventTime:[theEvent timestamp]];
if ((cgevent = [theEvent CGEvent])) if ((cgevent = [theEvent CGEvent]))
{ controller.keyboardType = CGEventGetIntegerValueField(cgevent, kCGKeyboardEventKeyboardType);
CGEventSourceKeyboardType keyboardType = CGEventGetIntegerValueField(cgevent,
kCGKeyboardEventKeyboardType);
if (keyboardType != controller.keyboardType)
{
controller.keyboardType = keyboardType;
[controller keyboardSelectionDidChange];
}
}
[queue postEvent:event]; [queue postEvent:event];