2
// Copyright (c) 2002 - 2005 Henrik Kinnunen (fluxgen at fluxbox dot org)
4
// Permission is hereby granted, free of charge, to any person obtaining a
5
// copy of this software and associated documentation files (the "Software"),
6
// to deal in the Software without restriction, including without limitation
7
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
// and/or sell copies of the Software, and to permit persons to whom the
9
// Software is furnished to do so, subject to the following conditions:
11
// The above copyright notice and this permission notice shall be included in
12
// all copies or substantial portions of the Software.
14
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20
// DEALINGS IN THE SOFTWARE.
26
#include "EventManager.hh"
39
App *App::instance() {
41
throw std::string("You must create an instance of FbTk::App first!");
45
App::App(const char *displayname):m_done(false), m_display(0) {
47
throw std::string("Can't create more than one instance of FbTk::App");
49
// this allows the use of std::string.c_str(), which returns
50
// a blank string, rather than a null string, so we make them equivalent
51
if (displayname != 0 && displayname[0] == '\0')
53
m_display = XOpenDisplay(displayname);
55
throw std::string("Couldn't connect to XServer");
67
XCloseDisplay(m_display);
73
void App::sync(bool discard) {
74
XSync(display(), discard);
77
void App::eventLoop() {
80
XNextEvent(display(), &ev);
81
EventManager::instance()->handleEvent(ev);
87
m_done = true; //end loop in App::eventLoop
90
}; // end namespace FbTk