summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-11-27 21:50:32 (GMT)
committerfluxgen <fluxgen>2002-11-27 21:50:32 (GMT)
commitc9e62e7aee97862ec0e0527b4a963bc9d244e41c (patch)
tree8afc0107a7c53a9eb03b6d08b1043c2aba9ec880 /src
parentd39c023411aca300017a2710d484a2b16e5dd064 (diff)
downloadfluxbox_lack-c9e62e7aee97862ec0e0527b4a963bc9d244e41c.zip
fluxbox_lack-c9e62e7aee97862ec0e0527b4a963bc9d244e41c.tar.bz2
virtual eventLoop, default displayname and exit eventLoop variable
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/App.cc18
-rw-r--r--src/FbTk/App.hh5
2 files changed, 20 insertions, 3 deletions
diff --git a/src/FbTk/App.cc b/src/FbTk/App.cc
index 89b5921..e32c806 100644
--- a/src/FbTk/App.cc
+++ b/src/FbTk/App.cc
@@ -20,6 +20,9 @@
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22#include "App.hh" 22#include "App.hh"
23
24#include "EventManager.hh"
25
23#include <cassert> 26#include <cassert>
24#include <string> 27#include <string>
25 28
@@ -33,7 +36,7 @@ App *App::instance() {
33 return s_app; 36 return s_app;
34} 37}
35 38
36App::App(const char *displayname) { 39App::App(const char *displayname):m_done(false) {
37 if (s_app != 0) 40 if (s_app != 0)
38 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");
39 s_app = this; 42 s_app = this;
@@ -48,4 +51,17 @@ App::~App() {
48 s_app = 0; 51 s_app = 0;
49} 52}
50 53
54void App::eventLoop() {
55 XEvent ev;
56 while (!m_done) {
57 XNextEvent(display(), &ev);
58 EventManager::instance()->handleEvent(ev);
59 }
60}
61
62
63void App::end() {
64 m_done = true; //end loop in App::eventLoop
65}
66
51}; // end namespace FbTk 67}; // end namespace FbTk
diff --git a/src/FbTk/App.hh b/src/FbTk/App.hh
index ef5836c..bbaa249 100644
--- a/src/FbTk/App.hh
+++ b/src/FbTk/App.hh
@@ -32,16 +32,17 @@ class App {
32public: 32public:
33 /// @return singleton instance of App 33 /// @return singleton instance of App
34 static App *instance(); 34 static App *instance();
35 explicit App(const char *displayname); 35 explicit App(const char *displayname=0);
36 virtual ~App(); 36 virtual ~App();
37 /// display connection 37 /// display connection
38 Display *display() const { return m_display; } 38 Display *display() const { return m_display; }
39 /// starts event loop 39 /// starts event loop
40 void eventLoop(); 40 virtual void eventLoop();
41 /// ends event loop 41 /// ends event loop
42 void end(); 42 void end();
43private: 43private:
44 static App *s_app; 44 static App *s_app;
45 bool m_done;
45 Display *m_display; 46 Display *m_display;
46}; 47};
47 48