Mercurial > mplayer.hg
annotate libvo/x11_common.c @ 3895:7df4a1460e3a
dshow help changed - it doesn't depend on c++ compiler/libs
author | arpi |
---|---|
date | Sun, 30 Dec 2001 13:26:14 +0000 |
parents | fc1db33734e7 |
children | 50be9c235764 |
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 |
2149
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
24 #ifdef HAVE_XINERAMA |
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
25 #include <X11/extensions/Xinerama.h> |
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
26 #endif |
1732 | 27 |
28 /* | |
29 * If SCAN_VISUALS is defined, vo_init() scans all available TrueColor | |
30 * visuals for the 'best' visual for MPlayer video display. Note that | |
31 * the 'best' visual might be different from the default visual that | |
32 * is in use on the root window of the display/screen. | |
33 */ | |
34 #define SCAN_VISUALS | |
35 | |
36 | |
1456
8c57a5a3c645
printfs cleanup - moved to higher -v level or moved to stderr
arpi
parents:
1447
diff
changeset
|
37 extern verbose; |
8c57a5a3c645
printfs cleanup - moved to higher -v level or moved to stderr
arpi
parents:
1447
diff
changeset
|
38 |
324 | 39 static int dpms_disabled=0; |
40 static int timeout_save=0; | |
41 | |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
42 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
|
43 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
|
44 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
|
45 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
|
46 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
|
47 |
3830 | 48 /* output window id */ |
49 int WinID=-1; | |
384 | 50 |
51 void vo_hidecursor ( Display *disp , Window win ) | |
52 { | |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
53 Cursor no_ptr; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
54 Pixmap bm_no; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
55 XColor black,dummy; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
56 Colormap colormap; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
57 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
|
58 |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
59 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
|
60 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
|
61 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
|
62 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
|
63 XDefineCursor(disp,win,no_ptr); |
384 | 64 } |
65 | |
66 | |
1732 | 67 #ifdef SCAN_VISUALS |
68 /* | |
69 * Scan the available visuals on this Display/Screen. Try to find | |
70 * the 'best' available TrueColor visual that has a decent color | |
71 * depth (at least 15bit). If there are multiple visuals with depth | |
72 * >= 15bit, we prefer visuals with a smaller color depth. | |
73 */ | |
74 int vo_find_depth_from_visuals(Display *dpy, int screen, Visual **visual_return) | |
75 { | |
76 XVisualInfo visual_tmpl; | |
77 XVisualInfo *visuals; | |
78 int nvisuals, i; | |
79 int bestvisual = -1; | |
80 int bestvisual_depth = -1; | |
81 | |
82 visual_tmpl.screen = screen; | |
83 visual_tmpl.class = TrueColor; | |
84 visuals = XGetVisualInfo(dpy, | |
85 VisualScreenMask | VisualClassMask, &visual_tmpl, | |
86 &nvisuals); | |
87 if (visuals != NULL) { | |
88 for (i = 0; i < nvisuals; i++) { | |
89 if (verbose) | |
90 printf("vo: X11 truecolor visual %#x, depth %d, R:%lX G:%lX B:%lX\n", | |
91 visuals[i].visualid, visuals[i].depth, | |
92 visuals[i].red_mask, visuals[i].green_mask, | |
93 visuals[i].blue_mask); | |
94 /* | |
95 * save the visual index and it's depth, if this is the first | |
96 * truecolor visul, or a visual that is 'preferred' over the | |
97 * previous 'best' visual | |
98 */ | |
99 if (bestvisual_depth == -1 | |
100 || (visuals[i].depth >= 15 | |
101 && ( visuals[i].depth < bestvisual_depth | |
102 || bestvisual_depth < 15))) { | |
103 bestvisual = i; | |
104 bestvisual_depth = visuals[i].depth; | |
105 } | |
106 } | |
107 | |
108 if (bestvisual != -1 && visual_return != NULL) | |
109 *visual_return = visuals[bestvisual].visual; | |
110 | |
111 XFree(visuals); | |
112 } | |
113 return bestvisual_depth; | |
114 } | |
115 #endif | |
116 | |
117 | |
32 | 118 int vo_init( void ) |
119 { | |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
120 // int mScreen; |
1732 | 121 int depth, bpp; |
1137
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
122 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
|
123 // 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
|
124 // Display * mDisplay; |
1732 | 125 XImage * mXImage = NULL; |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
126 // Window mRootWin; |
1732 | 127 XWindowAttributes attribs; |
32 | 128 |
129 if(vo_depthonscreen) return 1; // already called | |
130 | |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
131 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
|
132 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
|
133 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
|
134 |
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
135 mDisplay=XOpenDisplay(mDisplayName); |
32 | 136 if ( !mDisplay ) |
137 { | |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
138 printf( "vo: couldn't open the X11 display (%s)!\n",mDisplayName ); |
32 | 139 return 0; |
140 } | |
141 mScreen=DefaultScreen( mDisplay ); // Screen ID. | |
142 mRootWin=RootWindow( mDisplay,mScreen );// Root window ID. | |
2149
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
143 |
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
144 #ifdef HAVE_XINERAMA |
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
145 if(XineramaIsActive(mDisplay)) |
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
146 { |
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
147 XineramaScreenInfo *screens; |
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
148 int num_screens; |
3461
6b4ff1eb79bf
xinerama: allow to override xinerama screen_w/screen_h and setting size of screen where the window is placed
alex
parents:
2364
diff
changeset
|
149 int disp_screen = mScreen; |
6b4ff1eb79bf
xinerama: allow to override xinerama screen_w/screen_h and setting size of screen where the window is placed
alex
parents:
2364
diff
changeset
|
150 |
2149
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
151 screens = XineramaQueryScreens(mDisplay, &num_screens); |
3461
6b4ff1eb79bf
xinerama: allow to override xinerama screen_w/screen_h and setting size of screen where the window is placed
alex
parents:
2364
diff
changeset
|
152 if (disp_screen > num_screens) |
6b4ff1eb79bf
xinerama: allow to override xinerama screen_w/screen_h and setting size of screen where the window is placed
alex
parents:
2364
diff
changeset
|
153 disp_screen = 0; |
6b4ff1eb79bf
xinerama: allow to override xinerama screen_w/screen_h and setting size of screen where the window is placed
alex
parents:
2364
diff
changeset
|
154 if (! vo_screenwidth) |
6b4ff1eb79bf
xinerama: allow to override xinerama screen_w/screen_h and setting size of screen where the window is placed
alex
parents:
2364
diff
changeset
|
155 vo_screenwidth=screens[disp_screen].width; |
6b4ff1eb79bf
xinerama: allow to override xinerama screen_w/screen_h and setting size of screen where the window is placed
alex
parents:
2364
diff
changeset
|
156 if (! vo_screenheight) |
6b4ff1eb79bf
xinerama: allow to override xinerama screen_w/screen_h and setting size of screen where the window is placed
alex
parents:
2364
diff
changeset
|
157 vo_screenheight=screens[disp_screen].height; |
2149
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
158 } |
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
159 else |
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
160 #endif |
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
161 { |
2364 | 162 if (! vo_screenwidth) |
163 vo_screenwidth=DisplayWidth( mDisplay,mScreen ); | |
164 if (! vo_screenheight) | |
165 vo_screenheight=DisplayHeight( mDisplay,mScreen ); | |
2149
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
166 } |
1732 | 167 // get color depth (from root window, or the best visual): |
32 | 168 XGetWindowAttributes(mDisplay, mRootWin, &attribs); |
1732 | 169 depth=attribs.depth; |
170 | |
171 #ifdef SCAN_VISUALS | |
172 if (depth != 15 && depth != 16 && depth != 24 && depth != 32) { | |
173 Visual *visual; | |
174 | |
175 depth = vo_find_depth_from_visuals(mDisplay, mScreen, &visual); | |
176 if (depth != -1) | |
177 mXImage=XCreateImage(mDisplay, visual, depth, ZPixmap, | |
178 0, NULL, 1, 1, 8, 1); | |
179 } else | |
180 #endif | |
181 mXImage=XGetImage( mDisplay,mRootWin,0,0,1,1,AllPlanes,ZPixmap ); | |
182 | |
183 vo_depthonscreen = depth; // display depth on screen | |
184 | |
185 // get bits/pixel from XImage structure: | |
186 if (mXImage == NULL) { | |
187 mask = 0; | |
188 } else { | |
189 /* | |
190 * for the depth==24 case, the XImage structures might use | |
191 * 24 or 32 bits of data per pixel. The global variable | |
192 * vo_depthonscreen stores the amount of data per pixel in the | |
193 * XImage structure! | |
194 * | |
195 * Maybe we should rename vo_depthonscreen to (or add) vo_bpp? | |
196 */ | |
32 | 197 bpp=mXImage->bits_per_pixel; |
1137
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
198 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
|
199 mask=mXImage->red_mask|mXImage->green_mask|mXImage->blue_mask; |
1732 | 200 XDestroyImage( mXImage ); |
1456
8c57a5a3c645
printfs cleanup - moved to higher -v level or moved to stderr
arpi
parents:
1447
diff
changeset
|
201 if(verbose) |
1732 | 202 printf("vo: X11 color mask: %X (R:%lX G:%lX B:%lX)\n", |
203 mask,mXImage->red_mask,mXImage->green_mask,mXImage->blue_mask); | |
204 } | |
205 if(((vo_depthonscreen+7)/8)==2){ | |
206 if(mask==0x7FFF) vo_depthonscreen=15; else | |
207 if(mask==0xFFFF) vo_depthonscreen=16; | |
208 } | |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
209 // XCloseDisplay( mDisplay ); |
1447
e82fbd67ae60
better local display connection patch by Adam Tla/lka atlka@pg.gda.pl
arpi
parents:
1415
diff
changeset
|
210 /* slightly improved local display detection AST */ |
e82fbd67ae60
better local display connection patch by Adam Tla/lka atlka@pg.gda.pl
arpi
parents:
1415
diff
changeset
|
211 if ( strncmp(mDisplayName, "unix:", 5) == 0) |
e82fbd67ae60
better local display connection patch by Adam Tla/lka atlka@pg.gda.pl
arpi
parents:
1415
diff
changeset
|
212 mDisplayName += 4; |
e82fbd67ae60
better local display connection patch by Adam Tla/lka atlka@pg.gda.pl
arpi
parents:
1415
diff
changeset
|
213 else if ( strncmp(mDisplayName, "localhost:", 10) == 0) |
e82fbd67ae60
better local display connection patch by Adam Tla/lka atlka@pg.gda.pl
arpi
parents:
1415
diff
changeset
|
214 mDisplayName += 9; |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
215 if (*mDisplayName==':') mLocalDisplay=1; else mLocalDisplay=0; |
1732 | 216 printf("vo: X11 running at %dx%d with depth %d and %d bits/pixel (\"%s\" => %s display)\n", |
217 vo_screenwidth,vo_screenheight, | |
218 depth, vo_depthonscreen, | |
219 mDisplayName,mLocalDisplay?"local":"remote"); | |
32 | 220 return 1; |
221 } | |
222 | |
223 #include "../linux/keycodes.h" | |
224 #include "wskeys.h" | |
225 | |
226 extern void mplayer_put_key(int code); | |
227 | |
228 void vo_x11_putkey(int key){ | |
229 switch ( key ) | |
230 { | |
231 case wsLeft: mplayer_put_key(KEY_LEFT); break; | |
232 case wsRight: mplayer_put_key(KEY_RIGHT); break; | |
233 case wsUp: mplayer_put_key(KEY_UP); break; | |
234 case wsDown: mplayer_put_key(KEY_DOWN); break; | |
235 case wsSpace: mplayer_put_key(' '); break; | |
236 case wsEscape: mplayer_put_key(KEY_ESC); break; | |
237 case wsEnter: mplayer_put_key(KEY_ENTER); break; | |
651 | 238 case wsPageUp: mplayer_put_key(KEY_PAGE_UP); break; |
239 case wsPageDown: mplayer_put_key(KEY_PAGE_DOWN); break; | |
32 | 240 case wsq: |
241 case wsQ: mplayer_put_key('q'); break; | |
242 case wsp: | |
243 case wsP: mplayer_put_key('p'); break; | |
244 case wsMinus: | |
245 case wsGrayMinus: mplayer_put_key('-'); break; | |
246 case wsPlus: | |
247 case wsGrayPlus: mplayer_put_key('+'); break; | |
464 | 248 case wsGrayMul: |
249 case wsMul: mplayer_put_key('*'); break; | |
250 case wsGrayDiv: | |
251 case wsDiv: mplayer_put_key('/'); break; | |
3490 | 252 case wsLess: mplayer_put_key('<'); break; |
253 case wsMore: mplayer_put_key('>'); break; | |
516 | 254 case wsm: |
255 case wsM: mplayer_put_key('m'); break; | |
655 | 256 case wso: |
257 case wsO: mplayer_put_key('o'); break; | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1456
diff
changeset
|
258 default: if((key>='a' && key<='z')||(key>='A' && key<='Z')|| |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1456
diff
changeset
|
259 (key>='0' && key<='9')) mplayer_put_key(key); |
32 | 260 } |
369 | 261 |
32 | 262 } |
263 | |
264 | |
265 // ----- Motif header: ------- | |
266 | |
1236 | 267 #define MWM_HINTS_FUNCTIONS (1L << 0) |
268 #define MWM_HINTS_DECORATIONS (1L << 1) | |
269 #define MWM_HINTS_INPUT_MODE (1L << 2) | |
270 #define MWM_HINTS_STATUS (1L << 3) | |
271 | |
272 #define MWM_FUNC_ALL (1L << 0) | |
273 #define MWM_FUNC_RESIZE (1L << 1) | |
274 #define MWM_FUNC_MOVE (1L << 2) | |
275 #define MWM_FUNC_MINIMIZE (1L << 3) | |
276 #define MWM_FUNC_MAXIMIZE (1L << 4) | |
277 #define MWM_FUNC_CLOSE (1L << 5) | |
278 | |
279 #define MWM_DECOR_ALL (1L << 0) | |
280 #define MWM_DECOR_BORDER (1L << 1) | |
281 #define MWM_DECOR_RESIZEH (1L << 2) | |
282 #define MWM_DECOR_TITLE (1L << 3) | |
283 #define MWM_DECOR_MENU (1L << 4) | |
284 #define MWM_DECOR_MINIMIZE (1L << 5) | |
285 #define MWM_DECOR_MAXIMIZE (1L << 6) | |
286 | |
287 #define MWM_INPUT_MODELESS 0 | |
288 #define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1 | |
289 #define MWM_INPUT_SYSTEM_MODAL 2 | |
290 #define MWM_INPUT_FULL_APPLICATION_MODAL 3 | |
291 #define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL | |
292 | |
293 #define MWM_TEAROFF_WINDOW (1L<<0) | |
32 | 294 |
295 typedef struct | |
296 { | |
297 long flags; | |
298 long functions; | |
299 long decorations; | |
300 long input_mode; | |
1236 | 301 long state; |
32 | 302 } MotifWmHints; |
303 | |
304 extern MotifWmHints vo_MotifWmHints; | |
305 extern Atom vo_MotifHints; | |
306 extern int vo_depthonscreen; | |
307 extern int vo_screenwidth; | |
308 extern int vo_screenheight; | |
309 | |
310 static MotifWmHints vo_MotifWmHints; | |
311 static Atom vo_MotifHints = None; | |
312 | |
1266 | 313 // Note: always d==0 ! |
32 | 314 void vo_x11_decoration( Display * vo_Display,Window w,int d ) |
315 { | |
1266 | 316 |
317 if(vo_fsmode&1){ | |
318 XSetWindowAttributes attr; | |
319 attr.override_redirect = True; | |
320 XChangeWindowAttributes(vo_Display, w, CWOverrideRedirect, &attr); | |
321 // XMapWindow(vo_Display], w); | |
322 } | |
323 | |
1415 | 324 if(vo_fsmode&8){ |
325 XSetTransientForHint (vo_Display, w, RootWindow(vo_Display,mScreen)); | |
326 } | |
327 | |
32 | 328 vo_MotifHints=XInternAtom( vo_Display,"_MOTIF_WM_HINTS",0 ); |
329 if ( vo_MotifHints != None ) | |
330 { | |
1236 | 331 memset( &vo_MotifWmHints,0,sizeof( MotifWmHints ) ); |
332 vo_MotifWmHints.flags=MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS; | |
333 vo_MotifWmHints.functions=MWM_FUNC_MOVE | MWM_FUNC_CLOSE | MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE; | |
334 if ( d ) d=MWM_DECOR_ALL; | |
1266 | 335 vo_MotifWmHints.decorations=d|((vo_fsmode&2)?0:MWM_DECOR_MENU); |
32 | 336 XChangeProperty( vo_Display,w,vo_MotifHints,vo_MotifHints,32, |
1266 | 337 PropModeReplace,(unsigned char *)&vo_MotifWmHints,(vo_fsmode&4)?4:5 ); |
32 | 338 } |
339 } | |
340 | |
1137
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
341 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
|
342 XClassHint wmClass; |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
343 wmClass.res_name = name; |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
344 wmClass.res_class = "MPlayer"; |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
345 XSetClassHint(display,window,&wmClass); |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
346 } |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
347 |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1501
diff
changeset
|
348 #ifdef HAVE_NEW_GUI |
723 | 349 Window vo_window = None; |
350 GC vo_gc; | |
351 int vo_xeventhandling = 1; | |
352 int vo_resize = 0; | |
353 int vo_expose = 0; | |
354 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1501
diff
changeset
|
355 void vo_setwindow( Window w,GC g ) { |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1501
diff
changeset
|
356 vo_window=w; vo_gc=g; |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1501
diff
changeset
|
357 vo_xeventhandling=0; |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1501
diff
changeset
|
358 } |
1746 | 359 void vo_setwindowsize( int w,int h ) { |
360 vo_dwidth=w; vo_dheight=h; | |
361 } | |
723 | 362 #endif |
363 | |
32 | 364 int vo_x11_check_events(Display *mydisplay){ |
365 int ret=0; | |
366 XEvent Event; | |
367 char buf[100]; | |
368 KeySym keySym; | |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J«ärgen Keil <jk@tools.de>
arpi_esp
parents:
922
diff
changeset
|
369 static XComposeStatus stat; |
32 | 370 // unsigned long vo_KeyTable[512]; |
371 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1501
diff
changeset
|
372 #ifdef HAVE_NEW_GUI |
723 | 373 if ( vo_xeventhandling ) |
374 { | |
375 #endif | |
376 while ( XPending( mydisplay ) ) | |
377 { | |
378 XNextEvent( mydisplay,&Event ); | |
379 switch( Event.type ) | |
380 { | |
381 case Expose: | |
382 ret|=VO_EVENT_EXPOSE; | |
383 break; | |
384 case ConfigureNotify: | |
385 vo_dwidth=Event.xconfigure.width; | |
386 vo_dheight=Event.xconfigure.height; | |
387 ret|=VO_EVENT_RESIZE; | |
388 break; | |
389 case KeyPress: | |
390 XLookupString( &Event.xkey,buf,sizeof(buf),&keySym,&stat ); | |
391 vo_x11_putkey( ( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) ) ); | |
392 ret|=VO_EVENT_KEYPRESS; | |
393 break; | |
394 } | |
395 } | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1501
diff
changeset
|
396 #ifdef HAVE_NEW_GUI |
32 | 397 } |
723 | 398 else |
399 { | |
400 if ( vo_resize ) | |
401 { | |
402 vo_resize=0; | |
403 ret|=VO_EVENT_RESIZE; | |
404 } | |
405 if ( vo_expose ) | |
406 { | |
407 vo_expose=0; | |
408 ret|=VO_EVENT_EXPOSE; | |
409 } | |
410 } | |
411 #endif | |
32 | 412 |
413 return ret; | |
414 } | |
415 | |
324 | 416 void saver_on(Display *mDisplay) { |
417 | |
1345
be674b95b485
x11_common does not compile, when the XDPMS extension is not available on the
jkeil
parents:
1266
diff
changeset
|
418 #ifdef HAVE_XDPMS |
324 | 419 int nothing; |
420 if (dpms_disabled) | |
421 { | |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
422 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
|
423 { |
741 | 424 if (!DPMSEnable(mDisplay)) { // restoring power saving settings |
425 printf("DPMS not available?\n"); | |
426 } else { | |
427 // DPMS does not seem to be enabled unless we call DPMSInfo | |
428 BOOL onoff; | |
429 CARD16 state; | |
430 DPMSInfo(mDisplay, &state, &onoff); | |
431 if (onoff) { | |
432 printf ("Successfully enabled DPMS\n"); | |
433 } else { | |
434 printf ("Could not enable DPMS\n"); | |
435 } | |
436 } | |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
437 } |
324 | 438 } |
1345
be674b95b485
x11_common does not compile, when the XDPMS extension is not available on the
jkeil
parents:
1266
diff
changeset
|
439 #endif |
be674b95b485
x11_common does not compile, when the XDPMS extension is not available on the
jkeil
parents:
1266
diff
changeset
|
440 |
324 | 441 if (timeout_save) |
442 { | |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
443 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
|
444 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
|
445 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
|
446 XGetScreenSaver(mDisplay, &timeout_save, &interval, &prefer_blank, &allow_exp); |
324 | 447 } |
448 | |
449 } | |
450 | |
451 void saver_off(Display *mDisplay) { | |
452 | |
1345
be674b95b485
x11_common does not compile, when the XDPMS extension is not available on the
jkeil
parents:
1266
diff
changeset
|
453 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
|
454 #ifdef HAVE_XDPMS |
be674b95b485
x11_common does not compile, when the XDPMS extension is not available on the
jkeil
parents:
1266
diff
changeset
|
455 int nothing; |
324 | 456 |
457 if (DPMSQueryExtension(mDisplay, ¬hing, ¬hing)) | |
458 { | |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
459 BOOL onoff; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
460 CARD16 state; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
461 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
|
462 if (onoff) |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
463 { |
741 | 464 Status stat; |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
465 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
|
466 dpms_disabled=1; |
741 | 467 stat = DPMSDisable(mDisplay); // monitor powersave off |
468 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
|
469 } |
324 | 470 } |
1345
be674b95b485
x11_common does not compile, when the XDPMS extension is not available on the
jkeil
parents:
1266
diff
changeset
|
471 #endif |
324 | 472 XGetScreenSaver(mDisplay, &timeout_save, &interval, &prefer_blank, &allow_exp); |
473 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
|
474 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
|
475 // turning off screensaver |
326 | 476 } |
448
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
440
diff
changeset
|
477 |
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
440
diff
changeset
|
478 #endif |