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