Bug 66843

Summary: Background of other sessions doesn't get updated correctly when maximizing.
Product: [Applications] konsole Reporter: Sandro Giessl <sgiessl>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 1.3 Beta   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Sandro Giessl 2003-10-29 16:32:15 UTC
Version:           1.3 Beta (using KDE 3.1.93 (3.2 beta 1), Gentoo)
Compiler:          gcc version 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r2, propolice)
OS:          Linux (i686) release 2.4.20-gentoo-r7

I noticed a bug in Konsole which leads to a wrong painting of the background...
To reproduce it:
- switch to a transparent Konsole shema.
- open 2 or more sessions in the same window (using the same shema).
- maximize the window.
- the background of other sessions is filled with "tiles" of the old background. Screenshot: http://www.tnt22.com/files_sandro/konsole_bg.png
Comment 1 Sandro Giessl 2004-05-20 18:44:03 UTC
CVS commit by giessl: 

Fix #66843.
This is a workaround for a possible bug in KRootPixmap. After resizing
Konsole with multiple sessions and switching to another session, the
tab widget sends resize events, but obviously KRootPixmap isn't able
to handle them correctly.
Please try if it also fixes #71213 and similar.

CCMAIL: 66843-done@bugs.kde.org, 71213@bugs.kde.org, jansen@kde.org


  M +21 -0     konsole.cpp   1.461
  M +1 -0      konsole.h   1.177


--- kdebase/konsole/konsole/konsole.cpp  #1.460:1.461
@@ -881,4 +881,5 @@ void Konsole::makeTabWidget()
 {
   tabwidget = new KTabWidget(this);
+  tabwidget->installEventFilter(this);
   tabwidget->setTabReorderingEnabled(true);
   if (n_tabbar==TabTop)
@@ -943,4 +944,19 @@ bool Konsole::eventFilter( QObject *o, Q
     }
   }
+  else if (o == tabwidget)
+  {
+    // There is probably a bug in KRootPixmap which makes this workaround
+    // neccesary:
+    // Mark the background of invisible TEWidgets dirty so they can be
+    // repainted when they are displayed next.
+    if (tabwidget && ev->type() == QEvent::Resize) {
+      for(int i = 0; i < tabwidget->count(); i++) {
+        QWidget *page = tabwidget->page(i);
+        if (page != tabwidget->currentPage()) {
+          rootxpmsDirty[page] = true;
+        }
+      }
+    }
+  }
   return KMainWindow::eventFilter(o, ev);
 }
@@ -2426,4 +2442,9 @@ void Konsole::activateSession(QWidget* w
   activateSession(tabwidget->indexOf(w));
   w->setFocus();
+  if( rootxpmsDirty[w] ) {
+    // force repaint!
+    rootxpms[w]->repaint(true);
+    rootxpmsDirty.remove(w);
+  }
 }
 

--- kdebase/konsole/konsole/konsole.h  #1.176:1.177
@@ -285,4 +285,5 @@ private:
 
   QPtrDict<KRootPixmap> rootxpms;
+  QMap<QWidget*, bool>  rootxpmsDirty;
   KWinModule*    kWinModule;