std::unique_ptr<char, decltype(free)*> profileNamePtr(profileName, free);
return std::string(profileName);
}
+
+ std::string getHomeKey() {
+ std::string profileName = getProfileName();
+ if (profileName[0] == 'w' || profileName[0] == 'W')
+ return "XF86PowerOff";
+ else
+ return "XF86Home";
+ }
}
Ecore_Event_Key *ev = static_cast<Ecore_Event_Key*>(event);
Popupper* runner = static_cast<Popupper*>(data);
ALOGD("HW button pressed. type <" << type << "> pressed key is <" << ev->key << ">");
- if ((!strcmp("XF86Home", ev->key) || !strcmp("XF86Back", ev->key)) && runner->m_elementPtr) {
+ if ((!strcmp(getHomeKey().c_str(), ev->key) || !strcmp("XF86Back", ev->key)) && runner->m_elementPtr) {
ALOGD("Respond as deny once.");
runner->m_popupResponseHandler(NResponseType::None);
}
elm_win_indicator_mode_set(m_win, ELM_WIN_INDICATOR_SHOW);
evas_object_smart_callback_add(m_win, "unfocused", &Popupper::unfocusedCb, this);
- elm_win_keygrab_set(m_win, "XF86Home", 0, 0, 0, ELM_WIN_KEYGRAB_SHARED);
+ elm_win_keygrab_set(m_win, getHomeKey().c_str(), 0, 0, 0, ELM_WIN_KEYGRAB_SHARED);
elm_win_keygrab_set(m_win, "XF86Back", 0, 0, 0, ELM_WIN_KEYGRAB_TOPMOST);
ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, &Popupper::hwKeyClickedCb, this);
}
void Popupper::stop()
{
m_shouldRaise = false;
- elm_win_keygrab_unset(m_win, "XF86Home", 0, 0);
+ elm_win_keygrab_unset(m_win, getHomeKey().c_str(), 0, 0);
elm_win_keygrab_unset(m_win, "XF86Back", 0, 0);
m_elementPtr.reset(nullptr);
m_answerablePtr.reset(nullptr);