Fix shading: isShade() returns the actual state of the window, and isSetShade()
returns the state set by the user - these two may differ e.g. while hover-unshaded. Therefore titlebar buttons should use isSetShade(), otherwise they become a bit useless with hover-unshading. Also fix updating the button state - the styles duplicate way too much code, and if one of them has a bug, most of them definitely have it as well. Some of the code should probably move to the decoration lib :-/ . svn path=/trunk/kdebase/kwin/; revision=366147icc-effect-5.14.5
parent
a0284f092c
commit
9a5a1c5d95
|
@ -700,7 +700,11 @@ void Client::setShade( ShadeMode mode )
|
|||
ShadeMode was_shade_mode = shade_mode;
|
||||
shade_mode = mode;
|
||||
if( was_shade == isShade())
|
||||
{
|
||||
if( decoration != NULL ) // decoration may want to update after e.g. hover-shade changes
|
||||
decoration->shadeChange();
|
||||
return; // no real change in shaded state
|
||||
}
|
||||
|
||||
if( shade_mode == ShadeNormal )
|
||||
{
|
||||
|
|
|
@ -329,7 +329,7 @@ void B2Client::maxButtonClicked()
|
|||
|
||||
void B2Client::shadeButtonClicked()
|
||||
{
|
||||
setShade(!isShade());
|
||||
setShade(!isSetShade());
|
||||
}
|
||||
|
||||
void B2Client::resizeButtonPressed()
|
||||
|
@ -350,7 +350,7 @@ void B2Client::init()
|
|||
i18n("Not on all desktops") : i18n("On all desktops"),
|
||||
i18n("Minimize"), i18n("Maximize"),
|
||||
i18n("Close"), i18n("Help"),
|
||||
isShade() ? i18n("Unshade") : i18n("Shade"),
|
||||
isSetShade() ? i18n("Unshade") : i18n("Shade"),
|
||||
i18n("Resize")
|
||||
};
|
||||
|
||||
|
@ -845,7 +845,7 @@ void B2Client::shadeChange()
|
|||
doShape();
|
||||
if (B2Button *b = button[BtnShade]) {
|
||||
QToolTip::remove(b);
|
||||
QToolTip::add(b, isShade() ? i18n("Unshade") : i18n("Shade"));
|
||||
QToolTip::add(b, isSetShade() ? i18n("Unshade") : i18n("Shade"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -891,7 +891,7 @@ void B2Client::menuButtonPressed()
|
|||
minimize();
|
||||
break;
|
||||
case B2::ShadeOp:
|
||||
setShade(!isShade());
|
||||
setShade(!isSetShade());
|
||||
break;
|
||||
case B2::CloseOp:
|
||||
closeWindow();
|
||||
|
|
|
@ -1021,8 +1021,6 @@ void KDEDefaultClient::slotBelow()
|
|||
void KDEDefaultClient::slotShade()
|
||||
{
|
||||
setShade( !isSetShade());
|
||||
button[BtnShade]->setBitmap(isSetShade() ? shade_on_bits : shade_off_bits );
|
||||
button[BtnShade]->repaint(true);
|
||||
}
|
||||
|
||||
void KDEDefaultClient::resizeEvent( QResizeEvent* e)
|
||||
|
@ -1285,7 +1283,8 @@ void KDEDefaultClient::activeChange()
|
|||
void KDEDefaultClient::shadeChange()
|
||||
{
|
||||
if (button[BtnShade]) {
|
||||
bool on = isShade();
|
||||
bool on = isSetShade();
|
||||
button[BtnShade]->setBitmap( on ? shade_on_bits : shade_off_bits );
|
||||
button[BtnShade]->turnOn(on);
|
||||
button[BtnShade]->repaint(false);
|
||||
QToolTip::remove( button[BtnShade] );
|
||||
|
|
|
@ -524,10 +524,6 @@ void ModernSys::slotBelow()
|
|||
void ModernSys::slotShade()
|
||||
{
|
||||
setShade( !isSetShade());
|
||||
if (button[BtnShade]) {
|
||||
button[BtnShade]->setBitmap(isSetShade() ? shade_on_bits : shade_off_bits );
|
||||
button[BtnShade]->repaint(true);
|
||||
}
|
||||
}
|
||||
|
||||
void ModernSys::resizeEvent( QResizeEvent* )
|
||||
|
@ -796,8 +792,9 @@ void ModernSys::iconChange()
|
|||
void ModernSys::shadeChange()
|
||||
{
|
||||
if (button[BtnShade]) {
|
||||
bool on = isShade();
|
||||
bool on = isSetShade();
|
||||
button[BtnShade]->turnOn(on);
|
||||
button[BtnShade]->setBitmap(isSetShade() ? shade_on_bits : shade_off_bits );
|
||||
button[BtnShade]->repaint(false);
|
||||
QToolTip::remove( button[BtnShade] );
|
||||
QToolTip::add( button[BtnShade], on ? i18n("Unshade") : i18n("Shade"));
|
||||
|
|
|
@ -606,7 +606,7 @@ void PlastikClient::addButtons(QBoxLayout *layout, const QString& s, int buttonS
|
|||
break;
|
||||
case 'L': // Shade button
|
||||
if ((!m_button[ShadeButton]) && isShadeable()){
|
||||
bool shaded = isShade();
|
||||
bool shaded = isSetShade();
|
||||
m_button[ShadeButton] = new PlastikButton(this, "shade",
|
||||
shaded?i18n("Unshade"):i18n("Shade"), ShadeButton, buttonSize, true);
|
||||
m_button[ShadeButton]->setOn( shaded );
|
||||
|
@ -762,7 +762,7 @@ void PlastikClient::desktopChange()
|
|||
void PlastikClient::shadeChange()
|
||||
{
|
||||
if ( m_button[ShadeButton] ) {
|
||||
bool shaded = isShade();
|
||||
bool shaded = isSetShade();
|
||||
m_button[ShadeButton]->setOn( shaded );
|
||||
m_button[ShadeButton]->setTipText( shaded ?
|
||||
i18n("Unshade")
|
||||
|
@ -781,7 +781,7 @@ void PlastikClient::slotMaximize()
|
|||
|
||||
void PlastikClient::slotShade()
|
||||
{
|
||||
setShade( !isShade() );
|
||||
setShade( !isSetShade() );
|
||||
}
|
||||
|
||||
void PlastikClient::slotKeepAbove()
|
||||
|
|
|
@ -782,8 +782,9 @@ void QuartzClient::keepBelowChange( bool below )
|
|||
void QuartzClient::shadeChange()
|
||||
{
|
||||
if (button[BtnShade]) {
|
||||
bool on = isShade();
|
||||
bool on = isSetShade();
|
||||
button[BtnShade]->turnOn(on);
|
||||
button[BtnShade]->setBitmap(on ? shade_on_bits : shade_off_bits );
|
||||
button[BtnShade]->repaint(false);
|
||||
QToolTip::remove( button[BtnShade] );
|
||||
QToolTip::add( button[BtnShade], on ? i18n("Unshade") : i18n("Shade"));
|
||||
|
@ -819,8 +820,6 @@ void QuartzClient::slotBelow()
|
|||
void QuartzClient::slotShade()
|
||||
{
|
||||
setShade( !isSetShade());
|
||||
button[BtnShade]->setBitmap(isSetShade() ? shade_on_bits : shade_off_bits );
|
||||
button[BtnShade]->repaint(true);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -377,6 +377,8 @@ class KWIN_EXPORT KDecoration
|
|||
/**
|
||||
* Returns @a true if the decorated window is currently shaded.
|
||||
* If the window is e.g. hover unshaded, it's not considered to be shaded.
|
||||
* This function should not be used for the shade titlebar button, use
|
||||
* @ref isSetShade() instead.
|
||||
*
|
||||
* @see isSetShade
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue