Skip to content

Commit

Permalink
Give Alt+F4 similar special treatment to Cmd+Q
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Sep 9, 2015
1 parent 7c4523d commit d8a85e3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/events.cpp
Expand Up @@ -399,6 +399,16 @@ void pump()
}
break;
}

#ifndef __APPLE__
case SDL_KEYDOWN: {
if(event.key.keysym.sym == SDLK_F4 && (event.key.keysym.mod == KMOD_RALT || event.key.keysym.mod == KMOD_LALT)) {
quit_confirmation::quit();
continue; // this event is already handled
}
break;
}
#endif

#if defined(_X11) && !defined(__APPLE__)
case SDL_SYSWMEVENT: {
Expand Down
6 changes: 4 additions & 2 deletions src/hotkey/hotkey_item.cpp
Expand Up @@ -481,11 +481,13 @@ std::string get_names(std::string id)
if (id == "quit") {
names.push_back("escape");
}
#ifdef __APPLE__
else if (id == "quit-to-desktop") {
#ifdef __APPLE__
names.push_back("cmd+q");
}
#else
names.push_back("alt+F4");
#endif
}

return boost::algorithm::join(names, ", ");
}
Expand Down

0 comments on commit d8a85e3

Please sign in to comment.