diff options
Diffstat (limited to 'src/FbTk/App.cc')
-rw-r--r-- | src/FbTk/App.cc | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/FbTk/App.cc b/src/FbTk/App.cc index e32c806..3daf61a 100644 --- a/src/FbTk/App.cc +++ b/src/FbTk/App.cc | |||
@@ -31,37 +31,37 @@ namespace FbTk { | |||
31 | App *App::s_app = 0; | 31 | App *App::s_app = 0; |
32 | 32 | ||
33 | App *App::instance() { | 33 | App *App::instance() { |
34 | if (s_app == 0) | 34 | if (s_app == 0) |
35 | throw std::string("You must create an instance of FbTk::App first!"); | 35 | throw std::string("You must create an instance of FbTk::App first!"); |
36 | return s_app; | 36 | return s_app; |
37 | } | 37 | } |
38 | 38 | ||
39 | App::App(const char *displayname):m_done(false) { | 39 | App::App(const char *displayname):m_done(false) { |
40 | if (s_app != 0) | 40 | if (s_app != 0) |
41 | throw std::string("Can't create more than one instance of FbTk::App"); | 41 | throw std::string("Can't create more than one instance of FbTk::App"); |
42 | s_app = this; | 42 | s_app = this; |
43 | m_display = XOpenDisplay(displayname); | 43 | m_display = XOpenDisplay(displayname); |
44 | } | 44 | } |
45 | 45 | ||
46 | App::~App() { | 46 | App::~App() { |
47 | if (m_display != 0) { | 47 | if (m_display != 0) { |
48 | XCloseDisplay(m_display); | 48 | XCloseDisplay(m_display); |
49 | m_display = 0; | 49 | m_display = 0; |
50 | } | 50 | } |
51 | s_app = 0; | 51 | s_app = 0; |
52 | } | 52 | } |
53 | 53 | ||
54 | void App::eventLoop() { | 54 | void App::eventLoop() { |
55 | XEvent ev; | 55 | XEvent ev; |
56 | while (!m_done) { | 56 | while (!m_done) { |
57 | XNextEvent(display(), &ev); | 57 | XNextEvent(display(), &ev); |
58 | EventManager::instance()->handleEvent(ev); | 58 | EventManager::instance()->handleEvent(ev); |
59 | } | 59 | } |
60 | } | 60 | } |
61 | 61 | ||
62 | 62 | ||
63 | void App::end() { | 63 | void App::end() { |
64 | m_done = true; //end loop in App::eventLoop | 64 | m_done = true; //end loop in App::eventLoop |
65 | } | 65 | } |
66 | 66 | ||
67 | }; // end namespace FbTk | 67 | }; // end namespace FbTk |