GTK : Fixed a bug with default joypad selection.

This commit is contained in:
bgk 2008-09-13 18:16:09 +00:00
parent 8af83ed1cb
commit 6f066367a4
2 changed files with 7 additions and 0 deletions

View File

@ -47,6 +47,7 @@ JoypadConfigDialog::JoypadConfigDialog() :
m_oTitleLabel("Joypad :", Gtk::ALIGN_RIGHT), m_oTitleLabel("Joypad :", Gtk::ALIGN_RIGHT),
m_oDefaultJoypad("Default joypad"), m_oDefaultJoypad("Default joypad"),
m_oTable(G_N_ELEMENTS(m_astKeys), 2, false), m_oTable(G_N_ELEMENTS(m_astKeys), 2, false),
m_bUpdating(false),
m_ePad(PAD_MAIN) m_ePad(PAD_MAIN)
{ {
// Joypad selection // Joypad selection
@ -104,6 +105,7 @@ JoypadConfigDialog::~JoypadConfigDialog()
void JoypadConfigDialog::vUpdateEntries() void JoypadConfigDialog::vUpdateEntries()
{ {
m_bUpdating = true;
m_oDefaultJoypad.set_active(inputGetDefaultJoypad() == m_ePad); m_oDefaultJoypad.set_active(inputGetDefaultJoypad() == m_ePad);
for (guint i = 0; i < m_oEntries.size(); i++) for (guint i = 0; i < m_oEntries.size(); i++)
@ -155,6 +157,8 @@ void JoypadConfigDialog::vUpdateEntries()
m_oEntries[i]->set_text(csName); m_oEntries[i]->set_text(csName);
} }
} }
m_bUpdating = false;
} }
bool JoypadConfigDialog::bOnEntryFocusIn(GdkEventFocus * _pstEvent, bool JoypadConfigDialog::bOnEntryFocusIn(GdkEventFocus * _pstEvent,
@ -275,6 +279,8 @@ void JoypadConfigDialog::vOnJoypadSelect()
void JoypadConfigDialog::vOnDefaultJoypadSelect() void JoypadConfigDialog::vOnDefaultJoypadSelect()
{ {
if (m_bUpdating) return;
if (m_oDefaultJoypad.get_active()) if (m_oDefaultJoypad.get_active())
{ {
inputSetDefaultJoypad(m_ePad); inputSetDefaultJoypad(m_ePad);

View File

@ -64,6 +64,7 @@ private:
Gtk::Button * m_poOkButton; Gtk::Button * m_poOkButton;
std::vector<Gtk::Entry *> m_oEntries; std::vector<Gtk::Entry *> m_oEntries;
gint m_iCurrentEntry; gint m_iCurrentEntry;
bool m_bUpdating;
static const SJoypadKey m_astKeys[]; static const SJoypadKey m_astKeys[];
sigc::connection m_oConfigSig; sigc::connection m_oConfigSig;
SDL_Event m_oPreviousEvent; SDL_Event m_oPreviousEvent;