mirror of https://github.com/PCSX2/pcsx2.git
onepad: fix keyboard on 2nd pad
There is only a single event queue, so you need to detect the pad based on the configuration Mouse/Wiimote is limited to first pad Related to issue #1441
This commit is contained in:
parent
eefe3e8d4f
commit
8b3e04d1b6
|
@ -172,13 +172,18 @@ EXPORT_C_(void) PADupdate(int pad)
|
|||
|
||||
// Actually PADupdate is always call with pad == 0. So you need to update both
|
||||
// pads -- Gregory
|
||||
for (int cpad = 0; cpad < GAMEPAD_NUMBER; cpad++) {
|
||||
// Poll keyboard/mouse event
|
||||
key_status->keyboard_state_acces(cpad);
|
||||
PollForX11KeyboardInput(cpad);
|
||||
|
||||
// Get joystick state
|
||||
// Poll keyboard/mouse event. There is currently no way to separate pad0 from pad1 event.
|
||||
// So we will populate both pad in the same time
|
||||
for (int cpad = 0; cpad < GAMEPAD_NUMBER; cpad++) {
|
||||
key_status->keyboard_state_acces(cpad);
|
||||
}
|
||||
PollForX11KeyboardInput();
|
||||
|
||||
// Get joystick state + Commit
|
||||
for (int cpad = 0; cpad < GAMEPAD_NUMBER; cpad++) {
|
||||
key_status->joystick_state_acces(cpad);
|
||||
|
||||
PollForJoystickInput(cpad);
|
||||
|
||||
key_status->commit_status(cpad);
|
||||
|
|
|
@ -56,10 +56,19 @@ static bool s_grab_input = false;
|
|||
static bool s_Shift = false;
|
||||
static unsigned int s_previous_mouse_x = 0;
|
||||
static unsigned int s_previous_mouse_y = 0;
|
||||
void AnalyzeKeyEvent(int pad, keyEvent &evt)
|
||||
void AnalyzeKeyEvent(keyEvent &evt)
|
||||
{
|
||||
KeySym key = (KeySym)evt.key;
|
||||
int index = get_keyboard_key(pad, key);
|
||||
int pad = 0;
|
||||
int index = -1;
|
||||
|
||||
for (int cpad = 0; cpad < GAMEPAD_NUMBER; cpad++) {
|
||||
int tmp_index = get_keyboard_key(cpad, key);
|
||||
if (tmp_index != -1) {
|
||||
pad = cpad;
|
||||
index = tmp_index;
|
||||
}
|
||||
}
|
||||
|
||||
switch (evt.evt)
|
||||
{
|
||||
|
@ -194,14 +203,14 @@ void AnalyzeKeyEvent(int pad, keyEvent &evt)
|
|||
}
|
||||
}
|
||||
|
||||
void PollForX11KeyboardInput(int pad)
|
||||
void PollForX11KeyboardInput()
|
||||
{
|
||||
keyEvent evt;
|
||||
XEvent E;
|
||||
|
||||
// Keyboard input send by PCSX2
|
||||
while (!ev_fifo.empty()) {
|
||||
AnalyzeKeyEvent(pad, ev_fifo.front());
|
||||
AnalyzeKeyEvent(ev_fifo.front());
|
||||
pthread_spin_lock(&mutex_KeyEvent);
|
||||
ev_fifo.pop();
|
||||
pthread_spin_unlock(&mutex_KeyEvent);
|
||||
|
@ -227,7 +236,7 @@ void PollForX11KeyboardInput(int pad)
|
|||
evt.key = (int)XLookupKeysym(&E.xkey, 0);
|
||||
}
|
||||
|
||||
AnalyzeKeyEvent(pad, evt);
|
||||
AnalyzeKeyEvent(evt);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "Linux/linux.h"
|
||||
|
||||
extern Display *GSdsp;
|
||||
extern void PollForX11KeyboardInput(int pad);
|
||||
extern void PollForX11KeyboardInput();
|
||||
extern bool PollX11KeyboardMouseEvent(u32 &pkey);
|
||||
extern Window GSwin;
|
||||
|
||||
|
|
Loading…
Reference in New Issue