From 64a137829a1d3523c52fd1109db910da6c58a9e6 Mon Sep 17 00:00:00 2001 From: "SND\\dario86_cp" Date: Sat, 22 Feb 2014 16:05:51 +0000 Subject: - bugfix: when controller is connected configuration dialog does not show up with SDL 2.0 on GNU/Linux (issue #11479). - legal: about dialog shows GPLv2 instead of GPLv3. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@89187 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- plugins/dfinput/cfg-gtk.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'plugins/dfinput') diff --git a/plugins/dfinput/cfg-gtk.c b/plugins/dfinput/cfg-gtk.c index 80443f3a..eba56d8a 100755 --- a/plugins/dfinput/cfg-gtk.c +++ b/plugins/dfinput/cfg-gtk.c @@ -608,7 +608,12 @@ static void PopulateDevList() { n = SDL_NumJoysticks(); for (j = 0; j < n; j++) { - sprintf(buf, "%d: %s", j + 1, SDL_JoystickName(j)); + #if SDL_VERSION_ATLEAST(2, 0, 0) + SDL_Joystick *joystick = SDL_JoystickOpen(j); + sprintf(buf, "%d: %s", j + 1, SDL_JoystickName(joystick)); + #else + sprintf(buf, "%d: %s", j + 1, SDL_JoystickName(j)); + #endif gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, buf, -1); } @@ -632,7 +637,7 @@ long PADconfigure() { GtkTreeSelection *treesel; GtkTreeViewColumn *column; GtkCellRenderer *renderer; - + if (SDL_Init(SDL_INIT_JOYSTICK) == -1) { fprintf(stderr, "Failed to initialize SDL!\n"); return -1; @@ -643,7 +648,7 @@ long PADconfigure() { fprintf(stderr, "XOpenDisplay failed!\n"); return -1; } - + LoadPADConfig(); xml = gtk_builder_new(); @@ -652,12 +657,12 @@ long PADconfigure() { g_warning("We could not load the interface!"); return -1; } - + MainWindow = GTK_WIDGET(gtk_builder_get_object(xml, "CfgWnd")); gtk_window_set_title(GTK_WINDOW(MainWindow), _("Gamepad/Keyboard Input Configuration")); widget = GTK_WIDGET(gtk_builder_get_object(xml, widgetname_treeview[1])); // pad 1 - + // column for key renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Key"), @@ -815,13 +820,13 @@ long PADconfigure() { widget = GTK_WIDGET(gtk_builder_get_object(xml, widgetname_combodev[0])); g_signal_connect_data(G_OBJECT(widget), "changed", G_CALLBACK(OnDeviceChanged), GINT_TO_POINTER(-1), NULL, G_CONNECT_AFTER); - + PopulateDevList(); UpdateKeyList(); - + gtk_widget_show(MainWindow); gtk_main(); - + return 0; } -- cgit v1.2.3