all repos — fluxbox @ c9e62e7aee97862ec0e0527b4a963bc9d244e41c

custom fork of the fluxbox windowmanager

virtual eventLoop, default displayname and exit eventLoop variable
fluxgen fluxgen
commit

c9e62e7aee97862ec0e0527b4a963bc9d244e41c

parent

d39c023411aca300017a2710d484a2b16e5dd064

2 files changed, 20 insertions(+), 3 deletions(-)

jump to
M src/FbTk/App.ccsrc/FbTk/App.cc

@@ -20,6 +20,9 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER

// DEALINGS IN THE SOFTWARE. #include "App.hh" + +#include "EventManager.hh" + #include <cassert> #include <string>

@@ -33,7 +36,7 @@ throw std::string("You must create an instance of FbTk::App first!");

return s_app; } -App::App(const char *displayname) { +App::App(const char *displayname):m_done(false) { if (s_app != 0) throw std::string("Can't create more than one instance of FbTk::App"); s_app = this;

@@ -46,6 +49,19 @@ XCloseDisplay(m_display);

m_display = 0; } s_app = 0; +} + +void App::eventLoop() { + XEvent ev; + while (!m_done) { + XNextEvent(display(), &ev); + EventManager::instance()->handleEvent(ev); + } +} + + +void App::end() { + m_done = true; //end loop in App::eventLoop } }; // end namespace FbTk
M src/FbTk/App.hhsrc/FbTk/App.hh

@@ -32,16 +32,17 @@ class App {

public: /// @return singleton instance of App static App *instance(); - explicit App(const char *displayname); + explicit App(const char *displayname=0); virtual ~App(); /// display connection Display *display() const { return m_display; } /// starts event loop - void eventLoop(); + virtual void eventLoop(); /// ends event loop void end(); private: static App *s_app; + bool m_done; Display *m_display; };