[Kde-cygwin-cvs] CVS: qt-3/src/kernel qapplication_win.cpp,1.1.2.30.2.88,1.1.2.30.2.89 qdnd_win.cpp,
Status: Inactive
Brought to you by:
habacker
From: Christian E. <che...@us...> - 2005-08-05 16:27:56
|
Update of /cvsroot/kde-cygwin/qt-3/src/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27425/src/kernel Modified Files: Tag: QT_WIN32_3_3_BRANCH qapplication_win.cpp qdnd_win.cpp qwidget_win.cpp Log Message: qdnd - renamed qIDataObject to QOleDataObject to sync with qt4 and qwidget.h definition better debug output Index: qapplication_win.cpp =================================================================== RCS file: /cvsroot/kde-cygwin/qt-3/src/kernel/Attic/qapplication_win.cpp,v retrieving revision 1.1.2.30.2.88 retrieving revision 1.1.2.30.2.89 diff -u -r1.1.2.30.2.88 -r1.1.2.30.2.89 --- qapplication_win.cpp 1 Aug 2005 17:44:44 -0000 1.1.2.30.2.88 +++ qapplication_win.cpp 5 Aug 2005 16:27:29 -0000 1.1.2.30.2.89 @@ -2290,9 +2290,11 @@ QApplication::sendSpontaneousEvent( this, &e ); return FALSE; } */ - bool QETWidget::translateEraseEvent( const MSG &msg ) { +#ifdef DEBUG_QAPPLICATION + qDebug( "QETWidget::translateEraseEvent: %s, %s", className(), name() ); +#endif QRegion rgn; // here we need empty_region - qt_erase_region needs it & doesn't touch it QPixmap *pm = ( extra ) ? extra->bg_pix : NULL; HDC hdcOld = hdc; @@ -2308,9 +2310,8 @@ bool QETWidget::translatePaintEvent( const MSG &msg ) { - // XXX: ccj - does not merge paint events like the X11 version #ifdef DEBUG_QAPPLICATION - qDebug( "qapplication_win.cpp: QETWidget::translatePaintEvent, %s, %s", className(), name() ); + qDebug( "QETWidget::translatePaintEvent %s, %s", className(), name() ); #endif PAINTSTRUCT ps; Index: qdnd_win.cpp =================================================================== RCS file: /cvsroot/kde-cygwin/qt-3/src/kernel/Attic/qdnd_win.cpp,v retrieving revision 1.1.2.5.2.24 retrieving revision 1.1.2.5.2.25 diff -u -r1.1.2.5.2.24 -r1.1.2.5.2.25 --- qdnd_win.cpp 1 Aug 2005 17:44:46 -0000 1.1.2.5.2.24 +++ qdnd_win.cpp 5 Aug 2005 16:27:31 -0000 1.1.2.5.2.25 @@ -200,7 +200,7 @@ cur = copyCursor; } else if ( ( ( dwEffect & DROPEFFECT_MOVE ) == DROPEFFECT_MOVE ) && ( ( drag_mode == QDragObject::DragMove ) || - ( drag_mode == QDragObject::DragCopy ) || // windows-bug? + ( drag_mode == QDragObject::DragCopy ) || // windows-bug? ( drag_mode == QDragObject::DragCopyOrMove ) || ( drag_mode == QDragObject::DragDefault ) ) ) { cur = moveCursor; @@ -521,7 +521,7 @@ private: int *m_formats; // formats we can provide data in - ULONG m_nCount, // number of formats we support + ULONG m_nCount, // number of formats we support m_nCurrent; // current enum position /* IUnknown vars */ ulong m_refs; @@ -626,15 +626,20 @@ } /*********************************************** - qIDataObject + QOleDataObject ************************************************/ -class qIDataObject : public IDataObject +class QOleDataObject : public IDataObject { public: - qIDataObject( QDragObject * o ); - virtual ~qIDataObject(); + QOleDataObject( QDragObject * o ); + virtual ~QOleDataObject(); + /* own methods */ QWidget *getWidget(); + void releaseQt() + { + m_dragObj = 0; + } /* IDataObject methods */ STDMETHODIMP GetData( FORMATETC *pformatetcIn, STGMEDIUM *pmedium ); @@ -657,21 +662,21 @@ private: #if defined(Q_DISABLE_COPY) // Disabled copy constructor and operator= - qIDataObject ( const qIDataObject & ); - qIDataObject & operator=( const qIDataObject & ); + QOleDataObject ( const QOleDataObject & ); + QOleDataObject & operator=( const QOleDataObject & ); #endif }; -qIDataObject::qIDataObject( QDragObject * o ) +QOleDataObject::QOleDataObject( QDragObject * o ) { m_refs = 1; m_dragObj = o; } -qIDataObject::~qIDataObject() +QOleDataObject::~QOleDataObject() {} -STDMETHODIMP qIDataObject::GetData( FORMATETC *pformatetcIn, STGMEDIUM *pmedium ) +STDMETHODIMP QOleDataObject::GetData( FORMATETC *pformatetcIn, STGMEDIUM *pmedium ) { // is data is in our format? HRESULT hr = QueryGetData( pformatetcIn ); @@ -702,7 +707,7 @@ return E_UNEXPECTED; } -STDMETHODIMP qIDataObject::GetDataHere( FORMATETC *pformatetc, STGMEDIUM *pmedium ) +STDMETHODIMP QOleDataObject::GetDataHere( FORMATETC *pformatetc, STGMEDIUM *pmedium ) { // is data is in our format? HRESULT hr = QueryGetData( pformatetc ); @@ -734,10 +739,10 @@ return E_UNEXPECTED; } -STDMETHODIMP qIDataObject::QueryGetData( FORMATETC *pformatetc ) +STDMETHODIMP QOleDataObject::QueryGetData( FORMATETC *pformatetc ) { #ifdef DEBUG_QDND_SRC - qDebug( "qIDataObject::QueryGetData( %p )", pformatetc ); + qDebug( "QOleDataObject::QueryGetData( %p )", pformatetc ); #endif if ( !pformatetc ) { @@ -766,18 +771,18 @@ return DV_E_FORMATETC; } -STDMETHODIMP qIDataObject::GetCanonicalFormatEtc( FORMATETC *, FORMATETC *pformatetcOut ) +STDMETHODIMP QOleDataObject::GetCanonicalFormatEtc( FORMATETC *, FORMATETC *pformatetcOut ) { pformatetcOut->ptd = NULL; return ResultFromScode( E_NOTIMPL ); } -STDMETHODIMP qIDataObject::SetData( FORMATETC *pfetc, STGMEDIUM *pmedium, BOOL fRelease ) +STDMETHODIMP QOleDataObject::SetData( FORMATETC *pfetc, STGMEDIUM *pmedium, BOOL fRelease ) { - return E_NOTIMPL; + return ResultFromScode( E_NOTIMPL ); } -STDMETHODIMP qIDataObject::EnumFormatEtc( DWORD dwDir, IEnumFORMATETC **ppenumFormatEtc ) +STDMETHODIMP QOleDataObject::EnumFormatEtc( DWORD dwDir, IEnumFORMATETC **ppenumFormatEtc ) { if ( dwDir == DATADIR_SET ) @@ -810,22 +815,22 @@ return ResultFromScode( S_OK ); } -STDMETHODIMP qIDataObject::DAdvise( FORMATETC*, DWORD, IAdviseSink *, DWORD* ) +STDMETHODIMP QOleDataObject::DAdvise( FORMATETC*, DWORD, IAdviseSink *, DWORD* ) { return ResultFromScode( OLE_E_ADVISENOTSUPPORTED ); } -STDMETHODIMP qIDataObject::DUnadvise( DWORD ) +STDMETHODIMP QOleDataObject::DUnadvise( DWORD ) { return ResultFromScode( OLE_E_ADVISENOTSUPPORTED ); } -STDMETHODIMP qIDataObject::EnumDAdvise( IEnumSTATDATA ** ) +STDMETHODIMP QOleDataObject::EnumDAdvise( IEnumSTATDATA ** ) { return ResultFromScode( OLE_E_ADVISENOTSUPPORTED ); } -STDMETHODIMP qIDataObject::QueryInterface( REFIID iid, void** ppv ) +STDMETHODIMP QOleDataObject::QueryInterface( REFIID iid, void** ppv ) { if ( iid == IID_IUnknown || iid == IID_IDataObject ) { *ppv = this; @@ -837,16 +842,16 @@ } STDMETHODIMP_( ULONG ) -qIDataObject::AddRef() +QOleDataObject::AddRef() { return ++m_refs; } STDMETHODIMP_( ULONG ) -qIDataObject::Release() +QOleDataObject::Release() { if ( --m_refs == 0 ) { - // releaseQt(); + releaseQt(); delete this; return 0; } @@ -863,28 +868,7 @@ bool QDragManager::eventFilter( QObject * o, QEvent * e ) { -#ifdef DEBUG_QDND_WIN_2 - qDebug( "QDragManager::eventFilter( %p, %p )", o, e ); -#endif - - if ( e->type() == QEvent::DragResponse ) { - if ( ( ( QDragResponseEvent * ) e ) ->dragAccepted() ) { - if ( !willDrop ) { - willDrop = true; - } - } else { - if ( willDrop ) { - willDrop = false; - } - } - // updateCursor(); - return true; - } else - if ( e->type() == QEvent::DragLeave ) { - willDrop = false; - // updateCursor(); - return false; - } + // not used in windows implementation return false; } @@ -976,32 +960,46 @@ beingCancelled = false; } - qApp->installEventFilter( this ); - object = o; drag_mode = mode; updatePixmap(); willDrop = FALSE; +#ifndef QT_NO_ACCESSIBILITY + + QAccessible::updateAccessibility( this, 0, QAccessible::DragDropStart ); +#endif + DWORD dwEffect, dwOKEffect; - qIDataObject *data = new qIDataObject( o ); + QOleDataObject *obj = new QOleDataObject( o ); QOleDropSource *qsrc = new QOleDropSource(); src = o->target(); - qsrc->AddRef(); - data->AddRef(); dwOKEffect = ( mode == QDropEvent::Copy ) ? DROPEFFECT_COPY : DROPEFFECT_MOVE; updateCursor(); - DoDragDrop( data, qsrc, dwOKEffect, &dwEffect ); - // src = NULL; +#ifdef Q_OS_TEMP + HRESULT r = 0; + resultEffect = 0; +#else + HRESULT r = DoDragDrop( obj, qsrc, dwOKEffect, &dwEffect ); +#endif #ifndef QT_NO_CURSOR - - qApp->restoreOverrideCursor(); + QApplication::restoreOverrideCursor(); + restoreCursor = false; #endif - qApp->removeEventFilter( this ); + // clean up + obj->releaseQt(); + obj->Release(); // Will delete obj if refcount becomes 0 + qsrc->Release(); // Will delete src if refcount becomes 0 + object = 0; + +#ifndef QT_NO_ACCESSIBILITY + + QAccessible::updateAccessibility( this, 0, QAccessible::DragDropEnd ); +#endif return true; } @@ -1252,19 +1250,22 @@ dst->releaseQt(); dst->Release(); #ifndef Q_OS_TEMP - CoLockObjectExternal(dst, false, true); - RevokeDragDrop(widget->winId()); + + CoLockObjectExternal( dst, false, true ); + RevokeDragDrop( widget->winId() ); #endif } QOleDropTarget* qt_olednd_register( QWidget* widget ) { - QOleDropTarget* dst = new QOleDropTarget(widget); + QOleDropTarget * dst = new QOleDropTarget( widget ); #ifndef Q_OS_TEMP - RegisterDragDrop(widget->winId(), dst); - CoLockObjectExternal(dst, true, true); + + RegisterDragDrop( widget->winId(), dst ); + CoLockObjectExternal( dst, true, true ); #endif + return dst; } -#endif // QT_NO_DRAGANDDROP \ No newline at end of file +#endif // QT_NO_DRAGANDDROP Index: qwidget_win.cpp =================================================================== RCS file: /cvsroot/kde-cygwin/qt-3/src/kernel/Attic/qwidget_win.cpp,v retrieving revision 1.1.2.15.2.54 retrieving revision 1.1.2.15.2.55 diff -u -r1.1.2.15.2.54 -r1.1.2.15.2.55 --- qwidget_win.cpp 1 Aug 2005 17:44:46 -0000 1.1.2.15.2.54 +++ qwidget_win.cpp 5 Aug 2005 16:27:32 -0000 1.1.2.15.2.55 @@ -1081,7 +1081,10 @@ void QWidget::update() { - if ( isVisible() && isUpdatesEnabled() ) { +#ifdef DEBUG_QWIDGET + qDebug( "QWidget::update () %s, %s", className(), name() ); +#endif + if ( isVisible() && isUpdatesEnabled() ) { InvalidateRect( winId(), 0, false ); } } @@ -1108,6 +1111,10 @@ void QWidget::update( int x, int y, int w, int h ) { +#ifdef DEBUG_QWIDGET + qDebug( "QWidget::update (%d, %d, %d, %d ) %s, %s", x, y, w, h, className(), name() ); +#endif + if ( !isVisible() || !isUpdatesEnabled() ) return; @@ -1167,7 +1174,7 @@ void QWidget::repaint( int x, int y, int w, int h, bool erase ) { #ifdef DEBUG_QWIDGET - qDebug( "qwidget_win.cpp: repaint x: %d, y: %d, w: %d, h: %d, %s, %s", x, y, w, h, className(), name() ); + qDebug( "QWidget::repaint( %d, %d, %d, %d ) %s, %s", x, y, w, h, className(), name() ); #endif if ( !isVisible() || !isUpdatesEnabled() ) @@ -1690,11 +1697,10 @@ \sa repaint() */ - void QWidget::erase( int x, int y, int w, int h ) { #ifdef DEBUG_QWIDGET - qDebug( "qwidget_win.cpp:%s, QWidget::erase( int x, int y, int w, int h )", className() ); + qDebug( "QWidget::erase( %d, %d, %d, %d ) %s, %s", x, y, w, h, className(), name() ); #endif if ( w < 0 ) @@ -1715,7 +1721,7 @@ void QWidget::erase( const QRegion& reg ) { #ifdef DEBUG_QWIDGET - qDebug( "qwidget_win.cpp:%s, QWidget::erase( const QRegion& reg )", className() ); + qDebug( "QWidget::erase( const QRegion& reg ) %s, %s", className(), name() ); #endif if ( backgroundMode() == NoBackground || isDesktop() || !isVisible() ) @@ -1723,7 +1729,7 @@ QRect rr( reg.boundingRect() ); #ifdef DEBUG_QWIDGET - qDebug( "qwidget_win.cpp:%s, QWidget::erase:reg.boundingRect()=(%d, %d, %d, %d)", className(), rr.x(), rr.y(), rr.width(), rr.height() ); + qDebug( "QWidget::erase:reg.boundingRect()=(%d, %d, %d, %d)", rr.x(), rr.y(), rr.width(), rr.height() ); #endif bool unclipped = testWFlags( WPaintUnclipped ); @@ -1735,7 +1741,6 @@ qt_erase_region( this, pm, backgroundOffset(), reg ); } - /*! \overload This version of the function scrolls the entire widget and moves the |