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
2b4d95cd
Commit
2b4d95cd
authored
Feb 06, 2013
by
Ken Thomases
Committed by
Alexandre Julliard
Feb 06, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemac: Implement GetKeyNameText().
parent
80baa3a0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
172 additions
and
0 deletions
+172
-0
keyboard.c
dlls/winemac.drv/keyboard.c
+171
-0
winemac.drv.spec
dlls/winemac.drv/winemac.drv.spec
+1
-0
No files found.
dlls/winemac.drv/keyboard.c
View file @
2b4d95cd
...
...
@@ -312,6 +312,88 @@ static const struct {
};
static
const
struct
{
DWORD
vkey
;
const
char
*
name
;
}
vkey_names
[]
=
{
{
VK_ADD
,
"Num +"
},
{
VK_BACK
,
"Backspace"
},
{
VK_CAPITAL
,
"Caps Lock"
},
{
VK_CONTROL
,
"Ctrl"
},
{
VK_DECIMAL
,
"Num Del"
},
{
VK_DELETE
|
0x100
,
"Delete"
},
{
VK_DIVIDE
|
0x100
,
"Num /"
},
{
VK_DOWN
|
0x100
,
"Down"
},
{
VK_END
|
0x100
,
"End"
},
{
VK_ESCAPE
,
"Esc"
},
{
VK_F1
,
"F1"
},
{
VK_F2
,
"F2"
},
{
VK_F3
,
"F3"
},
{
VK_F4
,
"F4"
},
{
VK_F5
,
"F5"
},
{
VK_F6
,
"F6"
},
{
VK_F7
,
"F7"
},
{
VK_F8
,
"F8"
},
{
VK_F9
,
"F9"
},
{
VK_F10
,
"F10"
},
{
VK_F11
,
"F11"
},
{
VK_F12
,
"F12"
},
{
VK_F13
,
"F13"
},
{
VK_F14
,
"F14"
},
{
VK_F15
,
"F15"
},
{
VK_F16
,
"F16"
},
{
VK_F17
,
"F17"
},
{
VK_F18
,
"F18"
},
{
VK_F19
,
"F19"
},
{
VK_F20
,
"F20"
},
{
VK_F21
,
"F21"
},
{
VK_F22
,
"F22"
},
{
VK_F23
,
"F23"
},
{
VK_F24
,
"F24"
},
{
VK_HELP
|
0x100
,
"Help"
},
{
VK_HOME
|
0x100
,
"Home"
},
{
VK_INSERT
|
0x100
,
"Insert"
},
{
VK_LCONTROL
,
"Ctrl"
},
{
VK_LEFT
|
0x100
,
"Left"
},
{
VK_LMENU
,
"Alt"
},
{
VK_LSHIFT
,
"Shift"
},
{
VK_LWIN
|
0x100
,
"Win"
},
{
VK_MENU
,
"Alt"
},
{
VK_MULTIPLY
,
"Num *"
},
{
VK_NEXT
|
0x100
,
"Page Down"
},
{
VK_NUMLOCK
|
0x100
,
"Num Lock"
},
{
VK_NUMPAD0
,
"Num 0"
},
{
VK_NUMPAD1
,
"Num 1"
},
{
VK_NUMPAD2
,
"Num 2"
},
{
VK_NUMPAD3
,
"Num 3"
},
{
VK_NUMPAD4
,
"Num 4"
},
{
VK_NUMPAD5
,
"Num 5"
},
{
VK_NUMPAD6
,
"Num 6"
},
{
VK_NUMPAD7
,
"Num 7"
},
{
VK_NUMPAD8
,
"Num 8"
},
{
VK_NUMPAD9
,
"Num 9"
},
{
VK_OEM_CLEAR
,
"Num Clear"
},
{
VK_OEM_NEC_EQUAL
|
0x100
,
"Num ="
},
{
VK_PRIOR
|
0x100
,
"Page Up"
},
{
VK_RCONTROL
|
0x100
,
"Right Ctrl"
},
{
VK_RETURN
,
"Return"
},
{
VK_RETURN
|
0x100
,
"Num Enter"
},
{
VK_RIGHT
|
0x100
,
"Right"
},
{
VK_RMENU
|
0x100
,
"Right Alt"
},
{
VK_RSHIFT
,
"Right Shift"
},
{
VK_RWIN
|
0x100
,
"Right Win"
},
{
VK_SEPARATOR
,
"Num ,"
},
{
VK_SHIFT
,
"Shift"
},
{
VK_SPACE
,
"Space"
},
{
VK_SUBTRACT
,
"Num -"
},
{
VK_TAB
,
"Tab"
},
{
VK_UP
|
0x100
,
"Up"
},
{
VK_VOLUME_DOWN
|
0x100
,
"Volume Down"
},
{
VK_VOLUME_MUTE
|
0x100
,
"Mute"
},
{
VK_VOLUME_UP
|
0x100
,
"Volume Up"
},
};
static
BOOL
char_matches_string
(
WCHAR
wchar
,
UniChar
*
string
,
BOOL
ignore_diacritics
)
{
BOOL
ret
;
...
...
@@ -774,6 +856,95 @@ void CDECL macdrv_Beep(void)
/***********************************************************************
* GetKeyNameText (MACDRV.@)
*/
INT
CDECL
macdrv_GetKeyNameText
(
LONG
lparam
,
LPWSTR
buffer
,
INT
size
)
{
struct
macdrv_thread_data
*
thread_data
=
macdrv_init_thread_data
();
int
scan
,
keyc
;
scan
=
(
lparam
>>
16
)
&
0x1FF
;
for
(
keyc
=
0
;
keyc
<
sizeof
(
thread_data
->
keyc2scan
)
/
sizeof
(
thread_data
->
keyc2scan
[
0
]);
keyc
++
)
{
if
(
thread_data
->
keyc2scan
[
keyc
]
==
scan
)
{
static
const
WCHAR
dead
[]
=
{
' '
,
'd'
,
'e'
,
'a'
,
'd'
,
0
};
const
UCKeyboardLayout
*
uchr
;
UInt32
deadKeyState
=
0
;
UniCharCount
len
;
OSStatus
status
;
uchr
=
(
const
UCKeyboardLayout
*
)
CFDataGetBytePtr
(
thread_data
->
keyboard_layout_uchr
);
status
=
UCKeyTranslate
(
uchr
,
keyc
,
kUCKeyActionDisplay
,
0
,
thread_data
->
keyboard_type
,
0
,
&
deadKeyState
,
size
-
1
,
&
len
,
(
UniChar
*
)
buffer
);
if
(
status
!=
noErr
)
len
=
0
;
if
(
len
&&
isgraphW
(
buffer
[
0
]))
buffer
[
len
]
=
0
;
else
{
DWORD
vkey
=
thread_data
->
keyc2vkey
[
keyc
];
int
i
;
if
(
scan
&
0x100
)
vkey
|=
0x100
;
if
(
lparam
&
(
1
<<
25
))
{
/* Caller doesn't care about distinctions between left and
right keys. */
switch
(
vkey
)
{
case
VK_LSHIFT
:
case
VK_RSHIFT
:
vkey
=
VK_SHIFT
;
break
;
case
VK_LCONTROL
:
case
VK_RCONTROL
:
vkey
=
VK_CONTROL
;
break
;
case
VK_LMENU
:
case
VK_RMENU
:
vkey
=
VK_MENU
;
break
;
}
}
len
=
0
;
for
(
i
=
0
;
i
<
sizeof
(
vkey_names
)
/
sizeof
(
vkey_names
[
0
]);
i
++
)
{
if
(
vkey_names
[
i
].
vkey
==
vkey
)
{
len
=
MultiByteToWideChar
(
CP_UTF8
,
0
,
vkey_names
[
i
].
name
,
-
1
,
buffer
,
size
);
if
(
len
)
len
--
;
break
;
}
}
if
(
!
len
)
{
static
const
WCHAR
format
[]
=
{
'K'
,
'e'
,
'y'
,
' '
,
'0'
,
'x'
,
'%'
,
'0'
,
'2'
,
'x'
,
0
};
snprintfW
(
buffer
,
size
,
format
,
vkey
);
len
=
strlenW
(
buffer
);
}
}
if
(
!
len
)
break
;
if
(
status
==
noErr
&&
deadKeyState
)
{
lstrcpynW
(
buffer
+
len
,
dead
,
size
-
len
);
len
=
strlenW
(
buffer
);
}
TRACE
(
"lparam 0x%08x -> %s
\n
"
,
lparam
,
debugstr_w
(
buffer
));
return
len
;
}
}
WARN
(
"found no name for lparam 0x%08x
\n
"
,
lparam
);
return
0
;
}
/***********************************************************************
* MapVirtualKeyEx (MACDRV.@)
*/
UINT
CDECL
macdrv_MapVirtualKeyEx
(
UINT
wCode
,
UINT
wMapType
,
HKL
hkl
)
...
...
dlls/winemac.drv/winemac.drv.spec
View file @
2b4d95cd
...
...
@@ -9,6 +9,7 @@
@ cdecl CreateWindow(long) macdrv_CreateWindow
@ cdecl DestroyWindow(long) macdrv_DestroyWindow
@ cdecl EnumDisplayMonitors(long ptr ptr long) macdrv_EnumDisplayMonitors
@ cdecl GetKeyNameText(long ptr long) macdrv_GetKeyNameText
@ cdecl GetMonitorInfo(long ptr) macdrv_GetMonitorInfo
@ cdecl MapVirtualKeyEx(long long long) macdrv_MapVirtualKeyEx
@ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) macdrv_MsgWaitForMultipleObjectsEx
...
...
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