diff options
-rw-r--r-- | src/tests/testKeys.cc | 43 |
1 files changed, 12 insertions, 31 deletions
diff --git a/src/tests/testKeys.cc b/src/tests/testKeys.cc index 27873e0..5094e80 100644 --- a/src/tests/testKeys.cc +++ b/src/tests/testKeys.cc | |||
@@ -1,5 +1,5 @@ | |||
1 | // testKeys.cc | 1 | // testKeys.cc |
2 | // Copyright (c) 2001 - 2002 Henrik Kinnunen (fluxgen@linuxmail.org) | 2 | // Copyright (c) 2001 - 2004 Henrik Kinnunen (fluxgen@linuxmail.org) |
3 | // | 3 | // |
4 | // Permission is hereby granted, free of charge, to any person obtaining a | 4 | // Permission is hereby granted, free of charge, to any person obtaining a |
5 | // copy of this software and associated documentation files (the "Software"), | 5 | // copy of this software and associated documentation files (the "Software"), |
@@ -19,44 +19,25 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | #include "../Keys.hh" | ||
23 | #include <iostream> | 22 | #include <iostream> |
24 | #include <X11/Xlib.h> | 23 | #include "../FbTk/App.hh" |
25 | 24 | #include "../FbTk/KeyUtil.hh" | |
26 | |||
27 | #ifdef UDS | ||
28 | #include <uds/init.hh> | ||
29 | #include <uds/uds.hh> | ||
30 | // configure UDS | ||
31 | uds::uds_flags_t uds::flags = uds::leak_check|uds::log_allocs; | ||
32 | #endif | ||
33 | 25 | ||
34 | using namespace std; | 26 | using namespace std; |
35 | 27 | ||
36 | void testKeys(int argc, char **argv) { | 28 | void testKeys(int argc, char **argv) { |
37 | Display *display = XOpenDisplay(0); | 29 | FbTk::App app(0); |
38 | 30 | if (app.display() == 0) { | |
39 | if (display==0) { | ||
40 | cerr<<"Cant open display."<<endl; | 31 | cerr<<"Cant open display."<<endl; |
41 | return; | 32 | return; |
42 | } | 33 | } |
43 | 34 | std::string theline; | |
44 | Keys *keys = new Keys(display); | 35 | cout<<"Type key: "; |
45 | const char default_keyfile[] = "keys"; | 36 | getline(cin, theline); |
46 | 37 | unsigned int key = FbTk::KeyUtil::getKey(theline.c_str()); | |
47 | if (argc>1) { | 38 | cerr<<"key = "<<key<<endl; |
48 | cerr<<"Loading file: "<<argv[1]<<endl; | 39 | if (key == NoSymbol) |
49 | keys->load(const_cast<char *>(argv[1])); | 40 | cerr<<"NoSymbol"<<endl; |
50 | } else { | ||
51 | cerr<<"Using default file: "<<default_keyfile<<endl; | ||
52 | keys->load(const_cast<char *>(default_keyfile)); | ||
53 | } | ||
54 | |||
55 | keys->load(const_cast<char *>(default_keyfile)); | ||
56 | |||
57 | delete keys; | ||
58 | |||
59 | XCloseDisplay(display); | ||
60 | } | 41 | } |
61 | 42 | ||
62 | int main(int argc, char **argv) { | 43 | int main(int argc, char **argv) { |