summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorSND\edgbla_cp <SND\edgbla_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2012-10-18 19:03:26 +0000
committerSND\edgbla_cp <SND\edgbla_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2012-10-18 19:03:26 +0000
commit16d2de352db837b4e5f4e1f6c6025dcd12a3e4f6 (patch)
treefa99f80e685c3e411f6a76577499c0c064f855ab /plugins
parent0b1e3f1d1f4e07b55aa31f0de3ecf2533e359200 (diff)
downloadpcsxr-16d2de352db837b4e5f4e1f6c6025dcd12a3e4f6.tar.gz
Issue 7770;
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@80600 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'plugins')
-rw-r--r--plugins/dfinput/cfg-gtk2.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/plugins/dfinput/cfg-gtk2.c b/plugins/dfinput/cfg-gtk2.c
index aff5de65..109fd072 100644
--- a/plugins/dfinput/cfg-gtk2.c
+++ b/plugins/dfinput/cfg-gtk2.c
@@ -259,6 +259,7 @@ static void OnConfigExit(GtkWidget *widget, gpointer user_data) {
gtk_widget_destroy(widget);
SDL_Quit();
+ XCloseDisplay(g.Disp);
gtk_exit(0);
}
@@ -340,6 +341,8 @@ static void ReadDKeyEvent(int padnum, int key) {
GdkEvent *ge;
int i;
Sint16 axis, numAxes = 0, InitAxisPos[256], PrevAxisPos[256];
+ unsigned char buttons[32];
+ uint16_t Key;
if (g.cfg.PadDef[padnum].DevNum >= 0) {
js = SDL_JoystickOpen(g.cfg.PadDef[padnum].DevNum);
@@ -403,15 +406,15 @@ static void ReadDKeyEvent(int padnum, int key) {
}
// check keyboard events
- while ((ge = gdk_event_get()) != NULL) {
- if (ge->type == GDK_KEY_PRESS) {
- if (ge->key.keyval != XK_Escape) {
- g.cfg.PadDef[padnum].KeyDef[key].Key = ge->key.keyval;
+ XQueryKeymap(g.Disp, buttons);
+ for (i = 0; i < 256; ++i) {
+ if(buttons[i >> 3] & (1 << (i & 7))) {
+ Key = XkbKeycodeToKeysym(g.Disp, i, 0, 0);
+ if(Key != XK_Escape) {
+ g.cfg.PadDef[padnum].KeyDef[key].Key = Key;
}
- gdk_event_free(ge);
goto end;
}
- gdk_event_free(ge);
}
usleep(5000);
@@ -429,6 +432,8 @@ static void ReadAnalogEvent(int padnum, int analognum, int analogdir) {
GdkEvent *ge;
int i;
Sint16 axis, numAxes = 0, InitAxisPos[256], PrevAxisPos[256];
+ unsigned char buttons[32];
+ uint16_t Key;
if (g.cfg.PadDef[padnum].DevNum >= 0) {
js = SDL_JoystickOpen(g.cfg.PadDef[padnum].DevNum);
@@ -492,15 +497,15 @@ static void ReadAnalogEvent(int padnum, int analognum, int analogdir) {
}
// check keyboard events
- while ((ge = gdk_event_get()) != NULL) {
- if (ge->type == GDK_KEY_PRESS) {
- if (ge->key.keyval != XK_Escape) {
- g.cfg.PadDef[padnum].AnalogDef[analognum][analogdir].Key = ge->key.keyval;
+ XQueryKeymap(g.Disp, buttons);
+ for (i = 0; i < 256; ++i) {
+ if(buttons[i >> 3] & (1 << (i & 7))) {
+ Key = XkbKeycodeToKeysym(g.Disp, i, 0, 0);
+ if(Key != XK_Escape) {
+ g.cfg.PadDef[padnum].AnalogDef[analognum][analogdir].Key = Key;
}
- gdk_event_free(ge);
goto end;
}
- gdk_event_free(ge);
}
usleep(5000);
@@ -598,6 +603,12 @@ long PADconfigure() {
fprintf(stderr, "Failed to initialize SDL!\n");
return -1;
}
+
+ g.Disp = XOpenDisplay(NULL);
+ if (!g.Disp) {
+ fprintf(stderr, "XOpenDisplay failed!\n");
+ return -1;
+ }
LoadPADConfig();