]> git.sesse.net Git - vlc/commitdiff
* modules/video_output/directx/events.c: prevent monitor power down when the directx...
authorGildas Bazin <gbazin@videolan.org>
Mon, 19 Apr 2004 12:44:56 +0000 (12:44 +0000)
committerGildas Bazin <gbazin@videolan.org>
Mon, 19 Apr 2004 12:44:56 +0000 (12:44 +0000)
modules/video_output/directx/events.c

index cea3fbac7f1ad8856be92f370faf9af9b3318df2..5f0197ed3e994007c6f66652bdf8d69e105bc57b 100644 (file)
@@ -84,6 +84,7 @@ void DirectXEventThread( event_thread_t *p_event )
     POINT old_mouse_pos = {0,0};
     vlc_value_t val;
     int i_width, i_height, i_x, i_y;
+    HMODULE hkernel32;
 
     /* Initialisation */
     p_event->p_vout->pf_control = Control;
@@ -100,6 +101,21 @@ void DirectXEventThread( event_thread_t *p_event )
     /* Signal the creation of the window */
     vlc_thread_ready( p_event );
 
+    /* Set power management stuff */
+    if( (hkernel32 = GetModuleHandle( "KERNEL32" ) ) )
+    {
+        ULONG (WINAPI* OurSetThreadExecutionState)( ULONG );
+
+        OurSetThreadExecutionState =
+            GetProcAddress( hkernel32, "SetThreadExecutionState" );
+
+        if( OurSetThreadExecutionState )
+            /* Prevent monitor from powering off */
+            OurSetThreadExecutionState( ES_DISPLAY_REQUIRED );
+        else
+            msg_Dbg( p_event, "no support for SetThreadExecutionState()" );
+    }
+
     /* Main loop */
     /* GetMessage will sleep if there's no message in the queue */
     while( !p_event->b_die && ( p_event->p_vout->p_sys->hparent ||