KWin rules - obey/disobey given position.
svn path=/trunk/kdebase/kwin/; revision=322443
This commit is contained in:
parent
50e4644385
commit
c6a91d80ba
4 changed files with 22 additions and 12 deletions
21
manage.cpp
21
manage.cpp
|
@ -227,18 +227,22 @@ bool Client::manage( Window w, bool isMapped )
|
||||||
placementDone = true;
|
placementDone = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isMapped || session || placementDone
|
bool usePosition = false;
|
||||||
|| ( isTransient() && !isUtility() && !isDialog() && !isSplash()))
|
if ( isMapped || session || placementDone )
|
||||||
{ // TODO
|
placementDone = true; // use geometry
|
||||||
placementDone = TRUE;
|
else if( isTransient() && !isUtility() && !isDialog() && !isSplash())
|
||||||
}
|
usePosition = true;
|
||||||
else if( isTransient() && !hasNETSupport())
|
else if( isTransient() && !hasNETSupport())
|
||||||
placementDone = true;
|
usePosition = true;
|
||||||
else if( isDialog() && hasNETSupport()) // see Placement::placeDialog()
|
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
|
; // force using placement policy
|
||||||
else if( isSplash())
|
else if( isSplash())
|
||||||
; // force using placement policy
|
; // force using placement policy
|
||||||
else
|
else
|
||||||
|
usePosition = true;
|
||||||
|
if( !rules()->checkIgnorePosition( !usePosition ))
|
||||||
{
|
{
|
||||||
bool ignorePPosition = ( options->ignorePositionClasses.contains(QString::fromLatin1(resourceClass())));
|
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)
|
// disobey xinerama placement option for now (#70943)
|
||||||
area = workspace()->clientArea( PlacementArea, geom.center(), desktop());
|
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) )
|
if ( (xSizeHint.flags & USSize) || (xSizeHint.flags & PSize) )
|
||||||
{
|
{
|
||||||
// keep in mind that we now actually have a size :-)
|
// keep in mind that we now actually have a size :-)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (xSizeHint.flags & PMaxSize)
|
if (xSizeHint.flags & PMaxSize)
|
||||||
geom.setSize( geom.size().boundedTo(
|
geom.setSize( geom.size().boundedTo(
|
||||||
|
|
|
@ -418,10 +418,6 @@ void Placement::placeUtility(Client* c, QRect& area )
|
||||||
|
|
||||||
void Placement::placeDialog(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 );
|
placeOnMainWindow( c, area );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ Rules::Rules()
|
||||||
, sizerule( UnusedSetRule )
|
, sizerule( UnusedSetRule )
|
||||||
, minsizerule( UnusedForceRule )
|
, minsizerule( UnusedForceRule )
|
||||||
, maxsizerule( UnusedForceRule )
|
, maxsizerule( UnusedForceRule )
|
||||||
|
, ignorepositionrule( UnusedForceRule )
|
||||||
, desktoprule( UnusedSetRule )
|
, desktoprule( UnusedSetRule )
|
||||||
, typerule( UnusedForceRule )
|
, typerule( UnusedForceRule )
|
||||||
, maximizevertrule( UnusedSetRule )
|
, maximizevertrule( UnusedSetRule )
|
||||||
|
@ -126,6 +127,7 @@ void Rules::readFromCfg( KConfig& cfg )
|
||||||
READ_FORCE_RULE( maxsize, Size, );
|
READ_FORCE_RULE( maxsize, Size, );
|
||||||
if( maxsize.isEmpty())
|
if( maxsize.isEmpty())
|
||||||
maxsizerule = UnusedForceRule;
|
maxsizerule = UnusedForceRule;
|
||||||
|
READ_FORCE_RULE( ignoreposition, Bool, );
|
||||||
READ_SET_RULE( desktop, Num, );
|
READ_SET_RULE( desktop, Num, );
|
||||||
type = readType( cfg, "type" );
|
type = readType( cfg, "type" );
|
||||||
typerule = type != NET::Unknown ? readForceRule( cfg, "typerule" ) : UnusedForceRule;
|
typerule = type != NET::Unknown ? readForceRule( cfg, "typerule" ) : UnusedForceRule;
|
||||||
|
@ -211,6 +213,7 @@ void Rules::write( KConfig& cfg ) const
|
||||||
WRITE_SET_RULE( size, );
|
WRITE_SET_RULE( size, );
|
||||||
WRITE_FORCE_RULE( minsize, );
|
WRITE_FORCE_RULE( minsize, );
|
||||||
WRITE_FORCE_RULE( maxsize, );
|
WRITE_FORCE_RULE( maxsize, );
|
||||||
|
WRITE_FORCE_RULE( ignoreposition, );
|
||||||
WRITE_SET_RULE( desktop, );
|
WRITE_SET_RULE( desktop, );
|
||||||
WRITE_FORCE_RULE( type, );
|
WRITE_FORCE_RULE( type, );
|
||||||
WRITE_SET_RULE( maximizevert, );
|
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( minsize, MinSize, QSize )
|
||||||
APPLY_FORCE_RULE( maxsize, MaxSize, QSize )
|
APPLY_FORCE_RULE( maxsize, MaxSize, QSize )
|
||||||
|
APPLY_FORCE_RULE( ignoreposition, IgnorePosition, bool )
|
||||||
APPLY_RULE( desktop, Desktop, int )
|
APPLY_RULE( desktop, Desktop, int )
|
||||||
APPLY_FORCE_RULE( type, Type, NET::WindowType )
|
APPLY_FORCE_RULE( type, Type, NET::WindowType )
|
||||||
|
|
||||||
|
@ -572,6 +576,7 @@ CHECK_RULE( Position, QPoint )
|
||||||
CHECK_RULE( Size, QSize )
|
CHECK_RULE( Size, QSize )
|
||||||
CHECK_FORCE_RULE( MinSize, QSize )
|
CHECK_FORCE_RULE( MinSize, QSize )
|
||||||
CHECK_FORCE_RULE( MaxSize, QSize )
|
CHECK_FORCE_RULE( MaxSize, QSize )
|
||||||
|
CHECK_FORCE_RULE( IgnorePosition, bool )
|
||||||
CHECK_RULE( Desktop, int )
|
CHECK_RULE( Desktop, int )
|
||||||
CHECK_FORCE_RULE( Type, NET::WindowType )
|
CHECK_FORCE_RULE( Type, NET::WindowType )
|
||||||
CHECK_RULE( MaximizeVert, KDecorationDefines::MaximizeMode )
|
CHECK_RULE( MaximizeVert, KDecorationDefines::MaximizeMode )
|
||||||
|
|
4
rules.h
4
rules.h
|
@ -45,6 +45,7 @@ class WindowRules
|
||||||
QSize checkSize( QSize s, bool init = false ) const;
|
QSize checkSize( QSize s, bool init = false ) const;
|
||||||
QSize checkMinSize( QSize s ) const;
|
QSize checkMinSize( QSize s ) const;
|
||||||
QSize checkMaxSize( QSize s ) const;
|
QSize checkMaxSize( QSize s ) const;
|
||||||
|
bool checkIgnorePosition( bool ignore ) const;
|
||||||
int checkDesktop( int desktop, bool init = false ) const;
|
int checkDesktop( int desktop, bool init = false ) const;
|
||||||
NET::WindowType checkType( NET::WindowType type ) const;
|
NET::WindowType checkType( NET::WindowType type ) const;
|
||||||
MaximizeMode checkMaximize( MaximizeMode mode, bool init = false ) const;
|
MaximizeMode checkMaximize( MaximizeMode mode, bool init = false ) const;
|
||||||
|
@ -85,6 +86,7 @@ class Rules
|
||||||
bool applySize( QSize& s, bool init ) const;
|
bool applySize( QSize& s, bool init ) const;
|
||||||
bool applyMinSize( QSize& s ) const;
|
bool applyMinSize( QSize& s ) const;
|
||||||
bool applyMaxSize( QSize& s ) const;
|
bool applyMaxSize( QSize& s ) const;
|
||||||
|
bool applyIgnorePosition( bool& ignore ) const;
|
||||||
bool applyDesktop( int& desktop, bool init ) const;
|
bool applyDesktop( int& desktop, bool init ) const;
|
||||||
bool applyType( NET::WindowType& type ) const;
|
bool applyType( NET::WindowType& type ) const;
|
||||||
bool applyMaximizeVert( MaximizeMode& mode, bool init ) const;
|
bool applyMaximizeVert( MaximizeMode& mode, bool init ) const;
|
||||||
|
@ -151,6 +153,8 @@ class Rules
|
||||||
ForceRule minsizerule;
|
ForceRule minsizerule;
|
||||||
QSize maxsize;
|
QSize maxsize;
|
||||||
ForceRule maxsizerule;
|
ForceRule maxsizerule;
|
||||||
|
bool ignoreposition;
|
||||||
|
ForceRule ignorepositionrule;
|
||||||
int desktop;
|
int desktop;
|
||||||
SetRule desktoprule;
|
SetRule desktoprule;
|
||||||
NET::WindowType type; // type for setting
|
NET::WindowType type; // type for setting
|
||||||
|
|
Loading…
Reference in a new issue