Mercurial > mplayer.hg
annotate libvo/x11_common.c @ 4980:0e6e50c02f7b
direct rendering support
author | arpi |
---|---|
date | Thu, 07 Mar 2002 16:57:40 +0000 |
parents | 7b65a4f0b74e |
children | bfc652fc7f43 |
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 |
4425
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
28 #ifdef HAVE_XF86VM |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
29 #include <X11/extensions/xf86vmode.h> |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
30 #endif |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
31 |
4658 | 32 #ifdef HAVE_NEW_INPUT |
33 #include "../input/input.h" | |
34 #include "../input/mouse.h" | |
35 #endif | |
36 | |
4798 | 37 #ifdef HAVE_NEW_GUI |
38 #include "../Gui/interface.h" | |
39 #endif | |
40 | |
1732 | 41 /* |
42 * If SCAN_VISUALS is defined, vo_init() scans all available TrueColor | |
43 * visuals for the 'best' visual for MPlayer video display. Note that | |
44 * the 'best' visual might be different from the default visual that | |
45 * is in use on the root window of the display/screen. | |
46 */ | |
47 #define SCAN_VISUALS | |
48 | |
49 | |
4812 | 50 extern int verbose; |
1456
8c57a5a3c645
printfs cleanup - moved to higher -v level or moved to stderr
arpi
parents:
1447
diff
changeset
|
51 |
324 | 52 static int dpms_disabled=0; |
53 static int timeout_save=0; | |
54 | |
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* 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
|
56 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
|
57 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
|
58 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
|
59 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
|
60 |
3830 | 61 /* output window id */ |
62 int WinID=-1; | |
384 | 63 |
4017 | 64 #ifdef HAVE_XINERAMA |
65 int xinerama_screen = 0; | |
66 int xinerama_x = 0; | |
67 int xinerama_y = 0; | |
68 #endif | |
4425
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
69 #ifdef HAVE_XF86VM |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
70 XF86VidModeModeInfo **vidmodes=NULL; |
4977
7b65a4f0b74e
vm pecs applied from daniel carter <hedonist@win.co.nz>
pontscho
parents:
4974
diff
changeset
|
71 XF86VidModeModeLine modeline; |
4425
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
72 #endif |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
73 |
384 | 74 void vo_hidecursor ( Display *disp , Window win ) |
75 { | |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
76 Cursor no_ptr; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
77 Pixmap bm_no; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
78 XColor black,dummy; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
79 Colormap colormap; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
80 static unsigned char bm_no_data[] = { 0,0,0,0, 0,0,0,0 }; |
3954 | 81 |
82 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
|
83 |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
84 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
|
85 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
|
86 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
|
87 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
|
88 XDefineCursor(disp,win,no_ptr); |
384 | 89 } |
90 | |
91 | |
1732 | 92 #ifdef SCAN_VISUALS |
93 /* | |
94 * Scan the available visuals on this Display/Screen. Try to find | |
95 * the 'best' available TrueColor visual that has a decent color | |
96 * depth (at least 15bit). If there are multiple visuals with depth | |
97 * >= 15bit, we prefer visuals with a smaller color depth. | |
98 */ | |
99 int vo_find_depth_from_visuals(Display *dpy, int screen, Visual **visual_return) | |
100 { | |
101 XVisualInfo visual_tmpl; | |
102 XVisualInfo *visuals; | |
103 int nvisuals, i; | |
104 int bestvisual = -1; | |
105 int bestvisual_depth = -1; | |
106 | |
107 visual_tmpl.screen = screen; | |
108 visual_tmpl.class = TrueColor; | |
109 visuals = XGetVisualInfo(dpy, | |
110 VisualScreenMask | VisualClassMask, &visual_tmpl, | |
111 &nvisuals); | |
112 if (visuals != NULL) { | |
113 for (i = 0; i < nvisuals; i++) { | |
114 if (verbose) | |
115 printf("vo: X11 truecolor visual %#x, depth %d, R:%lX G:%lX B:%lX\n", | |
116 visuals[i].visualid, visuals[i].depth, | |
117 visuals[i].red_mask, visuals[i].green_mask, | |
118 visuals[i].blue_mask); | |
119 /* | |
120 * save the visual index and it's depth, if this is the first | |
121 * truecolor visul, or a visual that is 'preferred' over the | |
122 * previous 'best' visual | |
123 */ | |
124 if (bestvisual_depth == -1 | |
125 || (visuals[i].depth >= 15 | |
126 && ( visuals[i].depth < bestvisual_depth | |
127 || bestvisual_depth < 15))) { | |
128 bestvisual = i; | |
129 bestvisual_depth = visuals[i].depth; | |
130 } | |
131 } | |
132 | |
133 if (bestvisual != -1 && visual_return != NULL) | |
134 *visual_return = visuals[bestvisual].visual; | |
135 | |
136 XFree(visuals); | |
137 } | |
138 return bestvisual_depth; | |
139 } | |
140 #endif | |
141 | |
4742 | 142 static void x11_errorhandler(Display *display, XErrorEvent *event) |
143 { | |
144 #define MSGLEN 60 | |
145 char msg[MSGLEN]; | |
146 | |
4812 | 147 XGetErrorText(display, event->error_code, (char *)&msg, MSGLEN); |
4742 | 148 |
149 printf("X11 error: %s\n", msg); | |
150 | |
151 if (verbose) | |
152 { | |
153 printf("Type: %x, display: %x, resourceid: %x, serial: %x\n", | |
154 event->type, event->display, event->resourceid, event->serial); | |
155 printf("Error code: %x, request code: %x, minor code: %x\n", | |
156 event->error_code, event->request_code, event->minor_code); | |
157 } | |
158 | |
159 exit_player("X11 error"); | |
160 #undef MSGLEN | |
161 } | |
1732 | 162 |
32 | 163 int vo_init( void ) |
164 { | |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
165 // int mScreen; |
1732 | 166 int depth, bpp; |
1137
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
167 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
|
168 // 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
|
169 // Display * mDisplay; |
1732 | 170 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
|
171 // Window mRootWin; |
1732 | 172 XWindowAttributes attribs; |
4815
178b524e5213
Bugfix in x11_common.c mainly. Don't screw up the display name,
albeu
parents:
4812
diff
changeset
|
173 char* dispName; |
32 | 174 |
175 if(vo_depthonscreen) return 1; // already called | |
176 | |
4812 | 177 XSetErrorHandler(x11_errorhandler); |
178 | |
179 #if 0 | |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
180 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
|
181 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
|
182 mDisplayName=strdup(":0.0"); |
4812 | 183 #else |
4815
178b524e5213
Bugfix in x11_common.c mainly. Don't screw up the display name,
albeu
parents:
4812
diff
changeset
|
184 dispName = XDisplayName(mDisplayName); |
4812 | 185 #endif |
186 | |
187 if (verbose) | |
4815
178b524e5213
Bugfix in x11_common.c mainly. Don't screw up the display name,
albeu
parents:
4812
diff
changeset
|
188 printf("X11 opening display: %s\n", dispName); |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
189 |
4815
178b524e5213
Bugfix in x11_common.c mainly. Don't screw up the display name,
albeu
parents:
4812
diff
changeset
|
190 mDisplay=XOpenDisplay(dispName); |
32 | 191 if ( !mDisplay ) |
192 { | |
4815
178b524e5213
Bugfix in x11_common.c mainly. Don't screw up the display name,
albeu
parents:
4812
diff
changeset
|
193 printf( "vo: couldn't open the X11 display (%s)!\n",dispName ); |
32 | 194 return 0; |
195 } | |
196 mScreen=DefaultScreen( mDisplay ); // Screen ID. | |
197 mRootWin=RootWindow( mDisplay,mScreen );// Root window ID. | |
2149
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
198 |
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
199 #ifdef HAVE_XINERAMA |
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
200 if(XineramaIsActive(mDisplay)) |
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
201 { |
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
202 XineramaScreenInfo *screens; |
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
203 int num_screens; |
3990 | 204 |
2149
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
205 screens = XineramaQueryScreens(mDisplay, &num_screens); |
4017 | 206 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
|
207 if (! vo_screenwidth) |
4017 | 208 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
|
209 if (! vo_screenheight) |
4017 | 210 vo_screenheight=screens[xinerama_screen].height; |
211 xinerama_x = screens[xinerama_screen].x_org; | |
212 xinerama_y = screens[xinerama_screen].y_org; | |
213 | |
3990 | 214 XFree(screens); |
2149
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
215 } |
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
216 else |
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
217 #endif |
4977
7b65a4f0b74e
vm pecs applied from daniel carter <hedonist@win.co.nz>
pontscho
parents:
4974
diff
changeset
|
218 #ifdef HAVE_XF86VM |
7b65a4f0b74e
vm pecs applied from daniel carter <hedonist@win.co.nz>
pontscho
parents:
4974
diff
changeset
|
219 { |
7b65a4f0b74e
vm pecs applied from daniel carter <hedonist@win.co.nz>
pontscho
parents:
4974
diff
changeset
|
220 int clock; |
7b65a4f0b74e
vm pecs applied from daniel carter <hedonist@win.co.nz>
pontscho
parents:
4974
diff
changeset
|
221 XF86VidModeGetModeLine( mDisplay,mScreen,&clock ,&modeline ); |
7b65a4f0b74e
vm pecs applied from daniel carter <hedonist@win.co.nz>
pontscho
parents:
4974
diff
changeset
|
222 if ( !vo_screenwidth ) vo_screenwidth=modeline.hdisplay; |
7b65a4f0b74e
vm pecs applied from daniel carter <hedonist@win.co.nz>
pontscho
parents:
4974
diff
changeset
|
223 if ( !vo_screenheight ) vo_screenheight=modeline.vdisplay; |
7b65a4f0b74e
vm pecs applied from daniel carter <hedonist@win.co.nz>
pontscho
parents:
4974
diff
changeset
|
224 } |
7b65a4f0b74e
vm pecs applied from daniel carter <hedonist@win.co.nz>
pontscho
parents:
4974
diff
changeset
|
225 #endif |
2149
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
226 { |
2364 | 227 if (! vo_screenwidth) |
228 vo_screenwidth=DisplayWidth( mDisplay,mScreen ); | |
229 if (! vo_screenheight) | |
230 vo_screenheight=DisplayHeight( mDisplay,mScreen ); | |
2149
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
231 } |
1732 | 232 // get color depth (from root window, or the best visual): |
32 | 233 XGetWindowAttributes(mDisplay, mRootWin, &attribs); |
1732 | 234 depth=attribs.depth; |
235 | |
236 #ifdef SCAN_VISUALS | |
237 if (depth != 15 && depth != 16 && depth != 24 && depth != 32) { | |
238 Visual *visual; | |
239 | |
240 depth = vo_find_depth_from_visuals(mDisplay, mScreen, &visual); | |
241 if (depth != -1) | |
242 mXImage=XCreateImage(mDisplay, visual, depth, ZPixmap, | |
243 0, NULL, 1, 1, 8, 1); | |
244 } else | |
245 #endif | |
246 mXImage=XGetImage( mDisplay,mRootWin,0,0,1,1,AllPlanes,ZPixmap ); | |
247 | |
248 vo_depthonscreen = depth; // display depth on screen | |
249 | |
250 // get bits/pixel from XImage structure: | |
251 if (mXImage == NULL) { | |
252 mask = 0; | |
253 } else { | |
254 /* | |
255 * for the depth==24 case, the XImage structures might use | |
256 * 24 or 32 bits of data per pixel. The global variable | |
257 * vo_depthonscreen stores the amount of data per pixel in the | |
258 * XImage structure! | |
259 * | |
260 * Maybe we should rename vo_depthonscreen to (or add) vo_bpp? | |
261 */ | |
32 | 262 bpp=mXImage->bits_per_pixel; |
1137
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
263 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
|
264 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
|
265 if(verbose) |
1732 | 266 printf("vo: X11 color mask: %X (R:%lX G:%lX B:%lX)\n", |
267 mask,mXImage->red_mask,mXImage->green_mask,mXImage->blue_mask); | |
4181 | 268 XDestroyImage( mXImage ); |
1732 | 269 } |
270 if(((vo_depthonscreen+7)/8)==2){ | |
271 if(mask==0x7FFF) vo_depthonscreen=15; else | |
272 if(mask==0xFFFF) vo_depthonscreen=16; | |
273 } | |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
274 // XCloseDisplay( mDisplay ); |
1447
e82fbd67ae60
better local display connection patch by Adam Tla/lka atlka@pg.gda.pl
arpi
parents:
1415
diff
changeset
|
275 /* slightly improved local display detection AST */ |
4815
178b524e5213
Bugfix in x11_common.c mainly. Don't screw up the display name,
albeu
parents:
4812
diff
changeset
|
276 if ( strncmp(dispName, "unix:", 5) == 0) |
178b524e5213
Bugfix in x11_common.c mainly. Don't screw up the display name,
albeu
parents:
4812
diff
changeset
|
277 dispName += 4; |
178b524e5213
Bugfix in x11_common.c mainly. Don't screw up the display name,
albeu
parents:
4812
diff
changeset
|
278 else if ( strncmp(dispName, "localhost:", 10) == 0) |
178b524e5213
Bugfix in x11_common.c mainly. Don't screw up the display name,
albeu
parents:
4812
diff
changeset
|
279 dispName += 9; |
178b524e5213
Bugfix in x11_common.c mainly. Don't screw up the display name,
albeu
parents:
4812
diff
changeset
|
280 if (*dispName==':') mLocalDisplay=1; else mLocalDisplay=0; |
1732 | 281 printf("vo: X11 running at %dx%d with depth %d and %d bits/pixel (\"%s\" => %s display)\n", |
282 vo_screenwidth,vo_screenheight, | |
283 depth, vo_depthonscreen, | |
4815
178b524e5213
Bugfix in x11_common.c mainly. Don't screw up the display name,
albeu
parents:
4812
diff
changeset
|
284 dispName,mLocalDisplay?"local":"remote"); |
4742 | 285 |
32 | 286 return 1; |
287 } | |
288 | |
4436 | 289 |
32 | 290 #include "../linux/keycodes.h" |
291 #include "wskeys.h" | |
292 | |
293 extern void mplayer_put_key(int code); | |
294 | |
295 void vo_x11_putkey(int key){ | |
296 switch ( key ) | |
297 { | |
298 case wsLeft: mplayer_put_key(KEY_LEFT); break; | |
299 case wsRight: mplayer_put_key(KEY_RIGHT); break; | |
300 case wsUp: mplayer_put_key(KEY_UP); break; | |
301 case wsDown: mplayer_put_key(KEY_DOWN); break; | |
302 case wsSpace: mplayer_put_key(' '); break; | |
303 case wsEscape: mplayer_put_key(KEY_ESC); break; | |
304 case wsEnter: mplayer_put_key(KEY_ENTER); break; | |
651 | 305 case wsPageUp: mplayer_put_key(KEY_PAGE_UP); break; |
306 case wsPageDown: mplayer_put_key(KEY_PAGE_DOWN); break; | |
32 | 307 case wsq: |
308 case wsQ: mplayer_put_key('q'); break; | |
309 case wsp: | |
310 case wsP: mplayer_put_key('p'); break; | |
311 case wsMinus: | |
312 case wsGrayMinus: mplayer_put_key('-'); break; | |
313 case wsPlus: | |
314 case wsGrayPlus: mplayer_put_key('+'); break; | |
464 | 315 case wsGrayMul: |
316 case wsMul: mplayer_put_key('*'); break; | |
317 case wsGrayDiv: | |
318 case wsDiv: mplayer_put_key('/'); break; | |
3490 | 319 case wsLess: mplayer_put_key('<'); break; |
320 case wsMore: mplayer_put_key('>'); break; | |
516 | 321 case wsm: |
322 case wsM: mplayer_put_key('m'); break; | |
655 | 323 case wso: |
324 case wsO: mplayer_put_key('o'); break; | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1456
diff
changeset
|
325 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
|
326 (key>='0' && key<='9')) mplayer_put_key(key); |
32 | 327 } |
369 | 328 |
32 | 329 } |
330 | |
331 | |
332 // ----- Motif header: ------- | |
333 | |
1236 | 334 #define MWM_HINTS_FUNCTIONS (1L << 0) |
335 #define MWM_HINTS_DECORATIONS (1L << 1) | |
336 #define MWM_HINTS_INPUT_MODE (1L << 2) | |
337 #define MWM_HINTS_STATUS (1L << 3) | |
338 | |
339 #define MWM_FUNC_ALL (1L << 0) | |
340 #define MWM_FUNC_RESIZE (1L << 1) | |
341 #define MWM_FUNC_MOVE (1L << 2) | |
342 #define MWM_FUNC_MINIMIZE (1L << 3) | |
343 #define MWM_FUNC_MAXIMIZE (1L << 4) | |
344 #define MWM_FUNC_CLOSE (1L << 5) | |
345 | |
346 #define MWM_DECOR_ALL (1L << 0) | |
347 #define MWM_DECOR_BORDER (1L << 1) | |
348 #define MWM_DECOR_RESIZEH (1L << 2) | |
349 #define MWM_DECOR_TITLE (1L << 3) | |
350 #define MWM_DECOR_MENU (1L << 4) | |
351 #define MWM_DECOR_MINIMIZE (1L << 5) | |
352 #define MWM_DECOR_MAXIMIZE (1L << 6) | |
353 | |
354 #define MWM_INPUT_MODELESS 0 | |
355 #define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1 | |
356 #define MWM_INPUT_SYSTEM_MODAL 2 | |
357 #define MWM_INPUT_FULL_APPLICATION_MODAL 3 | |
358 #define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL | |
359 | |
360 #define MWM_TEAROFF_WINDOW (1L<<0) | |
32 | 361 |
362 typedef struct | |
363 { | |
364 long flags; | |
365 long functions; | |
366 long decorations; | |
367 long input_mode; | |
1236 | 368 long state; |
32 | 369 } MotifWmHints; |
370 | |
371 extern MotifWmHints vo_MotifWmHints; | |
372 extern Atom vo_MotifHints; | |
373 extern int vo_depthonscreen; | |
374 extern int vo_screenwidth; | |
375 extern int vo_screenheight; | |
376 | |
377 static MotifWmHints vo_MotifWmHints; | |
378 static Atom vo_MotifHints = None; | |
379 | |
1266 | 380 // Note: always d==0 ! |
32 | 381 void vo_x11_decoration( Display * vo_Display,Window w,int d ) |
382 { | |
1266 | 383 |
384 if(vo_fsmode&1){ | |
385 XSetWindowAttributes attr; | |
386 attr.override_redirect = True; | |
387 XChangeWindowAttributes(vo_Display, w, CWOverrideRedirect, &attr); | |
4437 | 388 // XMapWindow(vo_Display, w); |
1266 | 389 } |
390 | |
1415 | 391 if(vo_fsmode&8){ |
392 XSetTransientForHint (vo_Display, w, RootWindow(vo_Display,mScreen)); | |
393 } | |
394 | |
32 | 395 vo_MotifHints=XInternAtom( vo_Display,"_MOTIF_WM_HINTS",0 ); |
396 if ( vo_MotifHints != None ) | |
397 { | |
1236 | 398 memset( &vo_MotifWmHints,0,sizeof( MotifWmHints ) ); |
399 vo_MotifWmHints.flags=MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS; | |
400 vo_MotifWmHints.functions=MWM_FUNC_MOVE | MWM_FUNC_CLOSE | MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE; | |
401 if ( d ) d=MWM_DECOR_ALL; | |
1266 | 402 vo_MotifWmHints.decorations=d|((vo_fsmode&2)?0:MWM_DECOR_MENU); |
32 | 403 XChangeProperty( vo_Display,w,vo_MotifHints,vo_MotifHints,32, |
1266 | 404 PropModeReplace,(unsigned char *)&vo_MotifWmHints,(vo_fsmode&4)?4:5 ); |
32 | 405 } |
406 } | |
407 | |
1137
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
408 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
|
409 XClassHint wmClass; |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
410 wmClass.res_name = name; |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
411 wmClass.res_class = "MPlayer"; |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
412 XSetClassHint(display,window,&wmClass); |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
413 } |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
414 |
4795 | 415 Window vo_window = None; |
416 GC vo_gc; | |
417 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1501
diff
changeset
|
418 #ifdef HAVE_NEW_GUI |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1501
diff
changeset
|
419 void vo_setwindow( Window w,GC g ) { |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1501
diff
changeset
|
420 vo_window=w; vo_gc=g; |
1746 | 421 } |
723 | 422 #endif |
423 | |
4437 | 424 int vo_x11_uninit(Display *display, Window window) |
425 { | |
4742 | 426 XSetErrorHandler(NULL); |
427 | |
4437 | 428 #ifdef HAVE_NEW_GUI |
429 /* destroy window only if it's not controlled by GUI */ | |
430 if (vo_window == None) | |
431 #endif | |
432 { | |
433 /* and -wid is set */ | |
434 if (!(WinID > 0)) | |
435 XDestroyWindow(display, window); | |
4438
e01ee848935f
grr, 10l. vo_x11_uninit: close display only if window not created by GUI
alex
parents:
4437
diff
changeset
|
436 XCloseDisplay(display); |
4815
178b524e5213
Bugfix in x11_common.c mainly. Don't screw up the display name,
albeu
parents:
4812
diff
changeset
|
437 vo_depthonscreen = 0; |
4437 | 438 } |
439 return(1); | |
440 } | |
441 | |
32 | 442 int vo_x11_check_events(Display *mydisplay){ |
443 int ret=0; | |
444 XEvent Event; | |
445 char buf[100]; | |
446 KeySym keySym; | |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by Jrgen Keil <jk@tools.de>
arpi_esp
parents:
922
diff
changeset
|
447 static XComposeStatus stat; |
32 | 448 // unsigned long vo_KeyTable[512]; |
449 | |
4795 | 450 while ( XPending( mydisplay ) ) |
451 { | |
452 XNextEvent( mydisplay,&Event ); | |
4798 | 453 #ifdef HAVE_NEW_GUI |
454 if ( use_gui ) guiGetEvent( 0,(char*)&Event ); | |
455 #endif | |
4795 | 456 if ( vo_window == Event.xany.window ) |
457 switch( Event.type ) | |
458 { | |
459 case Expose: | |
460 ret|=VO_EVENT_EXPOSE; | |
461 break; | |
462 case ConfigureNotify: | |
463 vo_dwidth=Event.xconfigure.width; | |
464 vo_dheight=Event.xconfigure.height; | |
4812 | 465 #if 0 |
466 /* when resizing, x and y are zero :( */ | |
467 vo_dx=Event.xconfigure.x; | |
468 vo_dy=Event.xconfigure.y; | |
469 #else | |
470 { | |
471 Window root; | |
472 int foo; | |
473 XGetGeometry(mydisplay, vo_window, &root, &foo, &foo, | |
474 &foo/*width*/, &foo/*height*/, &foo, &foo); | |
475 XTranslateCoordinates(mydisplay, vo_window, root, 0, 0, | |
476 &vo_dx, &vo_dy, (Window *)&foo); | |
477 } | |
478 #endif | |
479 if (verbose) | |
480 printf("X11 Window %dx%d-%dx%d\n", vo_dx, vo_dy, vo_dwidth, vo_dheight); | |
4795 | 481 ret|=VO_EVENT_RESIZE; |
482 break; | |
483 case KeyPress: | |
4974 | 484 { |
485 int key; | |
486 XLookupString( &Event.xkey,buf,sizeof(buf),&keySym,&stat ); | |
487 key=( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) ); | |
488 #ifdef HAVE_NEW_GUI | |
489 if ( ( use_gui )&&( key == wsEnter ) ) break; | |
490 #endif | |
491 vo_x11_putkey( key ); | |
492 ret|=VO_EVENT_KEYPRESS; | |
493 } | |
4795 | 494 break; |
4658 | 495 #ifdef HAVE_NEW_INPUT |
4795 | 496 case ButtonPress: |
497 // Ignore mouse whell press event | |
498 if(Event.xbutton.button == 4 || Event.xbutton.button == 5) | |
499 break; | |
500 mplayer_put_key((MOUSE_BTN0+Event.xbutton.button-1)|MP_KEY_DOWN); | |
501 break; | |
502 case ButtonRelease: | |
503 mplayer_put_key(MOUSE_BTN0+Event.xbutton.button-1); | |
504 break; | |
4658 | 505 #endif |
723 | 506 } |
4795 | 507 } |
32 | 508 |
509 return ret; | |
510 } | |
511 | |
324 | 512 void saver_on(Display *mDisplay) { |
513 | |
1345
be674b95b485
x11_common does not compile, when the XDPMS extension is not available on the
jkeil
parents:
1266
diff
changeset
|
514 #ifdef HAVE_XDPMS |
324 | 515 int nothing; |
516 if (dpms_disabled) | |
517 { | |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
518 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
|
519 { |
741 | 520 if (!DPMSEnable(mDisplay)) { // restoring power saving settings |
521 printf("DPMS not available?\n"); | |
522 } else { | |
523 // DPMS does not seem to be enabled unless we call DPMSInfo | |
524 BOOL onoff; | |
525 CARD16 state; | |
526 DPMSInfo(mDisplay, &state, &onoff); | |
527 if (onoff) { | |
528 printf ("Successfully enabled DPMS\n"); | |
529 } else { | |
530 printf ("Could not enable DPMS\n"); | |
531 } | |
532 } | |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
533 } |
324 | 534 } |
1345
be674b95b485
x11_common does not compile, when the XDPMS extension is not available on the
jkeil
parents:
1266
diff
changeset
|
535 #endif |
be674b95b485
x11_common does not compile, when the XDPMS extension is not available on the
jkeil
parents:
1266
diff
changeset
|
536 |
324 | 537 if (timeout_save) |
538 { | |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
539 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
|
540 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
|
541 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
|
542 XGetScreenSaver(mDisplay, &timeout_save, &interval, &prefer_blank, &allow_exp); |
324 | 543 } |
544 | |
545 } | |
546 | |
547 void saver_off(Display *mDisplay) { | |
548 | |
1345
be674b95b485
x11_common does not compile, when the XDPMS extension is not available on the
jkeil
parents:
1266
diff
changeset
|
549 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
|
550 #ifdef HAVE_XDPMS |
be674b95b485
x11_common does not compile, when the XDPMS extension is not available on the
jkeil
parents:
1266
diff
changeset
|
551 int nothing; |
324 | 552 |
553 if (DPMSQueryExtension(mDisplay, ¬hing, ¬hing)) | |
554 { | |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
555 BOOL onoff; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
556 CARD16 state; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
557 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
|
558 if (onoff) |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
559 { |
741 | 560 Status stat; |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
456
diff
changeset
|
561 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
|
562 dpms_disabled=1; |
741 | 563 stat = DPMSDisable(mDisplay); // monitor powersave off |
564 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
|
565 } |
324 | 566 } |
1345
be674b95b485
x11_common does not compile, when the XDPMS extension is not available on the
jkeil
parents:
1266
diff
changeset
|
567 #endif |
324 | 568 XGetScreenSaver(mDisplay, &timeout_save, &interval, &prefer_blank, &allow_exp); |
569 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
|
570 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
|
571 // turning off screensaver |
326 | 572 } |
448
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
440
diff
changeset
|
573 |
3990 | 574 |
575 | |
576 #ifdef HAVE_XINERAMA | |
577 void vo_x11_xinerama_move(Display *dsp, Window w) | |
578 { | |
579 if(XineramaIsActive(dsp)) | |
580 { | |
4017 | 581 /* printf("XXXX Xinerama screen: x: %hd y: %hd\n",xinerama_x,xinerama_y); */ |
582 XMoveWindow(dsp,w,xinerama_x,xinerama_y); | |
3990 | 583 } |
584 } | |
448
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
440
diff
changeset
|
585 #endif |
3990 | 586 |
4425
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
587 #ifdef HAVE_XF86VM |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
588 void vo_vm_switch(uint32_t X, uint32_t Y, int* modeline_width, int* modeline_height) |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
589 { |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
590 unsigned int vm_event, vm_error; |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
591 unsigned int vm_ver, vm_rev; |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
592 int i,j,have_vm=0; |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
593 |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
594 int modecount; |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
595 |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
596 if (XF86VidModeQueryExtension(mDisplay, &vm_event, &vm_error)) { |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
597 XF86VidModeQueryVersion(mDisplay, &vm_ver, &vm_rev); |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
598 printf("XF86VidMode Extension v%i.%i\n", vm_ver, vm_rev); |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
599 have_vm=1; |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
600 } else |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
601 printf("XF86VidMode Extenstion not available.\n"); |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
602 |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
603 if (have_vm) { |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
604 if (vidmodes==NULL) |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
605 XF86VidModeGetAllModeLines(mDisplay,mScreen,&modecount,&vidmodes); |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
606 j=0; |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
607 *modeline_width=vidmodes[0]->hdisplay; |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
608 *modeline_height=vidmodes[0]->vdisplay; |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
609 |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
610 for (i=1; i<modecount; i++) |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
611 if ((vidmodes[i]->hdisplay >= X) && (vidmodes[i]->vdisplay >= Y)) |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
612 if ( (vidmodes[i]->hdisplay < *modeline_width ) && (vidmodes[i]->vdisplay < *modeline_height) ) |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
613 { |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
614 *modeline_width=vidmodes[i]->hdisplay; |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
615 *modeline_height=vidmodes[i]->vdisplay; |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
616 j=i; |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
617 } |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
618 |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
619 printf("XF86VM: Selected video mode %dx%d for image size %dx%d.\n",*modeline_width, *modeline_height, X, Y); |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
620 XF86VidModeLockModeSwitch(mDisplay,mScreen,0); |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
621 XF86VidModeSwitchToMode(mDisplay,mScreen,vidmodes[j]); |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
622 XF86VidModeSwitchToMode(mDisplay,mScreen,vidmodes[j]); |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
623 X=(vo_screenwidth-*modeline_width)/2; |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
624 Y=(vo_screenheight-*modeline_height)/2; |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
625 XF86VidModeSetViewPort(mDisplay,mScreen,X,Y); |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
626 } |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
627 } |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
628 |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
629 void vo_vm_close(Display *dpy) |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
630 { |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
631 #ifdef HAVE_NEW_GUI |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
632 if ((vidmodes!=NULL)&&( vo_window == None ) ) |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
633 #else |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
634 if (vidmodes!=NULL) |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
635 #endif |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
636 { |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
637 int screen; screen=DefaultScreen( dpy ); |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
638 XF86VidModeSwitchToMode(dpy,screen,vidmodes[0]); |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
639 XF86VidModeSwitchToMode(dpy,screen,vidmodes[0]); |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
640 free(vidmodes); |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
641 } |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
642 } |
3990 | 643 #endif |
4425
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
644 |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
645 #endif |