Honor rules in general isMaximizable/Minimizable/Shadeable queries

REVIEW: 103379
This commit is contained in:
Thomas Lübking 2011-12-10 20:29:01 +01:00
parent 450d90ceb7
commit b7d1dbeb86
2 changed files with 17 additions and 8 deletions

View file

@ -945,6 +945,9 @@ bool Client::isMinimizable() const
{
if (isSpecialWindow())
return false;
if (!rules()->checkMinimize(true))
return false;
if (isTransient()) {
// #66868 - Let other xmms windows be minimized when the mainwindow is minimized
bool shown_mainwindow = false;
@ -978,9 +981,6 @@ void Client::minimize(bool avoid_animation)
{
if (!isMinimizable() || isMinimized())
return;
if (!rules()->checkMinimize(true)) {
return;
}
if (isShade()) // NETWM restriction - KWindowInfo::isMinimized() == Hidden && !Shaded
info->setState(0, NET::Shaded);
@ -1068,13 +1068,13 @@ QRect Client::iconGeometry() const
bool Client::isShadeable() const
{
return !isSpecialWindow() && !noBorder();
return !isSpecialWindow() && !noBorder() && (rules()->checkShade(ShadeNormal) != rules()->checkShade(ShadeNone));
}
void Client::setShade(ShadeMode mode)
{
if (!isShadeable())
return;
if (isSpecialWindow() || noBorder())
mode = ShadeNone;
mode = rules()->checkShade(mode);
if (shade_mode == mode)
return;

View file

@ -1852,7 +1852,9 @@ bool Client::isMaximizable() const
if (!isMovable() || !isResizable() || isToolbar()) // SELI isToolbar() ?
return false;
}
return true;
if (rules()->checkMaximize(MaximizeRestore) == MaximizeRestore && rules()->checkMaximize(MaximizeFull) != MaximizeRestore)
return true;
return false;
}
@ -2127,8 +2129,15 @@ void Client::setMaximize(bool vertically, bool horizontally)
static bool changeMaximizeRecursion = false;
void Client::changeMaximize(bool vertical, bool horizontal, bool adjust)
{
if (!isMaximizable() || changeMaximizeRecursion)
if (changeMaximizeRecursion)
return;
{
// isMovable() and isResizable() may be false for maximized windows
// with moving/resizing maximized windows disabled
TemporaryAssign< MaximizeMode > tmp(max_mode, MaximizeRestore);
if (!isMovable() || !isResizable() || isToolbar()) // SELI isToolbar() ?
return;
}
MaximizeMode old_mode = max_mode;
// 'adjust == true' means to update the size only, e.g. after changing workspace size