Don't use struts if KWin itself restricts workarea size by topmenus.

svn path=/trunk/kdebase/kwin/; revision=266150
This commit is contained in:
Luboš Luňák 2003-11-10 18:08:04 +00:00
parent 468633c0f7
commit 07b08d5d99
4 changed files with 47 additions and 22 deletions

View file

@ -67,6 +67,7 @@ class Client : public QObject, public KDecorationDefines
QRect geometry() const;
QSize size() const;
QSize minSize() const;
QPoint pos() const;
QRect rect() const;
int x() const;
@ -731,6 +732,11 @@ inline QSize Client::size() const
return frame_geometry.size();
}
inline QSize Client::minSize() const
{
return QSize( xSizeHint.min_width, xSizeHint.min_height );
}
inline QPoint Client::pos() const
{
return frame_geometry.topLeft();

View file

@ -351,6 +351,11 @@ void Workspace::unclutterDesktop()
QRect Client::adjustedClientArea( const QRect& area ) const
{
QRect r = area;
if( isTopMenu() && workspace()->managingTopMenus())
{
r.setTop( r.top() + workspace()->topMenuHeight());
return r;
}
NETStrut strut = info->strut();
if ( strut.left > 0 )
r.setLeft( r.left() + (int) strut.left );
@ -431,18 +436,6 @@ void Client::checkWorkspacePosition()
// kdDebug() << "TOPMENU size adjust: " << area << ":" << this << endl;
setGeometry( area );
}
NETStrut strut = info->strut();
int top = workspace()->managingTopMenus() ? workspace()->topMenuHeight() : 0;
if( strut.left != 0 || strut.right != 0 || strut.bottom != 0 || strut.top != top )
{
NETStrut new_strut;
new_strut.left = 0;
new_strut.right = 0;
new_strut.top = top;
new_strut.bottom = 0;
info->setStrut( new_strut );
workspace()->updateClientArea();
}
return;
}

View file

@ -432,6 +432,11 @@ 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())
@ -441,13 +446,6 @@ void Workspace::addClient( Client* c, allowed_t )
if( activeClient() == NULL && should_get_focus.count() == 0 )
activateClient( findDesktop( true, currentDesktop()));
}
if( c->isTopMenu())
{
topmenus.append( c );
c->checkWorkspacePosition();
// kdDebug() << "NEW TOPMENU:" << c << endl;
updateCurrentTopMenu(); // SELI make sure this is called correctly WRT things done in manage()
}
if( c->isUtility() || c->isMenu() || c->isToolbar())
updateToolWindows( true );
checkTransients( c->window()); // SELI does this really belong here?
@ -478,9 +476,8 @@ void Workspace::removeClient( Client* c, allowed_t )
stacking_order.remove( c );
focus_chain.remove( c );
attention_chain.remove( c );
// if( c->isTopMenu())
// kdDebug() << "REMOVE TOPMENU:" << c << endl;
topmenus.remove( c );
if( c->isTopMenu())
removeTopMenu( c );
Group* group = findGroup( c->window());
if( group != NULL )
group->lostLeader();
@ -1804,6 +1801,33 @@ void Workspace::raiseElectricBorders()
}
}
void Workspace::addTopMenu( Client* c )
{
assert( c->isTopMenu());
assert( !topmenus.contains( c ));
topmenus.append( c );
int minsize = c->minSize().height();
if( minsize > topMenuHeight())
{
topmenu_height = minsize;
for( ClientList::ConstIterator it = topmenus.begin();
it != topmenus.end();
++it )
(*it)->checkWorkspacePosition();
}
c->checkWorkspacePosition();
// kdDebug() << "NEW TOPMENU:" << c << endl;
}
void Workspace::removeTopMenu( Client* c )
{
// if( c->isTopMenu())
// kdDebug() << "REMOVE TOPMENU:" << c << endl;
assert( c->isTopMenu());
assert( topmenus.contains( c ));
topmenus.remove( c );
// TODO reduce topMenuHeight() if possible?
}
void Workspace::lostTopMenuSelection()
{

View file

@ -339,6 +339,8 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine
bool keepTransientAbove( const Client* mainwindow, const Client* transient );
void blockStackingUpdates( bool block );
void updateCurrentTopMenu();
void addTopMenu( Client* c );
void removeTopMenu( Client* c );
void updateToolWindows( bool also_hide );
// this is the right way to create a new client