Bug 66152 - High CPU load when using desktop menu bar
Summary: High CPU load when using desktop menu bar
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR major
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 67264 67401 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-10-17 10:04 UTC by Mathieu Jobin
Modified: 2003-11-18 19:57 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mathieu Jobin 2003-10-17 10:04:48 UTC
Version:           unknown (using KDE 3.1.92 (alpha2, CVS >= 20030921), compiled sources)
Compiler:          gcc version 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk)
OS:          Linux (i686) release 2.4.21-0.13mdk

When I enable Desktop menu bar, kdesktop and X process eat up all my CPU.
My load average never stop increase.... KDE become unusable.
After a fresh startup, no apps running, i get at least a load average of 3. up to 8 when i'm surfing, etc.

I was about to worry, i thought it was KDE, because i dont have any load on every others window manager. but i try with my girlfriend's login and she had similar performance.

So i try removing my kdesktoprc and found the same performance.... i diff the new file with mine, and the menubar jump to my eye... since that menubar NEVER EVER SHOW UP.

I did not remember I had enabled that. because it never works, but this is the features that eat up my memory. i just select it in the config dialog, click apply without restarting anything, my CPU load goes up and up. disable it, everything come back to normal.
Comment 1 Stephan Binner 2003-10-17 11:43:30 UTC
David said "blame new kwin". :-)
Comment 2 Stephan Binner 2003-11-06 19:29:17 UTC
*** Bug 67264 has been marked as a duplicate of this bug. ***
Comment 3 Stephan Binner 2003-11-06 19:29:30 UTC
*** Bug 67401 has been marked as a duplicate of this bug. ***
Comment 4 Lubos Lunak 2003-11-12 10:49:03 UTC

*** This bug has been marked as a duplicate of 65897 ***
Comment 5 Stephan Binner 2003-11-12 21:35:32 UTC
Does the solution require any patches from qt-copy? With setting "desktop menu bar" the menu bar stays blank while causing high CPU load. With setting "application bar" the application bar works fine, but stays blank (without high CPU load) when there should be the desktop bar (no window has focus).
Comment 6 Stephan Binner 2003-11-12 21:39:32 UTC
Addition: The blank bar doesn't go away when turned off.
Comment 7 Lubos Lunak 2003-11-13 15:34:32 UTC
Please update and try again.
Comment 8 Mathieu Jobin 2003-11-14 06:33:45 UTC
I  just recompile everything from CVS HEAD yesterday.
 and i'm using the MacOS menu bar right now.
I've also try the other desktop menu bar, works fine.
no excessive CPU load.

but when i'm on the desktop, theer is nothing on the BAR.
Comment 9 Stephan Binner 2003-11-14 09:15:13 UTC
Turning off menu bar now works. The desktop menu bar stays blank in both modes where it displays here too. And application menu bar flickers and causes high CPU load. As previously, qt-copy without patches.
Comment 10 Mathieu Jobin 2003-11-15 01:42:19 UTC
The MacOS Bar was not eating excessif CPU until I shut it off.
When I remove it, the bar did not dispear and kicker and kdesktop start taking the cpu load. until a load of 3.00
then I reenable the mac bar and my load is back to 0.30

Comment 11 Lubos Lunak 2003-11-18 19:57:25 UTC
Subject: kdelibs/kdeui

CVS commit by lunakl: 

Try even harder to avoid infinite recursion.
CCMAIL: 66152-done@bugs.kde.org


  M +10 -9     kmenubar.cpp   1.177
  M +3 -3      kmenubar.h   1.61


--- kdelibs/kdeui/kmenubar.cpp  #1.176:1.177
@@ -329,12 +329,13 @@ void KMenuBar::selectionTimeout()
 }
 
-// KDE4 remove
+int KMenuBar::block_resize = 0;
+
 void KMenuBar::resizeEvent( QResizeEvent *e )
 {
-    QMenuBar::resizeEvent(e);
+    ++block_resize; // do not respond with configure request to ConfigureNotify event
+    QMenuBar::resizeEvent(e); // to avoid possible infinite loop
+    --block_resize;
 }
 
-bool KMenuBar::block_resize = false;
-
 void KMenuBar::setGeometry( const QRect& r )
 {
@@ -344,7 +345,7 @@ void KMenuBar::setGeometry( const QRect&
 void KMenuBar::setGeometry( int x, int y, int w, int h )
 {
-    if( block_resize )
+    if( block_resize > 0 )
     {
-        QMenuBar::setGeometry( x, y, width(), height());
+        move( x, y );
         return;
     }
@@ -356,5 +357,5 @@ void KMenuBar::setGeometry( int x, int y
 void KMenuBar::resize( int w, int h )
 {
-    if( block_resize )
+    if( block_resize > 0 )
         return;
     checkSize( w, h );
@@ -375,9 +376,9 @@ void KMenuBar::checkSize( int& w, int& h
       // sizeHint() may indirectly call resize(), avoid infinite
       // recursion.
-        block_resize = true;
+        ++block_resize;
         QSize s = sizeHint();
         w = s.width();
         h = s.height();
-        block_resize = false;
+        ++block_resize;
     }
     // This is not done as setMinimumSize(), becase that would set the minimum

--- kdelibs/kdeui/kmenubar.h  #1.60:1.61
@@ -96,5 +96,5 @@ private:
     void setTopLevelMenuInternal(bool top_level);
     void checkSize( int& w, int& h );
-    static bool block_resize;
+    static int block_resize;
 protected:
     virtual void virtual_hook( int id, void* data );