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
This commit is contained in:
Luboš Luňák 2004-03-08 15:31:09 +00:00
parent 4b28eb82db
commit edbcd03ce9

View file

@ -453,10 +453,7 @@ void Workspace::addClient( Client* c, allowed_t )
if( !unconstrained_stacking_order.contains( c )) if( !unconstrained_stacking_order.contains( c ))
unconstrained_stacking_order.append( c ); unconstrained_stacking_order.append( c );
if( c->isTopMenu()) if( c->isTopMenu())
{
addTopMenu( c ); 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 updateClientArea(); // this cannot be in manage(), because the client got added only now
updateClientLayer( c ); updateClientLayer( c );
if( c->isDesktop()) if( c->isDesktop())
@ -764,18 +761,17 @@ void Workspace::slotReconfigure()
else else
destroyBorderWindows(); destroyBorderWindows();
if( options->topMenuEnabled()) if( options->topMenuEnabled() && !managingTopMenus())
{ {
if( !managingTopMenus() && topmenu_selection->claim( false )) if( topmenu_selection->claim( false ))
setupTopMenuHandling(); setupTopMenuHandling();
} else
else
{
if( managingTopMenus())
{
topmenu_selection->release();
lostTopMenuSelection(); lostTopMenuSelection();
} }
else if( !options->topMenuEnabled() && managingTopMenus())
{
topmenu_selection->release();
lostTopMenuSelection();
} }
topmenu_height = 0; // invalidate used menu height topmenu_height = 0; // invalidate used menu height
if( managingTopMenus()) if( managingTopMenus())
@ -1869,6 +1865,7 @@ void Workspace::addTopMenu( Client* c )
updateTopMenuGeometry(); updateTopMenuGeometry();
} }
updateTopMenuGeometry( c ); updateTopMenuGeometry( c );
updateCurrentTopMenu();
} }
// kdDebug() << "NEW TOPMENU:" << c << endl; // kdDebug() << "NEW TOPMENU:" << c << endl;
} }
@ -1880,12 +1877,16 @@ void Workspace::removeTopMenu( Client* c )
assert( c->isTopMenu()); assert( c->isTopMenu());
assert( topmenus.contains( c )); assert( topmenus.contains( c ));
topmenus.remove( c ); topmenus.remove( c );
updateCurrentTopMenu();
// TODO reduce topMenuHeight() if possible? // TODO reduce topMenuHeight() if possible?
} }
void Workspace::lostTopMenuSelection() void Workspace::lostTopMenuSelection()
{ {
// kdDebug() << "lost TopMenu selection" << endl; // 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 ) if( !managing_topmenus )
return; return;
connect( topmenu_watcher, SIGNAL( lostOwner()), this, SLOT( lostTopMenuOwner())); connect( topmenu_watcher, SIGNAL( lostOwner()), this, SLOT( lostTopMenuOwner()));
@ -1925,6 +1926,7 @@ void Workspace::setupTopMenuHandling()
updateTopMenuGeometry(); updateTopMenuGeometry();
topmenu_space->show(); topmenu_space->show();
updateClientArea(); updateClientArea();
updateCurrentTopMenu();
} }
int Workspace::topMenuHeight() const int Workspace::topMenuHeight() const