From edbcd03ce99ec0f5b8d3268dc8459f0877bab671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Mon, 8 Mar 2004 15:31:09 +0000 Subject: [PATCH] Fix a problem with topmenu which shows up when turning topmenus off, adding menu applet, turning them on, removing applet -> kwin won't notice it has to manage them. svn path=/trunk/kdebase/kwin/; revision=294455 --- workspace.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/workspace.cpp b/workspace.cpp index 034dba423c..d299a150d6 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -453,10 +453,7 @@ void Workspace::addClient( Client* c, allowed_t ) if( !unconstrained_stacking_order.contains( c )) unconstrained_stacking_order.append( c ); if( c->isTopMenu()) - { addTopMenu( c ); - updateCurrentTopMenu(); // SELI make sure this is called correctly WRT things done in manage() - } updateClientArea(); // this cannot be in manage(), because the client got added only now updateClientLayer( c ); if( c->isDesktop()) @@ -764,18 +761,17 @@ void Workspace::slotReconfigure() else destroyBorderWindows(); - if( options->topMenuEnabled()) + if( options->topMenuEnabled() && !managingTopMenus()) { - if( !managingTopMenus() && topmenu_selection->claim( false )) + if( topmenu_selection->claim( false )) setupTopMenuHandling(); - } - else - { - if( managingTopMenus()) - { - topmenu_selection->release(); + else lostTopMenuSelection(); - } + } + else if( !options->topMenuEnabled() && managingTopMenus()) + { + topmenu_selection->release(); + lostTopMenuSelection(); } topmenu_height = 0; // invalidate used menu height if( managingTopMenus()) @@ -1869,6 +1865,7 @@ void Workspace::addTopMenu( Client* c ) updateTopMenuGeometry(); } updateTopMenuGeometry( c ); + updateCurrentTopMenu(); } // kdDebug() << "NEW TOPMENU:" << c << endl; } @@ -1880,12 +1877,16 @@ void Workspace::removeTopMenu( Client* c ) assert( c->isTopMenu()); assert( topmenus.contains( c )); topmenus.remove( c ); + updateCurrentTopMenu(); // TODO reduce topMenuHeight() if possible? } void Workspace::lostTopMenuSelection() { // kdDebug() << "lost TopMenu selection" << endl; + // make sure this signal is always set when not owning the selection + disconnect( topmenu_watcher, SIGNAL( lostOwner()), this, SLOT( lostTopMenuOwner())); + connect( topmenu_watcher, SIGNAL( lostOwner()), this, SLOT( lostTopMenuOwner())); if( !managing_topmenus ) return; connect( topmenu_watcher, SIGNAL( lostOwner()), this, SLOT( lostTopMenuOwner())); @@ -1925,6 +1926,7 @@ void Workspace::setupTopMenuHandling() updateTopMenuGeometry(); topmenu_space->show(); updateClientArea(); + updateCurrentTopMenu(); } int Workspace::topMenuHeight() const