KWin rules - obey/disobey given position.

svn path=/trunk/kdebase/kwin/; revision=322443
This commit is contained in:
Luboš Luňák 2004-06-21 12:38:40 +00:00
parent 50e4644385
commit c6a91d80ba
4 changed files with 22 additions and 12 deletions

View file

@ -227,18 +227,22 @@ bool Client::manage( Window w, bool isMapped )
placementDone = true;
}
if ( isMapped || session || placementDone
|| ( isTransient() && !isUtility() && !isDialog() && !isSplash()))
{ // TODO
placementDone = TRUE;
}
bool usePosition = false;
if ( isMapped || session || placementDone )
placementDone = true; // use geometry
else if( isTransient() && !isUtility() && !isDialog() && !isSplash())
usePosition = true;
else if( isTransient() && !hasNETSupport())
placementDone = true;
else if( isDialog() && hasNETSupport()) // see Placement::placeDialog()
usePosition = true;
else if( isDialog() && hasNETSupport())
// if the dialog is actually non-NETWM transient window, don't try to apply placement to it,
// it breaks with too many things (xmms, display)
; // force using placement policy
else if( isSplash())
; // force using placement policy
else
usePosition = true;
if( !rules()->checkIgnorePosition( !usePosition ))
{
bool ignorePPosition = ( options->ignorePositionClasses.contains(QString::fromLatin1(resourceClass())));
@ -249,11 +253,12 @@ bool Client::manage( Window w, bool isMapped )
// disobey xinerama placement option for now (#70943)
area = workspace()->clientArea( PlacementArea, geom.center(), desktop());
}
}
if( true ) // size is always obeyed for now, only with constraints applied
if ( (xSizeHint.flags & USSize) || (xSizeHint.flags & PSize) )
{
// keep in mind that we now actually have a size :-)
}
}
if (xSizeHint.flags & PMaxSize)
geom.setSize( geom.size().boundedTo(

View file

@ -418,10 +418,6 @@ void Placement::placeUtility(Client* c, QRect& area )
void Placement::placeDialog(Client* c, QRect& area )
{
// if the dialog is actually non-NETWM transient window, don't apply placement to it,
// it breaks with too many things (xmms, display)
if( !c->hasNETSupport())
return;
placeOnMainWindow( c, area );
}

View file

@ -37,6 +37,7 @@ Rules::Rules()
, sizerule( UnusedSetRule )
, minsizerule( UnusedForceRule )
, maxsizerule( UnusedForceRule )
, ignorepositionrule( UnusedForceRule )
, desktoprule( UnusedSetRule )
, typerule( UnusedForceRule )
, maximizevertrule( UnusedSetRule )
@ -126,6 +127,7 @@ void Rules::readFromCfg( KConfig& cfg )
READ_FORCE_RULE( maxsize, Size, );
if( maxsize.isEmpty())
maxsizerule = UnusedForceRule;
READ_FORCE_RULE( ignoreposition, Bool, );
READ_SET_RULE( desktop, Num, );
type = readType( cfg, "type" );
typerule = type != NET::Unknown ? readForceRule( cfg, "typerule" ) : UnusedForceRule;
@ -211,6 +213,7 @@ void Rules::write( KConfig& cfg ) const
WRITE_SET_RULE( size, );
WRITE_FORCE_RULE( minsize, );
WRITE_FORCE_RULE( maxsize, );
WRITE_FORCE_RULE( ignoreposition, );
WRITE_SET_RULE( desktop, );
WRITE_FORCE_RULE( type, );
WRITE_SET_RULE( maximizevert, );
@ -430,6 +433,7 @@ bool Rules::applySize( QSize& s, bool init ) const
APPLY_FORCE_RULE( minsize, MinSize, QSize )
APPLY_FORCE_RULE( maxsize, MaxSize, QSize )
APPLY_FORCE_RULE( ignoreposition, IgnorePosition, bool )
APPLY_RULE( desktop, Desktop, int )
APPLY_FORCE_RULE( type, Type, NET::WindowType )
@ -572,6 +576,7 @@ CHECK_RULE( Position, QPoint )
CHECK_RULE( Size, QSize )
CHECK_FORCE_RULE( MinSize, QSize )
CHECK_FORCE_RULE( MaxSize, QSize )
CHECK_FORCE_RULE( IgnorePosition, bool )
CHECK_RULE( Desktop, int )
CHECK_FORCE_RULE( Type, NET::WindowType )
CHECK_RULE( MaximizeVert, KDecorationDefines::MaximizeMode )

View file

@ -45,6 +45,7 @@ class WindowRules
QSize checkSize( QSize s, bool init = false ) const;
QSize checkMinSize( QSize s ) const;
QSize checkMaxSize( QSize s ) const;
bool checkIgnorePosition( bool ignore ) const;
int checkDesktop( int desktop, bool init = false ) const;
NET::WindowType checkType( NET::WindowType type ) const;
MaximizeMode checkMaximize( MaximizeMode mode, bool init = false ) const;
@ -85,6 +86,7 @@ class Rules
bool applySize( QSize& s, bool init ) const;
bool applyMinSize( QSize& s ) const;
bool applyMaxSize( QSize& s ) const;
bool applyIgnorePosition( bool& ignore ) const;
bool applyDesktop( int& desktop, bool init ) const;
bool applyType( NET::WindowType& type ) const;
bool applyMaximizeVert( MaximizeMode& mode, bool init ) const;
@ -151,6 +153,8 @@ class Rules
ForceRule minsizerule;
QSize maxsize;
ForceRule maxsizerule;
bool ignoreposition;
ForceRule ignorepositionrule;
int desktop;
SetRule desktoprule;
NET::WindowType type; // type for setting