diff --git a/src/gui/keybind_setup.cpp b/src/gui/keybind_setup.cpp index be5c504ff..21f8dce61 100644 --- a/src/gui/keybind_setup.cpp +++ b/src/gui/keybind_setup.cpp @@ -68,15 +68,13 @@ CKeybindSetup::CKeybindSetup() { - keySetupNotifier = new CKeySetupNotifier; - keySetupNotifier->changeNotify(NONEXISTANT_LOCALE, NULL); + changeNotify(LOCALE_KEYBINDINGMENU_REPEATBLOCKGENERIC, NULL); width = w_max (40, 10); } CKeybindSetup::~CKeybindSetup() { - delete keySetupNotifier; } int CKeybindSetup::exec(CMenuTarget* parent, const std::string &actionKey) @@ -218,10 +216,8 @@ int CKeybindSetup::showKeySetup() keySettings->addItem(new CMenuForwarder(LOCALE_EXTRA_SAVEKEYS, true, NULL, this, "savekeys", CRCInput::convertDigitToKey(shortcut++))); //rc tuning - CStringInput keySettings_repeat_genericblocker(LOCALE_KEYBINDINGMENU_REPEATBLOCKGENERIC, g_settings.repeat_genericblocker, 3, LOCALE_REPEATBLOCKER_HINT_1, LOCALE_REPEATBLOCKER_HINT_2, "0123456789 ", keySetupNotifier); - CStringInput keySettings_repeatBlocker(LOCALE_KEYBINDINGMENU_REPEATBLOCK, g_settings.repeat_blocker, 3, LOCALE_REPEATBLOCKER_HINT_1, LOCALE_REPEATBLOCKER_HINT_2, "0123456789 ", keySetupNotifier); - - keySetupNotifier->changeNotify(NONEXISTANT_LOCALE, NULL); + CStringInput keySettings_repeat_genericblocker(LOCALE_KEYBINDINGMENU_REPEATBLOCKGENERIC, g_settings.repeat_genericblocker, 3, LOCALE_REPEATBLOCKER_HINT_1, LOCALE_REPEATBLOCKER_HINT_2, "0123456789 ", this); + CStringInput keySettings_repeatBlocker(LOCALE_KEYBINDINGMENU_REPEATBLOCK, g_settings.repeat_blocker, 3, LOCALE_REPEATBLOCKER_HINT_1, LOCALE_REPEATBLOCKER_HINT_2, "0123456789 ", this); keySettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_KEYBINDINGMENU_RC)); if (RC_HW_SELECT) @@ -323,3 +319,19 @@ void CKeybindSetup::showKeyBindMovieplayerSetup(CMenuWidget *bindSettings_mplaye bindSettings_mplayer->addItem(new CMenuDForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i])); } +bool CKeybindSetup::changeNotify(const neutrino_locale_t OptionName, void * /* data */) +{ + if (ARE_LOCALES_EQUAL(OptionName, LOCALE_KEYBINDINGMENU_REPEATBLOCKGENERIC) || + ARE_LOCALES_EQUAL(OptionName, LOCALE_KEYBINDINGMENU_REPEATBLOCK)) { + unsigned int fdelay = atoi(g_settings.repeat_blocker); + unsigned int xdelay = atoi(g_settings.repeat_genericblocker); + + g_RCInput->repeat_block = fdelay * 1000; + g_RCInput->repeat_block_generic = xdelay * 1000; + + int fd = g_RCInput->getFileHandle(); + ioctl(fd, IOC_IR_SET_F_DELAY, fdelay); + ioctl(fd, IOC_IR_SET_X_DELAY, xdelay); + } + return false; +} diff --git a/src/gui/keybind_setup.h b/src/gui/keybind_setup.h index 37daa0c95..e936219cf 100644 --- a/src/gui/keybind_setup.h +++ b/src/gui/keybind_setup.h @@ -39,7 +39,7 @@ #include -class CKeybindSetup : public CMenuTarget +class CKeybindSetup : public CMenuTarget, public CChangeObserver { public: enum keynames @@ -82,7 +82,6 @@ class CKeybindSetup : public CMenuTarget private: CFrameBuffer *frameBuffer; - CKeySetupNotifier *keySetupNotifier; CKeyChooser *keychooser[KEYBINDS_COUNT]; int width; @@ -97,8 +96,8 @@ class CKeybindSetup : public CMenuTarget CKeybindSetup(); ~CKeybindSetup(); int exec(CMenuTarget* parent, const std::string & actionKey); + bool changeNotify(const neutrino_locale_t OptionName, void * data); }; - #endif