1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2001-2009 the VideoLAN team
7 * Authors: Gildas Bazin <gbazin@videolan.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
25 /*****************************************************************************
26 * Preamble: This file contains the functions related to the creation of
27 * a window and the handling of its messages (events).
28 *****************************************************************************/
33 #include <errno.h> /* ENOMEM */
34 #include <ctype.h> /* tolower() */
37 # define _WIN32_WINNT 0x0500
40 #include <vlc_common.h>
41 #include <vlc_interface.h>
42 #include <vlc_playlist.h>
44 #include <vlc_vout_window.h>
51 #ifdef MODULE_NAME_IS_directx
54 #ifdef MODULE_NAME_IS_direct3d
57 #ifdef MODULE_NAME_IS_glwin32
65 #include <vlc_windows_interfaces.h>
70 //WINSHELLAPI BOOL WINAPI SHFullScreen(HWND hwndRequester, DWORD dwState);
73 static int vaControlParentWindow( vout_thread_t *, int, va_list );
76 int CommonInit( vout_thread_t *p_vout )
78 vout_sys_t *p_sys = p_vout->p_sys;
81 p_sys->hvideownd = NULL;
82 p_sys->hparent = NULL;
85 SetRectEmpty( &p_sys->rect_display );
86 SetRectEmpty( &p_sys->rect_parent );
87 vlc_mutex_init( &p_sys->lock );
89 var_Create( p_vout, "video-title", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
91 /* Set main window's size */
92 p_sys->i_window_width = p_vout->i_window_width;
93 p_sys->i_window_height = p_vout->i_window_height;
95 p_sys->p_event = EventThreadCreate( p_vout );
98 if( EventThreadStart( p_sys->p_event ) )
101 /* Variable to indicate if the window should be on top of others */
102 /* Trigger a callback right now */
103 var_TriggerCallback( p_vout, "video-on-top" );
105 /* Why not with glwin32 */
106 #if !defined(UNDER_CE) && !defined(MODULE_NAME_IS_glwin32)
107 var_Create( p_vout, "disable-screensaver", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
108 DisableScreensaver ( p_vout );
115 void CommonClean( vout_thread_t *p_vout )
117 vout_sys_t *p_sys = p_vout->p_sys;
119 ExitFullscreen( p_vout );
122 EventThreadStop( p_sys->p_event );
123 EventThreadDestroy( p_sys->p_event );
126 vlc_mutex_destroy( &p_sys->lock );
128 #if !defined(UNDER_CE) && !defined(MODULE_NAME_IS_glwin32)
129 RestoreScreensaver( p_vout );
133 void CommonManage( vout_thread_t *p_vout )
135 /* If we do not control our window, we check for geometry changes
136 * ourselves because the parent might not send us its events. */
137 vlc_mutex_lock( &p_vout->p_sys->lock );
138 if( p_vout->p_sys->hparent && !p_vout->b_fullscreen )
143 vlc_mutex_unlock( &p_vout->p_sys->lock );
145 GetClientRect( p_vout->p_sys->hparent, &rect_parent );
146 point.x = point.y = 0;
147 ClientToScreen( p_vout->p_sys->hparent, &point );
148 OffsetRect( &rect_parent, point.x, point.y );
150 if( !EqualRect( &rect_parent, &p_vout->p_sys->rect_parent ) )
152 p_vout->p_sys->rect_parent = rect_parent;
154 /* FIXME I find such #ifdef quite weirds. Are they really needed ? */
156 #if defined(MODULE_NAME_IS_direct3d)
157 SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
158 rect_parent.right - rect_parent.left,
159 rect_parent.bottom - rect_parent.top,
161 UpdateRects( p_vout, true );
163 /* This one is to force the update even if only
164 * the position has changed */
165 SetWindowPos( p_vout->p_sys->hwnd, 0, 1, 1,
166 rect_parent.right - rect_parent.left,
167 rect_parent.bottom - rect_parent.top, 0 );
169 SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
170 rect_parent.right - rect_parent.left,
171 rect_parent.bottom - rect_parent.top, 0 );
173 #if defined(MODULE_NAME_IS_wingdi) || defined(MODULE_NAME_IS_wingapi)
174 unsigned int i_x, i_y, i_width, i_height;
175 vout_PlacePicture( p_vout, rect_parent.right - rect_parent.left,
176 rect_parent.bottom - rect_parent.top,
177 &i_x, &i_y, &i_width, &i_height );
179 SetWindowPos( p_vout->p_sys->hvideownd, HWND_TOP,
180 i_x, i_y, i_width, i_height, 0 );
187 vlc_mutex_unlock( &p_vout->p_sys->lock );
190 /* autoscale toggle */
191 if( p_vout->i_changes & VOUT_SCALE_CHANGE )
193 p_vout->i_changes &= ~VOUT_SCALE_CHANGE;
195 p_vout->b_autoscale = var_GetBool( p_vout, "autoscale" );
196 p_vout->i_zoom = (int) ZOOM_FP_FACTOR;
198 UpdateRects( p_vout, true );
202 if( p_vout->i_changes & VOUT_ZOOM_CHANGE )
204 p_vout->i_changes &= ~VOUT_ZOOM_CHANGE;
206 p_vout->b_autoscale = false;
208 (int)( ZOOM_FP_FACTOR * var_GetFloat( p_vout, "scale" ) );
209 UpdateRects( p_vout, true );
212 /* Check for cropping / aspect changes */
213 if( p_vout->i_changes & VOUT_CROP_CHANGE ||
214 p_vout->i_changes & VOUT_ASPECT_CHANGE )
216 p_vout->i_changes &= ~VOUT_CROP_CHANGE;
217 p_vout->i_changes &= ~VOUT_ASPECT_CHANGE;
219 p_vout->fmt_out.i_x_offset = p_vout->fmt_in.i_x_offset;
220 p_vout->fmt_out.i_y_offset = p_vout->fmt_in.i_y_offset;
221 p_vout->fmt_out.i_visible_width = p_vout->fmt_in.i_visible_width;
222 p_vout->fmt_out.i_visible_height = p_vout->fmt_in.i_visible_height;
223 p_vout->fmt_out.i_aspect = p_vout->fmt_in.i_aspect;
224 p_vout->fmt_out.i_sar_num = p_vout->fmt_in.i_sar_num;
225 p_vout->fmt_out.i_sar_den = p_vout->fmt_in.i_sar_den;
226 p_vout->output.i_aspect = p_vout->fmt_in.i_aspect;
227 UpdateRects( p_vout, true );
230 /* We used to call the Win32 PeekMessage function here to read the window
231 * messages. But since window can stay blocked into this function for a
232 * long time (for example when you move your window on the screen), I
233 * decided to isolate PeekMessage in another thread. */
238 if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE
239 || p_vout->p_sys->i_changes & VOUT_FULLSCREEN_CHANGE )
241 Win32ToggleFullscreen( p_vout );
243 p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
244 p_vout->p_sys->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
250 EventThreadMouseAutoHide( p_vout->p_sys->p_event );
253 * "Always on top" status change
255 if( p_vout->p_sys->b_on_top_change )
257 HMENU hMenu = GetSystemMenu( p_vout->p_sys->hwnd, FALSE );
258 bool b = var_GetBool( p_vout, "video-on-top" );
260 /* Set the window on top if necessary */
261 if( b && !( GetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE )
264 CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
265 MF_BYCOMMAND | MFS_CHECKED );
266 SetWindowPos( p_vout->p_sys->hwnd, HWND_TOPMOST, 0, 0, 0, 0,
267 SWP_NOSIZE | SWP_NOMOVE );
270 /* The window shouldn't be on top */
271 if( !b && ( GetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE )
274 CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
275 MF_BYCOMMAND | MFS_UNCHECKED );
276 SetWindowPos( p_vout->p_sys->hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,
277 SWP_NOSIZE | SWP_NOMOVE );
280 p_vout->p_sys->b_on_top_change = false;
284 /*****************************************************************************
285 * UpdateRects: update clipping rectangles
286 *****************************************************************************
287 * This function is called when the window position or size are changed, and
288 * its job is to update the source and destination RECTs used to display the
290 *****************************************************************************/
291 void UpdateRects( vout_thread_t *p_vout, bool b_force )
293 #define rect_src p_vout->p_sys->rect_src
294 #define rect_src_clipped p_vout->p_sys->rect_src_clipped
295 #define rect_dest p_vout->p_sys->rect_dest
296 #define rect_dest_clipped p_vout->p_sys->rect_dest_clipped
298 unsigned int i_width, i_height, i_x, i_y;
303 /* Retrieve the window size */
304 GetClientRect( p_vout->p_sys->hwnd, &rect );
306 /* Retrieve the window position */
307 point.x = point.y = 0;
308 ClientToScreen( p_vout->p_sys->hwnd, &point );
310 /* If nothing changed, we can return */
312 && p_vout->p_sys->i_window_width == rect.right
313 && p_vout->p_sys->i_window_height == rect.bottom
314 && p_vout->p_sys->i_window_x == point.x
315 && p_vout->p_sys->i_window_y == point.y )
320 /* Update the window position and size */
321 p_vout->p_sys->i_window_x = point.x;
322 p_vout->p_sys->i_window_y = point.y;
323 p_vout->p_sys->i_window_width = rect.right;
324 p_vout->p_sys->i_window_height = rect.bottom;
326 vout_PlacePicture( p_vout, rect.right, rect.bottom,
327 &i_x, &i_y, &i_width, &i_height );
329 if( p_vout->p_sys->hvideownd )
330 SetWindowPos( p_vout->p_sys->hvideownd, 0,
331 i_x, i_y, i_width, i_height,
332 SWP_NOCOPYBITS|SWP_NOZORDER|SWP_ASYNCWINDOWPOS );
334 /* Destination image position and dimensions */
335 rect_dest.left = point.x + i_x;
336 rect_dest.right = rect_dest.left + i_width;
337 rect_dest.top = point.y + i_y;
338 rect_dest.bottom = rect_dest.top + i_height;
340 #ifdef MODULE_NAME_IS_directx
341 /* Apply overlay hardware constraints */
342 if( p_vout->p_sys->b_using_overlay )
344 if( p_vout->p_sys->i_align_dest_boundary )
345 rect_dest.left = ( rect_dest.left +
346 p_vout->p_sys->i_align_dest_boundary / 2 ) &
347 ~p_vout->p_sys->i_align_dest_boundary;
349 if( p_vout->p_sys->i_align_dest_size )
350 rect_dest.right = (( rect_dest.right - rect_dest.left +
351 p_vout->p_sys->i_align_dest_size / 2 ) &
352 ~p_vout->p_sys->i_align_dest_size) + rect_dest.left;
355 /* UpdateOverlay directdraw function doesn't automatically clip to the
356 * display size so we need to do it otherwise it will fail */
358 /* Clip the destination window */
359 if( !IntersectRect( &rect_dest_clipped, &rect_dest,
360 &p_vout->p_sys->rect_display ) )
362 SetRectEmpty( &rect_src_clipped );
367 msg_Dbg( p_vout, "DirectXUpdateRects image_dst_clipped coords:"
369 rect_dest_clipped.left, rect_dest_clipped.top,
370 rect_dest_clipped.right, rect_dest_clipped.bottom );
373 #else /* MODULE_NAME_IS_directx */
375 /* AFAIK, there are no clipping constraints in Direct3D, OpenGL and GDI */
376 rect_dest_clipped = rect_dest;
380 /* the 2 following lines are to fix a bug when clicking on the desktop */
381 if( (rect_dest_clipped.right - rect_dest_clipped.left)==0 ||
382 (rect_dest_clipped.bottom - rect_dest_clipped.top)==0 )
384 SetRectEmpty( &rect_src_clipped );
388 /* src image dimensions */
391 rect_src.right = p_vout->render.i_width;
392 rect_src.bottom = p_vout->render.i_height;
394 /* Clip the source image */
395 rect_src_clipped.left = p_vout->fmt_out.i_x_offset +
396 (rect_dest_clipped.left - rect_dest.left) *
397 p_vout->fmt_out.i_visible_width / (rect_dest.right - rect_dest.left);
398 rect_src_clipped.right = p_vout->fmt_out.i_x_offset +
399 p_vout->fmt_out.i_visible_width -
400 (rect_dest.right - rect_dest_clipped.right) *
401 p_vout->fmt_out.i_visible_width / (rect_dest.right - rect_dest.left);
402 rect_src_clipped.top = p_vout->fmt_out.i_y_offset +
403 (rect_dest_clipped.top - rect_dest.top) *
404 p_vout->fmt_out.i_visible_height / (rect_dest.bottom - rect_dest.top);
405 rect_src_clipped.bottom = p_vout->fmt_out.i_y_offset +
406 p_vout->fmt_out.i_visible_height -
407 (rect_dest.bottom - rect_dest_clipped.bottom) *
408 p_vout->fmt_out.i_visible_height / (rect_dest.bottom - rect_dest.top);
410 #ifdef MODULE_NAME_IS_directx
411 /* Apply overlay hardware constraints */
412 if( p_vout->p_sys->b_using_overlay )
414 if( p_vout->p_sys->i_align_src_boundary )
415 rect_src_clipped.left = ( rect_src_clipped.left +
416 p_vout->p_sys->i_align_src_boundary / 2 ) &
417 ~p_vout->p_sys->i_align_src_boundary;
419 if( p_vout->p_sys->i_align_src_size )
420 rect_src_clipped.right = (( rect_src_clipped.right -
421 rect_src_clipped.left +
422 p_vout->p_sys->i_align_src_size / 2 ) &
423 ~p_vout->p_sys->i_align_src_size) + rect_src_clipped.left;
428 msg_Dbg( p_vout, "DirectXUpdateRects image_src_clipped"
429 " coords: %li,%li,%li,%li",
430 rect_src_clipped.left, rect_src_clipped.top,
431 rect_src_clipped.right, rect_src_clipped.bottom );
434 #ifdef MODULE_NAME_IS_directx
435 /* The destination coordinates need to be relative to the current
436 * directdraw primary surface (display) */
437 rect_dest_clipped.left -= p_vout->p_sys->rect_display.left;
438 rect_dest_clipped.right -= p_vout->p_sys->rect_display.left;
439 rect_dest_clipped.top -= p_vout->p_sys->rect_display.top;
440 rect_dest_clipped.bottom -= p_vout->p_sys->rect_display.top;
442 if( p_vout->p_sys->b_using_overlay )
443 DirectDrawUpdateOverlay( p_vout );
447 /* Windows 7 taskbar thumbnail code */
448 LPTASKBARLIST3 p_taskbl;
449 OSVERSIONINFO winVer;
450 winVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
451 if( GetVersionEx(&winVer) && winVer.dwMajorVersion > 5 )
455 if( S_OK == CoCreateInstance( &clsid_ITaskbarList,
456 NULL, CLSCTX_INPROC_SERVER,
460 RECT rect_video, rect_parent, rect_relative;
461 HWND hroot = GetAncestor(p_vout->p_sys->hwnd,GA_ROOT);
463 p_taskbl->vt->HrInit(p_taskbl);
464 GetWindowRect(p_vout->p_sys->hvideownd, &rect_video);
465 GetWindowRect(hroot, &rect_parent);
466 rect_relative.left = rect_video.left - rect_parent.left - 8;
467 rect_relative.right = rect_video.right - rect_video.left + rect_relative.left;
468 rect_relative.top = rect_video.top - rect_parent.top - 10;
469 rect_relative.bottom = rect_video.bottom - rect_video.top + rect_relative.top - 25;
471 if (S_OK != p_taskbl->vt->SetThumbnailClip(p_taskbl, hroot, &rect_relative))
472 msg_Err( p_vout, "SetThumbNailClip failed");
474 p_taskbl->vt->Release(p_taskbl);
479 /* Signal the change in size/position */
480 p_vout->p_sys->i_changes |= DX_POSITION_CHANGE;
483 #undef rect_src_clipped
485 #undef rect_dest_clipped
488 /*****************************************************************************
489 * Control: control facility for the vout
490 *****************************************************************************/
491 int Control( vout_thread_t *p_vout, int i_query, va_list args )
498 if( p_vout->p_sys->parent_window )
499 return vaControlParentWindow( p_vout, i_query, args );
501 /* Update dimensions */
502 rect_window.top = rect_window.left = 0;
503 rect_window.right = va_arg( args, unsigned int );
504 rect_window.bottom = va_arg( args, unsigned int );
505 if( !rect_window.right ) rect_window.right = p_vout->i_window_width;
506 if( !rect_window.bottom ) rect_window.bottom = p_vout->i_window_height;
507 AdjustWindowRect( &rect_window, p_vout->p_sys->i_window_style, 0 );
509 SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
510 rect_window.right - rect_window.left,
511 rect_window.bottom - rect_window.top, SWP_NOMOVE );
515 case VOUT_SET_STAY_ON_TOP:
516 if( p_vout->p_sys->hparent && !var_GetBool( p_vout, "fullscreen" ) )
517 return vaControlParentWindow( p_vout, i_query, args );
519 p_vout->p_sys->b_on_top_change = true;
528 /* Internal wrapper over GetWindowPlacement */
529 static WINDOWPLACEMENT getWindowState(HWND hwnd)
531 WINDOWPLACEMENT window_placement;
532 window_placement.length = sizeof(WINDOWPLACEMENT);
533 GetWindowPlacement( hwnd, &window_placement );
534 return window_placement;
537 /* Internal wrapper to call vout_ControlWindow for hparent */
538 static int vaControlParentWindow( vout_thread_t *p_vout, int i_query,
545 const unsigned i_width = va_arg(args, unsigned);
546 const unsigned i_height = va_arg(args, unsigned);
547 return vout_window_SetSize( p_vout->p_sys->parent_window, i_width, i_height );
549 case VOUT_SET_STAY_ON_TOP:
551 const bool is_on_top = va_arg(args, int);
552 return vout_window_SetOnTop( p_vout->p_sys->parent_window, is_on_top );
560 static int ControlParentWindow( vout_thread_t *p_vout, int i_query, ... )
565 va_start( args, i_query );
566 ret = vaControlParentWindow( p_vout, i_query, args );
572 void ExitFullscreen( vout_thread_t *p_vout )
574 if( p_vout->b_fullscreen )
576 msg_Dbg( p_vout, "Quitting fullscreen" );
577 Win32ToggleFullscreen( p_vout );
578 /* Force fullscreen in the core for the next video */
579 var_SetBool( p_vout, "fullscreen", true );
583 void Win32ToggleFullscreen( vout_thread_t *p_vout )
585 HWND hwnd = (p_vout->p_sys->hparent && p_vout->p_sys->hfswnd) ?
586 p_vout->p_sys->hfswnd : p_vout->p_sys->hwnd;
588 /* Save the current windows placement/placement to restore
589 when fullscreen is over */
590 WINDOWPLACEMENT window_placement = getWindowState( hwnd );
592 p_vout->b_fullscreen = ! p_vout->b_fullscreen;
594 /* We want to go to Fullscreen */
595 if( p_vout->b_fullscreen )
597 msg_Dbg( p_vout, "entering fullscreen mode" );
599 /* Change window style, no borders and no title bar */
600 int i_style = WS_CLIPCHILDREN | WS_VISIBLE;
601 SetWindowLong( hwnd, GWL_STYLE, i_style );
603 if( p_vout->p_sys->hparent )
608 ClientToScreen( p_vout->p_sys->hwnd, &point );
609 GetClientRect( p_vout->p_sys->hwnd, &rect );
610 SetWindowPos( hwnd, 0, point.x, point.y,
611 rect.right, rect.bottom,
612 SWP_NOZORDER|SWP_FRAMECHANGED );
614 /* Retrieve current window position so fullscreen will happen
615 *on the right screen */
616 HMONITOR hmon = MonitorFromWindow(p_vout->p_sys->hparent,
617 MONITOR_DEFAULTTONEAREST);
619 if (GetMonitorInfo(hmon, &mi))
620 SetWindowPos( hwnd, 0,
623 mi.rcMonitor.right - mi.rcMonitor.left,
624 mi.rcMonitor.bottom - mi.rcMonitor.top,
625 SWP_NOZORDER|SWP_FRAMECHANGED );
630 /* Maximize non embedded window */
631 ShowWindow( hwnd, SW_SHOWMAXIMIZED );
634 if( p_vout->p_sys->hparent )
636 /* Hide the previous window */
638 GetClientRect( hwnd, &rect );
639 SetParent( p_vout->p_sys->hwnd, hwnd );
640 SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
641 rect.right, rect.bottom,
642 SWP_NOZORDER|SWP_FRAMECHANGED );
645 HWND topLevelParent = GetParent( p_vout->p_sys->hparent );
647 HWND topLevelParent = GetAncestor( p_vout->p_sys->hparent, GA_ROOT );
649 ShowWindow( topLevelParent, SW_HIDE );
652 SetForegroundWindow( hwnd );
656 msg_Dbg( p_vout, "leaving fullscreen mode" );
657 /* Change window style, no borders and no title bar */
658 SetWindowLong( hwnd, GWL_STYLE, p_vout->p_sys->i_window_style );
660 if( p_vout->p_sys->hparent )
663 GetClientRect( p_vout->p_sys->hparent, &rect );
664 SetParent( p_vout->p_sys->hwnd, p_vout->p_sys->hparent );
665 SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
666 rect.right, rect.bottom,
667 SWP_NOZORDER|SWP_FRAMECHANGED );
670 HWND topLevelParent = GetParent( p_vout->p_sys->hparent );
672 HWND topLevelParent = GetAncestor( p_vout->p_sys->hparent, GA_ROOT );
674 ShowWindow( topLevelParent, SW_SHOW );
675 SetForegroundWindow( p_vout->p_sys->hparent );
676 ShowWindow( hwnd, SW_HIDE );
680 /* return to normal window for non embedded vout */
681 SetWindowPlacement( hwnd, &window_placement );
682 ShowWindow( hwnd, SW_SHOWNORMAL );
685 /* Make sure the mouse cursor is displayed */
686 PostMessage( p_vout->p_sys->hwnd, WM_VLC_SHOW_MOUSE, 0, 0 );
689 /* Update the object variable and trigger callback */
690 var_SetBool( p_vout, "fullscreen", p_vout->b_fullscreen );
694 void DisableScreensaver( vout_thread_t *p_vout )
696 /* disable screensaver by temporarily changing system settings */
697 p_vout->p_sys->i_spi_lowpowertimeout = 0;
698 p_vout->p_sys->i_spi_powerofftimeout = 0;
699 p_vout->p_sys->i_spi_screensavetimeout = 0;
700 if( var_GetBool( p_vout, "disable-screensaver" ) )
702 msg_Dbg(p_vout, "disabling screen saver");
703 SystemParametersInfo(SPI_GETLOWPOWERTIMEOUT,
704 0, &(p_vout->p_sys->i_spi_lowpowertimeout), 0);
705 if( 0 != p_vout->p_sys->i_spi_lowpowertimeout ) {
706 SystemParametersInfo(SPI_SETLOWPOWERTIMEOUT, 0, NULL, 0);
708 SystemParametersInfo(SPI_GETPOWEROFFTIMEOUT, 0,
709 &(p_vout->p_sys->i_spi_powerofftimeout), 0);
710 if( 0 != p_vout->p_sys->i_spi_powerofftimeout ) {
711 SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT, 0, NULL, 0);
713 SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0,
714 &(p_vout->p_sys->i_spi_screensavetimeout), 0);
715 if( 0 != p_vout->p_sys->i_spi_screensavetimeout ) {
716 SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, 0, NULL, 0);
721 void RestoreScreensaver( vout_thread_t *p_vout )
723 /* restore screensaver system settings */
724 if( 0 != p_vout->p_sys->i_spi_lowpowertimeout ) {
725 SystemParametersInfo(SPI_SETLOWPOWERTIMEOUT,
726 p_vout->p_sys->i_spi_lowpowertimeout, NULL, 0);
728 if( 0 != p_vout->p_sys->i_spi_powerofftimeout ) {
729 SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT,
730 p_vout->p_sys->i_spi_powerofftimeout, NULL, 0);
732 if( 0 != p_vout->p_sys->i_spi_screensavetimeout ) {
733 SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT,
734 p_vout->p_sys->i_spi_screensavetimeout, NULL, 0);