diff --git a/src/osd/sdl/draw13.c b/src/osd/sdl/draw13.c index 71129e0cdc0..aa20f9ca2a6 100644 --- a/src/osd/sdl/draw13.c +++ b/src/osd/sdl/draw13.c @@ -577,12 +577,10 @@ static int draw13_window_create(sdl_window_info *window, int width, int height) SDL_WINDOW_BORDERLESS | SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_FULLSCREEN : SDL_WINDOW_RESIZABLE); // create the SDL window - SDL_SelectVideoDisplay(window->monitor->handle); - if (window->fullscreen && video_config.switchres) { SDL_DisplayMode mode; - SDL_GetCurrentDisplayMode(&mode); + SDL_GetCurrentDisplayMode(window->monitor->handle, &mode); mode.w = width; mode.h = height; if (window->refresh) @@ -612,7 +610,7 @@ static int draw13_window_create(sdl_window_info *window, int width, int height) else SDL_SetWindowDisplayMode(window->sdl_window, NULL); // Use desktop - window->sdl_window = SDL_CreateWindow(window->title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, + window->sdl_window = SDL_CreateWindow(window->title, SDL_WINDOWPOS_UNDEFINED_DISPLAY(window->monitor->handle), SDL_WINDOWPOS_UNDEFINED, width, height, sdl->extra_flags); // create renderer diff --git a/src/osd/sdl/drawogl.c b/src/osd/sdl/drawogl.c index 78a5b45c882..ecadb7b58b5 100644 --- a/src/osd/sdl/drawogl.c +++ b/src/osd/sdl/drawogl.c @@ -556,12 +556,11 @@ static int drawogl_window_create(sdl_window_info *window, int width, int height) //load_gl_lib(*window->machine); // create the SDL window - SDL_SelectVideoDisplay(window->monitor->handle); if (window->fullscreen && video_config.switchres) { SDL_DisplayMode mode; - SDL_GetCurrentDisplayMode(&mode); + SDL_GetCurrentDisplayMode(window->monitor->handle, &mode); mode.w = width; mode.h = height; if (window->refresh) @@ -571,7 +570,7 @@ static int drawogl_window_create(sdl_window_info *window, int width, int height) else SDL_SetWindowDisplayMode(window->sdl_window, NULL); // Use desktop - window->sdl_window = SDL_CreateWindow(window->title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, + window->sdl_window = SDL_CreateWindow(window->title, SDL_WINDOWPOS_UNDEFINED_DISPLAY(window->monitor->handle), SDL_WINDOWPOS_UNDEFINED, width, height, sdl->extra_flags); if (!window->sdl_window ) diff --git a/src/osd/sdl/drawsdl.c b/src/osd/sdl/drawsdl.c index 28694a000a6..3b32489a4ed 100644 --- a/src/osd/sdl/drawsdl.c +++ b/src/osd/sdl/drawsdl.c @@ -263,7 +263,7 @@ static void setup_texture(sdl_window_info *window, int tempwidth, int tempheight UINT32 fmt; // Determine preferred pixelformat and set up yuv if necessary - SDL_GetCurrentDisplayMode(&mode); + SDL_GetCurrentDisplayMode(window->monitor->handle, &mode); if (sdl->yuv_bitmap) { @@ -414,12 +414,10 @@ static int drawsdl_window_create(sdl_window_info *window, int width, int height) SDL_WINDOW_BORDERLESS | SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_MOUSE_FOCUS | SDL_WINDOW_INPUT_GRABBED : SDL_WINDOW_RESIZABLE); - SDL_SelectVideoDisplay(window->monitor->handle); - if (window->fullscreen && video_config.switchres) { SDL_DisplayMode mode; - SDL_GetCurrentDisplayMode(&mode); + SDL_GetCurrentDisplayMode(window->monitor->handle, &mode); mode.w = width; mode.h = height; if (window->refresh) @@ -433,13 +431,13 @@ static int drawsdl_window_create(sdl_window_info *window, int width, int height) width, height, sdl->extra_flags); SDL_ShowWindow(window->sdl_window); - SDL_SetWindowFullscreen(window->sdl_window, window->fullscreen); + SDL_SetWindowFullscreen(window->sdl_window, (SDL_bool) window->fullscreen); SDL_GetWindowSize(window->sdl_window, &window->width, &window->height); SDL_RaiseWindow(window->sdl_window); /* FIXME: Bug in SDL 1.3 */ if (window->fullscreen) - SDL_SetWindowGrab(window->sdl_window, 1); + SDL_SetWindowGrab(window->sdl_window, SDL_TRUE); // create a texture diff --git a/src/osd/sdl/input.c b/src/osd/sdl/input.c index 6141c120bf1..194961b61ad 100644 --- a/src/osd/sdl/input.c +++ b/src/osd/sdl/input.c @@ -642,7 +642,7 @@ static void devmap_init(running_machine *machine, device_map_t *devmap, const ch if (dev_name && *dev_name && strcmp(dev_name,SDLOPTVAL_AUTO)) { devmap->map[dev].name = remove_spaces(machine, dev_name); - mame_printf_verbose("%s: Logical id %d: %s\n", label, dev + 1, joy_map.map[dev].name); + mame_printf_verbose("%s: Logical id %d: %s\n", label, dev + 1, devmap->map[dev].name); devmap->initialized = 1; } } @@ -1002,7 +1002,7 @@ static kt_table * sdlinput_read_keymap(running_machine *machine) // sdlinput_register_keyboards //============================================================ -#if (!SDL13_POST_HG4464 && SDL_VERSION_ATLEAST(1,3,0)) +#if ((1 ||!SDL13_POST_HG4464) && SDL_VERSION_ATLEAST(1,3,0)) static void sdlinput_register_keyboards(running_machine *machine) { int physical_keyboard; @@ -1015,8 +1015,9 @@ static void sdlinput_register_keyboards(running_machine *machine) for (physical_keyboard = 0; physical_keyboard < SDL_GetNumKeyboards(); physical_keyboard++) { - char defname[90]; - snprintf(defname, sizeof(defname)-1, "Keyboard #%d", physical_keyboard + 1); + //char defname[90]; + //snprintf(defname, sizeof(defname)-1, "Keyboard #%d", physical_keyboard + 1); + char *defname = remove_spaces(machine, SDL_GetKeyboardName(SDL_GetKeyboard(physical_keyboard) )); devmap_register(&keyboard_map, physical_keyboard, defname); } @@ -1081,7 +1082,7 @@ static void sdlinput_register_keyboards(running_machine *machine) snprintf(defname, sizeof(defname)-1, "%s", key_trans_table[keynum].ui_name); // add the item to the device -// printf("Keynum %d => sdl key %d\n", keynum, OSD_SDL_INDEX(key_trans_table[keynum].sdl_key)); +// printf("Keynum %d => sdl key %d\n", keynum, OSD_SDL_INDEX(key_trans_table[keynum].sdl_key)); input_device_item_add(devinfo->device, defname, &devinfo->keyboard.state[OSD_SDL_INDEX(key_trans_table[keynum].sdl_key)], itemid, generic_button_get_state); } @@ -1306,7 +1307,7 @@ void sdlinput_poll(running_machine *machine) switch(event.type) { case SDL_KEYDOWN: devinfo = generic_device_find_index( keyboard_list, keyboard_map.logical[event.key.which]); -// printf("Key down %d %d %s => %d %s (scrlock keycode is %d)\n", event.key.which, event.key.keysym.scancode, devinfo->name, OSD_SDL_INDEX_KEYSYM(&event.key.keysym), sdl_key_trans_table[event.key.keysym.scancode].mame_key_name, KEYCODE_SCRLOCK); + //printf("Key down %d %d %s => %d %s (scrlock keycode is %d)\n", event.key.which, event.key.keysym.scancode, devinfo->name, OSD_SDL_INDEX_KEYSYM(&event.key.keysym), sdl_key_trans_table[event.key.keysym.scancode].mame_key_name, KEYCODE_SCRLOCK); devinfo->keyboard.state[OSD_SDL_INDEX_KEYSYM(&event.key.keysym)] = 0x80; #if (!SDL_VERSION_ATLEAST(1,3,0)) ui_input_push_char_event(machine, sdl_window_list->target, (unicode_char) event.key.keysym.unicode); diff --git a/src/osd/sdl/sdlmain.c b/src/osd/sdl/sdlmain.c index 4b974535f29..afddf9b71af 100644 --- a/src/osd/sdl/sdlmain.c +++ b/src/osd/sdl/sdlmain.c @@ -490,7 +490,7 @@ static void defines_verbose(void) static void osd_sdl_info(void) { #if SDL_VERSION_ATLEAST(1,3,0) - int i, cur, num = SDL_GetNumVideoDrivers(); + int i, num = SDL_GetNumVideoDrivers(); mame_printf_verbose("Available videodrivers: "); for (i=0;i 0); // first up, try it as a filename - font = TTF_OpenFont(name.cstr(), POINT_SIZE); + font = TTF_OpenFont_Magic(name, POINT_SIZE); // if no success, try the font path @@ -967,7 +984,7 @@ osd_font sdl_osd_interface::font_open(const char *_name, int &height) if (file.open(name) == FILERR_NONE) { astring full_name = file.fullpath(); - font = TTF_OpenFont(full_name.cstr(), POINT_SIZE); + font = TTF_OpenFont_Magic(full_name, POINT_SIZE); if (font) mame_printf_verbose("Found font %s\n", full_name.cstr()); } diff --git a/src/osd/sdl/video.c b/src/osd/sdl/video.c index 07c1e395bc9..c3f2877857b 100644 --- a/src/osd/sdl/video.c +++ b/src/osd/sdl/video.c @@ -166,8 +166,7 @@ void sdlvideo_monitor_refresh(sdl_monitor_info *monitor) #if (SDL_VERSION_ATLEAST(1,3,0)) SDL_DisplayMode dmode; - SDL_SelectVideoDisplay(monitor->handle); - SDL_GetDesktopDisplayMode(&dmode); + SDL_GetDesktopDisplayMode(monitor->handle, &dmode); monitor->monitor_width = dmode.w; monitor->monitor_height = dmode.h; monitor->center_width = dmode.w; @@ -448,10 +447,9 @@ static void init_monitors(void) #if (SDL_VERSION_ATLEAST(1,3,0)) { - int i, temp; + int i; mame_printf_verbose("Enter init_monitors\n"); - temp = SDL_GetCurrentVideoDisplay(); for (i = 0; i < SDL_GetNumVideoDisplays(); i++) { @@ -463,8 +461,7 @@ static void init_monitors(void) snprintf(monitor->monitor_device, sizeof(monitor->monitor_device)-1, "%s%d", SDLOPTION_SCREEN,i); - SDL_SelectVideoDisplay(i); - SDL_GetDesktopDisplayMode(&dmode); + SDL_GetDesktopDisplayMode(i, &dmode); monitor->monitor_width = dmode.w; monitor->monitor_height = dmode.h; monitor->center_width = dmode.w; @@ -482,7 +479,6 @@ static void init_monitors(void) *tailptr = monitor; tailptr = &monitor->next; } - SDL_SelectVideoDisplay(temp); } mame_printf_verbose("Leave init_monitors\n"); #elif defined(SDLMAME_WIN32) diff --git a/src/osd/sdl/window.c b/src/osd/sdl/window.c index 6998e75c637..63aff122574 100644 --- a/src/osd/sdl/window.c +++ b/src/osd/sdl/window.c @@ -606,13 +606,13 @@ static void sdlwindow_update_cursor_state(running_machine *machine, sdl_window_i { SDL_ShowCursor(SDL_ENABLE); if (SDL_GetWindowGrab(window->sdl_window )) - SDL_SetWindowGrab(window->sdl_window, 0); + SDL_SetWindowGrab(window->sdl_window, SDL_FALSE); } else { SDL_ShowCursor(SDL_DISABLE); if (!SDL_GetWindowGrab(window->sdl_window)) - SDL_SetWindowGrab(window->sdl_window, 1); + SDL_SetWindowGrab(window->sdl_window, SDL_TRUE); } SDL_SetCursor(NULL); // Force an update in case the underlying driver has changed visibility } @@ -818,7 +818,7 @@ static void pick_best_mode(sdl_window_info *window, int *fswidth, int *fsheight) minimum_height -= 4; } - num = SDL_GetNumDisplayModes(); + num = SDL_GetNumDisplayModes(window->monitor->handle); if (num == 0) { @@ -830,7 +830,7 @@ static void pick_best_mode(sdl_window_info *window, int *fswidth, int *fsheight) for (i = 0; i < num; ++i) { SDL_DisplayMode mode; - SDL_GetDisplayMode(i, &mode); + SDL_GetDisplayMode(window->monitor->handle, i, &mode); // compute initial score based on difference between target and current size_score = 1.0f / (1.0f + fabsf((INT32)mode.w - target_width) + fabsf((INT32)mode.h - target_height));