Show the topmenu_space window reserving the space for standalone menubars

only if there's no menubar active. Helps Fredrik to have the menu shadow
exactly in the color he wants :).

svn path=/trunk/kdebase/kwin/; revision=273185
This commit is contained in:
Luboš Luňák 2003-12-15 18:30:14 +00:00
parent 2197c646eb
commit 997f45b25e
2 changed files with 20 additions and 18 deletions

View file

@ -55,6 +55,7 @@ class Client : public QObject, public KDecorationDefines
Client* transientFor();
bool isTransient() const;
bool groupTransient() const;
bool wasOriginallyGroupTransient() const;
ClientList mainClients() const; // call once before loop , is not indirect
bool hasTransient( const Client* c, bool indirect ) const;
const ClientList& transients() const; // is not indirect
@ -532,6 +533,13 @@ inline bool Client::groupTransient() const
return transient_for_id == workspace()->rootWin();
}
// needed because verifyTransientFor() may set transient_for_id to root window,
// if the original value has a problem (window doesn't exist, etc.)
inline bool Client::wasOriginallyGroupTransient() const
{
return original_transient_for_id == workspace()->rootWin();
}
inline bool Client::isTransient() const
{
return transient_for_id != None;

View file

@ -507,6 +507,8 @@ void Workspace::removeClient( Client* c, allowed_t )
void Workspace::updateCurrentTopMenu()
{
if( !managingTopMenus())
return;
// toplevel menubar handling
Client* menubar = 0;
bool block_desktop_menubar = false;
@ -558,11 +560,11 @@ void Workspace::updateCurrentTopMenu()
for( ClientList::ConstIterator it = topmenus.begin();
it != topmenus.end();
++it )
if( (*it)->groupTransient())
{
menubar = *it;
break;
}
if( (*it)->wasOriginallyGroupTransient()) // kdesktop's topmenu has WM_TRANSIENT_FOR
{ // set pointing to the root window
menubar = *it; // to recognize it here
break; // Also, with the xroot hack in kdesktop,
} // there's no NET::Desktop window to be transient for
}
}
@ -572,27 +574,19 @@ void Workspace::updateCurrentTopMenu()
if( active_client && !menubar->isOnDesktop( active_client->desktop()))
menubar->setDesktop( active_client->desktop());
menubar->hideClient( false );
topmenu_space->hide();
}
else
{ // no topmenu active - show the space window, so that there's not empty space
topmenu_space->show();
}
// ... then hide the other ones. Avoids flickers.
#if 0
// Leave the desktop menubars always visible. Helps visually when the app doesn't show
// its menubar immediately.
for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it)
{
if( (*it)->isTopMenu() && (*it) != menubar && !(*it)->mainClient()->isDesktop() )
(*it)->hideClient( true );
}
#else
// There's a blank area where topmenus are placed, no need to keep
// the desktop one always visible
for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it)
{
if( (*it)->isTopMenu() && (*it) != menubar )
(*it)->hideClient( true );
}
#endif
}