Mercurial > mplayer.hg
annotate libvo/x11_common.c @ 1422:d02e0dcaf077
libvo2 support
author | arpi |
---|---|
date | Mon, 30 Jul 2001 02:00:54 +0000 |
parents | 4d77492e5d67 |
children | e82fbd67ae60 |
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 | |
1415 | 198 if(vo_fsmode&8){ |
199 XSetTransientForHint (vo_Display, w, RootWindow(vo_Display,mScreen)); | |
200 } | |
201 | |
32 | 202 vo_MotifHints=XInternAtom( vo_Display,"_MOTIF_WM_HINTS",0 ); |
203 if ( vo_MotifHints != None ) | |
204 { | |
1236 | 205 memset( &vo_MotifWmHints,0,sizeof( MotifWmHints ) ); |
206 vo_MotifWmHints.flags=MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS; | |
207 vo_MotifWmHints.functions=MWM_FUNC_MOVE | MWM_FUNC_CLOSE | MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE; | |
208 if ( d ) d=MWM_DECOR_ALL; | |
1266 | 209 vo_MotifWmHints.decorations=d|((vo_fsmode&2)?0:MWM_DECOR_MENU); |
32 | 210 XChangeProperty( vo_Display,w,vo_MotifHints,vo_MotifHints,32, |
1266 | 211 PropModeReplace,(unsigned char *)&vo_MotifWmHints,(vo_fsmode&4)?4:5 ); |
32 | 212 } |
213 } | |
214 | |
1137
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
215 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
|
216 XClassHint wmClass; |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
217 wmClass.res_name = name; |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
218 wmClass.res_class = "MPlayer"; |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
219 XSetClassHint(display,window,&wmClass); |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
220 } |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
221 |
723 | 222 #ifdef HAVE_GUI |
223 Window vo_window = None; | |
224 GC vo_gc; | |
225 int vo_xeventhandling = 1; | |
226 int vo_resize = 0; | |
227 int vo_expose = 0; | |
228 | |
229 void vo_setwindow( Window w,GC g ) | |
230 { vo_window=w; vo_gc=g; } | |
231 #endif | |
232 | |
32 | 233 int vo_x11_check_events(Display *mydisplay){ |
234 int ret=0; | |
235 XEvent Event; | |
236 char buf[100]; | |
237 KeySym keySym; | |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J«ärgen Keil <jk@tools.de>
arpi_esp
parents:
922
diff
changeset
|
238 static XComposeStatus stat; |
32 | 239 // unsigned long vo_KeyTable[512]; |
240 | |
723 | 241 #ifdef HAVE_GUI |
242 if ( vo_xeventhandling ) | |
243 { | |
244 #endif | |
245 while ( XPending( mydisplay ) ) | |
246 { | |
247 XNextEvent( mydisplay,&Event ); | |
248 switch( Event.type ) | |
249 { | |
250 case Expose: | |
251 ret|=VO_EVENT_EXPOSE; | |
252 break; | |
253 case ConfigureNotify: | |
254 vo_dwidth=Event.xconfigure.width; | |
255 vo_dheight=Event.xconfigure.height; | |
256 ret|=VO_EVENT_RESIZE; | |
257 break; | |
258 case KeyPress: | |
259 XLookupString( &Event.xkey,buf,sizeof(buf),&keySym,&stat ); | |
260 vo_x11_putkey( ( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) ) ); | |
261 ret|=VO_EVENT_KEYPRESS; | |
262 break; | |
263 } | |
264 } | |
265 #ifdef HAVE_GUI | |
32 | 266 } |
723 | 267 else |
268 { | |
269 if ( vo_resize ) | |
270 { | |
271 vo_resize=0; | |
272 ret|=VO_EVENT_RESIZE; | |
273 } | |
274 if ( vo_expose ) | |
275 { | |
276 vo_expose=0; | |
277 ret|=VO_EVENT_EXPOSE; | |
278 } | |
279 } | |
280 #endif | |
32 | 281 |
282 return ret; | |
283 } | |
284 | |
324 | 285 void saver_on(Display *mDisplay) { |
286 | |
1345
be674b95b485
x11_common does not compile, when the XDPMS extension is not available on the
jkeil
parents:
1266
diff
changeset
|
287 #ifdef HAVE_XDPMS |
324 | 288 int nothing; |
289 if (dpms_disabled) | |
290 { | |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
291 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
|
292 { |
741 | 293 if (!DPMSEnable(mDisplay)) { // restoring power saving settings |
294 printf("DPMS not available?\n"); | |
295 } else { | |
296 // DPMS does not seem to be enabled unless we call DPMSInfo | |
297 BOOL onoff; | |
298 CARD16 state; | |
299 DPMSInfo(mDisplay, &state, &onoff); | |
300 if (onoff) { | |
301 printf ("Successfully enabled DPMS\n"); | |
302 } else { | |
303 printf ("Could not enable DPMS\n"); | |
304 } | |
305 } | |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
306 } |
324 | 307 } |
1345
be674b95b485
x11_common does not compile, when the XDPMS extension is not available on the
jkeil
parents:
1266
diff
changeset
|
308 #endif |
be674b95b485
x11_common does not compile, when the XDPMS extension is not available on the
jkeil
parents:
1266
diff
changeset
|
309 |
324 | 310 if (timeout_save) |
311 { | |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
312 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
|
313 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
|
314 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
|
315 XGetScreenSaver(mDisplay, &timeout_save, &interval, &prefer_blank, &allow_exp); |
324 | 316 } |
317 | |
318 } | |
319 | |
320 void saver_off(Display *mDisplay) { | |
321 | |
1345
be674b95b485
x11_common does not compile, when the XDPMS extension is not available on the
jkeil
parents:
1266
diff
changeset
|
322 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
|
323 #ifdef HAVE_XDPMS |
be674b95b485
x11_common does not compile, when the XDPMS extension is not available on the
jkeil
parents:
1266
diff
changeset
|
324 int nothing; |
324 | 325 |
326 if (DPMSQueryExtension(mDisplay, ¬hing, ¬hing)) | |
327 { | |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
328 BOOL onoff; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
329 CARD16 state; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
330 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
|
331 if (onoff) |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
332 { |
741 | 333 Status stat; |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
334 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
|
335 dpms_disabled=1; |
741 | 336 stat = DPMSDisable(mDisplay); // monitor powersave off |
337 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
|
338 } |
324 | 339 } |
1345
be674b95b485
x11_common does not compile, when the XDPMS extension is not available on the
jkeil
parents:
1266
diff
changeset
|
340 #endif |
324 | 341 XGetScreenSaver(mDisplay, &timeout_save, &interval, &prefer_blank, &allow_exp); |
342 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
|
343 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
|
344 // turning off screensaver |
326 | 345 } |
448
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
440
diff
changeset
|
346 |
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
440
diff
changeset
|
347 #endif |