Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/kernel/qdnd_win.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    155155    qDebug("QOleDataObject::GetData(LPFORMATETC pformatetc, LPSTGMEDIUM pmedium)");
    156156#ifndef Q_OS_WINCE
    157     char buf[256] = {0};
    158     GetClipboardFormatNameA(pformatetc->cfFormat, buf, 255);
    159     qDebug("CF = %d : %s", pformatetc->cfFormat, buf);
     157    wchar_t buf[256] = {0};
     158    GetClipboardFormatName(pformatetc->cfFormat, buf, 255);
     159    qDebug("CF = %d : %s", pformatetc->cfFormat, QString::fromWCharArray(buf));
    160160#endif
    161161#endif
     
    399399
    400400            if (!pm.isNull()) {
    401                 int x1 = qMin(-hotSpot.x(),0);
    402                 int x2 = qMax(pm.width()-hotSpot.x(),cpm.width());
    403                 int y1 = qMin(-hotSpot.y(),0);
    404                 int y2 = qMax(pm.height()-hotSpot.y(),cpm.height());
    405 
    406                 w = x2-x1+1;
    407                 h = y2-y1+1;
     401                int x1 = qMin(-hotSpot.x(), 0);
     402                int x2 = qMax(pm.width() - hotSpot.x(), cpm.width());
     403                int y1 = qMin(-hotSpot.y(), 0);
     404                int y2 = qMax(pm.height() - hotSpot.y(), cpm.height());
     405
     406                w = x2 - x1 + 1;
     407                h = y2 - y1 + 1;
    408408            }
    409409
     
    412412            QPoint newHotSpot = hotSpot;
    413413
    414 #if !defined(Q_OS_WINCE) || defined(GWES_ICONCURS)
    415                         bool limitedCursorSize = (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based)
    416                                                   || (QSysInfo::WindowsVersion == QSysInfo::WV_NT)
    417                                   || (QSysInfo::WindowsVersion == QSysInfo::WV_CE);
    418 
    419             if (limitedCursorSize) {
    420                 // Limited cursor size
    421                 int reqw = GetSystemMetrics(SM_CXCURSOR);
    422                 int reqh = GetSystemMetrics(SM_CYCURSOR);
    423 
    424                 QPoint hotspotInPM = newHotSpot - pmDest;
    425                 if (reqw < w) {
    426                     // Not wide enough - move objectpm right
    427                     qreal r = qreal(newHotSpot.x()) / w;
    428                     newHotSpot = QPoint(int(r * reqw), newHotSpot.y());
    429                     if (newHotSpot.x() + cpm.width() > reqw)
    430                         newHotSpot.setX(reqw - cpm.width());
    431 
    432                     srcRect = QRect(QPoint(hotspotInPM.x() - newHotSpot.x(), srcRect.top()), QSize(reqw, srcRect.height()));
    433                 }
    434                 if (reqh < h) {
    435                     qreal r = qreal(newHotSpot.y()) / h;
    436                     newHotSpot = QPoint(newHotSpot.x(), int(r * reqh));
    437                     if (newHotSpot.y() + cpm.height() > reqh)
    438                         newHotSpot.setY(reqh - cpm.height());
    439 
    440                     srcRect = QRect(QPoint(srcRect.left(), hotspotInPM.y() - newHotSpot.y()), QSize(srcRect.width(), reqh));
    441                 }
    442                 // Always use system cursor size
    443                 w = reqw;
    444                 h = reqh;
     414#if defined(Q_OS_WINCE)
     415            // Limited cursor size
     416            int reqw = GetSystemMetrics(SM_CXCURSOR);
     417            int reqh = GetSystemMetrics(SM_CYCURSOR);
     418
     419            QPoint hotspotInPM = newHotSpot - pmDest;
     420            if (reqw < w) {
     421                // Not wide enough - move objectpm right
     422                qreal r = qreal(newHotSpot.x()) / w;
     423                newHotSpot = QPoint(int(r * reqw), newHotSpot.y());
     424                if (newHotSpot.x() + cpm.width() > reqw)
     425                    newHotSpot.setX(reqw - cpm.width());
     426
     427                srcRect = QRect(QPoint(hotspotInPM.x() - newHotSpot.x(), srcRect.top()), QSize(reqw, srcRect.height()));
    445428            }
    446 #endif
     429            if (reqh < h) {
     430                qreal r = qreal(newHotSpot.y()) / h;
     431                newHotSpot = QPoint(newHotSpot.x(), int(r * reqh));
     432                if (newHotSpot.y() + cpm.height() > reqh)
     433                    newHotSpot.setY(reqh - cpm.height());
     434
     435                srcRect = QRect(QPoint(srcRect.left(), hotspotInPM.y() - newHotSpot.y()), QSize(srcRect.width(), reqh));
     436            }
     437            // Always use system cursor size
     438            w = reqw;
     439            h = reqh;
     440#endif
     441
    447442            QPixmap newCursor(w, h);
    448443            if (!pm.isNull()) {
     
    550545        }
    551546#endif
    552         qApp->processEvents();
     547        QApplication::processEvents();
    553548        return NOERROR;
    554549    }
Note: See TracChangeset for help on using the changeset viewer.