Bug 54230 - konsole flickers when resizing
Summary: konsole flickers when resizing
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Unclassified
Component: general (show other bugs)
Version: 1.2
Platform: unspecified Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-06 23:53 UTC by Marcel Martin
Modified: 2006-07-09 00:59 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch to reduce flickering (1.87 KB, patch)
2006-07-01 17:32 UTC, Andreas Kling
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel Martin 2003-02-06 23:53:26 UTC
Version:           1.2 (using KDE 3.1.9)
Compiler:          gcc version 3.2.1 20021207 (Gentoo Linux 3.2.1-20021207)
OS:          Linux (i686) release 2.4.19-xfs-r1

The entire Konsole window's content is cleared to the background color and redrawn on every resize event, which leads to a major flicker when resizing.
Comment 1 Andreas Kling 2006-07-01 17:32:59 UTC
Created attachment 16842 [details]
Patch to reduce flickering

This patch sets the WNoAutoErase QWidget flag for the konsole part, which
reduces flicker to a minimum.
Comment 2 Kurt Hindenburg 2006-07-04 23:51:35 UTC
SVN commit 558206 by hindenburg:

Test patch to reduce flickering; patch by Andreas Kling.

CCBUG: 54230


 M  +43 -1     TEWidget.cpp  


--- trunk/KDE/kdebase/apps/konsole/konsole/TEWidget.cpp #558205:558206
@@ -336,7 +336,7 @@
 /* ------------------------------------------------------------------------- */
 
 TEWidget::TEWidget(QWidget *parent)
-:QFrame(parent)
+:QFrame(parent,Qt::WNoAutoErase)
 ,font_h(1)
 ,font_w(1)
 ,font_a(1)
@@ -1012,6 +1012,48 @@
   }
 
   drawFrame( &paint );
+
+  // Since we're using WNoAutoErase, we have to make sure that
+  // every single pixel is painted by the paint event.
+  // To do this, we must figure out which pixels are left in the
+  // area between the terminal image and the frame border.
+
+  // Calculate the contents rect excluding scroll bar.
+  QRect innerRect = contentsRect();
+  if( scrollLoc != SCRNONE )
+    innerRect.setWidth( innerRect.width() - scrollbar->width() );
+
+  innerRect.setWidth( innerRect.width() + 3 );
+  innerRect.setHeight( innerRect.height() );
+
+  // Calculate the emulation rect (area needed for actual terminal contents)
+  QRect emurect( contentsRect().topLeft(), QSize( columns * font_w + 2 * rimX, lines * font_h + 2 * rimY ));
+
+  // Now erase() the remaining pixels on all sides of the emulation
+
+  // Top
+  QRect er( innerRect );
+  er.setBottom( emurect.top() );
+  erase( er );
+
+  // Bottom
+  er.setBottom( innerRect.bottom() );
+  er.setTop( emurect.bottom() );
+  erase( er );
+
+  // Left
+  er.setTop( emurect.top() );
+  er.setBottom( emurect.bottom() - 1 );
+  er.setRight( emurect.left() );
+  erase( er );
+
+  // Right
+  er.setRight( innerRect.right() );
+  er.setTop( emurect.top() );
+  er.setBottom( emurect.bottom() - 1 );
+  er.setLeft( emurect.right() );
+  erase( er );
+
   paint.end();
 }
 
Comment 3 Kurt Hindenburg 2006-07-09 00:59:34 UTC
SVN commit 560010 by hindenburg:

Patch to reduce flickering by Andreas Kling.

Already forwarded port Qt4 version to /trunk.

BUG: 54230


 M  +43 -1     TEWidget.cpp  


--- branches/KDE/3.5/kdebase/konsole/konsole/TEWidget.cpp #560009:560010
@@ -316,7 +316,7 @@
 /* ------------------------------------------------------------------------- */
 
 TEWidget::TEWidget(QWidget *parent, const char *name)
-:QFrame(parent,name)
+:QFrame(parent,name,WNoAutoErase)
 ,font_h(1)
 ,font_w(1)
 ,font_a(1)
@@ -983,6 +983,48 @@
   paintContents(paint, rect, pm != 0);
 
   drawFrame( &paint );
+
+  // Since we're using WNoAutoErase, we have to make sure that
+  // every single pixel is painted by the paint event.
+  // To do this, we must figure out which pixels are left in the
+  // area between the terminal image and the frame border.
+
+  // Calculate the contents rect excluding scroll bar.
+  QRect innerRect = contentsRect();
+  if( scrollLoc != SCRNONE )
+    innerRect.setWidth( innerRect.width() - scrollbar->width() );
+
+  innerRect.setWidth( innerRect.width() + 3 );
+  innerRect.setHeight( innerRect.height() );
+
+  // Calculate the emulation rect (area needed for actual terminal contents)
+  QRect emurect( contentsRect().topLeft(), QSize( columns * font_w + 2 * rimX, lines * font_h + 2 * rimY ));
+
+  // Now erase() the remaining pixels on all sides of the emulation
+
+  // Top
+  QRect er( innerRect );
+  er.setBottom( emurect.top() );
+  erase( er );
+
+  // Bottom
+  er.setBottom( innerRect.bottom() );
+  er.setTop( emurect.bottom() );
+  erase( er );
+
+  // Left
+  er.setTop( emurect.top() );
+  er.setBottom( emurect.bottom() - 1 );
+  er.setRight( emurect.left() );
+  erase( er );
+
+  // Right
+  er.setRight( innerRect.right() );
+  er.setTop( emurect.top() );
+  er.setBottom( emurect.bottom() - 1 );
+  er.setLeft( emurect.right() );
+  erase( er );
+
   paint.end();
   setUpdatesEnabled(true);
 }