Mercurial > mplayer.hg
annotate libvo/x11_common.c @ 27799:898b89a6dab1
Merge two Xvid build steps.
author | diego |
---|---|
date | Sun, 26 Oct 2008 09:49:33 +0000 |
parents | b82e78288439 |
children | f92271dc5f17 |
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> | |
7964
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
4 #include <math.h> |
6401 | 5 #include <inttypes.h> |
448
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 #include "config.h" |
5998 | 8 #include "mp_msg.h" |
22823
98eaf29b5dee
Code cleanup: don't include a .c file in mplayer.c and fix a few
rathann
parents:
21964
diff
changeset
|
9 #include "mp_fifo.h" |
6401 | 10 #include "x11_common.h" |
448
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
440
diff
changeset
|
11 |
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
440
diff
changeset
|
12 #ifdef X11_FULLSCREEN |
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
440
diff
changeset
|
13 |
440
d19a3da6ac13
Pontscho's mixer, select, and hell-a-lot-of-stuff patch ;)
gabucino
parents:
416
diff
changeset
|
14 #include <string.h> |
32 | 15 #include <unistd.h> |
12520
94e66acdb706
Metacity fullscreen issues, patch by Alexander Strasser <eclipse7@gmx.net>,
diego
parents:
12371
diff
changeset
|
16 #include <assert.h> |
32 | 17 |
18 #include "video_out.h" | |
10889 | 19 #include "aspect.h" |
12032
8cc4d4344c0f
Don't mess with the window position in xinerama when -geometry changes it.
diego
parents:
12031
diff
changeset
|
20 #include "geometry.h" |
9317
c7f5df43b937
- support command line parameter -fstype, eg. -fstype layer=12,above,fullscreen
filon
parents:
9217
diff
changeset
|
21 #include "help_mp.h" |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
12972
diff
changeset
|
22 #include "osdep/timer.h" |
32 | 23 |
324 | 24 #include <X11/Xmd.h> |
32 | 25 #include <X11/Xlib.h> |
26 #include <X11/Xutil.h> | |
27 #include <X11/Xatom.h> | |
28 | |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
29 #ifdef CONFIG_XSS |
25482 | 30 #include <X11/extensions/scrnsaver.h> |
31 #endif | |
32 | |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
33 #ifdef CONFIG_XDPMS |
448
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
440
diff
changeset
|
34 #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
|
35 #endif |
448
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
440
diff
changeset
|
36 |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
37 #ifdef CONFIG_XINERAMA |
2149
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
38 #include <X11/extensions/Xinerama.h> |
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
39 #endif |
1732 | 40 |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
41 #ifdef CONFIG_XF86VM |
4425
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
42 #include <X11/extensions/xf86vmode.h> |
14636
408bcfa575bf
Separate XF86 video mode extension check from XF86 keysym check as
diego
parents:
14244
diff
changeset
|
43 #endif |
408bcfa575bf
Separate XF86 video mode extension check from XF86 keysym check as
diego
parents:
14244
diff
changeset
|
44 |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
45 #ifdef CONFIG_XF86XK |
9822
1e761763566c
Support for "internet" or "multimedia" keyboards in X11.
albeu
parents:
9695
diff
changeset
|
46 #include <X11/XF86keysym.h> |
4425
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
47 #endif |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
48 |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
49 #ifdef CONFIG_XV |
10359 | 50 #include <X11/extensions/Xv.h> |
51 #include <X11/extensions/Xvlib.h> | |
14742 | 52 |
53 #include "subopt-helper.h" | |
10359 | 54 #endif |
55 | |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
12972
diff
changeset
|
56 #include "input/input.h" |
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
12972
diff
changeset
|
57 #include "input/mouse.h" |
4658 | 58 |
27343 | 59 #ifdef CONFIG_GUI |
23077 | 60 #include "gui/interface.h" |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
12972
diff
changeset
|
61 #include "mplayer.h" |
4798 | 62 #endif |
63 | |
8660
39476cbd1673
I have looked at the fullscreen code and realized that there are
arpi
parents:
8653
diff
changeset
|
64 #define WIN_LAYER_ONBOTTOM 2 |
39476cbd1673
I have looked at the fullscreen code and realized that there are
arpi
parents:
8653
diff
changeset
|
65 #define WIN_LAYER_NORMAL 4 |
39476cbd1673
I have looked at the fullscreen code and realized that there are
arpi
parents:
8653
diff
changeset
|
66 #define WIN_LAYER_ONTOP 6 |
8669
fd398a0b4b3b
This time the patch is fixing much more that breaking :-)
arpi
parents:
8663
diff
changeset
|
67 #define WIN_LAYER_ABOVE_DOCK 10 |
12582 | 68 |
19850
4919b3ce8d5e
report to mplayer with a slave command the coordinates of the pointer reported by x11; rescale coordinates to [0,1]x[0,1] range - patch by Jonas Jermann and me
nicodvb
parents:
18950
diff
changeset
|
69 extern int enable_mouse_movements; |
12582 | 70 int fs_layer = WIN_LAYER_ABOVE_DOCK; |
71 static int orig_layer = 0; | |
12111
8e31aacc3e81
- win_gravity memorizing and restoring while switching fullscreen mode (by Adam Tla/lka)
rathann
parents:
12096
diff
changeset
|
72 static int old_gravity = NorthWestGravity; |
8866 | 73 |
12582 | 74 int stop_xscreensaver = 0; |
6202 | 75 |
12582 | 76 static int dpms_disabled = 0; |
324 | 77 |
12582 | 78 char *mDisplayName = NULL; |
79 Display *mDisplay = NULL; | |
80 Window mRootWin; | |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
81 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
|
82 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
|
83 |
3830 | 84 /* output window id */ |
5955
caac20b1ca79
fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents:
5919
diff
changeset
|
85 int vo_mouse_autohide = 0; |
9317
c7f5df43b937
- support command line parameter -fstype, eg. -fstype layer=12,above,fullscreen
filon
parents:
9217
diff
changeset
|
86 int vo_wm_type = 0; |
12796
24075685789b
This fixes the problems that originated from my ewmh
rtognimp
parents:
12582
diff
changeset
|
87 int vo_fs_type = 0; // needs to be accessible for GUI X11 code |
12125
f4fc74a88e65
full screen flipping synchronization corrections (by Adam Tla/lka)
rathann
parents:
12123
diff
changeset
|
88 static int vo_fs_flip = 0; |
12582 | 89 char **vo_fstype_list; |
384 | 90 |
21938 | 91 /* 1 means that the WM is metacity (broken as hell) */ |
8835
664b0612f950
Fixed metacity + xv behavior (something broke it lately).
filon
parents:
8783
diff
changeset
|
92 int metacity_hack = 0; |
664b0612f950
Fixed metacity + xv behavior (something broke it lately).
filon
parents:
8783
diff
changeset
|
93 |
10587
382bf4771ee7
moved lot of global variables into static ones (and some minor spelling fixes)
alex
parents:
10570
diff
changeset
|
94 static Atom XA_NET_SUPPORTED; |
382bf4771ee7
moved lot of global variables into static ones (and some minor spelling fixes)
alex
parents:
10570
diff
changeset
|
95 static Atom XA_NET_WM_STATE; |
382bf4771ee7
moved lot of global variables into static ones (and some minor spelling fixes)
alex
parents:
10570
diff
changeset
|
96 static Atom XA_NET_WM_STATE_FULLSCREEN; |
382bf4771ee7
moved lot of global variables into static ones (and some minor spelling fixes)
alex
parents:
10570
diff
changeset
|
97 static Atom XA_NET_WM_STATE_ABOVE; |
382bf4771ee7
moved lot of global variables into static ones (and some minor spelling fixes)
alex
parents:
10570
diff
changeset
|
98 static Atom XA_NET_WM_STATE_STAYS_ON_TOP; |
382bf4771ee7
moved lot of global variables into static ones (and some minor spelling fixes)
alex
parents:
10570
diff
changeset
|
99 static Atom XA_NET_WM_STATE_BELOW; |
382bf4771ee7
moved lot of global variables into static ones (and some minor spelling fixes)
alex
parents:
10570
diff
changeset
|
100 static Atom XA_NET_WM_PID; |
382bf4771ee7
moved lot of global variables into static ones (and some minor spelling fixes)
alex
parents:
10570
diff
changeset
|
101 static Atom XA_WIN_PROTOCOLS; |
382bf4771ee7
moved lot of global variables into static ones (and some minor spelling fixes)
alex
parents:
10570
diff
changeset
|
102 static Atom XA_WIN_LAYER; |
382bf4771ee7
moved lot of global variables into static ones (and some minor spelling fixes)
alex
parents:
10570
diff
changeset
|
103 static Atom XA_WIN_HINTS; |
18149
163fe5c2577d
Register for window-manager delete window events and quit MPlayer.
reimar
parents:
18116
diff
changeset
|
104 static Atom XAWM_PROTOCOLS; |
163fe5c2577d
Register for window-manager delete window events and quit MPlayer.
reimar
parents:
18116
diff
changeset
|
105 static Atom XAWM_DELETE_WINDOW; |
8742
241f40ef5e28
More fullscreen cleanup work. Use nice macros for X atoms.
filon
parents:
8716
diff
changeset
|
106 |
241f40ef5e28
More fullscreen cleanup work. Use nice macros for X atoms.
filon
parents:
8716
diff
changeset
|
107 #define XA_INIT(x) XA##x = XInternAtom(mDisplay, #x, False) |
241f40ef5e28
More fullscreen cleanup work. Use nice macros for X atoms.
filon
parents:
8716
diff
changeset
|
108 |
7435 | 109 static int vo_old_x = 0; |
110 static int vo_old_y = 0; | |
111 static int vo_old_width = 0; | |
112 static int vo_old_height = 0; | |
113 | |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
114 #ifdef CONFIG_XF86VM |
12582 | 115 XF86VidModeModeInfo **vidmodes = NULL; |
4977
7b65a4f0b74e
vm pecs applied from daniel carter <hedonist@win.co.nz>
pontscho
parents:
4974
diff
changeset
|
116 XF86VidModeModeLine modeline; |
4425
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
117 #endif |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
118 |
10587
382bf4771ee7
moved lot of global variables into static ones (and some minor spelling fixes)
alex
parents:
10570
diff
changeset
|
119 static int vo_x11_get_fs_type(int supported); |
10212
d358fa9a1068
warning fixes by Dominik Mierzejewski <dominik@rangers.eu.org>
alex
parents:
10193
diff
changeset
|
120 |
12520
94e66acdb706
Metacity fullscreen issues, patch by Alexander Strasser <eclipse7@gmx.net>,
diego
parents:
12371
diff
changeset
|
121 |
94e66acdb706
Metacity fullscreen issues, patch by Alexander Strasser <eclipse7@gmx.net>,
diego
parents:
12371
diff
changeset
|
122 /* |
94e66acdb706
Metacity fullscreen issues, patch by Alexander Strasser <eclipse7@gmx.net>,
diego
parents:
12371
diff
changeset
|
123 * Sends the EWMH fullscreen state event. |
21938 | 124 * |
125 * action: could be one of _NET_WM_STATE_REMOVE -- remove state | |
126 * _NET_WM_STATE_ADD -- add state | |
127 * _NET_WM_STATE_TOGGLE -- toggle | |
12520
94e66acdb706
Metacity fullscreen issues, patch by Alexander Strasser <eclipse7@gmx.net>,
diego
parents:
12371
diff
changeset
|
128 */ |
12582 | 129 void vo_x11_ewmh_fullscreen(int action) |
12520
94e66acdb706
Metacity fullscreen issues, patch by Alexander Strasser <eclipse7@gmx.net>,
diego
parents:
12371
diff
changeset
|
130 { |
12582 | 131 assert(action == _NET_WM_STATE_REMOVE || |
132 action == _NET_WM_STATE_ADD || action == _NET_WM_STATE_TOGGLE); | |
133 | |
134 if (vo_fs_type & vo_wm_FULLSCREEN) | |
12520
94e66acdb706
Metacity fullscreen issues, patch by Alexander Strasser <eclipse7@gmx.net>,
diego
parents:
12371
diff
changeset
|
135 { |
12582 | 136 XEvent xev; |
137 | |
21938 | 138 /* init X event structure for _NET_WM_FULLSCREEN client message */ |
12582 | 139 xev.xclient.type = ClientMessage; |
140 xev.xclient.serial = 0; | |
141 xev.xclient.send_event = True; | |
27616
213d9bc30b35
Use already "prefetched" atoms instead of calling XInternAtom each time.
reimar
parents:
27377
diff
changeset
|
142 xev.xclient.message_type = XA_NET_WM_STATE; |
12582 | 143 xev.xclient.window = vo_window; |
144 xev.xclient.format = 32; | |
145 xev.xclient.data.l[0] = action; | |
27616
213d9bc30b35
Use already "prefetched" atoms instead of calling XInternAtom each time.
reimar
parents:
27377
diff
changeset
|
146 xev.xclient.data.l[1] = XA_NET_WM_STATE_FULLSCREEN; |
12582 | 147 xev.xclient.data.l[2] = 0; |
148 xev.xclient.data.l[3] = 0; | |
149 xev.xclient.data.l[4] = 0; | |
150 | |
151 /* finally send that damn thing */ | |
152 if (!XSendEvent(mDisplay, DefaultRootWindow(mDisplay), False, | |
153 SubstructureRedirectMask | SubstructureNotifyMask, | |
154 &xev)) | |
155 { | |
156 mp_msg(MSGT_VO, MSGL_ERR, MSGTR_EwmhFullscreenStateFailed); | |
157 } | |
12520
94e66acdb706
Metacity fullscreen issues, patch by Alexander Strasser <eclipse7@gmx.net>,
diego
parents:
12371
diff
changeset
|
158 } |
94e66acdb706
Metacity fullscreen issues, patch by Alexander Strasser <eclipse7@gmx.net>,
diego
parents:
12371
diff
changeset
|
159 } |
94e66acdb706
Metacity fullscreen issues, patch by Alexander Strasser <eclipse7@gmx.net>,
diego
parents:
12371
diff
changeset
|
160 |
12582 | 161 void vo_hidecursor(Display * disp, Window win) |
384 | 162 { |
12582 | 163 Cursor no_ptr; |
164 Pixmap bm_no; | |
165 XColor black, dummy; | |
166 Colormap colormap; | |
13828
b4ad5f0b550d
Fix erroneus extern declarations, fix wrong signedness of some vars
atmos4
parents:
13787
diff
changeset
|
167 static char bm_no_data[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; |
3954 | 168 |
12582 | 169 if (WinID == 0) |
21938 | 170 return; // do not hide if playing on the root window |
12582 | 171 |
172 colormap = DefaultColormap(disp, DefaultScreen(disp)); | |
14743
465c8617cbe5
We should not crash, only because we couldn't hide the cursor.
al
parents:
14742
diff
changeset
|
173 if ( !XAllocNamedColor(disp, colormap, "black", &black, &dummy) ) |
465c8617cbe5
We should not crash, only because we couldn't hide the cursor.
al
parents:
14742
diff
changeset
|
174 { |
465c8617cbe5
We should not crash, only because we couldn't hide the cursor.
al
parents:
14742
diff
changeset
|
175 return; // color alloc failed, give up |
465c8617cbe5
We should not crash, only because we couldn't hide the cursor.
al
parents:
14742
diff
changeset
|
176 } |
12582 | 177 bm_no = XCreateBitmapFromData(disp, win, bm_no_data, 8, 8); |
178 no_ptr = XCreatePixmapCursor(disp, bm_no, bm_no, &black, &black, 0, 0); | |
179 XDefineCursor(disp, win, no_ptr); | |
180 XFreeCursor(disp, no_ptr); | |
181 if (bm_no != None) | |
182 XFreePixmap(disp, bm_no); | |
13953 | 183 XFreeColors(disp,colormap,&black.pixel,1,0); |
384 | 184 } |
185 | |
12582 | 186 void vo_showcursor(Display * disp, Window win) |
187 { | |
188 if (WinID == 0) | |
189 return; | |
190 XDefineCursor(disp, win, 0); | |
5955
caac20b1ca79
fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents:
5919
diff
changeset
|
191 } |
384 | 192 |
12582 | 193 static int x11_errorhandler(Display * display, XErrorEvent * event) |
4742 | 194 { |
195 #define MSGLEN 60 | |
196 char msg[MSGLEN]; | |
12582 | 197 |
198 XGetErrorText(display, event->error_code, (char *) &msg, MSGLEN); | |
199 | |
200 mp_msg(MSGT_VO, MSGL_ERR, "X11 error: %s\n", msg); | |
201 | |
202 mp_msg(MSGT_VO, MSGL_V, | |
17366 | 203 "Type: %x, display: %p, resourceid: %lx, serial: %lx\n", |
12582 | 204 event->type, event->display, event->resourceid, event->serial); |
205 mp_msg(MSGT_VO, MSGL_V, | |
206 "Error code: %x, request code: %x, minor code: %x\n", | |
207 event->error_code, event->request_code, event->minor_code); | |
208 | |
21808
eaf6ed9cb5ab
Do not abort on X11 errors, most are not at all fatal.
reimar
parents:
21623
diff
changeset
|
209 // abort(); |
6095 | 210 //exit_player("X11 error"); |
23615 | 211 return 0; |
4742 | 212 #undef MSGLEN |
213 } | |
1732 | 214 |
9317
c7f5df43b937
- support command line parameter -fstype, eg. -fstype layer=12,above,fullscreen
filon
parents:
9217
diff
changeset
|
215 void fstype_help(void) |
c7f5df43b937
- support command line parameter -fstype, eg. -fstype layer=12,above,fullscreen
filon
parents:
9217
diff
changeset
|
216 { |
12582 | 217 mp_msg(MSGT_VO, MSGL_INFO, MSGTR_AvailableFsType); |
18237
4231482179b6
Get ride of the several if(identify) messy lines and rearangment of some of the output, both patches by Kiriuja mplayer-patches AT en-directo_net, his changes are barely unrelated, nevertheless Im commiting them thogeter just for the sake of my mental healt, I had both patches already applied on my local three
reynaldo
parents:
18160
diff
changeset
|
218 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_FULL_SCREEN_TYPES\n"); |
12582 | 219 |
220 mp_msg(MSGT_VO, MSGL_INFO, " %-15s %s\n", "none", | |
221 "don't set fullscreen window layer"); | |
222 mp_msg(MSGT_VO, MSGL_INFO, " %-15s %s\n", "layer", | |
223 "use _WIN_LAYER hint with default layer"); | |
224 mp_msg(MSGT_VO, MSGL_INFO, " %-15s %s\n", "layer=<0..15>", | |
225 "use _WIN_LAYER hint with a given layer number"); | |
226 mp_msg(MSGT_VO, MSGL_INFO, " %-15s %s\n", "netwm", | |
227 "force NETWM style"); | |
228 mp_msg(MSGT_VO, MSGL_INFO, " %-15s %s\n", "above", | |
229 "use _NETWM_STATE_ABOVE hint if available"); | |
230 mp_msg(MSGT_VO, MSGL_INFO, " %-15s %s\n", "below", | |
231 "use _NETWM_STATE_BELOW hint if available"); | |
232 mp_msg(MSGT_VO, MSGL_INFO, " %-15s %s\n", "fullscreen", | |
233 "use _NETWM_STATE_FULLSCREEN hint if availale"); | |
234 mp_msg(MSGT_VO, MSGL_INFO, " %-15s %s\n", "stays_on_top", | |
235 "use _NETWM_STATE_STAYS_ON_TOP hint if available"); | |
236 mp_msg(MSGT_VO, MSGL_INFO, | |
237 "You can also negate the settings with simply putting '-' in the beginning"); | |
17727
096cb1dfb591
Make -xy help output consistent, output an empty line before and after.
diego
parents:
17566
diff
changeset
|
238 mp_msg(MSGT_VO, MSGL_INFO, "\n"); |
10695
879ce4016b34
Commit alex's fstype patch x11_common.c3.diff with additional manpage extension.
attila
parents:
10587
diff
changeset
|
239 } |
879ce4016b34
Commit alex's fstype patch x11_common.c3.diff with additional manpage extension.
attila
parents:
10587
diff
changeset
|
240 |
879ce4016b34
Commit alex's fstype patch x11_common.c3.diff with additional manpage extension.
attila
parents:
10587
diff
changeset
|
241 static void fstype_dump(int fstype) |
879ce4016b34
Commit alex's fstype patch x11_common.c3.diff with additional manpage extension.
attila
parents:
10587
diff
changeset
|
242 { |
879ce4016b34
Commit alex's fstype patch x11_common.c3.diff with additional manpage extension.
attila
parents:
10587
diff
changeset
|
243 if (fstype) |
879ce4016b34
Commit alex's fstype patch x11_common.c3.diff with additional manpage extension.
attila
parents:
10587
diff
changeset
|
244 { |
12582 | 245 mp_msg(MSGT_VO, MSGL_V, "[x11] Current fstype setting honours"); |
246 if (fstype & vo_wm_LAYER) | |
247 mp_msg(MSGT_VO, MSGL_V, " LAYER"); | |
248 if (fstype & vo_wm_FULLSCREEN) | |
249 mp_msg(MSGT_VO, MSGL_V, " FULLSCREEN"); | |
250 if (fstype & vo_wm_STAYS_ON_TOP) | |
251 mp_msg(MSGT_VO, MSGL_V, " STAYS_ON_TOP"); | |
252 if (fstype & vo_wm_ABOVE) | |
253 mp_msg(MSGT_VO, MSGL_V, " ABOVE"); | |
254 if (fstype & vo_wm_BELOW) | |
255 mp_msg(MSGT_VO, MSGL_V, " BELOW"); | |
256 mp_msg(MSGT_VO, MSGL_V, " X atoms\n"); | |
257 } else | |
258 mp_msg(MSGT_VO, MSGL_V, | |
259 "[x11] Current fstype setting doesn't honour any X atoms\n"); | |
9317
c7f5df43b937
- support command line parameter -fstype, eg. -fstype layer=12,above,fullscreen
filon
parents:
9217
diff
changeset
|
260 } |
12582 | 261 |
10587
382bf4771ee7
moved lot of global variables into static ones (and some minor spelling fixes)
alex
parents:
10570
diff
changeset
|
262 static int net_wm_support_state_test(Atom atom) |
8653 | 263 { |
9317
c7f5df43b937
- support command line parameter -fstype, eg. -fstype layer=12,above,fullscreen
filon
parents:
9217
diff
changeset
|
264 #define NET_WM_STATE_TEST(x) { if (atom == XA_NET_WM_STATE_##x) { mp_msg( MSGT_VO,MSGL_V, "[x11] Detected wm supports " #x " state.\n" ); return vo_wm_##x; } } |
12582 | 265 |
266 NET_WM_STATE_TEST(FULLSCREEN); | |
267 NET_WM_STATE_TEST(ABOVE); | |
268 NET_WM_STATE_TEST(STAYS_ON_TOP); | |
269 NET_WM_STATE_TEST(BELOW); | |
270 return 0; | |
8653 | 271 } |
272 | |
12582 | 273 static int x11_get_property(Atom type, Atom ** args, unsigned long *nitems) |
8742
241f40ef5e28
More fullscreen cleanup work. Use nice macros for X atoms.
filon
parents:
8716
diff
changeset
|
274 { |
12582 | 275 int format; |
276 unsigned long bytesafter; | |
8742
241f40ef5e28
More fullscreen cleanup work. Use nice macros for X atoms.
filon
parents:
8716
diff
changeset
|
277 |
26755
46f0b4d34fa1
cosmetics: Remove useless parentheses from from return statements.
diego
parents:
26436
diff
changeset
|
278 return Success == |
12582 | 279 XGetWindowProperty(mDisplay, mRootWin, type, 0, 16384, False, |
280 AnyPropertyType, &type, &format, nitems, | |
281 &bytesafter, (unsigned char **) args) | |
26755
46f0b4d34fa1
cosmetics: Remove useless parentheses from from return statements.
diego
parents:
26436
diff
changeset
|
282 && *nitems > 0; |
8742
241f40ef5e28
More fullscreen cleanup work. Use nice macros for X atoms.
filon
parents:
8716
diff
changeset
|
283 } |
241f40ef5e28
More fullscreen cleanup work. Use nice macros for X atoms.
filon
parents:
8716
diff
changeset
|
284 |
10587
382bf4771ee7
moved lot of global variables into static ones (and some minor spelling fixes)
alex
parents:
10570
diff
changeset
|
285 static int vo_wm_detect(void) |
6009 | 286 { |
12582 | 287 int i; |
288 int wm = 0; | |
289 unsigned long nitems; | |
290 Atom *args = NULL; | |
291 | |
292 if (WinID >= 0) | |
293 return 0; | |
294 | |
8669
fd398a0b4b3b
This time the patch is fixing much more that breaking :-)
arpi
parents:
8663
diff
changeset
|
295 // -- supports layers |
12582 | 296 if (x11_get_property(XA_WIN_PROTOCOLS, &args, &nitems)) |
297 { | |
298 mp_msg(MSGT_VO, MSGL_V, "[x11] Detected wm supports layers.\n"); | |
299 for (i = 0; i < nitems; i++) | |
300 { | |
301 if (args[i] == XA_WIN_LAYER) | |
302 { | |
303 wm |= vo_wm_LAYER; | |
304 metacity_hack |= 1; | |
305 } else | |
21938 | 306 /* metacity is the only window manager I know which reports |
307 * supporting only the _WIN_LAYER hint in _WIN_PROTOCOLS. | |
308 * (what's more support for it is broken) */ | |
12582 | 309 metacity_hack |= 2; |
310 } | |
311 XFree(args); | |
312 if (wm && (metacity_hack == 1)) | |
313 { | |
21938 | 314 // metacity claims to support layers, but it is not the truth :-) |
12582 | 315 wm ^= vo_wm_LAYER; |
316 mp_msg(MSGT_VO, MSGL_V, | |
317 "[x11] Using workaround for Metacity bugs.\n"); | |
318 } | |
319 } | |
6009 | 320 // --- netwm |
12582 | 321 if (x11_get_property(XA_NET_SUPPORTED, &args, &nitems)) |
322 { | |
323 mp_msg(MSGT_VO, MSGL_V, "[x11] Detected wm supports NetWM.\n"); | |
324 for (i = 0; i < nitems; i++) | |
325 wm |= net_wm_support_state_test(args[i]); | |
326 XFree(args); | |
327 } | |
9317
c7f5df43b937
- support command line parameter -fstype, eg. -fstype layer=12,above,fullscreen
filon
parents:
9217
diff
changeset
|
328 |
12582 | 329 if (wm == 0) |
330 mp_msg(MSGT_VO, MSGL_V, "[x11] Unknown wm type...\n"); | |
331 return wm; | |
332 } | |
6009 | 333 |
10587
382bf4771ee7
moved lot of global variables into static ones (and some minor spelling fixes)
alex
parents:
10570
diff
changeset
|
334 static void init_atoms(void) |
8742
241f40ef5e28
More fullscreen cleanup work. Use nice macros for X atoms.
filon
parents:
8716
diff
changeset
|
335 { |
12582 | 336 XA_INIT(_NET_SUPPORTED); |
337 XA_INIT(_NET_WM_STATE); | |
338 XA_INIT(_NET_WM_STATE_FULLSCREEN); | |
339 XA_INIT(_NET_WM_STATE_ABOVE); | |
340 XA_INIT(_NET_WM_STATE_STAYS_ON_TOP); | |
341 XA_INIT(_NET_WM_STATE_BELOW); | |
342 XA_INIT(_NET_WM_PID); | |
343 XA_INIT(_WIN_PROTOCOLS); | |
344 XA_INIT(_WIN_LAYER); | |
345 XA_INIT(_WIN_HINTS); | |
18149
163fe5c2577d
Register for window-manager delete window events and quit MPlayer.
reimar
parents:
18116
diff
changeset
|
346 XA_INIT(WM_PROTOCOLS); |
163fe5c2577d
Register for window-manager delete window events and quit MPlayer.
reimar
parents:
18116
diff
changeset
|
347 XA_INIT(WM_DELETE_WINDOW); |
8742
241f40ef5e28
More fullscreen cleanup work. Use nice macros for X atoms.
filon
parents:
8716
diff
changeset
|
348 } |
241f40ef5e28
More fullscreen cleanup work. Use nice macros for X atoms.
filon
parents:
8716
diff
changeset
|
349 |
18116 | 350 void update_xinerama_info(void) { |
26436 | 351 int screen = xinerama_screen; |
352 xinerama_x = xinerama_y = 0; | |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
353 #ifdef CONFIG_XINERAMA |
18116 | 354 if (screen >= -1 && XineramaIsActive(mDisplay)) |
355 { | |
356 XineramaScreenInfo *screens; | |
357 int num_screens; | |
358 | |
359 screens = XineramaQueryScreens(mDisplay, &num_screens); | |
26436 | 360 if (screen >= num_screens) |
361 screen = num_screens - 1; | |
362 if (screen == -1) { | |
363 int x = vo_dx + vo_dwidth / 2; | |
364 int y = vo_dy + vo_dheight / 2; | |
365 for (screen = num_screens - 1; screen > 0; screen--) { | |
366 int left = screens[screen].x_org; | |
367 int right = left + screens[screen].width; | |
368 int top = screens[screen].y_org; | |
369 int bottom = top + screens[screen].height; | |
370 if (left <= x && x <= right && top <= y && y <= bottom) | |
371 break; | |
372 } | |
26407 | 373 } |
18116 | 374 if (screen < 0) |
375 screen = 0; | |
376 vo_screenwidth = screens[screen].width; | |
377 vo_screenheight = screens[screen].height; | |
378 xinerama_x = screens[screen].x_org; | |
379 xinerama_y = screens[screen].y_org; | |
380 | |
381 XFree(screens); | |
382 } | |
18160
03bc3385a845
10l, aspect_save_screenres must be always called in update_xinerama_info.
reimar
parents:
18149
diff
changeset
|
383 #endif |
18116 | 384 aspect_save_screenres(vo_screenwidth, vo_screenheight); |
385 } | |
386 | |
12582 | 387 int vo_init(void) |
32 | 388 { |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
389 // int mScreen; |
12582 | 390 int depth, bpp; |
391 unsigned int mask; | |
392 | |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
393 // 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
|
394 // Display * mDisplay; |
12582 | 395 XImage *mXImage = NULL; |
396 | |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
397 // Window mRootWin; |
12582 | 398 XWindowAttributes attribs; |
399 char *dispName; | |
12972
c8900eba2cc7
now use vo_rootwin var to check for -rootwin switch
nplourde
parents:
12798
diff
changeset
|
400 |
c8900eba2cc7
now use vo_rootwin var to check for -rootwin switch
nplourde
parents:
12798
diff
changeset
|
401 if (vo_rootwin) |
21938 | 402 WinID = 0; // use root window |
32 | 403 |
12582 | 404 if (vo_depthonscreen) |
13935 | 405 { |
406 saver_off(mDisplay); | |
12582 | 407 return 1; // already called |
13935 | 408 } |
32 | 409 |
12582 | 410 XSetErrorHandler(x11_errorhandler); |
4812 | 411 |
412 #if 0 | |
12582 | 413 if (!mDisplayName) |
414 if (!(mDisplayName = getenv("DISPLAY"))) | |
415 mDisplayName = strdup(":0.0"); | |
4812 | 416 #else |
12582 | 417 dispName = XDisplayName(mDisplayName); |
4812 | 418 #endif |
419 | |
12582 | 420 mp_msg(MSGT_VO, MSGL_V, "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
|
421 |
12582 | 422 mDisplay = XOpenDisplay(dispName); |
423 if (!mDisplay) | |
424 { | |
425 mp_msg(MSGT_VO, MSGL_ERR, | |
426 "vo: couldn't open the X11 display (%s)!\n", dispName); | |
427 return 0; | |
428 } | |
21938 | 429 mScreen = DefaultScreen(mDisplay); // screen ID |
430 mRootWin = RootWindow(mDisplay, mScreen); // root window ID | |
2149
6358db6ad3d0
Xinerama screen size fix by Lev Babiev <harley@hosers.org>
arpi
parents:
1746
diff
changeset
|
431 |
12582 | 432 init_atoms(); |
433 | |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
434 #ifdef CONFIG_XF86VM |
12582 | 435 { |
436 int clock; | |
437 | |
438 XF86VidModeGetModeLine(mDisplay, mScreen, &clock, &modeline); | |
439 if (!vo_screenwidth) | |
440 vo_screenwidth = modeline.hdisplay; | |
441 if (!vo_screenheight) | |
442 vo_screenheight = modeline.vdisplay; | |
443 } | |
4977
7b65a4f0b74e
vm pecs applied from daniel carter <hedonist@win.co.nz>
pontscho
parents:
4974
diff
changeset
|
444 #endif |
12582 | 445 { |
446 if (!vo_screenwidth) | |
447 vo_screenwidth = DisplayWidth(mDisplay, mScreen); | |
448 if (!vo_screenheight) | |
449 vo_screenheight = DisplayHeight(mDisplay, mScreen); | |
450 } | |
451 // get color depth (from root window, or the best visual): | |
452 XGetWindowAttributes(mDisplay, mRootWin, &attribs); | |
453 depth = attribs.depth; | |
1732 | 454 |
12582 | 455 if (depth != 15 && depth != 16 && depth != 24 && depth != 32) |
456 { | |
457 Visual *visual; | |
458 | |
459 depth = vo_find_depth_from_visuals(mDisplay, mScreen, &visual); | |
460 if (depth != -1) | |
461 mXImage = XCreateImage(mDisplay, visual, depth, ZPixmap, | |
462 0, NULL, 1, 1, 8, 1); | |
463 } else | |
464 mXImage = | |
465 XGetImage(mDisplay, mRootWin, 0, 0, 1, 1, AllPlanes, ZPixmap); | |
1732 | 466 |
12582 | 467 vo_depthonscreen = depth; // display depth on screen |
1732 | 468 |
12582 | 469 // get bits/pixel from XImage structure: |
470 if (mXImage == NULL) | |
471 { | |
472 mask = 0; | |
473 } else | |
474 { | |
475 /* | |
476 * for the depth==24 case, the XImage structures might use | |
477 * 24 or 32 bits of data per pixel. The global variable | |
478 * vo_depthonscreen stores the amount of data per pixel in the | |
479 * XImage structure! | |
480 * | |
481 * Maybe we should rename vo_depthonscreen to (or add) vo_bpp? | |
482 */ | |
483 bpp = mXImage->bits_per_pixel; | |
484 if ((vo_depthonscreen + 7) / 8 != (bpp + 7) / 8) | |
485 vo_depthonscreen = bpp; // by A'rpi | |
486 mask = | |
487 mXImage->red_mask | mXImage->green_mask | mXImage->blue_mask; | |
488 mp_msg(MSGT_VO, MSGL_V, | |
489 "vo: X11 color mask: %X (R:%lX G:%lX B:%lX)\n", mask, | |
490 mXImage->red_mask, mXImage->green_mask, mXImage->blue_mask); | |
491 XDestroyImage(mXImage); | |
492 } | |
493 if (((vo_depthonscreen + 7) / 8) == 2) | |
494 { | |
495 if (mask == 0x7FFF) | |
496 vo_depthonscreen = 15; | |
497 else if (mask == 0xFFFF) | |
498 vo_depthonscreen = 16; | |
499 } | |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
741
diff
changeset
|
500 // XCloseDisplay( mDisplay ); |
1447
e82fbd67ae60
better local display connection patch by Adam Tla/lka atlka@pg.gda.pl
arpi
parents:
1415
diff
changeset
|
501 /* slightly improved local display detection AST */ |
12582 | 502 if (strncmp(dispName, "unix:", 5) == 0) |
503 dispName += 4; | |
504 else if (strncmp(dispName, "localhost:", 10) == 0) | |
505 dispName += 9; | |
506 if (*dispName == ':' && atoi(dispName + 1) < 10) | |
507 mLocalDisplay = 1; | |
508 else | |
509 mLocalDisplay = 0; | |
16301 | 510 mp_msg(MSGT_VO, MSGL_V, |
12582 | 511 "vo: X11 running at %dx%d with depth %d and %d bpp (\"%s\" => %s display)\n", |
512 vo_screenwidth, vo_screenheight, depth, vo_depthonscreen, | |
513 dispName, mLocalDisplay ? "local" : "remote"); | |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5981
diff
changeset
|
514 |
12582 | 515 vo_wm_type = vo_wm_detect(); |
516 | |
517 vo_fs_type = vo_x11_get_fs_type(vo_wm_type); | |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5981
diff
changeset
|
518 |
12582 | 519 fstype_dump(vo_fs_type); |
9317
c7f5df43b937
- support command line parameter -fstype, eg. -fstype layer=12,above,fullscreen
filon
parents:
9217
diff
changeset
|
520 |
12582 | 521 saver_off(mDisplay); |
522 return 1; | |
32 | 523 } |
524 | |
12582 | 525 void vo_uninit(void) |
6013
7f6e02a16ac4
some bugfix, x[11|mga|v] ( fullscreen with more files )
pontscho
parents:
6009
diff
changeset
|
526 { |
12582 | 527 if (!mDisplay) |
528 { | |
529 mp_msg(MSGT_VO, MSGL_V, | |
25962 | 530 "vo: x11 uninit called but X11 not initialized..\n"); |
12582 | 531 return; |
532 } | |
6077 | 533 // if( !vo_depthonscreen ) return; |
12582 | 534 mp_msg(MSGT_VO, MSGL_V, "vo: uninit ...\n"); |
535 XSetErrorHandler(NULL); | |
536 XCloseDisplay(mDisplay); | |
537 vo_depthonscreen = 0; | |
538 mDisplay = NULL; | |
6013
7f6e02a16ac4
some bugfix, x[11|mga|v] ( fullscreen with more files )
pontscho
parents:
6009
diff
changeset
|
539 } |
4436 | 540 |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
12972
diff
changeset
|
541 #include "osdep/keycodes.h" |
32 | 542 #include "wskeys.h" |
543 | |
9822
1e761763566c
Support for "internet" or "multimedia" keyboards in X11.
albeu
parents:
9695
diff
changeset
|
544 #ifdef XF86XK_AudioPause |
18950 | 545 static void vo_x11_putkey_ext(int keysym) |
12582 | 546 { |
547 switch (keysym) | |
548 { | |
27713
b82e78288439
Add missing support for some multimedia keys to X11 backend code.
diego
parents:
27617
diff
changeset
|
549 case XF86XK_MenuKB: |
b82e78288439
Add missing support for some multimedia keys to X11 backend code.
diego
parents:
27617
diff
changeset
|
550 mplayer_put_key(KEY_MENU); |
b82e78288439
Add missing support for some multimedia keys to X11 backend code.
diego
parents:
27617
diff
changeset
|
551 break; |
b82e78288439
Add missing support for some multimedia keys to X11 backend code.
diego
parents:
27617
diff
changeset
|
552 case XF86XK_AudioPlay: |
b82e78288439
Add missing support for some multimedia keys to X11 backend code.
diego
parents:
27617
diff
changeset
|
553 mplayer_put_key(KEY_PLAY); |
b82e78288439
Add missing support for some multimedia keys to X11 backend code.
diego
parents:
27617
diff
changeset
|
554 break; |
12582 | 555 case XF86XK_AudioPause: |
16892
3470c810527b
libvo input cleanup: remove the dependency on libinput,
albeu
parents:
16793
diff
changeset
|
556 mplayer_put_key(KEY_PAUSE); |
12582 | 557 break; |
558 case XF86XK_AudioStop: | |
16892
3470c810527b
libvo input cleanup: remove the dependency on libinput,
albeu
parents:
16793
diff
changeset
|
559 mplayer_put_key(KEY_STOP); |
12582 | 560 break; |
561 case XF86XK_AudioPrev: | |
16892
3470c810527b
libvo input cleanup: remove the dependency on libinput,
albeu
parents:
16793
diff
changeset
|
562 mplayer_put_key(KEY_PREV); |
12582 | 563 break; |
564 case XF86XK_AudioNext: | |
16892
3470c810527b
libvo input cleanup: remove the dependency on libinput,
albeu
parents:
16793
diff
changeset
|
565 mplayer_put_key(KEY_NEXT); |
12582 | 566 break; |
27713
b82e78288439
Add missing support for some multimedia keys to X11 backend code.
diego
parents:
27617
diff
changeset
|
567 case XF86XK_AudioMute: |
b82e78288439
Add missing support for some multimedia keys to X11 backend code.
diego
parents:
27617
diff
changeset
|
568 mplayer_put_key(KEY_MUTE); |
b82e78288439
Add missing support for some multimedia keys to X11 backend code.
diego
parents:
27617
diff
changeset
|
569 break; |
24323
ddd7774aa043
Allow XF86AudioLowerVolume/XF86AudioRaiseVolume keys to be handled by MPlayer.
diego
parents:
24313
diff
changeset
|
570 case XF86XK_AudioLowerVolume: |
ddd7774aa043
Allow XF86AudioLowerVolume/XF86AudioRaiseVolume keys to be handled by MPlayer.
diego
parents:
24313
diff
changeset
|
571 mplayer_put_key(KEY_VOLUME_DOWN); |
ddd7774aa043
Allow XF86AudioLowerVolume/XF86AudioRaiseVolume keys to be handled by MPlayer.
diego
parents:
24313
diff
changeset
|
572 break; |
ddd7774aa043
Allow XF86AudioLowerVolume/XF86AudioRaiseVolume keys to be handled by MPlayer.
diego
parents:
24313
diff
changeset
|
573 case XF86XK_AudioRaiseVolume: |
ddd7774aa043
Allow XF86AudioLowerVolume/XF86AudioRaiseVolume keys to be handled by MPlayer.
diego
parents:
24313
diff
changeset
|
574 mplayer_put_key(KEY_VOLUME_UP); |
ddd7774aa043
Allow XF86AudioLowerVolume/XF86AudioRaiseVolume keys to be handled by MPlayer.
diego
parents:
24313
diff
changeset
|
575 break; |
12582 | 576 default: |
577 break; | |
578 } | |
9822
1e761763566c
Support for "internet" or "multimedia" keyboards in X11.
albeu
parents:
9695
diff
changeset
|
579 } |
1e761763566c
Support for "internet" or "multimedia" keyboards in X11.
albeu
parents:
9695
diff
changeset
|
580 #endif |
1e761763566c
Support for "internet" or "multimedia" keyboards in X11.
albeu
parents:
9695
diff
changeset
|
581 |
12582 | 582 void vo_x11_putkey(int key) |
583 { | |
584 switch (key) | |
585 { | |
586 case wsLeft: | |
587 mplayer_put_key(KEY_LEFT); | |
588 break; | |
589 case wsRight: | |
590 mplayer_put_key(KEY_RIGHT); | |
591 break; | |
592 case wsUp: | |
593 mplayer_put_key(KEY_UP); | |
594 break; | |
595 case wsDown: | |
596 mplayer_put_key(KEY_DOWN); | |
597 break; | |
598 case wsSpace: | |
599 mplayer_put_key(' '); | |
600 break; | |
601 case wsEscape: | |
602 mplayer_put_key(KEY_ESC); | |
603 break; | |
16892
3470c810527b
libvo input cleanup: remove the dependency on libinput,
albeu
parents:
16793
diff
changeset
|
604 case wsTab: |
3470c810527b
libvo input cleanup: remove the dependency on libinput,
albeu
parents:
16793
diff
changeset
|
605 mplayer_put_key(KEY_TAB); |
3470c810527b
libvo input cleanup: remove the dependency on libinput,
albeu
parents:
16793
diff
changeset
|
606 break; |
12582 | 607 case wsEnter: |
608 mplayer_put_key(KEY_ENTER); | |
609 break; | |
610 case wsBackSpace: | |
611 mplayer_put_key(KEY_BS); | |
612 break; | |
613 case wsDelete: | |
614 mplayer_put_key(KEY_DELETE); | |
615 break; | |
616 case wsInsert: | |
617 mplayer_put_key(KEY_INSERT); | |
618 break; | |
619 case wsHome: | |
620 mplayer_put_key(KEY_HOME); | |
621 break; | |
622 case wsEnd: | |
623 mplayer_put_key(KEY_END); | |
624 break; | |
625 case wsPageUp: | |
626 mplayer_put_key(KEY_PAGE_UP); | |
627 break; | |
628 case wsPageDown: | |
629 mplayer_put_key(KEY_PAGE_DOWN); | |
630 break; | |
631 case wsF1: | |
632 mplayer_put_key(KEY_F + 1); | |
633 break; | |
634 case wsF2: | |
635 mplayer_put_key(KEY_F + 2); | |
636 break; | |
637 case wsF3: | |
638 mplayer_put_key(KEY_F + 3); | |
639 break; | |
640 case wsF4: | |
641 mplayer_put_key(KEY_F + 4); | |
642 break; | |
643 case wsF5: | |
644 mplayer_put_key(KEY_F + 5); | |
645 break; | |
646 case wsF6: | |
647 mplayer_put_key(KEY_F + 6); | |
648 break; | |
649 case wsF7: | |
650 mplayer_put_key(KEY_F + 7); | |
651 break; | |
652 case wsF8: | |
653 mplayer_put_key(KEY_F + 8); | |
654 break; | |
655 case wsF9: | |
656 mplayer_put_key(KEY_F + 9); | |
657 break; | |
658 case wsF10: | |
659 mplayer_put_key(KEY_F + 10); | |
660 break; | |
661 case wsF11: | |
662 mplayer_put_key(KEY_F + 11); | |
663 break; | |
664 case wsF12: | |
665 mplayer_put_key(KEY_F + 12); | |
666 break; | |
667 case wsMinus: | |
668 case wsGrayMinus: | |
669 mplayer_put_key('-'); | |
670 break; | |
671 case wsPlus: | |
672 case wsGrayPlus: | |
673 mplayer_put_key('+'); | |
674 break; | |
675 case wsGrayMul: | |
676 case wsMul: | |
677 mplayer_put_key('*'); | |
678 break; | |
679 case wsGrayDiv: | |
680 case wsDiv: | |
681 mplayer_put_key('/'); | |
682 break; | |
683 case wsLess: | |
684 mplayer_put_key('<'); | |
685 break; | |
686 case wsMore: | |
687 mplayer_put_key('>'); | |
688 break; | |
689 case wsGray0: | |
690 mplayer_put_key(KEY_KP0); | |
691 break; | |
692 case wsGrayEnd: | |
693 case wsGray1: | |
694 mplayer_put_key(KEY_KP1); | |
695 break; | |
696 case wsGrayDown: | |
697 case wsGray2: | |
698 mplayer_put_key(KEY_KP2); | |
699 break; | |
700 case wsGrayPgDn: | |
701 case wsGray3: | |
702 mplayer_put_key(KEY_KP3); | |
703 break; | |
704 case wsGrayLeft: | |
705 case wsGray4: | |
706 mplayer_put_key(KEY_KP4); | |
707 break; | |
708 case wsGray5Dup: | |
709 case wsGray5: | |
710 mplayer_put_key(KEY_KP5); | |
711 break; | |
712 case wsGrayRight: | |
713 case wsGray6: | |
714 mplayer_put_key(KEY_KP6); | |
715 break; | |
716 case wsGrayHome: | |
717 case wsGray7: | |
718 mplayer_put_key(KEY_KP7); | |
719 break; | |
720 case wsGrayUp: | |
721 case wsGray8: | |
722 mplayer_put_key(KEY_KP8); | |
723 break; | |
724 case wsGrayPgUp: | |
725 case wsGray9: | |
726 mplayer_put_key(KEY_KP9); | |
727 break; | |
728 case wsGrayDecimal: | |
729 mplayer_put_key(KEY_KPDEC); | |
730 break; | |
731 case wsGrayInsert: | |
732 mplayer_put_key(KEY_KPINS); | |
733 break; | |
734 case wsGrayDelete: | |
735 mplayer_put_key(KEY_KPDEL); | |
736 break; | |
737 case wsGrayEnter: | |
738 mplayer_put_key(KEY_KPENTER); | |
739 break; | |
740 case wsGrave: | |
741 mplayer_put_key('`'); | |
742 break; | |
743 case wsTilde: | |
744 mplayer_put_key('~'); | |
745 break; | |
746 case wsExclSign: | |
747 mplayer_put_key('!'); | |
748 break; | |
749 case wsAt: | |
750 mplayer_put_key('@'); | |
751 break; | |
752 case wsHash: | |
753 mplayer_put_key('#'); | |
754 break; | |
755 case wsDollar: | |
756 mplayer_put_key('$'); | |
757 break; | |
758 case wsPercent: | |
759 mplayer_put_key('%'); | |
760 break; | |
761 case wsCircumflex: | |
762 mplayer_put_key('^'); | |
763 break; | |
764 case wsAmpersand: | |
765 mplayer_put_key('&'); | |
766 break; | |
767 case wsobracket: | |
768 mplayer_put_key('('); | |
769 break; | |
770 case wscbracket: | |
771 mplayer_put_key(')'); | |
772 break; | |
773 case wsUnder: | |
774 mplayer_put_key('_'); | |
775 break; | |
776 case wsocbracket: | |
777 mplayer_put_key('{'); | |
778 break; | |
779 case wsccbracket: | |
780 mplayer_put_key('}'); | |
781 break; | |
782 case wsColon: | |
783 mplayer_put_key(':'); | |
784 break; | |
785 case wsSemicolon: | |
786 mplayer_put_key(';'); | |
787 break; | |
788 case wsDblQuote: | |
789 mplayer_put_key('\"'); | |
790 break; | |
791 case wsAcute: | |
792 mplayer_put_key('\''); | |
793 break; | |
794 case wsComma: | |
795 mplayer_put_key(','); | |
796 break; | |
797 case wsPoint: | |
798 mplayer_put_key('.'); | |
799 break; | |
800 case wsQuestSign: | |
801 mplayer_put_key('?'); | |
802 break; | |
803 case wsBSlash: | |
804 mplayer_put_key('\\'); | |
805 break; | |
806 case wsPipe: | |
807 mplayer_put_key('|'); | |
808 break; | |
809 case wsEqual: | |
810 mplayer_put_key('='); | |
811 break; | |
812 case wsosbrackets: | |
813 mplayer_put_key('['); | |
814 break; | |
815 case wscsbrackets: | |
816 mplayer_put_key(']'); | |
817 break; | |
10936
51bc09f2977c
Get more keys from X window (punctuation, etc.) Hopefully, all alnum keys
lumag
parents:
10920
diff
changeset
|
818 |
51bc09f2977c
Get more keys from X window (punctuation, etc.) Hopefully, all alnum keys
lumag
parents:
10920
diff
changeset
|
819 |
12582 | 820 default: |
821 if ((key >= 'a' && key <= 'z') || (key >= 'A' && key <= 'Z') || | |
822 (key >= '0' && key <= '9')) | |
823 mplayer_put_key(key); | |
824 } | |
369 | 825 |
32 | 826 } |
827 | |
828 | |
829 // ----- Motif header: ------- | |
830 | |
1236 | 831 #define MWM_HINTS_FUNCTIONS (1L << 0) |
832 #define MWM_HINTS_DECORATIONS (1L << 1) | |
833 #define MWM_HINTS_INPUT_MODE (1L << 2) | |
834 #define MWM_HINTS_STATUS (1L << 3) | |
835 | |
836 #define MWM_FUNC_ALL (1L << 0) | |
837 #define MWM_FUNC_RESIZE (1L << 1) | |
838 #define MWM_FUNC_MOVE (1L << 2) | |
839 #define MWM_FUNC_MINIMIZE (1L << 3) | |
840 #define MWM_FUNC_MAXIMIZE (1L << 4) | |
841 #define MWM_FUNC_CLOSE (1L << 5) | |
842 | |
843 #define MWM_DECOR_ALL (1L << 0) | |
844 #define MWM_DECOR_BORDER (1L << 1) | |
845 #define MWM_DECOR_RESIZEH (1L << 2) | |
846 #define MWM_DECOR_TITLE (1L << 3) | |
847 #define MWM_DECOR_MENU (1L << 4) | |
848 #define MWM_DECOR_MINIMIZE (1L << 5) | |
849 #define MWM_DECOR_MAXIMIZE (1L << 6) | |
850 | |
851 #define MWM_INPUT_MODELESS 0 | |
852 #define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1 | |
853 #define MWM_INPUT_SYSTEM_MODAL 2 | |
854 #define MWM_INPUT_FULL_APPLICATION_MODAL 3 | |
855 #define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL | |
856 | |
857 #define MWM_TEAROFF_WINDOW (1L<<0) | |
32 | 858 |
859 typedef struct | |
860 { | |
12582 | 861 long flags; |
862 long functions; | |
863 long decorations; | |
864 long input_mode; | |
865 long state; | |
32 | 866 } MotifWmHints; |
867 | |
12582 | 868 static MotifWmHints vo_MotifWmHints; |
869 static Atom vo_MotifHints = None; | |
32 | 870 |
12582 | 871 void vo_x11_decoration(Display * vo_Display, Window w, int d) |
32 | 872 { |
12582 | 873 static unsigned int olddecor = MWM_DECOR_ALL; |
874 static unsigned int oldfuncs = | |
875 MWM_FUNC_MOVE | MWM_FUNC_CLOSE | MWM_FUNC_MINIMIZE | | |
876 MWM_FUNC_MAXIMIZE | MWM_FUNC_RESIZE; | |
877 Atom mtype; | |
878 int mformat; | |
879 unsigned long mn, mb; | |
880 | |
881 if (!WinID) | |
882 return; | |
5955
caac20b1ca79
fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents:
5919
diff
changeset
|
883 |
12582 | 884 if (vo_fsmode & 8) |
885 { | |
886 XSetTransientForHint(vo_Display, w, | |
887 RootWindow(vo_Display, mScreen)); | |
888 } | |
889 | |
890 vo_MotifHints = XInternAtom(vo_Display, "_MOTIF_WM_HINTS", 0); | |
891 if (vo_MotifHints != None) | |
892 { | |
893 if (!d) | |
894 { | |
895 MotifWmHints *mhints = NULL; | |
1415 | 896 |
12582 | 897 XGetWindowProperty(vo_Display, w, vo_MotifHints, 0, 20, False, |
898 vo_MotifHints, &mtype, &mformat, &mn, | |
899 &mb, (unsigned char **) &mhints); | |
900 if (mhints) | |
901 { | |
902 if (mhints->flags & MWM_HINTS_DECORATIONS) | |
903 olddecor = mhints->decorations; | |
904 if (mhints->flags & MWM_HINTS_FUNCTIONS) | |
905 oldfuncs = mhints->functions; | |
906 XFree(mhints); | |
907 } | |
908 } | |
12096 | 909 |
12582 | 910 memset(&vo_MotifWmHints, 0, sizeof(MotifWmHints)); |
911 vo_MotifWmHints.flags = | |
912 MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS; | |
913 if (d) | |
914 { | |
915 vo_MotifWmHints.functions = oldfuncs; | |
916 d = olddecor; | |
917 } | |
4993 | 918 #if 0 |
12582 | 919 vo_MotifWmHints.decorations = |
920 d | ((vo_fsmode & 2) ? 0 : MWM_DECOR_MENU); | |
4993 | 921 #else |
12582 | 922 vo_MotifWmHints.decorations = |
923 d | ((vo_fsmode & 2) ? MWM_DECOR_MENU : 0); | |
4993 | 924 #endif |
12582 | 925 XChangeProperty(vo_Display, w, vo_MotifHints, vo_MotifHints, 32, |
926 PropModeReplace, | |
927 (unsigned char *) &vo_MotifWmHints, | |
928 (vo_fsmode & 4) ? 4 : 5); | |
929 } | |
32 | 930 } |
931 | |
12582 | 932 void vo_x11_classhint(Display * display, Window window, char *name) |
933 { | |
934 XClassHint wmClass; | |
935 pid_t pid = getpid(); | |
936 | |
937 wmClass.res_name = name; | |
938 wmClass.res_class = "MPlayer"; | |
939 XSetClassHint(display, window, &wmClass); | |
940 XChangeProperty(display, window, XA_NET_WM_PID, XA_CARDINAL, 32, | |
941 PropModeReplace, (unsigned char *) &pid, 1); | |
1137
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
942 } |
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
943 |
12582 | 944 Window vo_window = None; |
945 GC vo_gc = NULL; | |
946 GC f_gc = NULL; | |
4993 | 947 XSizeHints vo_hint; |
4795 | 948 |
27343 | 949 #ifdef CONFIG_GUI |
12582 | 950 void vo_setwindow(Window w, GC g) |
951 { | |
952 vo_window = w; | |
953 vo_gc = g; | |
954 } | |
723 | 955 #endif |
956 | |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
17366
diff
changeset
|
957 void vo_x11_uninit(void) |
4437 | 958 { |
7111 | 959 saver_on(mDisplay); |
12582 | 960 if (vo_window != None) |
961 vo_showcursor(mDisplay, vo_window); | |
4742 | 962 |
12582 | 963 if (f_gc) |
964 { | |
965 XFreeGC(mDisplay, f_gc); | |
966 f_gc = NULL; | |
967 } | |
27343 | 968 #ifdef CONFIG_GUI |
21938 | 969 /* destroy window only if it's not controlled by the GUI */ |
12582 | 970 if (!use_gui) |
4437 | 971 #endif |
972 { | |
12582 | 973 if (vo_gc) |
974 { | |
975 XSetBackground(mDisplay, vo_gc, 0); | |
976 XFreeGC(mDisplay, vo_gc); | |
977 vo_gc = NULL; | |
978 } | |
979 if (vo_window != None) | |
980 { | |
981 XClearWindow(mDisplay, vo_window); | |
982 if (WinID < 0) | |
983 { | |
984 XEvent xev; | |
985 | |
986 XUnmapWindow(mDisplay, vo_window); | |
987 XDestroyWindow(mDisplay, vo_window); | |
988 do | |
989 { | |
990 XNextEvent(mDisplay, &xev); | |
991 } | |
992 while (xev.type != DestroyNotify | |
993 || xev.xdestroywindow.event != vo_window); | |
994 } | |
995 vo_window = None; | |
996 } | |
997 vo_fs = 0; | |
998 vo_old_width = vo_old_height = 0; | |
4437 | 999 } |
1000 } | |
1001 | |
18287
292337d09af2
Remove updating of vo_mouse_timer_const from the main loop and also
uau
parents:
18237
diff
changeset
|
1002 static unsigned int mouse_timer; |
292337d09af2
Remove updating of vo_mouse_timer_const from the main loop and also
uau
parents:
18237
diff
changeset
|
1003 static int mouse_waiting_hide; |
5651
b8d8d72776f2
fix playlist bug with gui and rewrite mousecursor show/hide code
pontscho
parents:
5538
diff
changeset
|
1004 |
12582 | 1005 int vo_x11_check_events(Display * mydisplay) |
1006 { | |
1007 int ret = 0; | |
1008 XEvent Event; | |
1009 char buf[100]; | |
1010 KeySym keySym; | |
1011 static XComposeStatus stat; | |
5651
b8d8d72776f2
fix playlist bug with gui and rewrite mousecursor show/hide code
pontscho
parents:
5538
diff
changeset
|
1012 |
32 | 1013 // unsigned long vo_KeyTable[512]; |
1014 | |
18287
292337d09af2
Remove updating of vo_mouse_timer_const from the main loop and also
uau
parents:
18237
diff
changeset
|
1015 if ((vo_mouse_autohide) && mouse_waiting_hide && |
292337d09af2
Remove updating of vo_mouse_timer_const from the main loop and also
uau
parents:
18237
diff
changeset
|
1016 (GetTimerMS() - mouse_timer >= 1000)) { |
12582 | 1017 vo_hidecursor(mydisplay, vo_window); |
18287
292337d09af2
Remove updating of vo_mouse_timer_const from the main loop and also
uau
parents:
18237
diff
changeset
|
1018 mouse_waiting_hide = 0; |
292337d09af2
Remove updating of vo_mouse_timer_const from the main loop and also
uau
parents:
18237
diff
changeset
|
1019 } |
6095 | 1020 |
12582 | 1021 while (XPending(mydisplay)) |
1022 { | |
1023 XNextEvent(mydisplay, &Event); | |
27343 | 1024 #ifdef CONFIG_GUI |
12582 | 1025 if (use_gui) |
1026 { | |
1027 guiGetEvent(0, (char *) &Event); | |
1028 if (vo_window != Event.xany.window) | |
1029 continue; | |
1030 } | |
1031 #endif | |
6095 | 1032 // printf("\rEvent.type=%X \n",Event.type); |
12582 | 1033 switch (Event.type) |
1034 { | |
1035 case Expose: | |
1036 ret |= VO_EVENT_EXPOSE; | |
1037 break; | |
1038 case ConfigureNotify: | |
1039 // if (!vo_fs && (Event.xconfigure.width == vo_screenwidth || Event.xconfigure.height == vo_screenheight)) break; | |
1040 // if (vo_fs && Event.xconfigure.width != vo_screenwidth && Event.xconfigure.height != vo_screenheight) break; | |
1041 if (vo_window == None) | |
1042 break; | |
1043 vo_dwidth = Event.xconfigure.width; | |
1044 vo_dheight = Event.xconfigure.height; | |
4812 | 1045 #if 0 |
12582 | 1046 /* when resizing, x and y are zero :( */ |
1047 vo_dx = Event.xconfigure.x; | |
1048 vo_dy = Event.xconfigure.y; | |
4812 | 1049 #else |
12582 | 1050 { |
1051 Window root; | |
1052 int foo; | |
1053 Window win; | |
1054 | |
1055 XGetGeometry(mydisplay, vo_window, &root, &foo, &foo, | |
1056 &foo /*width */ , &foo /*height */ , &foo, | |
1057 &foo); | |
1058 XTranslateCoordinates(mydisplay, vo_window, root, 0, 0, | |
1059 &vo_dx, &vo_dy, &win); | |
1060 } | |
1061 #endif | |
1062 ret |= VO_EVENT_RESIZE; | |
1063 break; | |
1064 case KeyPress: | |
1065 { | |
1066 int key; | |
1067 | |
27343 | 1068 #ifdef CONFIG_GUI |
14001 | 1069 if ( use_gui ) { break; } |
1070 #endif | |
1071 | |
12582 | 1072 XLookupString(&Event.xkey, buf, sizeof(buf), &keySym, |
1073 &stat); | |
1074 #ifdef XF86XK_AudioPause | |
1075 vo_x11_putkey_ext(keySym); | |
1076 #endif | |
1077 key = | |
1078 ((keySym & 0xff00) != | |
1079 0 ? ((keySym & 0x00ff) + 256) : (keySym)); | |
1080 vo_x11_putkey(key); | |
1081 ret |= VO_EVENT_KEYPRESS; | |
1082 } | |
1083 break; | |
1084 case MotionNotify: | |
19850
4919b3ce8d5e
report to mplayer with a slave command the coordinates of the pointer reported by x11; rescale coordinates to [0,1]x[0,1] range - patch by Jonas Jermann and me
nicodvb
parents:
18950
diff
changeset
|
1085 if(enable_mouse_movements) |
4919b3ce8d5e
report to mplayer with a slave command the coordinates of the pointer reported by x11; rescale coordinates to [0,1]x[0,1] range - patch by Jonas Jermann and me
nicodvb
parents:
18950
diff
changeset
|
1086 { |
4919b3ce8d5e
report to mplayer with a slave command the coordinates of the pointer reported by x11; rescale coordinates to [0,1]x[0,1] range - patch by Jonas Jermann and me
nicodvb
parents:
18950
diff
changeset
|
1087 char cmd_str[40]; |
4919b3ce8d5e
report to mplayer with a slave command the coordinates of the pointer reported by x11; rescale coordinates to [0,1]x[0,1] range - patch by Jonas Jermann and me
nicodvb
parents:
18950
diff
changeset
|
1088 sprintf(cmd_str,"set_mouse_pos %i %i",Event.xmotion.x, Event.xmotion.y); |
4919b3ce8d5e
report to mplayer with a slave command the coordinates of the pointer reported by x11; rescale coordinates to [0,1]x[0,1] range - patch by Jonas Jermann and me
nicodvb
parents:
18950
diff
changeset
|
1089 mp_input_queue_cmd(mp_input_parse_cmd(cmd_str)); |
4919b3ce8d5e
report to mplayer with a slave command the coordinates of the pointer reported by x11; rescale coordinates to [0,1]x[0,1] range - patch by Jonas Jermann and me
nicodvb
parents:
18950
diff
changeset
|
1090 } |
4919b3ce8d5e
report to mplayer with a slave command the coordinates of the pointer reported by x11; rescale coordinates to [0,1]x[0,1] range - patch by Jonas Jermann and me
nicodvb
parents:
18950
diff
changeset
|
1091 |
12582 | 1092 if (vo_mouse_autohide) |
1093 { | |
1094 vo_showcursor(mydisplay, vo_window); | |
18287
292337d09af2
Remove updating of vo_mouse_timer_const from the main loop and also
uau
parents:
18237
diff
changeset
|
1095 mouse_waiting_hide = 1; |
292337d09af2
Remove updating of vo_mouse_timer_const from the main loop and also
uau
parents:
18237
diff
changeset
|
1096 mouse_timer = GetTimerMS(); |
12582 | 1097 } |
1098 break; | |
1099 case ButtonPress: | |
1100 if (vo_mouse_autohide) | |
1101 { | |
1102 vo_showcursor(mydisplay, vo_window); | |
18287
292337d09af2
Remove updating of vo_mouse_timer_const from the main loop and also
uau
parents:
18237
diff
changeset
|
1103 mouse_waiting_hide = 1; |
292337d09af2
Remove updating of vo_mouse_timer_const from the main loop and also
uau
parents:
18237
diff
changeset
|
1104 mouse_timer = GetTimerMS(); |
12582 | 1105 } |
27343 | 1106 #ifdef CONFIG_GUI |
21938 | 1107 // Ignore mouse button 1-3 under GUI. |
12582 | 1108 if (use_gui && (Event.xbutton.button >= 1) |
1109 && (Event.xbutton.button <= 3)) | |
1110 break; | |
1111 #endif | |
1112 mplayer_put_key((MOUSE_BTN0 + Event.xbutton.button - | |
1113 1) | MP_KEY_DOWN); | |
1114 break; | |
1115 case ButtonRelease: | |
1116 if (vo_mouse_autohide) | |
1117 { | |
1118 vo_showcursor(mydisplay, vo_window); | |
18287
292337d09af2
Remove updating of vo_mouse_timer_const from the main loop and also
uau
parents:
18237
diff
changeset
|
1119 mouse_waiting_hide = 1; |
292337d09af2
Remove updating of vo_mouse_timer_const from the main loop and also
uau
parents:
18237
diff
changeset
|
1120 mouse_timer = GetTimerMS(); |
12582 | 1121 } |
27343 | 1122 #ifdef CONFIG_GUI |
21938 | 1123 // Ignore mouse button 1-3 under GUI. |
12582 | 1124 if (use_gui && (Event.xbutton.button >= 1) |
1125 && (Event.xbutton.button <= 3)) | |
1126 break; | |
1127 #endif | |
1128 mplayer_put_key(MOUSE_BTN0 + Event.xbutton.button - 1); | |
1129 break; | |
1130 case PropertyNotify: | |
1131 { | |
1132 char *name = | |
1133 XGetAtomName(mydisplay, Event.xproperty.atom); | |
1134 | |
1135 if (!name) | |
1136 break; | |
1137 | |
6046 | 1138 // fprintf(stderr,"[ws] PropertyNotify ( 0x%x ) %s ( 0x%x )\n",vo_window,name,Event.xproperty.atom ); |
12582 | 1139 |
1140 XFree(name); | |
1141 } | |
1142 break; | |
1143 case MapNotify: | |
1144 vo_hint.win_gravity = old_gravity; | |
1145 XSetWMNormalHints(mDisplay, vo_window, &vo_hint); | |
1146 vo_fs_flip = 0; | |
1147 break; | |
18149
163fe5c2577d
Register for window-manager delete window events and quit MPlayer.
reimar
parents:
18116
diff
changeset
|
1148 case ClientMessage: |
163fe5c2577d
Register for window-manager delete window events and quit MPlayer.
reimar
parents:
18116
diff
changeset
|
1149 if (Event.xclient.message_type == XAWM_PROTOCOLS && |
163fe5c2577d
Register for window-manager delete window events and quit MPlayer.
reimar
parents:
18116
diff
changeset
|
1150 Event.xclient.data.l[0] == XAWM_DELETE_WINDOW) |
163fe5c2577d
Register for window-manager delete window events and quit MPlayer.
reimar
parents:
18116
diff
changeset
|
1151 mplayer_put_key(KEY_CLOSE_WIN); |
163fe5c2577d
Register for window-manager delete window events and quit MPlayer.
reimar
parents:
18116
diff
changeset
|
1152 break; |
12582 | 1153 } |
1154 } | |
1155 return ret; | |
32 | 1156 } |
1157 | |
13843 | 1158 /** |
1159 * \brief sets the size and position of the non-fullscreen window. | |
1160 */ | |
1161 void vo_x11_nofs_sizepos(int x, int y, int width, int height) | |
1162 { | |
24312
716b7751e7ad
Make sure aspect hint is adjusted on aspect change
reimar
parents:
24311
diff
changeset
|
1163 vo_x11_sizehint(x, y, width, height, 0); |
13843 | 1164 if (vo_fs) { |
1165 vo_old_x = x; | |
1166 vo_old_y = y; | |
1167 vo_old_width = width; | |
1168 vo_old_height = height; | |
1169 } | |
1170 else | |
13871 | 1171 { |
1172 vo_dwidth = width; | |
1173 vo_dheight = height; | |
13843 | 1174 XMoveResizeWindow(mDisplay, vo_window, x, y, width, height); |
13871 | 1175 } |
13843 | 1176 } |
1177 | |
12582 | 1178 void vo_x11_sizehint(int x, int y, int width, int height, int max) |
4993 | 1179 { |
24311
0ff0253c8e00
Cosmetics: set vo_hint.flags at more consistent places (directly before
reimar
parents:
23875
diff
changeset
|
1180 vo_hint.flags = 0; |
12582 | 1181 if (vo_keepaspect) |
1182 { | |
1183 vo_hint.flags |= PAspect; | |
1184 vo_hint.min_aspect.x = width; | |
1185 vo_hint.min_aspect.y = height; | |
1186 vo_hint.max_aspect.x = width; | |
1187 vo_hint.max_aspect.y = height; | |
1188 } | |
8692
604f0cde816c
X11 window aspect patch by Arnaud Boulan <boulan@iie.cnam.fr>
attila
parents:
8676
diff
changeset
|
1189 |
24311
0ff0253c8e00
Cosmetics: set vo_hint.flags at more consistent places (directly before
reimar
parents:
23875
diff
changeset
|
1190 vo_hint.flags |= PPosition | PSize; |
12582 | 1191 vo_hint.x = x; |
1192 vo_hint.y = y; | |
1193 vo_hint.width = width; | |
1194 vo_hint.height = height; | |
1195 if (max) | |
1196 { | |
24311
0ff0253c8e00
Cosmetics: set vo_hint.flags at more consistent places (directly before
reimar
parents:
23875
diff
changeset
|
1197 vo_hint.flags |= PMaxSize; |
12582 | 1198 vo_hint.max_width = width; |
1199 vo_hint.max_height = height; | |
1200 } else | |
1201 { | |
1202 vo_hint.max_width = 0; | |
1203 vo_hint.max_height = 0; | |
1204 } | |
11995 | 1205 |
21938 | 1206 // Set minimum height/width to 4 to avoid off-by-one errors |
1207 // and because mga_vid requires a minimal size of 4 pixels. | |
24311
0ff0253c8e00
Cosmetics: set vo_hint.flags at more consistent places (directly before
reimar
parents:
23875
diff
changeset
|
1208 vo_hint.flags |= PMinSize; |
12582 | 1209 vo_hint.min_width = vo_hint.min_height = 4; |
11995 | 1210 |
24311
0ff0253c8e00
Cosmetics: set vo_hint.flags at more consistent places (directly before
reimar
parents:
23875
diff
changeset
|
1211 vo_hint.flags |= PWinGravity; |
12582 | 1212 vo_hint.win_gravity = StaticGravity; |
1213 XSetWMNormalHints(mDisplay, vo_window, &vo_hint); | |
4993 | 1214 } |
1215 | |
10587
382bf4771ee7
moved lot of global variables into static ones (and some minor spelling fixes)
alex
parents:
10570
diff
changeset
|
1216 static int vo_x11_get_gnome_layer(Display * mDisplay, Window win) |
8866 | 1217 { |
12582 | 1218 Atom type; |
1219 int format; | |
1220 unsigned long nitems; | |
1221 unsigned long bytesafter; | |
1222 unsigned short *args = NULL; | |
8866 | 1223 |
12582 | 1224 if (XGetWindowProperty(mDisplay, win, XA_WIN_LAYER, 0, 16384, |
1225 False, AnyPropertyType, &type, &format, &nitems, | |
1226 &bytesafter, | |
1227 (unsigned char **) &args) == Success | |
1228 && nitems > 0 && args) | |
1229 { | |
1230 mp_msg(MSGT_VO, MSGL_V, "[x11] original window layer is %d.\n", | |
1231 *args); | |
1232 return *args; | |
1233 } | |
1234 return WIN_LAYER_NORMAL; | |
8866 | 1235 } |
1236 | |
10757
3aea64e0d6d9
Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents:
10754
diff
changeset
|
1237 // |
12582 | 1238 Window vo_x11_create_smooth_window(Display * mDisplay, Window mRoot, |
1239 Visual * vis, int x, int y, | |
1240 unsigned int width, unsigned int height, | |
1241 int depth, Colormap col_map) | |
10757
3aea64e0d6d9
Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents:
10754
diff
changeset
|
1242 { |
12582 | 1243 unsigned long xswamask = CWBackingStore | CWBorderPixel; |
1244 XSetWindowAttributes xswa; | |
1245 Window ret_win; | |
10757
3aea64e0d6d9
Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents:
10754
diff
changeset
|
1246 |
12582 | 1247 if (col_map != CopyFromParent) |
1248 { | |
1249 xswa.colormap = col_map; | |
1250 xswamask |= CWColormap; | |
1251 } | |
1252 xswa.background_pixel = 0; | |
1253 xswa.border_pixel = 0; | |
1254 xswa.backing_store = Always; | |
1255 xswa.bit_gravity = StaticGravity; | |
1256 | |
1257 ret_win = | |
1258 XCreateWindow(mDisplay, mRootWin, x, y, width, height, 0, depth, | |
1259 CopyFromParent, vis, xswamask, &xswa); | |
18149
163fe5c2577d
Register for window-manager delete window events and quit MPlayer.
reimar
parents:
18116
diff
changeset
|
1260 XSetWMProtocols(mDisplay, ret_win, &XAWM_DELETE_WINDOW, 1); |
12582 | 1261 if (!f_gc) |
1262 f_gc = XCreateGC(mDisplay, ret_win, 0, 0); | |
1263 XSetForeground(mDisplay, f_gc, 0); | |
1264 | |
1265 return ret_win; | |
10757
3aea64e0d6d9
Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents:
10754
diff
changeset
|
1266 } |
12582 | 1267 |
23655
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1268 /** |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1269 * \brief create and setup a window suitable for display |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1270 * \param vis Visual to use for creating the window |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1271 * \param x x position of window |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1272 * \param y y position of window |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1273 * \param width width of window |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1274 * \param height height of window |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1275 * \param flags flags for window creation. |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1276 * Only VOFLAG_FULLSCREEN is supported so far. |
23823
513293585949
document "default" behaviour if CopyFromParent is passed as colormap
attila
parents:
23660
diff
changeset
|
1277 * \param col_map Colourmap for window or CopyFromParent if a specific colormap isn't needed |
23655
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1278 * \param classname name to use for the classhint |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1279 * \param title title for the window |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1280 * |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1281 * This also does the grunt-work like setting Window Manager hints etc. |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1282 * If vo_window is already set it just moves and resizes it. |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1283 */ |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1284 void vo_x11_create_vo_window(XVisualInfo *vis, int x, int y, |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1285 unsigned int width, unsigned int height, int flags, |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1286 Colormap col_map, |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1287 const char *classname, const char *title) |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1288 { |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1289 if (vo_window == None) { |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1290 XSizeHints hint; |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1291 XEvent xev; |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1292 vo_fs = 0; |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1293 vo_dwidth = width; |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1294 vo_dheight = height; |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1295 vo_window = vo_x11_create_smooth_window(mDisplay, mRootWin, vis->visual, |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1296 x, y, width, height, vis->depth, col_map); |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1297 vo_x11_classhint(mDisplay, vo_window, classname); |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1298 XStoreName(mDisplay, vo_window, title); |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1299 vo_hidecursor(mDisplay, vo_window); |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1300 XSelectInput(mDisplay, vo_window, StructureNotifyMask); |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1301 hint.x = x; hint.y = y; |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1302 hint.width = width; hint.height = height; |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1303 hint.flags = PPosition | PSize; |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1304 XSetStandardProperties(mDisplay, vo_window, title, title, None, NULL, 0, &hint); |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1305 vo_x11_sizehint(x, y, width, height, 0); |
27304 | 1306 if (!vo_border) vo_x11_decoration(mDisplay, vo_window, 0); |
23655
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1307 // map window |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1308 XMapWindow(mDisplay, vo_window); |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1309 XClearWindow(mDisplay, vo_window); |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1310 // wait for map |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1311 do { |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1312 XNextEvent(mDisplay, &xev); |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1313 } while (xev.type != MapNotify || xev.xmap.event != vo_window); |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1314 XSelectInput(mDisplay, vo_window, NoEventMask); |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1315 XSync(mDisplay, False); |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1316 vo_x11_selectinput_witherr(mDisplay, vo_window, |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1317 StructureNotifyMask | KeyPressMask | PointerMotionMask | |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1318 ButtonPressMask | ButtonReleaseMask | ExposureMask); |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1319 } |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1320 if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop); |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1321 vo_x11_nofs_sizepos(vo_dx, vo_dy, width, height); |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1322 if (!!vo_fs != !!(flags & VOFLAG_FULLSCREEN)) |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1323 vo_x11_fullscreen(); |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23615
diff
changeset
|
1324 } |
10757
3aea64e0d6d9
Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents:
10754
diff
changeset
|
1325 |
12582 | 1326 void vo_x11_clearwindow_part(Display * mDisplay, Window vo_window, |
1327 int img_width, int img_height, int use_fs) | |
10757
3aea64e0d6d9
Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents:
10754
diff
changeset
|
1328 { |
12582 | 1329 int u_dheight, u_dwidth, left_ov, left_ov2; |
10765
c8fb7e2690a3
10000l. Never ever use such foolish GCC 3.x extensionscvs diff -u x11_common.c x11_common.h |more
alex
parents:
10757
diff
changeset
|
1330 |
12582 | 1331 if (!f_gc) |
1332 return; | |
10757
3aea64e0d6d9
Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents:
10754
diff
changeset
|
1333 |
12582 | 1334 u_dheight = use_fs ? vo_screenheight : vo_dheight; |
1335 u_dwidth = use_fs ? vo_screenwidth : vo_dwidth; | |
1336 if ((u_dheight <= img_height) && (u_dwidth <= img_width)) | |
1337 return; | |
10765
c8fb7e2690a3
10000l. Never ever use such foolish GCC 3.x extensionscvs diff -u x11_common.c x11_common.h |more
alex
parents:
10757
diff
changeset
|
1338 |
12582 | 1339 left_ov = (u_dheight - img_height) / 2; |
1340 left_ov2 = (u_dwidth - img_width) / 2; | |
1341 | |
1342 XFillRectangle(mDisplay, vo_window, f_gc, 0, 0, u_dwidth, left_ov); | |
1343 XFillRectangle(mDisplay, vo_window, f_gc, 0, u_dheight - left_ov - 1, | |
1344 u_dwidth, left_ov + 1); | |
10757
3aea64e0d6d9
Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents:
10754
diff
changeset
|
1345 |
12582 | 1346 if (u_dwidth > img_width) |
1347 { | |
1348 XFillRectangle(mDisplay, vo_window, f_gc, 0, left_ov, left_ov2, | |
1349 img_height); | |
1350 XFillRectangle(mDisplay, vo_window, f_gc, u_dwidth - left_ov2 - 1, | |
23660
3ab096c77b9e
Fix vo_x11_clearwindow_part: x position is one less to avoid not clearing
reimar
parents:
23655
diff
changeset
|
1351 left_ov, left_ov2 + 1, img_height); |
12582 | 1352 } |
1353 | |
1354 XFlush(mDisplay); | |
10757
3aea64e0d6d9
Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents:
10754
diff
changeset
|
1355 } |
3aea64e0d6d9
Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents:
10754
diff
changeset
|
1356 |
12582 | 1357 void vo_x11_clearwindow(Display * mDisplay, Window vo_window) |
10757
3aea64e0d6d9
Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents:
10754
diff
changeset
|
1358 { |
12582 | 1359 if (!f_gc) |
1360 return; | |
1361 XFillRectangle(mDisplay, vo_window, f_gc, 0, 0, vo_screenwidth, | |
1362 vo_screenheight); | |
1363 // | |
1364 XFlush(mDisplay); | |
10757
3aea64e0d6d9
Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents:
10754
diff
changeset
|
1365 } |
12582 | 1366 |
10757
3aea64e0d6d9
Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents:
10754
diff
changeset
|
1367 |
12582 | 1368 void vo_x11_setlayer(Display * mDisplay, Window vo_window, int layer) |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5981
diff
changeset
|
1369 { |
12582 | 1370 if (WinID >= 0) |
1371 return; | |
8864 | 1372 |
12582 | 1373 if (vo_fs_type & vo_wm_LAYER) |
1374 { | |
1375 XClientMessageEvent xev; | |
1376 | |
1377 if (!orig_layer) | |
1378 orig_layer = vo_x11_get_gnome_layer(mDisplay, vo_window); | |
8866 | 1379 |
12582 | 1380 memset(&xev, 0, sizeof(xev)); |
1381 xev.type = ClientMessage; | |
1382 xev.display = mDisplay; | |
1383 xev.window = vo_window; | |
1384 xev.message_type = XA_WIN_LAYER; | |
1385 xev.format = 32; | |
1386 xev.data.l[0] = layer ? fs_layer : orig_layer; // if not fullscreen, stay on default layer | |
1387 xev.data.l[1] = CurrentTime; | |
1388 mp_msg(MSGT_VO, MSGL_V, | |
17366 | 1389 "[x11] Layered style stay on top (layer %ld).\n", |
12582 | 1390 xev.data.l[0]); |
1391 XSendEvent(mDisplay, mRootWin, False, SubstructureNotifyMask, | |
1392 (XEvent *) & xev); | |
1393 } else if (vo_fs_type & vo_wm_NETWM) | |
1394 { | |
1395 XClientMessageEvent xev; | |
1396 char *state; | |
8645 | 1397 |
12582 | 1398 memset(&xev, 0, sizeof(xev)); |
1399 xev.type = ClientMessage; | |
1400 xev.message_type = XA_NET_WM_STATE; | |
1401 xev.display = mDisplay; | |
1402 xev.window = vo_window; | |
1403 xev.format = 32; | |
1404 xev.data.l[0] = layer; | |
9317
c7f5df43b937
- support command line parameter -fstype, eg. -fstype layer=12,above,fullscreen
filon
parents:
9217
diff
changeset
|
1405 |
12582 | 1406 if (vo_fs_type & vo_wm_STAYS_ON_TOP) |
1407 xev.data.l[1] = XA_NET_WM_STATE_STAYS_ON_TOP; | |
1408 else if (vo_fs_type & vo_wm_ABOVE) | |
1409 xev.data.l[1] = XA_NET_WM_STATE_ABOVE; | |
1410 else if (vo_fs_type & vo_wm_FULLSCREEN) | |
1411 xev.data.l[1] = XA_NET_WM_STATE_FULLSCREEN; | |
1412 else if (vo_fs_type & vo_wm_BELOW) | |
21938 | 1413 // This is not fallback. We can safely assume that the situation |
1414 // where only NETWM_STATE_BELOW is supported doesn't exist. | |
12582 | 1415 xev.data.l[1] = XA_NET_WM_STATE_BELOW; |
1416 | |
1417 XSendEvent(mDisplay, mRootWin, False, SubstructureRedirectMask, | |
1418 (XEvent *) & xev); | |
1419 state = XGetAtomName(mDisplay, xev.data.l[1]); | |
1420 mp_msg(MSGT_VO, MSGL_V, | |
1421 "[x11] NET style stay on top (layer %d). Using state %s.\n", | |
1422 layer, state); | |
1423 XFree(state); | |
1424 } | |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5981
diff
changeset
|
1425 } |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5981
diff
changeset
|
1426 |
10587
382bf4771ee7
moved lot of global variables into static ones (and some minor spelling fixes)
alex
parents:
10570
diff
changeset
|
1427 static int vo_x11_get_fs_type(int supported) |
9317
c7f5df43b937
- support command line parameter -fstype, eg. -fstype layer=12,above,fullscreen
filon
parents:
9217
diff
changeset
|
1428 { |
12582 | 1429 int i; |
1430 int type = supported; | |
1431 | |
1432 if (vo_fstype_list) | |
9317
c7f5df43b937
- support command line parameter -fstype, eg. -fstype layer=12,above,fullscreen
filon
parents:
9217
diff
changeset
|
1433 { |
12582 | 1434 i = 0; |
1435 for (i = 0; vo_fstype_list[i]; i++) | |
1436 { | |
1437 int neg = 0; | |
1438 char *arg = vo_fstype_list[i]; | |
1439 | |
1440 if (vo_fstype_list[i][0] == '-') | |
1441 { | |
1442 neg = 1; | |
1443 arg = vo_fstype_list[i] + 1; | |
1444 } | |
1445 | |
1446 if (!strncmp(arg, "layer", 5)) | |
1447 { | |
1448 if (!neg && (arg[5] == '=')) | |
1449 { | |
1450 char *endptr = NULL; | |
1451 int layer = strtol(vo_fstype_list[i] + 6, &endptr, 10); | |
9317
c7f5df43b937
- support command line parameter -fstype, eg. -fstype layer=12,above,fullscreen
filon
parents:
9217
diff
changeset
|
1452 |
12582 | 1453 if (endptr && *endptr == '\0' && layer >= 0 |
1454 && layer <= 15) | |
1455 fs_layer = layer; | |
1456 } | |
1457 if (neg) | |
1458 type &= ~vo_wm_LAYER; | |
1459 else | |
1460 type |= vo_wm_LAYER; | |
1461 } else if (!strcmp(arg, "above")) | |
1462 { | |
1463 if (neg) | |
1464 type &= ~vo_wm_ABOVE; | |
1465 else | |
1466 type |= vo_wm_ABOVE; | |
1467 } else if (!strcmp(arg, "fullscreen")) | |
1468 { | |
1469 if (neg) | |
1470 type &= ~vo_wm_FULLSCREEN; | |
1471 else | |
1472 type |= vo_wm_FULLSCREEN; | |
1473 } else if (!strcmp(arg, "stays_on_top")) | |
1474 { | |
1475 if (neg) | |
1476 type &= ~vo_wm_STAYS_ON_TOP; | |
1477 else | |
1478 type |= vo_wm_STAYS_ON_TOP; | |
1479 } else if (!strcmp(arg, "below")) | |
1480 { | |
1481 if (neg) | |
1482 type &= ~vo_wm_BELOW; | |
1483 else | |
1484 type |= vo_wm_BELOW; | |
1485 } else if (!strcmp(arg, "netwm")) | |
1486 { | |
1487 if (neg) | |
1488 type &= ~vo_wm_NETWM; | |
1489 else | |
1490 type |= vo_wm_NETWM; | |
1491 } else if (!strcmp(arg, "none")) | |
1492 return 0; | |
9317
c7f5df43b937
- support command line parameter -fstype, eg. -fstype layer=12,above,fullscreen
filon
parents:
9217
diff
changeset
|
1493 } |
c7f5df43b937
- support command line parameter -fstype, eg. -fstype layer=12,above,fullscreen
filon
parents:
9217
diff
changeset
|
1494 } |
5919 | 1495 |
12582 | 1496 return type; |
4981 | 1497 } |
1498 | |
12582 | 1499 void vo_x11_fullscreen(void) |
11542 | 1500 { |
12582 | 1501 int x, y, w, h; |
1502 | |
1503 if (WinID >= 0 || vo_fs_flip) | |
1504 return; | |
1505 | |
1506 if (vo_fs) | |
1507 { | |
1508 // fs->win | |
12796
24075685789b
This fixes the problems that originated from my ewmh
rtognimp
parents:
12582
diff
changeset
|
1509 if ( ! (vo_fs_type & vo_wm_FULLSCREEN) ) // not needed with EWMH fs |
24075685789b
This fixes the problems that originated from my ewmh
rtognimp
parents:
12582
diff
changeset
|
1510 { |
12798
33423862b159
Indentation fix from previous patch, as discussed on IRC.
rtognimp
parents:
12796
diff
changeset
|
1511 x = vo_old_x; |
33423862b159
Indentation fix from previous patch, as discussed on IRC.
rtognimp
parents:
12796
diff
changeset
|
1512 y = vo_old_y; |
33423862b159
Indentation fix from previous patch, as discussed on IRC.
rtognimp
parents:
12796
diff
changeset
|
1513 w = vo_old_width; |
33423862b159
Indentation fix from previous patch, as discussed on IRC.
rtognimp
parents:
12796
diff
changeset
|
1514 h = vo_old_height; |
33423862b159
Indentation fix from previous patch, as discussed on IRC.
rtognimp
parents:
12796
diff
changeset
|
1515 } |
12796
24075685789b
This fixes the problems that originated from my ewmh
rtognimp
parents:
12582
diff
changeset
|
1516 |
24075685789b
This fixes the problems that originated from my ewmh
rtognimp
parents:
12582
diff
changeset
|
1517 vo_x11_ewmh_fullscreen(_NET_WM_STATE_REMOVE); // removes fullscreen state if wm supports EWMH |
24075685789b
This fixes the problems that originated from my ewmh
rtognimp
parents:
12582
diff
changeset
|
1518 vo_fs = VO_FALSE; |
12582 | 1519 } else |
1520 { | |
1521 // win->fs | |
1522 vo_x11_ewmh_fullscreen(_NET_WM_STATE_ADD); // sends fullscreen state to be added if wm supports EWMH | |
1523 | |
12796
24075685789b
This fixes the problems that originated from my ewmh
rtognimp
parents:
12582
diff
changeset
|
1524 vo_fs = VO_TRUE; |
24075685789b
This fixes the problems that originated from my ewmh
rtognimp
parents:
12582
diff
changeset
|
1525 if ( ! (vo_fs_type & vo_wm_FULLSCREEN) ) // not needed with EWMH fs |
24075685789b
This fixes the problems that originated from my ewmh
rtognimp
parents:
12582
diff
changeset
|
1526 { |
12798
33423862b159
Indentation fix from previous patch, as discussed on IRC.
rtognimp
parents:
12796
diff
changeset
|
1527 vo_old_x = vo_dx; |
33423862b159
Indentation fix from previous patch, as discussed on IRC.
rtognimp
parents:
12796
diff
changeset
|
1528 vo_old_y = vo_dy; |
33423862b159
Indentation fix from previous patch, as discussed on IRC.
rtognimp
parents:
12796
diff
changeset
|
1529 vo_old_width = vo_dwidth; |
33423862b159
Indentation fix from previous patch, as discussed on IRC.
rtognimp
parents:
12796
diff
changeset
|
1530 vo_old_height = vo_dheight; |
23875
df05ff41590e
make sure update_xinerama_info is always called even when using the
reimar
parents:
23823
diff
changeset
|
1531 } |
18116 | 1532 update_xinerama_info(); |
1533 x = xinerama_x; | |
1534 y = xinerama_y; | |
12798
33423862b159
Indentation fix from previous patch, as discussed on IRC.
rtognimp
parents:
12796
diff
changeset
|
1535 w = vo_screenwidth; |
33423862b159
Indentation fix from previous patch, as discussed on IRC.
rtognimp
parents:
12796
diff
changeset
|
1536 h = vo_screenheight; |
12582 | 1537 } |
1538 { | |
1539 long dummy; | |
1540 | |
1541 XGetWMNormalHints(mDisplay, vo_window, &vo_hint, &dummy); | |
1542 if (!(vo_hint.flags & PWinGravity)) | |
1543 old_gravity = NorthWestGravity; | |
1544 else | |
1545 old_gravity = vo_hint.win_gravity; | |
1546 } | |
1547 if (vo_wm_type == 0 && !(vo_fsmode & 16)) | |
1548 { | |
1549 XUnmapWindow(mDisplay, vo_window); // required for MWM | |
1550 XWithdrawWindow(mDisplay, vo_window, mScreen); | |
1551 vo_fs_flip = 1; | |
1552 } | |
1553 | |
12796
24075685789b
This fixes the problems that originated from my ewmh
rtognimp
parents:
12582
diff
changeset
|
1554 if ( ! (vo_fs_type & vo_wm_FULLSCREEN) ) // not needed with EWMH fs |
24075685789b
This fixes the problems that originated from my ewmh
rtognimp
parents:
12582
diff
changeset
|
1555 { |
27303
690ba711bda8
Make vo_x11_fullscreen not break vo_border (proper support still needs vo changes)
reimar
parents:
27029
diff
changeset
|
1556 vo_x11_decoration(mDisplay, vo_window, vo_border && !vo_fs); |
12798
33423862b159
Indentation fix from previous patch, as discussed on IRC.
rtognimp
parents:
12796
diff
changeset
|
1557 vo_x11_sizehint(x, y, w, h, 0); |
33423862b159
Indentation fix from previous patch, as discussed on IRC.
rtognimp
parents:
12796
diff
changeset
|
1558 vo_x11_setlayer(mDisplay, vo_window, vo_fs); |
12582 | 1559 |
1560 | |
12798
33423862b159
Indentation fix from previous patch, as discussed on IRC.
rtognimp
parents:
12796
diff
changeset
|
1561 XMoveResizeWindow(mDisplay, vo_window, x, y, w, h); |
12796
24075685789b
This fixes the problems that originated from my ewmh
rtognimp
parents:
12582
diff
changeset
|
1562 } |
21938 | 1563 /* some WMs lose ontop after fullscreen */ |
14244
9b03ad0254ae
Fix ontop for some WMs that lose ontop state after fullscreen event.
al
parents:
14207
diff
changeset
|
1564 if ((!(vo_fs)) & vo_ontop) |
9b03ad0254ae
Fix ontop for some WMs that lose ontop state after fullscreen event.
al
parents:
14207
diff
changeset
|
1565 vo_x11_setlayer(mDisplay, vo_window, vo_ontop); |
9b03ad0254ae
Fix ontop for some WMs that lose ontop state after fullscreen event.
al
parents:
14207
diff
changeset
|
1566 |
12582 | 1567 XMapRaised(mDisplay, vo_window); |
18715
30d7ddf08889
Fix window position when changing videos while in fullscreen and for
reimar
parents:
18508
diff
changeset
|
1568 if ( ! (vo_fs_type & vo_wm_FULLSCREEN) ) // some WMs change window pos on map |
30d7ddf08889
Fix window position when changing videos while in fullscreen and for
reimar
parents:
18508
diff
changeset
|
1569 XMoveResizeWindow(mDisplay, vo_window, x, y, w, h); |
12582 | 1570 XRaiseWindow(mDisplay, vo_window); |
1571 XFlush(mDisplay); | |
1572 } | |
1573 | |
1574 void vo_x11_ontop(void) | |
1575 { | |
1576 vo_ontop = (!(vo_ontop)); | |
1577 | |
1578 vo_x11_setlayer(mDisplay, vo_window, vo_ontop); | |
11542 | 1579 } |
1580 | |
27306
7a650839fc10
Enable runtime border/window decorations-toggling for Linux gl and gl2 vos.
reimar
parents:
27304
diff
changeset
|
1581 void vo_x11_border(void) |
7a650839fc10
Enable runtime border/window decorations-toggling for Linux gl and gl2 vos.
reimar
parents:
27304
diff
changeset
|
1582 { |
7a650839fc10
Enable runtime border/window decorations-toggling for Linux gl and gl2 vos.
reimar
parents:
27304
diff
changeset
|
1583 vo_border = !vo_border; |
7a650839fc10
Enable runtime border/window decorations-toggling for Linux gl and gl2 vos.
reimar
parents:
27304
diff
changeset
|
1584 vo_x11_decoration(mDisplay, vo_window, vo_border && !vo_fs); |
7a650839fc10
Enable runtime border/window decorations-toggling for Linux gl and gl2 vos.
reimar
parents:
27304
diff
changeset
|
1585 } |
7a650839fc10
Enable runtime border/window decorations-toggling for Linux gl and gl2 vos.
reimar
parents:
27304
diff
changeset
|
1586 |
9695 | 1587 /* |
1588 * XScreensaver stuff | |
1589 */ | |
1590 | |
25608
3ada48a71450
Use a screensaver_off variable to save current state and avoid
reimar
parents:
25482
diff
changeset
|
1591 static int screensaver_off; |
12031
0c2b8b731d42
Use system clock for xscreensaver pings (Tobias Diedrich).
diego
parents:
11995
diff
changeset
|
1592 static unsigned int time_last; |
9695 | 1593 |
12031
0c2b8b731d42
Use system clock for xscreensaver pings (Tobias Diedrich).
diego
parents:
11995
diff
changeset
|
1594 void xscreensaver_heartbeat(void) |
9695 | 1595 { |
12031
0c2b8b731d42
Use system clock for xscreensaver pings (Tobias Diedrich).
diego
parents:
11995
diff
changeset
|
1596 unsigned int time = GetTimerMS(); |
9695 | 1597 |
25609
dc64735e7391
Remove most of the messy screensaver code in favour of only XResetScreenSaver
reimar
parents:
25608
diff
changeset
|
1598 if (mDisplay && screensaver_off && (time - time_last) > 30000) |
12582 | 1599 { |
1600 time_last = time; | |
9695 | 1601 |
25609
dc64735e7391
Remove most of the messy screensaver code in favour of only XResetScreenSaver
reimar
parents:
25608
diff
changeset
|
1602 XResetScreenSaver(mDisplay); |
9695 | 1603 } |
1604 } | |
1605 | |
25466 | 1606 static int xss_suspend(Bool suspend) |
1607 { | |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
1608 #ifndef CONFIG_XSS |
25466 | 1609 return 0; |
1610 #else | |
1611 int event, error, major, minor; | |
1612 if (XScreenSaverQueryExtension(mDisplay, &event, &error) != True || | |
1613 XScreenSaverQueryVersion(mDisplay, &major, &minor) != True) | |
1614 return 0; | |
27029
e8c49e69f46f
Add parentheses to expression to avoid the warning:
diego
parents:
26755
diff
changeset
|
1615 if (major < 1 || (major == 1 && minor < 1)) |
25466 | 1616 return 0; |
1617 XScreenSaverSuspend(mDisplay, suspend); | |
1618 return 1; | |
1619 #endif | |
1620 } | |
1621 | |
9695 | 1622 /* |
1623 * End of XScreensaver stuff | |
1624 */ | |
1625 | |
12582 | 1626 void saver_on(Display * mDisplay) |
1627 { | |
324 | 1628 |
25608
3ada48a71450
Use a screensaver_off variable to save current state and avoid
reimar
parents:
25482
diff
changeset
|
1629 if (!screensaver_off) |
3ada48a71450
Use a screensaver_off variable to save current state and avoid
reimar
parents:
25482
diff
changeset
|
1630 return; |
3ada48a71450
Use a screensaver_off variable to save current state and avoid
reimar
parents:
25482
diff
changeset
|
1631 screensaver_off = 0; |
25466 | 1632 if (xss_suspend(False)) |
1633 return; | |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
1634 #ifdef CONFIG_XDPMS |
324 | 1635 if (dpms_disabled) |
1636 { | |
25447 | 1637 int nothing; |
12582 | 1638 if (DPMSQueryExtension(mDisplay, ¬hing, ¬hing)) |
1639 { | |
1640 if (!DPMSEnable(mDisplay)) | |
1641 { // restoring power saving settings | |
1642 mp_msg(MSGT_VO, MSGL_WARN, "DPMS not available?\n"); | |
1643 } else | |
1644 { | |
741 | 1645 // DPMS does not seem to be enabled unless we call DPMSInfo |
12582 | 1646 BOOL onoff; |
1647 CARD16 state; | |
1648 | |
1649 DPMSForceLevel(mDisplay, DPMSModeOn); | |
1650 DPMSInfo(mDisplay, &state, &onoff); | |
1651 if (onoff) | |
1652 { | |
13946 | 1653 mp_msg(MSGT_VO, MSGL_V, |
12582 | 1654 "Successfully enabled DPMS\n"); |
1655 } else | |
1656 { | |
1657 mp_msg(MSGT_VO, MSGL_WARN, "Could not enable DPMS\n"); | |
741 | 1658 } |
1659 } | |
12582 | 1660 } |
1661 dpms_disabled = 0; | |
324 | 1662 } |
1345
be674b95b485
x11_common does not compile, when the XDPMS extension is not available on the
jkeil
parents:
1266
diff
changeset
|
1663 #endif |
324 | 1664 } |
1665 | |
12582 | 1666 void saver_off(Display * mDisplay) |
1667 { | |
1345
be674b95b485
x11_common does not compile, when the XDPMS extension is not available on the
jkeil
parents:
1266
diff
changeset
|
1668 int nothing; |
324 | 1669 |
25608
3ada48a71450
Use a screensaver_off variable to save current state and avoid
reimar
parents:
25482
diff
changeset
|
1670 if (screensaver_off) |
3ada48a71450
Use a screensaver_off variable to save current state and avoid
reimar
parents:
25482
diff
changeset
|
1671 return; |
3ada48a71450
Use a screensaver_off variable to save current state and avoid
reimar
parents:
25482
diff
changeset
|
1672 screensaver_off = 1; |
25466 | 1673 if (xss_suspend(True)) |
1674 return; | |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
1675 #ifdef CONFIG_XDPMS |
324 | 1676 if (DPMSQueryExtension(mDisplay, ¬hing, ¬hing)) |
1677 { | |
12582 | 1678 BOOL onoff; |
1679 CARD16 state; | |
1680 | |
1681 DPMSInfo(mDisplay, &state, &onoff); | |
1682 if (onoff) | |
1683 { | |
1684 Status stat; | |
1685 | |
13946 | 1686 mp_msg(MSGT_VO, MSGL_V, "Disabling DPMS\n"); |
12582 | 1687 dpms_disabled = 1; |
1688 stat = DPMSDisable(mDisplay); // monitor powersave off | |
1689 mp_msg(MSGT_VO, MSGL_V, "DPMSDisable stat: %d\n", stat); | |
1690 } | |
324 | 1691 } |
1345
be674b95b485
x11_common does not compile, when the XDPMS extension is not available on the
jkeil
parents:
1266
diff
changeset
|
1692 #endif |
326 | 1693 } |
448
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
440
diff
changeset
|
1694 |
6953
ce67cc1f0beb
ignore BadAccess error at XSelectInput() (grabbing mouse etc) with warning
arpi
parents:
6401
diff
changeset
|
1695 static XErrorHandler old_handler = NULL; |
ce67cc1f0beb
ignore BadAccess error at XSelectInput() (grabbing mouse etc) with warning
arpi
parents:
6401
diff
changeset
|
1696 static int selectinput_err = 0; |
12582 | 1697 static int x11_selectinput_errorhandler(Display * display, |
1698 XErrorEvent * event) | |
6953
ce67cc1f0beb
ignore BadAccess error at XSelectInput() (grabbing mouse etc) with warning
arpi
parents:
6401
diff
changeset
|
1699 { |
12582 | 1700 if (event->error_code == BadAccess) |
1701 { | |
1702 selectinput_err = 1; | |
1703 mp_msg(MSGT_VO, MSGL_ERR, | |
1704 "X11 error: BadAccess during XSelectInput Call\n"); | |
1705 mp_msg(MSGT_VO, MSGL_ERR, | |
1706 "X11 error: The 'ButtonPressMask' mask of specified window has probably already used by another appication (see man XSelectInput)\n"); | |
21938 | 1707 /* If you think MPlayer should shutdown with this error, |
1708 * comment out the following line */ | |
12582 | 1709 return 0; |
1710 } | |
1711 if (old_handler != NULL) | |
1712 old_handler(display, event); | |
1713 else | |
1714 x11_errorhandler(display, event); | |
1715 return 0; | |
6953
ce67cc1f0beb
ignore BadAccess error at XSelectInput() (grabbing mouse etc) with warning
arpi
parents:
6401
diff
changeset
|
1716 } |
3990 | 1717 |
12582 | 1718 void vo_x11_selectinput_witherr(Display * display, Window w, |
1719 long event_mask) | |
6953
ce67cc1f0beb
ignore BadAccess error at XSelectInput() (grabbing mouse etc) with warning
arpi
parents:
6401
diff
changeset
|
1720 { |
12582 | 1721 XSync(display, False); |
1722 old_handler = XSetErrorHandler(x11_selectinput_errorhandler); | |
1723 selectinput_err = 0; | |
1724 if (vo_nomouse_input) | |
1725 { | |
1726 XSelectInput(display, w, | |
1727 event_mask & | |
1728 (~(ButtonPressMask | ButtonReleaseMask))); | |
1729 } else | |
1730 { | |
1731 XSelectInput(display, w, event_mask); | |
1732 } | |
1733 XSync(display, False); | |
1734 XSetErrorHandler(old_handler); | |
1735 if (selectinput_err) | |
1736 { | |
1737 mp_msg(MSGT_VO, MSGL_ERR, | |
1738 "X11 error: MPlayer discards mouse control (reconfiguring)\n"); | |
1739 XSelectInput(display, w, | |
1740 event_mask & | |
1741 (~ | |
1742 (ButtonPressMask | ButtonReleaseMask | | |
1743 PointerMotionMask))); | |
1744 } | |
6953
ce67cc1f0beb
ignore BadAccess error at XSelectInput() (grabbing mouse etc) with warning
arpi
parents:
6401
diff
changeset
|
1745 } |
3990 | 1746 |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
1747 #ifdef CONFIG_XF86VM |
12582 | 1748 void vo_vm_switch(uint32_t X, uint32_t Y, int *modeline_width, |
1749 int *modeline_height) | |
4425
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
1750 { |
13828
b4ad5f0b550d
Fix erroneus extern declarations, fix wrong signedness of some vars
atmos4
parents:
13787
diff
changeset
|
1751 int vm_event, vm_error; |
b4ad5f0b550d
Fix erroneus extern declarations, fix wrong signedness of some vars
atmos4
parents:
13787
diff
changeset
|
1752 int vm_ver, vm_rev; |
12582 | 1753 int i, j, have_vm = 0; |
4425
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
1754 |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
1755 int modecount; |
12582 | 1756 |
1757 if (XF86VidModeQueryExtension(mDisplay, &vm_event, &vm_error)) | |
1758 { | |
1759 XF86VidModeQueryVersion(mDisplay, &vm_ver, &vm_rev); | |
18508 | 1760 mp_msg(MSGT_VO, MSGL_V, "XF86VidMode extension v%i.%i\n", vm_ver, |
12582 | 1761 vm_rev); |
1762 have_vm = 1; | |
4425
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
1763 } else |
12582 | 1764 mp_msg(MSGT_VO, MSGL_WARN, |
18508 | 1765 "XF86VidMode extension not available.\n"); |
12582 | 1766 |
1767 if (have_vm) | |
1768 { | |
1769 if (vidmodes == NULL) | |
1770 XF86VidModeGetAllModeLines(mDisplay, mScreen, &modecount, | |
1771 &vidmodes); | |
1772 j = 0; | |
1773 *modeline_width = vidmodes[0]->hdisplay; | |
1774 *modeline_height = vidmodes[0]->vdisplay; | |
4425
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
1775 |
12582 | 1776 for (i = 1; i < modecount; i++) |
1777 if ((vidmodes[i]->hdisplay >= X) | |
1778 && (vidmodes[i]->vdisplay >= Y)) | |
1779 if ((vidmodes[i]->hdisplay <= *modeline_width) | |
1780 && (vidmodes[i]->vdisplay <= *modeline_height)) | |
1781 { | |
1782 *modeline_width = vidmodes[i]->hdisplay; | |
1783 *modeline_height = vidmodes[i]->vdisplay; | |
1784 j = i; | |
1785 } | |
1786 | |
16793
8d4fb5469efb
Make a few more messages translatable by moving them into help_mp-en.h.
diego
parents:
16301
diff
changeset
|
1787 mp_msg(MSGT_VO, MSGL_INFO, MSGTR_SelectedVideoMode, |
12582 | 1788 *modeline_width, *modeline_height, X, Y); |
1789 XF86VidModeLockModeSwitch(mDisplay, mScreen, 0); | |
1790 XF86VidModeSwitchToMode(mDisplay, mScreen, vidmodes[j]); | |
1791 XF86VidModeSwitchToMode(mDisplay, mScreen, vidmodes[j]); | |
1792 X = (vo_screenwidth - *modeline_width) / 2; | |
1793 Y = (vo_screenheight - *modeline_height) / 2; | |
1794 XF86VidModeSetViewPort(mDisplay, mScreen, X, Y); | |
4425
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
1795 } |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
1796 } |
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
1797 |
12582 | 1798 void vo_vm_close(Display * dpy) |
4425
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
1799 { |
27343 | 1800 #ifdef CONFIG_GUI |
12582 | 1801 if (vidmodes != NULL && vo_window != None) |
1802 #else | |
1803 if (vidmodes != NULL) | |
1804 #endif | |
1805 { | |
1806 int i, modecount; | |
1807 int screen; | |
1808 | |
1809 screen = DefaultScreen(dpy); | |
5019 | 1810 |
12582 | 1811 free(vidmodes); |
1812 vidmodes = NULL; | |
1813 XF86VidModeGetAllModeLines(mDisplay, mScreen, &modecount, | |
1814 &vidmodes); | |
1815 for (i = 0; i < modecount; i++) | |
1816 if ((vidmodes[i]->hdisplay == vo_screenwidth) | |
1817 && (vidmodes[i]->vdisplay == vo_screenheight)) | |
1818 { | |
1819 mp_msg(MSGT_VO, MSGL_INFO, | |
1820 "Returning to original mode %dx%d\n", | |
1821 vo_screenwidth, vo_screenheight); | |
1822 break; | |
1823 } | |
5019 | 1824 |
12582 | 1825 XF86VidModeSwitchToMode(dpy, screen, vidmodes[i]); |
1826 XF86VidModeSwitchToMode(dpy, screen, vidmodes[i]); | |
1827 free(vidmodes); | |
1828 vidmodes = NULL; | |
1829 } | |
4425
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
1830 } |
3990 | 1831 #endif |
4425
6144f63cbaa1
common -vm code, patch by Santi Bjar <tiarda@yahoo.es>
arpi
parents:
4181
diff
changeset
|
1832 |
12582 | 1833 #endif /* X11_FULLSCREEN */ |
7256
ec6dd0a29d93
Add the code that chooses a good X11 truecolor visual to the vo_x11 config()
jkeil
parents:
7111
diff
changeset
|
1834 |
ec6dd0a29d93
Add the code that chooses a good X11 truecolor visual to the vo_x11 config()
jkeil
parents:
7111
diff
changeset
|
1835 |
ec6dd0a29d93
Add the code that chooses a good X11 truecolor visual to the vo_x11 config()
jkeil
parents:
7111
diff
changeset
|
1836 /* |
ec6dd0a29d93
Add the code that chooses a good X11 truecolor visual to the vo_x11 config()
jkeil
parents:
7111
diff
changeset
|
1837 * Scan the available visuals on this Display/Screen. Try to find |
ec6dd0a29d93
Add the code that chooses a good X11 truecolor visual to the vo_x11 config()
jkeil
parents:
7111
diff
changeset
|
1838 * the 'best' available TrueColor visual that has a decent color |
ec6dd0a29d93
Add the code that chooses a good X11 truecolor visual to the vo_x11 config()
jkeil
parents:
7111
diff
changeset
|
1839 * depth (at least 15bit). If there are multiple visuals with depth |
ec6dd0a29d93
Add the code that chooses a good X11 truecolor visual to the vo_x11 config()
jkeil
parents:
7111
diff
changeset
|
1840 * >= 15bit, we prefer visuals with a smaller color depth. |
ec6dd0a29d93
Add the code that chooses a good X11 truecolor visual to the vo_x11 config()
jkeil
parents:
7111
diff
changeset
|
1841 */ |
12582 | 1842 int vo_find_depth_from_visuals(Display * dpy, int screen, |
1843 Visual ** visual_return) | |
7256
ec6dd0a29d93
Add the code that chooses a good X11 truecolor visual to the vo_x11 config()
jkeil
parents:
7111
diff
changeset
|
1844 { |
12582 | 1845 XVisualInfo visual_tmpl; |
1846 XVisualInfo *visuals; | |
1847 int nvisuals, i; | |
1848 int bestvisual = -1; | |
1849 int bestvisual_depth = -1; | |
7256
ec6dd0a29d93
Add the code that chooses a good X11 truecolor visual to the vo_x11 config()
jkeil
parents:
7111
diff
changeset
|
1850 |
12582 | 1851 visual_tmpl.screen = screen; |
1852 visual_tmpl.class = TrueColor; | |
1853 visuals = XGetVisualInfo(dpy, | |
1854 VisualScreenMask | VisualClassMask, | |
1855 &visual_tmpl, &nvisuals); | |
1856 if (visuals != NULL) | |
1857 { | |
1858 for (i = 0; i < nvisuals; i++) | |
1859 { | |
1860 mp_msg(MSGT_VO, MSGL_V, | |
17366 | 1861 "vo: X11 truecolor visual %#lx, depth %d, R:%lX G:%lX B:%lX\n", |
12582 | 1862 visuals[i].visualid, visuals[i].depth, |
1863 visuals[i].red_mask, visuals[i].green_mask, | |
1864 visuals[i].blue_mask); | |
1865 /* | |
21938 | 1866 * Save the visual index and its depth, if this is the first |
12582 | 1867 * truecolor visul, or a visual that is 'preferred' over the |
21938 | 1868 * previous 'best' visual. |
12582 | 1869 */ |
1870 if (bestvisual_depth == -1 | |
1871 || (visuals[i].depth >= 15 | |
1872 && (visuals[i].depth < bestvisual_depth | |
1873 || bestvisual_depth < 15))) | |
1874 { | |
1875 bestvisual = i; | |
1876 bestvisual_depth = visuals[i].depth; | |
1877 } | |
1878 } | |
1879 | |
1880 if (bestvisual != -1 && visual_return != NULL) | |
1881 *visual_return = visuals[bestvisual].visual; | |
1882 | |
1883 XFree(visuals); | |
7256
ec6dd0a29d93
Add the code that chooses a good X11 truecolor visual to the vo_x11 config()
jkeil
parents:
7111
diff
changeset
|
1884 } |
12582 | 1885 return bestvisual_depth; |
7256
ec6dd0a29d93
Add the code that chooses a good X11 truecolor visual to the vo_x11 config()
jkeil
parents:
7111
diff
changeset
|
1886 } |
ec6dd0a29d93
Add the code that chooses a good X11 truecolor visual to the vo_x11 config()
jkeil
parents:
7111
diff
changeset
|
1887 |
7964
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1888 |
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1889 static Colormap cmap = None; |
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1890 static XColor cols[256]; |
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1891 static int cm_size, red_mask, green_mask, blue_mask; |
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1892 |
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1893 |
12582 | 1894 Colormap vo_x11_create_colormap(XVisualInfo * vinfo) |
7964
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1895 { |
12582 | 1896 unsigned k, r, g, b, ru, gu, bu, m, rv, gv, bv, rvu, gvu, bvu; |
7964
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1897 |
12582 | 1898 if (vinfo->class != DirectColor) |
1899 return XCreateColormap(mDisplay, mRootWin, vinfo->visual, | |
1900 AllocNone); | |
7964
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1901 |
12582 | 1902 /* can this function get called twice or more? */ |
1903 if (cmap) | |
1904 return cmap; | |
1905 cm_size = vinfo->colormap_size; | |
1906 red_mask = vinfo->red_mask; | |
1907 green_mask = vinfo->green_mask; | |
1908 blue_mask = vinfo->blue_mask; | |
1909 ru = (red_mask & (red_mask - 1)) ^ red_mask; | |
1910 gu = (green_mask & (green_mask - 1)) ^ green_mask; | |
1911 bu = (blue_mask & (blue_mask - 1)) ^ blue_mask; | |
1912 rvu = 65536ull * ru / (red_mask + ru); | |
1913 gvu = 65536ull * gu / (green_mask + gu); | |
1914 bvu = 65536ull * bu / (blue_mask + bu); | |
1915 r = g = b = 0; | |
1916 rv = gv = bv = 0; | |
1917 m = DoRed | DoGreen | DoBlue; | |
1918 for (k = 0; k < cm_size; k++) | |
1919 { | |
1920 int t; | |
1921 | |
1922 cols[k].pixel = r | g | b; | |
1923 cols[k].red = rv; | |
1924 cols[k].green = gv; | |
1925 cols[k].blue = bv; | |
1926 cols[k].flags = m; | |
1927 t = (r + ru) & red_mask; | |
1928 if (t < r) | |
1929 m &= ~DoRed; | |
1930 r = t; | |
1931 t = (g + gu) & green_mask; | |
1932 if (t < g) | |
1933 m &= ~DoGreen; | |
1934 g = t; | |
1935 t = (b + bu) & blue_mask; | |
1936 if (t < b) | |
1937 m &= ~DoBlue; | |
1938 b = t; | |
1939 rv += rvu; | |
1940 gv += gvu; | |
1941 bv += bvu; | |
1942 } | |
1943 cmap = XCreateColormap(mDisplay, mRootWin, vinfo->visual, AllocAll); | |
1944 XStoreColors(mDisplay, cmap, cols, cm_size); | |
1945 return cmap; | |
7964
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1946 } |
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1947 |
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1948 /* |
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1949 * Via colormaps/gamma ramps we can do gamma, brightness, contrast, |
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1950 * hue and red/green/blue intensity, but we cannot do saturation. |
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1951 * Currently only gamma, brightness and contrast are implemented. |
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1952 * Is there sufficient interest for hue and/or red/green/blue intensity? |
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1953 */ |
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1954 /* these values have range [-100,100] and are initially 0 */ |
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1955 static int vo_gamma = 0; |
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1956 static int vo_brightness = 0; |
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1957 static int vo_contrast = 0; |
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1958 |
25674
b13f792efe7b
Use a transform_color function to reduce code duplication
reimar
parents:
25626
diff
changeset
|
1959 static int transform_color(float val, |
b13f792efe7b
Use a transform_color function to reduce code duplication
reimar
parents:
25626
diff
changeset
|
1960 float brightness, float contrast, float gamma) { |
b13f792efe7b
Use a transform_color function to reduce code duplication
reimar
parents:
25626
diff
changeset
|
1961 float s = pow(val, gamma); |
b13f792efe7b
Use a transform_color function to reduce code duplication
reimar
parents:
25626
diff
changeset
|
1962 s = (s - 0.5) * contrast + 0.5; |
b13f792efe7b
Use a transform_color function to reduce code duplication
reimar
parents:
25626
diff
changeset
|
1963 s += brightness; |
b13f792efe7b
Use a transform_color function to reduce code duplication
reimar
parents:
25626
diff
changeset
|
1964 if (s < 0) |
b13f792efe7b
Use a transform_color function to reduce code duplication
reimar
parents:
25626
diff
changeset
|
1965 s = 0; |
b13f792efe7b
Use a transform_color function to reduce code duplication
reimar
parents:
25626
diff
changeset
|
1966 if (s > 1) |
b13f792efe7b
Use a transform_color function to reduce code duplication
reimar
parents:
25626
diff
changeset
|
1967 s = 1; |
b13f792efe7b
Use a transform_color function to reduce code duplication
reimar
parents:
25626
diff
changeset
|
1968 return (unsigned short) (s * 65535); |
b13f792efe7b
Use a transform_color function to reduce code duplication
reimar
parents:
25626
diff
changeset
|
1969 } |
7964
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1970 |
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1971 uint32_t vo_x11_set_equalizer(char *name, int value) |
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1972 { |
12582 | 1973 float gamma, brightness, contrast; |
1974 float rf, gf, bf; | |
1975 int k; | |
1976 | |
1977 /* | |
1978 * IMPLEMENTME: consider using XF86VidModeSetGammaRamp in the case | |
1979 * of TrueColor-ed window but be careful: | |
21938 | 1980 * Unlike the colormaps, which are private for the X client |
12582 | 1981 * who created them and thus automatically destroyed on client |
1982 * disconnect, this gamma ramp is a system-wide (X-server-wide) | |
21938 | 1983 * setting and _must_ be restored before the process exits. |
1984 * Unforunately when the process crashes (or gets killed | |
12582 | 1985 * for some reason) it is impossible to restore the setting, |
1986 * and such behaviour could be rather annoying for the users. | |
1987 */ | |
1988 if (cmap == None) | |
1989 return VO_NOTAVAIL; | |
7964
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1990 |
12582 | 1991 if (!strcasecmp(name, "brightness")) |
1992 vo_brightness = value; | |
1993 else if (!strcasecmp(name, "contrast")) | |
1994 vo_contrast = value; | |
1995 else if (!strcasecmp(name, "gamma")) | |
1996 vo_gamma = value; | |
1997 else | |
1998 return VO_NOTIMPL; | |
7964
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
1999 |
12582 | 2000 brightness = 0.01 * vo_brightness; |
2001 contrast = tan(0.0095 * (vo_contrast + 100) * M_PI / 4); | |
2002 gamma = pow(2, -0.02 * vo_gamma); | |
7964
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
2003 |
12582 | 2004 rf = (float) ((red_mask & (red_mask - 1)) ^ red_mask) / red_mask; |
2005 gf = (float) ((green_mask & (green_mask - 1)) ^ green_mask) / | |
2006 green_mask; | |
2007 bf = (float) ((blue_mask & (blue_mask - 1)) ^ blue_mask) / blue_mask; | |
7964
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
2008 |
12582 | 2009 /* now recalculate the colormap using the newly set value */ |
2010 for (k = 0; k < cm_size; k++) | |
2011 { | |
25674
b13f792efe7b
Use a transform_color function to reduce code duplication
reimar
parents:
25626
diff
changeset
|
2012 cols[k].red = transform_color(rf * k, brightness, contrast, gamma); |
b13f792efe7b
Use a transform_color function to reduce code duplication
reimar
parents:
25626
diff
changeset
|
2013 cols[k].green = transform_color(gf * k, brightness, contrast, gamma); |
b13f792efe7b
Use a transform_color function to reduce code duplication
reimar
parents:
25626
diff
changeset
|
2014 cols[k].blue = transform_color(bf * k, brightness, contrast, gamma); |
12582 | 2015 } |
2016 | |
2017 XStoreColors(mDisplay, cmap, cols, cm_size); | |
2018 XFlush(mDisplay); | |
2019 return VO_TRUE; | |
7964
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
2020 } |
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
2021 |
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
2022 uint32_t vo_x11_get_equalizer(char *name, int *value) |
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
2023 { |
12582 | 2024 if (cmap == None) |
2025 return VO_NOTAVAIL; | |
2026 if (!strcasecmp(name, "brightness")) | |
2027 *value = vo_brightness; | |
2028 else if (!strcasecmp(name, "contrast")) | |
2029 *value = vo_contrast; | |
2030 else if (!strcasecmp(name, "gamma")) | |
2031 *value = vo_gamma; | |
2032 else | |
2033 return VO_NOTIMPL; | |
2034 return VO_TRUE; | |
7964
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
2035 } |
12582 | 2036 |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
2037 #ifdef CONFIG_XV |
10359 | 2038 int vo_xv_set_eq(uint32_t xv_port, char *name, int value) |
2039 { | |
2040 XvAttribute *attributes; | |
12582 | 2041 int i, howmany, xv_atom; |
7964
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
2042 |
10359 | 2043 mp_dbg(MSGT_VO, MSGL_V, "xv_set_eq called! (%s, %d)\n", name, value); |
7964
143d730908ae
here is a somewhat generic equalizer implementation for the X11 vo drivers
arpi
parents:
7766
diff
changeset
|
2044 |
10359 | 2045 /* get available attributes */ |
2046 attributes = XvQueryPortAttributes(mDisplay, xv_port, &howmany); | |
2047 for (i = 0; i < howmany && attributes; i++) | |
12582 | 2048 if (attributes[i].flags & XvSettable) |
2049 { | |
2050 xv_atom = XInternAtom(mDisplay, attributes[i].name, True); | |
10359 | 2051 /* since we have SET_DEFAULTS first in our list, we can check if it's available |
2052 then trigger it if it's ok so that the other values are at default upon query */ | |
12582 | 2053 if (xv_atom != None) |
2054 { | |
2055 int hue = 0, port_value, port_min, port_max; | |
10359 | 2056 |
12582 | 2057 if (!strcmp(attributes[i].name, "XV_BRIGHTNESS") && |
2058 (!strcasecmp(name, "brightness"))) | |
2059 port_value = value; | |
2060 else if (!strcmp(attributes[i].name, "XV_CONTRAST") && | |
2061 (!strcasecmp(name, "contrast"))) | |
2062 port_value = value; | |
2063 else if (!strcmp(attributes[i].name, "XV_SATURATION") && | |
2064 (!strcasecmp(name, "saturation"))) | |
2065 port_value = value; | |
2066 else if (!strcmp(attributes[i].name, "XV_HUE") && | |
2067 (!strcasecmp(name, "hue"))) | |
2068 { | |
2069 port_value = value; | |
2070 hue = 1; | |
2071 } else | |
10359 | 2072 /* Note: since 22.01.2002 GATOS supports these attrs for radeons (NK) */ |
12582 | 2073 if (!strcmp(attributes[i].name, "XV_RED_INTENSITY") && |
2074 (!strcasecmp(name, "red_intensity"))) | |
2075 port_value = value; | |
2076 else if (!strcmp(attributes[i].name, "XV_GREEN_INTENSITY") | |
2077 && (!strcasecmp(name, "green_intensity"))) | |
2078 port_value = value; | |
2079 else if (!strcmp(attributes[i].name, "XV_BLUE_INTENSITY") | |
2080 && (!strcasecmp(name, "blue_intensity"))) | |
2081 port_value = value; | |
2082 else | |
2083 continue; | |
2084 | |
2085 port_min = attributes[i].min_value; | |
2086 port_max = attributes[i].max_value; | |
10359 | 2087 |
12582 | 2088 /* nvidia hue workaround */ |
2089 if (hue && port_min == 0 && port_max == 360) | |
2090 { | |
2091 port_value = | |
2092 (port_value >= | |
2093 0) ? (port_value - 100) : (port_value + 100); | |
10359 | 2094 } |
12582 | 2095 // -100 -> min |
2096 // 0 -> (max+min)/2 | |
2097 // +100 -> max | |
2098 port_value = | |
2099 (port_value + 100) * (port_max - port_min) / 200 + | |
2100 port_min; | |
2101 XvSetPortAttribute(mDisplay, xv_port, xv_atom, port_value); | |
26755
46f0b4d34fa1
cosmetics: Remove useless parentheses from from return statements.
diego
parents:
26436
diff
changeset
|
2102 return VO_TRUE; |
12582 | 2103 } |
2104 } | |
26755
46f0b4d34fa1
cosmetics: Remove useless parentheses from from return statements.
diego
parents:
26436
diff
changeset
|
2105 return VO_FALSE; |
10359 | 2106 } |
2107 | |
2108 int vo_xv_get_eq(uint32_t xv_port, char *name, int *value) | |
2109 { | |
12582 | 2110 |
10359 | 2111 XvAttribute *attributes; |
12582 | 2112 int i, howmany, xv_atom; |
10359 | 2113 |
2114 /* get available attributes */ | |
2115 attributes = XvQueryPortAttributes(mDisplay, xv_port, &howmany); | |
2116 for (i = 0; i < howmany && attributes; i++) | |
12582 | 2117 if (attributes[i].flags & XvGettable) |
2118 { | |
2119 xv_atom = XInternAtom(mDisplay, attributes[i].name, True); | |
10359 | 2120 /* since we have SET_DEFAULTS first in our list, we can check if it's available |
2121 then trigger it if it's ok so that the other values are at default upon query */ | |
12582 | 2122 if (xv_atom != None) |
2123 { | |
2124 int val, port_value = 0, port_min, port_max; | |
10359 | 2125 |
12582 | 2126 XvGetPortAttribute(mDisplay, xv_port, xv_atom, |
2127 &port_value); | |
2128 | |
2129 port_min = attributes[i].min_value; | |
2130 port_max = attributes[i].max_value; | |
2131 val = | |
2132 (port_value - port_min) * 200 / (port_max - port_min) - | |
2133 100; | |
10359 | 2134 |
12582 | 2135 if (!strcmp(attributes[i].name, "XV_BRIGHTNESS") && |
2136 (!strcasecmp(name, "brightness"))) | |
2137 *value = val; | |
2138 else if (!strcmp(attributes[i].name, "XV_CONTRAST") && | |
2139 (!strcasecmp(name, "contrast"))) | |
2140 *value = val; | |
2141 else if (!strcmp(attributes[i].name, "XV_SATURATION") && | |
2142 (!strcasecmp(name, "saturation"))) | |
2143 *value = val; | |
2144 else if (!strcmp(attributes[i].name, "XV_HUE") && | |
2145 (!strcasecmp(name, "hue"))) | |
2146 { | |
2147 /* nasty nvidia detect */ | |
2148 if (port_min == 0 && port_max == 360) | |
2149 *value = (val >= 0) ? (val - 100) : (val + 100); | |
2150 else | |
2151 *value = val; | |
2152 } else | |
10359 | 2153 /* Note: since 22.01.2002 GATOS supports these attrs for radeons (NK) */ |
12582 | 2154 if (!strcmp(attributes[i].name, "XV_RED_INTENSITY") && |
2155 (!strcasecmp(name, "red_intensity"))) | |
2156 *value = val; | |
2157 else if (!strcmp(attributes[i].name, "XV_GREEN_INTENSITY") | |
2158 && (!strcasecmp(name, "green_intensity"))) | |
2159 *value = val; | |
2160 else if (!strcmp(attributes[i].name, "XV_BLUE_INTENSITY") | |
2161 && (!strcasecmp(name, "blue_intensity"))) | |
2162 *value = val; | |
2163 else | |
2164 continue; | |
10359 | 2165 |
12582 | 2166 mp_dbg(MSGT_VO, MSGL_V, "xv_get_eq called! (%s, %d)\n", |
2167 name, *value); | |
26755
46f0b4d34fa1
cosmetics: Remove useless parentheses from from return statements.
diego
parents:
26436
diff
changeset
|
2168 return VO_TRUE; |
12582 | 2169 } |
2170 } | |
26755
46f0b4d34fa1
cosmetics: Remove useless parentheses from from return statements.
diego
parents:
26436
diff
changeset
|
2171 return VO_FALSE; |
10359 | 2172 } |
2173 | |
14742 | 2174 /** \brief contains flags changing the execution of the colorkeying code */ |
2175 xv_ck_info_t xv_ck_info = { CK_METHOD_MANUALFILL, CK_SRC_CUR }; | |
2176 unsigned long xv_colorkey; ///< The color used for manual colorkeying. | |
2177 unsigned int xv_port; ///< The selected Xv port. | |
2178 | |
2179 /** | |
2180 * \brief Interns the requested atom if it is available. | |
2181 * | |
2182 * \param atom_name String containing the name of the requested atom. | |
2183 * | |
2184 * \return Returns the atom if available, else None is returned. | |
2185 * | |
2186 */ | |
2187 static Atom xv_intern_atom_if_exists( char const * atom_name ) | |
2188 { | |
2189 XvAttribute * attributes; | |
2190 int attrib_count,i; | |
2191 Atom xv_atom = None; | |
2192 | |
2193 attributes = XvQueryPortAttributes( mDisplay, xv_port, &attrib_count ); | |
2194 if( attributes!=NULL ) | |
2195 { | |
2196 for ( i = 0; i < attrib_count; ++i ) | |
2197 { | |
2198 if ( strcmp(attributes[i].name, atom_name ) == 0 ) | |
2199 { | |
2200 xv_atom = XInternAtom( mDisplay, atom_name, False ); | |
2201 break; // found what we want, break out | |
2202 } | |
2203 } | |
2204 XFree( attributes ); | |
2205 } | |
2206 | |
2207 return xv_atom; | |
2208 } | |
15826
db966bdf6f5b
Try to set XV_SYNC_TO_VBLANK to enable vsync on non-overlay xv adapters.
reimar
parents:
15789
diff
changeset
|
2209 |
db966bdf6f5b
Try to set XV_SYNC_TO_VBLANK to enable vsync on non-overlay xv adapters.
reimar
parents:
15789
diff
changeset
|
2210 /** |
db966bdf6f5b
Try to set XV_SYNC_TO_VBLANK to enable vsync on non-overlay xv adapters.
reimar
parents:
15789
diff
changeset
|
2211 * \brief Try to enable vsync for xv. |
db966bdf6f5b
Try to set XV_SYNC_TO_VBLANK to enable vsync on non-overlay xv adapters.
reimar
parents:
15789
diff
changeset
|
2212 * \return Returns -1 if not available, 0 on failure and 1 on success. |
db966bdf6f5b
Try to set XV_SYNC_TO_VBLANK to enable vsync on non-overlay xv adapters.
reimar
parents:
15789
diff
changeset
|
2213 */ |
22886 | 2214 int vo_xv_enable_vsync(void) |
15826
db966bdf6f5b
Try to set XV_SYNC_TO_VBLANK to enable vsync on non-overlay xv adapters.
reimar
parents:
15789
diff
changeset
|
2215 { |
db966bdf6f5b
Try to set XV_SYNC_TO_VBLANK to enable vsync on non-overlay xv adapters.
reimar
parents:
15789
diff
changeset
|
2216 Atom xv_atom = xv_intern_atom_if_exists("XV_SYNC_TO_VBLANK"); |
db966bdf6f5b
Try to set XV_SYNC_TO_VBLANK to enable vsync on non-overlay xv adapters.
reimar
parents:
15789
diff
changeset
|
2217 if (xv_atom == None) |
db966bdf6f5b
Try to set XV_SYNC_TO_VBLANK to enable vsync on non-overlay xv adapters.
reimar
parents:
15789
diff
changeset
|
2218 return -1; |
db966bdf6f5b
Try to set XV_SYNC_TO_VBLANK to enable vsync on non-overlay xv adapters.
reimar
parents:
15789
diff
changeset
|
2219 return XvSetPortAttribute(mDisplay, xv_port, xv_atom, 1) == Success; |
db966bdf6f5b
Try to set XV_SYNC_TO_VBLANK to enable vsync on non-overlay xv adapters.
reimar
parents:
15789
diff
changeset
|
2220 } |
db966bdf6f5b
Try to set XV_SYNC_TO_VBLANK to enable vsync on non-overlay xv adapters.
reimar
parents:
15789
diff
changeset
|
2221 |
14742 | 2222 /** |
16958 | 2223 * \brief Get maximum supported source image dimensions. |
2224 * | |
2225 * This function does not set the variables pointed to by | |
21938 | 2226 * width and height if the information could not be retrieved, |
2227 * so the caller is reponsible for properly initializing them. | |
16958 | 2228 * |
2229 * \param width [out] The maximum width gets stored here. | |
2230 * \param height [out] The maximum height gets stored here. | |
2231 * | |
2232 */ | |
2233 void vo_xv_get_max_img_dim( uint32_t * width, uint32_t * height ) | |
2234 { | |
2235 XvEncodingInfo * encodings; | |
2236 //unsigned long num_encodings, idx; to int or too long?! | |
2237 unsigned int num_encodings, idx; | |
2238 | |
2239 XvQueryEncodings( mDisplay, xv_port, &num_encodings, &encodings); | |
2240 | |
2241 if ( encodings ) | |
2242 { | |
2243 for ( idx = 0; idx < num_encodings; ++idx ) | |
2244 { | |
2245 if ( strcmp( encodings[idx].name, "XV_IMAGE" ) == 0 ) | |
2246 { | |
2247 *width = encodings[idx].width; | |
2248 *height = encodings[idx].height; | |
2249 break; | |
2250 } | |
2251 } | |
2252 } | |
2253 | |
2254 mp_msg( MSGT_VO, MSGL_V, | |
2255 "[xv common] Maximum source image dimensions: %ux%u\n", | |
2256 *width, *height ); | |
2257 | |
2258 XvFreeEncodingInfo( encodings ); | |
2259 } | |
2260 | |
2261 /** | |
14742 | 2262 * \brief Print information about the colorkey method and source. |
2263 * | |
2264 * \param ck_handling Integer value containing the information about | |
2265 * colorkey handling (see x11_common.h). | |
2266 * | |
2267 * Outputs the content of |ck_handling| as a readable message. | |
2268 * | |
2269 */ | |
22886 | 2270 void vo_xv_print_ck_info(void) |
14742 | 2271 { |
2272 mp_msg( MSGT_VO, MSGL_V, "[xv common] " ); | |
2273 | |
2274 switch ( xv_ck_info.method ) | |
2275 { | |
2276 case CK_METHOD_NONE: | |
2277 mp_msg( MSGT_VO, MSGL_V, "Drawing no colorkey.\n" ); return; | |
2278 case CK_METHOD_AUTOPAINT: | |
2279 mp_msg( MSGT_VO, MSGL_V, "Colorkey is drawn by Xv." ); break; | |
2280 case CK_METHOD_MANUALFILL: | |
2281 mp_msg( MSGT_VO, MSGL_V, "Drawing colorkey manually." ); break; | |
2282 case CK_METHOD_BACKGROUND: | |
2283 mp_msg( MSGT_VO, MSGL_V, "Colorkey is drawn as window background." ); break; | |
2284 } | |
2285 | |
2286 mp_msg( MSGT_VO, MSGL_V, "\n[xv common] " ); | |
2287 | |
2288 switch ( xv_ck_info.source ) | |
2289 { | |
2290 case CK_SRC_CUR: | |
17366 | 2291 mp_msg( MSGT_VO, MSGL_V, "Using colorkey from Xv (0x%06lx).\n", |
14742 | 2292 xv_colorkey ); |
2293 break; | |
2294 case CK_SRC_USE: | |
2295 if ( xv_ck_info.method == CK_METHOD_AUTOPAINT ) | |
2296 { | |
2297 mp_msg( MSGT_VO, MSGL_V, | |
17366 | 2298 "Ignoring colorkey from MPlayer (0x%06lx).\n", |
14742 | 2299 xv_colorkey ); |
2300 } | |
2301 else | |
2302 { | |
2303 mp_msg( MSGT_VO, MSGL_V, | |
17366 | 2304 "Using colorkey from MPlayer (0x%06lx)." |
14742 | 2305 " Use -colorkey to change.\n", |
2306 xv_colorkey ); | |
2307 } | |
2308 break; | |
2309 case CK_SRC_SET: | |
2310 mp_msg( MSGT_VO, MSGL_V, | |
17366 | 2311 "Setting and using colorkey from MPlayer (0x%06lx)." |
14742 | 2312 " Use -colorkey to change.\n", |
2313 xv_colorkey ); | |
2314 break; | |
2315 } | |
2316 } | |
2317 /** | |
2318 * \brief Init colorkey depending on the settings in xv_ck_info. | |
2319 * | |
2320 * \return Returns 0 on failure and 1 on success. | |
2321 * | |
2322 * Sets the colorkey variable according to the CK_SRC_* and CK_METHOD_* | |
2323 * flags in xv_ck_info. | |
2324 * | |
2325 * Possiblilities: | |
2326 * * Methods | |
2327 * - manual colorkey drawing ( CK_METHOD_MANUALFILL ) | |
2328 * - set colorkey as window background ( CK_METHOD_BACKGROUND ) | |
2329 * - let Xv paint the colorkey ( CK_METHOD_AUTOPAINT ) | |
2330 * * Sources | |
2331 * - use currently set colorkey ( CK_SRC_CUR ) | |
2332 * - use colorkey in vo_colorkey ( CK_SRC_USE ) | |
2333 * - use and set colorkey in vo_colorkey ( CK_SRC_SET ) | |
2334 * | |
2335 * NOTE: If vo_colorkey has bits set after the first 3 low order bytes | |
2336 * we don't draw anything as this means it was forced to off. | |
2337 */ | |
22886 | 2338 int vo_xv_init_colorkey(void) |
14742 | 2339 { |
2340 Atom xv_atom; | |
2341 int rez; | |
2342 | |
2343 /* check if colorkeying is needed */ | |
2344 xv_atom = xv_intern_atom_if_exists( "XV_COLORKEY" ); | |
2345 | |
2346 /* if we have to deal with colorkeying ... */ | |
2347 if( xv_atom != None && !(vo_colorkey & 0xFF000000) ) | |
2348 { | |
2349 /* check if we should use the colorkey specified in vo_colorkey */ | |
2350 if ( xv_ck_info.source != CK_SRC_CUR ) | |
2351 { | |
2352 xv_colorkey = vo_colorkey; | |
2353 | |
2354 /* check if we have to set the colorkey too */ | |
2355 if ( xv_ck_info.source == CK_SRC_SET ) | |
2356 { | |
2357 xv_atom = XInternAtom(mDisplay, "XV_COLORKEY",False); | |
2358 | |
2359 rez = XvSetPortAttribute( mDisplay, xv_port, xv_atom, vo_colorkey ); | |
2360 if ( rez != Success ) | |
2361 { | |
2362 mp_msg( MSGT_VO, MSGL_FATAL, | |
2363 "[xv common] Couldn't set colorkey!\n" ); | |
2364 return 0; // error setting colorkey | |
2365 } | |
2366 } | |
2367 } | |
2368 else | |
2369 { | |
2370 int colorkey_ret; | |
2371 | |
2372 rez=XvGetPortAttribute(mDisplay,xv_port, xv_atom, &colorkey_ret); | |
2373 if ( rez == Success ) | |
2374 { | |
2375 xv_colorkey = colorkey_ret; | |
2376 } | |
2377 else | |
2378 { | |
2379 mp_msg( MSGT_VO, MSGL_FATAL, | |
2380 "[xv common] Couldn't get colorkey!" | |
2381 "Maybe the selected Xv port has no overlay.\n" ); | |
2382 return 0; // error getting colorkey | |
2383 } | |
2384 } | |
2385 | |
15186 | 2386 xv_atom = xv_intern_atom_if_exists( "XV_AUTOPAINT_COLORKEY" ); |
2387 | |
14742 | 2388 /* should we draw the colorkey ourselves or activate autopainting? */ |
2389 if ( xv_ck_info.method == CK_METHOD_AUTOPAINT ) | |
2390 { | |
2391 rez = !Success; // reset rez to something different than Success | |
2392 | |
2393 if ( xv_atom != None ) // autopaint is supported | |
2394 { | |
2395 rez = XvSetPortAttribute( mDisplay, xv_port, xv_atom, 1 ); | |
2396 } | |
2397 | |
2398 if ( rez != Success ) | |
2399 { | |
2400 // fallback to manual colorkey drawing | |
2401 xv_ck_info.method = CK_METHOD_MANUALFILL; | |
2402 } | |
2403 } | |
15186 | 2404 else // disable colorkey autopainting if supported |
2405 { | |
2406 if ( xv_atom != None ) // we have autopaint attribute | |
2407 { | |
2408 XvSetPortAttribute( mDisplay, xv_port, xv_atom, 0 ); | |
2409 } | |
2410 } | |
14742 | 2411 } |
2412 else // do no colorkey drawing at all | |
2413 { | |
2414 xv_ck_info.method = CK_METHOD_NONE; | |
2415 } /* end: should we draw colorkey */ | |
2416 | |
21938 | 2417 /* output information about the current colorkey settings */ |
14742 | 2418 vo_xv_print_ck_info(); |
2419 | |
2420 return 1; // success | |
2421 } | |
2422 | |
2423 /** | |
2424 * \brief Draw the colorkey on the video window. | |
2425 * | |
2426 * Draws the colorkey depending on the set method ( colorkey_handling ). | |
2427 * | |
21938 | 2428 * Also draws the black bars ( when the video doesn't fit the display in |
2429 * fullscreen ) separately, so they don't overlap with the video area. | |
2430 * It doesn't call XFlush. | |
14742 | 2431 * |
2432 */ | |
24890 | 2433 void vo_xv_draw_colorkey( int32_t x, int32_t y, |
15100 | 2434 int32_t w, int32_t h ) |
14742 | 2435 { |
15100 | 2436 if( xv_ck_info.method == CK_METHOD_MANUALFILL || |
2437 xv_ck_info.method == CK_METHOD_BACKGROUND )//less tearing than XClearWindow() | |
14742 | 2438 { |
2439 XSetForeground( mDisplay, vo_gc, xv_colorkey ); | |
2440 XFillRectangle( mDisplay, vo_window, vo_gc, | |
2441 x, y, | |
2442 w, h ); | |
2443 } | |
2444 | |
2445 /* draw black bars if needed */ | |
15100 | 2446 /* TODO! move this to vo_x11_clearwindow_part() */ |
14742 | 2447 if ( vo_fs ) |
2448 { | |
2449 XSetForeground( mDisplay, vo_gc, 0 ); | |
21938 | 2450 /* making non-overlap fills, requires 8 checks instead of 4 */ |
14742 | 2451 if ( y > 0 ) |
2452 XFillRectangle( mDisplay, vo_window, vo_gc, | |
2453 0, 0, | |
2454 vo_screenwidth, y); | |
2455 if (x > 0) | |
2456 XFillRectangle( mDisplay, vo_window, vo_gc, | |
15100 | 2457 0, 0, |
2458 x, vo_screenheight); | |
14742 | 2459 if (x + w < vo_screenwidth) |
2460 XFillRectangle( mDisplay, vo_window, vo_gc, | |
15100 | 2461 x + w, 0, |
2462 vo_screenwidth, vo_screenheight); | |
14742 | 2463 if (y + h < vo_screenheight) |
2464 XFillRectangle( mDisplay, vo_window, vo_gc, | |
2465 0, y + h, | |
15100 | 2466 vo_screenwidth, vo_screenheight); |
14742 | 2467 } |
2468 } | |
2469 | |
21938 | 2470 /** \brief Tests if a valid argument for the ck suboption was given. */ |
14742 | 2471 int xv_test_ck( void * arg ) |
2472 { | |
2473 strarg_t * strarg = (strarg_t *)arg; | |
2474 | |
15734
7e4fa8fc255c
helper functions for comparing strarg_t "strings".
reimar
parents:
15186
diff
changeset
|
2475 if ( strargcmp( strarg, "use" ) == 0 || |
7e4fa8fc255c
helper functions for comparing strarg_t "strings".
reimar
parents:
15186
diff
changeset
|
2476 strargcmp( strarg, "set" ) == 0 || |
7e4fa8fc255c
helper functions for comparing strarg_t "strings".
reimar
parents:
15186
diff
changeset
|
2477 strargcmp( strarg, "cur" ) == 0 ) |
14742 | 2478 { |
2479 return 1; | |
2480 } | |
2481 | |
2482 return 0; | |
2483 } | |
21938 | 2484 /** \brief Tests if a valid arguments for the ck-method suboption was given. */ |
14742 | 2485 int xv_test_ckm( void * arg ) |
2486 { | |
2487 strarg_t * strarg = (strarg_t *)arg; | |
2488 | |
15734
7e4fa8fc255c
helper functions for comparing strarg_t "strings".
reimar
parents:
15186
diff
changeset
|
2489 if ( strargcmp( strarg, "bg" ) == 0 || |
7e4fa8fc255c
helper functions for comparing strarg_t "strings".
reimar
parents:
15186
diff
changeset
|
2490 strargcmp( strarg, "man" ) == 0 || |
7e4fa8fc255c
helper functions for comparing strarg_t "strings".
reimar
parents:
15186
diff
changeset
|
2491 strargcmp( strarg, "auto" ) == 0 ) |
14742 | 2492 { |
2493 return 1; | |
2494 } | |
2495 | |
2496 return 0; | |
2497 } | |
2498 | |
2499 /** | |
2500 * \brief Modify the colorkey_handling var according to str | |
2501 * | |
2502 * Checks if a valid pointer ( not NULL ) to the string | |
2503 * was given. And in that case modifies the colorkey_handling | |
2504 * var to reflect the requested behaviour. | |
2505 * If nothing happens the content of colorkey_handling stays | |
2506 * the same. | |
2507 * | |
2508 * \param str Pointer to the string or NULL | |
2509 * | |
2510 */ | |
2511 void xv_setup_colorkeyhandling( char const * ck_method_str, | |
2512 char const * ck_str ) | |
2513 { | |
2514 /* check if a valid pointer to the string was passed */ | |
2515 if ( ck_str ) | |
2516 { | |
2517 if ( strncmp( ck_str, "use", 3 ) == 0 ) | |
2518 { | |
2519 xv_ck_info.source = CK_SRC_USE; | |
2520 } | |
2521 else if ( strncmp( ck_str, "set", 3 ) == 0 ) | |
2522 { | |
2523 xv_ck_info.source = CK_SRC_SET; | |
2524 } | |
2525 } | |
2526 /* check if a valid pointer to the string was passed */ | |
2527 if ( ck_method_str ) | |
2528 { | |
2529 if ( strncmp( ck_method_str, "bg", 2 ) == 0 ) | |
2530 { | |
2531 xv_ck_info.method = CK_METHOD_BACKGROUND; | |
2532 } | |
2533 else if ( strncmp( ck_method_str, "man", 3 ) == 0 ) | |
2534 { | |
2535 xv_ck_info.method = CK_METHOD_MANUALFILL; | |
2536 } | |
2537 else if ( strncmp( ck_method_str, "auto", 4 ) == 0 ) | |
2538 { | |
2539 xv_ck_info.method = CK_METHOD_AUTOPAINT; | |
2540 } | |
2541 } | |
2542 } | |
2543 | |
10359 | 2544 #endif |