<div>This patch is a feature addition/request.</div>Currently, if the user minimizes VLC , video playback is auto paused and it is resumed when the user 'un'minimizes VLC again.<div><br></div><div>The following patch (also attached) adds to the existing feature by implementing auto pause of video when VLC Player window is not active or does not have keyboard attention. The playback is resumed when VLC Player becomes the active window again.</div>
<div><br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8">Effectively, if some other window takes up the viewer's attention (screen), VLC is paused, and resumed when VLC gets attention again.</div>
<div><br></div><div>Thus now, video is paused in the following situations :</div><div>1. User minimizes VLC window (already existing feature)</div><div>2. User opens some other window, say Chrome or Firefox or something else that takes up the screen and hence the user's attention.</div>
<div>3. User goes to another window using Alt-Tab.</div><div>4. Unexpected pop-up window appears.</div><div><br></div><div>Playback is resumed when VLC window becomes active again. Eg. If VLC was previously paused when the user had opened Chrome window, playback would resume when Chrome window is minimized/closed OR VLC window is explicitly opened again, thus making it active.</div>
<div>Another example: If a pop up window appears while the user is watching a movie, playback would auto pause. Would be resumed when user closes/handles the pop up window or explicitly opens VLC window again.</div><div><br>
</div><div>No need for manually pausing if the user wants to open some other window or task. </div><div>--------------------------------------------------------------------------------------------------------------------------</div>
<div><br></div><div><div>From: Sanjeev M K <<a href="mailto:sanjeevmk4890@gmail.com">sanjeevmk4890@gmail.com</a>></div><div>Date: Mon, 12 Sep 2011 03:26:34 +0530</div><div>Subject: [PATCH 3/3] <span class="Apple-tab-span" style="white-space:pre">      </span>modified:   modules/gui/qt4/main_interface.cpp</div>
<div> Modified function changeEvent() of MainInterface to add the feature of auto pausing video playback when VLC is not currently the active window or does not have keyboard attention.</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">  </span>modified:   modules/gui/qt4/main_interface.hpp</div>
<div>Added variable b_hasPausedWhenInactive of type 'bool' to toggle play/pause when VLC window active/inactive respectively</div><div>---</div><div> modules/gui/qt4/main_interface.cpp |   23 +++++++++++++++++++++++</div>
<div> modules/gui/qt4/main_interface.hpp |    1 +</div><div> 2 files changed, 24 insertions(+), 0 deletions(-)</div><div><br></div><div>diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp</div>
<div>index 193bf7f..1c26a03 100644</div><div>--- a/modules/gui/qt4/main_interface.cpp</div><div>+++ b/modules/gui/qt4/main_interface.cpp</div><div>@@ -1145,6 +1145,29 @@ void MainInterface::changeEvent(QEvent *event)</div>
<div>         }</div><div>     }</div><div> </div><div>+<span class="Apple-tab-span" style="white-space:pre">       </span>else if( (event->type() == QEvent::ActivationChange) )</div><div>+<span class="Apple-tab-span" style="white-space:pre">   </span>{</div>
<div>+<span class="Apple-tab-span" style="white-space:pre">     </span>if( THEMIM->getIM()->playingStatus() == PLAYING_S &&</div><div>+<span class="Apple-tab-span" style="white-space:pre">          </span>THEMIM->getIM()->hasVideo() &&</div>
<div>+<span class="Apple-tab-span" style="white-space:pre">             </span>!THEMIM->getIM()->hasVisualisation() &&</div><div>+<span class="Apple-tab-span" style="white-space:pre">               </span>var_InheritBool( p_intf, "qt-pause-minimized" ) )</div>
<div>+<span class="Apple-tab-span" style="white-space:pre">             </span>{</div><div>+<span class="Apple-tab-span" style="white-space:pre">                   </span>b_hasPausedWhenInactive=true;</div><div>+<span class="Apple-tab-span" style="white-space:pre">                       </span>THEMIM->pause();</div>
<div>+<span class="Apple-tab-span" style="white-space:pre">             </span>}</div><div>+<span class="Apple-tab-span" style="white-space:pre">   </span>else if(THEMIM->getIM()->playingStatus() == PAUSE_S &&</div><div>
+<span class="Apple-tab-span" style="white-space:pre">                        </span>THEMIM->getIM()->hasVideo() &&</div><div>+<span class="Apple-tab-span" style="white-space:pre">                        </span>!THEMIM->getIM()->hasVisualisation() &&</div>
<div>+<span class="Apple-tab-span" style="white-space:pre">                     </span>var_InheritBool( p_intf, "qt-pause-minimized" ) )</div><div>+<span class="Apple-tab-span" style="white-space:pre">         </span>{</div><div>+<span class="Apple-tab-span" style="white-space:pre">                   </span>if(b_hasPausedWhenInactive)</div>
<div>+<span class="Apple-tab-span" style="white-space:pre">                     </span>{</div><div>+<span class="Apple-tab-span" style="white-space:pre">                           </span>b_hasPausedWhenInactive=false;</div><div>+<span class="Apple-tab-span" style="white-space:pre">                              </span>THEMIM->play();</div>
<div>+<span class="Apple-tab-span" style="white-space:pre">                     </span>}</div><div>+<span class="Apple-tab-span" style="white-space:pre">           </span>}</div><div>+<span class="Apple-tab-span" style="white-space:pre">   </span>}</div>
<div>+</div><div>     QWidget::changeEvent(event);</div><div> }</div><div> </div><div>diff --git a/modules/gui/qt4/main_interface.hpp b/modules/gui/qt4/main_interface.hpp</div><div>index cfac21f..dfd0935 100644</div><div>
--- a/modules/gui/qt4/main_interface.hpp</div><div>+++ b/modules/gui/qt4/main_interface.hpp</div><div>@@ -168,6 +168,7 @@ private:</div><div> //    bool                 b_visualSelectorEnabled;</div><div>     bool                 b_plDocked;            ///< Is the playlist docked ?</div>
<div> </div><div>+<span class="Apple-tab-span" style="white-space:pre">     </span>bool<span class="Apple-tab-span" style="white-space:pre">                                </span> b_hasPausedWhenInactive;</div><div>     bool                 b_hasPausedWhenMinimized;</div>
<div>     bool                 b_statusbarVisible;</div></div>