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
66c31814
Commit
66c31814
authored
Apr 30, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
Apr 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Move GetKeyboardLayoutList from nulldrv.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d1c2fada
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
56 deletions
+75
-56
driver.c
dlls/user32/driver.c
+1
-53
input.c
dlls/user32/input.c
+74
-3
No files found.
dlls/user32/driver.c
View file @
66c31814
...
...
@@ -198,59 +198,7 @@ static void CDECL nulldrv_Beep(void)
static
UINT
CDECL
nulldrv_GetKeyboardLayoutList
(
INT
size
,
HKL
*
layouts
)
{
HKEY
hKeyKeyboard
;
DWORD
rc
;
INT
count
=
0
;
ULONG_PTR
baselayout
;
LANGID
langid
;
baselayout
=
GetUserDefaultLCID
();
langid
=
PRIMARYLANGID
(
LANGIDFROMLCID
(
baselayout
));
if
(
langid
==
LANG_CHINESE
||
langid
==
LANG_JAPANESE
||
langid
==
LANG_KOREAN
)
baselayout
=
MAKELONG
(
baselayout
,
0xe001
);
/* IME */
else
baselayout
|=
baselayout
<<
16
;
/* Enumerate the Registry */
rc
=
RegOpenKeyW
(
HKEY_LOCAL_MACHINE
,
L"System
\\
CurrentControlSet
\\
Control
\\
Keyboard Layouts"
,
&
hKeyKeyboard
);
if
(
rc
==
ERROR_SUCCESS
)
{
do
{
WCHAR
szKeyName
[
9
];
HKL
layout
;
rc
=
RegEnumKeyW
(
hKeyKeyboard
,
count
,
szKeyName
,
9
);
if
(
rc
==
ERROR_SUCCESS
)
{
layout
=
(
HKL
)(
ULONG_PTR
)
wcstoul
(
szKeyName
,
NULL
,
16
);
if
(
baselayout
!=
0
&&
layout
==
(
HKL
)
baselayout
)
baselayout
=
0
;
/* found in the registry do not add again */
if
(
size
&&
layouts
)
{
if
(
count
>=
size
)
break
;
layouts
[
count
]
=
layout
;
}
count
++
;
}
}
while
(
rc
==
ERROR_SUCCESS
);
RegCloseKey
(
hKeyKeyboard
);
}
/* make sure our base layout is on the list */
if
(
baselayout
!=
0
)
{
if
(
size
&&
layouts
)
{
if
(
count
<
size
)
{
layouts
[
count
]
=
(
HKL
)
baselayout
;
count
++
;
}
}
else
count
++
;
}
return
count
;
return
~
0
;
/* use default implementation */
}
static
INT
CDECL
nulldrv_GetKeyNameText
(
LONG
lparam
,
LPWSTR
buffer
,
INT
size
)
...
...
dlls/user32/input.c
View file @
66c31814
...
...
@@ -77,6 +77,43 @@ static WORD get_key_state(void)
}
/***********************************************************************
* get_locale_kbd_layout
*/
static
HKL
get_locale_kbd_layout
(
void
)
{
ULONG_PTR
layout
;
LANGID
langid
;
/* FIXME:
*
* layout = main_key_tab[kbd_layout].lcid;
*
* Winword uses return value of GetKeyboardLayout as a codepage
* to translate ANSI keyboard messages to unicode. But we have
* a problem with it: for instance Polish keyboard layout is
* identical to the US one, and therefore instead of the Polish
* locale id we return the US one.
*/
layout
=
GetUserDefaultLCID
();
/*
* Microsoft Office expects this value to be something specific
* for Japanese and Korean Windows with an IME the value is 0xe001
* We should probably check to see if an IME exists and if so then
* set this word properly.
*/
langid
=
PRIMARYLANGID
(
LANGIDFROMLCID
(
layout
)
);
if
(
langid
==
LANG_CHINESE
||
langid
==
LANG_JAPANESE
||
langid
==
LANG_KOREAN
)
layout
=
MAKELONG
(
layout
,
0xe001
);
/* IME */
else
layout
=
MAKELONG
(
layout
,
layout
);
return
(
HKL
)
layout
;
}
/**********************************************************************
* set_capture_window
*/
...
...
@@ -1297,11 +1334,45 @@ BOOL WINAPI BlockInput(BOOL fBlockIt)
* Return number of values available if either input parm is
* 0, per MS documentation.
*/
UINT
WINAPI
GetKeyboardLayoutList
(
INT
nBuff
,
HKL
*
layouts
)
UINT
WINAPI
GetKeyboardLayoutList
(
INT
size
,
HKL
*
layouts
)
{
TRACE_
(
keyboard
)(
"(%d, %p)
\n
"
,
nBuff
,
layouts
);
WCHAR
klid
[
KL_NAMELENGTH
];
UINT
count
,
tmp
,
i
=
0
;
HKEY
hkey
;
HKL
layout
;
TRACE_
(
keyboard
)(
"size %d, layouts %p.
\n
"
,
size
,
layouts
);
if
((
count
=
USER_Driver
->
pGetKeyboardLayoutList
(
size
,
layouts
))
!=
~
0
)
return
count
;
layout
=
get_locale_kbd_layout
();
count
=
0
;
count
++
;
if
(
size
&&
layouts
)
{
layouts
[
count
-
1
]
=
layout
;
if
(
count
==
size
)
return
count
;
}
if
(
!
RegOpenKeyW
(
HKEY_LOCAL_MACHINE
,
L"System
\\
CurrentControlSet
\\
Control
\\
Keyboard Layouts"
,
&
hkey
))
{
while
(
!
RegEnumKeyW
(
hkey
,
i
++
,
klid
,
ARRAY_SIZE
(
klid
)
))
{
tmp
=
wcstoul
(
klid
,
NULL
,
16
);
if
(
layout
==
UlongToHandle
(
tmp
))
continue
;
count
++
;
if
(
size
&&
layouts
)
{
layouts
[
count
-
1
]
=
UlongToHandle
(
tmp
);
if
(
count
==
size
)
break
;
}
}
RegCloseKey
(
hkey
);
}
return
USER_Driver
->
pGetKeyboardLayoutList
(
nBuff
,
layouts
)
;
return
count
;
}
...
...
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