summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util/fbrun/main.cc36
1 files changed, 15 insertions, 21 deletions
diff --git a/util/fbrun/main.cc b/util/fbrun/main.cc
index 994ace8..60d2762 100644
--- a/util/fbrun/main.cc
+++ b/util/fbrun/main.cc
@@ -19,10 +19,10 @@
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// $Id: main.cc,v 1.5 2002/11/15 14:00:45 fluxgen Exp $ 22// $Id: main.cc,v 1.6 2002/11/26 17:04:23 fluxgen Exp $
23 23
24#include "FbRun.hh" 24#include "FbRun.hh"
25#include "BaseDisplay.hh" 25#include "App.hh"
26#include "StringUtil.hh" 26#include "StringUtil.hh"
27 27
28#include <string> 28#include <string>
@@ -30,21 +30,8 @@
30 30
31using namespace std; 31using namespace std;
32 32
33class App:public BaseDisplay {
34public:
35 App(const char *displaystr):BaseDisplay("FbRun", displaystr) { }
36 FbRun &fbrun() { return m_fbrun; }
37 void handleEvent(XEvent * const ev) {
38 m_fbrun.handleEvent(ev);
39 if (m_fbrun.end())
40 shutdown();
41 }
42private:
43 FbRun m_fbrun;
44};
45
46void showUsage(const char *progname) { 33void showUsage(const char *progname) {
47 cerr<<"fbrun 1.1.1 : (c) 2002 Henrik Kinnunen"<<endl; 34 cerr<<"fbrun 1.1.2 : (c) 2002 Henrik Kinnunen"<<endl;
48 cerr<<"Usage: "<< 35 cerr<<"Usage: "<<
49 progname<<" [arguments]"<<endl<< 36 progname<<" [arguments]"<<endl<<
50 "Arguments: "<<endl<< 37 "Arguments: "<<endl<<
@@ -117,10 +104,11 @@ int main(int argc, char **argv) {
117 104
118 try { 105 try {
119 106
120 App application(display_name.c_str()); 107 FbTk::App application(display_name.c_str());
121 Display *disp = application.getXDisplay(); 108 Display *disp = application.display();
122 109
123 FbRun &fbrun = application.fbrun(); 110 FbRun fbrun;
111
124 if (fontname.size() != 0) { 112 if (fontname.size() != 0) {
125 if (!fbrun.loadFont(fontname.c_str())) { 113 if (!fbrun.loadFont(fontname.c_str())) {
126 cerr<<"Failed to load font: "<<fontname<<endl; 114 cerr<<"Failed to load font: "<<fontname<<endl;
@@ -167,8 +155,14 @@ int main(int argc, char **argv) {
167 155
168 if (set_pos) 156 if (set_pos)
169 fbrun.move(x, y); 157 fbrun.move(x, y);
170 158
171 application.eventLoop(); 159 XEvent ev;
160
161 // main loop
162 while (!fbrun.end()) {
163 XNextEvent(disp, &ev);
164 fbrun.handleEvent(&ev);
165 }
172 166
173 } catch (string errstr) { 167 } catch (string errstr) {
174 cerr<<"Error: "<<errstr<<endl; 168 cerr<<"Error: "<<errstr<<endl;