Commit 8fd1f855 authored by Erwan Tulou's avatar Erwan Tulou

skins2: remove questionable trick

This trick only works if the action ends up in the state really being toggled.
This is not always the case and can then lead to undesirable effects,
for instance the play button going to pause when no playback is underway.

This trick was needed to prevent visual artefacts when refreshing was a heavy
task, but is no longer needed since refreshing has been heavily optimised.
parent 01356cfb
...@@ -196,24 +196,7 @@ void CtrlCheckbox::CmdUpOverDownOver::execute() ...@@ -196,24 +196,7 @@ void CtrlCheckbox::CmdUpOverDownOver::execute()
void CtrlCheckbox::CmdDownOverUpOver::execute() void CtrlCheckbox::CmdDownOverUpOver::execute()
{ {
m_pParent->releaseMouse(); m_pParent->releaseMouse();
m_pParent->setImage( m_pParent->m_pImgUp );
// There is a little trick here: since we update the image of the control
// before executing the command, there is no way that the observed variable
// can have changed, so changeButton() has not been called, and m_pImgUp is
// still the "old" up state. That's why we don't use it, and use the other
// one instead. Otherwise, we would notice a "phantom effect", where the
// old up image is displayed for a few milliseconds, until the variable is
// updated and the correct up image is displayed.
// Executing the action before refreshing the state wouldn't work, because
// the variable may be updated asynchronously (when triggered by a callback
// from an object variable).
// Invert the state variable
if( m_pParent->m_pImgUp == &m_pParent->m_imgUp1 )
m_pParent->setImage( &m_pParent->m_imgUp2 );
else
m_pParent->setImage( &m_pParent->m_imgUp1 );
// Execute the command // Execute the command
m_pParent->m_pCommand->execute(); m_pParent->m_pCommand->execute();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment