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