32 #include <QtCore/QTimer> 39 static int qt_x11_errhandler( Display *dpy, XErrorEvent *err )
43 if ( err->error_code == BadWindow ) {
48 else if ( err->error_code == BadMatch
49 && err->request_code == 42 ) {
52 else if ( err->error_code == BadDrawable
53 && err->request_code == 14 ) {
59 XGetErrorText( dpy, err->error_code, errstr, 256 );
60 qWarning(
"X11 Error: %s %d\n Major opcode: %d",
61 errstr, err->error_code, err->request_code );
74 QByteArray localMsg = msg.toLocal8Bit();
77 if(QRootApplication::fDebug)
78 fprintf(stderr,
"QtRoot-Debug: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
81 if(QRootApplication::fWarning)
82 fprintf(stderr,
"QtRoot-Warning: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
85 fprintf(stderr,
"QtRoot-Critical: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
88 fprintf(stderr,
"QtRoot-Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
91 fprintf(stderr,
"QtRoot-other: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
97 QApplication(argc,argv, true)
102 timer =
new QTimer(
this );
104 timer->setSingleShot(
false);
114 const char *env = gSystem->Getenv(
"ROOT_CANVAS");
117 if ((strcmp(env,
"yes") == 0) || (strcmp(env,
"YES") == 0))
119 else if ((strcmp(env,
"no") == 0) || (strcmp(env,
"NO") == 0))
128 XSetErrorHandler( qt_x11_errhandler );
146 gSystem->ProcessEvents();
virtual ~QRootApplication()
QRootApplication(int &argc, char **argv, int poll=0)
static bool IsRootCanvasMenuEnabled()
void q5MessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
static bool fRootCanvasMenusEnabled