When KWin is run with -sync, print also backtraces for X errors.

svn path=/trunk/KDE/kdebase/workspace/; revision=732021
This commit is contained in:
Luboš Luňák 2007-11-02 15:01:40 +00:00
parent 1b8b326c7b
commit c5eb488c3b

View file

@ -57,6 +57,10 @@ Atoms* atoms;
int screen_number = -1; int screen_number = -1;
static bool initting = false; static bool initting = false;
// Whether to run Xlib in synchronous mode and print backtraces for X errors.
// Note that you most probably need to configure cmake with "-D__KDE_HAVE_GCC_VISIBILITY=0"
// and -rdynamic in CXXFLAGS for kBacktrace() to work.
static bool kwin_sync = false;
static static
int x11ErrorHandler(Display *d, XErrorEvent *e) int x11ErrorHandler(Display *d, XErrorEvent *e)
@ -84,6 +88,9 @@ int x11ErrorHandler(Display *d, XErrorEvent *e)
fprintf(stderr, "kwin: %s(0x%lx): %s\n", req, e->resourceid, msg); fprintf(stderr, "kwin: %s(0x%lx): %s\n", req, e->resourceid, msg);
if( kwin_sync )
kDebug() << kBacktrace();
if (initting) if (initting)
{ {
fputs(i18n("kwin: failure during initialization; aborting").toLocal8Bit(), stderr); fputs(i18n("kwin: failure during initialization; aborting").toLocal8Bit(), stderr);
@ -140,6 +147,12 @@ int Application::crashes = 0;
Application::Application( ) Application::Application( )
: KApplication( ), owner( screen_number ) : KApplication( ), owner( screen_number )
{ {
if( KCmdLineArgs::parsedArgs( "qt" )->isSet( "sync" ))
{
kwin_sync = true;
XSynchronize( display(), True );
kDebug() << "Running KWin in sync mode";
}
KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
KSharedConfig::Ptr config = KGlobal::config(); KSharedConfig::Ptr config = KGlobal::config();
if (!config->isImmutable() && args->isSet("lock")) if (!config->isImmutable() && args->isSet("lock"))