]> Dogcows Code - chaz/openbox/blob - otk/application.cc
fixed bugs, got otkapp to select on a fd, modded widget to make use of otkapp, press...
[chaz/openbox] / otk / application.cc
1 #include "application.hh"
2 #include "eventhandler.hh"
3
4 #include <iostream>
5
6 namespace otk {
7
8 OtkApplication::OtkApplication(int argc, char **argv)
9 : OtkEventDispatcher(), _dockable(false)
10 {
11 argc = argc;
12 argv = argv;
13
14 OBDisplay::initialize(0);
15 const ScreenInfo *s_info = OBDisplay::screenInfo(DefaultScreen(OBDisplay::display));
16
17 _timer_manager = new OBTimerQueueManager();
18 _img_ctrl = new BImageControl(_timer_manager, s_info, True, 4, 5, 200);
19 _style_conf = new Configuration(False);
20 _style = new Style(_img_ctrl);
21
22 loadStyle();
23 }
24
25 OtkApplication::~OtkApplication()
26 {
27 delete _style_conf;
28 delete _img_ctrl;
29 delete _timer_manager;
30 delete _style;
31
32 OBDisplay::destroy();
33 }
34
35 void OtkApplication::loadStyle(void)
36 {
37 // find the style name as a property
38 _style_conf->setFile("/usr/local/share/openbox/styles/artwiz");
39 _style_conf->load();
40 _style->load(*_style_conf);
41 }
42
43 void OtkApplication::exec(void)
44 {
45 const int xfd = ConnectionNumber(OBDisplay::display);
46 fd_set rfds;
47 timeval *timeout = 0;
48
49 while (1) {
50 dispatchEvents();
51
52 FD_ZERO(&rfds);
53 FD_SET(xfd, &rfds);
54
55 select(xfd + 1, &rfds, 0, 0, timeout);
56 }
57 }
58
59 }
This page took 0.0335839999999999 seconds and 4 git commands to generate.