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 *****************************************************************************/
34 #include <vlc_common.h>
35 #include <vlc_vout_display.h>
36 #include <vlc_vout_window.h>
42 #ifdef MODULE_NAME_IS_directx
45 #ifdef MODULE_NAME_IS_direct3d
48 #ifdef MODULE_NAME_IS_glwin32
49 #include "../opengl.h"
51 #ifdef MODULE_NAME_IS_direct2d
58 #include <vlc_windows_interfaces.h>
63 //WINSHELLAPI BOOL WINAPI SHFullScreen(HWND hwndRequester, DWORD dwState);
66 static void CommonChangeThumbnailClip(vout_display_t *, bool show);
67 static int CommonControlSetFullscreen(vout_display_t *, bool is_fullscreen);
69 #if !defined(UNDER_CE) && !defined(MODULE_NAME_IS_glwin32)
70 static void DisableScreensaver(vout_display_t *);
71 static void RestoreScreensaver(vout_display_t *);
75 int CommonInit(vout_display_t *vd)
77 vout_display_sys_t *sys = vd->sys;
80 sys->hvideownd = NULL;
84 SetRectEmpty(&sys->rect_display);
85 SetRectEmpty(&sys->rect_parent);
86 sys->is_first_display = true;
87 sys->is_on_top = false;
89 var_Create(vd, "video-title", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
90 var_Create(vd, "video-deco", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);
93 sys->event = EventThreadCreate(vd);
98 memset(&cfg, 0, sizeof(cfg));
99 #ifdef MODULE_NAME_IS_direct3d
100 cfg.use_desktop = sys->use_desktop;
102 #ifdef MODULE_NAME_IS_directx
103 cfg.use_overlay = sys->use_overlay;
105 cfg.win.type = VOUT_WINDOW_TYPE_HWND;
106 cfg.win.x = var_InheritInteger(vd, "video-x");
107 cfg.win.y = var_InheritInteger(vd, "video-y");
108 cfg.win.width = vd->cfg->display.width;
109 cfg.win.height = vd->cfg->display.height;
112 if (EventThreadStart(sys->event, &hwnd, &cfg))
115 sys->parent_window = hwnd.parent_window;
116 sys->hparent = hwnd.hparent;
117 sys->hwnd = hwnd.hwnd;
118 sys->hvideownd = hwnd.hvideownd;
119 sys->hfswnd = hwnd.hfswnd;
121 if (vd->cfg->is_fullscreen) {
122 if (CommonControlSetFullscreen(vd, true))
123 vout_display_SendEventFullscreen(vd, false);
126 /* Why not with glwin32 */
127 #if !defined(UNDER_CE) && !defined(MODULE_NAME_IS_glwin32)
128 var_Create(vd, "disable-screensaver", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);
129 DisableScreensaver (vd);
136 void CommonClean(vout_display_t *vd)
138 vout_display_sys_t *sys = vd->sys;
141 CommonChangeThumbnailClip(vd, false);
142 EventThreadStop(sys->event);
143 EventThreadDestroy(sys->event);
146 #if !defined(UNDER_CE) && !defined(MODULE_NAME_IS_glwin32)
147 RestoreScreensaver(vd);
151 void CommonManage(vout_display_t *vd)
153 vout_display_sys_t *sys = vd->sys;
155 /* We used to call the Win32 PeekMessage function here to read the window
156 * messages. But since window can stay blocked into this function for a
157 * long time (for example when you move your window on the screen), I
158 * decided to isolate PeekMessage in another thread. */
160 /* If we do not control our window, we check for geometry changes
161 * ourselves because the parent might not send us its events. */
166 /* Check if the parent window has resized or moved */
167 GetClientRect(sys->hparent, &rect_parent);
168 point.x = point.y = 0;
169 ClientToScreen(sys->hparent, &point);
170 OffsetRect(&rect_parent, point.x, point.y);
172 if (!EqualRect(&rect_parent, &sys->rect_parent)) {
173 sys->rect_parent = rect_parent;
175 /* This code deals with both resize and move
177 * For most drivers(direct3d, gdi, opengl), move is never
178 * an issue. The surface automatically gets moved together
179 * with the associated window (hvideownd)
181 * For directx, it is still important to call UpdateRects
182 * on a move of the parent window, even if no resize occured
184 SetWindowPos(sys->hwnd, 0, 0, 0,
185 rect_parent.right - rect_parent.left,
186 rect_parent.bottom - rect_parent.top,
189 UpdateRects(vd, NULL, NULL, true);
193 /* HasMoved means here resize or move */
194 if (EventThreadGetAndResetHasMoved(sys->event))
195 UpdateRects(vd, NULL, NULL, false);
199 * It ensures that the video window is shown after the first picture
202 void CommonDisplay(vout_display_t *vd)
204 vout_display_sys_t *sys = vd->sys;
206 if (!sys->is_first_display)
209 /* Video window is initially hidden, show it now since we got a
212 SetWindowPos(sys->hvideownd, 0, 0, 0, 0, 0,
219 sys->is_first_display = false;
223 * It updates a picture data/pitches.
225 int CommonUpdatePicture(picture_t *picture, picture_t **fallback,
226 uint8_t *data, unsigned pitch)
229 if (*fallback == NULL) {
230 *fallback = picture_NewFromFormat(&picture->format);
231 if (*fallback == NULL)
234 for (int n = 0; n < picture->i_planes; n++) {
235 const plane_t *src = &(*fallback)->p[n];
236 plane_t *dst = &picture->p[n];
237 dst->p_pixels = src->p_pixels;
238 dst->i_pitch = src->i_pitch;
239 dst->i_lines = src->i_lines;
243 /* fill in buffer info in first plane */
244 picture->p->p_pixels = data;
245 picture->p->i_pitch = pitch;
246 picture->p->i_lines = picture->format.i_height;
248 /* Fill chroma planes for planar YUV */
249 if (picture->format.i_chroma == VLC_CODEC_I420 ||
250 picture->format.i_chroma == VLC_CODEC_J420 ||
251 picture->format.i_chroma == VLC_CODEC_YV12) {
253 for (int n = 1; n < picture->i_planes; n++) {
254 const plane_t *o = &picture->p[n-1];
255 plane_t *p = &picture->p[n];
257 p->p_pixels = o->p_pixels + o->i_lines * o->i_pitch;
258 p->i_pitch = pitch / 2;
259 p->i_lines = picture->format.i_height / 2;
261 /* The dx/d3d buffer is always allocated as YV12 */
262 if (vlc_fourcc_AreUVPlanesSwapped(picture->format.i_chroma, VLC_CODEC_YV12)) {
263 uint8_t *p_tmp = picture->p[1].p_pixels;
264 picture->p[1].p_pixels = picture->p[2].p_pixels;
265 picture->p[2].p_pixels = p_tmp;
271 void AlignRect(RECT *r, int align_boundary, int align_size)
274 r->left = (r->left + align_boundary/2) & ~align_boundary;
276 r->right = ((r->right - r->left + align_size/2) & ~align_size) + r->left;
280 static void CommonChangeThumbnailClip(vout_display_t *vd, bool show)
283 vout_display_sys_t *sys = vd->sys;
285 /* Windows 7 taskbar thumbnail code */
286 OSVERSIONINFO winVer;
287 winVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
288 if (!GetVersionEx(&winVer) || winVer.dwMajorVersion <= 5)
293 LPTASKBARLIST3 taskbl;
294 if (S_OK == CoCreateInstance(&clsid_ITaskbarList,
295 NULL, CLSCTX_INPROC_SERVER,
298 taskbl->vt->HrInit(taskbl);
300 HWND hroot = GetAncestor(sys->hwnd,GA_ROOT);
304 GetWindowRect(sys->hvideownd, &video);
305 GetWindowRect(hroot, &parent);
306 relative.left = video.left - parent.left - 8;
307 relative.top = video.top - parent.top - 10;
309 relative.right = video.right - video.left + relative.left;
310 relative.bottom = video.bottom - video.top + relative.top - 25;
312 if (S_OK != taskbl->vt->SetThumbnailClip(taskbl, hroot,
313 show ? &relative : NULL))
314 msg_Err(vd, "SetThumbNailClip failed");
316 taskbl->vt->Release(taskbl);
322 /*****************************************************************************
323 * UpdateRects: update clipping rectangles
324 *****************************************************************************
325 * This function is called when the window position or size are changed, and
326 * its job is to update the source and destination RECTs used to display the
328 *****************************************************************************/
329 void UpdateRects(vout_display_t *vd,
330 const vout_display_cfg_t *cfg,
331 const video_format_t *source,
334 vout_display_sys_t *sys = vd->sys;
335 #define rect_src sys->rect_src
336 #define rect_src_clipped sys->rect_src_clipped
337 #define rect_dest sys->rect_dest
338 #define rect_dest_clipped sys->rect_dest_clipped
347 source = &vd->source;
349 /* Retrieve the window size */
350 GetClientRect(sys->hwnd, &rect);
352 /* Retrieve the window position */
353 point.x = point.y = 0;
354 ClientToScreen(sys->hwnd, &point);
356 /* If nothing changed, we can return */
359 EventThreadUpdateWindowPosition(sys->event, &has_moved, &is_resized,
361 rect.right, rect.bottom);
363 vout_display_SendEventDisplaySize(vd, rect.right, rect.bottom, cfg->is_fullscreen);
364 if (!is_forced && !has_moved && !is_resized )
367 /* Update the window position and size */
368 vout_display_cfg_t place_cfg = *cfg;
369 place_cfg.display.width = rect.right;
370 place_cfg.display.height = rect.bottom;
372 vout_display_place_t place;
373 vout_display_PlacePicture(&place, source, &place_cfg, false);
375 EventThreadUpdateSourceAndPlace(sys->event, source, &place);
376 #if defined(MODULE_NAME_IS_wingapi)
377 if (place.width != vd->fmt.i_width || place.height != vd->fmt.i_height)
378 vout_display_SendEventPicturesInvalid(vd);
382 SetWindowPos(sys->hvideownd, 0,
383 place.x, place.y, place.width, place.height,
384 SWP_NOCOPYBITS|SWP_NOZORDER|SWP_ASYNCWINDOWPOS);
386 /* Destination image position and dimensions */
387 #if defined(MODULE_NAME_IS_direct3d) || defined(MODULE_NAME_IS_direct2d)
389 rect_dest.right = place.width;
391 rect_dest.bottom = place.height;
393 rect_dest.left = point.x + place.x;
394 rect_dest.right = rect_dest.left + place.width;
395 rect_dest.top = point.y + place.y;
396 rect_dest.bottom = rect_dest.top + place.height;
398 #ifdef MODULE_NAME_IS_directx
399 /* Apply overlay hardware constraints */
400 if (sys->use_overlay)
401 AlignRect(&rect_dest, sys->i_align_dest_boundary, sys->i_align_dest_size);
406 #if defined(MODULE_NAME_IS_directx) || defined(MODULE_NAME_IS_direct3d) || defined(MODULE_NAME_IS_direct2d)
407 /* UpdateOverlay directdraw function doesn't automatically clip to the
408 * display size so we need to do it otherwise it will fail
409 * It is also needed for d3d to avoid exceding our surface size */
411 /* Clip the destination window */
412 if (!IntersectRect(&rect_dest_clipped, &rect_dest,
413 &sys->rect_display)) {
414 SetRectEmpty(&rect_src_clipped);
419 msg_Dbg(vd, "DirectXUpdateRects image_dst_clipped coords:"
421 rect_dest_clipped.left, rect_dest_clipped.top,
422 rect_dest_clipped.right, rect_dest_clipped.bottom);
427 /* AFAIK, there are no clipping constraints in Direct3D, OpenGL and GDI */
428 rect_dest_clipped = rect_dest;
432 /* the 2 following lines are to fix a bug when clicking on the desktop */
433 if ((rect_dest_clipped.right - rect_dest_clipped.left) == 0 ||
434 (rect_dest_clipped.bottom - rect_dest_clipped.top) == 0) {
435 SetRectEmpty(&rect_src_clipped);
439 /* src image dimensions */
442 rect_src.right = source->i_width;
443 rect_src.bottom = source->i_height;
445 /* Clip the source image */
446 rect_src_clipped.left = source->i_x_offset +
447 (rect_dest_clipped.left - rect_dest.left) *
448 source->i_visible_width / (rect_dest.right - rect_dest.left);
449 rect_src_clipped.right = source->i_x_offset +
450 source->i_visible_width -
451 (rect_dest.right - rect_dest_clipped.right) *
452 source->i_visible_width / (rect_dest.right - rect_dest.left);
453 rect_src_clipped.top = source->i_y_offset +
454 (rect_dest_clipped.top - rect_dest.top) *
455 source->i_visible_height / (rect_dest.bottom - rect_dest.top);
456 rect_src_clipped.bottom = source->i_y_offset +
457 source->i_visible_height -
458 (rect_dest.bottom - rect_dest_clipped.bottom) *
459 source->i_visible_height / (rect_dest.bottom - rect_dest.top);
461 #ifdef MODULE_NAME_IS_directx
462 /* Apply overlay hardware constraints */
463 if (sys->use_overlay)
464 AlignRect(&rect_src_clipped, sys->i_align_src_boundary, sys->i_align_src_size);
465 #elif defined(MODULE_NAME_IS_direct3d) || defined(MODULE_NAME_IS_direct2d)
466 /* Needed at least with YUV content */
467 rect_src_clipped.left &= ~1;
468 rect_src_clipped.right &= ~1;
469 rect_src_clipped.top &= ~1;
470 rect_src_clipped.bottom &= ~1;
474 msg_Dbg(vd, "DirectXUpdateRects image_src_clipped"
475 " coords: %li,%li,%li,%li",
476 rect_src_clipped.left, rect_src_clipped.top,
477 rect_src_clipped.right, rect_src_clipped.bottom);
480 #ifdef MODULE_NAME_IS_directx
481 /* The destination coordinates need to be relative to the current
482 * directdraw primary surface (display) */
483 rect_dest_clipped.left -= sys->rect_display.left;
484 rect_dest_clipped.right -= sys->rect_display.left;
485 rect_dest_clipped.top -= sys->rect_display.top;
486 rect_dest_clipped.bottom -= sys->rect_display.top;
489 CommonChangeThumbnailClip(vd, true);
492 /* Signal the change in size/position */
493 sys->changes |= DX_POSITION_CHANGE;
496 #undef rect_src_clipped
498 #undef rect_dest_clipped
501 static int CommonControlSetFullscreen(vout_display_t *vd, bool is_fullscreen)
503 vout_display_sys_t *sys = vd->sys;
505 #ifdef MODULE_NAME_IS_direct3d
506 if (sys->use_desktop && is_fullscreen)
511 if (sys->parent_window)
512 return vout_window_SetFullScreen(sys->parent_window, is_fullscreen);
515 HWND hwnd = sys->hparent && sys->hfswnd ? sys->hfswnd : sys->hwnd;
517 /* Save the current windows placement/placement to restore
518 when fullscreen is over */
519 WINDOWPLACEMENT window_placement;
520 window_placement.length = sizeof(WINDOWPLACEMENT);
521 GetWindowPlacement(hwnd, &window_placement);
524 msg_Dbg(vd, "entering fullscreen mode");
526 /* Change window style, no borders and no title bar */
527 SetWindowLong(hwnd, GWL_STYLE, WS_CLIPCHILDREN | WS_VISIBLE);
533 ClientToScreen(sys->hwnd, &point);
534 GetClientRect(sys->hwnd, &rect);
535 SetWindowPos(hwnd, 0, point.x, point.y,
536 rect.right, rect.bottom,
537 SWP_NOZORDER|SWP_FRAMECHANGED);
539 /* Retrieve current window position so fullscreen will happen
540 *on the right screen */
541 HMONITOR hmon = MonitorFromWindow(sys->hparent,
542 MONITOR_DEFAULTTONEAREST);
544 mi.cbSize = sizeof(MONITORINFO);
545 if (GetMonitorInfo(hmon, &mi))
546 SetWindowPos(hwnd, 0,
549 mi.rcMonitor.right - mi.rcMonitor.left,
550 mi.rcMonitor.bottom - mi.rcMonitor.top,
551 SWP_NOZORDER|SWP_FRAMECHANGED);
554 /* Maximize non embedded window */
555 ShowWindow(hwnd, SW_SHOWMAXIMIZED);
559 /* Hide the previous window */
561 GetClientRect(hwnd, &rect);
562 SetParent(sys->hwnd, hwnd);
563 SetWindowPos(sys->hwnd, 0, 0, 0,
564 rect.right, rect.bottom,
565 SWP_NOZORDER|SWP_FRAMECHANGED);
568 HWND topLevelParent = GetParent(sys->hparent);
570 HWND topLevelParent = GetAncestor(sys->hparent, GA_ROOT);
572 ShowWindow(topLevelParent, SW_HIDE);
574 SetForegroundWindow(hwnd);
576 msg_Dbg(vd, "leaving fullscreen mode");
578 /* Change window style, no borders and no title bar */
579 SetWindowLong(hwnd, GWL_STYLE, EventThreadGetWindowStyle(sys->event));
583 GetClientRect(sys->hparent, &rect);
584 SetParent(sys->hwnd, sys->hparent);
585 SetWindowPos(sys->hwnd, 0, 0, 0,
586 rect.right, rect.bottom,
587 SWP_NOZORDER|SWP_FRAMECHANGED);
590 HWND topLevelParent = GetParent(sys->hparent);
592 HWND topLevelParent = GetAncestor(sys->hparent, GA_ROOT);
594 ShowWindow(topLevelParent, SW_SHOW);
595 SetForegroundWindow(sys->hparent);
596 ShowWindow(hwnd, SW_HIDE);
598 /* return to normal window for non embedded vout */
599 SetWindowPlacement(hwnd, &window_placement);
600 ShowWindow(hwnd, SW_SHOWNORMAL);
606 int CommonControl(vout_display_t *vd, int query, va_list args)
608 vout_display_sys_t *sys = vd->sys;
611 case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE: /* const vout_display_cfg_t *p_cfg, int is_forced */
612 case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED: /* const vout_display_cfg_t *p_cfg */
613 case VOUT_DISPLAY_CHANGE_ZOOM: /* const vout_display_cfg_t *p_cfg */
614 case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT: /* const video_format_t *p_source */
615 case VOUT_DISPLAY_CHANGE_SOURCE_CROP: { /* const video_format_t *p_source */
616 const vout_display_cfg_t *cfg;
617 const video_format_t *source;
618 bool is_forced = true;
619 if (query == VOUT_DISPLAY_CHANGE_SOURCE_CROP ||
620 query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT) {
622 source = va_arg(args, const video_format_t *);
624 cfg = va_arg(args, const vout_display_cfg_t *);
625 source = &vd->source;
626 if (query == VOUT_DISPLAY_CHANGE_DISPLAY_SIZE)
627 is_forced = va_arg(args, int);
629 if (query == VOUT_DISPLAY_CHANGE_DISPLAY_SIZE && is_forced) {
630 /* Update dimensions */
631 if (sys->parent_window) {
632 vout_window_SetSize(sys->parent_window, cfg->display.width, cfg->display.height);
636 rect_window.left = 0;
637 rect_window.right = cfg->display.width;
638 rect_window.bottom = cfg->display.height;
639 AdjustWindowRect(&rect_window, EventThreadGetWindowStyle(sys->event), 0);
641 SetWindowPos(sys->hwnd, 0, 0, 0,
642 rect_window.right - rect_window.left,
643 rect_window.bottom - rect_window.top, SWP_NOMOVE);
646 UpdateRects(vd, cfg, source, is_forced);
649 case VOUT_DISPLAY_CHANGE_WINDOW_STATE: { /* unsigned state */
650 const unsigned state = va_arg(args, unsigned);
651 const bool is_on_top = (state & VOUT_WINDOW_STATE_ABOVE) != 0;
652 #ifdef MODULE_NAME_IS_direct3d
653 if (sys->use_desktop && is_on_top)
656 if (sys->parent_window) {
657 if (vout_window_SetState(sys->parent_window, state))
660 HMENU hMenu = GetSystemMenu(sys->hwnd, FALSE);
662 if (is_on_top && !(GetWindowLong(sys->hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST)) {
663 CheckMenuItem(hMenu, IDM_TOGGLE_ON_TOP, MF_BYCOMMAND | MFS_CHECKED);
664 SetWindowPos(sys->hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
665 } else if (!is_on_top && (GetWindowLong(sys->hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST)) {
666 CheckMenuItem(hMenu, IDM_TOGGLE_ON_TOP, MF_BYCOMMAND | MFS_UNCHECKED);
667 SetWindowPos(sys->hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
670 sys->is_on_top = is_on_top;
673 case VOUT_DISPLAY_CHANGE_FULLSCREEN: { /* const vout_display_cfg_t *p_cfg */
674 const vout_display_cfg_t *cfg = va_arg(args, const vout_display_cfg_t *);
675 if (CommonControlSetFullscreen(vd, cfg->is_fullscreen))
677 UpdateRects(vd, NULL, NULL, false);
681 case VOUT_DISPLAY_HIDE_MOUSE:
682 EventThreadMouseHide(sys->event);
684 case VOUT_DISPLAY_RESET_PICTURES:
691 #if !defined(UNDER_CE) && !defined(MODULE_NAME_IS_glwin32)
692 static void DisableScreensaver(vout_display_t *vd)
694 vout_display_sys_t *sys = vd->sys;
696 /* disable screensaver by temporarily changing system settings */
697 sys->i_spi_lowpowertimeout = 0;
698 sys->i_spi_powerofftimeout = 0;
699 sys->i_spi_screensavetimeout = 0;
700 if (var_GetBool(vd, "disable-screensaver")) {
701 msg_Dbg(vd, "disabling screen saver");
702 SystemParametersInfo(SPI_GETLOWPOWERTIMEOUT, 0,
703 &sys->i_spi_lowpowertimeout, 0);
704 if (0 != sys->i_spi_lowpowertimeout) {
705 SystemParametersInfo(SPI_SETLOWPOWERTIMEOUT, 0, NULL, 0);
707 SystemParametersInfo(SPI_GETPOWEROFFTIMEOUT, 0,
708 &sys->i_spi_powerofftimeout, 0);
709 if (0 != sys->i_spi_powerofftimeout) {
710 SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT, 0, NULL, 0);
712 SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0,
713 &sys->i_spi_screensavetimeout, 0);
714 if (0 != sys->i_spi_screensavetimeout) {
715 SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, 0, NULL, 0);
720 static void RestoreScreensaver(vout_display_t *vd)
722 vout_display_sys_t *sys = vd->sys;
724 /* restore screensaver system settings */
725 if (0 != sys->i_spi_lowpowertimeout) {
726 SystemParametersInfo(SPI_SETLOWPOWERTIMEOUT,
727 sys->i_spi_lowpowertimeout, NULL, 0);
729 if (0 != sys->i_spi_powerofftimeout) {
730 SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT,
731 sys->i_spi_powerofftimeout, NULL, 0);
733 if (0 != sys->i_spi_screensavetimeout) {
734 SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT,
735 sys->i_spi_screensavetimeout, NULL, 0);