annotate libvo/vo_xmga.c @ 17576:ed90229407c6

ALSA changes
author cladisch
date Fri, 10 Feb 2006 10:28:20 +0000
parents fd51fd1ff231
children d75953576ae4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
100
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
1
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
2 //#define SHOW_TIME
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
3
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
4 /*
7680
d60cfb1f8b37 more cleanup, some -vo mga fullscreen fixes
arpi
parents: 7679
diff changeset
5 * vo_xmga.c
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 * Copyright (C) Zoltan Ponekker - Jan 2001
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 #include <stdio.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 #include <stdlib.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 #include <string.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 #include "config.h"
6296
74115095d9fe msg/i18n fixes and some printf->mp_msg
arpi
parents: 6095
diff changeset
16
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 #include "video_out.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 #include "video_out_internal.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21 #include <sys/ioctl.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 #include <unistd.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23 #include <fcntl.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 #include <sys/mman.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26 #include "drivers/mga_vid.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 #include <X11/Xlib.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29 #include <X11/Xutil.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30 #include <errno.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31
4017
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
32 #ifdef HAVE_XINERAMA
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
33 #include <X11/extensions/Xinerama.h>
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
34 #endif
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
35
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
36 #include "x11_common.h"
616
41d6eec69b60 clean up
pontscho
parents: 614
diff changeset
37 #include "sub.h"
2057
378aed6b232d Use aspect()
atmos4
parents: 2039
diff changeset
38 #include "aspect.h"
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
39
182
80a7b40f201a *** empty log message ***
pontscho
parents: 120
diff changeset
40 #ifdef SHOW_TIME
13787
e047e70a9767 Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents: 13056
diff changeset
41 #include "osdep/timer.h"
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
42 static unsigned int timer = 0;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
43 static unsigned int timerd = 0;
100
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
44 #endif
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
45
5955
caac20b1ca79 fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents: 5945
diff changeset
46 #ifdef HAVE_NEW_GUI
13787
e047e70a9767 Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents: 13056
diff changeset
47 #include "Gui/interface.h"
5955
caac20b1ca79 fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents: 5945
diff changeset
48 #endif
caac20b1ca79 fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents: 5945
diff changeset
49
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
50 static vo_info_t info = {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
51 "Matrox G200/G4x0/G550 overlay in X11 window (using /dev/mga_vid)",
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
52 "xmga",
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
53 "Zoltan Ponekker <pontscho@makacs.poliod.hu>",
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
54 ""
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
57 LIBVO_EXTERN(xmga)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
58 static XGCValues wGCV;
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 8017
diff changeset
59
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
60 static uint32_t mDepth;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
61 static XWindowAttributes attribs;
10988
c2bff70784d5 user settable colorkey
alex
parents: 10729
diff changeset
62 static int colorkey;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
64 static uint32_t mvHeight;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
65 static uint32_t mvWidth;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
67 static Window mRoot;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
69 static XSetWindowAttributes xWAttribs;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
71 static int inited = 0;
6311
da2dda48b7ec add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
pontscho
parents: 6307
diff changeset
72
4981
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4970
diff changeset
73 #define VO_XMGA
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 #include "mga_common.c"
4981
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4970
diff changeset
75 #undef VO_XMGA
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
77 static void mDrawColorKey(void)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78 {
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
79 XSetBackground(mDisplay, vo_gc, 0);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
80 XClearWindow(mDisplay, vo_window);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
81 XSetForeground(mDisplay, vo_gc, colorkey);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
82 XFillRectangle(mDisplay, vo_window, vo_gc, drwX, drwY, drwWidth,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
83 (vo_fs ? drwHeight - 1 : drwHeight));
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
84 XFlush(mDisplay);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
87 static void check_events(void)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88 {
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
89 int e = vo_x11_check_events(mDisplay);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
90
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
91 if (!(e & VO_EVENT_RESIZE) && !(e & VO_EVENT_EXPOSE))
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
92 return;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
93 set_window();
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
94 mDrawColorKey();
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
95 if (ioctl(f, MGA_VID_CONFIG, &mga_vid_config))
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
96 mp_msg(MSGT_VO, MSGL_WARN,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
97 "Error in mga_vid_config ioctl (wrong mga_vid.o version?)");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
98 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
99
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
100 static void flip_page(void)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
101 {
182
80a7b40f201a *** empty log message ***
pontscho
parents: 120
diff changeset
102 #ifdef SHOW_TIME
100
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
103 unsigned int t;
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
104
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
105 t = GetTimer();
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
106 mp_msg(MSGT_VO, MSGL_STATUS,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
107 " [timer: %08X diff: %6d dd: %6d ] \n", t, t - timer,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
108 (t - timer) - timerd);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
109 timerd = t - timer;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
110 timer = t;
182
80a7b40f201a *** empty log message ***
pontscho
parents: 120
diff changeset
111 #endif
100
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
112
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
113 vo_mga_flip_page();
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
114 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
115
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15540
diff changeset
116 static int config(uint32_t width, uint32_t height, uint32_t d_width,
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
117 uint32_t d_height, uint32_t flags, char *title,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
118 uint32_t format)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
119 {
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
120 char *mTitle = (title == NULL) ? "XMGA render" : title;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
121 XVisualInfo vinfo;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
122 unsigned long xswamask;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
123 int r, g, b;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
124
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
125 if (mga_init(width, height, format))
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
126 return -1; // ioctl errors?
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
127
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
128 aspect_save_orig(width, height);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
129 aspect_save_prescale(d_width, d_height);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
130 aspect_save_screenres(vo_screenwidth, vo_screenheight);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
131
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
132 mvWidth = width;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
133 mvHeight = height;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
134
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
135 vo_panscan_x = vo_panscan_y = vo_panscan_amount = 0;
2249
48f0ac1e9d13 Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents: 2057
diff changeset
136
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
137 vo_dx = (vo_screenwidth - d_width) / 2;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
138 vo_dy = (vo_screenheight - d_height) / 2;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
139 geometry(&vo_dx, &vo_dy, &d_width, &d_height, vo_screenwidth,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
140 vo_screenheight);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
141 vo_dwidth = d_width;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
142 vo_dheight = d_height;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
143 vo_mouse_autohide = 1;
6307
72c87b2ec779 added panscan support for xmga/xvidix
pontscho
parents: 6296
diff changeset
144
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
145 r = (vo_colorkey & 0x00ff0000) >> 16;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
146 g = (vo_colorkey & 0x0000ff00) >> 8;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
147 b = vo_colorkey & 0x000000ff;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
148 switch (vo_depthonscreen)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
149 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
150 case 32:
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
151 colorkey = vo_colorkey;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
152 break;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
153 case 24:
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
154 colorkey = vo_colorkey & 0x00ffffff;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
155 break;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
156 case 16:
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
157 colorkey = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
158 break;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
159 case 15:
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
160 colorkey = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
161 break;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
162 default:
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
163 mp_msg(MSGT_VO, MSGL_ERR,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
164 "Sorry, this (%d) color depth not supported.\n",
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
165 vo_depthonscreen);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
166 return -1;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
167 }
13946
e632b43f0598 Reduce excessive verbosity.
diego
parents: 13787
diff changeset
168 mp_msg(MSGT_VO, MSGL_V, "Using colorkey: %x\n", colorkey);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
169
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
170 inited = 1;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
171
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
172 aspect(&d_width, &d_height, A_NOZOOM);
5985
cb393303865d the Right Fix for gui window setup
arpi
parents: 5975
diff changeset
173
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1637
diff changeset
174 #ifdef HAVE_NEW_GUI
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
175 if (use_gui)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
176 guiGetEvent(guiSetShVideo, 0); // the GUI will set up / resize the window
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
177 else
5985
cb393303865d the Right Fix for gui window setup
arpi
parents: 5975
diff changeset
178 #endif
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
179 {
15212
05aa13cdf92f replace VO and VF numeric flags with #defined identifiers
henry
parents: 13946
diff changeset
180 if (flags & VOFLAG_FULLSCREEN)
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
181 aspect(&dwidth, &dheight, A_ZOOM);
723
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
182
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
183 XGetWindowAttributes(mDisplay, mRootWin, &attribs);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
184 mDepth = attribs.depth;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
185 if (mDepth != 15 && mDepth != 16 && mDepth != 24 && mDepth != 32)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
186 mDepth = 24;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
187 XMatchVisualInfo(mDisplay, mScreen, mDepth, TrueColor, &vinfo);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
188 xWAttribs.colormap =
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
189 XCreateColormap(mDisplay, mRootWin, vinfo.visual, AllocNone);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
190 xWAttribs.background_pixel = 0;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
191 xWAttribs.border_pixel = 0;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
192 xWAttribs.event_mask =
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
193 StructureNotifyMask | ExposureMask | KeyPressMask |
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
194 ((WinID ==
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
195 0) ? 0 : (ButtonPressMask | ButtonReleaseMask |
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
196 PointerMotionMask | PropertyChangeMask));
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
197 xswamask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
198
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
199 if (WinID >= 0)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
200 {
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
201
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
202 vo_window = WinID ? ((Window) WinID) : mRootWin;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
203 if (WinID)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
204 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
205 XUnmapWindow(mDisplay, vo_window);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
206 XChangeWindowAttributes(mDisplay, vo_window, xswamask,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
207 &xWAttribs);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
208 vo_x11_selectinput_witherr(mDisplay, vo_window,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
209 StructureNotifyMask |
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
210 KeyPressMask |
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
211 PropertyChangeMask |
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
212 PointerMotionMask |
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
213 ButtonPressMask |
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
214 ButtonReleaseMask |
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
215 ExposureMask);
15540
91d210e8a19c Make -wid behave more consistent.
al
parents: 15212
diff changeset
216 XMapWindow(mDisplay, vo_window);
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
217 } else
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
218 XSelectInput(mDisplay, vo_window, ExposureMask);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
219
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
220 } else
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
221 {
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
222
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
223 if (vo_window == None)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
224 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
225 vo_window = XCreateWindow(mDisplay, mRootWin,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
226 vo_dx, vo_dy,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
227 vo_dwidth, vo_dheight,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
228 xWAttribs.border_pixel,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
229 mDepth,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
230 InputOutput,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
231 vinfo.visual, xswamask,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
232 &xWAttribs);
723
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
233
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
234 vo_x11_classhint(mDisplay, vo_window, "xmga");
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
235 vo_hidecursor(mDisplay, vo_window);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
236 vo_x11_sizehint(vo_dx, vo_dy, vo_dwidth, vo_dheight, 0);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
237
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
238 XStoreName(mDisplay, vo_window, mTitle);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
239 XMapWindow(mDisplay, vo_window);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
240
15212
05aa13cdf92f replace VO and VF numeric flags with #defined identifiers
henry
parents: 13946
diff changeset
241 if (flags & VOFLAG_FULLSCREEN)
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
242 vo_x11_fullscreen();
5999
792d58595767 fix -fs and 'f'
pontscho
parents: 5985
diff changeset
243
3990
87538547c8f4 xinerama fix by attila
atmos4
parents: 3847
diff changeset
244 #ifdef HAVE_XINERAMA
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
245 vo_x11_xinerama_move(mDisplay, vo_window);
3990
87538547c8f4 xinerama fix by attila
atmos4
parents: 3847
diff changeset
246 #endif
15212
05aa13cdf92f replace VO and VF numeric flags with #defined identifiers
henry
parents: 13946
diff changeset
247 } else if (!(flags & VOFLAG_FULLSCREEN))
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
248 XMoveResizeWindow(mDisplay, vo_window, vo_dx, vo_dy,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
249 vo_dwidth, vo_dheight);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
250 }
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
251
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
252 if (vo_gc != None)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
253 XFreeGC(mDisplay, vo_gc);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
254 vo_gc = XCreateGC(mDisplay, vo_window, GCForeground, &wGCV);
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
255
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
256 } // !GUI
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
257
15212
05aa13cdf92f replace VO and VF numeric flags with #defined identifiers
henry
parents: 13946
diff changeset
258 if ((flags & VOFLAG_FULLSCREEN) && (!WinID))
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
259 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
260 vo_dx = 0;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
261 vo_dy = 0;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
262 vo_dwidth = vo_screenwidth;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
263 vo_dheight = vo_screenheight;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
264 vo_fs = 1;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
265 }
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
266
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
267 panscan_calc();
6755
a31b9f15cbff - fix audio equalizer
pontscho
parents: 6382
diff changeset
268
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
269 mga_vid_config.colkey_on = 1;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
270 mga_vid_config.colkey_red = r;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
271 mga_vid_config.colkey_green = g;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
272 mga_vid_config.colkey_blue = b;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
273
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
274 set_window(); // set up mga_vid_config.dest_width etc
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
275
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
276 if (vo_ontop)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
277 vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
6755
a31b9f15cbff - fix audio equalizer
pontscho
parents: 6382
diff changeset
278
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
279 XSync(mDisplay, False);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
280
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
281 ioctl(f, MGA_VID_ON, 0);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
282
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
283 return 0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
284 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
285
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
286 static void uninit(void)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
287 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
288 mp_msg(MSGT_VO, MSGL_V, "vo: uninit!\n");
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
289 mga_uninit();
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
290 if (!inited)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
291 return; // no window?
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
292 inited = 0;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11542
diff changeset
293 vo_x11_uninit(); // destroy the window
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
294 }