mirror of https://github.com/PCSX2/pcsx2.git
pad-linux: Abort 'set all btns' on escape key + gui fixes (#4809)
This commit is contained in:
parent
ad29594d08
commit
fb14500b41
|
@ -472,7 +472,7 @@ void PADDialog::InitDialog()
|
||||||
|
|
||||||
void PADDialog::OnButtonClicked(wxCommandEvent& event)
|
void PADDialog::OnButtonClicked(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
// Affichage d'un message à chaque clic sur le bouton
|
// Display a message each time the button is clicked
|
||||||
wxButton* bt_tmp = (wxButton*)event.GetEventObject(); // get the button object
|
wxButton* bt_tmp = (wxButton*)event.GetEventObject(); // get the button object
|
||||||
int bt_id = bt_tmp->GetId() - wxID_HIGHEST - 1; // get the real ID
|
int bt_id = bt_tmp->GetId() - wxID_HIGHEST - 1; // get the real ID
|
||||||
int gamepad_id = m_tab_gamepad->GetSelection(); // get the tab ID (equivalent to the gamepad id)
|
int gamepad_id = m_tab_gamepad->GetSelection(); // get the tab ID (equivalent to the gamepad id)
|
||||||
|
@ -540,7 +540,7 @@ void PADDialog::OnButtonClicked(wxCommandEvent& event)
|
||||||
}
|
}
|
||||||
m_pan_tabs[gamepad_id]->Refresh();
|
m_pan_tabs[gamepad_id]->Refresh();
|
||||||
m_pan_tabs[gamepad_id]->Update();
|
m_pan_tabs[gamepad_id]->Update();
|
||||||
config_key(gamepad_id, i);
|
bool key_captured = config_key(gamepad_id, i);
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case PAD_L_UP: // Left joystick (Up) ↑
|
case PAD_L_UP: // Left joystick (Up) ↑
|
||||||
|
@ -573,6 +573,10 @@ void PADDialog::OnButtonClicked(wxCommandEvent& event)
|
||||||
}
|
}
|
||||||
m_pan_tabs[gamepad_id]->Refresh();
|
m_pan_tabs[gamepad_id]->Refresh();
|
||||||
m_pan_tabs[gamepad_id]->Update();
|
m_pan_tabs[gamepad_id]->Update();
|
||||||
|
if (!key_captured)
|
||||||
|
{ // if ESC is hit, abort Set_all and return user control
|
||||||
|
break;
|
||||||
|
}
|
||||||
usleep(500000); // give enough time to the user to release the button
|
usleep(500000); // give enough time to the user to release the button
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -595,7 +599,7 @@ void PADDialog::OnButtonClicked(wxCommandEvent& event)
|
||||||
/*********** Methods functions **********/
|
/*********** Methods functions **********/
|
||||||
/****************************************/
|
/****************************************/
|
||||||
|
|
||||||
void PADDialog::config_key(int pad, int key)
|
bool PADDialog::config_key(int pad, int key)
|
||||||
{
|
{
|
||||||
bool captured = false;
|
bool captured = false;
|
||||||
u32 key_pressed = 0;
|
u32 key_pressed = 0;
|
||||||
|
@ -612,11 +616,17 @@ void PADDialog::config_key(int pad, int key)
|
||||||
set_keyboard_key(pad, key_pressed, key);
|
set_keyboard_key(pad, key_pressed, key);
|
||||||
m_simulatedKeys[pad][key] = key_pressed;
|
m_simulatedKeys[pad][key] = key_pressed;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return captured;
|
||||||
|
}
|
||||||
captured = true;
|
captured = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_bt_gamepad[pad][key]->SetLabel(
|
m_bt_gamepad[pad][key]->SetLabel(
|
||||||
KeyName(pad, key, m_simulatedKeys[pad][key]).c_str());
|
KeyName(pad, key, m_simulatedKeys[pad][key]).c_str());
|
||||||
|
|
||||||
|
return captured;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PADDialog::clear_key(int pad, int key)
|
void PADDialog::clear_key(int pad, int key)
|
||||||
|
@ -655,7 +665,8 @@ void DisplayDialog()
|
||||||
if (g_conf.ftw)
|
if (g_conf.ftw)
|
||||||
{
|
{
|
||||||
wxString info("The PAD GUI is provided to map the keyboard/mouse to the virtual PS2 pad.\n\n"
|
wxString info("The PAD GUI is provided to map the keyboard/mouse to the virtual PS2 pad.\n\n"
|
||||||
"Gamepads/Joysticks are plug and play. The active gamepad can be selected in the 'Gamepad Configuration' panel.\n\n");
|
"Gamepads/Joysticks are plug and play. Re-mapping of Gamepads/Joysticks is currently not supported in the PAD GUI.\n\n"
|
||||||
|
"The active gamepad can be selected in the 'Gamepad Configuration' panel.\n\n");
|
||||||
|
|
||||||
wxMessageDialog ftw(nullptr, info);
|
wxMessageDialog ftw(nullptr, info);
|
||||||
ftw.ShowModal();
|
ftw.ShowModal();
|
||||||
|
|
|
@ -54,7 +54,7 @@ enum gui_buttons
|
||||||
#define BUTTONS_LENGHT 32 // numbers of buttons on the gamepad
|
#define BUTTONS_LENGHT 32 // numbers of buttons on the gamepad
|
||||||
#define UPDATE_TIME 5
|
#define UPDATE_TIME 5
|
||||||
#define DEFAULT_WIDTH 1000
|
#define DEFAULT_WIDTH 1000
|
||||||
#define DEFAULT_HEIGHT 740
|
#define DEFAULT_HEIGHT 760
|
||||||
|
|
||||||
class PADDialog : public wxDialog
|
class PADDialog : public wxDialog
|
||||||
{
|
{
|
||||||
|
@ -72,7 +72,7 @@ class PADDialog : public wxDialog
|
||||||
bool m_pressed[GAMEPAD_NUMBER][NB_IMG];
|
bool m_pressed[GAMEPAD_NUMBER][NB_IMG];
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
void config_key(int, int);
|
bool config_key(int, int);
|
||||||
void clear_key(int, int);
|
void clear_key(int, int);
|
||||||
void repopulate();
|
void repopulate();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue