Mercurial > mplayer.hg
comparison libvo/vo_xv.c @ 324:720c640332c8
Szebb es jobb screensaver-kikapcsolo resz
xmga, xv, x11 support (sdl comming soon)
author | laaz |
---|---|
date | Tue, 10 Apr 2001 00:00:04 +0000 |
parents | 4e69a8e2700a |
children | f6b5c2dbc88e |
comparison
equal
deleted
inserted
replaced
323:639dec99c0fd | 324:720c640332c8 |
---|---|
22 LIBVO_EXTERN(xv) | 22 LIBVO_EXTERN(xv) |
23 | 23 |
24 #include <X11/Xlib.h> | 24 #include <X11/Xlib.h> |
25 #include <X11/Xutil.h> | 25 #include <X11/Xutil.h> |
26 #include <X11/extensions/XShm.h> | 26 #include <X11/extensions/XShm.h> |
27 #include <X11/extensions/dpms.h> | |
28 #include <errno.h> | 27 #include <errno.h> |
29 | 28 |
30 #include "x11_common.h" | 29 #include "x11_common.h" |
31 | 30 |
32 static vo_info_t vo_info = | 31 static vo_info_t vo_info = |
77 | 76 |
78 static Window mRoot; | 77 static Window mRoot; |
79 static uint32_t drwX,drwY,drwWidth,drwHeight,drwBorderWidth,drwDepth; | 78 static uint32_t drwX,drwY,drwWidth,drwHeight,drwBorderWidth,drwDepth; |
80 static uint32_t drwcX,drwcY,dwidth,dheight,mFullscreen; | 79 static uint32_t drwcX,drwcY,dwidth,dheight,mFullscreen; |
81 | 80 |
82 static int timeout_save=0; | |
83 static int dpms_disabled=0; | |
84 | |
85 /* | 81 /* |
86 * connect to server, create and map window, | 82 * connect to server, create and map window, |
87 * allocate colors and (shared) memory | 83 * allocate colors and (shared) memory |
88 */ | 84 */ |
89 static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format) | 85 static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format) |
90 { | 86 { |
91 int screen; | 87 int screen; |
92 int nothing, interval, prefer_blank, allow_exp; | |
93 char *hello = (title == NULL) ? "Xv render" : title; | 88 char *hello = (title == NULL) ? "Xv render" : title; |
94 char *name = ":0.0"; | 89 char *name = ":0.0"; |
95 XSizeHints hint; | 90 XSizeHints hint; |
96 XVisualInfo vinfo; | 91 XVisualInfo vinfo; |
97 XEvent xev; | 92 XEvent xev; |
202 drwWidth=(dwidth > vo_screenwidth?vo_screenwidth:dwidth); | 197 drwWidth=(dwidth > vo_screenwidth?vo_screenwidth:dwidth); |
203 drwHeight=(dheight > vo_screenheight?vo_screenheight:dheight); | 198 drwHeight=(dheight > vo_screenheight?vo_screenheight:dheight); |
204 fprintf( stderr,"[xv-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); | 199 fprintf( stderr,"[xv-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); |
205 } | 200 } |
206 | 201 |
207 if (DPMSQueryExtension(mydisplay, ¬hing, ¬hing)) | 202 saver_off(mydisplay); // turning off screen saver |
208 { | |
209 BOOL onoff; | |
210 CARD16 state; | |
211 DPMSInfo(mydisplay, &state, &onoff); | |
212 if (onoff) | |
213 { | |
214 dpms_disabled=1; | |
215 DPMSDisable(mydisplay); // monitor powersave off | |
216 } | |
217 } | |
218 | |
219 XGetScreenSaver(mydisplay, &timeout_save, &interval, &prefer_blank, &allow_exp); | |
220 if (timeout_save) | |
221 XSetScreenSaver(mydisplay, 0, interval, prefer_blank, allow_exp); | |
222 // switching off screensaver | |
223 | |
224 return 0; | 203 return 0; |
225 } | 204 } |
226 } | 205 } |
227 | 206 |
228 printf("Sorry, Xv not supported by this X11 version/driver\n"); | 207 printf("Sorry, Xv not supported by this X11 version/driver\n"); |
410 } | 389 } |
411 return 0; | 390 return 0; |
412 } | 391 } |
413 | 392 |
414 static void uninit(void) { | 393 static void uninit(void) { |
415 int nothing; | 394 saver_on(mydisplay); // screen saver back on |
416 if (DPMSQueryExtension(mydisplay, ¬hing, ¬hing)) | 395 } |
417 { | 396 |
418 if (dpms_disabled) | 397 |
419 { | 398 |
420 DPMSEnable(mydisplay); // restoring power saving settings | |
421 DPMSQueryExtension(mydisplay, ¬hing, ¬hing); | |
422 } | |
423 } | |
424 | |
425 if (timeout_save) | |
426 { | |
427 int interval, prefer_blank, allow_exp, dummy; | |
428 XGetScreenSaver(mydisplay, &dummy, &interval, &prefer_blank, &allow_exp); | |
429 XSetScreenSaver(mydisplay, timeout_save, interval, prefer_blank, allow_exp); | |
430 XGetScreenSaver(mydisplay, &timeout_save, &interval, &prefer_blank, &allow_exp); | |
431 } | |
432 | |
433 | |
434 } | |
435 | |
436 | |
437 |