Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
10556c25
Commit
10556c25
authored
May 28, 2015
by
Huw Davies
Committed by
Alexandre Julliard
May 28, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11: Fix ctrl-<symbol> to generate codes below 0x20 where necessary.
parent
68e1fdf9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
23 deletions
+83
-23
input.c
dlls/user32/tests/input.c
+73
-21
keyboard.c
dlls/winex11.drv/keyboard.c
+10
-2
No files found.
dlls/user32/tests/input.c
View file @
10556c25
...
...
@@ -1587,6 +1587,56 @@ static void test_key_map(void)
}
}
#define shift 1
#define ctrl 2
static
const
struct
tounicode_tests
{
UINT
vk
;
DWORD
modifiers
;
WCHAR
chr
;
/* if vk is 0, lookup vk using this char */
int
expect_ret
;
WCHAR
expect_buf
[
4
];
}
utests
[]
=
{
{
'A'
,
0
,
0
,
1
,
{
'a'
,
0
}},
{
'A'
,
ctrl
,
0
,
1
,
{
1
,
0
}},
{
'A'
,
shift
|
ctrl
,
0
,
1
,
{
1
,
0
}},
{
VK_TAB
,
ctrl
,
0
,
0
,
{}},
{
VK_TAB
,
shift
|
ctrl
,
0
,
0
,
{}},
{
VK_RETURN
,
ctrl
,
0
,
1
,
{
'\n'
,
0
}},
{
VK_RETURN
,
shift
|
ctrl
,
0
,
0
,
{}},
{
'4'
,
ctrl
,
0
,
0
,
{}},
{
'4'
,
shift
|
ctrl
,
0
,
0
,
{}},
{
0
,
ctrl
,
'!'
,
0
,
{}},
{
0
,
ctrl
,
'\"'
,
0
,
{}},
{
0
,
ctrl
,
'#'
,
0
,
{}},
{
0
,
ctrl
,
'$'
,
0
,
{}},
{
0
,
ctrl
,
'%'
,
0
,
{}},
{
0
,
ctrl
,
'\''
,
0
,
{}},
{
0
,
ctrl
,
'('
,
0
,
{}},
{
0
,
ctrl
,
')'
,
0
,
{}},
{
0
,
ctrl
,
'*'
,
0
,
{}},
{
0
,
ctrl
,
'+'
,
0
,
{}},
{
0
,
ctrl
,
','
,
0
,
{}},
{
0
,
ctrl
,
'-'
,
0
,
{}},
{
0
,
ctrl
,
'.'
,
0
,
{}},
{
0
,
ctrl
,
'/'
,
0
,
{}},
{
0
,
ctrl
,
':'
,
0
,
{}},
{
0
,
ctrl
,
';'
,
0
,
{}},
{
0
,
ctrl
,
'<'
,
0
,
{}},
{
0
,
ctrl
,
'='
,
0
,
{}},
{
0
,
ctrl
,
'>'
,
0
,
{}},
{
0
,
ctrl
,
'?'
,
0
,
{}},
{
0
,
ctrl
,
'@'
,
1
,
{
0
}},
{
0
,
ctrl
,
'['
,
1
,
{
0x1b
}},
{
0
,
ctrl
,
'\\'
,
1
,
{
0x1c
}},
{
0
,
ctrl
,
']'
,
1
,
{
0x1d
}},
{
0
,
ctrl
,
'^'
,
1
,
{
0x1e
}},
{
0
,
ctrl
,
'_'
,
1
,
{
0x1f
}},
{
0
,
ctrl
,
'`'
,
0
,
{}},
};
static
void
test_ToUnicode
(
void
)
{
WCHAR
wStr
[
4
];
...
...
@@ -1614,30 +1664,32 @@ static void test_ToUnicode(void)
"ToUnicode didn't null-terminate the buffer when there was room.
\n
"
);
}
ret
=
ToUnicode
(
'A'
,
SC_A
,
state
,
wStr
,
4
,
0
);
ok
(
ret
==
1
,
"ToUnicode for character A didn't return 1 (was %i)
\n
"
,
ret
);
ok
(
wStr
[
0
]
==
'a'
,
"ToUnicode for character 'A' was %i (expected %i)
\n
"
,
wStr
[
0
],
'a'
)
;
for
(
i
=
0
;
i
<
sizeof
(
utests
)
/
sizeof
(
utests
[
0
]);
i
++
)
{
UINT
vk
=
utests
[
i
].
vk
,
mod
=
utests
[
i
].
modifiers
,
scan
;
state
[
VK_CONTROL
]
|=
HIGHEST_BIT
;
state
[
VK_LCONTROL
]
|=
HIGHEST_BIT
;
ret
=
ToUnicode
(
VK_TAB
,
SC_TAB
,
state
,
wStr
,
2
,
0
);
ok
(
ret
==
0
,
"ToUnicode for CTRL + Tab didn't return 0 (was %i)
\n
"
,
ret
);
if
(
!
vk
)
{
short
vk_ret
=
VkKeyScanW
(
utests
[
i
].
chr
);
if
(
vk_ret
==
-
1
)
continue
;
vk
=
vk_ret
&
0xff
;
if
(
vk_ret
&
0x100
)
mod
|=
shift
;
if
(
vk_ret
&
0x200
)
mod
|=
ctrl
;
}
scan
=
MapVirtualKeyW
(
vk
,
MAPVK_VK_TO_VSC
);
ret
=
ToUnicode
(
VK_RETURN
,
SC_RETURN
,
state
,
wStr
,
2
,
0
);
ok
(
ret
==
1
,
"ToUnicode for CTRL + Return didn't return 1 (was %i)
\n
"
,
ret
);
if
(
ret
==
1
)
ok
(
wStr
[
0
]
==
'\n'
,
"ToUnicode for CTRL + Return was %i (expected 10)
\n
"
,
wStr
[
0
]);
state
[
VK_SHIFT
]
=
state
[
VK_LSHIFT
]
=
(
mod
&
shift
)
?
HIGHEST_BIT
:
0
;
state
[
VK_CONTROL
]
=
state
[
VK_LCONTROL
]
=
(
mod
&
ctrl
)
?
HIGHEST_BIT
:
0
;
ret
=
ToUnicode
(
'A'
,
SC_A
,
state
,
wStr
,
4
,
0
);
ok
(
ret
==
1
,
"ToUnicode for CTRL + character A didn't return 1 (was %i)
\n
"
,
ret
);
ok
(
wStr
[
0
]
==
1
,
"ToUnicode for CTRL + character 'A' was %i (expected 1)
\n
"
,
wStr
[
0
]);
ret
=
ToUnicode
(
vk
,
scan
,
state
,
wStr
,
4
,
0
);
ok
(
ret
==
utests
[
i
].
expect_ret
,
"%d: got %d expected %d
\n
"
,
i
,
ret
,
utests
[
i
].
expect_ret
);
if
(
ret
)
ok
(
!
lstrcmpW
(
wStr
,
utests
[
i
].
expect_buf
),
"%d: got %s expected %s
\n
"
,
i
,
wine_dbgstr_w
(
wStr
),
wine_dbgstr_w
(
utests
[
i
].
expect_buf
));
state
[
VK_SHIFT
]
|=
HIGHEST_BIT
;
state
[
VK_LSHIFT
]
|=
HIGHEST_BIT
;
ret
=
ToUnicode
(
VK_TAB
,
SC_TAB
,
state
,
wStr
,
2
,
0
);
ok
(
ret
==
0
,
"ToUnicode for CTRL + SHIFT + Tab didn't return 0 (was %i)
\n
"
,
ret
);
ret
=
ToUnicode
(
VK_RETURN
,
SC_RETURN
,
state
,
wStr
,
2
,
0
);
todo_wine
ok
(
ret
==
0
,
"ToUnicode for CTRL + SHIFT + Return didn't return 0 (was %i)
\n
"
,
ret
);
}
state
[
VK_SHIFT
]
=
state
[
VK_LSHIFT
]
=
0
;
state
[
VK_CONTROL
]
=
state
[
VK_LCONTROL
]
=
0
;
ret
=
ToUnicode
(
VK_TAB
,
SC_TAB
,
NULL
,
wStr
,
4
,
0
);
ok
(
ret
==
0
,
"ToUnicode with NULL keystate didn't return 0 (was %i)
\n
"
,
ret
);
...
...
@@ -1688,7 +1740,7 @@ static void test_ToAscii(void)
state
[
VK_SHIFT
]
|=
HIGHEST_BIT
;
state
[
VK_LSHIFT
]
|=
HIGHEST_BIT
;
ret
=
ToAscii
(
VK_RETURN
,
SC_RETURN
,
state
,
&
character
,
0
);
todo_wine
ok
(
ret
==
0
,
"ToAscii for CTRL + Shift + Return key didn't return 0 (was %i)
\n
"
,
ret
);
ok
(
ret
==
0
,
"ToAscii for CTRL + Shift + Return key didn't return 0 (was %i)
\n
"
,
ret
);
ret
=
ToAscii
(
VK_RETURN
,
SC_RETURN
,
NULL
,
&
character
,
0
);
ok
(
ret
==
0
,
"ToAscii for NULL keystate didn't return 0 (was %i)
\n
"
,
ret
);
...
...
dlls/winex11.drv/keyboard.c
View file @
10556c25
...
...
@@ -2664,8 +2664,8 @@ INT CDECL X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState
CTRL + number or CTRL + symbol */
if
(
e
.
state
&
ControlMask
)
{
if
(((
keysym
>=
33
)
&&
(
keysym
<
'
A
'
))
||
(
(
keysym
>
'Z'
)
&&
(
keysym
<
'a'
)
)
||
if
(((
keysym
>=
33
)
&&
(
keysym
<
'
@
'
))
||
(
keysym
==
'`'
)
||
(
keysym
==
XK_Tab
))
{
lpChar
[
0
]
=
0
;
...
...
@@ -2689,9 +2689,17 @@ INT CDECL X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState
else
if
((
lpKeyState
[
VK_CONTROL
]
&
0x80
)
/* Control is pressed */
&&
(
keysym
==
XK_Return
||
keysym
==
XK_KP_Enter
))
{
if
(
lpKeyState
[
VK_SHIFT
]
&
0x80
)
{
lpChar
[
0
]
=
0
;
ret
=
0
;
}
else
{
lpChar
[
0
]
=
'\n'
;
ret
=
1
;
}
}
/* Hack to detect an XLookupString hard-coded to Latin1 */
if
(
ret
==
1
&&
keysym
>=
0x00a0
&&
keysym
<=
0x00ff
&&
(
BYTE
)
lpChar
[
0
]
==
keysym
)
...
...
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