void SetupInput() { for (int port=0;port<4;port++) { kcode[port]=0xFFFF; rt[port]=0; lt[port]=0; } #if HOST_OS != OS_DARWIN if (true) { #ifdef TARGET_PANDORA const char* device = "/dev/input/event4"; #else const char* device = "/dev/event2"; #endif char name[256]= "Unknown"; if ((kbfd = open(device, O_RDONLY)) > 0) { fcntl(kbfd,F_SETFL,O_NONBLOCK); if(ioctl(kbfd, EVIOCGNAME(sizeof(name)), name) < 0) { perror("evdev ioctl"); } printf("The device on %s says its name is %s\n",device, name); } else perror("evdev open"); } #endif #if HOST_OS != OS_DARWIN #if defined(SUPPORT_X11) && !defined(TARGET_PANDORA) for (int port=0;port<4;port++) { // Setup the dreamcast controllers setup_dc_controller(dc_pads[port]); // Load keyboard mappings load_keyboard_map(kb_maps[port], config_section_names_keyboard[port]); } #endif // Open joystick devices load_joystick(js[0], "/dev/input/js0"); load_joystick(js[1], "/dev/input/js1"); load_joystick(js[2], "/dev/input/js2"); load_joystick(js[3], "/dev/input/js3"); // Load joystick mappings for (int port=0;port<4;port++) { load_joystick_map(js_maps[port], config_section_names_keyboard[port]); } #endif }
unsigned int freerdp_kbd_init(unsigned int keyboard_layout_id) { char xkbfile[256]; keyboard_layout_id = detect_keyboard(keyboard_layout_id, xkbfile, sizeof(xkbfile)); printf("Using keyboard layout 0x%X with xkb name %s and xkbfile %s\n", keyboard_layout_id, get_layout_name(keyboard_layout_id), xkbfile); load_keyboard_map(xkbfile); return keyboard_layout_id; }
unsigned int freerdp_kbd_init(void* dpy, unsigned int keyboard_layout_id) { memset(x_keycode_to_rdp_scancode, 0, sizeof(x_keycode_to_rdp_scancode)); memset(rdp_scancode_to_x_keycode, '\0', sizeof(rdp_scancode_to_x_keycode)); #ifdef WITH_XKBFILE if (!init_xkb(dpy)) { DEBUG_KBD("Error initializing xkb"); return 0; } if (keyboard_layout_id == 0) { keyboard_layout_id = detect_keyboard_layout_from_xkb(dpy); DEBUG_KBD("detect_keyboard_layout_from_xkb: %X", keyboard_layout_id); } init_keycodes_from_xkb(dpy, x_keycode_to_rdp_scancode, rdp_scancode_to_x_keycode); #else int vkcode; int keycode; char xkbfile[256]; KeycodeToVkcode keycodeToVkcode; if (keyboard_layout_id == 0) keyboard_layout_id = detect_keyboard(dpy, keyboard_layout_id, xkbfile, sizeof(xkbfile)); DEBUG_KBD("Using keyboard layout 0x%X with xkb name %s and xkbfile %s", keyboard_layout_id, get_layout_name(keyboard_layout_id), xkbfile); load_keyboard_map(keycodeToVkcode, xkbfile); for (keycode = 0; keycode < 256; keycode++) { vkcode = keycodeToVkcode[keycode]; DEBUG_KBD("X keycode %3d VK %3d %-19s-> RDP scancode %d/%d", keycode, vkcode, virtualKeyboard[vkcode].name, virtualKeyboard[vkcode].extended, virtualKeyboard[vkcode].scancode); x_keycode_to_rdp_scancode[keycode].keycode = virtualKeyboard[vkcode].scancode; x_keycode_to_rdp_scancode[keycode].extended = virtualKeyboard[vkcode].extended; x_keycode_to_rdp_scancode[keycode].keyname = virtualKeyboard[vkcode].name; if (x_keycode_to_rdp_scancode[keycode].extended) rdp_scancode_to_x_keycode[virtualKeyboard[vkcode].scancode][1] = keycode; else rdp_scancode_to_x_keycode[virtualKeyboard[vkcode].scancode][0] = keycode; } #endif return keyboard_layout_id; }