Mercurial > mplayer.hg
annotate libvo/x11_common.c @ 1273:17c13bef14f4
-fsmode
author | gabucino |
---|---|
date | Wed, 04 Jul 2001 16:32:38 +0000 |
parents | 9e1b353f8171 |
children | be674b95b485 |
rev | line source |
---|---|
448
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
440
diff
changeset
|
1 |
32 | 2 #include <stdio.h> |
3 #include <stdlib.h> | |
448
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
440
diff
changeset
|
4 |
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
440
diff
changeset
|
5 #include "config.h" |
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
440
diff
changeset
|
6 |
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
440
diff
changeset
|
7 #ifdef X11_FULLSCREEN |
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
440
diff
changeset
|
8 |
440
d19a3da6ac13
Pontscho's mixer, select, and hell-a-lot-of-stuff patch ;)
gabucino
parents:
416
diff
changeset
|
9 #include <string.h> |
32 | 10 #include <unistd.h> |
11 #include <sys/mman.h> | |
12 | |
13 #include "video_out.h" | |
14 | |
324 | 15 #include <X11/Xmd.h> |
32 | 16 #include <X11/Xlib.h> |
17 #include <X11/Xutil.h> | |
18 #include <X11/Xatom.h> | |
19 | |
448
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
440
diff
changeset
|
20 #include <X11/extensions/dpms.h> |
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
440
diff
changeset
|
21 |
324 | 22 static int dpms_disabled=0; |
23 static int timeout_save=0; | |
24 | |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
25 char* mDisplayName=NULL; |
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
26 Display* mDisplay; |
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
27 Window mRootWin; |
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
28 int mScreen; |
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
29 int mLocalDisplay; |
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
30 |
384 | 31 |
32 void vo_hidecursor ( Display *disp , Window win ) | |
33 { | |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
34 Cursor no_ptr; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
35 Pixmap bm_no; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
36 XColor black,dummy; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
37 Colormap colormap; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
38 static unsigned char bm_no_data[] = { 0,0,0,0, 0,0,0,0 }; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
39 |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
40 colormap = DefaultColormap(disp,DefaultScreen(disp)); |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
41 XAllocNamedColor(disp,colormap,"black",&black,&dummy); |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
42 bm_no = XCreateBitmapFromData(disp, win, bm_no_data, 8,8); |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
43 no_ptr=XCreatePixmapCursor(disp, bm_no, bm_no,&black, &black,0, 0); |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
44 XDefineCursor(disp,win,no_ptr); |
384 | 45 } |
46 | |
47 | |
32 | 48 int vo_init( void ) |
49 { | |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
50 // int mScreen; |
32 | 51 int bpp; |
1137
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
52 unsigned int mask; |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
53 // char * DisplayName = ":0.0"; |
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
54 // Display * mDisplay; |
32 | 55 XImage * mXImage; |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
56 // Window mRootWin; |
32 | 57 static XWindowAttributes attribs; |
58 | |
59 if(vo_depthonscreen) return 1; // already called | |
60 | |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
61 if (!mDisplayName) |
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
62 if (!(mDisplayName=getenv("DISPLAY"))) |
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
63 mDisplayName=strdup(":0.0"); |
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
64 |
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
65 mDisplay=XOpenDisplay(mDisplayName); |
32 | 66 if ( !mDisplay ) |
67 { | |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
68 printf( "vo: couldn't open the X11 display (%s)!\n",mDisplayName ); |
32 | 69 return 0; |
70 } | |
71 mScreen=DefaultScreen( mDisplay ); // Screen ID. | |
72 mRootWin=RootWindow( mDisplay,mScreen );// Root window ID. | |
73 vo_screenwidth=DisplayWidth( mDisplay,mScreen ); | |
74 vo_screenheight=DisplayHeight( mDisplay,mScreen ); | |
75 // get color depth: | |
76 // XGetWindowAttributes(mydisplay, DefaultRootWindow(mDisplay), &attribs); | |
77 XGetWindowAttributes(mDisplay, mRootWin, &attribs); | |
78 vo_depthonscreen=attribs.depth; | |
79 // get bits/pixel: | |
80 mXImage=XGetImage( mDisplay,mRootWin,0,0,1,1,AllPlanes,ZPixmap ); | |
81 bpp=mXImage->bits_per_pixel; | |
1137
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
82 if((vo_depthonscreen+7)/8 != (bpp+7)/8) vo_depthonscreen=bpp; // by A'rpi |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
83 mask=mXImage->red_mask|mXImage->green_mask|mXImage->blue_mask; |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
84 printf("vo: X11 color mask: %X (R:%lX G:%lX B:%lX)\n", |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
85 mask,mXImage->red_mask,mXImage->green_mask,mXImage->blue_mask); |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
86 if(((vo_depthonscreen+7)/8)==2){ |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
87 if(mask==0x7FFF) vo_depthonscreen=15; else |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
88 if(mask==0xFFFF) vo_depthonscreen=16; |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
89 } |
32 | 90 XDestroyImage( mXImage ); |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
91 // XCloseDisplay( mDisplay ); |
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
92 #warning Better local display detection method is needed. |
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
93 if (*mDisplayName==':') mLocalDisplay=1; else mLocalDisplay=0; |
1137
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
94 printf("vo: X11 running at %dx%d depth: %d (\"%s\" => %s display)\n",vo_screenwidth,vo_screenheight,vo_depthonscreen,mDisplayName,mLocalDisplay?"local":"remote"); |
32 | 95 return 1; |
96 } | |
97 | |
98 #include "../linux/keycodes.h" | |
99 #include "wskeys.h" | |
100 | |
101 extern void mplayer_put_key(int code); | |
102 | |
103 void vo_x11_putkey(int key){ | |
104 switch ( key ) | |
105 { | |
106 case wsLeft: mplayer_put_key(KEY_LEFT); break; | |
107 case wsRight: mplayer_put_key(KEY_RIGHT); break; | |
108 case wsUp: mplayer_put_key(KEY_UP); break; | |
109 case wsDown: mplayer_put_key(KEY_DOWN); break; | |
110 case wsSpace: mplayer_put_key(' '); break; | |
111 case wsEscape: mplayer_put_key(KEY_ESC); break; | |
112 case wsEnter: mplayer_put_key(KEY_ENTER); break; | |
651 | 113 case wsPageUp: mplayer_put_key(KEY_PAGE_UP); break; |
114 case wsPageDown: mplayer_put_key(KEY_PAGE_DOWN); break; | |
32 | 115 case wsq: |
116 case wsQ: mplayer_put_key('q'); break; | |
117 case wsp: | |
118 case wsP: mplayer_put_key('p'); break; | |
119 case wsMinus: | |
120 case wsGrayMinus: mplayer_put_key('-'); break; | |
121 case wsPlus: | |
122 case wsGrayPlus: mplayer_put_key('+'); break; | |
464 | 123 case wsGrayMul: |
124 case wsMul: mplayer_put_key('*'); break; | |
125 case wsGrayDiv: | |
126 case wsDiv: mplayer_put_key('/'); break; | |
516 | 127 case wsm: |
128 case wsM: mplayer_put_key('m'); break; | |
655 | 129 case wso: |
130 case wsO: mplayer_put_key('o'); break; | |
369 | 131 default: if((key>='a' && key<='z')||(key>='A' && key<='Z')) mplayer_put_key(key); |
32 | 132 } |
369 | 133 |
32 | 134 } |
135 | |
136 | |
137 // ----- Motif header: ------- | |
138 | |
1236 | 139 #define MWM_HINTS_FUNCTIONS (1L << 0) |
140 #define MWM_HINTS_DECORATIONS (1L << 1) | |
141 #define MWM_HINTS_INPUT_MODE (1L << 2) | |
142 #define MWM_HINTS_STATUS (1L << 3) | |
143 | |
144 #define MWM_FUNC_ALL (1L << 0) | |
145 #define MWM_FUNC_RESIZE (1L << 1) | |
146 #define MWM_FUNC_MOVE (1L << 2) | |
147 #define MWM_FUNC_MINIMIZE (1L << 3) | |
148 #define MWM_FUNC_MAXIMIZE (1L << 4) | |
149 #define MWM_FUNC_CLOSE (1L << 5) | |
150 | |
151 #define MWM_DECOR_ALL (1L << 0) | |
152 #define MWM_DECOR_BORDER (1L << 1) | |
153 #define MWM_DECOR_RESIZEH (1L << 2) | |
154 #define MWM_DECOR_TITLE (1L << 3) | |
155 #define MWM_DECOR_MENU (1L << 4) | |
156 #define MWM_DECOR_MINIMIZE (1L << 5) | |
157 #define MWM_DECOR_MAXIMIZE (1L << 6) | |
158 | |
159 #define MWM_INPUT_MODELESS 0 | |
160 #define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1 | |
161 #define MWM_INPUT_SYSTEM_MODAL 2 | |
162 #define MWM_INPUT_FULL_APPLICATION_MODAL 3 | |
163 #define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL | |
164 | |
165 #define MWM_TEAROFF_WINDOW (1L<<0) | |
32 | 166 |
167 typedef struct | |
168 { | |
169 long flags; | |
170 long functions; | |
171 long decorations; | |
172 long input_mode; | |
1236 | 173 long state; |
32 | 174 } MotifWmHints; |
175 | |
176 extern MotifWmHints vo_MotifWmHints; | |
177 extern Atom vo_MotifHints; | |
178 extern int vo_depthonscreen; | |
179 extern int vo_screenwidth; | |
180 extern int vo_screenheight; | |
181 | |
182 static MotifWmHints vo_MotifWmHints; | |
183 static Atom vo_MotifHints = None; | |
184 | |
1266 | 185 // Note: always d==0 ! |
32 | 186 void vo_x11_decoration( Display * vo_Display,Window w,int d ) |
187 { | |
1266 | 188 |
189 if(vo_fsmode&1){ | |
190 XSetWindowAttributes attr; | |
191 attr.override_redirect = True; | |
192 XChangeWindowAttributes(vo_Display, w, CWOverrideRedirect, &attr); | |
193 // XMapWindow(vo_Display], w); | |
194 } | |
195 | |
32 | 196 vo_MotifHints=XInternAtom( vo_Display,"_MOTIF_WM_HINTS",0 ); |
197 if ( vo_MotifHints != None ) | |
198 { | |
1236 | 199 memset( &vo_MotifWmHints,0,sizeof( MotifWmHints ) ); |
200 vo_MotifWmHints.flags=MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS; | |
201 vo_MotifWmHints.functions=MWM_FUNC_MOVE | MWM_FUNC_CLOSE | MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE; | |
202 if ( d ) d=MWM_DECOR_ALL; | |
1266 | 203 vo_MotifWmHints.decorations=d|((vo_fsmode&2)?0:MWM_DECOR_MENU); |
32 | 204 XChangeProperty( vo_Display,w,vo_MotifHints,vo_MotifHints,32, |
1266 | 205 PropModeReplace,(unsigned char *)&vo_MotifWmHints,(vo_fsmode&4)?4:5 ); |
32 | 206 } |
207 } | |
208 | |
1137
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
209 void vo_x11_classhint( Display * display,Window window,char *name ){ |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
210 XClassHint wmClass; |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
211 wmClass.res_name = name; |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
212 wmClass.res_class = "MPlayer"; |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
213 XSetClassHint(display,window,&wmClass); |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
214 } |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
215 |
723 | 216 #ifdef HAVE_GUI |
217 Window vo_window = None; | |
218 GC vo_gc; | |
219 int vo_xeventhandling = 1; | |
220 int vo_resize = 0; | |
221 int vo_expose = 0; | |
222 | |
223 void vo_setwindow( Window w,GC g ) | |
224 { vo_window=w; vo_gc=g; } | |
225 #endif | |
226 | |
32 | 227 int vo_x11_check_events(Display *mydisplay){ |
228 int ret=0; | |
229 XEvent Event; | |
230 char buf[100]; | |
231 KeySym keySym; | |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
922
diff
changeset
|
232 static XComposeStatus stat; |
32 | 233 // unsigned long vo_KeyTable[512]; |
234 | |
723 | 235 #ifdef HAVE_GUI |
236 if ( vo_xeventhandling ) | |
237 { | |
238 #endif | |
239 while ( XPending( mydisplay ) ) | |
240 { | |
241 XNextEvent( mydisplay,&Event ); | |
242 switch( Event.type ) | |
243 { | |
244 case Expose: | |
245 ret|=VO_EVENT_EXPOSE; | |
246 break; | |
247 case ConfigureNotify: | |
248 vo_dwidth=Event.xconfigure.width; | |
249 vo_dheight=Event.xconfigure.height; | |
250 ret|=VO_EVENT_RESIZE; | |
251 break; | |
252 case KeyPress: | |
253 XLookupString( &Event.xkey,buf,sizeof(buf),&keySym,&stat ); | |
254 vo_x11_putkey( ( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) ) ); | |
255 ret|=VO_EVENT_KEYPRESS; | |
256 break; | |
257 } | |
258 } | |
259 #ifdef HAVE_GUI | |
32 | 260 } |
723 | 261 else |
262 { | |
263 if ( vo_resize ) | |
264 { | |
265 vo_resize=0; | |
266 ret|=VO_EVENT_RESIZE; | |
267 } | |
268 if ( vo_expose ) | |
269 { | |
270 vo_expose=0; | |
271 ret|=VO_EVENT_EXPOSE; | |
272 } | |
273 } | |
274 #endif | |
32 | 275 |
276 return ret; | |
277 } | |
278 | |
324 | 279 void saver_on(Display *mDisplay) { |
280 | |
281 int nothing; | |
282 if (dpms_disabled) | |
283 { | |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
284 if (DPMSQueryExtension(mDisplay, ¬hing, ¬hing)) |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
285 { |
741 | 286 if (!DPMSEnable(mDisplay)) { // restoring power saving settings |
287 printf("DPMS not available?\n"); | |
288 } else { | |
289 // DPMS does not seem to be enabled unless we call DPMSInfo | |
290 BOOL onoff; | |
291 CARD16 state; | |
292 DPMSInfo(mDisplay, &state, &onoff); | |
293 if (onoff) { | |
294 printf ("Successfully enabled DPMS\n"); | |
295 } else { | |
296 printf ("Could not enable DPMS\n"); | |
297 } | |
298 } | |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
299 } |
324 | 300 } |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
301 |
324 | 302 if (timeout_save) |
303 { | |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
304 int dummy, interval, prefer_blank, allow_exp; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
305 XGetScreenSaver(mDisplay, &dummy, &interval, &prefer_blank, &allow_exp); |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
306 XSetScreenSaver(mDisplay, timeout_save, interval, prefer_blank, allow_exp); |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
307 XGetScreenSaver(mDisplay, &timeout_save, &interval, &prefer_blank, &allow_exp); |
324 | 308 } |
309 | |
310 } | |
311 | |
312 void saver_off(Display *mDisplay) { | |
313 | |
314 int interval, prefer_blank, allow_exp, nothing; | |
315 | |
316 if (DPMSQueryExtension(mDisplay, ¬hing, ¬hing)) | |
317 { | |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
318 BOOL onoff; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
319 CARD16 state; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
320 DPMSInfo(mDisplay, &state, &onoff); |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
321 if (onoff) |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
322 { |
741 | 323 Status stat; |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
324 printf ("Disabling DPMS\n"); |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
325 dpms_disabled=1; |
741 | 326 stat = DPMSDisable(mDisplay); // monitor powersave off |
327 printf ("stat: %d\n", stat); | |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
328 } |
324 | 329 } |
330 XGetScreenSaver(mDisplay, &timeout_save, &interval, &prefer_blank, &allow_exp); | |
331 if (timeout_save) | |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
332 XSetScreenSaver(mDisplay, 0, interval, prefer_blank, allow_exp); |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
333 // turning off screensaver |
326 | 334 } |
448
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
440
diff
changeset
|
335 |
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
440
diff
changeset
|
336 #endif |