fixed desktop mode

preferencesAboutTextFull
Claudio Valerio 12 years ago
parent ac468994c7
commit 77f51fd103
  1. 52
      src/gui/UBScreenMirror.cpp

@ -80,41 +80,23 @@ void UBScreenMirror::timerEvent(QTimerEvent *event)
void UBScreenMirror::grabPixmap() void UBScreenMirror::grabPixmap()
{ {
// if (mSourceWidget) if (mSourceWidget)
// { {
// QPoint topLeft = mSourceWidget->mapToGlobal(mSourceWidget->geometry().topLeft()); QPoint topLeft = mSourceWidget->mapToGlobal(mSourceWidget->geometry().topLeft());
// QPoint bottomRight = mSourceWidget->mapToGlobal(mSourceWidget->geometry().bottomRight()); QPoint bottomRight = mSourceWidget->mapToGlobal(mSourceWidget->geometry().bottomRight());
// mRect.setTopLeft(topLeft); mRect.setTopLeft(topLeft);
// mRect.setBottomRight(bottomRight); mRect.setBottomRight(bottomRight);
// } mLastPixmap = QPixmap::grabWidget(mSourceWidget);
}
// // get image of desktop else{
// WHY HERE?
// WId windowID = qApp->desktop()->screen(mScreenIndex)->winId(); // this is the case we are showing the desktop but the is no widget and we use the last widget rectagle to know
// qDebug() << windowID; // what we have to grab. Not very good way of doing
//#if defined(Q_WS_MAC) WId windowID = qApp->desktop()->screen(mScreenIndex)->winId();
mLastPixmap = QPixmap::grabWindow(windowID, mRect.x(), mRect.y(), mRect.width(), mRect.height());
// TODO: bad mac fix. On dual screen mac os x and let web mode for more than one minute and it crashed }
// NSAutorelease pull should avoid this.
// // Available in Mac OS X v10.6 and later.
// CGRect grabRect;
// grabRect.origin.x = mRect.x();
// grabRect.origin.y = mRect.y();
// grabRect.size.width = mRect.width();
// grabRect.size.height = mRect.height();
// CGImageRef windowImage = CGWindowListCreateImage(grabRect
// ,kCGWindowListOptionOnScreenOnly
// ,windowID
// ,kCGWindowImageDefault);
// mLastPixmap = QPixmap::fromMacCGImageRef(windowImage);
//#else
// mLastPixmap = QPixmap::grabWindow(windowID, mRect.x(), mRect.y(), mRect.width(), mRect.height());
//#endif
mLastPixmap = QPixmap::grabWidget(mSourceWidget);
mLastPixmap = mLastPixmap.scaled(width(), height(), Qt::KeepAspectRatio, Qt::SmoothTransformation); mLastPixmap = mLastPixmap.scaled(width(), height(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
} }

Loading…
Cancel
Save