]>
Dogcows Code - chaz/openbox/blob - otk/application.cc
2530fdd112c20cee6494f7280f76f4caa8b8157d
1 #include "application.hh"
2 #include "eventhandler.hh"
17 OtkApplication::OtkApplication(int argc
, char **argv
)
18 : OtkEventDispatcher(), _main_widget(0), _dockable(false)
23 OBDisplay::initialize(0);
24 const ScreenInfo
*s_info
= OBDisplay::screenInfo(DefaultScreen(OBDisplay::display
));
26 _timer_manager
= new OBTimerQueueManager();
27 _img_ctrl
= new BImageControl(_timer_manager
, s_info
, True
, 4, 5, 200);
28 _style_conf
= new Configuration(False
);
29 _style
= new Style(_img_ctrl
);
34 OtkApplication::~OtkApplication()
38 delete _timer_manager
;
44 void OtkApplication::loadStyle(void)
46 // find the style name as a property
47 std::string style
= "/usr/local/share/openbox/styles/artwiz";
48 _style_conf
->setFile(style
);
49 if (!_style_conf
->load()) {
50 std::cerr
<< "Unable to load style \"" << style
<< "\". Aborting.\n";
53 _style
->load(*_style_conf
);
56 void OtkApplication::exec(void)
59 std::cerr
<< "ERROR: No main widget set. You must create a main " <<
60 "OtkWidget for the OtkApplication before calling " <<
61 "OtkApplication::exec().\n";
66 _timer_manager
->fire(); // fire pending events
70 bool OtkApplication::setMainWidget(const OtkWidget
*main_widget
)
72 // ignore it if it has already been set
74 std::cerr
<< "WARNING: More than one main OtkWidget being created for " <<
75 "the OtkApplication!\n";
79 _main_widget
= main_widget
;
81 // set WM Protocols on the window
83 protocols
[0] = XInternAtom(OBDisplay::display
, "WM_PROTOCOLS", false);
84 protocols
[1] = XInternAtom(OBDisplay::display
, "WM_DELETE_WINDOW", false);
85 XSetWMProtocols(OBDisplay::display
, _main_widget
->getWindow(), protocols
, 2);
This page took 0.034646 seconds and 4 git commands to generate.