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 static void DisableScreensaver(vout_display_t *);
70 static void RestoreScreensaver(vout_display_t *);
73 int CommonInit(vout_display_t *vd)
75 vout_display_sys_t *sys = vd->sys;
78 sys->hvideownd = NULL;
82 SetRectEmpty(&sys->rect_display);
83 SetRectEmpty(&sys->rect_parent);
84 sys->is_first_display = true;
85 sys->is_on_top = false;
87 var_Create(vd, "video-title", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
88 var_Create(vd, "video-deco", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);
91 sys->event = EventThreadCreate(vd);
96 memset(&cfg, 0, sizeof(cfg));
97 #ifdef MODULE_NAME_IS_direct3d
98 cfg.use_desktop = sys->use_desktop;
100 #ifdef MODULE_NAME_IS_directx
101 cfg.use_overlay = sys->use_overlay;
103 cfg.win.type = VOUT_WINDOW_TYPE_HWND;
104 cfg.win.x = var_InheritInteger(vd, "video-x");
105 cfg.win.y = var_InheritInteger(vd, "video-y");
106 cfg.win.width = vd->cfg->display.width;
107 cfg.win.height = vd->cfg->display.height;
110 if (EventThreadStart(sys->event, &hwnd, &cfg))
113 sys->parent_window = hwnd.parent_window;
114 sys->hparent = hwnd.hparent;
115 sys->hwnd = hwnd.hwnd;
116 sys->hvideownd = hwnd.hvideownd;
117 sys->hfswnd = hwnd.hfswnd;
119 if (vd->cfg->is_fullscreen) {
120 if (CommonControlSetFullscreen(vd, true))
121 vout_display_SendEventFullscreen(vd, false);
124 /* Why not with glwin32 */
125 #if !defined(UNDER_CE) && !defined(MODULE_NAME_IS_glwin32)
126 var_Create(vd, "disable-screensaver", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);
127 DisableScreensaver (vd);
134 void CommonClean(vout_display_t *vd)
136 vout_display_sys_t *sys = vd->sys;
139 CommonChangeThumbnailClip(vd, false);
140 EventThreadStop(sys->event);
141 EventThreadDestroy(sys->event);
144 #if !defined(UNDER_CE) && !defined(MODULE_NAME_IS_glwin32)
145 RestoreScreensaver(vd);
149 void CommonManage(vout_display_t *vd)
151 vout_display_sys_t *sys = vd->sys;
153 /* We used to call the Win32 PeekMessage function here to read the window
154 * messages. But since window can stay blocked into this function for a
155 * long time (for example when you move your window on the screen), I
156 * decided to isolate PeekMessage in another thread. */
158 /* If we do not control our window, we check for geometry changes
159 * ourselves because the parent might not send us its events. */
164 /* Check if the parent window has resized or moved */
165 GetClientRect(sys->hparent, &rect_parent);
166 point.x = point.y = 0;
167 ClientToScreen(sys->hparent, &point);
168 OffsetRect(&rect_parent, point.x, point.y);
170 if (!EqualRect(&rect_parent, &sys->rect_parent)) {
171 sys->rect_parent = rect_parent;
173 /* This code deals with both resize and move
175 * For most drivers(direct3d, gdi, opengl), move is never
176 * an issue. The surface automatically gets moved together
177 * with the associated window (hvideownd)
179 * For directx, it is still important to call UpdateRects
180 * on a move of the parent window, even if no resize occured
182 SetWindowPos(sys->hwnd, 0, 0, 0,
183 rect_parent.right - rect_parent.left,
184 rect_parent.bottom - rect_parent.top,
187 UpdateRects(vd, NULL, NULL, true);
191 /* HasMoved means here resize or move */
192 if (EventThreadGetAndResetHasMoved(sys->event))
193 UpdateRects(vd, NULL, NULL, false);
197 * It ensures that the video window is shown after the first picture
200 void CommonDisplay(vout_display_t *vd)
202 vout_display_sys_t *sys = vd->sys;
204 if (!sys->is_first_display)
207 /* Video window is initially hidden, show it now since we got a
210 SetWindowPos(sys->hvideownd, 0, 0, 0, 0, 0,
217 sys->is_first_display = false;
221 * It updates a picture data/pitches.
223 int CommonUpdatePicture(picture_t *picture, picture_t **fallback,
224 uint8_t *data, unsigned pitch)
227 if (*fallback == NULL) {
228 *fallback = picture_NewFromFormat(&picture->format);
229 if (*fallback == NULL)
232 for (int n = 0; n < picture->i_planes; n++) {
233 const plane_t *src = &(*fallback)->p[n];
234 plane_t *dst = &picture->p[n];
235 dst->p_pixels = src->p_pixels;
236 dst->i_pitch = src->i_pitch;
237 dst->i_lines = src->i_lines;
241 /* fill in buffer info in first plane */
242 picture->p->p_pixels = data;
243 picture->p->i_pitch = pitch;
244 picture->p->i_lines = picture->format.i_height;
246 /* Fill chroma planes for planar YUV */
247 if (picture->format.i_chroma == VLC_CODEC_I420 ||
248 picture->format.i_chroma == VLC_CODEC_J420 ||
249 picture->format.i_chroma == VLC_CODEC_YV12) {
251 for (int n = 1; n < picture->i_planes; n++) {
252 const plane_t *o = &picture->p[n-1];
253 plane_t *p = &picture->p[n];
255 p->p_pixels = o->p_pixels + o->i_lines * o->i_pitch;
256 p->i_pitch = pitch / 2;
257 p->i_lines = picture->format.i_height / 2;
259 /* The dx/d3d buffer is always allocated as YV12 */
260 if (vlc_fourcc_AreUVPlanesSwapped(picture->format.i_chroma, VLC_CODEC_YV12)) {
261 uint8_t *p_tmp = picture->p[1].p_pixels;
262 picture->p[1].p_pixels = picture->p[2].p_pixels;
263 picture->p[2].p_pixels = p_tmp;
269 void AlignRect(RECT *r, int align_boundary, int align_size)
272 r->left = (r->left + align_boundary/2) & ~align_boundary;
274 r->right = ((r->right - r->left + align_size/2) & ~align_size) + r->left;
278 static void CommonChangeThumbnailClip(vout_display_t *vd, bool show)
281 vout_display_sys_t *sys = vd->sys;
283 /* Windows 7 taskbar thumbnail code */
284 OSVERSIONINFO winVer;
285 winVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
286 if (!GetVersionEx(&winVer) || winVer.dwMajorVersion <= 5)
291 LPTASKBARLIST3 taskbl;
292 if (S_OK == CoCreateInstance(&clsid_ITaskbarList,
293 NULL, CLSCTX_INPROC_SERVER,
296 taskbl->vt->HrInit(taskbl);
298 HWND hroot = GetAncestor(sys->hwnd,GA_ROOT);
302 GetWindowRect(sys->hvideownd, &video);
303 GetWindowRect(hroot, &parent);
304 relative.left = video.left - parent.left - 8;
305 relative.top = video.top - parent.top - 10;
307 relative.right = video.right - video.left + relative.left;
308 relative.bottom = video.bottom - video.top + relative.top - 25;
310 if (S_OK != taskbl->vt->SetThumbnailClip(taskbl, hroot,
311 show ? &relative : NULL))
312 msg_Err(vd, "SetThumbNailClip failed");
314 taskbl->vt->Release(taskbl);
320 /*****************************************************************************
321 * UpdateRects: update clipping rectangles
322 *****************************************************************************
323 * This function is called when the window position or size are changed, and
324 * its job is to update the source and destination RECTs used to display the
326 *****************************************************************************/
327 void UpdateRects(vout_display_t *vd,
328 const vout_display_cfg_t *cfg,
329 const video_format_t *source,
332 vout_display_sys_t *sys = vd->sys;
333 #define rect_src sys->rect_src
334 #define rect_src_clipped sys->rect_src_clipped
335 #define rect_dest sys->rect_dest
336 #define rect_dest_clipped sys->rect_dest_clipped
345 source = &vd->source;
347 /* Retrieve the window size */
348 GetClientRect(sys->hwnd, &rect);
350 /* Retrieve the window position */
351 point.x = point.y = 0;
352 ClientToScreen(sys->hwnd, &point);
354 /* If nothing changed, we can return */
357 EventThreadUpdateWindowPosition(sys->event, &has_moved, &is_resized,
359 rect.right, rect.bottom);
361 vout_display_SendEventDisplaySize(vd, rect.right, rect.bottom, cfg->is_fullscreen);
362 if (!is_forced && !has_moved && !is_resized )
365 /* Update the window position and size */
366 vout_display_cfg_t place_cfg = *cfg;
367 place_cfg.display.width = rect.right;
368 place_cfg.display.height = rect.bottom;
370 vout_display_place_t place;
371 vout_display_PlacePicture(&place, source, &place_cfg, false);
373 EventThreadUpdateSourceAndPlace(sys->event, source, &place);
374 #if defined(MODULE_NAME_IS_wingapi)
375 if (place.width != vd->fmt.i_width || place.height != vd->fmt.i_height)
376 vout_display_SendEventPicturesInvalid(vd);
380 SetWindowPos(sys->hvideownd, 0,
381 place.x, place.y, place.width, place.height,
382 SWP_NOCOPYBITS|SWP_NOZORDER|SWP_ASYNCWINDOWPOS);
384 /* Destination image position and dimensions */
385 #if defined(MODULE_NAME_IS_direct3d) || defined(MODULE_NAME_IS_direct2d)
387 rect_dest.right = place.width;
389 rect_dest.bottom = place.height;
391 rect_dest.left = point.x + place.x;
392 rect_dest.right = rect_dest.left + place.width;
393 rect_dest.top = point.y + place.y;
394 rect_dest.bottom = rect_dest.top + place.height;
396 #ifdef MODULE_NAME_IS_directx
397 /* Apply overlay hardware constraints */
398 if (sys->use_overlay)
399 AlignRect(&rect_dest, sys->i_align_dest_boundary, sys->i_align_dest_size);
404 #if defined(MODULE_NAME_IS_directx) || defined(MODULE_NAME_IS_direct3d) || defined(MODULE_NAME_IS_direct2d)
405 /* UpdateOverlay directdraw function doesn't automatically clip to the
406 * display size so we need to do it otherwise it will fail
407 * It is also needed for d3d to avoid exceding our surface size */
409 /* Clip the destination window */
410 if (!IntersectRect(&rect_dest_clipped, &rect_dest,
411 &sys->rect_display)) {
412 SetRectEmpty(&rect_src_clipped);
417 msg_Dbg(vd, "DirectXUpdateRects image_dst_clipped coords:"
419 rect_dest_clipped.left, rect_dest_clipped.top,
420 rect_dest_clipped.right, rect_dest_clipped.bottom);
425 /* AFAIK, there are no clipping constraints in Direct3D, OpenGL and GDI */
426 rect_dest_clipped = rect_dest;
430 /* the 2 following lines are to fix a bug when clicking on the desktop */
431 if ((rect_dest_clipped.right - rect_dest_clipped.left) == 0 ||
432 (rect_dest_clipped.bottom - rect_dest_clipped.top) == 0) {
433 SetRectEmpty(&rect_src_clipped);
437 /* src image dimensions */
440 rect_src.right = source->i_width;
441 rect_src.bottom = source->i_height;
443 /* Clip the source image */
444 rect_src_clipped.left = source->i_x_offset +
445 (rect_dest_clipped.left - rect_dest.left) *
446 source->i_visible_width / (rect_dest.right - rect_dest.left);
447 rect_src_clipped.right = source->i_x_offset +
448 source->i_visible_width -
449 (rect_dest.right - rect_dest_clipped.right) *
450 source->i_visible_width / (rect_dest.right - rect_dest.left);
451 rect_src_clipped.top = source->i_y_offset +
452 (rect_dest_clipped.top - rect_dest.top) *
453 source->i_visible_height / (rect_dest.bottom - rect_dest.top);
454 rect_src_clipped.bottom = source->i_y_offset +
455 source->i_visible_height -
456 (rect_dest.bottom - rect_dest_clipped.bottom) *
457 source->i_visible_height / (rect_dest.bottom - rect_dest.top);
459 #ifdef MODULE_NAME_IS_directx
460 /* Apply overlay hardware constraints */
461 if (sys->use_overlay)
462 AlignRect(&rect_src_clipped, sys->i_align_src_boundary, sys->i_align_src_size);
463 #elif defined(MODULE_NAME_IS_direct3d) || defined(MODULE_NAME_IS_direct2d)
464 /* Needed at least with YUV content */
465 rect_src_clipped.left &= ~1;
466 rect_src_clipped.right &= ~1;
467 rect_src_clipped.top &= ~1;
468 rect_src_clipped.bottom &= ~1;
472 msg_Dbg(vd, "DirectXUpdateRects image_src_clipped"
473 " coords: %li,%li,%li,%li",
474 rect_src_clipped.left, rect_src_clipped.top,
475 rect_src_clipped.right, rect_src_clipped.bottom);
478 #ifdef MODULE_NAME_IS_directx
479 /* The destination coordinates need to be relative to the current
480 * directdraw primary surface (display) */
481 rect_dest_clipped.left -= sys->rect_display.left;
482 rect_dest_clipped.right -= sys->rect_display.left;
483 rect_dest_clipped.top -= sys->rect_display.top;
484 rect_dest_clipped.bottom -= sys->rect_display.top;
487 CommonChangeThumbnailClip(vd, true);
490 /* Signal the change in size/position */
491 sys->changes |= DX_POSITION_CHANGE;
494 #undef rect_src_clipped
496 #undef rect_dest_clipped
499 static int CommonControlSetFullscreen(vout_display_t *vd, bool is_fullscreen)
501 vout_display_sys_t *sys = vd->sys;
503 #ifdef MODULE_NAME_IS_direct3d
504 if (sys->use_desktop && is_fullscreen)
509 if (sys->parent_window)
510 return vout_window_SetFullScreen(sys->parent_window, is_fullscreen);
513 HWND hwnd = sys->hparent && sys->hfswnd ? sys->hfswnd : sys->hwnd;
515 /* Save the current windows placement/placement to restore
516 when fullscreen is over */
517 WINDOWPLACEMENT window_placement;
518 window_placement.length = sizeof(WINDOWPLACEMENT);
519 GetWindowPlacement(hwnd, &window_placement);
522 msg_Dbg(vd, "entering fullscreen mode");
524 /* Change window style, no borders and no title bar */
525 SetWindowLong(hwnd, GWL_STYLE, WS_CLIPCHILDREN | WS_VISIBLE);
531 ClientToScreen(sys->hwnd, &point);
532 GetClientRect(sys->hwnd, &rect);
533 SetWindowPos(hwnd, 0, point.x, point.y,
534 rect.right, rect.bottom,
535 SWP_NOZORDER|SWP_FRAMECHANGED);
537 /* Retrieve current window position so fullscreen will happen
538 *on the right screen */
539 HMONITOR hmon = MonitorFromWindow(sys->hparent,
540 MONITOR_DEFAULTTONEAREST);
542 mi.cbSize = sizeof(MONITORINFO);
543 if (GetMonitorInfo(hmon, &mi))
544 SetWindowPos(hwnd, 0,
547 mi.rcMonitor.right - mi.rcMonitor.left,
548 mi.rcMonitor.bottom - mi.rcMonitor.top,
549 SWP_NOZORDER|SWP_FRAMECHANGED);
552 /* Maximize non embedded window */
553 ShowWindow(hwnd, SW_SHOWMAXIMIZED);
557 /* Hide the previous window */
559 GetClientRect(hwnd, &rect);
560 SetParent(sys->hwnd, hwnd);
561 SetWindowPos(sys->hwnd, 0, 0, 0,
562 rect.right, rect.bottom,
563 SWP_NOZORDER|SWP_FRAMECHANGED);
566 HWND topLevelParent = GetParent(sys->hparent);
568 HWND topLevelParent = GetAncestor(sys->hparent, GA_ROOT);
570 ShowWindow(topLevelParent, SW_HIDE);
572 SetForegroundWindow(hwnd);
574 msg_Dbg(vd, "leaving fullscreen mode");
576 /* Change window style, no borders and no title bar */
577 SetWindowLong(hwnd, GWL_STYLE, EventThreadGetWindowStyle(sys->event));
581 GetClientRect(sys->hparent, &rect);
582 SetParent(sys->hwnd, sys->hparent);
583 SetWindowPos(sys->hwnd, 0, 0, 0,
584 rect.right, rect.bottom,
585 SWP_NOZORDER|SWP_FRAMECHANGED);
588 HWND topLevelParent = GetParent(sys->hparent);
590 HWND topLevelParent = GetAncestor(sys->hparent, GA_ROOT);
592 ShowWindow(topLevelParent, SW_SHOW);
593 SetForegroundWindow(sys->hparent);
594 ShowWindow(hwnd, SW_HIDE);
596 /* return to normal window for non embedded vout */
597 SetWindowPlacement(hwnd, &window_placement);
598 ShowWindow(hwnd, SW_SHOWNORMAL);
604 int CommonControl(vout_display_t *vd, int query, va_list args)
606 vout_display_sys_t *sys = vd->sys;
609 case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE: /* const vout_display_cfg_t *p_cfg, int is_forced */
610 case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED: /* const vout_display_cfg_t *p_cfg */
611 case VOUT_DISPLAY_CHANGE_ZOOM: /* const vout_display_cfg_t *p_cfg */
612 case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT: /* const video_format_t *p_source */
613 case VOUT_DISPLAY_CHANGE_SOURCE_CROP: { /* const video_format_t *p_source */
614 const vout_display_cfg_t *cfg;
615 const video_format_t *source;
616 bool is_forced = true;
617 if (query == VOUT_DISPLAY_CHANGE_SOURCE_CROP ||
618 query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT) {
620 source = va_arg(args, const video_format_t *);
622 cfg = va_arg(args, const vout_display_cfg_t *);
623 source = &vd->source;
624 if (query == VOUT_DISPLAY_CHANGE_DISPLAY_SIZE)
625 is_forced = va_arg(args, int);
627 if (query == VOUT_DISPLAY_CHANGE_DISPLAY_SIZE && is_forced) {
628 /* Update dimensions */
629 if (sys->parent_window) {
630 vout_window_SetSize(sys->parent_window, cfg->display.width, cfg->display.height);
634 rect_window.left = 0;
635 rect_window.right = cfg->display.width;
636 rect_window.bottom = cfg->display.height;
637 AdjustWindowRect(&rect_window, EventThreadGetWindowStyle(sys->event), 0);
639 SetWindowPos(sys->hwnd, 0, 0, 0,
640 rect_window.right - rect_window.left,
641 rect_window.bottom - rect_window.top, SWP_NOMOVE);
644 UpdateRects(vd, cfg, source, is_forced);
647 case VOUT_DISPLAY_CHANGE_WINDOW_STATE: { /* unsigned state */
648 const unsigned state = va_arg(args, unsigned);
649 const bool is_on_top = (state & VOUT_WINDOW_STATE_ABOVE) != 0;
650 #ifdef MODULE_NAME_IS_direct3d
651 if (sys->use_desktop && is_on_top)
654 if (sys->parent_window) {
655 if (vout_window_SetState(sys->parent_window, state))
658 HMENU hMenu = GetSystemMenu(sys->hwnd, FALSE);
660 if (is_on_top && !(GetWindowLong(sys->hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST)) {
661 CheckMenuItem(hMenu, IDM_TOGGLE_ON_TOP, MF_BYCOMMAND | MFS_CHECKED);
662 SetWindowPos(sys->hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
663 } else if (!is_on_top && (GetWindowLong(sys->hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST)) {
664 CheckMenuItem(hMenu, IDM_TOGGLE_ON_TOP, MF_BYCOMMAND | MFS_UNCHECKED);
665 SetWindowPos(sys->hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
668 sys->is_on_top = is_on_top;
671 case VOUT_DISPLAY_CHANGE_FULLSCREEN: { /* const vout_display_cfg_t *p_cfg */
672 const vout_display_cfg_t *cfg = va_arg(args, const vout_display_cfg_t *);
673 if (CommonControlSetFullscreen(vd, cfg->is_fullscreen))
675 UpdateRects(vd, NULL, NULL, false);
679 case VOUT_DISPLAY_HIDE_MOUSE:
680 EventThreadMouseHide(sys->event);
682 case VOUT_DISPLAY_RESET_PICTURES:
690 static void DisableScreensaver(vout_display_t *vd)
692 vout_display_sys_t *sys = vd->sys;
694 /* disable screensaver by temporarily changing system settings */
695 sys->i_spi_lowpowertimeout = 0;
696 sys->i_spi_powerofftimeout = 0;
697 sys->i_spi_screensavetimeout = 0;
698 if (var_GetBool(vd, "disable-screensaver")) {
699 msg_Dbg(vd, "disabling screen saver");
700 SystemParametersInfo(SPI_GETLOWPOWERTIMEOUT, 0,
701 &sys->i_spi_lowpowertimeout, 0);
702 if (0 != sys->i_spi_lowpowertimeout) {
703 SystemParametersInfo(SPI_SETLOWPOWERTIMEOUT, 0, NULL, 0);
705 SystemParametersInfo(SPI_GETPOWEROFFTIMEOUT, 0,
706 &sys->i_spi_powerofftimeout, 0);
707 if (0 != sys->i_spi_powerofftimeout) {
708 SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT, 0, NULL, 0);
710 SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0,
711 &sys->i_spi_screensavetimeout, 0);
712 if (0 != sys->i_spi_screensavetimeout) {
713 SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, 0, NULL, 0);
718 static void RestoreScreensaver(vout_display_t *vd)
720 vout_display_sys_t *sys = vd->sys;
722 /* restore screensaver system settings */
723 if (0 != sys->i_spi_lowpowertimeout) {
724 SystemParametersInfo(SPI_SETLOWPOWERTIMEOUT,
725 sys->i_spi_lowpowertimeout, NULL, 0);
727 if (0 != sys->i_spi_powerofftimeout) {
728 SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT,
729 sys->i_spi_powerofftimeout, NULL, 0);
731 if (0 != sys->i_spi_screensavetimeout) {
732 SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT,
733 sys->i_spi_screensavetimeout, NULL, 0);