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
ac2053ba
Commit
ac2053ba
authored
May 23, 2008
by
Eric Pouech
Committed by
Alexandre Julliard
May 27, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Properly handle the extended keys in getch().
parent
9f74bf1e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
4 deletions
+48
-4
console.c
dlls/msvcrt/console.c
+48
-4
No files found.
dlls/msvcrt/console.c
View file @
ac2053ba
...
...
@@ -77,6 +77,24 @@ int CDECL _cputs(const char* str)
return
retval
;
}
#define NORMAL_CHAR 0
#define ALT_CHAR 1
#define CTRL_CHAR 2
#define SHIFT_CHAR 3
static
struct
{
unsigned
vk
;
unsigned
ch
[
4
][
2
];}
enh_map
[]
=
{
{
0x47
,
{{
0xE0
,
0x47
},
{
0x00
,
0x97
},
{
0xE0
,
0x77
},
{
0xE0
,
0x47
}}},
{
0x48
,
{{
0xE0
,
0x48
},
{
0x00
,
0x98
},
{
0xE0
,
0x8D
},
{
0xE0
,
0x48
}}},
{
0x49
,
{{
0xE0
,
0x49
},
{
0x00
,
0x99
},
{
0xE0
,
0x86
},
{
0xE0
,
0x49
}}},
{
0x4B
,
{{
0xE0
,
0x4B
},
{
0x00
,
0x9B
},
{
0xE0
,
0x73
},
{
0xE0
,
0x4B
}}},
{
0x4D
,
{{
0xE0
,
0x4D
},
{
0x00
,
0x9D
},
{
0xE0
,
0x74
},
{
0xE0
,
0x4D
}}},
{
0x4F
,
{{
0xE0
,
0x4F
},
{
0x00
,
0x9F
},
{
0xE0
,
0x75
},
{
0xE0
,
0x4F
}}},
{
0x50
,
{{
0xE0
,
0x50
},
{
0x00
,
0xA0
},
{
0xE0
,
0x91
},
{
0xE0
,
0x50
}}},
{
0x51
,
{{
0xE0
,
0x51
},
{
0x00
,
0xA1
},
{
0xE0
,
0x76
},
{
0xE0
,
0x51
}}},
{
0x52
,
{{
0xE0
,
0x52
},
{
0x00
,
0xA2
},
{
0xE0
,
0x92
},
{
0xE0
,
0x52
}}},
{
0x53
,
{{
0xE0
,
0x53
},
{
0x00
,
0xA3
},
{
0xE0
,
0x93
},
{
0xE0
,
0x53
}}},
};
/*********************************************************************
* _getch (MSVCRT.@)
*/
...
...
@@ -103,13 +121,39 @@ int CDECL _getch(void)
do
{
if
(
ReadConsoleInputA
(
MSVCRT_console_in
,
&
ir
,
1
,
&
count
))
{
int
i
;
/* Only interested in ASCII chars */
if
(
ir
.
EventType
==
KEY_EVENT
&&
ir
.
Event
.
KeyEvent
.
bKeyDown
&&
ir
.
Event
.
KeyEvent
.
uChar
.
AsciiChar
)
ir
.
Event
.
KeyEvent
.
bKeyDown
)
{
retval
=
ir
.
Event
.
KeyEvent
.
uChar
.
AsciiChar
;
break
;
if
(
ir
.
Event
.
KeyEvent
.
uChar
.
AsciiChar
)
{
retval
=
ir
.
Event
.
KeyEvent
.
uChar
.
AsciiChar
;
break
;
}
for
(
i
=
0
;
i
<
sizeof
(
enh_map
)
/
sizeof
(
enh_map
[
0
]);
i
++
)
{
if
(
ir
.
Event
.
KeyEvent
.
wVirtualScanCode
==
enh_map
[
i
].
vk
)
break
;
}
if
(
i
<
sizeof
(
enh_map
)
/
sizeof
(
enh_map
[
0
]))
{
unsigned
idx
;
if
(
ir
.
Event
.
KeyEvent
.
wVirtualScanCode
&
(
LEFT_ALT_PRESSED
|
RIGHT_ALT_PRESSED
))
idx
=
ALT_CHAR
;
else
if
(
ir
.
Event
.
KeyEvent
.
wVirtualScanCode
&
(
LEFT_CTRL_PRESSED
|
RIGHT_CTRL_PRESSED
)
)
idx
=
CTRL_CHAR
;
else
if
(
ir
.
Event
.
KeyEvent
.
wVirtualScanCode
&
SHIFT_PRESSED
)
idx
=
SHIFT_CHAR
;
else
idx
=
NORMAL_CHAR
;
retval
=
enh_map
[
i
].
ch
[
idx
][
0
];
__MSVCRT_console_buffer
=
enh_map
[
i
].
ch
[
idx
][
1
];
break
;
}
WARN
(
"Unmapped char keyState=%x vk=%x
\n
"
,
ir
.
Event
.
KeyEvent
.
dwControlKeyState
,
ir
.
Event
.
KeyEvent
.
wVirtualScanCode
);
}
}
else
...
...
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