[vlc-commits] skins2: remove questionable trick

Erwan Tulou git at videolan.org
Tue Mar 1 14:27:52 CET 2011


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Tue Mar  1 13:59:28 2011 +0100| [8fd1f855e0b8b634ce8541e11357df45afeafb36] | committer: 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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8fd1f855e0b8b634ce8541e11357df45afeafb36
---

 modules/gui/skins2/controls/ctrl_checkbox.cpp |   19 +------------------
 1 files changed, 1 insertions(+), 18 deletions(-)

diff --git a/modules/gui/skins2/controls/ctrl_checkbox.cpp b/modules/gui/skins2/controls/ctrl_checkbox.cpp
index 2fff0d4..bd56de0 100644
--- a/modules/gui/skins2/controls/ctrl_checkbox.cpp
+++ b/modules/gui/skins2/controls/ctrl_checkbox.cpp
@@ -196,24 +196,7 @@ void CtrlCheckbox::CmdUpOverDownOver::execute()
 void CtrlCheckbox::CmdDownOverUpOver::execute()
 {
     m_pParent->releaseMouse();
-
-    // 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 );
-
+    m_pParent->setImage( m_pParent->m_pImgUp );
     // Execute the command
     m_pParent->m_pCommand->execute();
 }



More information about the vlc-commits mailing list