+void DrawingWindow::realSync()
+{
+ mayUpdate();
+ qApp->sendPostedEvents(this, QEvent::UpdateLater);
+ qApp->sendPostedEvents(this, QEvent::UpdateRequest);
+ qApp->sendPostedEvents(this, QEvent::Paint);
+ qApp->processEvents(QEventLoop::ExcludeUserInputEvents |
+ QEventLoop::ExcludeSocketNotifiers |
+ QEventLoop::DeferredDeletion |
+ QEventLoop::X11ExcludeTimers);
+ qApp->flush();
+ qApp->syncX();
+ syncMutex.lock();
+ syncCondition.wakeAll();
+ syncMutex.unlock();
+}
+
+void DrawingWindow::realDrawText(int x, int y, const char *text, int flags)
+{
+ QRect r(image->rect());
+ switch (flags & Qt::AlignHorizontal_Mask) {
+ case Qt::AlignRight:
+ r.setRight(x);
+ break;
+ case Qt::AlignHCenter:
+ if (x < width / 2)
+ r.setLeft(2 * x - width + 1);
+ else
+ r.setRight(2 * x);
+ break;
+ default:
+ r.setLeft(x);
+ }
+ switch (flags & Qt::AlignVertical_Mask) {
+ case Qt::AlignBottom:
+ r.setBottom(y);
+ break;
+ case Qt::AlignVCenter:
+ if (y < height / 2)
+ r.setTop(2 * y - height + 1);
+ else
+ r.setBottom(2 * y);
+ break;
+ default:
+ r.setTop(y);
+ }
+ syncMutex.lock();
+ painter->drawText(r, flags, text, &r);
+ dirty(r);
+ syncCondition.wakeAll();
+ syncMutex.unlock();
+}
+