Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
d0e1a025
Commit
d0e1a025
authored
Feb 03, 2013
by
Ken Thomases
Committed by
Alexandre Julliard
Feb 05, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemac: Rebuild key map when Mac keyboard layout changes.
parent
b78eee31
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
89 additions
and
0 deletions
+89
-0
cocoa_app.m
dlls/winemac.drv/cocoa_app.m
+50
-0
cocoa_event.m
dlls/winemac.drv/cocoa_event.m
+3
-0
event.c
dlls/winemac.drv/event.c
+7
-0
keyboard.c
dlls/winemac.drv/keyboard.c
+22
-0
macdrv.h
dlls/winemac.drv/macdrv.h
+1
-0
macdrv_cocoa.h
dlls/winemac.drv/macdrv_cocoa.h
+6
-0
No files found.
dlls/winemac.drv/cocoa_app.m
View file @
d0e1a025
...
...
@@ -177,6 +177,47 @@ int macdrv_err_on;
}
}
-
(
void
)
keyboardSelectionDidChange
{
TISInputSourceRef
inputSource
;
inputSource
=
TISCopyCurrentKeyboardLayoutInputSource
();
if
(
inputSource
)
{
CFDataRef
uchr
;
uchr
=
TISGetInputSourceProperty
(
inputSource
,
kTISPropertyUnicodeKeyLayoutData
);
if
(
uchr
)
{
macdrv_event
event
;
WineEventQueue
*
queue
;
event
.
type
=
KEYBOARD_CHANGED
;
event
.
window
=
NULL
;
event
.
keyboard_changed
.
keyboard_type
=
self
.
keyboardType
;
event
.
keyboard_changed
.
iso_keyboard
=
(
KBGetLayoutType
(
self
.
keyboardType
)
==
kKeyboardISO
);
event
.
keyboard_changed
.
uchr
=
CFDataCreateCopy
(
NULL
,
uchr
);
if
(
event
.
keyboard_changed
.
uchr
)
{
[
eventQueuesLock
lock
];
for
(
queue
in
eventQueues
)
{
CFRetain
(
event
.
keyboard_changed
.
uchr
);
[
queue
postEvent
:
&
event
];
}
[
eventQueuesLock
unlock
];
CFRelease
(
event
.
keyboard_changed
.
uchr
);
}
}
CFRelease
(
inputSource
);
}
}
/*
* ---------- NSApplicationDelegate methods ----------
...
...
@@ -218,6 +259,15 @@ int macdrv_err_on;
[
keyWindows
removeObjectIdenticalTo
:
window
];
}];
[
nc
addObserver
:
self
selector
:
@selector
(
keyboardSelectionDidChange
)
name
:
NSTextInputContextKeyboardSelectionDidChangeNotification
object
:
nil
];
/* The above notification isn't sent unless the NSTextInputContext
class has initialized itself. Poke it. */
[
NSTextInputContext
self
];
self
.
keyboardType
=
LMGetKbdType
();
}
...
...
dlls/winemac.drv/cocoa_event.m
View file @
d0e1a025
...
...
@@ -277,6 +277,9 @@ void macdrv_cleanup_event(macdrv_event *event)
switch
(
event
->
type
)
{
case
KEYBOARD_CHANGED
:
CFRelease
(
event
->
keyboard_changed
.
uchr
);
break
;
case
WINDOW_GOT_FOCUS
:
[(
NSMutableSet
*
)
event
->
window_got_focus
.
tried_windows
release
];
break
;
...
...
dlls/winemac.drv/event.c
View file @
d0e1a025
...
...
@@ -33,6 +33,7 @@ static const char *dbgstr_event(int type)
{
static
const
char
*
const
event_names
[]
=
{
"APP_DEACTIVATED"
,
"KEYBOARD_CHANGED"
,
"MOUSE_BUTTON"
,
"WINDOW_CLOSE_REQUESTED"
,
"WINDOW_DID_MINIMIZE"
,
...
...
@@ -56,6 +57,9 @@ static macdrv_event_mask get_event_mask(DWORD mask)
if
((
mask
&
QS_ALLINPUT
)
==
QS_ALLINPUT
)
return
-
1
;
if
(
mask
&
QS_KEY
)
event_mask
|=
event_mask_for_type
(
KEYBOARD_CHANGED
);
if
(
mask
&
QS_MOUSEBUTTON
)
event_mask
|=
event_mask_for_type
(
MOUSE_BUTTON
);
...
...
@@ -94,6 +98,9 @@ void macdrv_handle_event(macdrv_event *event)
case
APP_DEACTIVATED
:
macdrv_app_deactivated
();
break
;
case
KEYBOARD_CHANGED
:
macdrv_keyboard_changed
(
event
);
break
;
case
MOUSE_BUTTON
:
macdrv_mouse_button
(
hwnd
,
event
);
break
;
...
...
dlls/winemac.drv/keyboard.c
View file @
d0e1a025
...
...
@@ -661,3 +661,25 @@ void macdrv_compute_keyboard_layout(struct macdrv_thread_data *thread_data)
TRACE
(
"keyc 0x%04x -> vkey 0x%04x (spare vkey)
\n
"
,
keyc
,
vkey
);
}
}
/***********************************************************************
* macdrv_keyboard_changed
*
* Handler for KEYBOARD_CHANGED events.
*/
void
macdrv_keyboard_changed
(
const
macdrv_event
*
event
)
{
struct
macdrv_thread_data
*
thread_data
=
macdrv_thread_data
();
TRACE
(
"new keyboard layout uchr data %p, type %u, iso %d
\n
"
,
event
->
keyboard_changed
.
uchr
,
event
->
keyboard_changed
.
keyboard_type
,
event
->
keyboard_changed
.
iso_keyboard
);
if
(
thread_data
->
keyboard_layout_uchr
)
CFRelease
(
thread_data
->
keyboard_layout_uchr
);
thread_data
->
keyboard_layout_uchr
=
CFDataCreateCopy
(
NULL
,
event
->
keyboard_changed
.
uchr
);
thread_data
->
keyboard_type
=
event
->
keyboard_changed
.
keyboard_type
;
thread_data
->
iso_keyboard
=
event
->
keyboard_changed
.
iso_keyboard
;
macdrv_compute_keyboard_layout
(
thread_data
);
}
dlls/winemac.drv/macdrv.h
View file @
d0e1a025
...
...
@@ -134,5 +134,6 @@ extern void macdrv_window_did_unminimize(HWND hwnd) DECLSPEC_HIDDEN;
extern
void
macdrv_mouse_button
(
HWND
hwnd
,
const
macdrv_event
*
event
)
DECLSPEC_HIDDEN
;
extern
void
macdrv_compute_keyboard_layout
(
struct
macdrv_thread_data
*
thread_data
)
DECLSPEC_HIDDEN
;
extern
void
macdrv_keyboard_changed
(
const
macdrv_event
*
event
)
DECLSPEC_HIDDEN
;
#endif
/* __WINE_MACDRV_H */
dlls/winemac.drv/macdrv_cocoa.h
View file @
d0e1a025
...
...
@@ -125,6 +125,7 @@ extern void macdrv_free_displays(struct macdrv_display* displays) DECLSPEC_HIDDE
/* event */
enum
{
APP_DEACTIVATED
,
KEYBOARD_CHANGED
,
MOUSE_BUTTON
,
WINDOW_CLOSE_REQUESTED
,
WINDOW_DID_MINIMIZE
,
...
...
@@ -142,6 +143,11 @@ typedef struct macdrv_event {
macdrv_window
window
;
union
{
struct
{
CFDataRef
uchr
;
CGEventSourceKeyboardType
keyboard_type
;
int
iso_keyboard
;
}
keyboard_changed
;
struct
{
int
button
;
int
pressed
;
int
x
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment