# HG changeset patch # User Chris Cannam # Date 1326910405 0 # Node ID 3240925e00ef523e64aad38271e36c0f7e5c27b7 # Parent 7d627586705847de5816bd16a798a59be3d82f19 Move X11 stuff here, from svcore diff -r 7d6275867058 -r 3240925e00ef framework/MainWindowBase.cpp --- a/framework/MainWindowBase.cpp Fri Jan 13 17:43:12 2012 +0000 +++ b/framework/MainWindowBase.cpp Wed Jan 18 18:13:25 2012 +0000 @@ -108,6 +108,27 @@ using std::map; using std::set; +#ifdef Q_WS_X11 +#define Window X11Window +#include +#include +#include +#include + +static int handle_x11_error(Display *dpy, XErrorEvent *err) +{ + char errstr[256]; + XGetErrorText(dpy, err->error_code, errstr, 256); + if (err->error_code != BadWindow) { + std::cerr << "Sonic Visualiser: X Error: " + << errstr << " " << int(err->error_code) + << "\nin major opcode: " + << int(err->request_code) << std::endl; + } + return 0; +} +#undef Window +#endif MainWindowBase::MainWindowBase(bool withAudioOutput, bool withOSCSupport, @@ -132,6 +153,10 @@ { Profiler profiler("MainWindowBase::MainWindowBase"); +#ifdef Q_WS_X11 + XSetErrorHandler(handle_x11_error); +#endif + connect(CommandHistory::getInstance(), SIGNAL(commandExecuted()), this, SLOT(documentModified())); connect(CommandHistory::getInstance(), SIGNAL(documentRestored()),