diff --git a/src/apps/bin/keymap/Keymap.cpp b/src/apps/bin/keymap/Keymap.cpp index 9bbb49477d..70a4184de4 100644 --- a/src/apps/bin/keymap/Keymap.cpp +++ b/src/apps/bin/keymap/Keymap.cpp @@ -18,6 +18,8 @@ #include #include #include +#include +#include void Keymap::GetKey( char *chars, int32 offset, char* string) @@ -538,9 +540,17 @@ Keymap::GetChars(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey, char** c status_t _restore_key_map_(); -// we make our input server use the map in /boot/home/config/settings/Keymap -status_t -Keymap::Use() +void +Keymap::RestoreSystemDefault() { - return _restore_key_map_(); + BPath path; + if (find_directory(B_USER_SETTINGS_DIRECTORY, &path)!=B_OK) + return; + + path.Append("Key_map"); + + BEntry ref(path.Path()); + ref.Remove(); + + _restore_key_map_(); } diff --git a/src/apps/bin/keymap/Keymap.h b/src/apps/bin/keymap/Keymap.h index 71c3e8a8ac..13db980ab5 100644 --- a/src/apps/bin/keymap/Keymap.h +++ b/src/apps/bin/keymap/Keymap.h @@ -31,7 +31,7 @@ public: uint8 IsDeadKey(uint32 keyCode, uint32 modifiers); bool IsDeadSecondKey(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey); void GetChars(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey, char** chars, int32* numBytes); - status_t Use(); + void RestoreSystemDefault(); static void GetKey( char *chars, int32 offset, char* string); private: char *fChars; diff --git a/src/apps/bin/keymap/key_map.cpp b/src/apps/bin/keymap/key_map.cpp index a3a4bf7a79..4b53fe0d04 100644 --- a/src/apps/bin/keymap/key_map.cpp +++ b/src/apps/bin/keymap/key_map.cpp @@ -42,10 +42,14 @@ int main(int argc, char **argv) keymap.LoadCurrent(); keymap.Dump(); return 0; + } + if (operation == 'r') { + Keymap keymap; + keymap.RestoreSystemDefault(); + return 0; } } else { if (operation == 'o') { - //return do_compile(argv[i]); return 0; } else break;