--- previous/src/control.c 2018/04/24 19:25:10 1.1.1.1 +++ previous/src/control.c 2018/04/24 19:31:11 1.1.1.4 @@ -27,6 +27,7 @@ const char Control_fileid[] = "Hatari co #include "debugui.h" #include "file.h" #include "log.h" +#include "screen.h" #include "shortcut.h" #include "str.h" @@ -54,17 +55,16 @@ static bool bRemotePaused; static bool Control_InsertKey(const char *event) { const char *key = NULL; - bool press; if (strncmp(event, "keypress ", 9) == 0) { key = &event[9]; - press = true; - } else if (strncmp(event, "keyrelease ", 11) == 0) { - key = &event[11]; - press = false; + } else if (strncmp(event, "keydown ", 8) == 0) { + key = &event[8]; + } else if (strncmp(event, "keyup ", 6) == 0) { + key = &event[6]; } if (!(key && key[0])) { - fprintf(stderr, "ERROR: event '%s' contains no key press/release\n", event); + fprintf(stderr, "ERROR: '%s' contains no key press/down/up event\n", event); return false; } if (key[1]) { @@ -73,16 +73,15 @@ static bool Control_InsertKey(const char int keycode = strtol(key, &endptr, 0); /* not a valid number or keycode is out of range? */ if (*endptr || keycode < 0 || keycode > 255) { - fprintf(stderr, "ERROR: '%s' is not valid key code, got %d\n", + fprintf(stderr, "ERROR: '%s' is not valid key scancode, got %d\n", key, keycode); return false; } -// IKBD_PressSTKey(keycode, press); - } else { -// Keymap_SimulateCharacter(key[0], press); - } - fprintf(stderr, "Simulated %s key %s\n", - key, (press?"press":"release")); + } +#if 0 + fprintf(stderr, "Simulated key %s of %d\n", + (down? (up? "press":"down") :"up"), key); +#endif return true; } @@ -101,11 +100,11 @@ static bool Control_InsertEvent(const ch // Keyboard.LButtonDblClk = 1; return true; } - if (strcmp(event, "rightpress") == 0) { + if (strcmp(event, "rightdown") == 0) { // Keyboard.bRButtonDown |= BUTTON_MOUSE; return true; } - if (strcmp(event, "rightrelease") == 0) { + if (strcmp(event, "rightup") == 0) { // Keyboard.bRButtonDown &= ~BUTTON_MOUSE; return true; } @@ -113,13 +112,17 @@ static bool Control_InsertEvent(const ch return true; } fprintf(stderr, "ERROR: unrecognized event: '%s'\n", event); - fprintf(stderr, "Supported events are:\n"); - fprintf(stderr, "- doubleclick\n"); - fprintf(stderr, "- rightpress\n"); - fprintf(stderr, "- rightrelease\n"); - fprintf(stderr, "- keypress \n"); - fprintf(stderr, "- keyrelease \n"); - fprintf(stderr, " can be either a single ASCII char or keycode.\n"); + fprintf(stderr, + "Supported mouse button and key events are:\n" + "- doubleclick\n" + "- rightdown\n" + "- rightup\n" + "- keypress \n" + "- keydown \n" + "- keyup \n" + " can be either a single ASCII character or an ST scancode\n" + "(e.g. space has scancode of 57 and enter 28).\n" + ); return false; } @@ -140,6 +143,9 @@ static bool Control_DeviceAction(const c void(*init)(void); void(*uninit)(void); } item[] = { +// { "printer", &ConfigureParams.Printer.bEnablePrinting, Printer_Init, Printer_UnInit }, +// { "rs232", &ConfigureParams.RS232.bEnableRS232, RS232_Init, RS232_UnInit }, +// { "midi", &ConfigureParams.Midi.bEnableMidi, Midi_Init, Midi_UnInit }, { NULL, NULL, NULL, NULL } }; int i; @@ -190,8 +196,6 @@ static bool Control_SetPath(char *name) const char *name; char *path; } item[] = { - { "memauto", ConfigureParams.Memory.szAutoSaveFileName }, - { "memsave", ConfigureParams.Memory.szMemoryCaptureFileName }, { NULL, NULL } }; int i; @@ -469,6 +473,7 @@ const char *Control_SetSocket(const char */ void Control_ReparentWindow(int width, int height, bool noembed) { +#if 0 Display *display; Window parent_win, sdl_win, wm_win; const char *parent_win_id; @@ -485,7 +490,7 @@ void Control_ReparentWindow(int width, i } SDL_VERSION(&info.version); - if (!SDL_GetWMInfo(&info)) { + if (!SDL_GetWindowWMInfo(sdlWindow, &info)) { Log_Printf(LOG_WARN, "Failed to get SDL_GetWMInfo()\n"); return; } @@ -514,6 +519,9 @@ void Control_ReparentWindow(int width, i } } info.info.x11.unlock_func(); +#else + fprintf(stderr, "FIXME: Port Control_ReparentWindow to SDL2\n"); +#endif } /** @@ -523,7 +531,7 @@ static int Control_GetUISocket(void) { SDL_SysWMinfo info; SDL_VERSION(&info.version); - if (!SDL_GetWMInfo(&info)) { + if (!SDL_GetWindowWMInfo(sdlWindow, &info)) { Log_Printf(LOG_WARN, "Failed to get SDL_GetWMInfo()\n"); return 0; }