kde-cygwin--cvs Mailing List for KDE on Cygwin (Page 9)
Status: Inactive
Brought to you by:
habacker
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(88) |
Jul
(27) |
Aug
(3) |
Sep
(1) |
Oct
(3) |
Nov
(20) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(23) |
Feb
(25) |
Mar
(9) |
Apr
(88) |
May
(137) |
Jun
(244) |
Jul
(52) |
Aug
(17) |
Sep
(1) |
Oct
(12) |
Nov
(124) |
Dec
(42) |
2003 |
Jan
(112) |
Feb
(53) |
Mar
(24) |
Apr
(6) |
May
|
Jun
(63) |
Jul
(64) |
Aug
(151) |
Sep
(5) |
Oct
(87) |
Nov
(58) |
Dec
(13) |
2004 |
Jan
(76) |
Feb
(22) |
Mar
(30) |
Apr
(41) |
May
(4) |
Jun
(60) |
Jul
(39) |
Aug
(217) |
Sep
(165) |
Oct
(90) |
Nov
(72) |
Dec
(60) |
2005 |
Jan
(153) |
Feb
(110) |
Mar
(76) |
Apr
(237) |
May
(60) |
Jun
(20) |
Jul
(39) |
Aug
(8) |
Sep
(136) |
Oct
(39) |
Nov
|
Dec
|
2006 |
Jan
(16) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2012 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Christian E. <che...@us...> - 2005-08-01 17:44:57
|
Update of /cvsroot/kde-cygwin/qt-3/src/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9720/src/kernel Modified Files: Tag: QT_WIN32_3_3_BRANCH qapplication_win.cpp qdnd_win.cpp qfont_win.cpp qwidget_win.cpp Log Message: huge update from qt4 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.87 retrieving revision 1.1.2.30.2.88 diff -u -r1.1.2.30.2.87 -r1.1.2.30.2.88 --- qapplication_win.cpp 22 Jul 2005 15:41:00 -0000 1.1.2.30.2.87 +++ qapplication_win.cpp 1 Aug 2005 17:44:44 -0000 1.1.2.30.2.88 @@ -226,10 +226,6 @@ extern void qt_dispatchEnterLeave( QWidget*, QWidget* ); // qapplication.cpp -// Palette handling -extern QPalette *qt_std_pal; -extern void qt_create_std_palette(); - // Keyboard handling static bool bInTranslateMessage = false; static bool bChar = true; @@ -280,22 +276,15 @@ }; -// read the _QT_INPUT_ENCODING property and apply the settings to -// the application -static void qt_set_input_encoding() -{ -#ifdef DEBUG_QAPPLICATION - qDebug( "TODO: qapplication_win.cpp: qt_set_input_encoding" ); -#endif -} - static const QColor getQColorFromSys( int syscolor ) { COLORREF c = GetSysColor( syscolor ); return QColor( GetRValue( c ), GetGValue( c ), GetBValue( c ) ); } -void qt_win_update_os_settings() +extern QFont qt_LOGFONTtoQFont(LOGFONT& lf,bool scale); + +static void qt_set_windows_resources() { if ( !qApp ) return ; @@ -505,60 +494,119 @@ if ( pal != QApplication::palette() ) QApplication::setPalette( pal, TRUE, "QTipLabel" ); +#ifndef Q_OS_TEMP + QFont menuFont; + QFont messageFont; + QFont statusFont; + QFont titleFont; + QFont smallTitleFont; + + QT_WA({ + NONCLIENTMETRICS ncm; + ncm.cbSize = sizeof(ncm); + SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0); + menuFont = qt_LOGFONTtoQFont(ncm.lfMenuFont,true); + messageFont = qt_LOGFONTtoQFont(ncm.lfMessageFont,true); + statusFont = qt_LOGFONTtoQFont(ncm.lfStatusFont,true); + titleFont = qt_LOGFONTtoQFont(ncm.lfCaptionFont,true); + smallTitleFont = qt_LOGFONTtoQFont(ncm.lfSmCaptionFont,true); + } , { + // A version + NONCLIENTMETRICSA ncm; + ncm.cbSize = sizeof(ncm); + SystemParametersInfoA(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0); + menuFont = qt_LOGFONTtoQFont((LOGFONT&)ncm.lfMenuFont,true); + messageFont = qt_LOGFONTtoQFont((LOGFONT&)ncm.lfMessageFont,true); + statusFont = qt_LOGFONTtoQFont((LOGFONT&)ncm.lfStatusFont,true); + titleFont = qt_LOGFONTtoQFont((LOGFONT&)ncm.lfCaptionFont,true); + smallTitleFont = qt_LOGFONTtoQFont((LOGFONT&)ncm.lfSmCaptionFont,true); + }); - NONCLIENTMETRICS ncm; - ncm.cbSize = sizeof( NONCLIENTMETRICS ); - QT_WA( - SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0 );, - SystemParametersInfoA( SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0 ); - ) - HDC hDC = qt_display_dc(); /* better than GetDC(0) */ + QApplication::setFont(menuFont, true, "QMenu"); + QApplication::setFont(menuFont, true, "QMenuBar"); + QApplication::setFont(menuFont, true, "QPopupMenu"); + QApplication::setFont(menuFont, true, "QPushButton"); + QApplication::setFont(messageFont, true, "QMessageBox"); + QApplication::setFont(messageFont, true, "QMessageBoxLabel"); + QApplication::setFont(statusFont, true, "QTipLabel"); + QApplication::setFont(statusFont, true, "QStatusBar"); + QApplication::setFont(titleFont, true, "QTitleBar"); + QApplication::setFont(smallTitleFont, true, "QDockWidgetTitle"); +#else LOGFONT lf; - QT_WA( - GetObjectW( GetStockObject( DEFAULT_GUI_FONT ), sizeof( LOGFONT ), &lf );, - GetObjectA( GetStockObject( DEFAULT_GUI_FONT ), sizeof( LOGFONT ), &lf ); - ) + HGDIOBJ stockFont = GetStockObject(SYSTEM_FONT); + GetObject(stockFont, sizeof(lf), &lf); + QApplication::setFont(qt_LOGFONTtoQFont(lf, true)); +#endif// Q_OS_TEMP +} -#ifdef DEBUG_QAPPLICATION +// need to get default font? +extern bool qt_app_has_font; + +static void qt_init_gui() +{ + QT_WA_INLINE( qt_register_window_classes_w (), + qt_register_window_classes_a () ); + + // Get the application name/instance if qWinMain() was not invoked +#ifndef Q_OS_TEMP + // No message boxes but important ones + SetErrorMode(SetErrorMode(0) | SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX); +#endif + + if (appInst == 0) { + QT_WA({ + appInst = GetModuleHandleW(0); + }, { + appInst = GetModuleHandleA(0); + }); + } + +#ifndef Q_OS_TEMP + // Initialize OLE/COM + // S_OK means success and S_FALSE means that it has already + // been initialized + HRESULT r; + r = OleInitialize(0); + if (r != S_OK && r != S_FALSE) { + qWarning("Qt: Could not initialize OLE (error %x)", (unsigned int)r); + } +#endif + + // Misc. initialization +#if defined(QT_DEBUG) + GdiSetBatchLimit(1); +#endif + + QColor::initialize(); + QFont::initialize(); + QCursor::initialize(); + QPainter::initialize(); + QWindowsMime::initialize(); - qDebug( "qapplication_win.cpp: qt_init_internal default font: %s, lfHeight%d, fsize=%d, GetDeviceCaps(hDC, LOGPIXELSY)=%d", lf.lfFaceName, lf.lfHeight, GetPointSize( hDC, lf.lfHeight ), ( int ) GetDeviceCaps( hDC, LOGPIXELSY ) ); -#endif - - QFont fmenu( qt_winQString( ncm.lfMenuFont.lfFaceName ), - GetPointSize( hDC, ncm.lfMenuFont.lfHeight ), - ncm.lfMenuFont.lfWeight == FW_BOLD ? QFont::Bold : QFont::Normal, - ( bool ) ncm.lfMenuFont.lfItalic - ); - QFont fstatus( qt_winQString( ncm.lfStatusFont.lfFaceName ), - GetPointSize( hDC, ncm.lfStatusFont.lfHeight ), - ncm.lfStatusFont.lfWeight == FW_BOLD ? QFont::Bold : QFont::Normal, - ( bool ) ncm.lfStatusFont.lfItalic - ); - QFont fmsg( qt_winQString( ncm.lfMessageFont.lfFaceName ), - GetPointSize( hDC, ncm.lfMessageFont.lfHeight ), - ncm.lfMessageFont.lfWeight == FW_BOLD ? QFont::Bold : QFont::Normal, - ( bool ) ncm.lfMessageFont.lfItalic - ); - QFont ftitle( qt_winQString( ncm.lfCaptionFont.lfFaceName ), - GetPointSize( hDC, ncm.lfCaptionFont.lfHeight ), - ncm.lfCaptionFont.lfWeight == FW_BOLD ? QFont::Bold : QFont::Normal, - ( bool ) ncm.lfCaptionFont.lfItalic - ); - QFont fdef( qt_winQString( lf.lfFaceName ), - GetPointSize( hDC, lf.lfHeight ), - lf.lfWeight == FW_BOLD ? QFont::Bold : QFont::Normal, - ( bool ) lf.lfItalic - ); - - QApplication::setFont( fdef ); - - QApplication::setFont( fmenu, TRUE, "QMenuBar" ); - QApplication::setFont( fmenu, TRUE, "QPopupMenu" ); - QApplication::setFont( fmenu, TRUE, "QPushButton" ); - QApplication::setFont( fstatus, TRUE, "QTipLabel" ); - QApplication::setFont( fmsg, TRUE, "QMessageBoxLabel" ); - QApplication::setFont( ftitle, TRUE, "QTitleBar" ); + qApp->setName( appName ); + // default font + if (!qt_app_has_font) { + HFONT hfont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); + QFont f; + QT_WA({ + LOGFONT lf; + if (GetObject(hfont, sizeof(lf), &lf)) + f = qt_LOGFONTtoQFont((LOGFONT&)lf,true); + } , { + LOGFONTA lf; + if (GetObjectA(hfont, sizeof(lf), &lf)) + f = qt_LOGFONTtoQFont((LOGFONT&)lf,true); + }); + QApplication::setFont(f); + } + qt_set_windows_resources(); + QT_WA({ + WM95_MOUSEWHEEL = RegisterWindowMessage(L"MSWHEEL_ROLLMSG"); + } , { + WM95_MOUSEWHEEL = RegisterWindowMessageA("MSWHEEL_ROLLMSG"); + }); } static void qt_init_internal( int *argcptr, char **argv ) @@ -647,35 +695,9 @@ } *argcptr = j; - - if ( qt_is_gui_used ) { - QT_WA_INLINE( qt_register_window_classes_w (), - qt_register_window_classes_a () ); - -#ifdef DEBUG_QAPPLICATION - - qDebug( "qapplication_win.cpp: qt_init_internal: after registerclass" ); -#endif - -#ifndef Q_OS_TEMP - // Initialize OLE/COM - // S_OK means success and S_FALSE means that it has already - // been initialized - HRESULT r; - r = OleInitialize(0); - if (r != S_OK && r != S_FALSE) { - qWarning("Qt: Could not initialize OLE (error %x)", (unsigned int)r); - } -#endif - - QColor::initialize(); - QFont::initialize(); - QCursor::initialize(); - QPainter::initialize(); - QWindowsMime::initialize(); - - qApp->setName( appName ); - } + + if ( qt_is_gui_used ) + qt_init_gui(); setlocale( LC_ALL, "" ); // use correct char set mapping @@ -686,18 +708,6 @@ setlocale( LC_NUMERIC, "C" ); // make sprintf()/scanf() work - if ( qt_is_gui_used ) { - extern void qt_init_dnd(); - - qt_init_dnd(); - qt_set_input_encoding(); - qt_win_update_os_settings(); - QT_WA({ - WM95_MOUSEWHEEL = RegisterWindowMessage(L"MSWHEEL_ROLLMSG"); - } , { - WM95_MOUSEWHEEL = RegisterWindowMessageA("MSWHEEL_ROLLMSG"); - }); - } /* we can't call something like qt_init_dir() in qdir_win.cpp since link_includes and configure.exe will fail linking because of missing qAddPostRoutine */ #if !defined(Q_CYGWIN_WIN) @@ -2287,7 +2297,9 @@ QPixmap *pm = ( extra ) ? extra->bg_pix : NULL; HDC hdcOld = hdc; hdc = ( HDC ) msg.wParam; + setWState( WState_InPaintEvent ); qt_erase_region( this, pm, backgroundOffset(), rgn ); + clearWState ( WState_InPaintEvent ); hdc = hdcOld; /* An application should return nonzero in response to WM_ERASEBKGND if it processes the message and erases the background */ @@ -2311,17 +2323,7 @@ qDebug( "painting region %d,%d-%d,%d", ps.rcPaint.top, ps.rcPaint.left, ps.rcPaint.bottom, ps.rcPaint.right ); qDebug( "QETWidget::translatePaintEvent crect %d,%d-%d,%d", crect.left(), crect.top(), crect.right(), crect.bottom() ); #endif - if ( ps.fErase ) { - /* We should never get into here since this is handled in QETWidget::translateEraseEvent */ - QPixmap *pm = ( extra ) ? extra->bg_pix : NULL; - qt_erase_region( this, pm, backgroundOffset(), paintRegion ); - } - // There is no need to set a clipRegion since the hdc we get from beginPaint already - // has the correct clip regions set - QPaintEvent e( paintRegion, ps.fErase ); - setWState( WState_InPaintEvent ); - QApplication::sendSpontaneousEvent( this, &e ); - clearWState ( WState_InPaintEvent ); + repaint( paintRegion ); EndPaint( winid, &ps ); hdc = hdcOld; 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.23 retrieving revision 1.1.2.5.2.24 diff -u -r1.1.2.5.2.23 -r1.1.2.5.2.24 --- qdnd_win.cpp 31 Jul 2005 17:43:25 -0000 1.1.2.5.2.23 +++ qdnd_win.cpp 1 Aug 2005 17:44:46 -0000 1.1.2.5.2.24 @@ -66,8 +66,6 @@ static IDataObject *pIDataObject = NULL; -class QOleDropTarget; -QPtrList<QOleDropTarget> dnd_widgets; static QDragObject *global_src = 0; static QDragObject::DragMode drag_mode; @@ -264,6 +262,10 @@ { return widget; } + void releaseQt() + { + widget = 0; + } /* IDropTarget methods */ STDMETHOD( DragEnter ) ( LPDATAOBJECT, DWORD, POINTL, LPDWORD ); @@ -1245,73 +1247,24 @@ /*********************************************** Enables / disables drag and drop for widget w ************************************************/ -bool qt_dnd_enable( QWidget * w, bool on ) +void qt_olednd_unregister( QWidget* widget, QOleDropTarget *dst ) { - if ( on ) { - for ( QOleDropTarget * tgt = dnd_widgets.first(); tgt; tgt = dnd_widgets.next() ) { - if ( tgt->getWidget() == w ) - return true; - } - QOleDropTarget *dst = new QOleDropTarget( w ); - dst->AddRef(); -#ifndef Q_OS_TEMP - - int ret = RegisterDragDrop( w->winId(), dst ); - if ( ret != S_OK ) { -#ifdef DEBUG_QDND_WIN - qDebug( "RegisterDragDrop failed with error %d", ret ); -#endif - - dst->Release(); - return false; - } - CoLockObjectExternal( dst, true, true ); -#endif - - dnd_widgets.append( dst ); - return true; - } - /* on == false */ - for ( QOleDropTarget * dst = dnd_widgets.first(); dst; dst = dnd_widgets.next() ) { - if ( dst->getWidget() == w ) { + dst->releaseQt(); + dst->Release(); #ifndef Q_OS_TEMP - CoLockObjectExternal( dst, false, true ); - RevokeDragDrop( dst->getWidget() ->winId() ); + CoLockObjectExternal(dst, false, true); + RevokeDragDrop(widget->winId()); #endif - - dnd_widgets.remove( dst ); - dst->Release(); - return true; - } - } - return false; } -void qt_cleanup_dnd() +QOleDropTarget* qt_olednd_register( QWidget* widget ) { - for ( QOleDropTarget * dst = dnd_widgets.last(); dst; dst = dnd_widgets.prev() ) { + QOleDropTarget* dst = new QOleDropTarget(widget); #ifndef Q_OS_TEMP - CoLockObjectExternal( dst, false, true ); - RevokeDragDrop( dst->getWidget() ->winId() ); + RegisterDragDrop(widget->winId(), dst); + CoLockObjectExternal(dst, true, true); #endif - - dst->Release(); - } - dnd_widgets.clear(); - delete noDropCursor; - delete copyCursor; - delete moveCursor; - delete linkCursor; - delete stdNoDropCursor; - delete stdCopyCursor; - delete stdMoveCursor; - delete stdLinkCursor; + return dst; } -void qt_init_dnd() -{ - qAddPostRoutine( qt_cleanup_dnd ); -} - -#endif // QT_NO_DRAGANDDROP - +#endif // QT_NO_DRAGANDDROP \ No newline at end of file Index: qfont_win.cpp =================================================================== RCS file: /cvsroot/kde-cygwin/qt-3/src/kernel/Attic/qfont_win.cpp,v retrieving revision 1.1.2.16.2.10 retrieving revision 1.1.2.16.2.11 diff -u -r1.1.2.16.2.10 -r1.1.2.16.2.11 --- qfont_win.cpp 17 Oct 2004 17:26:54 -0000 1.1.2.16.2.10 +++ qfont_win.cpp 1 Aug 2005 17:44:46 -0000 1.1.2.16.2.11 @@ -76,6 +76,36 @@ #define QT_CHECK_STATE +// ### maybe move to qapplication_win +QFont qt_LOGFONTtoQFont(LOGFONT& lf, bool /*scale*/) +{ + QString family = QT_WA_INLINE(QString::fromUcs2((ushort*)lf.lfFaceName), + QString::fromLocal8Bit((char*)lf.lfFaceName)); + QFont qf(family); + qf.setItalic(lf.lfItalic); + if (lf.lfWeight != FW_DONTCARE) { + int weight; + if (lf.lfWeight < 400) + weight = QFont::Light; + else if (lf.lfWeight < 600) + weight = QFont::Normal; + else if (lf.lfWeight < 700) + weight = QFont::DemiBold; + else if (lf.lfWeight < 800) + weight = QFont::Bold; + else + weight = QFont::Black; + qf.setWeight(weight); + } + int lfh = QABS(lf.lfHeight); + Q_ASSERT(qt_display_dc()); + qf.setPointSize(lfh * 72.0 / GetDeviceCaps(qt_display_dc(),LOGPIXELSY)); + qf.setUnderline(false); + qf.setOverline(false); + qf.setStrikeOut(false); + return qf; +} + //333 double qt_pixelSize( double pointSize, QPaintDevice *paintdevice, int scr ) { 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.53 retrieving revision 1.1.2.15.2.54 diff -u -r1.1.2.15.2.53 -r1.1.2.15.2.54 --- qwidget_win.cpp 18 Jul 2005 15:05:59 -0000 1.1.2.15.2.53 +++ qwidget_win.cpp 1 Aug 2005 17:44:46 -0000 1.1.2.15.2.54 @@ -55,7 +55,8 @@ // defined in qregion_win.cpp HRGN QBitmapToHRGN( const QBitmap& bm ); // QWidget::setMask( QBitmap ) // defined in qdnd_win.cpp -bool qt_dnd_enable( QWidget* w, bool on ); // QWidget::setAcceptDrops() +void qt_olednd_unregister(QWidget* widget, QOleDropTarget *dst); +QOleDropTarget* qt_olednd_register(QWidget* widget); // defined in qapplication_x11.cpp void qt_leave_modal( QWidget * ); // QWidget::destroy() @@ -1081,7 +1082,7 @@ void QWidget::update() { if ( isVisible() && isUpdatesEnabled() ) { - InvalidateRect( winId(), 0, true ); + InvalidateRect( winId(), 0, false ); } } @@ -1122,7 +1123,7 @@ r.bottom = crect.height(); else r.bottom = y + h; - InvalidateRect( winId(), &r, true ); + InvalidateRect( winId(), &r, false ); } } @@ -1200,24 +1201,28 @@ \sa update(), paintEvent(), setUpdatesEnabled(), erase() */ -void QWidget::repaint( const QRegion& reg, bool erase ) +void QWidget::repaint( const QRegion& rgn, bool erase ) { #ifdef DEBUG_QWIDGET qDebug( "QWidget::repaint( QRegion& reg, bool erase=%d)", erase ); qDebug( " this is: %s %s", className(), name() ); - QRect rect = reg.boundingRect(); + QRect rect = rgn.boundingRect(); qDebug( "rect: %d,%d - %d,%d", rect.left(), rect.top(), rect.right(), rect.bottom() ); #endif - if ( !isVisible() || !isUpdatesEnabled() || reg.isEmpty() ) + if ( !isVisible() || !isUpdatesEnabled() || rgn.isEmpty() ) return; - ValidateRgn( winId(), reg.handle() ); + if ( testWState( Qt::WState_InPaintEvent ) ) + qWarning( "QWidget::repaint: recursive repaint detected." ); - QPaintEvent e( reg, erase ); - if ( erase ) - this->erase( reg ); - QApplication::sendEvent( this, &e ); + ValidateRgn( winId(), rgn.handle() ); + setWState( Qt::WState_InPaintEvent ); + + QPaintEvent e( rgn ); + this->erase( rgn ); + QApplication::sendSpontaneousEvent( this, &e ); + clearWState ( Qt::WState_InPaintEvent ); } /*! @@ -1373,7 +1378,7 @@ void QWidget::internalSetGeometry( int x, int y, int w, int h, bool isMove ) { #ifdef DEBUG_QWIDGET - qDebug( "qwidget_win.cpp: %s internalSetGeometry called: x=%d, y=%d, w=%d, h=%d, isMove=%d", className(), x, y, w, h, isMove ); + qDebug( "QWidget::internalSetGeometry( x=%d, y=%d, w=%d, h=%d, isMove=%d )", x, y, w, h, isMove ); #endif if ( isTopLevel() && isMove ) { @@ -1741,10 +1746,17 @@ void QWidget::scroll( int dx, int dy ) { #ifdef DEBUG_QWIDGET - qDebug( "qwidget_win.cpp: scroll(%d, %d)", dx, dy ); + qDebug( "QWidget::scroll( %d, %d )", dx, dy ); #endif + if ( testWState( WState_BlockUpdates ) ) + return; + + UINT flags = SW_INVALIDATE | SW_SCROLLCHILDREN; + if ( backgroundMode() != NoBackground ) + flags |= SW_ERASE; - scroll( dx, dy, QRect() ); + ScrollWindowEx( winId(), dx, dy, 0, 0, 0, 0, flags ); + UpdateWindow( winId() ); } /*! Scrolls \a r \a dx pixels to the right and \a dy downwards. Both @@ -1761,26 +1773,25 @@ \sa QScrollView erase() bitBlt() */ -void QWidget::scroll( int dx, int dy, const QRect& ) +void QWidget::scroll( int dx, int dy, const QRect& r ) { #ifdef DEBUG_QWIDGET - qDebug( "qwidget_win.cpp: scroll( %d, %d )", dx, dy ); + qDebug( "QWidget::scroll( %d, %d, %d/%d - %d/%d )", dx, dy, r.left(), r.top(), r.bottom(), r.right() ); #endif - if ( testWState( WState_BlockUpdates ) || !isVisible() ) - return ; - bool just_update = QABS( dx ) > width() || QABS( dy ) > height(); - if ( just_update ) - update(); - - if ( dx == 0 && dy == 0 ) - return ; + if ( testWState( WState_BlockUpdates ) ) + return; - /* CE: I first only scrolled visibleRect() or r but we have to scroll the entire client - area - otherwise we'll loose children which are completly outside our rect... - there is still a lot of flicker when resizing a QListView! - */ - ScrollWindowEx( winId(), dx, dy, 0, 0, NULL, NULL, SW_ERASE | SW_INVALIDATE | SW_SCROLLCHILDREN ); + UINT flags = SW_INVALIDATE; + if ( backgroundMode() != NoBackground ) + flags |= SW_ERASE; + + RECT wr; + wr.top = r.top(); + wr.left = r.left(); + wr.bottom = r.bottom() + 1; + wr.right = r.right() + 1; + ScrollWindowEx( winId(), dx, dy, &wr, &wr, 0, 0, flags ); UpdateWindow( winId() ); } @@ -1876,38 +1887,23 @@ void QWidget::createSysExtra() { -#ifdef DEBUG_QWIDGET - qDebug( "QWidget::createSysExtra()" ); -#endif + extra->dropTarget = 0; } void QWidget::deleteSysExtra() { -#ifdef DEBUG_QWIDGET - qDebug( "QWidget::deleteSysExtra()" ); -#endif + setAcceptDrops( false ); } void QWidget::createTLSysExtra() { -#ifdef DEBUG_QWIDGET - qDebug( "QWidget::createTLSysExtra()" ); -#endif - extra->topextra->winIcon = 0; } void QWidget::deleteTLSysExtra() { -#ifdef DEBUG_QWIDGET - qDebug( "QWidget::deleteTLSysExtra()" ); -#endif - - if ( extra->topextra->winIcon ) { - SendMessage( winid, WM_SETICON, ICON_BIG, 0 ); + if ( extra->topextra->winIcon ) DestroyIcon( extra->topextra->winIcon ); - extra->topextra->winIcon = 0; - } } @@ -1919,10 +1915,6 @@ bool QWidget::acceptDrops() const { -#ifdef DEBUG_QWIDGET - qDebug( "qwidget_win.cpp: acceptDrops" ); -#endif - return testWState( WState_DND ); } @@ -1939,16 +1931,35 @@ void QWidget::setAcceptDrops( bool on ) { -#ifdef DEBUG_QWIDGET - qDebug( "qwidget_win.cpp: setAcceptDrops" ); -#endif + if ( testWState( WState_DND ) == ( Qt::WState )on ) + return; - if ( testWState( WState_DND ) != (Qt::WState)on ) { - if ( qt_dnd_enable( this, on ) ) { - if ( on ) - setWState( WState_DND ); - else - clearWState( WState_DND ); + // Enablement is defined by d->extra->dropTarget != 0. + if ( on ) { + // Turn on. + createExtra(); + QWExtra *extra = extraData(); + if ( !extra->dropTarget ) { + extra->dropTarget = qt_olednd_register( this ); + setWState( Qt::WState_DND ); + } + } else { + // Turn off. + QWExtra *extra = extraData(); + if ( extra && extra->dropTarget ) { + qt_olednd_unregister( this, extra->dropTarget ); + extra->dropTarget = 0; + clearWState( Qt::WState_DND ); + } + } + + if ( children() ) { + QObjectListIt it( *children() ); + register QObject *obj; + while ( ( obj = it.current() ) ) { + ++it; + if ( obj->isWidgetType() ) + ( ( QWidget* ) obj ) ->setAcceptDrops( on ); } } } @@ -1971,7 +1982,12 @@ qDebug( "qwidget_win.cpp: setMask %s", className() ); #endif - SetWindowRgn( winId(), region.handle(), true ); + // Since SetWindowRegion takes ownership, and we need to translate, + // we take a copy. + HRGN wr = CreateRectRgn( 0, 0, 0, 0 ); + CombineRgn( wr, region.handle(), 0, RGN_COPY ); + + SetWindowRgn( winId(), wr, true ); } /*! @@ -1989,20 +2005,8 @@ void QWidget::setMask( const QBitmap &bitmap ) { -#ifdef DEBUG_QWIDGET - qDebug( "qwidget_win.cpp: setMask" ); -#endif - - HRGN hRgn = QBitmapToHRGN( bitmap ); // qregion_win.cpp - if ( !hRgn ) { -#ifdef DEBUG_QWIDGET - qDebug( "qwidget_win.cpp: setMask(QBitmap) failed" ); -#endif - - return; - } - SetWindowRgn( winId(), hRgn, TRUE ); - // hRgn is deleted by windows + QRegion region( bitmap ); + setMask( region ); } /*! @@ -2013,11 +2017,7 @@ void QWidget::clearMask() { -#ifdef DEBUG_QWIDGET - qDebug( "qwidget_win.cpp: clearMask, %s", className() ); -#endif - - SetWindowRgn( winId(), ( HRGN ) NULL, true ); + SetWindowRgn( winId(), 0, true ); } /*!\reimp @@ -2040,27 +2040,32 @@ qDebug( "qwidget_win.cpp updateFrameStrut()" ); #endif - QWidget *that = ( QWidget * ) this; + QWidget *q = ( QWidget * ) this; - if ( isDesktop() ) { - that->fstrut_dirty = false; - return ; + if ( !isVisible() || isDesktop() ) { + q->fstrut_dirty = isVisible(); + return; } - QTLWExtra *top = that->topData(); - - int capWidth, xBdrWidth, yBdrWidth; - getWndBorderInfo( winId(), capWidth, xBdrWidth, yBdrWidth ); - - top->fleft = xBdrWidth; - top->fright = xBdrWidth; - top->ftop = capWidth; - top->fbottom = yBdrWidth; -#ifdef DEBUG_QWIDGET - qDebug( "qwidget_win.cpp updateFrameStrut(%ld, %ld, %ld, %ld)", top->fleft, top->ftop, top->fright, top->fbottom ); -#endif + RECT fr, cr; + GetWindowRect( q->winId(), &fr ); + GetClientRect( q->winId(), &cr ); + + POINT pt; + pt.x = 0; + pt.y = 0; + + ClientToScreen( q->winId(), &pt ); + q->crect = QRect( QPoint( pt.x, pt.y ), + QPoint( pt.x + cr.right, pt.y + cr.bottom ) ); + + QTLWExtra *top = q->topData(); + top->ftop = crect.top() - fr.top; + top->fleft = crect.left() - fr.left; + top->fbottom = fr.bottom - crect.bottom(); + top->fright = fr.right - crect.right(); - that->fstrut_dirty = false; + q->fstrut_dirty = false; } |
From: Christian E. <che...@us...> - 2005-07-31 17:43:34
|
Update of /cvsroot/kde-cygwin/qt-3/src/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21059/src/kernel Modified Files: Tag: QT_WIN32_3_3_BRANCH qdnd_win.cpp Log Message: splitted qIDropWidget into QOleDropTarget and QOleDropSource a lot of code from qt4, not much tested now! 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.22 retrieving revision 1.1.2.5.2.23 diff -u -r1.1.2.5.2.22 -r1.1.2.5.2.23 --- qdnd_win.cpp 18 Jun 2005 18:43:48 -0000 1.1.2.5.2.22 +++ qdnd_win.cpp 31 Jul 2005 17:43:25 -0000 1.1.2.5.2.23 @@ -45,6 +45,7 @@ //#define DEBUG_QDND_TGT #include <shlobj.h> +#include "qapplication_p.h" #include "qbitmap.h" #include "qbuffer.h" #include "qcursor.h" @@ -54,14 +55,19 @@ #include "qwidget.h" #include "qt_windows.h" #include "qwindowdefs.h" // qAddPostRoutine() [...1049 lines suppressed...] @@ -1239,11 +1289,15 @@ void qt_cleanup_dnd() { - for ( qIDropWidget * tgt = dnd_widgets.first(); tgt; tgt = dnd_widgets.next() ) { - RevokeDragDrop( tgt->getWidget() ->winId() ); - dnd_widgets.remove( tgt ); - tgt->Release(); + for ( QOleDropTarget * dst = dnd_widgets.last(); dst; dst = dnd_widgets.prev() ) { +#ifndef Q_OS_TEMP + CoLockObjectExternal( dst, false, true ); + RevokeDragDrop( dst->getWidget() ->winId() ); +#endif + + dst->Release(); } + dnd_widgets.clear(); delete noDropCursor; delete copyCursor; delete moveCursor; |
From: Christian E. <che...@us...> - 2005-07-31 15:03:43
|
Update of /cvsroot/kde-cygwin/qt-3/src/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20990/src/kernel Modified Files: Tag: QT_WIN32_3_3_BRANCH qsound_win.cpp Log Message: qsound_win.cpp implementation from qt4 :) Index: qsound_win.cpp =================================================================== RCS file: /cvsroot/kde-cygwin/qt-3/src/kernel/Attic/qsound_win.cpp,v retrieving revision 1.1.2.8.2.9 retrieving revision 1.1.2.8.2.10 diff -u -r1.1.2.8.2.9 -r1.1.2.8.2.10 --- qsound_win.cpp 31 Jul 2005 13:01:50 -0000 1.1.2.8.2.9 +++ qsound_win.cpp 31 Jul 2005 15:03:30 -0000 1.1.2.8.2.10 @@ -1,514 +1,193 @@ /**************************************************************************** -** $Id$ ** -** Implementation of QSound class and QAuServer internal class +** Copyright (C) 1992-2005 Trolltech AS. All rights reserved. ** -** Created : 20030119 -** -** Copyright (C) 2003 Holger Schroeder -** Copyright (C) 2003 Richard Lärkäng -** Copyright (C) 2004 Tom and Timi Cecka -** Copyright (C) 2004 Ralf Habacker -** -** This file is part of the kernel module of the Qt GUI Toolkit. +** This file is part of the gui module of the Qt Toolkit. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** ** See http://www.trolltech.com/pricing.html or email sa...@tr... for -** information about Qt Commercial License Agreements. -** See http://www.trolltech.com/qpl/ for QPL licensing information. +** information about Qt Commercial License Agreements. ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** -** Contact kde...@kd... if any conditions of this licensing are +** Contact in...@tr... if any conditions of this licensing are ** not clear to you. ** -**********************************************************************/ - -#define QT_CLEAN_NAMESPACE +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ #include "qsound.h" -#define QT_WIN_SUPPORT #ifndef QT_NO_SOUND -#include "qplatformdefs.h" #include "qapplication.h" -#include "qptrdict.h" -#include "qt_windows.h" - -#ifdef QT_WIN_SUPPORT +#include "qapplication_p.h" +#include <qfile.h> -static QPtrDict<void> *inprogress = 0; +#include <qt_windows.h> +#include <mmsystem.h> -class WaveFile; -class QAuBucketWin; -class QAuServerWin : public QAuServer +class QAuServerWindows : public QAuServer { Q_OBJECT public: - QAuServerWin( QObject* parent ); - ~QAuServerWin(); + QAuServerWindows( QObject* parent, const char* name = NULL ); + ~QAuServerWindows(); + + void playHelper( const QString &filename, int loop, QSound *snd ); + void play( const QString& filename, int loop ); + void play( QSound* ); - void init( QSound* ); - void play( const QString& filename ); - void play( QSound* s ); void stop( QSound* ); bool okay(); - void setDone( QSound* ); -public slots: - void dataReceived(); - void soundDestroyed( QObject *o ); - -private: - bool wave; - WaveFile *wv; - QAuBucketWin* bucket( QSound* s ) + int decLoop( QSound *snd ) { - return ( QAuBucketWin* ) QAuServer::bucket( s ); + return QAuServer::decLoop( snd ); } -}; - -/*======================================================================== - * start of win32 classes WavePlay and PlayObject implementation - * written by Ralf Habacker - *=======================================================================*/ - -#define OFFSET_FORMATTAG 20 -#define OFFSET_CHANNELS 22 -#define OFFSET_SAMPLESPERSEC 24 -#define OFFSET_AVGBYTESPERSEC 28 -#define OFFSET_BLOCKALIGN 32 -#define OFFSET_BITSPERSAMPLE 34 -#define OFFSET_WAVEDATA 44 -#define HEADER_SIZE OFFSET_WAVEDATA - -class PlayObject; - -// FIXME move all private elements to this class -class WaveFilePrivate - {} -; -/* a wave file, support multiple playing a wave file */ - -class WaveFile -{ -public: - enum PlayMode { waitEnd, returnImmediate }; - enum Error { NoError, FileNotFound, CouldNotPlay }; - - WaveFile( const char *fileName, QSound *s, QAuServerWin *server ); - ~WaveFile(); - - /// play a sound - PlayObject *play( PlayMode mode = waitEnd, bool loop = false ); - - /// return error code from last operation - inline Error getError() - { - return error; - } - - /// set volume (0-100) in % for both channels - void setVolume( int avol ) - { - vol = avol; - } - - /// set volume for left and right channel - // void setVolume(int leftvol, int rightvol); - - /// return volume (0=left, 1 = right) - int getVolume( void ) - { - return vol; - } - // int getVolume(int channel=0); - - static int debug; -protected: - char *lpfile; - int file_size; - WAVEFORMATEX wfex; - Error error; - int vol; - // int leftvol; - // int rightvol; - QSound *m_sound; - QAuServerWin *m_server; - - - friend class PlayObject; -}; - -void CALLBACK WaveOutProc( HWAVEOUT hwo, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 ); - -/** - encapsulates one playing instance of a WaveFile object -*/ - -class PlayObject -{ -public: - PlayObject( WaveFile *_parent, int _count = 0 ) - { - counter = _count; - parent = _parent; - } - ~PlayObject(); - - bool play(); - inline int count( int offset = 0 ) - { - if ( !offset ) - return counter; - else - return counter += offset; - } - inline bool isPlaying() - { - return !done; - } - inline bool isloop() - { - return counter == -1; - } - inline void stop() - { - counter = 0; - } - inline void setDone() - { - done = true; - QAuServerWin *s = ( QAuServerWin * )inprogress->find( parent->m_sound ); - if ( s ) - s->setDone( ( QSound* ) parent->m_sound ); - } - void waitDone() - { - while ( !done ) - Sleep( 500 ); - } - -protected: - HWAVEOUT hwo; - WAVEHDR whdr; - WaveFile *parent; - int counter; - bool done; + HANDLE current; + HANDLE mutex; + HANDLE event; }; -bool PlayObject::play() +QAuServerWindows::QAuServerWindows( QObject* parent, const char* name ) : + QAuServer( parent, name ), current( 0 ) { - ZeroMemory( ( void* ) & whdr, sizeof( WAVEHDR ) ); - whdr.lpData = parent->lpfile + HEADER_SIZE; - whdr.dwBufferLength = parent->file_size - HEADER_SIZE; - whdr.dwUser = ( DWORD ) this; - done = false; - - // Find a waveOut device and open it - for ( UINT devid = 0; devid < waveOutGetNumDevs(); devid++ ) { - if ( devid == waveOutGetNumDevs() ) - // Error, no free devices found - return false; - if ( waveOutOpen( &hwo, WAVE_MAPPER, &parent->wfex, ( DWORD ) WaveOutProc, 0, CALLBACK_FUNCTION ) == MMSYSERR_NOERROR ) - // Usable device found, stop searching - break; - } - if ( parent && parent->debug ) { - DWORD vol; - waveOutGetVolume( hwo, &vol ); - fprintf( stderr, "%s original Volume: L:%04d R:%04d\n", __FUNCTION__, vol >> 16, vol & 0xffff ); - } - if ( parent && parent->vol != -1 ) { - int vol = ( int ) ( ( double ) parent->vol * 65535 / 100 ); - if ( parent->debug ) - fprintf( stderr, "%d %08x\n", vol, ( vol << 16 ) | vol ); - waveOutSetVolume( hwo, ( vol << 16 ) | vol ); - } - - if ( waveOutPrepareHeader( hwo, &whdr, sizeof( WAVEHDR ) ) != MMSYSERR_NOERROR ) - return false; - if ( waveOutWrite( hwo, &whdr, sizeof( WAVEHDR ) ) != MMSYSERR_NOERROR ) - return false; - return true; + mutex = CreateMutexA( 0, 0, 0 ); + event = CreateEventA( 0, false, false, 0 ); } -PlayObject::~PlayObject() +QAuServerWindows::~QAuServerWindows() { - waveOutClose( hwo ); -} + HANDLE mtx = mutex; + WaitForSingleObject( mtx, INFINITE ); + mutex = 0; -void CALLBACK WaveOutProc( HWAVEOUT hwo, UINT uMsg, DWORD /*dwInstance*/, DWORD dwParam1, DWORD /*dwParam2*/ ) -{ - switch ( uMsg ) { - case WOM_OPEN: - break; - case WOM_DONE: { - WAVEHDR *whdr = ( WAVEHDR* ) dwParam1; - PlayObject *obj = ( PlayObject * ) whdr->dwUser; - if ( obj->count( -1 ) > 0 ) - waveOutWrite( hwo, whdr, sizeof( WAVEHDR ) ); - else { - waveOutUnprepareHeader( hwo, whdr, sizeof( WAVEHDR ) ); - // signal the parent that the sound isn't playing anymore - obj->setDone(); - // delete whdr; - } - } - break; - case WOM_CLOSE: - break; - } + ReleaseMutex( mtx ); + CloseHandle( mtx ); + CloseHandle( event ); } - -int WaveFile::debug = 1; - -WaveFile::WaveFile( const char *fileName, QSound *s, QAuServerWin *server ) : - lpfile(NULL), m_sound( s ), m_server( server ) +struct SoundInfo { - FILE * f; // Structure to load the file into memory - - vol = -1; - error = NoError; - // Open and read the wave file - f = fopen( fileName, "rb" ); - if ( !f ) { - if ( debug ) - fprintf( stderr, "%s(%s) - file not found\n", __FUNCTION__, fileName ); - error = FileNotFound; - return ; - } - if ( debug ) - fprintf( stderr, "%s(%s) - file loaded\n", __FUNCTION__, fileName ); - // Determine the file size - fseek( f, 0, SEEK_END ); - file_size = ftell( f ); - // Rewind the pointer to the begginning so we can read it - fseek( f, 0, SEEK_SET ); - - // Request enough memory to store the entire file - lpfile = new char [ file_size ]; - // 'Copy' the file to memory - fread( lpfile, 1, file_size, f ); - // Close the file, we won't need it anymore - fclose( f ); - - // Fill WAVEFORMATEX with the data from the file - wfex.wFormatTag = *( ( WORD* ) ( lpfile + OFFSET_FORMATTAG ) ); - wfex.nChannels = *( ( WORD* ) ( lpfile + OFFSET_CHANNELS ) ); - wfex.nSamplesPerSec = *( ( DWORD* ) ( lpfile + OFFSET_SAMPLESPERSEC ) ); - wfex.nAvgBytesPerSec = *( ( DWORD* ) ( lpfile + OFFSET_AVGBYTESPERSEC ) ); - wfex.nBlockAlign = *( ( WORD* ) ( lpfile + OFFSET_BLOCKALIGN ) ); - wfex.wBitsPerSample = *( ( WORD* ) ( lpfile + OFFSET_BITSPERSAMPLE ) ); - return ; -} + SoundInfo( const QString &fn, int lp, QSound *snd, QAuServerWindows *srv ) + : sound( snd ), server( srv ), filename( fn ), loops( lp ) + {} -WaveFile::~WaveFile() -{ - delete [] lpfile; -} + QSound *sound; + QAuServerWindows *server; + QString filename; + int loops; +}; -PlayObject *WaveFile::play( PlayMode mode, bool loop ) +DWORD WINAPI SoundPlayProc( LPVOID param ) { - if ( error != NoError ) - return NULL; + SoundInfo * info = ( SoundInfo* ) param; - PlayObject *obj = new PlayObject( this, loop ); + // copy data before waking up GUI thread + QAuServerWindows *server = info->server; + QSound *sound = info->sound; + int loops = info->loops; + QString filename = info->filename; + HANDLE mutex = server->mutex; + HANDLE event = server->event; + info = 0; + + // server must not be destroyed until thread finishes + // and all other sounds have to wait + WaitForSingleObject( mutex, INFINITE ); + + if ( loops <= 1 ) { + server->current = 0; + int flags = SND_FILENAME | SND_ASYNC; + if ( loops == -1 ) + flags |= SND_LOOP; + + QT_WA( { + PlaySoundW( ( TCHAR* ) filename.ucs2(), 0, flags ); + } , { + PlaySoundA( QFile::encodeName( filename ).data(), 0, flags ); + } ); + if ( sound && loops == 1 ) + server->decLoop( sound ); - if ( obj->play() ) { - if ( mode == waitEnd ) { - obj->waitDone(); - delete obj; - return NULL; - } else - return obj; + // GUI thread continues, but we are done as well. + SetEvent( event ); } else { - delete obj; - error = CouldNotPlay; - return NULL; - } -} - -/*======================================================================== - * end of win32 classes WavePlay and PlayObject implementation - *=======================================================================*/ - -// qt related code -class QAuBucketWin : public QAuBucket, public PlayObject -{ -public: - QAuBucketWin( WaveFile *wv ) : PlayObject( wv ) - { } - ~QAuBucketWin() - {} - friend class QAuServerWin; -} -; + // signal GUI thread to continue - sound might be reset! + QSound *guarded_sound = sound; + SetEvent( event ); + + for ( int l = 0; l < loops && server->current; ++l ) { + QT_WA( { + PlaySoundW( ( TCHAR* ) filename.ucs2(), 0, SND_FILENAME | SND_SYNC ); + } , { + PlaySoundA( QFile::encodeName( filename ).data(), 0, SND_FILENAME | SND_SYNC ); + } ); -// qt used the below defined class vars in QAuBucket. PlayObject defines vars -// with exactly the same meaning but other names, so that the redefine below -// makes is easier to compare this qt code with the x11 code for further patches -#define stopped done -#define numplaying counter - -QAuServerWin::QAuServerWin( QObject* parent ) : - QAuServer( parent, "Win32 Audio System" ), - wave(false), - wv(NULL) -{ - wave = true; -} - -QAuServerWin::~QAuServerWin() -{ - wave = false; - if ( wv ) - delete wv; -} - -void QAuServerWin::soundDestroyed( QObject *o ) -{ - if ( inprogress ) { - QSound * so = static_cast<QSound *>( o ); - while ( inprogress->remove( so ) ); // Loop while remove returns TRUE + if ( guarded_sound ) + server->decLoop( guarded_sound ); + } + server->current = 0; } -} + ReleaseMutex( mutex ); -void QAuServerWin::play( const QString& filename ) -{ - if ( wv ) - delete wv; - QSound s( filename ); - init ( &s ); - wv->play(); - dataReceived(); + return 0; } -void QAuServerWin::setDone( QSound* s ) +void QAuServerWindows::playHelper( const QString &filename, int loop, QSound *snd ) { - if ( wave ) { - decLoop( s ); - if ( s->loopsRemaining() && !bucket( s )->stopped ) { - bucket( s )->stopped = TRUE; - play( s ); - } else { - if ( --( bucket( s )->numplaying ) == 0 ) - bucket( s )->stopped = TRUE; - inprogress->remove( s ); - } - } -} + if ( loop == 0 ) + return ; + // busy? + if ( WaitForSingleObject( mutex, 0 ) == WAIT_TIMEOUT ) + return ; + ReleaseMutex( mutex ); -void QAuServerWin::play( QSound* s ) -{ - if ( wave ) { - ++( bucket( s )->numplaying ); - if ( !bucket( s )->stopped ) { - stop( s ); - } + DWORD threadid = 0; + SoundInfo info( filename, loop, snd, this ); + current = CreateThread( 0, 0, SoundPlayProc, &info, 0, &threadid ); + CloseHandle( current ); - bucket( s )->stopped = FALSE; - if ( !inprogress ) - inprogress = new QPtrDict<void>; - inprogress->insert( s, ( void* ) this ); - - /* - int iv=100; - AuFixedPoint volume=AuFixedPointFromFraction(iv,100); - QAuBucketNAS *b = bucket(s); - AuSoundPlayFromBucket(nas, b->id, AuNone, volume, - callback, s, 0, &b->flow, NULL, NULL, NULL); - AuFlush(nas); - */ - QAuBucketWin *b = bucket( s ); - b->play(); - dataReceived(); - } + WaitForSingleObject( event, INFINITE ); } -void QAuServerWin::stop( QSound* s ) +void QAuServerWindows::play( const QString& filename, int loop ) { - if ( wave && !bucket( s ) ->stopped ) { - bucket( s )->stopped = TRUE; - /* - AuStopFlow(nas, bucket(s)->flow, NULL); - AuFlush(nas); - */ - dataReceived(); - } + playHelper( filename, loop, 0 ); } -void QAuServerWin::init( QSound* s ) +void QAuServerWindows::play( QSound* s ) { - connect( s, SIGNAL( destroyed( QObject * ) ), - this, SLOT( soundDestroyed( QObject * ) ) ); - if ( wv ) - delete wv; - wv = new WaveFile( s->fileName(), s, this ); - wv->setVolume( 100 ); - setBucket( s, new QAuBucketWin( wv ) ); + playHelper( s->fileName(), s->loops(), s ); } -bool QAuServerWin::okay() +void QAuServerWindows::stop( QSound* ) { - return !!wave; + // stop unlooped sound + if ( !current ) + PlaySound( 0, 0, 0 ); + // stop after loop is done + current = 0; } -void QAuServerWin::dataReceived() -{} - -#include "qsound_win.moc" - -#endif - - -class QAuServerNull : public QAuServer +bool QAuServerWindows::okay() { -public: - QAuServerNull( QObject* parent ); - - void play( const QString& ) - { } - void play( QSound*s ) - { - while ( decLoop( s ) > 0 ) /* nothing */ - ; - } - void stop( QSound* ) -{ } - bool okay() - { - return FALSE; - } -}; - -QAuServerNull::QAuServerNull( QObject* parent ) : - QAuServer( parent, "Null Audio Server" ) -{} - + return true; +} QAuServer* qt_new_audio_server() { -#ifdef QT_WIN_SUPPORT - QAuServer * s = new QAuServerWin( qApp ); - if ( s->okay() ) { - return s; - } else { - delete s; - } -#endif - return new QAuServerNull( qApp ); + return ( QAuServer* ) new QAuServerWindows( qApp ); } +#include "qsound_win.moc" #endif // QT_NO_SOUND |
From: Christian E. <che...@us...> - 2005-07-31 13:02:00
|
Update of /cvsroot/kde-cygwin/qt-3/src/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31251/src/kernel Modified Files: Tag: QT_WIN32_3_3_BRANCH qsound_win.cpp Log Message: call QAuServerWin::setDone() when we're ready playing a sonud - need some more work. Index: qsound_win.cpp =================================================================== RCS file: /cvsroot/kde-cygwin/qt-3/src/kernel/Attic/qsound_win.cpp,v retrieving revision 1.1.2.8.2.8 retrieving revision 1.1.2.8.2.9 diff -u -r1.1.2.8.2.8 -r1.1.2.8.2.9 --- qsound_win.cpp 14 Jul 2005 19:44:47 -0000 1.1.2.8.2.8 +++ qsound_win.cpp 31 Jul 2005 13:01:50 -0000 1.1.2.8.2.9 @@ -44,6 +44,38 @@ #ifdef QT_WIN_SUPPORT +static QPtrDict<void> *inprogress = 0; + +class WaveFile; +class QAuBucketWin; +class QAuServerWin : public QAuServer +{ + Q_OBJECT + +public: + QAuServerWin( QObject* parent ); + ~QAuServerWin(); + + void init( QSound* ); + void play( const QString& filename ); + void play( QSound* s ); + void stop( QSound* ); + bool okay(); + void setDone( QSound* ); + +public slots: + void dataReceived(); + void soundDestroyed( QObject *o ); + +private: + bool wave; + WaveFile *wv; + QAuBucketWin* bucket( QSound* s ) + { + return ( QAuBucketWin* ) QAuServer::bucket( s ); + } +}; + /*======================================================================== * start of win32 classes WavePlay and PlayObject implementation * written by Ralf Habacker @@ -73,7 +105,7 @@ enum PlayMode { waitEnd, returnImmediate }; enum Error { NoError, FileNotFound, CouldNotPlay }; - WaveFile( const char *fileName ); + WaveFile( const char *fileName, QSound *s, QAuServerWin *server ); ~WaveFile(); /// play a sound @@ -110,6 +142,8 @@ int vol; // int leftvol; // int rightvol; + QSound *m_sound; + QAuServerWin *m_server; friend class PlayObject; @@ -154,6 +188,9 @@ inline void setDone() { done = true; + QAuServerWin *s = ( QAuServerWin * )inprogress->find( parent->m_sound ); + if ( s ) + s->setDone( ( QSound* ) parent->m_sound ); } void waitDone() { @@ -236,8 +273,8 @@ int WaveFile::debug = 1; -WaveFile::WaveFile( const char *fileName ) : - lpfile(NULL) +WaveFile::WaveFile( const char *fileName, QSound *s, QAuServerWin *server ) : + lpfile(NULL), m_sound( s ), m_server( server ) { FILE * f; // Structure to load the file into memory @@ -324,35 +361,6 @@ #define stopped done #define numplaying counter -class QAuServerWin : public QAuServer -{ - Q_OBJECT - -public: - QAuServerWin( QObject* parent ); - ~QAuServerWin(); - - void init( QSound* ); - void play( const QString& filename ); - void play( QSound* s ); - void stop( QSound* ); - bool okay(); - void setDone( QSound* ); - -public slots: - void dataReceived(); - void soundDestroyed( QObject *o ); - -private: - bool wave; - WaveFile *wv; - QAuBucketWin* bucket( QSound* s ) - { - return ( QAuBucketWin* ) QAuServer::bucket( s ); - } -}; - - QAuServerWin::QAuServerWin( QObject* parent ) : QAuServer( parent, "Win32 Audio System" ), wave(false), @@ -368,15 +376,11 @@ delete wv; } -static QPtrDict<void> *inprogress = 0; - void QAuServerWin::soundDestroyed( QObject *o ) { if ( inprogress ) { QSound * so = static_cast<QSound *>( o ); - while ( inprogress->remove - ( so ) ) - ; // Loop while remove returns TRUE + while ( inprogress->remove( so ) ); // Loop while remove returns TRUE } } @@ -384,8 +388,8 @@ { if ( wv ) delete wv; - wv = new WaveFile ( filename.ascii() ); - wv->setVolume( 100 ); + QSound s( filename ); + init ( &s ); wv->play(); dataReceived(); } @@ -394,14 +398,13 @@ { if ( wave ) { decLoop( s ); - if ( s->loopsRemaining() && !bucket( s ) ->stopped ) { - bucket( s ) ->stopped = TRUE; + if ( s->loopsRemaining() && !bucket( s )->stopped ) { + bucket( s )->stopped = TRUE; play( s ); } else { - if ( --( bucket( s ) ->numplaying ) == 0 ) - bucket( s ) ->stopped = TRUE; - inprogress->remove - ( s ); + if ( --( bucket( s )->numplaying ) == 0 ) + bucket( s )->stopped = TRUE; + inprogress->remove( s ); } } } @@ -409,12 +412,12 @@ void QAuServerWin::play( QSound* s ) { if ( wave ) { - ++( bucket( s ) ->numplaying ); - if ( !bucket( s ) ->stopped ) { + ++( bucket( s )->numplaying ); + if ( !bucket( s )->stopped ) { stop( s ); } - bucket( s ) ->stopped = FALSE; + bucket( s )->stopped = FALSE; if ( !inprogress ) inprogress = new QPtrDict<void>; inprogress->insert( s, ( void* ) this ); @@ -436,7 +439,7 @@ void QAuServerWin::stop( QSound* s ) { if ( wave && !bucket( s ) ->stopped ) { - bucket( s ) ->stopped = TRUE; + bucket( s )->stopped = TRUE; /* AuStopFlow(nas, bucket(s)->flow, NULL); AuFlush(nas); @@ -451,7 +454,7 @@ this, SLOT( soundDestroyed( QObject * ) ) ); if ( wv ) delete wv; - wv = new WaveFile( s->fileName() ); + wv = new WaveFile( s->fileName(), s, this ); wv->setVolume( 100 ); setBucket( s, new QAuBucketWin( wv ) ); } |
From: Christian E. <che...@us...> - 2005-07-22 15:41:28
|
Update of /cvsroot/kde-cygwin/qt-3/src/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29055/src/kernel Modified Files: Tag: QT_WIN32_3_3_BRANCH qapplication_win.cpp Log Message: fix translateEraseEvent fix for modal dialogs lost focus 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.86 retrieving revision 1.1.2.30.2.87 diff -u -r1.1.2.30.2.86 -r1.1.2.30.2.87 --- qapplication_win.cpp 21 Jul 2005 15:14:31 -0000 1.1.2.30.2.86 +++ qapplication_win.cpp 22 Jul 2005 15:41:00 -0000 1.1.2.30.2.87 @@ -2283,7 +2283,6 @@ bool QETWidget::translateEraseEvent( const MSG &msg ) { - return FALSE; 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; @@ -2860,11 +2859,10 @@ while ( ( popup = QApplication::activePopupWidget() ) && maxiter-- ) popup->close(); } - qApp->winFocus( widget, LOWORD( wParam ) != WA_INACTIVE ); // Windows tries to activate a modally blocked window. // This happens when restoring an application after "Show Desktop" - if ( app_do_modal && LOWORD( wParam ) == WA_ACTIVE ) { + if ( app_do_modal && LOWORD( wParam ) != WA_INACTIVE ) { QWidget * top = 0; if ( !qt_tryModalHelper( widget, &top ) && top && widget != top ) top->setActiveWindow(); |
From: Holger <hol...@ho...> - 2005-07-21 19:44:46
|
Hi, was the "return false;" below really intended ? regards, Holger On Thursday 21 July 2005 17:14, Christian Ehrlicher wrote: > Update of /cvsroot/kde-cygwin/qt-3/src/kernel > In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9975/src/kernel > > Modified Files: > Tag: QT_WIN32_3_3_BRANCH > qapplication_win.cpp > Log Message: > translateEraseEvent *needs* empty_region... and also doesn't modify it. > > 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.85 > retrieving revision 1.1.2.30.2.86 > diff -u -r1.1.2.30.2.85 -r1.1.2.30.2.86 > --- qapplication_win.cpp 21 Jul 2005 15:06:05 -0000 1.1.2.30.2.85 > +++ qapplication_win.cpp 21 Jul 2005 15:14:31 -0000 1.1.2.30.2.86 > @@ -265,12 +265,12 @@ > > bool translateKeyEvent( MSG msg, bool grab ); > > - bool translateEraseEvent( WPARAM wPAram, LPARAM lParam ); > - bool translatePaintEvent( WPARAM wParam, LPARAM lParam ); > + bool translateEraseEvent( const MSG &msg ); > + bool translatePaintEvent( const MSG &msg ); > bool translateConfigEvent( UINT iMsg, WPARAM wParam, LPARAM lParam ); > bool translateCloseEvent( WPARAM wParam, LPARAM lParam ); > > - bool translateWheelEvent(const MSG &msg); > + bool translateWheelEvent( const MSG &msg ); > > bool invokeWinEvent( MSG* msg ) { return winEvent( msg ); } > > @@ -2281,12 +2281,13 @@ > return FALSE; > } */ > > -bool QETWidget::translateEraseEvent( WPARAM wParam, LPARAM /*lParam*/ ) > +bool QETWidget::translateEraseEvent( const MSG &msg ) > { > - QRegion rgn( 0, 0, 1, 1 ); // otherwise we would pollute empty_region > + return FALSE; ^^^^^^^^^^^^^^^^^^^^^ > + 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; > - hdc = ( HDC ) wParam; > + hdc = ( HDC ) msg.wParam; > qt_erase_region( this, pm, backgroundOffset(), rgn ); > hdc = hdcOld; > /* An application should return nonzero in response to WM_ERASEBKGND > @@ -2294,7 +2295,7 @@ > return TRUE; > } > > -bool QETWidget::translatePaintEvent( WPARAM /*wParam*/, LPARAM /*lParam*/ > ) +bool QETWidget::translatePaintEvent( const MSG &msg ) > { > // XXX: ccj - does not merge paint events like the X11 version > #ifdef DEBUG_QAPPLICATION > @@ -2841,11 +2842,11 @@ > > case WM_ERASEBKGND: > if ( widget ) > - return ( widget->translateEraseEvent( wParam, lParam ) ); > + return ( widget->translateEraseEvent( msg ) ); > break; > case WM_PAINT: > if ( widget ) > - return ( widget->translatePaintEvent( wParam, lParam ) ); > + return ( widget->translatePaintEvent( msg ) ); > break; > case WM_ACTIVATE: > if ( widget ) { > > > > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click > _______________________________________________ > Kde-cygwin--cvs mailing list > Kde...@li... > https://lists.sourceforge.net/lists/listinfo/kde-cygwin--cvs |
From: Christian E. <che...@us...> - 2005-07-21 15:16:08
|
Update of /cvsroot/kde-cygwin/qt-3/src/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9975/src/kernel Modified Files: Tag: QT_WIN32_3_3_BRANCH qapplication_win.cpp Log Message: translateEraseEvent *needs* empty_region... and also doesn't modify it. 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.85 retrieving revision 1.1.2.30.2.86 diff -u -r1.1.2.30.2.85 -r1.1.2.30.2.86 --- qapplication_win.cpp 21 Jul 2005 15:06:05 -0000 1.1.2.30.2.85 +++ qapplication_win.cpp 21 Jul 2005 15:14:31 -0000 1.1.2.30.2.86 @@ -265,12 +265,12 @@ bool translateKeyEvent( MSG msg, bool grab ); - bool translateEraseEvent( WPARAM wPAram, LPARAM lParam ); - bool translatePaintEvent( WPARAM wParam, LPARAM lParam ); + bool translateEraseEvent( const MSG &msg ); + bool translatePaintEvent( const MSG &msg ); bool translateConfigEvent( UINT iMsg, WPARAM wParam, LPARAM lParam ); bool translateCloseEvent( WPARAM wParam, LPARAM lParam ); - bool translateWheelEvent(const MSG &msg); + bool translateWheelEvent( const MSG &msg ); bool invokeWinEvent( MSG* msg ) { return winEvent( msg ); } @@ -2281,12 +2281,13 @@ return FALSE; } */ -bool QETWidget::translateEraseEvent( WPARAM wParam, LPARAM /*lParam*/ ) +bool QETWidget::translateEraseEvent( const MSG &msg ) { - QRegion rgn( 0, 0, 1, 1 ); // otherwise we would pollute empty_region + return FALSE; + 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; - hdc = ( HDC ) wParam; + hdc = ( HDC ) msg.wParam; qt_erase_region( this, pm, backgroundOffset(), rgn ); hdc = hdcOld; /* An application should return nonzero in response to WM_ERASEBKGND @@ -2294,7 +2295,7 @@ return TRUE; } -bool QETWidget::translatePaintEvent( WPARAM /*wParam*/, LPARAM /*lParam*/ ) +bool QETWidget::translatePaintEvent( const MSG &msg ) { // XXX: ccj - does not merge paint events like the X11 version #ifdef DEBUG_QAPPLICATION @@ -2841,11 +2842,11 @@ case WM_ERASEBKGND: if ( widget ) - return ( widget->translateEraseEvent( wParam, lParam ) ); + return ( widget->translateEraseEvent( msg ) ); break; case WM_PAINT: if ( widget ) - return ( widget->translatePaintEvent( wParam, lParam ) ); + return ( widget->translatePaintEvent( msg ) ); break; case WM_ACTIVATE: if ( widget ) { |
From: Christian E. <che...@us...> - 2005-07-21 15:08:44
|
Update of /cvsroot/kde-cygwin/qt-3/src/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8154/src/kernel Modified Files: Tag: QT_WIN32_3_3_BRANCH qapplication_win.cpp Log Message: - mouse events after popups sometimes were not recognized (introduced due my recent mouse event changes) - fix for [ 1089790 ] Marked text rendered incorrectly 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.84 retrieving revision 1.1.2.30.2.85 diff -u -r1.1.2.30.2.84 -r1.1.2.30.2.85 --- qapplication_win.cpp 18 Jul 2005 15:09:31 -0000 1.1.2.30.2.84 +++ qapplication_win.cpp 21 Jul 2005 15:06:05 -0000 1.1.2.30.2.85 @@ -1583,8 +1583,9 @@ // the popup dissappeared. Replay the event QWidget * w = QApplication::widgetAt( gpos.x, gpos.y ); if ( w && !qt_blocked_modal( w ) ) { - if ( QWidget::mouseGrabber() == 0 ) - setAutoCapture( w->winId() ); +// FIXME: this seems not work with qt3... +// if ( QWidget::mouseGrabber() == 0 ) +// setAutoCapture( w->winId() ); POINT widgetpt = gpos; ScreenToClient( w->winId(), &widgetpt ); LPARAM lParam = MAKELPARAM( widgetpt.x, widgetpt.y ); @@ -2282,7 +2283,7 @@ bool QETWidget::translateEraseEvent( WPARAM wParam, LPARAM /*lParam*/ ) { - QRegion rgn; + QRegion rgn( 0, 0, 1, 1 ); // otherwise we would pollute empty_region QPixmap *pm = ( extra ) ? extra->bg_pix : NULL; HDC hdcOld = hdc; hdc = ( HDC ) wParam; @@ -2301,7 +2302,7 @@ #endif PAINTSTRUCT ps; - QRegion paintRegion; + QRegion paintRegion( 0, 0, 1, 1 ); // otherwise we would pollute empty_region GetUpdateRgn ( winid, paintRegion.handle (), FALSE ); HDC hdcOld = hdc; hdc = BeginPaint( winid, &ps ); @@ -2901,7 +2902,7 @@ widget = ( QETWidget* ) w; } - return ( widget->translateMouseEvent( msg ) ); // mouse event + return ( !widget->translateMouseEvent( msg ) ); // mouse event case WM_MOUSELEAVE: // We receive a mouse leave for curWin, meaning // the mouse was moved outside our widgets @@ -3082,13 +3083,13 @@ widget = (QETWidget*)qApp->focusWidget(); HWND focus = ::GetFocus(); if (!widget || (focus && ::IsChild(widget->winId(), focus))) { - result = false; + return TRUE; } else { widget->clearFocus(); - result = true; + return FALSE; } } else { - result = false; + return TRUE; } break; case WM_CAPTURECHANGED: |
From: Christian E. <che...@us...> - 2005-07-18 15:09:41
|
Update of /cvsroot/kde-cygwin/qt-3/src/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22104/src/kernel Modified Files: Tag: QT_WIN32_3_3_BRANCH qapplication_win.cpp Log Message: fix qmousevent (state wasn't set correct which leads to nonfunctional scrollbars) 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.83 retrieving revision 1.1.2.30.2.84 diff -u -r1.1.2.30.2.83 -r1.1.2.30.2.84 --- qapplication_win.cpp 17 Jul 2005 14:26:07 -0000 1.1.2.30.2.83 +++ qapplication_win.cpp 18 Jul 2005 15:09:31 -0000 1.1.2.30.2.84 @@ -1492,8 +1492,7 @@ trackMouseEventLookup = true; ptrTrackMouseEvent = ( PtrTrackMouseEvent ) QLibrary::resolve( "comctl32", "_TrackMouseEvent" ); } - // if (ptrTrackMouseEvent && !qApp->inPopupMode()) { - if ( ptrTrackMouseEvent ) { + if ( ptrTrackMouseEvent && !qApp->inPopupMode() ) { // We always have to set the tracking, since // Windows detects more leaves than we do.. TRACKMOUSEEVENT tme; @@ -1518,6 +1517,12 @@ pos.ry() = curPos.y; // pos = mapFromWS(pos); FIXME! } else { + // this is different to qt4 ... + if ( type == QEvent::MouseButtonRelease ) { + state |= button; + } else { + state &= ~button; + } gpos = msg.pt; pos = mapFromGlobal( QPoint( gpos.x, gpos.y ) ); |
From: Christian E. <che...@us...> - 2005-07-18 15:06:08
|
Update of /cvsroot/kde-cygwin/qt-3/src/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21458/src/kernel Modified Files: Tag: QT_WIN32_3_3_BRANCH qwidget_win.cpp Log Message: fix for QWidget::update() - text is now correctly redrawn (see demo - color test area / date time editors) 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.52 retrieving revision 1.1.2.15.2.53 diff -u -r1.1.2.15.2.52 -r1.1.2.15.2.53 --- qwidget_win.cpp 12 Jul 2005 18:46:49 -0000 1.1.2.15.2.52 +++ qwidget_win.cpp 18 Jul 2005 15:05:59 -0000 1.1.2.15.2.53 @@ -1081,7 +1081,7 @@ void QWidget::update() { if ( isVisible() && isUpdatesEnabled() ) { - InvalidateRect( winId(), 0, false ); + InvalidateRect( winId(), 0, true ); } } @@ -1122,7 +1122,7 @@ r.bottom = crect.height(); else r.bottom = y + h; - InvalidateRect( winId(), &r, false ); + InvalidateRect( winId(), &r, true ); } } |
From: Christian E. <che...@us...> - 2005-07-17 14:26:17
|
Update of /cvsroot/kde-cygwin/qt-3/src/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14195/src/kernel Modified Files: Tag: QT_WIN32_3_3_BRANCH qapplication_win.cpp Log Message: added imm.h 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.82 retrieving revision 1.1.2.30.2.83 diff -u -r1.1.2.30.2.82 -r1.1.2.30.2.83 --- qapplication_win.cpp 17 Jul 2005 14:10:02 -0000 1.1.2.30.2.82 +++ qapplication_win.cpp 17 Jul 2005 14:26:07 -0000 1.1.2.30.2.83 @@ -42,6 +42,7 @@ #include "qplatformdefs.h" #include <windowsx.h> #include <ole2.h> // OleInitialize +#include <imm.h> //#define DEBUG_QAPPLICATION //#define QT_REAL_HARD_DEBUG |
From: Christian E. <che...@us...> - 2005-07-17 14:10:37
|
Update of /cvsroot/kde-cygwin/qt-3/src/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11773/src/kernel Modified Files: Tag: QT_WIN32_3_3_BRANCH qapplication_win.cpp Log Message: huge change in mouse handling (from qt4) cleanup + astyle 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.81 retrieving revision 1.1.2.30.2.82 diff -u -r1.1.2.30.2.81 -r1.1.2.30.2.82 --- qapplication_win.cpp 12 Jul 2005 18:26:54 -0000 1.1.2.30.2.81 +++ qapplication_win.cpp 17 Jul 2005 14:10:02 -0000 1.1.2.30.2.82 @@ -14,13 +14,10 @@ ** Copyright (C) 2004 Peter Kuemmel ** Copyright (C) 2004 Dmitriy Kazimirow ** Copyright (C) 2004, 2005 Christian Ehrlicher +** Copyright (C) 2005 Trolltech AS (parts of the source code are from qt4/gpl) ** ** This file is part of the kernel module of the Qt GUI Toolkit. ** -** This file may be distributed under the terms of the Q Public License -** as defined by Trolltech AS of Norway and appearing in the file -** LICENSE.QPL included in the packaging of this file. -** [...1737 lines suppressed...] } break; case WM_KILLFOCUS: - if ( widget ) { - qDebug("WM_KILLFOCUS for widget 0x%08p. wParam: 0x%08p, lParam: 0x%08p", widget->winId(), wParam, lParam); + if (!QWidget::find((HWND)wParam)) { // we don't get focus, so unset it now + if (!widget->hasFocus()) // work around Windows bug after minimizing/restoring + widget = (QETWidget*)qApp->focusWidget(); + HWND focus = ::GetFocus(); + if (!widget || (focus && ::IsChild(widget->winId(), focus))) { + result = false; + } else { + widget->clearFocus(); + result = true; + } + } else { + result = false; } break; case WM_CAPTURECHANGED: |
From: Christian E. <che...@us...> - 2005-07-17 14:08:56
|
Update of /cvsroot/kde-cygwin/qt-3/src/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11543/src/kernel Modified Files: Tag: QT_WIN32_3_3_BRANCH qeventloop_win.cpp Log Message: qt_app_idle() is no longer used - but don't remove it complet now Index: qeventloop_win.cpp =================================================================== RCS file: /cvsroot/kde-cygwin/qt-3/src/kernel/Attic/qeventloop_win.cpp,v retrieving revision 1.1.2.10.2.20 retrieving revision 1.1.2.10.2.21 diff -u -r1.1.2.10.2.20 -r1.1.2.10.2.21 --- qeventloop_win.cpp 9 Jul 2005 10:16:16 -0000 1.1.2.10.2.20 +++ qeventloop_win.cpp 17 Jul 2005 14:08:44 -0000 1.1.2.10.2.21 @@ -226,7 +226,9 @@ PostMessageA( 0, WM_NULL, 0, 0 ); } -extern bool qt_app_idle(); // qapplication_win.cpp +bool qt_app_idle() { + return true; +} bool QEventLoop::processEvents( ProcessEventsFlags flags ) { |
From: Christian E. <che...@us...> - 2005-07-17 14:08:10
|
Update of /cvsroot/kde-cygwin/qt-3/src/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11428/src/widgets Modified Files: Tag: QT_WIN32_3_3_BRANCH qcombobox.cpp Log Message: removed last change Index: qcombobox.cpp =================================================================== RCS file: /cvsroot/kde-cygwin/qt-3/src/widgets/qcombobox.cpp,v retrieving revision 1.1.1.14 retrieving revision 1.1.1.15 diff -u -r1.1.1.14 -r1.1.1.15 --- qcombobox.cpp 11 Jun 2005 16:13:20 -0000 1.1.1.14 +++ qcombobox.cpp 17 Jul 2005 14:07:59 -0000 1.1.1.15 @@ -1803,9 +1803,7 @@ if ( !d->listBox()->rect().contains( e->pos() ) ) { QPoint globalPos = d->listBox()->mapToGlobal(e->pos()); if ( QApplication::widgetAt( globalPos, TRUE ) == this ) { -// CE: comented this out - see bug #1218822 for this -// d->discardNextMousePress = TRUE; - // avoid popping up again + d->discardNextMousePress = TRUE; } popDownListBox(); return TRUE; |
From: Christian E. <che...@us...> - 2005-07-15 14:17:25
|
Update of /cvsroot/kde-cygwin/qt-3/src/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5654/src/tools Modified Files: Tag: QT_WIN32_3_3_BRANCH qdir_win.cpp Log Message: added unicode support for QDir::mkdir & rmdir astyle'd Index: qdir_win.cpp =================================================================== RCS file: /cvsroot/kde-cygwin/qt-3/src/tools/Attic/qdir_win.cpp,v retrieving revision 1.1.2.9.2.18 retrieving revision 1.1.2.9.2.19 diff -u -r1.1.2.9.2.18 -r1.1.2.9.2.19 --- qdir_win.cpp 15 Jul 2005 11:40:24 -0000 1.1.2.9.2.18 +++ qdir_win.cpp 15 Jul 2005 14:17:13 -0000 1.1.2.9.2.19 @@ -118,12 +118,20 @@ bool QDir::mkdir( const QString &dirName, bool acceptAbsPath ) const { - return QT_MKDIR( QFile::encodeName( filePath( dirName, acceptAbsPath ) ) ) == 0; + QT_WA( + return _wmkdir( ( LPCWSTR ) filePath( dirName, acceptAbsPath ).ucs2() ) == 0; + , + return _mkdir( QFile::encodeName( filePath( dirName, acceptAbsPath ) ) ) == 0; + ); } bool QDir::rmdir( const QString &dirName, bool acceptAbsPath ) const { - return QT_RMDIR( QFile::encodeName( filePath( dirName, acceptAbsPath ) ) ) == 0; + QT_WA( + return _wrmdir( ( LPCWSTR ) filePath( dirName, acceptAbsPath ).ucs2() ) == 0; + , + return _rmdir( QFile::encodeName( filePath( dirName, acceptAbsPath ) ) ) == 0; + ); } bool QDir::isReadable() const @@ -153,50 +161,52 @@ } QString fn1 = filePath( name, acceptAbsPaths ); QString fn2 = filePath( newName, acceptAbsPaths ); - return ::rename( QFile::encodeName( fn1 ), - QFile::encodeName( fn2 ) ) == 0; + QT_WA( + return MoveFileW( ( LPCWSTR ) fn1.ucs2(), ( LPCWSTR ) fn2.ucs2() ) != 0; + , + return MoveFileA( QFile::encodeName( fn1 ), QFile::encodeName( fn2 ) ) != 0; + ); } bool QDir::setCurrent( const QString &path ) { - if (!QDir(path).exists()) + if ( !QDir( path ).exists() ) return false; - int r; - QT_WA({ - r = SetCurrentDirectoryW( ( LPCWSTR ) path.ucs2() ); - } , { - r = SetCurrentDirectoryA( QFile::encodeName( path.local8Bit() ) ); - }); - return r >= 0; + QT_WA( + return ( SetCurrentDirectoryW( ( LPCWSTR ) path.ucs2() ) >= 0 ); + , + return ( SetCurrentDirectoryA( QFile::encodeName( path ) ) >= 0 ); + ); } QString QDir::currentDirPath() { QString ret; - QT_WA({ - DWORD size = 0; - WCHAR currentName[PATH_MAX]; - size = ::GetCurrentDirectoryW(PATH_MAX, currentName); - if (size !=0) { - if (size > PATH_MAX) { - WCHAR * newCurrentName = new WCHAR[size]; - if (::GetCurrentDirectoryW(PATH_MAX, newCurrentName) != 0) - ret = QString::fromUcs2((ushort*)newCurrentName); - delete [] newCurrentName; - } else { - ret = QString::fromUcs2((ushort*)currentName); - } - } - } , { - DWORD size = 0; - char currentName[PATH_MAX]; - size = ::GetCurrentDirectoryA(PATH_MAX, currentName); - if (size !=0) - ret = QString::fromLocal8Bit(currentName); - }); - if (ret.length() >= 2 && ret[1] == ':') - ret[0] = ret.at(0).upper(); // Force uppercase drive letters. + QT_WA( { + DWORD size = 0; + WCHAR currentName[ PATH_MAX ]; + size = ::GetCurrentDirectoryW( PATH_MAX, currentName ); + if ( size != 0 ) { + if ( size > PATH_MAX ) { + WCHAR * newCurrentName = new WCHAR[ size ]; + if ( ::GetCurrentDirectoryW( PATH_MAX, newCurrentName ) != 0 ) + ret = QString::fromUcs2( ( ushort* ) newCurrentName ); + delete [] newCurrentName; + } else { + ret = QString::fromUcs2( ( ushort* ) currentName ); + } + } + } , { + DWORD size = 0; + char currentName[ PATH_MAX ]; + size = ::GetCurrentDirectoryA( PATH_MAX, currentName ); + if ( size != 0 ) + ret = QString::fromLocal8Bit( currentName ); + } ) + ; + if ( ret.length() >= 2 && ret[ 1 ] == ':' ) + ret[ 0 ] = ret.at( 0 ).upper(); // Force uppercase drive letters. slashify( ret ); return ret; } @@ -257,11 +267,11 @@ bool doWritable = ( filterSpec & QDir::Writable ) != 0; bool doExecable = ( filterSpec & QDir::Executable ) != 0; bool doModified = ( filterSpec & QDir::Modified ) != 0; - bool doHidden = ( filterSpec & QDir::Hidden ) != 0; - bool doSystem = ( filterSpec & QDir::System ) != 0; + bool doHidden = ( filterSpec & QDir::Hidden ) != 0; + bool doSystem = ( filterSpec & QDir::System ) != 0; // show hidden files if the user asks explicitly for e.g. .* - if(!doHidden && !nameFilter.length()) { - if(nameFilter[0] == '.') { + if ( !doHidden && !nameFilter.length() ) { + if ( nameFilter[ 0 ] == '.' ) { doHidden = true; } } @@ -273,8 +283,8 @@ QString path; // work around a bug whel an url was given but be aware of unc-paths ! - if ( ( winpath[0] == '\\' ) && ( winpath[1] != '\\' ) ) - winpath = rootDirPath() + winpath; + if ( ( winpath[ 0 ] == '\\' ) && ( winpath[ 1 ] != '\\' ) ) + winpath = rootDirPath() + winpath; if ( winpath.isEmpty() ) { #if defined(CHECK_NULL) @@ -291,7 +301,7 @@ winpath += "*.*"; // from qt4: Cast is safe, since char is at end of WIN32_FIND_DATA handle = QT_WA_INLINE( FindFirstFileW ( ( LPCWSTR ) winpath.ucs2(), &finfo ), - FindFirstFileA ( QFile::encodeName( winpath ), (WIN32_FIND_DATAA*)&finfo ) ); + FindFirstFileA ( QFile::encodeName( winpath ), ( WIN32_FIND_DATAA* ) & finfo ) ); DWORD lasterr = GetLastError (); if ( handle == INVALID_HANDLE_VALUE && ( lasterr != ERROR_NO_MORE_FILES ) ) { #if defined(CHECK_NULL) @@ -302,50 +312,50 @@ return FALSE; } do { - QString fn = QT_WA_INLINE ( QString::fromUcs2( ( const unsigned short*) finfo.cFileName ), - QFile::decodeName( ( const char *) finfo.cFileName ) ); + QString fn = QT_WA_INLINE ( QString::fromUcs2( ( const unsigned short* ) finfo.cFileName ), + QFile::decodeName( ( const char * ) finfo.cFileName ) ); if ( finfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY ) { /* remove .lnk suffix in case of symlinks */ fn.remove( ".lnk$" ); } - int attrib = finfo.dwFileAttributes; + int attrib = finfo.dwFileAttributes; - bool isDir = (attrib & IS_SUBDIR) != 0; + bool isDir = ( attrib & IS_SUBDIR ) != 0; bool isFile = !isDir; bool isSymLink = false; bool isReadable = true; - bool isWritable = (attrib & IS_RDONLY) == 0; + bool isWritable = ( attrib & IS_RDONLY ) == 0; bool isExecable = false; - bool isModified = (attrib & IS_ARCH) != 0; - bool isHidden = (attrib & IS_HIDDEN) != 0; - bool isSystem = (attrib & IS_SYSTEM) != 0; + bool isModified = ( attrib & IS_ARCH ) != 0; + bool isHidden = ( attrib & IS_HIDDEN ) != 0; + bool isSystem = ( attrib & IS_SYSTEM ) != 0; if ( !qt_matchFilterList( filters, fn ) && !( allDirs && isDir ) ) continue; if ( ( doDirs && isDir ) || ( doFiles && isFile ) ) { - if( doExecable ) { + if ( doExecable ) { QString ext = fn.right( 4 ).lower(); - if( ext == ".exe" || ext == ".com" || ext == ".bat" || - ext == ".pif" || ext == ".cmd" || isDir ) + if ( ext == ".exe" || ext == ".com" || ext == ".bat" || + ext == ".pif" || ext == ".cmd" || isDir ) isExecable = true; } if ( noSymLinks && isSymLink ) continue; if ( ( filterSpec & RWEMask ) != 0 ) if ( ( doReadable && !isReadable ) || - ( doWritable && !isWritable ) || - ( doExecable && !isExecable ) ) + ( doWritable && !isWritable ) || + ( doExecable && !isExecable ) ) continue; - if( doModified && !isModified ) + if ( doModified && !isModified ) continue; - if( !doHidden && isHidden ) + if ( !doHidden && isHidden ) continue; - if( !doSystem && isSystem ) + if ( !doSystem && isSystem ) continue; fiList->append( new QFileInfo( path + fn ) ); } } while ( QT_WA_INLINE( FindNextFileW ( handle, &finfo ), - FindNextFileA ( handle, (WIN32_FIND_DATAA*)&finfo ) ) ); + FindNextFileA ( handle, ( WIN32_FIND_DATAA* ) & finfo ) ) ); lasterr = GetLastError (); FindClose ( handle ); @@ -430,7 +440,7 @@ for ( QFileInfo * fi = knownMemoryLeak->first(); fi; fi = knownMemoryLeak->next() ) delete fi; delete knownMemoryLeak; - } + } } #endif //QT_NO_DIR |
From: Christian E. <che...@us...> - 2005-07-15 11:40:34
|
Update of /cvsroot/kde-cygwin/qt-3/src/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8324/src/tools Modified Files: Tag: QT_WIN32_3_3_BRANCH qdir_win.cpp Log Message: next try for QDir::readDirEntries() ;-) Index: qdir_win.cpp =================================================================== RCS file: /cvsroot/kde-cygwin/qt-3/src/tools/Attic/qdir_win.cpp,v retrieving revision 1.1.2.9.2.17 retrieving revision 1.1.2.9.2.18 diff -u -r1.1.2.9.2.17 -r1.1.2.9.2.18 --- qdir_win.cpp 12 Jul 2005 18:46:50 -0000 1.1.2.9.2.17 +++ qdir_win.cpp 15 Jul 2005 11:40:24 -0000 1.1.2.9.2.18 @@ -173,27 +173,32 @@ QString QDir::currentDirPath() { - QString result; - - QT_STATBUF st; - if ( QT_STAT( ".", &st ) == 0 ) { - char currentName[ PATH_MAX ]; - if ( QT_GETCWD( currentName, PATH_MAX ) != 0 ) - result = QFile::decodeName( currentName ); -#if defined(QT_DEBUG) - - if ( result.isNull() ) - qWarning( "QDir::currentDirPath: getcwd() failed" ); -#endif - - } else { -#if defined(QT_DEBUG) - qWarning( "QDir::currentDirPath: stat(\".\") failed" ); -#endif - - } - slashify( result ); - return result; + QString ret; + QT_WA({ + DWORD size = 0; + WCHAR currentName[PATH_MAX]; + size = ::GetCurrentDirectoryW(PATH_MAX, currentName); + if (size !=0) { + if (size > PATH_MAX) { + WCHAR * newCurrentName = new WCHAR[size]; + if (::GetCurrentDirectoryW(PATH_MAX, newCurrentName) != 0) + ret = QString::fromUcs2((ushort*)newCurrentName); + delete [] newCurrentName; + } else { + ret = QString::fromUcs2((ushort*)currentName); + } + } + } , { + DWORD size = 0; + char currentName[PATH_MAX]; + size = ::GetCurrentDirectoryA(PATH_MAX, currentName); + if (size !=0) + ret = QString::fromLocal8Bit(currentName); + }); + if (ret.length() >= 2 && ret[1] == ':') + ret[0] = ret.at(0).upper(); // Force uppercase drive letters. + slashify( ret ); + return ret; } QString QDir::rootDirPath() @@ -337,7 +342,7 @@ continue; if( !doSystem && isSystem ) continue; - fiList->append( new QFileInfo( fn ) ); + fiList->append( new QFileInfo( path + fn ) ); } } while ( QT_WA_INLINE( FindNextFileW ( handle, &finfo ), FindNextFileA ( handle, (WIN32_FIND_DATAA*)&finfo ) ) ); |
From: Christian E. <che...@us...> - 2005-07-14 19:44:58
|
Update of /cvsroot/kde-cygwin/qt-3/src/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27624/src/kernel Modified Files: Tag: QT_WIN32_3_3_BRANCH qsound_win.cpp Log Message: small changes Index: qsound_win.cpp =================================================================== RCS file: /cvsroot/kde-cygwin/qt-3/src/kernel/Attic/qsound_win.cpp,v retrieving revision 1.1.2.8.2.7 retrieving revision 1.1.2.8.2.8 diff -u -r1.1.2.8.2.7 -r1.1.2.8.2.8 --- qsound_win.cpp 18 Dec 2004 13:54:36 -0000 1.1.2.8.2.7 +++ qsound_win.cpp 14 Jul 2005 19:44:47 -0000 1.1.2.8.2.8 @@ -124,7 +124,7 @@ class PlayObject { public: - PlayObject( WaveFile *_parent, int _count = 1 ) + PlayObject( WaveFile *_parent, int _count = 0 ) { counter = _count; parent = _parent; @@ -145,7 +145,7 @@ } inline bool isloop() { - return counter = -1; + return counter == -1; } inline void stop() { @@ -218,7 +218,7 @@ case WOM_DONE: { WAVEHDR *whdr = ( WAVEHDR* ) dwParam1; PlayObject *obj = ( PlayObject * ) whdr->dwUser; - if ( obj->count( -1 ) >= 0 ) + if ( obj->count( -1 ) > 0 ) waveOutWrite( hwo, whdr, sizeof( WAVEHDR ) ); else { waveOutUnprepareHeader( hwo, whdr, sizeof( WAVEHDR ) ); |
From: Christian E. <che...@us...> - 2005-07-12 18:46:59
|
Update of /cvsroot/kde-cygwin/qt-3/src/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31334/src/tools Modified Files: Tag: QT_WIN32_3_3_BRANCH qdir_win.cpp Log Message: fix for mingw compile errors Index: qdir_win.cpp =================================================================== RCS file: /cvsroot/kde-cygwin/qt-3/src/tools/Attic/qdir_win.cpp,v retrieving revision 1.1.2.9.2.16 retrieving revision 1.1.2.9.2.17 diff -u -r1.1.2.9.2.16 -r1.1.2.9.2.17 --- qdir_win.cpp 12 Jul 2005 18:24:22 -0000 1.1.2.9.2.16 +++ qdir_win.cpp 12 Jul 2005 18:46:50 -0000 1.1.2.9.2.17 @@ -297,8 +297,8 @@ return FALSE; } do { - QString fn = QT_WA_INLINE ( QString::fromUcs2( ( LPCWSTR )finfo.cFileName ), - QFile::decodeName( ( LPCSTR )finfo.cFileName ) ); + QString fn = QT_WA_INLINE ( QString::fromUcs2( ( const unsigned short*) finfo.cFileName ), + QFile::decodeName( ( const char *) finfo.cFileName ) ); if ( finfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY ) { /* remove .lnk suffix in case of symlinks */ fn.remove( ".lnk$" ); |
From: Christian E. <che...@us...> - 2005-07-12 18:46:59
|
Update of /cvsroot/kde-cygwin/qt-3/src/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31334/src/kernel Modified Files: Tag: QT_WIN32_3_3_BRANCH qwidget_win.cpp Log Message: fix for mingw compile errors 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.51 retrieving revision 1.1.2.15.2.52 diff -u -r1.1.2.15.2.51 -r1.1.2.15.2.52 --- qwidget_win.cpp 12 Jul 2005 18:27:01 -0000 1.1.2.15.2.51 +++ qwidget_win.cpp 12 Jul 2005 18:46:49 -0000 1.1.2.15.2.52 @@ -262,7 +262,7 @@ QT_WA({ id = CreateWindowEx(dwExtStyle, L"QWidget", - caption().ucs2(), + ( LPCWSTR )caption().ucs2(), dwStyle, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, @@ -273,7 +273,7 @@ } , { id = CreateWindowExA(dwExtStyle, "QWidget", - caption().latin1(), + ( LPCSTR )caption().latin1(), dwStyle, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, @@ -293,7 +293,7 @@ QT_WA({ id = CreateWindowEx(dwExtStyle, L"QWidget", - caption().ucs2(), + ( LPCWSTR )caption().ucs2(), dwStyle, 0, 0, 100, 30, @@ -304,7 +304,7 @@ } , { id = CreateWindowExA(dwExtStyle, "QWidget", - caption().latin1(), + ( LPCSTR ) caption().latin1(), dwStyle, 0, 0, 100, 30, |
From: Christian E. <che...@us...> - 2005-07-12 18:27:11
|
Update of /cvsroot/kde-cygwin/qt-3/src/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22472/src/kernel Modified Files: Tag: QT_WIN32_3_3_BRANCH qapplication_win.cpp qpainter_win.cpp qregion_win.cpp qwidget_win.cpp Log Message: small fix (qdirview crashed because of empty_region == NULL) qt_erase_region doesn't need HDC! 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.80 retrieving revision 1.1.2.30.2.81 diff -u -r1.1.2.30.2.80 -r1.1.2.30.2.81 --- qapplication_win.cpp 10 Jul 2005 13:13:38 -0000 1.1.2.30.2.80 +++ qapplication_win.cpp 12 Jul 2005 18:26:54 -0000 1.1.2.30.2.81 @@ -103,7 +103,7 @@ LRESULT CALLBACK qt_window_procedure ( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); // defined in qpainter_win.cpp -void qt_erase_region( HDC hdc, QWidget *w, QPixmap *pm, QPoint ofs, const QRegion ® ); // for QETWidget::translatePaintEvent & translateEraseEvent +void qt_erase_region( QWidget *w, QPixmap *pm, QPoint ofs, const QRegion ® ); // for QETWidget::translatePaintEvent & translateEraseEvent // defined in qeventloop_win.cpp bool winPeekMessage(MSG* msg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg); // defined in qwidget_win.cpp @@ -2329,7 +2329,10 @@ { QRegion rgn; QPixmap *pm = ( extra ) ? extra->bg_pix : NULL; - qt_erase_region( (HDC)wParam, this, pm, backgroundOffset(), rgn ); + HDC hdcOld = hdc; + hdc = ( HDC ) wParam; + qt_erase_region( this, pm, backgroundOffset(), rgn ); + hdc = hdcOld; /* An application should return nonzero in response to WM_ERASEBKGND if it processes the message and erases the background */ return TRUE; @@ -2355,7 +2358,7 @@ if ( ps.fErase ) { /* We should never get into here since this is handled in QETWidget::translateEraseEvent */ QPixmap *pm = ( extra ) ? extra->bg_pix : NULL; - qt_erase_region( hdc, this, pm, backgroundOffset(), paintRegion ); + qt_erase_region( this, pm, backgroundOffset(), paintRegion ); } // There is no need to set a clipRegion since the hdc we get from beginPaint already // has the correct clip regions set Index: qpainter_win.cpp =================================================================== RCS file: /cvsroot/kde-cygwin/qt-3/src/kernel/Attic/qpainter_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 --- qpainter_win.cpp 17 Jun 2005 13:20:29 -0000 1.1.2.15.2.54 +++ qpainter_win.cpp 12 Jul 2005 18:26:55 -0000 1.1.2.15.2.55 @@ -156,14 +156,14 @@ } // pm -> extra && extra->bg_pix && !extra->bg_pix -void qt_erase_region( HDC hdc, QWidget *w, QPixmap *pm, QPoint ofs, const QRegion &rgn ) +void qt_erase_region( QWidget *w, QPixmap *pm, QPoint ofs, const QRegion &rgn ) { RECT r; if ( !w ) return ; HWND hWnd = w->winId(); - int prevRop = SetROP2( hdc, R2_COPYPEN ); + int prevRop = SetROP2( w->handle(), R2_COPYPEN ); if ( pm && !pm->isNull() ) { GetClientRect( hWnd, &r ); QRect rr ( QPoint( r.left, r.top ), QPoint( r.right, r.bottom ) ); @@ -230,13 +230,13 @@ HBRUSH brush = CreateSolidBrush( RGB( bg_col.red(), bg_col.green(), bg_col.blue() ) ); if ( rgn.isEmpty() ) { GetClientRect( hWnd, &r ); - FillRect( hdc, &r, brush ); + FillRect( w->handle(), &r, brush ); } else { - FillRgn( hdc, rgn.handle(), brush ); + FillRgn( w->handle(), rgn.handle(), brush ); } DeleteObject( brush ); } - SetROP2( hdc, prevRop ); + SetROP2( w->handle(), prevRop ); } /***************************************************************************** Index: qregion_win.cpp =================================================================== RCS file: /cvsroot/kde-cygwin/qt-3/src/kernel/Attic/qregion_win.cpp,v retrieving revision 1.1.2.7.2.12 retrieving revision 1.1.2.7.2.13 diff -u -r1.1.2.7.2.12 -r1.1.2.7.2.13 --- qregion_win.cpp 8 Jul 2005 15:01:45 -0000 1.1.2.7.2.12 +++ qregion_win.cpp 12 Jul 2005 18:27:01 -0000 1.1.2.7.2.13 @@ -61,10 +61,9 @@ qDebug( "QRegion::QRegion()" ); #endif - if ( !empty_region ) { // avoid too many allocs + if ( !empty_region ) { qAddPostRoutine( cleanup_empty_region ); empty_region = new QRegion( TRUE ); - CHECK_PTR( empty_region ); } data = empty_region->data; data->ref(); @@ -335,6 +334,10 @@ bool QRegion::isEmpty() const { + if (!empty_region) { + QRegion rgn; + } + return data == empty_region->data || data->rgn == 0; } 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.50 retrieving revision 1.1.2.15.2.51 diff -u -r1.1.2.15.2.50 -r1.1.2.15.2.51 --- qwidget_win.cpp 10 Jul 2005 13:13:40 -0000 1.1.2.15.2.50 +++ qwidget_win.cpp 12 Jul 2005 18:27:01 -0000 1.1.2.15.2.51 @@ -51,7 +51,7 @@ //#define DEBUG_QWIDGET // defined in qpainter_win.cpp -void qt_erase_region( HDC hdc, QWidget *w, QPixmap *pm, QPoint ofs, const QRegion ® ); // QWidget::erase() +void qt_erase_region( QWidget *w, QPixmap *pm, QPoint ofs, const QRegion ® ); // QWidget::erase() // defined in qregion_win.cpp HRGN QBitmapToHRGN( const QBitmap& bm ); // QWidget::setMask( QBitmap ) // defined in qdnd_win.cpp @@ -1727,7 +1727,7 @@ setWFlags( WPaintUnclipped ); QPixmap *pm = ( extra ) ? extra->bg_pix : NULL; - qt_erase_region( hdc, this, pm, backgroundOffset(), reg ); + qt_erase_region( this, pm, backgroundOffset(), reg ); } |
From: Christian E. <che...@us...> - 2005-07-12 18:24:33
|
Update of /cvsroot/kde-cygwin/qt-3/src/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21373/src/tools Modified Files: Tag: QT_WIN32_3_3_BRANCH qdir_win.cpp Log Message: fix for unc paths + some backport from qt4 Index: qdir_win.cpp =================================================================== RCS file: /cvsroot/kde-cygwin/qt-3/src/tools/Attic/qdir_win.cpp,v retrieving revision 1.1.2.9.2.15 retrieving revision 1.1.2.9.2.16 diff -u -r1.1.2.9.2.15 -r1.1.2.9.2.16 --- qdir_win.cpp 15 Jan 2005 18:48:33 -0000 1.1.2.9.2.15 +++ qdir_win.cpp 12 Jul 2005 18:24:22 -0000 1.1.2.9.2.16 @@ -159,10 +159,16 @@ bool QDir::setCurrent( const QString &path ) { - QString my_path = path; - if ( ( my_path[ 0 ] == '\\' ) || ( my_path[ 0 ] == '/' ) ) - my_path = rootDirPath() + my_path.mid( 1 ); - return QT_CHDIR( QFile::encodeName( my_path ) ) >= 0; + if (!QDir(path).exists()) + return false; + + int r; + QT_WA({ + r = SetCurrentDirectoryW( ( LPCWSTR ) path.ucs2() ); + } , { + r = SetCurrentDirectoryA( QFile::encodeName( path.local8Bit() ) ); + }); + return r >= 0; } QString QDir::currentDirPath() @@ -209,10 +215,21 @@ return ( ( path[ p ] != '/' ) && ( path[ p ] != '\\' ) ); } +#undef IS_SUBDIR +#undef IS_RDONLY +#undef IS_ARCH +#undef IS_HIDDEN +#undef IS_SYSTEM +#undef FF_ERROR + +#define IS_SUBDIR FILE_ATTRIBUTE_DIRECTORY +#define IS_RDONLY FILE_ATTRIBUTE_READONLY +#define IS_ARCH FILE_ATTRIBUTE_ARCHIVE +#define IS_HIDDEN FILE_ATTRIBUTE_HIDDEN +#define IS_SYSTEM FILE_ATTRIBUTE_SYSTEM bool QDir::readDirEntries( const QString &nameFilter, int filterSpec, int sortSpec ) { - int i; if ( !fList ) { fList = new QStringList; Q_CHECK_PTR( fList ); @@ -228,24 +245,30 @@ QValueList<QRegExp> filters = qt_makeFilterList( nameFilter ); - bool doDirs = ( filterSpec & Dirs ) != 0; - bool doFiles = ( filterSpec & Files ) != 0; - bool noSymLinks = ( filterSpec & NoSymLinks ) != 0; - bool doReadable = ( filterSpec & Readable ) != 0; - bool doWritable = ( filterSpec & Writable ) != 0; - bool doExecable = ( filterSpec & Executable ) != 0; - bool doHidden = ( filterSpec & Hidden ) != 0; - bool doSystem = ( filterSpec & System ) != 0; + bool doDirs = ( ( filterSpec & QDir::Dirs ) != 0 || allDirs ); + bool doFiles = ( filterSpec & QDir::Files ) != 0; + bool noSymLinks = ( filterSpec & QDir::NoSymLinks ) != 0; + bool doReadable = ( filterSpec & QDir::Readable ) != 0; + bool doWritable = ( filterSpec & QDir::Writable ) != 0; + bool doExecable = ( filterSpec & QDir::Executable ) != 0; + bool doModified = ( filterSpec & QDir::Modified ) != 0; + bool doHidden = ( filterSpec & QDir::Hidden ) != 0; + bool doSystem = ( filterSpec & QDir::System ) != 0; + // show hidden files if the user asks explicitly for e.g. .* + if(!doHidden && !nameFilter.length()) { + if(nameFilter[0] == '.') { + doHidden = true; + } + } - QFileInfo fi; HANDLE handle; - WIN32_FIND_DATAA ep_a; - WIN32_FIND_DATAW ep_w; + WIN32_FIND_DATAW finfo; QString winpath = dPath.replace( "/", "\\" ); QString path; - if ( winpath.left( 1 ) == "\\" ) + // work around a bug whel an url was given but be aware of unc-paths ! + if ( ( winpath[0] == '\\' ) && ( winpath[1] != '\\' ) ) winpath = rootDirPath() + winpath; if ( winpath.isEmpty() ) { @@ -261,8 +284,9 @@ winpath += "\\"; path = winpath; winpath += "*.*"; - handle = QT_WA_INLINE( FindFirstFileW ( ( LPCWSTR ) winpath.ucs2(), &ep_w ), - FindFirstFileA ( QFile::encodeName( winpath ), &ep_a ) ); + // from qt4: Cast is safe, since char is at end of WIN32_FIND_DATA + handle = QT_WA_INLINE( FindFirstFileW ( ( LPCWSTR ) winpath.ucs2(), &finfo ), + FindFirstFileA ( QFile::encodeName( winpath ), (WIN32_FIND_DATAA*)&finfo ) ); DWORD lasterr = GetLastError (); if ( handle == INVALID_HANDLE_VALUE && ( lasterr != ERROR_NO_MORE_FILES ) ) { #if defined(CHECK_NULL) @@ -273,31 +297,50 @@ return FALSE; } do { - QString fn = QT_WA_INLINE ( qt_winQString ( ep_w.cFileName ), - QFile::decodeName( ( ep_a.cFileName ) ) ); - if ( ( QT_WA_INLINE( ep_w.dwFileAttributes, ep_a.dwFileAttributes ) ) & FILE_ATTRIBUTE_READONLY ) { + QString fn = QT_WA_INLINE ( QString::fromUcs2( ( LPCWSTR )finfo.cFileName ), + QFile::decodeName( ( LPCSTR )finfo.cFileName ) ); + if ( finfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY ) { /* remove .lnk suffix in case of symlinks */ fn.remove( ".lnk$" ); } - fi.setFile( *this, path + fn ); - if ( !qt_matchFilterList( filters, fn ) && !( allDirs && fi.isDir() ) ) + int attrib = finfo.dwFileAttributes; + + bool isDir = (attrib & IS_SUBDIR) != 0; + bool isFile = !isDir; + bool isSymLink = false; + bool isReadable = true; + bool isWritable = (attrib & IS_RDONLY) == 0; + bool isExecable = false; + bool isModified = (attrib & IS_ARCH) != 0; + bool isHidden = (attrib & IS_HIDDEN) != 0; + bool isSystem = (attrib & IS_SYSTEM) != 0; + + if ( !qt_matchFilterList( filters, fn ) && !( allDirs && isDir ) ) continue; - if ( ( doDirs && fi.isDir() ) || ( doFiles && fi.isFile() ) ) { - if ( noSymLinks && fi.isSymLink() ) + if ( ( doDirs && isDir ) || ( doFiles && isFile ) ) { + if( doExecable ) { + QString ext = fn.right( 4 ).lower(); + if( ext == ".exe" || ext == ".com" || ext == ".bat" || + ext == ".pif" || ext == ".cmd" || isDir ) + isExecable = true; + } + if ( noSymLinks && isSymLink ) continue; if ( ( filterSpec & RWEMask ) != 0 ) - if ( ( doReadable && !fi.isReadable() ) || - ( doWritable && !fi.isWritable() ) || - ( doExecable && !fi.isExecutable() ) ) + if ( ( doReadable && !isReadable ) || + ( doWritable && !isWritable ) || + ( doExecable && !isExecable ) ) continue; - if ( !doHidden && fi.isHidden() && - ( fn != QString::fromLatin1( "." ) ) && - ( fn != QString::fromLatin1( ".." ) ) ) + if( doModified && !isModified ) + continue; + if( !doHidden && isHidden ) continue; - fiList->append( new QFileInfo( fi ) ); + if( !doSystem && isSystem ) + continue; + fiList->append( new QFileInfo( fn ) ); } - } while ( QT_WA_INLINE( FindNextFileW ( handle, &ep_w ), - FindNextFileA ( handle, &ep_a ) ) ); + } while ( QT_WA_INLINE( FindNextFileW ( handle, &finfo ), + FindNextFileA ( handle, (WIN32_FIND_DATAA*)&finfo ) ) ); lasterr = GetLastError (); FindClose ( handle ); @@ -310,6 +353,7 @@ } // Sort... + int i; if ( fiList->count() ) { QDirSortItem * si = new QDirSortItem[ fiList->count() ]; QFileInfo* itm; @@ -337,6 +381,12 @@ dirty = TRUE; return TRUE; } +#undef IS_SUBDIR +#undef IS_RDONLY +#undef IS_ARCH +#undef IS_HIDDEN +#undef IS_SYSTEM +#undef FF_ERROR // at most one instance of QFileInfoList is leaked, and this variable // points to that list |
From: Christian E. <che...@us...> - 2005-07-10 13:13:51
|
Update of /cvsroot/kde-cygwin/qt-3/src/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28350/src/kernel Modified Files: Tag: QT_WIN32_3_3_BRANCH qapplication_win.cpp qwidget_win.cpp Log Message: fix compile errors 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.79 retrieving revision 1.1.2.30.2.80 diff -u -r1.1.2.30.2.79 -r1.1.2.30.2.80 --- qapplication_win.cpp 10 Jul 2005 10:42:42 -0000 1.1.2.30.2.79 +++ qapplication_win.cpp 10 Jul 2005 13:13:38 -0000 1.1.2.30.2.80 @@ -106,6 +106,8 @@ void qt_erase_region( HDC hdc, QWidget *w, QPixmap *pm, QPoint ofs, const QRegion ® ); // for QETWidget::translatePaintEvent & translateEraseEvent // defined in qeventloop_win.cpp bool winPeekMessage(MSG* msg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg); +// defined in qwidget_win.cpp +extern QCursor *qt_grab_cursor(); /***************************************************************************** Internal variables and functions @@ -192,7 +194,7 @@ #endif static QTextCodec * input_mapper = 0; -bool qt_try_modal( QWidget *w, UINT uMsg, WPARAM wParam ); +static bool qt_try_modal( QWidget *widget, MSG *msg, int& ret ); int qt_ncols_option = 216; // used in qcolor_x11.cpp int qt_visual_option = -1; @@ -237,11 +239,6 @@ //void qt_x11_intern_atom( const char *, Atom * ); -Q_EXPORT char const *qAppFileName() -{ - return appFileName; -} - inline QString getVersionString() { return QString::number( ( QT_VERSION >> 16 ) & 0xff ) @@ -1167,97 +1164,63 @@ } } -bool qt_try_modal( QWidget *widget, UINT uMsg, WPARAM wParam ) +bool qt_try_modal( QWidget *widget, MSG *msg, int& ret ) { -/* if (qt_xdnd_dragging) { - // allow mouse events while DnD is active - switch (event->type) { - case ButtonPress: - case ButtonRelease: - case MotionNotify: - return TRUE; - default: - break; - } - } -*/ - if ( qt_tryModalHelper( widget ) ) + QWidget *top = 0; + + if ( qt_tryModalHelper( widget, &top ) ) return TRUE; - switch ( uMsg ) { - case WM_ACTIVATE: - if ( wParam != WA_INACTIVE ) { -#ifdef DEBUG_QAPPLICATION - qDebug("qt_try_modal - WM_ACTIVATE: winid: %d wParam: %d", - qt_modal_stack->first()->winId(), wParam ); - qt_modal_stack->first()->setFocus(); + int type = msg->message; + + bool block_event = false; +#ifndef Q_OS_TEMP + if (type == WM_NCHITTEST) { + block_event = true; + } else +#endif + if ((type >= WM_MOUSEFIRST && type <= WM_MOUSELAST) || +// type == WM_MOUSEWHEEL || type == (int)WM95_MOUSEWHEEL || + type == WM_MOUSEWHEEL || + type == WM_MOUSELEAVE || + (type >= WM_KEYFIRST && type <= WM_KEYLAST) +#ifndef Q_OS_TEMP + || type == WM_NCMOUSEMOVE #endif - return false; - } - return true; - case WM_ACTIVATEAPP: - case WM_NCACTIVATE: - if ( wParam == TRUE ) { -#ifdef DEBUG_QAPPLICATION - qDebug("qt_try_modal - %s: winid: %d wParam: %d", uMsg == WM_ACTIVATEAPP ? "WM_ACTIVATEAPP" : "WM_NCACTIVATE", - qt_modal_stack->first()->winId(), wParam ); + ) { + if (type == WM_MOUSEMOVE +#ifndef Q_OS_TEMP + || type == WM_NCMOUSEMOVE #endif - qt_modal_stack->first()->setFocus(); - return false; - } - return true; - if ( wParam == TRUE ) { -#ifdef DEBUG_QAPPLICATION - qDebug("qt_try_modal - WM_ACTIVATEAPP: winid: %d wParam: %d", - qt_modal_stack->first()->winId(), wParam ); + ) { + QCursor *c = qt_grab_cursor(); + if (!c) + c = QApplication::overrideCursor(); + if (c) // application cursor defined + SetCursor(c->handle()); + else + SetCursor(QCursor(Qt::ArrowCursor).handle()); + } + block_event = true; + } else if (type == WM_CLOSE) { + block_event = true; + } +#ifndef Q_OS_TEMP + else if (type == WM_MOUSEACTIVATE || type == WM_NCLBUTTONDOWN){ + if (!top->isActiveWindow()) { + top->setActiveWindow(); + } else { + QApplication::beep(); + } + block_event = true; + ret = MA_NOACTIVATEANDEAT; + } else if (type == WM_SYSCOMMAND) { + if (!(msg->wParam == SC_RESTORE && widget->isMinimized())) + block_event = true; + } #endif - qt_modal_stack->first()->setFocus(); - return false; - } - return true; - case WM_SETFOCUS: - qt_modal_stack->first()->setFocus(); - - case WM_MOUSEACTIVATE: - case WM_KEYDOWN: // disallow mouse/key events - case WM_KEYUP: - case WM_SYSKEYDOWN: - case WM_SYSKEYUP: - case WM_RBUTTONDOWN: - case WM_LBUTTONDOWN: - case WM_MBUTTONDOWN: - case WM_RBUTTONUP: - case WM_LBUTTONUP: - case WM_MBUTTONUP: - case WM_MOUSEMOVE: - case WM_MOUSEWHEEL: - case WM_LBUTTONDBLCLK: - case WM_MBUTTONDBLCLK: - case WM_RBUTTONDBLCLK: - case WM_NCHITTEST: - case WM_NCLBUTTONDBLCLK: - case WM_NCLBUTTONDOWN: - case WM_NCLBUTTONUP: - case WM_NCMBUTTONDBLCLK: - case WM_NCMBUTTONDOWN: - case WM_NCMBUTTONUP: - case WM_NCMOUSEMOVE: - case WM_NCRBUTTONDBLCLK: - case WM_NCRBUTTONDOWN: - case WM_NCRBUTTONUP: - - case WM_WINDOWPOSCHANGING: - case WM_WINDOWPOSCHANGED: - return ( false ); - break; - default: -#ifdef DEBUG_QAPPLICATION - qDebug("not blocked: uMsg: %d wParam: %d", uMsg, wParam ); -#endif - break; - } - return ( true ); + return !block_event; } /***************************************************************************** @@ -2693,7 +2656,7 @@ void QApplication::setEffectEnabled( Qt::UIEffect effect, bool enable ) { #ifdef DEBUG_QAPPLICATION - qDebug( "qapplication_win.cpp: setEffectEnabled" ); + qDebug( "QApplication::setEffectEnabled( Qt::UIEffect 0x%08x, enable %d)", effect, enable ); #endif switch ( effect ) { @@ -2733,7 +2696,7 @@ bool QApplication::isEffectEnabled( Qt::UIEffect effect ) { #ifdef DEBUG_QAPPLICATION - qDebug( "qapplication_win.cpp: isEffectEnabled" ); + qDebug( "QApplication::isEffectEnabled( Qt::UIEffect 0x%08x )", effect ); #endif if ( !animate_ui ) @@ -2792,11 +2755,6 @@ #endif } -const char *qAppName() // get application name -{ - return appName; -} - // Windows specific code extern "C" @@ -2848,9 +2806,10 @@ if ( widget && widget->invokeWinEvent( &msg ) ) return 1; + int ret = 0; if ( widget && app_do_modal ) // modal event handling - if ( !qt_try_modal( widget, uMsg, wParam ) ) - return 1; + if ( !qt_try_modal( widget, &msg, ret ) ) + return 1; switch ( uMsg ) { case WM_CLOSE: @@ -3383,6 +3342,16 @@ LocalFree( lpMsgBuf ); } +Q_EXPORT char const *qAppFileName() +{ + return appFileName; +} + +const char *qAppName() // get application name +{ + return appName; +} + /* defined in qwindowdefs_win.h */ /* vars are set in qWinMain */ HINSTANCE qWinAppInst() 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.49 retrieving revision 1.1.2.15.2.50 diff -u -r1.1.2.15.2.49 -r1.1.2.15.2.50 --- qwidget_win.cpp 10 Jul 2005 10:42:43 -0000 1.1.2.15.2.49 +++ qwidget_win.cpp 10 Jul 2005 13:13:40 -0000 1.1.2.15.2.50 @@ -556,7 +556,7 @@ QPoint QWidget::mapToGlobal( const QPoint &pos ) const { - QWidget *window = qt4_QWidget_window( this ); + QWidget *window = topLevelWidget(); if (!isVisible() || isMinimized()) return mapTo(window, pos) + window->pos() + (window->geometry().topLeft() - window->frameGeometry().topLeft()); @@ -580,7 +580,7 @@ QPoint QWidget::mapFromGlobal( const QPoint &pos ) const { - QWidget *window = qt4_QWidget_window( this ); + QWidget *window = topLevelWidget(); if (!isVisible() || isMinimized()) return mapFrom( window, pos - window->pos()); |
From: Christian E. <che...@us...> - 2005-07-10 10:42:54
|
Update of /cvsroot/kde-cygwin/qt-3/src/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3326/src/kernel Modified Files: Tag: QT_WIN32_3_3_BRANCH qapplication_win.cpp qwidget_win.cpp Log Message: removed qt4_QWidget_window( QWidget ) because it's the same like QWidget::topLevelwidget() :) 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.78 retrieving revision 1.1.2.30.2.79 diff -u -r1.1.2.30.2.78 -r1.1.2.30.2.79 --- qapplication_win.cpp 9 Jul 2005 10:15:17 -0000 1.1.2.30.2.78 +++ qapplication_win.cpp 10 Jul 2005 10:42:42 -0000 1.1.2.30.2.79 @@ -166,8 +166,6 @@ // one day in the future we will be able to have static objects in libraries.... static QGuardedPtr<QWidget>* activeBeforePopup = 0; // focus handling with popups -QWidget *qt4_QWidget_window( const QWidget *w ); - typedef int (*QwinEventFilter) (MSG*); QwinEventFilter qt_set_win_event_filter (QwinEventFilter filter); @@ -2777,7 +2775,7 @@ if (mw && mw->isDialog()) { // raise the entire application, not just the dialog while(mw->parentWidget() && mw->isDialog()) - mw = qt4_QWidget_window( mw ); + mw = mw->topLevelWidget(); if (mw != QApplication::active_window) SetWindowPos(mw->winId(), HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); } @@ -2878,7 +2876,7 @@ else if (qApp->focusWidget()) widget = (QETWidget*)qApp->focusWidget(); else if (!widget || widget->winId() == GetFocus()) // We faked the message to go to exactly that widget. - widget = (QETWidget*) qt4_QWidget_window( widget ); + widget = (QETWidget*) widget->topLevelWidget(); if (widget->isEnabled()) return ( widget->translateKeyEvent(msg, g != 0) ); break; 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.48 retrieving revision 1.1.2.15.2.49 diff -u -r1.1.2.15.2.48 -r1.1.2.15.2.49 --- qwidget_win.cpp 10 Jul 2005 10:38:40 -0000 1.1.2.15.2.48 +++ qwidget_win.cpp 10 Jul 2005 10:42:43 -0000 1.1.2.15.2.49 @@ -68,17 +68,6 @@ extern "C" LRESULT CALLBACK qt_window_procedure ( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); -QWidget *qt4_QWidget_window( const QWidget *widget ) -{ - QWidget *w = (QWidget *)widget; - QWidget *p = w->parentWidget(); - while (!w->isTopLevel() && p) { - w = p; - p = p->parentWidget(); - } - return w; -} - //Used in QWidget::internalSetGeometry, QWidget::updateFrameStrut, QETWidget::translateConfigEvent void getWndBorderInfo( HWND hWnd, int& captionWidth, int& xBorderWidth, int& yBorderWidth ) { |
From: Christian E. <che...@us...> - 2005-07-10 10:42:52
|
Update of /cvsroot/kde-cygwin/qt-3/src/dialogs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3326/src/dialogs Modified Files: Tag: QT_WIN32_3_3_BRANCH qfiledialog_win.cpp Log Message: removed qt4_QWidget_window( QWidget ) because it's the same like QWidget::topLevelwidget() :) Index: qfiledialog_win.cpp =================================================================== RCS file: /cvsroot/kde-cygwin/qt-3/src/dialogs/Attic/qfiledialog_win.cpp,v retrieving revision 1.1.2.1.4.16 retrieving revision 1.1.2.1.4.17 diff -u -r1.1.2.1.4.16 -r1.1.2.1.4.17 --- qfiledialog_win.cpp 7 Jul 2005 18:35:20 -0000 1.1.2.1.4.16 +++ qfiledialog_win.cpp 10 Jul 2005 10:42:42 -0000 1.1.2.1.4.17 @@ -44,8 +44,6 @@ #include <commdlg.h> #endif -extern QWidget *qt4_QWidget_window( const QWidget *w ); - // Don't remove the lines below! // // resolving the W methods manually is needed, because Windows 95 doesn't include @@ -169,7 +167,7 @@ QFileDialog::Mode mode) { if (parent) - parent = qt4_QWidget_window(parent); + parent = parent->topLevelWidget(); else parent = qApp->activeWindow(); @@ -234,7 +232,7 @@ QFileDialog::Mode mode) { if (parent) - parent = qt4_QWidget_window(parent); + parent = parent->topLevelWidget(); else parent = qApp->activeWindow(); @@ -637,7 +635,7 @@ QString currentDir = QDir::currentDirPath(); QString result; if (parent) - parent = qt4_QWidget_window(parent); + parent = parent->topLevelWidget(); else parent = qApp->activeWindow(); QString title = caption; |
From: Christian E. <che...@us...> - 2005-07-10 10:38:52
|
Update of /cvsroot/kde-cygwin/qt-3/src/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1233/src/kernel Modified Files: Tag: QT_WIN32_3_3_BRANCH qwidget_win.cpp Log Message: rewrote QWidget::createSys with help from qt4 not complete yet 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.47 retrieving revision 1.1.2.15.2.48 diff -u -r1.1.2.15.2.47 -r1.1.2.15.2.48 --- qwidget_win.cpp 9 Jul 2005 14:41:56 -0000 1.1.2.15.2.47 +++ qwidget_win.cpp 10 Jul 2005 10:38:40 -0000 1.1.2.15.2.48 @@ -160,32 +160,29 @@ static int sw = -1, sh = -1; // screen size if ( sw < 0 ) { // get the screen size - RECT rect; - if ( !desktop ) { - QT_WA ( SystemParametersInfo ( SPI_GETWORKAREA, 0, &rect, FALSE );, - SystemParametersInfo ( SPI_GETWORKAREA, 0, &rect, FALSE ); ) - } else { - HWND hWndDesktop = GetDesktopWindow (); - GetWindowRect ( hWndDesktop, &rect ); - } - sw = rect.right - rect.left + 1; - sh = rect.bottom - rect.top + 1; + sw = GetSystemMetrics( SM_CXSCREEN ); + sh = GetSystemMetrics( SM_CYSCREEN ); } if ( desktop ) { // desktop widget - dialog = popup = FALSE; // force these flags off - crect.setRect( 0, 0, sw, sh ); + popup = FALSE; // force these flags off +#ifndef Q_OS_TEMP + if ( QApplication::winVersion() != Qt::WV_NT && QApplication::winVersion() != Qt::WV_95) + crect.setRect(GetSystemMetrics(76 /* SM_XVIRTUALSCREEN */), GetSystemMetrics(77 /* SM_YVIRTUALSCREEN */), + GetSystemMetrics(78 /* SM_CXVIRTUALSCREEN */), GetSystemMetrics(79 /* SM_CYVIRTUALSCREEN */)); + else +#endif + crect.setRect(0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); } else if ( topLevel ) { // calc pos/size from screen crect.setRect( sw / 4, 3 * sh / 10, sw / 2, 4 * sh / 10 ); } else { // child widget crect.setRect( 0, 0, 100, 30 ); } - - parentw = parentWidget() && (!popup) ? parentWidget()->winId () : NULL; + parentw = parentWidget() ? parentWidget()->winId () : NULL; - //WS_CLIPCHILDREN mean that when the parent draw into it client area must clip its children ... - DWORD dwStyle = WS_CLIPCHILDREN, dwExtStyle = WS_EX_NOPARENTNOTIFY; + DWORD dwStyle = WS_CLIPCHILDREN; + DWORD dwExtStyle = WS_EX_NOPARENTNOTIFY; if ( topLevel && parentWidget() ) { // if our parent has WStyle_StaysOnTop, so must we @@ -250,99 +247,154 @@ destroyw = winid; id = window; SetParent( id, parentw ); + LONG res = SetWindowLongA(window, GWL_STYLE, dwStyle); + if (!res) + qWarning("QWidget::create: Failed to set window style"); +#ifdef _WIN64 + res = SetWindowLongPtrA( window, GWLP_WNDPROC, (LONG_PTR)qt_window_procedure ); +#else + res = SetWindowLongA( window, GWL_WNDPROC, (LONG)qt_window_procedure ); +#endif + if (!res) + qWarning("QWidget::create: Failed to set window procedure"); } else if ( desktop ) { // desktop widget id = ( WId ) GetDesktopWindow (); // this is the desktop window handle - } else { - RECT rcWnd; - rcWnd.left = crect.left (); - rcWnd.top = crect.top (); - rcWnd.bottom = crect.bottom (); - rcWnd.right = crect.right (); -#ifdef DEBUG_QWIDGET + } else if (topLevel) { // create top-level widget + if (popup) + parentw = 0; - qDebug ( "QWidget::create window Rect before AdjustRect: %ld, %ld - %ld,%ld", rcWnd.left, rcWnd.top, rcWnd.right, rcWnd.bottom ); -#endif +#ifdef Q_OS_TEMP - AdjustWindowRectEx( &rcWnd, dwStyle, FALSE, dwExtStyle ); -#ifdef DEBUG_QWIDGET + const TCHAR *cname = windowClassName.utf16(); - qDebug ( "QWidget::create window Rect after AdjustRect: %ld, %ld - %ld,%ld", rcWnd.left, rcWnd.top, rcWnd.right, rcWnd.bottom ); -#endif - //fpos = QPoint(rcWnd.left, rcWnd.top); - createTLExtra(); -#ifdef DEBUG_QWIDGET + id = CreateWindowEx(exsty, cname, ttitle, style, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, parentw, 0, appinst, 0); +#else - if ( extra && extra->topextra ) - qDebug ( "window size: %ld,%ld - %ld,%ld", rcWnd.left, rcWnd.top, rcWnd.right, rcWnd.bottom ); -#endif - QT_WA( - id = ( WId ) CreateWindowExW ( dwExtStyle, // extended style - L"QWidget", // class name - ( LPCWSTR ) caption().ucs2(), - dwStyle, // window style - rcWnd.left, - rcWnd.top, - rcWnd.right - rcWnd.left, - rcWnd.bottom - rcWnd.top, - parentw, //parent window - NULL, // menu - qWinAppInst(), // application instance - NULL );, - id = ( WId ) CreateWindowExA ( dwExtStyle, // extended style - "QWidget", // class name - ( LPCSTR ) caption().data(), - dwStyle, // window style - rcWnd.left, - rcWnd.top, - rcWnd.right - rcWnd.left, - rcWnd.bottom - rcWnd.top, - parentw, //parent window - NULL, // menu - qWinAppInst(), // application instance - NULL ); - ) -#ifdef DEBUG_QWIDGET + QT_WA({ + id = CreateWindowEx(dwExtStyle, + L"QWidget", + caption().ucs2(), + dwStyle, + CW_USEDEFAULT, CW_USEDEFAULT, + CW_USEDEFAULT, CW_USEDEFAULT, + parentw, + NULL, + qWinAppInst(), + NULL); + } , { + id = CreateWindowExA(dwExtStyle, + "QWidget", + caption().latin1(), + dwStyle, + CW_USEDEFAULT, CW_USEDEFAULT, + CW_USEDEFAULT, CW_USEDEFAULT, + parentw, + NULL, + qWinAppInst(), + NULL); + }); - if ( id == NULL ) { - qDebug ( "CreateWindowEx failed: %ld", ( int ) GetLastError () ); - } #endif + + if (!id) + qWarning("QWidget::create: Failed to create window"); + if ( testWFlags( Qt::WStyle_StaysOnTop) ) + SetWindowPos(id, HWND_TOPMOST, 0, 0, 100, 100, SWP_NOACTIVATE); + } else { // create child widget + QT_WA({ + id = CreateWindowEx(dwExtStyle, + L"QWidget", + caption().ucs2(), + dwStyle, + 0, 0, + 100, 30, + parentw, + NULL, + qWinAppInst(), + NULL); + } , { + id = CreateWindowExA(dwExtStyle, + "QWidget", + caption().latin1(), + dwStyle, + 0, 0, + 100, 30, + parentw, + NULL, + qWinAppInst(), + NULL); + }); + if (!id) + qWarning("QWidget::create: Failed to create window"); + SetWindowPos(id, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } setWinId ( id ); hdc = GetDC( id ); #ifdef DEBUG_QWIDGET qDebug( "QWidget::create() hdc: 0x%08p, WinID: 0x%08X, pWinID: 0x%08X, flags: 0x%08X, flagsex: 0x%08X", hdc, id, parentw, dwStyle, dwExtStyle ); #endif - if ( desktop ) { - setWState( WState_Visible ); - } else if ( topLevel ) { - // ccj - cursor is changed in WM_SETCURSOR message - // see qapplication_win.cpp:qt_window_procedure - setWState( WState_OwnCursor ); - } - if ( window ) { - if ( topLevel && !desktop && initializeWindow ) { - QT_WA( - SetWindowLongPtrW ( window, GWL_STYLE, dwStyle ); - SetWindowLongPtrW ( window, GWL_EXSTYLE, dwExtStyle );, - SetWindowLongPtrA ( window, GWL_STYLE, dwStyle ); - SetWindowLongPtrA ( window, GWL_EXSTYLE, dwExtStyle ); - ) + + if (desktop) { + setWState( Qt::WState_Visible ); + } else { + RECT fr, cr; + GetWindowRect(id, &fr); // update rects + GetClientRect(id, &cr); + if (cr.top == cr.bottom && cr.left == cr.right) { + if (initializeWindow) { + int x, y, w, h; + if (topLevel) { + x = sw/4; + y = 3*sh/10; + w = sw/2; + h = 4*sh/10; + } else { + x = y = 0; + w = 100; + h = 30; + } + MoveWindow(winId(), x, y, w, h, true); + } + GetWindowRect(id, &fr); // update rects + GetClientRect(id, &cr); + } + if (topLevel){ + // one cannot trust cr.left and cr.top, use a correction POINT instead + POINT pt; + pt.x = 0; + pt.y = 0; + ClientToScreen(id, &pt); + crect = QRect(QPoint(pt.x, pt.y), + QPoint(pt.x+cr.right, pt.y+cr.bottom)); + + QTLWExtra *top = topData(); + top->ftop = crect.top() - fr.top; + top->fleft = crect.left() - fr.left; + top->fbottom = fr.bottom - crect.bottom(); + top->fright = fr.right - crect.right(); + fstrut_dirty = false; + + createTLExtra(); + } else { + crect.setCoords(cr.left, cr.top, cr.right, cr.bottom); + // in case extra data already exists (eg. reparent()). Set it. } - if ( IsWindowVisible ( window ) ) - setWState( WState_Visible ); - else - clearWState( WState_Visible ); } - if ( destroyw ) { -#ifdef DEBUG_QWIDGET - qDebug( "QWidget::create(): DestroyWindow hdc: %0x08p, id: 0x%08X, destroyw 0x%08X", hdc, winid, destroyw ); -#endif + if (window) { // got window from outside + if (IsWindowVisible(window)) + setWState(Qt::WState_Visible); + else + setWState(Qt::WState_Visible); + } - DestroyWindow ( destroyw ); + if (destroyw) { + DestroyWindow(destroyw); } - pal = QApplication::palette( this ); + +// QWinInputContext::enable(this, testWFlags(Qt::InputMethodEnabled) & isEnabled()); +// if (q != qt_tablet_widget) +// qt_tablet_init(); } /*! |