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
f344d7a2
Commit
f344d7a2
authored
Nov 20, 2013
by
Huw Davies
Committed by
Alexandre Julliard
Nov 20, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemac: Update the layout list if the enabled input sources change.
parent
fecaab9c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
8 deletions
+60
-8
cocoa_app.m
dlls/winemac.drv/cocoa_app.m
+10
-0
keyboard.c
dlls/winemac.drv/keyboard.c
+49
-8
macdrv_cocoa.h
dlls/winemac.drv/macdrv_cocoa.h
+1
-0
No files found.
dlls/winemac.drv/cocoa_app.m
View file @
f344d7a2
...
@@ -411,6 +411,11 @@ int macdrv_err_on;
...
@@ -411,6 +411,11 @@ int macdrv_err_on;
}
}
}
}
-
(
void
)
enabledKeyboardInputSourcesChanged
{
macdrv_layout_list_needs_update
=
TRUE
;
}
-
(
CGFloat
)
primaryScreenHeight
-
(
CGFloat
)
primaryScreenHeight
{
{
if
(
!
primaryScreenHeightValid
)
if
(
!
primaryScreenHeightValid
)
...
@@ -1930,6 +1935,11 @@ int macdrv_err_on;
...
@@ -1930,6 +1935,11 @@ int macdrv_err_on;
name
:
@"com.apple.HIToolbox.beginMenuTrackingNotification"
name
:
@"com.apple.HIToolbox.beginMenuTrackingNotification"
object
:
nil
object
:
nil
suspensionBehavior
:
NSNotificationSuspensionBehaviorDrop
];
suspensionBehavior
:
NSNotificationSuspensionBehaviorDrop
];
[
dnc
addObserver
:
self
selector
:
@selector
(
enabledKeyboardInputSourcesChanged
)
name
:
(
NSString
*
)
kTISNotifyEnabledKeyboardInputSourcesChanged
object
:
nil
];
}
}
-
(
BOOL
)
inputSourceIsInputMethod
-
(
BOOL
)
inputSourceIsInputMethod
...
...
dlls/winemac.drv/keyboard.c
View file @
f344d7a2
...
@@ -435,6 +435,7 @@ struct layout
...
@@ -435,6 +435,7 @@ struct layout
struct
list
entry
;
struct
list
entry
;
HKL
hkl
;
HKL
hkl
;
TISInputSourceRef
input_source
;
TISInputSourceRef
input_source
;
BOOL
enabled
;
/* is the input source enabled - ie displayed in the input source selector UI */
};
};
static
CRITICAL_SECTION
layout_list_section
;
static
CRITICAL_SECTION
layout_list_section
;
...
@@ -446,6 +447,8 @@ static CRITICAL_SECTION_DEBUG critsect_debug =
...
@@ -446,6 +447,8 @@ static CRITICAL_SECTION_DEBUG critsect_debug =
};
};
static
CRITICAL_SECTION
layout_list_section
=
{
&
critsect_debug
,
-
1
,
0
,
0
,
0
,
0
};
static
CRITICAL_SECTION
layout_list_section
=
{
&
critsect_debug
,
-
1
,
0
,
0
,
0
,
0
};
int
macdrv_layout_list_needs_update
=
TRUE
;
static
DWORD
get_lcid
(
CFStringRef
lang
)
static
DWORD
get_lcid
(
CFStringRef
lang
)
{
{
CFRange
range
;
CFRange
range
;
...
@@ -481,10 +484,36 @@ static HKL get_hkl(CFStringRef lang, CFStringRef type)
...
@@ -481,10 +484,36 @@ static HKL get_hkl(CFStringRef lang, CFStringRef type)
return
(
HKL
)
lcid
;
return
(
HKL
)
lcid
;
}
}
/******************************************************************
* get_layout_from_source
*
* Must be called while holding the layout_list_section.
* Note, returned layout may not currently be enabled.
*/
static
struct
layout
*
get_layout_from_source
(
TISInputSourceRef
input
)
{
struct
layout
*
ret
=
NULL
,
*
layout
;
LIST_FOR_EACH_ENTRY
(
layout
,
&
layout_list
,
struct
layout
,
entry
)
{
if
(
CFEqual
(
input
,
layout
->
input_source
))
{
ret
=
layout
;
break
;
}
}
return
ret
;
}
/***********************************************************************
/***********************************************************************
* update_layout_list
* update_layout_list
*
*
* Must be called while holding the layout_list_section
* Must be called while holding the layout_list_section
*
* If an input source has been disabled (ie. removed from the UI) its
* entry remains in the layout list but is marked as such and is not
* enumerated by GetKeyboardLayoutList. This is to ensure the
* HKL <-> input source mapping is unique.
*/
*/
static
void
update_layout_list
(
void
)
static
void
update_layout_list
(
void
)
{
{
...
@@ -492,23 +521,34 @@ static void update_layout_list(void)
...
@@ -492,23 +521,34 @@ static void update_layout_list(void)
struct
layout
*
layout
;
struct
layout
*
layout
;
int
i
;
int
i
;
if
(
!
list_empty
(
&
layout_list
))
return
;
if
(
!
InterlockedExchange
(
&
macdrv_layout_list_needs_update
,
FALSE
))
return
;
sources
=
macdrv_create_input_source_list
();
sources
=
macdrv_create_input_source_list
();
LIST_FOR_EACH_ENTRY
(
layout
,
&
layout_list
,
struct
layout
,
entry
)
layout
->
enabled
=
FALSE
;
for
(
i
=
0
;
i
<
CFArrayGetCount
(
sources
);
i
++
)
for
(
i
=
0
;
i
<
CFArrayGetCount
(
sources
);
i
++
)
{
{
CFDictionaryRef
dict
=
CFArrayGetValueAtIndex
(
sources
,
i
);
CFDictionaryRef
dict
=
CFArrayGetValueAtIndex
(
sources
,
i
);
TISInputSourceRef
input
=
(
TISInputSourceRef
)
CFDictionaryGetValue
(
dict
,
macdrv_input_source_input_key
);
TISInputSourceRef
input
=
(
TISInputSourceRef
)
CFDictionaryGetValue
(
dict
,
macdrv_input_source_input_key
);
CFStringRef
type
=
CFDictionaryGetValue
(
dict
,
macdrv_input_source_type_key
);
layout
=
get_layout_from_source
(
input
);
CFStringRef
lang
=
CFDictionaryGetValue
(
dict
,
macdrv_input_source_lang_key
);
if
(
!
layout
)
{
CFStringRef
type
=
CFDictionaryGetValue
(
dict
,
macdrv_input_source_type_key
);
CFStringRef
lang
=
CFDictionaryGetValue
(
dict
,
macdrv_input_source_lang_key
);
layout
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
layout
));
layout
->
input_source
=
(
TISInputSourceRef
)
CFRetain
(
input
);
layout
->
hkl
=
get_hkl
(
lang
,
type
);
layout
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
layout
));
list_add_tail
(
&
layout_list
,
&
layout
->
entry
);
layout
->
input_source
=
(
TISInputSourceRef
)
CFRetain
(
input
);
TRACE
(
"adding new layout %p
\n
"
,
layout
->
hkl
);
layout
->
hkl
=
get_hkl
(
lang
,
type
);
}
else
TRACE
(
"enabling already existing layout %p
\n
"
,
layout
->
hkl
);
list_add_tail
(
&
layout_list
,
&
layout
->
entry
);
layout
->
enabled
=
TRUE
;
TRACE
(
"adding new layout %p
\n
"
,
layout
->
hkl
);
}
}
CFRelease
(
sources
);
CFRelease
(
sources
);
...
@@ -1322,6 +1362,7 @@ UINT CDECL macdrv_GetKeyboardLayoutList(INT size, HKL *list)
...
@@ -1322,6 +1362,7 @@ UINT CDECL macdrv_GetKeyboardLayoutList(INT size, HKL *list)
LIST_FOR_EACH_ENTRY
(
layout
,
&
layout_list
,
struct
layout
,
entry
)
LIST_FOR_EACH_ENTRY
(
layout
,
&
layout_list
,
struct
layout
,
entry
)
{
{
if
(
!
layout
->
enabled
)
continue
;
if
(
list
)
if
(
list
)
{
{
if
(
count
>=
size
)
break
;
if
(
count
>=
size
)
break
;
...
...
dlls/winemac.drv/macdrv_cocoa.h
View file @
f344d7a2
...
@@ -416,6 +416,7 @@ extern CFArrayRef macdrv_create_input_source_list(void) DECLSPEC_HIDDEN;
...
@@ -416,6 +416,7 @@ extern CFArrayRef macdrv_create_input_source_list(void) DECLSPEC_HIDDEN;
extern
const
CFStringRef
macdrv_input_source_input_key
DECLSPEC_HIDDEN
;
extern
const
CFStringRef
macdrv_input_source_input_key
DECLSPEC_HIDDEN
;
extern
const
CFStringRef
macdrv_input_source_type_key
DECLSPEC_HIDDEN
;
extern
const
CFStringRef
macdrv_input_source_type_key
DECLSPEC_HIDDEN
;
extern
const
CFStringRef
macdrv_input_source_lang_key
DECLSPEC_HIDDEN
;
extern
const
CFStringRef
macdrv_input_source_lang_key
DECLSPEC_HIDDEN
;
extern
int
macdrv_layout_list_needs_update
DECLSPEC_HIDDEN
;
/* clipboard */
/* clipboard */
...
...
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