[Pkg-kde-commits] rev 1775 - in trunk/packages/qt-x11-free/debian: . patches

Christopher Martin chrsmrtn at costa.debian.org
Mon Sep 12 14:14:54 UTC 2005


Author: chrsmrtn
Date: 2005-09-12 14:14:53 +0000 (Mon, 12 Sep 2005)
New Revision: 1775

Added:
   trunk/packages/qt-x11-free/debian/patches/11_qt_rubberband.dpatch
Modified:
   trunk/packages/qt-x11-free/debian/changelog
   trunk/packages/qt-x11-free/debian/patches/00list
Log:
Commit the first (for Qt) part of the "Improving KDE" patches.

If people don't like the changes, we can talk and revert, but
at least this way people can build the packages and see what
they do easily.


Modified: trunk/packages/qt-x11-free/debian/changelog
===================================================================
--- trunk/packages/qt-x11-free/debian/changelog	2005-09-12 13:58:58 UTC (rev 1774)
+++ trunk/packages/qt-x11-free/debian/changelog	2005-09-12 14:14:53 UTC (rev 1775)
@@ -15,6 +15,9 @@
   * Revert the versioning of our build-depends on libpq-dev, since the fixed
     package has now built on all architectures.
 
+  * Add a patch from the "Improving KDE" set that tweaks KDE's default GUI,
+    changing some of the selection and highlight effects.
+  
  -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>  Fri,  9 Sep 2005 08:35:43 -0400
 
 qt-x11-free (3:3.3.4-8) unstable; urgency=low

Modified: trunk/packages/qt-x11-free/debian/patches/00list
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/00list	2005-09-12 13:58:58 UTC (rev 1774)
+++ trunk/packages/qt-x11-free/debian/patches/00list	2005-09-12 14:14:53 UTC (rev 1775)
@@ -6,6 +6,7 @@
 08_thread_default
 09_amd64_lib64
 10_arm_gcc4
+11_qt_rubberband
 14_fix_kmenu
 15_unify_declarations_glibc
 16_fix_opengl_check

Added: trunk/packages/qt-x11-free/debian/patches/11_qt_rubberband.dpatch
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/11_qt_rubberband.dpatch	2005-09-12 13:58:58 UTC (rev 1774)
+++ trunk/packages/qt-x11-free/debian/patches/11_qt_rubberband.dpatch	2005-09-12 14:14:53 UTC (rev 1775)
@@ -0,0 +1,416 @@
+#! /bin/sh -e
+
+if [ $# -lt 1 ]; then
+    echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
+    exit 1
+fi
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}"
+
+case "$1" in
+    -patch) patch -p1 ${patch_opts} < $0;;
+    -unpatch) patch -R -p1 ${patch_opts} < $0;;
+    *)
+        echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
+        exit 1;;
+esac
+
+exit 0
+
+ at DPATCH@
+--- qt.orig/src/iconview/qiconview.cpp
++++ qt.patched/src/iconview/qiconview.cpp
+@@ -261,6 +261,7 @@
+ 
+     QIconViewToolTip *toolTip;
+     QPixmapCache maskCache;
++    QPixmap *backrubber;    
+     QPtrDict<QIconViewItem> selectedItems;
+ 
+     struct ItemContainer {
+@@ -1974,14 +1975,27 @@
+     if ( picture() ) {
+ 	QPicture *pic = picture();
+ 	if ( isSelected() ) {
+-	    p->fillRect( pixmapRect( FALSE ), QBrush( cg.highlight(), QBrush::Dense4Pattern) );
++            p->setBrush( QBrush( cg.highlight(), QBrush::Dense4Pattern ) );
++            p->setPen( QPen( cg.highlight(), QBrush::Dense4Pattern ) );
++            p->drawRoundRect( pixmapRect( FALSE ), 
++			    1000 / pixmapRect( FALSE ).width(),
++			    1000 / pixmapRect( FALSE ).height() );		
+ 	}
+ 	p->drawPicture( x()-pic->boundingRect().x(), y()-pic->boundingRect().y(), *pic );
+ 	if ( isSelected() ) {
+-	    p->fillRect( textRect( FALSE ), cg.highlight() );
++            p->setBrush( QBrush( cg.highlight() ) );
++            p->setPen( QPen( cg.highlight() ) );
++            p->drawRoundRect( textRect( FALSE ), 
++			    1000 / textRect( FALSE ).width(),
++			    1000 / textRect( FALSE ).height() );		
+ 	    p->setPen( QPen( cg.highlightedText() ) );
+-	} else if ( view->d->itemTextBrush != NoBrush )
+-	    p->fillRect( textRect( FALSE ), view->d->itemTextBrush );
++	} else if ( view->d->itemTextBrush != NoBrush ) {
++            p->setBrush( view->d->itemTextBrush );
++            p->setPen( QPen( view->d->itemTextBrush.color() ) );
++            p->drawRoundRect( textRect( FALSE ), 
++			    1000 / textRect( FALSE ).width(),
++			    1000 / textRect( FALSE ).height() );		
++	}
+ 
+ 	int align = view->itemTextPos() == QIconView::Bottom ? AlignHCenter : AlignAuto;
+ 	if ( view->d->wordWrapIconText )
+@@ -2039,10 +2053,19 @@
+ 
+     p->save();
+     if ( isSelected() ) {
+-	p->fillRect( textRect( FALSE ), cg.highlight() );
++        p->setBrush( QBrush( cg.highlight() ) );
++        p->setPen( QPen( cg.highlight() ) );
++        p->drawRoundRect( textRect( FALSE ), 
++                          1000 / textRect( FALSE ).width(),
++			  1000 / textRect( FALSE ).height() );		
+ 	p->setPen( QPen( cg.highlightedText() ) );
+-    } else if ( view->d->itemTextBrush != NoBrush )
+-	p->fillRect( textRect( FALSE ), view->d->itemTextBrush );
++    } else if ( view->d->itemTextBrush != NoBrush ) {
++        p->setBrush( view->d->itemTextBrush );
++        p->setPen( QPen( view->d->itemTextBrush.color() ) );
++        p->drawRoundRect( textRect( FALSE ), 
++			  1000 / textRect( FALSE ).width(),
++			  1000 / textRect( FALSE ).height() );		
++    }
+ 
+     int align = AlignHCenter;
+     if ( view->d->wordWrapIconText )
+@@ -2058,31 +2081,13 @@
+ /*!
+     Paints the focus rectangle of the item using the painter \a p and
+     the color group \a cg.
++    
++    The default implementation does nothing; subclasses may
++    reimplement this function.
+ */
+ 
+-void QIconViewItem::paintFocus( QPainter *p, const QColorGroup &cg )
++void QIconViewItem::paintFocus( QPainter *, const QColorGroup & )
+ {
+-    if ( !view )
+-	return;
+-
+-    view->style().drawPrimitive(QStyle::PE_FocusRect, p,
+-				QRect( textRect( FALSE ).x(), textRect( FALSE ).y(),
+-				       textRect( FALSE ).width(),
+-				       textRect( FALSE ).height() ), cg,
+-				(isSelected() ?
+-				 QStyle::Style_FocusAtBorder :
+-				 QStyle::Style_Default),
+-				QStyleOption(isSelected() ? cg.highlight() : cg.base()));
+-
+-    if ( this != view->d->currentItem ) {
+-	view->style().drawPrimitive(QStyle::PE_FocusRect, p,
+-				    QRect( pixmapRect( FALSE ).x(),
+-					   pixmapRect( FALSE ).y(),
+-					   pixmapRect( FALSE ).width(),
+-					   pixmapRect( FALSE ).height() ),
+-				    cg, QStyle::Style_Default,
+-				    QStyleOption(cg.base()));
+-    }
+ }
+ 
+ /*!
+@@ -2780,6 +2785,7 @@
+     d->renamingItem = 0;
+     d->drawActiveSelection = TRUE;
+     d->drawDragShapes = FALSE;
++    d->backrubber = 0;    
+ 
+     connect( d->adjustTimer, SIGNAL( timeout() ),
+ 	     this, SLOT( adjustItems() ) );
+@@ -3264,7 +3270,7 @@
+ 
+ void QIconView::doAutoScroll()
+ {
+-    QRect oldRubber = QRect( *d->rubber );
++    QRect oldRubber = *d->rubber;
+ 
+     QPoint vp = viewport()->mapFromGlobal( QCursor::pos() );
+     QPoint pos = viewportToContents( vp );
+@@ -3281,7 +3287,6 @@
+     bool block = signalsBlocked();
+ 
+     QRect rr;
+-    QRegion region( 0, 0, visibleWidth(), visibleHeight() );
+ 
+     blockSignals( TRUE );
+     viewport()->setUpdatesEnabled( FALSE );
+@@ -3307,9 +3312,6 @@
+ 			item->setSelected( TRUE, TRUE );
+ 			changed = TRUE;
+ 			rr = rr.unite( item->rect() );
+-		    } else {
+-			region = region.subtract( QRect( contentsToViewport( item->pos() ),
+-							 item->size() ) );
+ 		    }
+ 
+ 		    minx = QMIN( minx, item->x() - 1 );
+@@ -3326,42 +3328,76 @@
+     viewport()->setUpdatesEnabled( TRUE );
+     blockSignals( block );
+ 
+-    QRect r = *d->rubber;
+-    *d->rubber = oldRubber;
++    // static bool drawAll;
++    if ( d->backrubber == 0 ) {
++        d->backrubber = new QPixmap( viewport()->rect().size() );
++        d->backrubber->fill( viewport(), viewport()->rect().topLeft() );
++        // drawAll = true;
++    }
++
++    // int oldX = 0, oldY = 0;
++    // if ( !drawAll && d->scrollTimer ) {
++    //     oldX = contentsX();
++    //     oldY = contentsY();
++    // }
++    ensureVisible( pos.x(), pos.y() );
++    // if ( !drawAll && d->scrollTimer && ( oldX != contentsX() || oldY != contentsY() ) )
++    //     drawAll = true;
++
++    QRect allRect = oldRubber.normalize();
++    if ( changed ) 
++        allRect |= rr.normalize();
++    allRect |= d->rubber->normalize();
++    QPoint point = contentsToViewport( allRect.topLeft() );
++    allRect = QRect( point.x(), point.y(), allRect.width(), allRect.height() );
++    allRect &= viewport()->rect();
+ 
+-    QPainter p;
+-    p.begin( viewport() );
+-    p.setRasterOp( NotROP );
+-    p.setPen( QPen( color0, 1 ) );
+-    p.setBrush( NoBrush );
+-    drawRubber( &p );
+     d->dragging = FALSE;
+-    p.end();
+ 
+-    *d->rubber = r;
++    QPainter p( d->backrubber );
++    p.translate( -contentsX(), -contentsY() );
++#if 0
++    if ( !drawAll ) {
++        oldRubber = oldRubber.normalize();
++        point = contentsToViewport( oldRubber.topLeft() );
++        oldRubber = QRect( point.x(), point.y(), oldRubber.width(), oldRubber.height() );
++        oldRubber &= viewport()->rect();
+ 
+-    if ( changed ) {
+-	d->drawAllBack = FALSE;
+-	d->clipRegion = region;
+-	repaintContents( rr, FALSE );
+-	d->drawAllBack = TRUE;
+-    }
++        point = contentsToViewport( nr.topLeft() );
++        nr = QRect( point.x(), point.y(), nr.width(), nr.height() );
++        nr &= viewport()->rect();
+ 
+-    ensureVisible( pos.x(), pos.y() );
++	QRegion region;
++	if ( allRect != nr )
++            region = QRegion(allRect).subtract( QRegion( nr ) );
++	if ( allRect != oldRubber )
++            region += QRegion(allRect).subtract( QRegion( oldRubber ) );
+ 
+-    p.begin( viewport() );
+-    p.setRasterOp( NotROP );
+-    p.setPen( QPen( color0, 1 ) );
+-    p.setBrush( NoBrush );
+-    drawRubber( &p );
+-    d->dragging = TRUE;
++	QMemArray< QRect > ar = region.rects();
++	for ( uint i = 0; i < ar.size(); ++i ) {
++             ar[i].addCoords( -2, -2, 4, 4 );
++             ar[i] = ar[i].normalize();
++	
++             p.setClipRect( ar[i] );
++             drawContents( &p, contentsX() + ar[i].left(), contentsY() + ar[i].top(), ar[i].width(), ar[i].height() );
++	}
++    }
++    else
++#endif
++    {	    
++        drawContents( &p, 
++                      contentsX() + allRect.left(), contentsY() + allRect.top(), 
++                      allRect.width(), allRect.height() ); 
++    }
+ 
+     p.end();
++    // drawAll = false;
++    d->dragging = TRUE;
++    bitBlt( viewport(), allRect.topLeft(), d->backrubber, allRect );
+ 
+     if ( changed ) {
+-	emit selectionChanged();
+-	if ( d->selectionMode == Single )
+-	    emit selectionChanged( d->currentItem );
++        if ( d->selectionMode == Single )
++            emit selectionChanged( d->currentItem );
+     }
+ 
+     if ( !QRect( 50, 50, viewport()->width()-100, viewport()->height()-100 ).contains( vp ) &&
+@@ -3388,9 +3424,7 @@
+ 
+ void QIconView::drawContents( QPainter *p, int cx, int cy, int cw, int ch )
+ {
+-    if ( d->dragging && d->rubber )
+-	drawRubber( p );
+-
++    p->save();
+     QRect r = QRect( cx, cy, cw, ch );
+ 
+     QIconViewPrivate::ItemContainer *c = d->firstContainer;
+@@ -3464,8 +3498,16 @@
+ 	d->currentItem->paintFocus( p, colorGroup() );
+     }
+ 
+-    if ( d->dragging && d->rubber )
+-	drawRubber( p );
++   p->restore();
++   if ( d->rubber ) {
++       p->save();              
++       p->translate( contentsX(), contentsY() );
++       p->setRasterOp( NotROP );
++       p->setPen( QPen( color0, 1 ) );
++       p->setBrush( NoBrush );        
++       drawRubber( p );
++       p->restore();
++    }
+ }
+ 
+ /*!
+@@ -4364,17 +4406,15 @@
+ void QIconView::contentsMousePressEventEx( QMouseEvent *e )
+ {
+     if ( d->rubber ) {
+-	QPainter p;
+-	p.begin( viewport() );
+-	p.setRasterOp( NotROP );
+-	p.setPen( QPen( color0, 1 ) );
+-	p.setBrush( NoBrush );
++        QRect r( d->rubber->normalize() );
++        delete d->rubber;
++        d->rubber = 0;  
++   
++        repaintContents( r, FALSE );
++        d->dragging = FALSE;
+ 
+-	drawRubber( &p );
+-	d->dragging = FALSE;
+-	p.end();
+-	delete d->rubber;
+-	d->rubber = 0;
++	delete d->backrubber;
++	d->backrubber = 0;
+ 
+ 	if ( d->scrollTimer ) {
+ 	    disconnect( d->scrollTimer, SIGNAL( timeout() ), this, SLOT( doAutoScroll() ) );
+@@ -4559,21 +4599,17 @@
+     d->startDragItem = 0;
+ 
+     if ( d->rubber ) {
+-	QPainter p;
+-	p.begin( viewport() );
+-	p.setRasterOp( NotROP );
+-	p.setPen( QPen( color0, 1 ) );
+-	p.setBrush( NoBrush );
+-
+-	drawRubber( &p );
+-	d->dragging = FALSE;
+-	p.end();
+-
++        QRect r(d->rubber->normalize());
++        
+ 	if ( ( d->rubber->topLeft() - d->rubber->bottomRight() ).manhattanLength() >
+ 	     QApplication::startDragDistance() )
+ 	    emitClicked = FALSE;
+ 	delete d->rubber;
+-	d->rubber = 0;
++    	d->rubber = 0;
++	repaintContents(r, FALSE);
++	d->dragging = FALSE;
++	delete d->backrubber;
++	d->backrubber = 0;      
+ 	d->currentItem = d->tmpCurrentItem;
+ 	d->tmpCurrentItem = 0;
+ 	if ( d->currentItem )
+@@ -5333,9 +5369,9 @@
+     QPoint pnt( d->rubber->x(), d->rubber->y() );
+     pnt = contentsToViewport( pnt );
+ 
+-    style().drawPrimitive(QStyle::PE_RubberBand, p,
+-			  QRect(pnt.x(), pnt.y(), d->rubber->width(), d->rubber->height()),
+-			  colorGroup(), QStyle::Style_Default, QStyleOption(colorGroup().base()));
++    style().drawPrimitive( QStyle::PE_RubberBand, p,
++			   QRect( pnt.x(), pnt.y(), d->rubber->width(), d->rubber->height() ).normalize(),
++			   colorGroup(), QStyle::Style_Default, QStyleOption(colorGroup().base()) );
+ }
+ 
+ /*!
+--- qt.orig/src/widgets/qlistbox.cpp
++++ qt.patched/src/widgets/qlistbox.cpp
+@@ -2162,7 +2162,7 @@
+     }
+ 
+     if ( d->rubber ) {
+-	drawRubber();
++	repaintContents( d->rubber->normalize(), FALSE );
+ 	delete d->rubber;
+ 	d->rubber = 0;
+ 	d->current = d->tmpCurrent;
+@@ -2240,11 +2240,9 @@
+     }
+ 
+     if ( d->rubber ) {
+-	QRect r = d->rubber->normalize();
+-	drawRubber();
++    	QRect r = d->rubber->normalize();
+ 	d->rubber->setCoords( d->rubber->x(), d->rubber->y(), e->x(), e->y() );
+ 	doRubberSelection( r, d->rubber->normalize() );
+-	drawRubber();
+ 	return;
+     }
+ 
+@@ -4381,6 +4379,7 @@
+ 	return;
+     if ( !d->rubber->width() && !d->rubber->height() )
+ 	return;
++ 
+     QPainter p( viewport() );
+     p.setRasterOp( NotROP );
+     style().drawPrimitive( QStyle::PE_RubberBand, &p, d->rubber->normalize(),
+@@ -4413,13 +4412,24 @@
+ 	    }
+ 	}
+     }
++
++    QRect allRect = old;
++    if ( changed ) {
++        allRect |= pr;
++    }    
++    allRect |= rubber;
++    allRect &= viewport()->rect();
++    allRect.addCoords( -2, -2, 2, 2 );
++
++    repaintContents( QRect( contentsX() + allRect.left(), contentsY() + allRect.top(), allRect.width(), allRect.height() ), FALSE ); 
++    drawRubber();
++    
+     if ( changed ) {
+ 	emit selectionChanged();
+ #if defined(QT_ACCESSIBILITY_SUPPORT)
+ 	QAccessible::updateAccessibility( viewport(), 0, QAccessible::Selection );
+ #endif
+     }
+-    viewport()->repaint( pr, TRUE );
+ }
+ 
+ 




More information about the pkg-kde-commits mailing list