Lines 28-39
Link Here
|
28 |
#include "WulforUtil.hh" |
28 |
#include "WulforUtil.hh" |
29 |
#include <iostream> |
29 |
#include <iostream> |
30 |
#include <signal.h> |
30 |
#include <signal.h> |
|
|
31 |
#include <X11/Xlib.h> |
31 |
|
32 |
|
32 |
void callBack(void* x, const std::string& a) |
33 |
void callBack(void* x, const std::string& a) |
33 |
{ |
34 |
{ |
34 |
std::cout << "Loading: " << a << std::endl; |
35 |
std::cout << "Loading: " << a << std::endl; |
35 |
} |
36 |
} |
36 |
|
37 |
|
|
|
38 |
static int(*old_x_error_handler) (Display *, XErrorEvent *); |
39 |
int bad_match_xerror_handler(Display *edpy, XErrorEvent *ee) { |
40 |
if(ee->error_code == BadMatch){ |
41 |
cerr << "(EE) Recieved an error from X!" << endl << \ |
42 |
"(EE) This is probably caused by the system tray icon, please t ry disabling it." << endl; |
43 |
return 0; |
44 |
} |
45 |
cerr << "(EE) Fatal Xerror: request code=" << ee->request_code << ", error code=" << ee->error_code << endl; |
46 |
return old_x_error_handler(edpy, ee); |
47 |
} |
48 |
|
37 |
int main(int argc, char *argv[]) |
49 |
int main(int argc, char *argv[]) |
38 |
{ |
50 |
{ |
39 |
// Initialize i18n support |
51 |
// Initialize i18n support |
Lines 69-74
int main(int argc, char *argv[])
Link Here
|
69 |
WulforSettingsManager::newInstance(); |
81 |
WulforSettingsManager::newInstance(); |
70 |
WulforManager::start(); |
82 |
WulforManager::start(); |
71 |
gdk_threads_enter(); |
83 |
gdk_threads_enter(); |
|
|
84 |
|
85 |
// install our Xerror handler, save the old one for restoring |
86 |
old_x_error_handler = XSetErrorHandler(bad_match_xerror_handler); |
87 |
|
72 |
gtk_main(); |
88 |
gtk_main(); |
73 |
gdk_threads_leave(); |
89 |
gdk_threads_leave(); |
74 |
WulforManager::stop(); |
90 |
WulforManager::stop(); |
Lines 76-81
int main(int argc, char *argv[])
Link Here
|
76 |
|
92 |
|
77 |
std::cout << "Shutting down..." << std::endl; |
93 |
std::cout << "Shutting down..." << std::endl; |
78 |
shutdown(); |
94 |
shutdown(); |
|
|
95 |
|
96 |
// restore the old Xerror handler |
97 |
XSetErrorHandler(old_x_error_handler); |
98 |
old_x_error_handler = NULL; |
79 |
|
99 |
|
80 |
return 0; |
100 |
return 0; |
81 |
} |
101 |
} |