added -r option

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8516 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2004-07-29 20:39:38 +00:00
parent 416e8e8104
commit 3a06d5ee6a
3 changed files with 20 additions and 6 deletions

View File

@ -18,6 +18,8 @@
#include <string.h> #include <string.h>
#include <ByteOrder.h> #include <ByteOrder.h>
#include <File.h> #include <File.h>
#include <FindDirectory.h>
#include <Path.h>
void void
Keymap::GetKey( char *chars, int32 offset, char* string) 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_(); status_t _restore_key_map_();
// we make our input server use the map in /boot/home/config/settings/Keymap void
status_t Keymap::RestoreSystemDefault()
Keymap::Use()
{ {
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_();
} }

View File

@ -31,7 +31,7 @@ public:
uint8 IsDeadKey(uint32 keyCode, uint32 modifiers); uint8 IsDeadKey(uint32 keyCode, uint32 modifiers);
bool IsDeadSecondKey(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey); bool IsDeadSecondKey(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey);
void GetChars(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey, char** chars, int32* numBytes); 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); static void GetKey( char *chars, int32 offset, char* string);
private: private:
char *fChars; char *fChars;

View File

@ -42,10 +42,14 @@ int main(int argc, char **argv)
keymap.LoadCurrent(); keymap.LoadCurrent();
keymap.Dump(); keymap.Dump();
return 0; return 0;
}
if (operation == 'r') {
Keymap keymap;
keymap.RestoreSystemDefault();
return 0;
} }
} else { } else {
if (operation == 'o') { if (operation == 'o') {
//return do_compile(argv[i]);
return 0; return 0;
} else } else
break; break;