]> git.sesse.net Git - vlc/blob - modules/video_output/x11/xcommon.h
* ./configure.ac.in: removed -W in favour of -Wtraditional.
[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 VideoLAN
5  * $Id: xcommon.h,v 1.4 2002/12/06 16:34:08 sam Exp $
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., 59 Temple Place - Suite 330, Boston, MA  02111, 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
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 /*****************************************************************************
45  * x11_window_t: X11 window descriptor
46  *****************************************************************************
47  * This structure contains all the data necessary to describe an X11 window.
48  *****************************************************************************/
49 typedef struct x11_window_t
50 {
51     Window              base_window;                          /* base window */
52     Window              video_window;     /* sub-window for displaying video */
53     GC                  gc;              /* graphic context instance handler */
54     unsigned int        i_width;                             /* window width */
55     unsigned int        i_height;                           /* window height */
56     Atom                wm_protocols;
57     Atom                wm_delete_window;
58
59     vlc_bool_t          b_owned;                   /* do we own this window? */
60
61 } x11_window_t;
62
63 /*****************************************************************************
64  * vout_sys_t: video output method descriptor
65  *****************************************************************************
66  * This structure is part of the video output thread descriptor.
67  * It describes the X11 and XVideo specific properties of an output thread.
68  *****************************************************************************/
69 struct vout_sys_t
70 {
71     /* Internal settings and properties */
72     Display *           p_display;                        /* display pointer */
73
74     Visual *            p_visual;                          /* visual pointer */
75     int                 i_screen;                           /* screen number */
76
77     /* Our current window */
78     x11_window_t *      p_win;
79
80     /* Our two windows */
81     x11_window_t        original_window;
82     x11_window_t        fullscreen_window;
83
84     /* X11 generic properties */
85     vlc_bool_t          b_altfullscreen;          /* which fullscreen method */
86 #ifdef HAVE_SYS_SHM_H
87     vlc_bool_t          b_shm;               /* shared memory extension flag */
88 #endif
89
90 #ifdef MODULE_NAME_IS_xvideo
91     int                 i_xvport;
92 #else
93     Colormap            colormap;               /* colormap used (8bpp only) */
94
95     unsigned int        i_screen_depth;
96     unsigned int        i_bytes_per_pixel;
97     unsigned int        i_bytes_per_line;
98 #endif
99
100     /* Screen saver properties */
101     unsigned int        i_ss_timeout;                             /* timeout */
102     unsigned int        i_ss_interval;           /* interval between changes */
103     unsigned int        i_ss_blanking;                      /* blanking mode */
104     unsigned int        i_ss_exposure;                      /* exposure mode */
105 #ifdef DPMSINFO_IN_DPMS_H
106     BOOL                b_ss_dpms;                              /* DPMS mode */
107 #endif
108
109     /* Mouse pointer properties */
110     vlc_bool_t          b_mouse_pointer_visible;
111     mtime_t             i_time_mouse_last_moved; /* used to auto-hide pointer*/
112     Cursor              blank_cursor;                   /* the hidden cursor */
113     mtime_t             i_time_button_last_pressed;   /* to track dbl-clicks */
114     Pixmap              cursor_pixmap;
115 };
116
117 /*****************************************************************************
118  * picture_sys_t: direct buffer method descriptor
119  *****************************************************************************
120  * This structure is part of the picture descriptor, it describes the
121  * XVideo specific properties of a direct buffer.
122  *****************************************************************************/
123 struct picture_sys_t
124 {
125     IMAGE_TYPE *        p_image;
126
127 #ifdef HAVE_SYS_SHM_H
128     XShmSegmentInfo     shminfo;       /* shared memory zone information */
129 #endif
130 };
131
132 /*****************************************************************************
133  * mwmhints_t: window manager hints
134  *****************************************************************************
135  * Fullscreen needs to be able to hide the wm decorations so we provide
136  * this structure to make it easier.
137  *****************************************************************************/
138 #define MWM_HINTS_DECORATIONS   (1L << 1)
139 #define PROP_MWM_HINTS_ELEMENTS 5
140 typedef struct mwmhints_t
141 {
142     u32 flags;
143     u32 functions;
144     u32 decorations;
145     s32 input_mode;
146     u32 status;
147 } mwmhints_t;
148
149 /*****************************************************************************
150  * Chroma defines
151  *****************************************************************************/
152 #ifdef MODULE_NAME_IS_xvideo
153 #   define MAX_DIRECTBUFFERS 10
154 #else
155 #   define MAX_DIRECTBUFFERS 2
156 #endif
157