xfreerdp-server: use libwinpr-input for keyboard mapping
This commit is contained in:
parent
54096f7b9b
commit
9bf924929c
@ -30,6 +30,8 @@ set(${MODULE_PREFIX}_SRCS
|
|||||||
xf_encode.h
|
xf_encode.h
|
||||||
xf_update.c
|
xf_update.c
|
||||||
xf_update.h
|
xf_update.h
|
||||||
|
xf_cursor.c
|
||||||
|
xf_cursor.h
|
||||||
xf_monitors.c
|
xf_monitors.c
|
||||||
xf_monitors.h
|
xf_monitors.h
|
||||||
xf_interface.c
|
xf_interface.c
|
||||||
@ -137,7 +139,7 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
|
|||||||
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
|
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
|
||||||
MONOLITHIC ${MONOLITHIC_BUILD}
|
MONOLITHIC ${MONOLITHIC_BUILD}
|
||||||
MODULE winpr
|
MODULE winpr
|
||||||
MODULES winpr-sspi)
|
MODULES winpr-sspi winpr-crt winpr-utils winpr-input winpr-sysinfo)
|
||||||
|
|
||||||
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr-makecert-tool)
|
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr-makecert-tool)
|
||||||
|
|
||||||
|
35
server/X11/xf_cursor.c
Normal file
35
server/X11/xf_cursor.c
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/**
|
||||||
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||||
|
* X11 Server Cursor
|
||||||
|
*
|
||||||
|
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/Xutil.h>
|
||||||
|
|
||||||
|
#ifdef WITH_XCURSOR
|
||||||
|
#include <X11/Xcursor/Xcursor.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
|
|
||||||
|
#include "xf_cursor.h"
|
||||||
|
|
||||||
|
|
28
server/X11/xf_cursor.h
Normal file
28
server/X11/xf_cursor.h
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||||
|
* X11 Server Cursor
|
||||||
|
*
|
||||||
|
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef XFREERDP_SERVER_CURSOR_H
|
||||||
|
#define XFREERDP_SERVER_CURSOR_H
|
||||||
|
|
||||||
|
#include "xfreerdp.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* XFREERDP_SERVER_CURSOR_H */
|
||||||
|
|
@ -25,6 +25,9 @@
|
|||||||
|
|
||||||
#include <freerdp/locale/keyboard.h>
|
#include <freerdp/locale/keyboard.h>
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
|
#include <winpr/input.h>
|
||||||
|
|
||||||
#include "xf_peer.h"
|
#include "xf_peer.h"
|
||||||
|
|
||||||
#include "xf_input.h"
|
#include "xf_input.h"
|
||||||
@ -37,7 +40,8 @@ void xf_input_synchronize_event(rdpInput* input, UINT32 flags)
|
|||||||
void xf_input_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
void xf_input_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||||
{
|
{
|
||||||
#ifdef WITH_XTEST
|
#ifdef WITH_XTEST
|
||||||
unsigned int keycode;
|
DWORD vkcode;
|
||||||
|
DWORD keycode;
|
||||||
BOOL extended = FALSE;
|
BOOL extended = FALSE;
|
||||||
xfPeerContext* xfp = (xfPeerContext*) input->context;
|
xfPeerContext* xfp = (xfPeerContext*) input->context;
|
||||||
xfInfo* xfi = xfp->info;
|
xfInfo* xfi = xfp->info;
|
||||||
@ -45,7 +49,11 @@ void xf_input_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
|||||||
if (flags & KBD_FLAGS_EXTENDED)
|
if (flags & KBD_FLAGS_EXTENDED)
|
||||||
extended = TRUE;
|
extended = TRUE;
|
||||||
|
|
||||||
keycode = freerdp_keyboard_get_x11_keycode_from_rdp_scancode(code, extended);
|
if (extended)
|
||||||
|
code |= KBDEXT;
|
||||||
|
|
||||||
|
vkcode = GetVirtualKeyCodeFromVirtualScanCode(code, 4);
|
||||||
|
keycode = GetKeycodeFromVirtualKeyCode(vkcode, KEYCODE_TYPE_EVDEV);
|
||||||
|
|
||||||
if (keycode != 0)
|
if (keycode != 0)
|
||||||
{
|
{
|
||||||
|
@ -874,6 +874,7 @@ WINPR_API DWORD GetVirtualScanCodeFromVirtualKeyCode(DWORD vkcode, DWORD dwKeybo
|
|||||||
#define KEYCODE_TYPE_EVDEV 0x00000002
|
#define KEYCODE_TYPE_EVDEV 0x00000002
|
||||||
|
|
||||||
WINPR_API DWORD GetVirtualKeyCodeFromKeycode(DWORD keycode, DWORD dwFlags);
|
WINPR_API DWORD GetVirtualKeyCodeFromKeycode(DWORD keycode, DWORD dwFlags);
|
||||||
|
WINPR_API DWORD GetKeycodeFromVirtualKeyCode(DWORD keycode, DWORD dwFlags);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -584,3 +584,34 @@ DWORD GetVirtualKeyCodeFromKeycode(DWORD keycode, DWORD dwFlags)
|
|||||||
|
|
||||||
return vkcode;
|
return vkcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DWORD GetKeycodeFromVirtualKeyCode(DWORD vkcode, DWORD dwFlags)
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
DWORD keycode = 0;
|
||||||
|
|
||||||
|
if (dwFlags & KEYCODE_TYPE_APPLE)
|
||||||
|
{
|
||||||
|
for (index = 0; index < 256; index++)
|
||||||
|
{
|
||||||
|
if (vkcode == KEYCODE_TO_VKCODE_APPLE[index])
|
||||||
|
{
|
||||||
|
keycode = index;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (dwFlags & KEYCODE_TYPE_EVDEV)
|
||||||
|
{
|
||||||
|
for (index = 0; index < 256; index++)
|
||||||
|
{
|
||||||
|
if (vkcode == KEYCODE_TO_VKCODE_EVDEV[index])
|
||||||
|
{
|
||||||
|
keycode = index;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return keycode;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user