mirror of
https://github.com/ValveSoftware/Proton.git
synced 2024-12-27 07:05:46 +03:00
lsteamclient: Convert windows VK to xkeysym
This commit is contained in:
parent
1a2fd5fdbc
commit
5b674f087a
@ -94,11 +94,13 @@ void cppISteamHTMLSurface_STEAMHTMLSURFACE_INTERFACE_VERSION_001_MouseWheel(void
|
||||
|
||||
void cppISteamHTMLSurface_STEAMHTMLSURFACE_INTERFACE_VERSION_001_KeyDown(void *linux_side, HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers)
|
||||
{
|
||||
nNativeKeyCode = manual_convert_nNativeKeyCode(nNativeKeyCode);
|
||||
((ISteamHTMLSurface*)linux_side)->KeyDown((HHTMLBrowser)unBrowserHandle, (uint32)nNativeKeyCode, (ISteamHTMLSurface::EHTMLKeyModifiers)eHTMLKeyModifiers);
|
||||
}
|
||||
|
||||
void cppISteamHTMLSurface_STEAMHTMLSURFACE_INTERFACE_VERSION_001_KeyUp(void *linux_side, HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers)
|
||||
{
|
||||
nNativeKeyCode = manual_convert_nNativeKeyCode(nNativeKeyCode);
|
||||
((ISteamHTMLSurface*)linux_side)->KeyUp((HHTMLBrowser)unBrowserHandle, (uint32)nNativeKeyCode, (ISteamHTMLSurface::EHTMLKeyModifiers)eHTMLKeyModifiers);
|
||||
}
|
||||
|
||||
|
@ -94,11 +94,13 @@ void cppISteamHTMLSurface_STEAMHTMLSURFACE_INTERFACE_VERSION_002_MouseWheel(void
|
||||
|
||||
void cppISteamHTMLSurface_STEAMHTMLSURFACE_INTERFACE_VERSION_002_KeyDown(void *linux_side, HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers)
|
||||
{
|
||||
nNativeKeyCode = manual_convert_nNativeKeyCode(nNativeKeyCode);
|
||||
((ISteamHTMLSurface*)linux_side)->KeyDown((HHTMLBrowser)unBrowserHandle, (uint32)nNativeKeyCode, (ISteamHTMLSurface::EHTMLKeyModifiers)eHTMLKeyModifiers);
|
||||
}
|
||||
|
||||
void cppISteamHTMLSurface_STEAMHTMLSURFACE_INTERFACE_VERSION_002_KeyUp(void *linux_side, HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers)
|
||||
{
|
||||
nNativeKeyCode = manual_convert_nNativeKeyCode(nNativeKeyCode);
|
||||
((ISteamHTMLSurface*)linux_side)->KeyUp((HHTMLBrowser)unBrowserHandle, (uint32)nNativeKeyCode, (ISteamHTMLSurface::EHTMLKeyModifiers)eHTMLKeyModifiers);
|
||||
}
|
||||
|
||||
|
@ -94,11 +94,13 @@ void cppISteamHTMLSurface_STEAMHTMLSURFACE_INTERFACE_VERSION_003_MouseWheel(void
|
||||
|
||||
void cppISteamHTMLSurface_STEAMHTMLSURFACE_INTERFACE_VERSION_003_KeyDown(void *linux_side, HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers)
|
||||
{
|
||||
nNativeKeyCode = manual_convert_nNativeKeyCode(nNativeKeyCode);
|
||||
((ISteamHTMLSurface*)linux_side)->KeyDown((HHTMLBrowser)unBrowserHandle, (uint32)nNativeKeyCode, (ISteamHTMLSurface::EHTMLKeyModifiers)eHTMLKeyModifiers);
|
||||
}
|
||||
|
||||
void cppISteamHTMLSurface_STEAMHTMLSURFACE_INTERFACE_VERSION_003_KeyUp(void *linux_side, HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers)
|
||||
{
|
||||
nNativeKeyCode = manual_convert_nNativeKeyCode(nNativeKeyCode);
|
||||
((ISteamHTMLSurface*)linux_side)->KeyUp((HHTMLBrowser)unBrowserHandle, (uint32)nNativeKeyCode, (ISteamHTMLSurface::EHTMLKeyModifiers)eHTMLKeyModifiers);
|
||||
}
|
||||
|
||||
|
@ -94,11 +94,13 @@ void cppISteamHTMLSurface_STEAMHTMLSURFACE_INTERFACE_VERSION_004_MouseWheel(void
|
||||
|
||||
void cppISteamHTMLSurface_STEAMHTMLSURFACE_INTERFACE_VERSION_004_KeyDown(void *linux_side, HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers)
|
||||
{
|
||||
nNativeKeyCode = manual_convert_nNativeKeyCode(nNativeKeyCode);
|
||||
((ISteamHTMLSurface*)linux_side)->KeyDown((HHTMLBrowser)unBrowserHandle, (uint32)nNativeKeyCode, (ISteamHTMLSurface::EHTMLKeyModifiers)eHTMLKeyModifiers);
|
||||
}
|
||||
|
||||
void cppISteamHTMLSurface_STEAMHTMLSURFACE_INTERFACE_VERSION_004_KeyUp(void *linux_side, HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers)
|
||||
{
|
||||
nNativeKeyCode = manual_convert_nNativeKeyCode(nNativeKeyCode);
|
||||
((ISteamHTMLSurface*)linux_side)->KeyUp((HHTMLBrowser)unBrowserHandle, (uint32)nNativeKeyCode, (ISteamHTMLSurface::EHTMLKeyModifiers)eHTMLKeyModifiers);
|
||||
}
|
||||
|
||||
|
@ -95,11 +95,13 @@ void cppISteamHTMLSurface_STEAMHTMLSURFACE_INTERFACE_VERSION_005_MouseWheel(void
|
||||
|
||||
void cppISteamHTMLSurface_STEAMHTMLSURFACE_INTERFACE_VERSION_005_KeyDown(void *linux_side, HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers, bool bIsSystemKey)
|
||||
{
|
||||
nNativeKeyCode = manual_convert_nNativeKeyCode(nNativeKeyCode);
|
||||
((ISteamHTMLSurface*)linux_side)->KeyDown((HHTMLBrowser)unBrowserHandle, (uint32)nNativeKeyCode, (ISteamHTMLSurface::EHTMLKeyModifiers)eHTMLKeyModifiers, (bool)bIsSystemKey);
|
||||
}
|
||||
|
||||
void cppISteamHTMLSurface_STEAMHTMLSURFACE_INTERFACE_VERSION_005_KeyUp(void *linux_side, HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers)
|
||||
{
|
||||
nNativeKeyCode = manual_convert_nNativeKeyCode(nNativeKeyCode);
|
||||
((ISteamHTMLSurface*)linux_side)->KeyUp((HHTMLBrowser)unBrowserHandle, (uint32)nNativeKeyCode, (ISteamHTMLSurface::EHTMLKeyModifiers)eHTMLKeyModifiers);
|
||||
}
|
||||
|
||||
|
@ -181,6 +181,11 @@ manual_type_converters = [
|
||||
"FSteamNetworkingSocketsDebugOutput"
|
||||
]
|
||||
|
||||
# manual converters for specific parameters
|
||||
manual_param_converters = [
|
||||
"nNativeKeyCode"
|
||||
]
|
||||
|
||||
#struct_conversion_cache = {
|
||||
# '142': {
|
||||
# 'SteamUGCDetails_t': True,
|
||||
@ -540,6 +545,8 @@ def handle_method(cfile, classname, winclassname, cppname, method, cpp, cpp_h, e
|
||||
win_name = typename.replace(real_type.spelling, "win%s_%s" % (real_type.spelling, sdkver))
|
||||
elif real_type.spelling in manual_type_converters:
|
||||
manual_convert.append(param)
|
||||
elif param.spelling in manual_param_converters:
|
||||
manual_convert.append(param)
|
||||
|
||||
if param.spelling == "":
|
||||
cfile.write(", %s _%s" % (win_name, unnamed))
|
||||
@ -587,7 +594,10 @@ def handle_method(cfile, classname, winclassname, cppname, method, cpp, cpp_h, e
|
||||
cpp.write(" %s lin_%s;\n" % (param.type.spelling, param.spelling))
|
||||
cpp.write(" win_to_lin_struct_%s_%s(&%s, &lin_%s);\n" % (param.type.spelling, sdkver, param.spelling, param.spelling))
|
||||
for param in manual_convert:
|
||||
cpp.write(" %s = (%s)manual_convert_%s((void*)%s);\n" % (param.spelling, param.type.spelling, param.type.spelling, param.spelling))
|
||||
if param.spelling in manual_param_converters:
|
||||
cpp.write(" %s = manual_convert_%s(%s);\n" % (param.spelling, param.spelling, param.spelling))
|
||||
else:
|
||||
cpp.write(" %s = (%s)manual_convert_%s((void*)%s);\n" % (param.spelling, param.type.spelling, param.type.spelling, param.spelling))
|
||||
|
||||
cfile.write(" TRACE(\"%p\\n\", _this);\n")
|
||||
|
||||
|
@ -12,6 +12,10 @@
|
||||
#include "wine/library.h"
|
||||
#include "steam_defs.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#include <X11/keysym.h>
|
||||
#endif
|
||||
|
||||
#include "steamclient_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(steamclient);
|
||||
@ -173,6 +177,145 @@ const char *steamclient_isteamcontroller_getglyph(int origin, const char *lin_pa
|
||||
return controller_glyphs[origin];
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
static const uint32 vk_to_xkeysym[0xFF] = {
|
||||
0, /* 0x0 Undefined */
|
||||
0, /* VK_LBUTTON */
|
||||
0, /* VK_RBUTTON */
|
||||
XK_Cancel, /* VK_CANCEL */
|
||||
0, /* VK_MBUTTON */
|
||||
0, /* VK_XBUTTON1 */
|
||||
0, /* VK_XBUTTON2 */
|
||||
0, /* 0x07 Undefined */
|
||||
XK_BackSpace, /* VK_BACK */
|
||||
XK_Tab, /* VK_TAB */
|
||||
0, /* 0x0A-0x0B Undefined */
|
||||
0,
|
||||
XK_Clear, /* VK_CLEAR */
|
||||
XK_Return, /* VK_RETURN */
|
||||
0, /* 0x0E-0x0F Undefined */
|
||||
0,
|
||||
XK_Shift_L, /* VK_SHIFT */
|
||||
XK_Control_L, /* VK_CONTROL */
|
||||
XK_Alt_L, /* VK_MENU */
|
||||
XK_Pause, /* VK_PAUSE */
|
||||
XK_Caps_Lock, /* VK_CAPITAL */
|
||||
0, /* VK_KANA */
|
||||
0, /* 0x16 Undefined */
|
||||
0, /* VK_JUNJA */
|
||||
0, /* VK_FINAL */
|
||||
0, /* VK_HANJA */
|
||||
0, /* 0x1A Undefined */
|
||||
XK_Escape, /* VK_ESCAPE */
|
||||
XK_Henkan_Mode, /* VK_CONVERT */
|
||||
XK_Muhenkan, /* VK_NONCONVERT */
|
||||
0, /* VK_ACCEPT */
|
||||
0, /* VK_MODECHANGE */
|
||||
' ', /* VK_SPACE */
|
||||
XK_Prior, /* VK_PRIOR */
|
||||
XK_Next, /* VK_NEXT */
|
||||
XK_End, /* VK_END */
|
||||
XK_Home, /* VK_HOME */
|
||||
XK_Left, /* VK_LEFT */
|
||||
XK_Up, /* VK_UP */
|
||||
XK_Right, /* VK_RIGHT */
|
||||
XK_Down, /* VK_DOWN */
|
||||
XK_Select, /* VK_SELECT */
|
||||
XK_Print, /* VK_PRINT */
|
||||
XK_Execute, /* VK_EXECUTE */
|
||||
XK_Print, /* VK_SNAPSHOT */
|
||||
XK_Insert, /* VK_INSERT */
|
||||
XK_Delete, /* VK_DELETE */
|
||||
XK_Help, /* VK_HELP */
|
||||
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
0, 0, 0, 0, 0, 0, 0, /* 0x3A-0x40 Undefined */
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
|
||||
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
|
||||
'U', 'V', 'W', 'X', 'Y', 'Z',
|
||||
|
||||
XK_Super_L, /* VK_LWIN */
|
||||
XK_Super_R, /* VK_RWIN */
|
||||
XK_Menu, /* VK_APPS */
|
||||
0, /* 0x5E Unassigned */
|
||||
0, /* VK_SLEEP */
|
||||
XK_KP_0, /* VK_NUMPAD0 */
|
||||
XK_KP_1, /* VK_NUMPAD1 */
|
||||
XK_KP_2, /* VK_NUMPAD2 */
|
||||
XK_KP_3, /* VK_NUMPAD3 */
|
||||
XK_KP_4, /* VK_NUMPAD4 */
|
||||
XK_KP_5, /* VK_NUMPAD5 */
|
||||
XK_KP_6, /* VK_NUMPAD6 */
|
||||
XK_KP_7, /* VK_NUMPAD7 */
|
||||
XK_KP_8, /* VK_NUMPAD8 */
|
||||
XK_KP_9, /* VK_NUMPAD9 */
|
||||
XK_KP_Multiply, /* VK_MULTIPLY */
|
||||
XK_KP_Add, /* VK_ADD */
|
||||
XK_KP_Separator, /* VK_SEPARATOR */
|
||||
XK_KP_Subtract, /* VK_SUBTRACT */
|
||||
XK_KP_Decimal, /* VK_DECIMAL */
|
||||
XK_KP_Divide, /* VK_DIVIDE */
|
||||
XK_F1, /* VK_F1 */
|
||||
XK_F2, /* VK_F2 */
|
||||
XK_F3, /* VK_F3 */
|
||||
XK_F4, /* VK_F4 */
|
||||
XK_F5, /* VK_F5 */
|
||||
XK_F6, /* VK_F6 */
|
||||
XK_F7, /* VK_F7 */
|
||||
XK_F8, /* VK_F8 */
|
||||
XK_F9, /* VK_F9 */
|
||||
XK_F10, /* VK_F10 */
|
||||
XK_F11, /* VK_F11 */
|
||||
XK_F12, /* VK_F12 */
|
||||
XK_F13, /* VK_F13 */
|
||||
XK_F14, /* VK_F14 */
|
||||
XK_F15, /* VK_F15 */
|
||||
XK_F16, /* VK_F16 */
|
||||
XK_F17, /* VK_F17 */
|
||||
XK_F18, /* VK_F18 */
|
||||
XK_F19, /* VK_F19 */
|
||||
XK_F20, /* VK_F20 */
|
||||
XK_F21, /* VK_F21 */
|
||||
XK_F22, /* VK_F22 */
|
||||
XK_F23, /* VK_F23 */
|
||||
XK_F24, /* VK_F24 */
|
||||
0, /* VK_NAVIGATION_VIEW */
|
||||
0, /* VK_NAVIGATION_MENU */
|
||||
0, /* VK_NAVIGATION_UP */
|
||||
0, /* VK_NAVIGATION_DOWN */
|
||||
0, /* VK_NAVIGATION_LEFT */
|
||||
0, /* VK_NAVIGATION_RIGHT */
|
||||
0, /* VK_NAVIGATION_ACCEPT */
|
||||
0, /* VK_NAVIGATION_CANCEL */
|
||||
XK_Num_Lock, /* VK_NUMLOCK */
|
||||
XK_Scroll_Lock, /* VK_SCROLL */
|
||||
XK_KP_Equal, /* VK_OEM_NEC_EQUAL */
|
||||
0, /* VK_OEM_FJ_JISHO */
|
||||
0, /* VK_OEM_FJ_MASSHOU */
|
||||
0, /* VK_OEM_FJ_TOUROKU */
|
||||
0, /* VK_OEM_FJ_LOYA */
|
||||
0, /* VK_OEM_FJ_ROYA */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x97-0x9F Unassigned */
|
||||
XK_Shift_L, /* VK_LSHIFT */
|
||||
XK_Shift_R, /* VK_RSHIFT */
|
||||
XK_Control_L, /* VK_LCONTROL */
|
||||
XK_Control_R, /* VK_RCONTROL */
|
||||
XK_Alt_L, /* VK_LMENU */
|
||||
XK_Alt_R, /* VK_RMENU */
|
||||
|
||||
/* below are OEM, browser keys, etc */
|
||||
};
|
||||
|
||||
uint32 manual_convert_nNativeKeyCode(uint32 win_vk)
|
||||
{
|
||||
if(win_vk < sizeof(vk_to_xkeysym) / sizeof(*vk_to_xkeysym))
|
||||
return vk_to_xkeysym[win_vk];
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#error You must implement VK<->Native keysym conversion for this platform.
|
||||
#endif
|
||||
|
||||
#include "win_constructors.h"
|
||||
|
||||
static const struct {
|
||||
|
@ -42,6 +42,7 @@ bool steamclient_dos_path_to_unix_path(const char *src, char *dst);
|
||||
const char **steamclient_dos_to_unix_stringlist(const char **src);
|
||||
void steamclient_free_stringlist(const char **out);
|
||||
const char *steamclient_isteamcontroller_getglyph(int origin, const char *lin_path);
|
||||
uint32 manual_convert_nNativeKeyCode(uint32 win_vk);
|
||||
void *create_LinuxISteamMatchmakingServerListResponse(void *win, const char *version);
|
||||
void *create_LinuxISteamMatchmakingPingResponse(void *win, const char *version);
|
||||
void *create_LinuxISteamMatchmakingPlayersResponse(void *win, const char *version);
|
||||
|
Loading…
Reference in New Issue
Block a user