Placement policy 'maximizing'.
svn path=/trunk/KDE/kdebase/kwin/; revision=444046
This commit is contained in:
parent
6a1baeaea0
commit
678a1ce18a
7 changed files with 57 additions and 18 deletions
6
client.h
6
client.h
|
@ -204,6 +204,9 @@ class Client : public QObject, public KDecorationDefines
|
|||
// plainResize() simply resizes
|
||||
void plainResize( int w, int h, ForceGeometry_t force = NormalGeometrySet );
|
||||
void plainResize( const QSize& s, ForceGeometry_t force = NormalGeometrySet );
|
||||
// resizeWithChecks() resizes according to gravity, and checks workarea position
|
||||
void resizeWithChecks( int w, int h, ForceGeometry_t force = NormalGeometrySet );
|
||||
void resizeWithChecks( const QSize& s, ForceGeometry_t force = NormalGeometrySet );
|
||||
void keepInArea( QRect area, bool partial = false );
|
||||
|
||||
void growHorizontal();
|
||||
|
@ -376,9 +379,6 @@ class Client : public QObject, public KDecorationDefines
|
|||
void checkDirection( int new_diff, int old_diff, QRect& rect, const QRect& area );
|
||||
static int computeWorkareaDiff( int left, int right, int a_left, int a_right );
|
||||
void configureRequest( int value_mask, int rx, int ry, int rw, int rh, int gravity, bool from_tool );
|
||||
// resizeWithChecks() resizes according to gravity, and checks workarea position
|
||||
void resizeWithChecks( int w, int h, ForceGeometry_t force = NormalGeometrySet );
|
||||
void resizeWithChecks( const QSize& s, ForceGeometry_t force = NormalGeometrySet );
|
||||
NETExtendedStrut strut() const;
|
||||
bool hasStrut() const;
|
||||
int checkShadeGeometry( int w, int h );
|
||||
|
|
|
@ -848,6 +848,7 @@ KMovingConfig::KMovingConfig (bool _standAlone, KConfig *_config, QWidget *paren
|
|||
|
||||
placementCombo = new QComboBox(false, windowsBox);
|
||||
placementCombo->insertItem(i18n("Smart"), SMART_PLACEMENT);
|
||||
placementCombo->insertItem(i18n("Maximizing"), MAXIMIZING_PLACEMENT);
|
||||
placementCombo->insertItem(i18n("Cascade"), CASCADE_PLACEMENT);
|
||||
placementCombo->insertItem(i18n("Random"), RANDOM_PLACEMENT);
|
||||
placementCombo->insertItem(i18n("Centered"), CENTERED_PLACEMENT);
|
||||
|
@ -862,6 +863,9 @@ KMovingConfig::KMovingConfig (bool _standAlone, KConfig *_config, QWidget *paren
|
|||
" will appear on the desktop."
|
||||
" <ul>"
|
||||
" <li><em>Smart</em> will try to achieve a minimum overlap of windows</li>"
|
||||
" <li><em>Maximizing</em> will try to maximize every window to fill the whole screen."
|
||||
" It might be useful to selectively affect placement of some windows using"
|
||||
" the window-specific settings.</li>"
|
||||
" <li><em>Cascade</em> will cascade the windows</li>"
|
||||
" <li><em>Random</em> will use a random position</li>"
|
||||
" <li><em>Centered</em> will place the window centered</li>"
|
||||
|
@ -1068,7 +1072,8 @@ void KMovingConfig::load( void )
|
|||
setPlacement(CENTERED_PLACEMENT);
|
||||
else if( key == "ZeroCornered")
|
||||
setPlacement(ZEROCORNERED_PLACEMENT);
|
||||
|
||||
else if( key == "Maximizing")
|
||||
setPlacement(MAXIMIZING_PLACEMENT);
|
||||
else
|
||||
setPlacement(SMART_PLACEMENT);
|
||||
// }
|
||||
|
@ -1115,6 +1120,8 @@ void KMovingConfig::save( void )
|
|||
config->writeEntry(KWIN_PLACEMENT, "Centered");
|
||||
else if (v == ZEROCORNERED_PLACEMENT)
|
||||
config->writeEntry(KWIN_PLACEMENT, "ZeroCornered");
|
||||
else if (v == MAXIMIZING_PLACEMENT)
|
||||
config->writeEntry(KWIN_PLACEMENT, "Maximizing");
|
||||
//CT 13mar98 manual and interactive placement
|
||||
// else if (v == MANUAL_PLACEMENT)
|
||||
// config->writeEntry(KWIN_PLACEMENT, "Manual");
|
||||
|
|
|
@ -53,12 +53,13 @@ class KIntNumInput;
|
|||
#define RESIZE_OPAQUE 1
|
||||
|
||||
#define SMART_PLACEMENT 0
|
||||
#define CASCADE_PLACEMENT 1
|
||||
#define RANDOM_PLACEMENT 2
|
||||
#define CENTERED_PLACEMENT 3
|
||||
#define ZEROCORNERED_PLACEMENT 4
|
||||
#define INTERACTIVE_PLACEMENT 5
|
||||
#define MANUAL_PLACEMENT 6
|
||||
#define MAXIMIZING_PLACEMENT 1
|
||||
#define CASCADE_PLACEMENT 2
|
||||
#define RANDOM_PLACEMENT 3
|
||||
#define CENTERED_PLACEMENT 4
|
||||
#define ZEROCORNERED_PLACEMENT 5
|
||||
#define INTERACTIVE_PLACEMENT 6
|
||||
#define MANUAL_PLACEMENT 7
|
||||
|
||||
#define CLICK_TO_FOCUS 0
|
||||
#define FOCUS_FOLLOWS_MOUSE 1
|
||||
|
|
|
@ -267,13 +267,14 @@ static int placementToCombo( Placement::Policy placement )
|
|||
{
|
||||
1, // NoPlacement
|
||||
0, // Default
|
||||
5, // Random
|
||||
6, // Random
|
||||
2, // Smart
|
||||
3, // Cascade
|
||||
4, // Centered
|
||||
6, // ZeroCornered
|
||||
7, // UnderMouse
|
||||
8 // OnMainWindow
|
||||
4, // Cascade
|
||||
5, // Centered
|
||||
7, // ZeroCornered
|
||||
8, // UnderMouse
|
||||
9, // OnMainWindow
|
||||
3 // Maximizing
|
||||
};
|
||||
return conv[ placement ];
|
||||
}
|
||||
|
@ -285,6 +286,7 @@ static Placement::Policy comboToPlacement( int val )
|
|||
Placement::Default,
|
||||
Placement::NoPlacement,
|
||||
Placement::Smart,
|
||||
Placement::Maximizing,
|
||||
Placement::Cascade,
|
||||
Placement::Centered,
|
||||
Placement::Random,
|
||||
|
|
|
@ -1121,6 +1121,11 @@
|
|||
<string>Smart</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Maximizing</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Cascade</string>
|
||||
|
|
|
@ -80,6 +80,8 @@ void Placement::place(Client* c, Policy policy, QRect& area )
|
|||
placeUnderMouse(c, area);
|
||||
else if (policy == OnMainWindow)
|
||||
placeOnMainWindow(c, area);
|
||||
else if( policy == Maximizing )
|
||||
placeMaximizing(c, area);
|
||||
else
|
||||
placeSmart(c, area);
|
||||
}
|
||||
|
@ -479,6 +481,24 @@ void Placement::placeOnMainWindow(Client* c, QRect& area )
|
|||
c->keepInArea( area ); // make sure it's kept inside workarea
|
||||
}
|
||||
|
||||
void Placement::placeMaximizing(Client* c, const QRect& area )
|
||||
{
|
||||
if( c->isMaximizable() && c->maxSize().width() >= area.width() && c->maxSize().height() >= area.height())
|
||||
{
|
||||
if( m_WorkspacePtr->clientArea( MaximizeArea, c ) == area )
|
||||
c->maximize( Client::MaximizeFull );
|
||||
else // if the geometry doesn't match default maximize area (xinerama case?),
|
||||
{ // it's probably better to use the given area
|
||||
c->setGeometry( area );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
c->resizeWithChecks( c->maxSize().boundedTo( area.size()));
|
||||
placeSmart( c, area );
|
||||
}
|
||||
}
|
||||
|
||||
QRect Placement::checkArea( const Client* c, const QRect& area )
|
||||
{
|
||||
if( area.isNull())
|
||||
|
@ -507,6 +527,8 @@ Placement::Policy Placement::policyFromString( const QString& policy, bool no_sp
|
|||
return UnderMouse;
|
||||
else if( policy == "OnMainWindow" && !no_special)
|
||||
return OnMainWindow;
|
||||
else if( policy == "Maximizing" )
|
||||
return Maximizing;
|
||||
else
|
||||
return Smart;
|
||||
}
|
||||
|
@ -515,7 +537,7 @@ const char* Placement::policyToString( Policy policy )
|
|||
{
|
||||
const char* const policies[] =
|
||||
{ "NoPlacement", "Default", "Random", "Smart", "Cascade", "Centered",
|
||||
"ZeroCornered", "UnderMouse", "OnMainWindow" };
|
||||
"ZeroCornered", "UnderMouse", "OnMainWindow", "Maximizing" };
|
||||
assert( policy < int( sizeof( policies ) / sizeof( policies[ 0 ] )));
|
||||
return policies[ policy ];
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ class Placement
|
|||
void placeAtRandom (Client* c, const QRect& area );
|
||||
void placeCascaded (Client* c, const QRect& area, bool re_init = false);
|
||||
void placeSmart (Client* c, const QRect& area );
|
||||
void placeMaximizing (Client* c, const QRect& area );
|
||||
void placeCentered (Client* c, const QRect& area );
|
||||
void placeZeroCornered(Client* c, const QRect& area );
|
||||
void placeDialog (Client* c, QRect& area );
|
||||
|
@ -55,7 +56,8 @@ class Placement
|
|||
Centered,
|
||||
ZeroCornered,
|
||||
UnderMouse, // special
|
||||
OnMainWindow // special
|
||||
OnMainWindow, // special
|
||||
Maximizing
|
||||
};
|
||||
|
||||
static Policy policyFromString( const QString& policy, bool no_special );
|
||||
|
|
Loading…
Reference in a new issue