Starting a new thread because this is a different patch and the previous thread had become pretty long.<div><br></div><div>As discussed previously in the thread "Pause when window inactive", one of the users suggested the idea of having the 'Pause when window inactive' feature as a Preference option, if there are significant number of users who want it. </div>
<div><br></div><div>The patch posted here, adds the option of pausing when the window becomes inactive (off by default) , to the Interface panel of Simple Preferences (directly above the 'Pause playback when minimized' checkbox). The GUI part has been implemented exactly as done with 'Pause when minimized'. </div>
<div><br></div><div>To summarize, this patch gives the option of pausing when the window becomes inactive. The option is turned OFF by default. If the user turns this ON this option in Simple Preferences (enables it), then the video playback will be automatically paused if the user switches to some other window using Alt+Tab or any other means of going to another window. If VLC doesn't have keyboard attention/ user attention, the video playback will be paused, with this option enabled.</div>
<div><br></div><div>Note - Audio playback is NOT paused.</div><div>The patch: </div><div>----------------------------------------------------------------------------------------</div><div><br></div><div><div>diff --git a/modules/gui/qt4/components/simple_preferences.cpp b/modules/gui/qt4/components/simple_preferences.cpp</div>
<div>index dfe1376..f268929 100644</div><div>--- a/modules/gui/qt4/components/simple_preferences.cpp</div><div>+++ b/modules/gui/qt4/components/simple_preferences.cpp</div><div>@@ -580,6 +580,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,</div>
<div>             CONNECT( ui.systrayBox, toggled( bool ), ui.sysPop, setEnabled( bool ) );</div><div>             ui.sysPop->setEnabled( ui.systrayBox->isChecked() );</div><div> </div><div>+            CONFIG_BOOL( "qt-pause-inactive", pauseInactiveBox );</div>
<div>             CONFIG_BOOL( "qt-pause-minimized", pauseMinimizedBox );</div><div>             CONFIG_BOOL( "playlist-tree", treePlaylist );</div><div>             CONFIG_BOOL( "play-and-pause", playPauseBox );</div>
<div>diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp</div><div>index 193bf7f..1c47c2b 100644</div><div>--- a/modules/gui/qt4/main_interface.cpp</div><div>+++ b/modules/gui/qt4/main_interface.cpp</div>
<div>@@ -1145,7 +1145,30 @@ void MainInterface::changeEvent(QEvent *event)</div><div>         }</div><div>     }</div><div> </div><div>-    QWidget::changeEvent(event);</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-inactive" ) )</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-inactive" ) )</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>+<span class="Apple-tab-span" style="white-space:pre">     </span>QWidget::changeEvent(event);</div><div> }</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> </div><div>diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp</div><div>index 8f3cd21..83de6f3 100644</div>
<div>--- a/modules/gui/qt4/qt4.cpp</div><div>+++ b/modules/gui/qt4/qt4.cpp</div><div>@@ -185,6 +185,10 @@ static void ShowDialog   ( intf_thread_t *, int, int, intf_dialog_args_t * );</div><div> #define QT_PAUSE_MINIMIZED_LONGTEXT N_( \</div>
<div>     "With this option enabled, the playback will be automatically paused when minimizing the window." )</div><div> </div><div>+#define QT_PAUSE_INACTIVE_TEXT N_( "Pause the video playback when window inactive." )</div>
<div>+#define QT_PAUSE_INACTIVE_LONGTEXT N_( \</div><div>+    "With this option enabled, the playback will be automatically paused when window becomes inactive." )</div><div>+</div><div> #define ICONCHANGE_TEXT N_( "Allow automatic icon changes")</div>
<div> #define ICONCHANGE_LONGTEXT N_( \</div><div>     "This option allows the interface to change its icon on various occasions.")</div><div>@@ -211,7 +215,8 @@ vlc_module_begin ()</div><div>               MINIMIZED_LONGTEXT, true)</div>
<div>     add_bool( "qt-pause-minimized", true, QT_PAUSE_MINIMIZED_TEXT,</div><div>               QT_PAUSE_MINIMIZED_LONGTEXT, false )</div><div>-</div><div>+<span class="Apple-tab-span" style="white-space:pre">       </span>add_bool( "qt-pause-inactive", false, QT_PAUSE_INACTIVE_TEXT,</div>
<div>+              QT_PAUSE_INACTIVE_LONGTEXT, true )</div><div>     add_float_with_range( "qt-opacity", 1., 0.1, 1., OPACITY_TEXT,</div><div>                           OPACITY_LONGTEXT, false )</div><div>     add_float_with_range( "qt-fs-opacity", 0.8, 0.1, 1., OPACITY_FS_TEXT,</div>
</div><div><div><br></div>-- <br>Regards,<div>Sanjeev M K</div><br>
</div>