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 );
191 p_vout->p_sys->i_changes |= EventThreadRetreiveChanges( p_vout->p_sys->p_event );
193 /* autoscale toggle */
194 if( p_vout->i_changes & VOUT_SCALE_CHANGE )
196 p_vout->i_changes &= ~VOUT_SCALE_CHANGE;
198 p_vout->b_autoscale = var_GetBool( p_vout, "autoscale" );
199 p_vout->i_zoom = (int) ZOOM_FP_FACTOR;
201 UpdateRects( p_vout, true );
205 if( p_vout->i_changes & VOUT_ZOOM_CHANGE )
207 p_vout->i_changes &= ~VOUT_ZOOM_CHANGE;
209 p_vout->b_autoscale = false;
211 (int)( ZOOM_FP_FACTOR * var_GetFloat( p_vout, "scale" ) );
212 UpdateRects( p_vout, true );
215 /* Check for cropping / aspect changes */
216 if( p_vout->i_changes & VOUT_CROP_CHANGE ||
217 p_vout->i_changes & VOUT_ASPECT_CHANGE )
219 p_vout->i_changes &= ~VOUT_CROP_CHANGE;
220 p_vout->i_changes &= ~VOUT_ASPECT_CHANGE;
222 p_vout->fmt_out.i_x_offset = p_vout->fmt_in.i_x_offset;
223 p_vout->fmt_out.i_y_offset = p_vout->fmt_in.i_y_offset;
224 p_vout->fmt_out.i_visible_width = p_vout->fmt_in.i_visible_width;
225 p_vout->fmt_out.i_visible_height = p_vout->fmt_in.i_visible_height;
226 p_vout->fmt_out.i_aspect = p_vout->fmt_in.i_aspect;
227 p_vout->fmt_out.i_sar_num = p_vout->fmt_in.i_sar_num;
228 p_vout->fmt_out.i_sar_den = p_vout->fmt_in.i_sar_den;
229 p_vout->output.i_aspect = p_vout->fmt_in.i_aspect;
230 UpdateRects( p_vout, true );
233 /* We used to call the Win32 PeekMessage function here to read the window
234 * messages. But since window can stay blocked into this function for a
235 * long time (for example when you move your window on the screen), I
236 * decided to isolate PeekMessage in another thread. */
241 if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE
242 || p_vout->p_sys->i_changes & VOUT_FULLSCREEN_CHANGE )
244 Win32ToggleFullscreen( p_vout );
246 p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
247 p_vout->p_sys->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
253 EventThreadMouseAutoHide( p_vout->p_sys->p_event );
256 * "Always on top" status change
258 if( p_vout->p_sys->b_on_top_change )
260 HMENU hMenu = GetSystemMenu( p_vout->p_sys->hwnd, FALSE );
261 bool b = var_GetBool( p_vout, "video-on-top" );
263 /* Set the window on top if necessary */
264 if( b && !( GetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE )
267 CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
268 MF_BYCOMMAND | MFS_CHECKED );
269 SetWindowPos( p_vout->p_sys->hwnd, HWND_TOPMOST, 0, 0, 0, 0,
270 SWP_NOSIZE | SWP_NOMOVE );
273 /* The window shouldn't be on top */
274 if( !b && ( GetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE )
277 CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
278 MF_BYCOMMAND | MFS_UNCHECKED );
279 SetWindowPos( p_vout->p_sys->hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,
280 SWP_NOSIZE | SWP_NOMOVE );
283 p_vout->p_sys->b_on_top_change = false;
287 /*****************************************************************************
288 * UpdateRects: update clipping rectangles
289 *****************************************************************************
290 * This function is called when the window position or size are changed, and
291 * its job is to update the source and destination RECTs used to display the
293 *****************************************************************************/
294 void UpdateRects( vout_thread_t *p_vout, bool b_force )
296 #define rect_src p_vout->p_sys->rect_src
297 #define rect_src_clipped p_vout->p_sys->rect_src_clipped
298 #define rect_dest p_vout->p_sys->rect_dest
299 #define rect_dest_clipped p_vout->p_sys->rect_dest_clipped
301 unsigned int i_width, i_height, i_x, i_y;
306 /* Retrieve the window size */
307 GetClientRect( p_vout->p_sys->hwnd, &rect );
309 /* Retrieve the window position */
310 point.x = point.y = 0;
311 ClientToScreen( p_vout->p_sys->hwnd, &point );
313 /* If nothing changed, we can return */
315 && p_vout->p_sys->i_window_width == rect.right
316 && p_vout->p_sys->i_window_height == rect.bottom
317 && p_vout->p_sys->i_window_x == point.x
318 && p_vout->p_sys->i_window_y == point.y )
323 /* Update the window position and size */
324 p_vout->p_sys->i_window_x = point.x;
325 p_vout->p_sys->i_window_y = point.y;
326 p_vout->p_sys->i_window_width = rect.right;
327 p_vout->p_sys->i_window_height = rect.bottom;
329 vout_PlacePicture( p_vout, rect.right, rect.bottom,
330 &i_x, &i_y, &i_width, &i_height );
332 if( p_vout->p_sys->hvideownd )
333 SetWindowPos( p_vout->p_sys->hvideownd, 0,
334 i_x, i_y, i_width, i_height,
335 SWP_NOCOPYBITS|SWP_NOZORDER|SWP_ASYNCWINDOWPOS );
337 /* Destination image position and dimensions */
338 rect_dest.left = point.x + i_x;
339 rect_dest.right = rect_dest.left + i_width;
340 rect_dest.top = point.y + i_y;
341 rect_dest.bottom = rect_dest.top + i_height;
343 #ifdef MODULE_NAME_IS_directx
344 /* Apply overlay hardware constraints */
345 if( p_vout->p_sys->b_using_overlay )
347 if( p_vout->p_sys->i_align_dest_boundary )
348 rect_dest.left = ( rect_dest.left +
349 p_vout->p_sys->i_align_dest_boundary / 2 ) &
350 ~p_vout->p_sys->i_align_dest_boundary;
352 if( p_vout->p_sys->i_align_dest_size )
353 rect_dest.right = (( rect_dest.right - rect_dest.left +
354 p_vout->p_sys->i_align_dest_size / 2 ) &
355 ~p_vout->p_sys->i_align_dest_size) + rect_dest.left;
358 /* UpdateOverlay directdraw function doesn't automatically clip to the
359 * display size so we need to do it otherwise it will fail */
361 /* Clip the destination window */
362 if( !IntersectRect( &rect_dest_clipped, &rect_dest,
363 &p_vout->p_sys->rect_display ) )
365 SetRectEmpty( &rect_src_clipped );
370 msg_Dbg( p_vout, "DirectXUpdateRects image_dst_clipped coords:"
372 rect_dest_clipped.left, rect_dest_clipped.top,
373 rect_dest_clipped.right, rect_dest_clipped.bottom );
376 #else /* MODULE_NAME_IS_directx */
378 /* AFAIK, there are no clipping constraints in Direct3D, OpenGL and GDI */
379 rect_dest_clipped = rect_dest;
383 /* the 2 following lines are to fix a bug when clicking on the desktop */
384 if( (rect_dest_clipped.right - rect_dest_clipped.left)==0 ||
385 (rect_dest_clipped.bottom - rect_dest_clipped.top)==0 )
387 SetRectEmpty( &rect_src_clipped );
391 /* src image dimensions */
394 rect_src.right = p_vout->render.i_width;
395 rect_src.bottom = p_vout->render.i_height;
397 /* Clip the source image */
398 rect_src_clipped.left = p_vout->fmt_out.i_x_offset +
399 (rect_dest_clipped.left - rect_dest.left) *
400 p_vout->fmt_out.i_visible_width / (rect_dest.right - rect_dest.left);
401 rect_src_clipped.right = p_vout->fmt_out.i_x_offset +
402 p_vout->fmt_out.i_visible_width -
403 (rect_dest.right - rect_dest_clipped.right) *
404 p_vout->fmt_out.i_visible_width / (rect_dest.right - rect_dest.left);
405 rect_src_clipped.top = p_vout->fmt_out.i_y_offset +
406 (rect_dest_clipped.top - rect_dest.top) *
407 p_vout->fmt_out.i_visible_height / (rect_dest.bottom - rect_dest.top);
408 rect_src_clipped.bottom = p_vout->fmt_out.i_y_offset +
409 p_vout->fmt_out.i_visible_height -
410 (rect_dest.bottom - rect_dest_clipped.bottom) *
411 p_vout->fmt_out.i_visible_height / (rect_dest.bottom - rect_dest.top);
413 #ifdef MODULE_NAME_IS_directx
414 /* Apply overlay hardware constraints */
415 if( p_vout->p_sys->b_using_overlay )
417 if( p_vout->p_sys->i_align_src_boundary )
418 rect_src_clipped.left = ( rect_src_clipped.left +
419 p_vout->p_sys->i_align_src_boundary / 2 ) &
420 ~p_vout->p_sys->i_align_src_boundary;
422 if( p_vout->p_sys->i_align_src_size )
423 rect_src_clipped.right = (( rect_src_clipped.right -
424 rect_src_clipped.left +
425 p_vout->p_sys->i_align_src_size / 2 ) &
426 ~p_vout->p_sys->i_align_src_size) + rect_src_clipped.left;
431 msg_Dbg( p_vout, "DirectXUpdateRects image_src_clipped"
432 " coords: %li,%li,%li,%li",
433 rect_src_clipped.left, rect_src_clipped.top,
434 rect_src_clipped.right, rect_src_clipped.bottom );
437 #ifdef MODULE_NAME_IS_directx
438 /* The destination coordinates need to be relative to the current
439 * directdraw primary surface (display) */
440 rect_dest_clipped.left -= p_vout->p_sys->rect_display.left;
441 rect_dest_clipped.right -= p_vout->p_sys->rect_display.left;
442 rect_dest_clipped.top -= p_vout->p_sys->rect_display.top;
443 rect_dest_clipped.bottom -= p_vout->p_sys->rect_display.top;
445 if( p_vout->p_sys->b_using_overlay )
446 DirectDrawUpdateOverlay( p_vout );
450 /* Windows 7 taskbar thumbnail code */
451 LPTASKBARLIST3 p_taskbl;
452 OSVERSIONINFO winVer;
453 winVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
454 if( GetVersionEx(&winVer) && winVer.dwMajorVersion > 5 )
458 if( S_OK == CoCreateInstance( &clsid_ITaskbarList,
459 NULL, CLSCTX_INPROC_SERVER,
463 RECT rect_video, rect_parent, rect_relative;
464 HWND hroot = GetAncestor(p_vout->p_sys->hwnd,GA_ROOT);
466 p_taskbl->vt->HrInit(p_taskbl);
467 GetWindowRect(p_vout->p_sys->hvideownd, &rect_video);
468 GetWindowRect(hroot, &rect_parent);
469 rect_relative.left = rect_video.left - rect_parent.left - 8;
470 rect_relative.right = rect_video.right - rect_video.left + rect_relative.left;
471 rect_relative.top = rect_video.top - rect_parent.top - 10;
472 rect_relative.bottom = rect_video.bottom - rect_video.top + rect_relative.top - 25;
474 if (S_OK != p_taskbl->vt->SetThumbnailClip(p_taskbl, hroot, &rect_relative))
475 msg_Err( p_vout, "SetThumbNailClip failed");
477 p_taskbl->vt->Release(p_taskbl);
482 /* Signal the change in size/position */
483 p_vout->p_sys->i_changes |= DX_POSITION_CHANGE;
486 #undef rect_src_clipped
488 #undef rect_dest_clipped
491 /*****************************************************************************
492 * Control: control facility for the vout
493 *****************************************************************************/
494 int Control( vout_thread_t *p_vout, int i_query, va_list args )
501 if( p_vout->p_sys->parent_window )
502 return vaControlParentWindow( p_vout, i_query, args );
504 /* Update dimensions */
505 rect_window.top = rect_window.left = 0;
506 rect_window.right = va_arg( args, unsigned int );
507 rect_window.bottom = va_arg( args, unsigned int );
508 if( !rect_window.right ) rect_window.right = p_vout->i_window_width;
509 if( !rect_window.bottom ) rect_window.bottom = p_vout->i_window_height;
510 AdjustWindowRect( &rect_window, p_vout->p_sys->i_window_style, 0 );
512 SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
513 rect_window.right - rect_window.left,
514 rect_window.bottom - rect_window.top, SWP_NOMOVE );
518 case VOUT_SET_STAY_ON_TOP:
519 if( p_vout->p_sys->hparent && !var_GetBool( p_vout, "fullscreen" ) )
520 return vaControlParentWindow( p_vout, i_query, args );
522 p_vout->p_sys->b_on_top_change = true;
531 /* Internal wrapper over GetWindowPlacement */
532 static WINDOWPLACEMENT getWindowState(HWND hwnd)
534 WINDOWPLACEMENT window_placement;
535 window_placement.length = sizeof(WINDOWPLACEMENT);
536 GetWindowPlacement( hwnd, &window_placement );
537 return window_placement;
540 /* Internal wrapper to call vout_ControlWindow for hparent */
541 static int vaControlParentWindow( vout_thread_t *p_vout, int i_query,
548 const unsigned i_width = va_arg(args, unsigned);
549 const unsigned i_height = va_arg(args, unsigned);
550 return vout_window_SetSize( p_vout->p_sys->parent_window, i_width, i_height );
552 case VOUT_SET_STAY_ON_TOP:
554 const bool is_on_top = va_arg(args, int);
555 return vout_window_SetOnTop( p_vout->p_sys->parent_window, is_on_top );
563 static int ControlParentWindow( vout_thread_t *p_vout, int i_query, ... )
568 va_start( args, i_query );
569 ret = vaControlParentWindow( p_vout, i_query, args );
575 void ExitFullscreen( vout_thread_t *p_vout )
577 if( p_vout->b_fullscreen )
579 msg_Dbg( p_vout, "Quitting fullscreen" );
580 Win32ToggleFullscreen( p_vout );
581 /* Force fullscreen in the core for the next video */
582 var_SetBool( p_vout, "fullscreen", true );
586 void Win32ToggleFullscreen( vout_thread_t *p_vout )
588 HWND hwnd = (p_vout->p_sys->hparent && p_vout->p_sys->hfswnd) ?
589 p_vout->p_sys->hfswnd : p_vout->p_sys->hwnd;
591 /* Save the current windows placement/placement to restore
592 when fullscreen is over */
593 WINDOWPLACEMENT window_placement = getWindowState( hwnd );
595 p_vout->b_fullscreen = ! p_vout->b_fullscreen;
597 /* We want to go to Fullscreen */
598 if( p_vout->b_fullscreen )
600 msg_Dbg( p_vout, "entering fullscreen mode" );
602 /* Change window style, no borders and no title bar */
603 int i_style = WS_CLIPCHILDREN | WS_VISIBLE;
604 SetWindowLong( hwnd, GWL_STYLE, i_style );
606 if( p_vout->p_sys->hparent )
611 ClientToScreen( p_vout->p_sys->hwnd, &point );
612 GetClientRect( p_vout->p_sys->hwnd, &rect );
613 SetWindowPos( hwnd, 0, point.x, point.y,
614 rect.right, rect.bottom,
615 SWP_NOZORDER|SWP_FRAMECHANGED );
617 /* Retrieve current window position so fullscreen will happen
618 *on the right screen */
619 HMONITOR hmon = MonitorFromWindow(p_vout->p_sys->hparent,
620 MONITOR_DEFAULTTONEAREST);
622 if (GetMonitorInfo(hmon, &mi))
623 SetWindowPos( hwnd, 0,
626 mi.rcMonitor.right - mi.rcMonitor.left,
627 mi.rcMonitor.bottom - mi.rcMonitor.top,
628 SWP_NOZORDER|SWP_FRAMECHANGED );
633 /* Maximize non embedded window */
634 ShowWindow( hwnd, SW_SHOWMAXIMIZED );
637 if( p_vout->p_sys->hparent )
639 /* Hide the previous window */
641 GetClientRect( hwnd, &rect );
642 SetParent( p_vout->p_sys->hwnd, hwnd );
643 SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
644 rect.right, rect.bottom,
645 SWP_NOZORDER|SWP_FRAMECHANGED );
648 HWND topLevelParent = GetParent( p_vout->p_sys->hparent );
650 HWND topLevelParent = GetAncestor( p_vout->p_sys->hparent, GA_ROOT );
652 ShowWindow( topLevelParent, SW_HIDE );
655 SetForegroundWindow( hwnd );
659 msg_Dbg( p_vout, "leaving fullscreen mode" );
660 /* Change window style, no borders and no title bar */
661 SetWindowLong( hwnd, GWL_STYLE, p_vout->p_sys->i_window_style );
663 if( p_vout->p_sys->hparent )
666 GetClientRect( p_vout->p_sys->hparent, &rect );
667 SetParent( p_vout->p_sys->hwnd, p_vout->p_sys->hparent );
668 SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
669 rect.right, rect.bottom,
670 SWP_NOZORDER|SWP_FRAMECHANGED );
673 HWND topLevelParent = GetParent( p_vout->p_sys->hparent );
675 HWND topLevelParent = GetAncestor( p_vout->p_sys->hparent, GA_ROOT );
677 ShowWindow( topLevelParent, SW_SHOW );
678 SetForegroundWindow( p_vout->p_sys->hparent );
679 ShowWindow( hwnd, SW_HIDE );
683 /* return to normal window for non embedded vout */
684 SetWindowPlacement( hwnd, &window_placement );
685 ShowWindow( hwnd, SW_SHOWNORMAL );
688 /* Make sure the mouse cursor is displayed */
689 PostMessage( p_vout->p_sys->hwnd, WM_VLC_SHOW_MOUSE, 0, 0 );
692 /* Update the object variable and trigger callback */
693 var_SetBool( p_vout, "fullscreen", p_vout->b_fullscreen );
697 void DisableScreensaver( vout_thread_t *p_vout )
699 /* disable screensaver by temporarily changing system settings */
700 p_vout->p_sys->i_spi_lowpowertimeout = 0;
701 p_vout->p_sys->i_spi_powerofftimeout = 0;
702 p_vout->p_sys->i_spi_screensavetimeout = 0;
703 if( var_GetBool( p_vout, "disable-screensaver" ) )
705 msg_Dbg(p_vout, "disabling screen saver");
706 SystemParametersInfo(SPI_GETLOWPOWERTIMEOUT,
707 0, &(p_vout->p_sys->i_spi_lowpowertimeout), 0);
708 if( 0 != p_vout->p_sys->i_spi_lowpowertimeout ) {
709 SystemParametersInfo(SPI_SETLOWPOWERTIMEOUT, 0, NULL, 0);
711 SystemParametersInfo(SPI_GETPOWEROFFTIMEOUT, 0,
712 &(p_vout->p_sys->i_spi_powerofftimeout), 0);
713 if( 0 != p_vout->p_sys->i_spi_powerofftimeout ) {
714 SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT, 0, NULL, 0);
716 SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0,
717 &(p_vout->p_sys->i_spi_screensavetimeout), 0);
718 if( 0 != p_vout->p_sys->i_spi_screensavetimeout ) {
719 SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, 0, NULL, 0);
724 void RestoreScreensaver( vout_thread_t *p_vout )
726 /* restore screensaver system settings */
727 if( 0 != p_vout->p_sys->i_spi_lowpowertimeout ) {
728 SystemParametersInfo(SPI_SETLOWPOWERTIMEOUT,
729 p_vout->p_sys->i_spi_lowpowertimeout, NULL, 0);
731 if( 0 != p_vout->p_sys->i_spi_powerofftimeout ) {
732 SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT,
733 p_vout->p_sys->i_spi_powerofftimeout, NULL, 0);
735 if( 0 != p_vout->p_sys->i_spi_screensavetimeout ) {
736 SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT,
737 p_vout->p_sys->i_spi_screensavetimeout, NULL, 0);