Mercurial > hg > svapp
comparison framework/MainWindowBase.cpp @ 255:3240925e00ef
Move X11 stuff here, from svcore
author | Chris Cannam |
---|---|
date | Wed, 18 Jan 2012 18:13:25 +0000 |
parents | c469f8d8208e |
children | f3f9e3d647c1 |
comparison
equal
deleted
inserted
replaced
254:7d6275867058 | 255:3240925e00ef |
---|---|
106 | 106 |
107 using std::vector; | 107 using std::vector; |
108 using std::map; | 108 using std::map; |
109 using std::set; | 109 using std::set; |
110 | 110 |
111 #ifdef Q_WS_X11 | |
112 #define Window X11Window | |
113 #include <X11/Xlib.h> | |
114 #include <X11/Xutil.h> | |
115 #include <X11/Xatom.h> | |
116 #include <X11/SM/SMlib.h> | |
117 | |
118 static int handle_x11_error(Display *dpy, XErrorEvent *err) | |
119 { | |
120 char errstr[256]; | |
121 XGetErrorText(dpy, err->error_code, errstr, 256); | |
122 if (err->error_code != BadWindow) { | |
123 std::cerr << "Sonic Visualiser: X Error: " | |
124 << errstr << " " << int(err->error_code) | |
125 << "\nin major opcode: " | |
126 << int(err->request_code) << std::endl; | |
127 } | |
128 return 0; | |
129 } | |
130 #undef Window | |
131 #endif | |
111 | 132 |
112 MainWindowBase::MainWindowBase(bool withAudioOutput, | 133 MainWindowBase::MainWindowBase(bool withAudioOutput, |
113 bool withOSCSupport, | 134 bool withOSCSupport, |
114 bool withMIDIInput) : | 135 bool withMIDIInput) : |
115 m_document(0), | 136 m_document(0), |
129 m_abandoning(false), | 150 m_abandoning(false), |
130 m_labeller(0), | 151 m_labeller(0), |
131 m_lastPlayStatusSec(0) | 152 m_lastPlayStatusSec(0) |
132 { | 153 { |
133 Profiler profiler("MainWindowBase::MainWindowBase"); | 154 Profiler profiler("MainWindowBase::MainWindowBase"); |
155 | |
156 #ifdef Q_WS_X11 | |
157 XSetErrorHandler(handle_x11_error); | |
158 #endif | |
134 | 159 |
135 connect(CommandHistory::getInstance(), SIGNAL(commandExecuted()), | 160 connect(CommandHistory::getInstance(), SIGNAL(commandExecuted()), |
136 this, SLOT(documentModified())); | 161 this, SLOT(documentModified())); |
137 connect(CommandHistory::getInstance(), SIGNAL(documentRestored()), | 162 connect(CommandHistory::getInstance(), SIGNAL(documentRestored()), |
138 this, SLOT(documentRestored())); | 163 this, SLOT(documentRestored())); |