mirror of https://github.com/PCSX2/pcsx2.git
onepad: Fix my last commit. A few minor changes.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3165 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
d39bdfcd1e
commit
a372eaf2eb
|
@ -23,6 +23,10 @@
|
||||||
#include <gdk/gdkx.h>
|
#include <gdk/gdkx.h>
|
||||||
|
|
||||||
extern string KeyName(int pad, int key);
|
extern string KeyName(int pad, int key);
|
||||||
|
|
||||||
|
void config_key(int pad, int key);
|
||||||
|
void on_conf_key(GtkButton *button, gpointer user_data);
|
||||||
|
|
||||||
int current_pad = 0;
|
int current_pad = 0;
|
||||||
GtkWidget *rev_lx_check, *rev_ly_check, *force_feedback_check, *rev_rx_check, *rev_ry_check;
|
GtkWidget *rev_lx_check, *rev_ly_check, *force_feedback_check, *rev_rx_check, *rev_ry_check;
|
||||||
|
|
||||||
|
@ -136,7 +140,6 @@ class keys_tree
|
||||||
|
|
||||||
void init()
|
void init()
|
||||||
{
|
{
|
||||||
|
|
||||||
treestore = gtk_tree_store_new(NUM_COLS,
|
treestore = gtk_tree_store_new(NUM_COLS,
|
||||||
G_TYPE_STRING,
|
G_TYPE_STRING,
|
||||||
G_TYPE_STRING,
|
G_TYPE_STRING,
|
||||||
|
@ -155,7 +158,6 @@ class keys_tree
|
||||||
|
|
||||||
gtk_tree_selection_set_mode(gtk_tree_view_get_selection(view),
|
gtk_tree_selection_set_mode(gtk_tree_view_get_selection(view),
|
||||||
GTK_SELECTION_SINGLE);
|
GTK_SELECTION_SINGLE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_all()
|
void clear_all()
|
||||||
|
@ -164,7 +166,7 @@ class keys_tree
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove_selected()
|
bool get_selected(int &pad, int &key)
|
||||||
{
|
{
|
||||||
GtkTreeSelection *selection;
|
GtkTreeSelection *selection;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
@ -172,16 +174,27 @@ class keys_tree
|
||||||
selection = gtk_tree_view_get_selection(view);
|
selection = gtk_tree_view_get_selection(view);
|
||||||
if (gtk_tree_selection_get_selected(selection, &model, &iter))
|
if (gtk_tree_selection_get_selected(selection, &model, &iter))
|
||||||
{
|
{
|
||||||
int pad;
|
|
||||||
int key;
|
|
||||||
|
|
||||||
gtk_tree_model_get(model, &iter, COL_PAD_NUM, &pad, COL_VALUE, &key,-1);
|
gtk_tree_model_get(model, &iter, COL_PAD_NUM, &pad, COL_VALUE, &key,-1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void remove_selected()
|
||||||
|
{
|
||||||
|
int key, pad;
|
||||||
|
if (get_selected(pad, key))
|
||||||
|
{
|
||||||
set_key(pad, key, 0);
|
set_key(pad, key, 0);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
void modify_selected()
|
||||||
{
|
{
|
||||||
// Not selected.
|
int key, pad;
|
||||||
|
if (get_selected(pad, key))
|
||||||
|
{
|
||||||
|
config_key(pad,key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -219,8 +232,6 @@ void populate_new_joysticks(GtkComboBox *box)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void on_conf_key(GtkButton *button, gpointer user_data);
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
|
@ -235,18 +246,10 @@ typedef struct
|
||||||
}
|
}
|
||||||
} dialog_buttons;
|
} dialog_buttons;
|
||||||
|
|
||||||
void on_conf_key(GtkButton *button, gpointer user_data)
|
void config_key(int pad, int key)
|
||||||
{
|
{
|
||||||
bool captured = false;
|
bool captured = false;
|
||||||
|
|
||||||
dialog_buttons *btn = (dialog_buttons *)user_data;
|
|
||||||
int id = btn->index;
|
|
||||||
|
|
||||||
if (id == -1) return;
|
|
||||||
|
|
||||||
int pad = current_pad; //id / MAX_KEYS;
|
|
||||||
int key = id; // % MAX_KEYS;
|
|
||||||
|
|
||||||
// save the joystick states
|
// save the joystick states
|
||||||
UpdateJoysticks();
|
UpdateJoysticks();
|
||||||
|
|
||||||
|
@ -320,6 +323,16 @@ void on_conf_key(GtkButton *button, gpointer user_data)
|
||||||
fir->init();
|
fir->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void on_conf_key(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
|
dialog_buttons *btn = (dialog_buttons *)user_data;
|
||||||
|
int key = btn->index;
|
||||||
|
|
||||||
|
if (key == -1) return;
|
||||||
|
|
||||||
|
config_key(current_pad, key);
|
||||||
|
}
|
||||||
|
|
||||||
void on_remove_clicked(GtkButton *button, gpointer user_data)
|
void on_remove_clicked(GtkButton *button, gpointer user_data)
|
||||||
{
|
{
|
||||||
fir->remove_selected();
|
fir->remove_selected();
|
||||||
|
|
|
@ -28,13 +28,6 @@
|
||||||
#include "onepad.h"
|
#include "onepad.h"
|
||||||
#include "linux.h"
|
#include "linux.h"
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#include "interface.h"
|
|
||||||
#include "support.h"
|
|
||||||
#include "callbacks.h"
|
|
||||||
}
|
|
||||||
|
|
||||||
extern std::string s_strIniPath;
|
extern std::string s_strIniPath;
|
||||||
|
|
||||||
string KeyName(int pad, int key)
|
string KeyName(int pad, int key)
|
||||||
|
|
|
@ -28,12 +28,4 @@
|
||||||
#include <gdk/gdkkeysyms.h>
|
#include <gdk/gdkkeysyms.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#include "interface.h"
|
|
||||||
#include "support.h"
|
|
||||||
#include "callbacks.h"
|
|
||||||
}
|
|
||||||
|
|
||||||
extern void DisplayDialog();
|
extern void DisplayDialog();
|
||||||
|
|
Loading…
Reference in New Issue