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