]> git.sesse.net Git - vlc/blob - modules/video_output/x11/xcommon.h
FSF address change.
[vlc] / modules / video_output / x11 / xcommon.h
1 /*****************************************************************************
2  * xcommon.h: Defines common to the X11 and XVideo plugins
3  *****************************************************************************
4  * Copyright (C) 1998-2001 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Vincent Seguin <seguin@via.ecp.fr>
8  *          Samuel Hocevar <sam@zoy.org>
9  *          David Kennedy <dkennedy@tinytoad.com>
10  *          Gildas Bazin <gbazin@netcourrier.com>
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25  *****************************************************************************/
26
27 /*****************************************************************************
28  * Defines
29  *****************************************************************************/
30 #ifdef MODULE_NAME_IS_xvideo
31 #   define IMAGE_TYPE     XvImage
32 #   define EXTRA_ARGS     int i_xvport, int i_chroma, int i_bits_per_pixel
33 #   define EXTRA_ARGS_SHM int i_xvport, int i_chroma, XShmSegmentInfo *p_shm
34 #   define DATA_SIZE(p)   (p)->data_size
35 #   define IMAGE_FREE     XFree      /* There is nothing like XvDestroyImage */
36 #else
37 #   define IMAGE_TYPE     XImage
38 #   define EXTRA_ARGS     Visual *p_visual, int i_depth, int i_bytes_per_pixel
39 #   define EXTRA_ARGS_SHM Visual *p_visual, int i_depth, XShmSegmentInfo *p_shm
40 #   define DATA_SIZE(p)   ((p)->bytes_per_line * (p)->height)
41 #   define IMAGE_FREE     XDestroyImage
42 #endif
43
44 #define X11_FOURCC( a, b, c, d ) \
45         ( ((uint32_t)a) | ( ((uint32_t)b) << 8 ) \
46            | ( ((uint32_t)c) << 16 ) | ( ((uint32_t)d) << 24 ) )
47 #define VLC2X11_FOURCC( i ) \
48         X11_FOURCC( ((char *)&i)[0], ((char *)&i)[1], ((char *)&i)[2], \
49                     ((char *)&i)[3] )
50 #define X112VLC_FOURCC( i ) \
51         VLC_FOURCC( i & 0xff, (i >> 8) & 0xff, (i >> 16) & 0xff, \
52                     (i >> 24) & 0xff )
53
54 /*****************************************************************************
55  * x11_window_t: X11 window descriptor
56  *****************************************************************************
57  * This structure contains all the data necessary to describe an X11 window.
58  *****************************************************************************/
59 typedef struct x11_window_t
60 {
61     Window              owner_window;               /* owner window (if any) */
62     Window              base_window;                          /* base window */
63     Window              video_window;     /* sub-window for displaying video */
64     GC                  gc;              /* graphic context instance handler */
65
66     unsigned int        i_width;                             /* window width */
67     unsigned int        i_height;                           /* window height */
68     int                 i_x;                          /* window x coordinate */
69     int                 i_y;                          /* window y coordinate */
70
71     Atom                wm_protocols;
72     Atom                wm_delete_window;
73
74 #ifdef HAVE_XINERAMA
75     int                 i_screen;
76 #endif
77
78 } x11_window_t;
79
80 /*****************************************************************************
81  * vout_sys_t: video output method descriptor
82  *****************************************************************************
83  * This structure is part of the video output thread descriptor.
84  * It describes the X11 and XVideo specific properties of an output thread.
85  *****************************************************************************/
86 struct vout_sys_t
87 {
88     /* Internal settings and properties */
89     Display *           p_display;                        /* display pointer */
90
91     Visual *            p_visual;                          /* visual pointer */
92     int                 i_screen;                           /* screen number */
93
94     vlc_mutex_t         lock;
95
96     /* Our current window */
97     x11_window_t *      p_win;
98
99     /* Our two windows */
100     x11_window_t        original_window;
101     x11_window_t        fullscreen_window;
102
103     /* X11 generic properties */
104     vlc_bool_t          b_altfullscreen;          /* which fullscreen method */
105 #ifdef HAVE_SYS_SHM_H
106     vlc_bool_t          b_shm;               /* shared memory extension flag */
107 #endif
108
109 #ifdef MODULE_NAME_IS_xvideo
110     int                 i_xvport;
111 #else
112     Colormap            colormap;               /* colormap used (8bpp only) */
113
114     unsigned int        i_screen_depth;
115     unsigned int        i_bytes_per_pixel;
116     unsigned int        i_bytes_per_line;
117 #endif
118
119     /* Screen saver properties */
120     unsigned int        i_ss_timeout;                             /* timeout */
121     unsigned int        i_ss_interval;           /* interval between changes */
122     unsigned int        i_ss_blanking;                      /* blanking mode */
123     unsigned int        i_ss_exposure;                      /* exposure mode */
124 #ifdef DPMSINFO_IN_DPMS_H
125     BOOL                b_ss_dpms;                              /* DPMS mode */
126 #endif
127
128     /* Mouse pointer properties */
129     vlc_bool_t          b_mouse_pointer_visible;
130     mtime_t             i_time_mouse_last_moved; /* used to auto-hide pointer*/
131     Cursor              blank_cursor;                   /* the hidden cursor */
132     mtime_t             i_time_button_last_pressed;   /* to track dbl-clicks */
133     Pixmap              cursor_pixmap;
134
135     /* Window manager properties */
136     Atom                net_wm_state;
137     Atom                net_wm_state_fullscreen;
138     vlc_bool_t          b_net_wm_state_fullscreen;
139     Atom                net_wm_state_above;
140     vlc_bool_t          b_net_wm_state_above;
141     Atom                net_wm_state_stays_on_top;
142     vlc_bool_t          b_net_wm_state_stays_on_top;
143     Atom                net_wm_state_below;
144     vlc_bool_t          b_net_wm_state_below;
145
146 #ifdef MODULE_NAME_IS_glx
147     /* GLX properties */
148     int                 b_glx13;
149     GLXContext          gwctx;
150     GLXWindow           gwnd;
151 #endif
152 };
153
154 /*****************************************************************************
155  * picture_sys_t: direct buffer method descriptor
156  *****************************************************************************
157  * This structure is part of the picture descriptor, it describes the
158  * XVideo specific properties of a direct buffer.
159  *****************************************************************************/
160 struct picture_sys_t
161 {
162     IMAGE_TYPE *        p_image;
163
164 #ifdef HAVE_SYS_SHM_H
165     XShmSegmentInfo     shminfo;       /* shared memory zone information */
166 #endif
167 };
168
169 /*****************************************************************************
170  * mwmhints_t: window manager hints
171  *****************************************************************************
172  * Fullscreen needs to be able to hide the wm decorations so we provide
173  * this structure to make it easier.
174  *****************************************************************************/
175 #define MWM_HINTS_DECORATIONS   (1L << 1)
176 #define PROP_MWM_HINTS_ELEMENTS 5
177 typedef struct mwmhints_t
178 {
179     uint32_t flags;
180     uint32_t functions;
181     uint32_t decorations;
182     int32_t  input_mode;
183     uint32_t status;
184
185 } mwmhints_t;
186
187 /*****************************************************************************
188  * Chroma defines
189  *****************************************************************************/
190 #ifdef MODULE_NAME_IS_xvideo
191 #   define MAX_DIRECTBUFFERS 10
192 #else
193 #   define MAX_DIRECTBUFFERS 2
194 #endif
195