1 /*****************************************************************************
2 * x11.c : X11 plugin for vlc
3 *****************************************************************************
4 * Copyright (C) 1998-2001 VideoLAN
5 * $Id: x11.c,v 1.17 2002/05/30 08:17:04 gbazin Exp $
7 * Authors: Vincent Seguin <seguin@via.ecp.fr>
8 * Samuel Hocevar <sam@zoy.org>
9 * David Kennedy <dkennedy@tinytoad.com>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
24 *****************************************************************************/
26 /*****************************************************************************
28 *****************************************************************************/
29 #include <stdlib.h> /* malloc(), free() */
30 #include <string.h> /* strerror() */
32 #include <videolan/vlc.h>
36 /*****************************************************************************
37 * Building configuration tree
38 *****************************************************************************/
40 #define ALT_FS_TEXT N_("alternate fullscreen method")
41 #define ALT_FS_LONGTEXT N_( \
42 "There are two ways to make a fullscreen window, unfortunately each one " \
43 "has its drawbacks.\n" \
44 "1) Let the window manager handle your fullscreen window (default). But " \
45 "things like taskbars will likely show on top of the video.\n" \
46 "2) Completly bypass the window manager, but then nothing will be able " \
47 "to show on top of the video.")
49 #define DISPLAY_TEXT N_("X11 display name")
50 #define DISPLAY_LONGTEXT N_( \
51 "Specify the X11 hardware display you want to use.\nBy default vlc will " \
52 "use the value of the DISPLAY environment variable.")
55 ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL )
56 ADD_STRING ( "x11-display", NULL, NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT )
57 ADD_BOOL ( "x11-altfullscreen", 0, NULL, ALT_FS_TEXT, ALT_FS_LONGTEXT )
61 SET_DESCRIPTION( _("X11 module") )
62 ADD_CAPABILITY( VOUT, 50 )
67 _M( vout_getfunctions )( &p_module->p_functions->vout );
70 MODULE_DEACTIVATE_START
71 MODULE_DEACTIVATE_STOP
74 /*****************************************************************************
75 * vout_SetPalette: sets an 8 bpp palette
76 *****************************************************************************
77 * This function sets the palette given as an argument. It does not return
78 * anything, but could later send information on which colors it was unable
80 *****************************************************************************/
81 static void vout_SetPalette( p_vout_thread_t p_vout,
82 u16 *red, u16 *green, u16 *blue, u16 *transp )
87 /* allocate palette */
88 for( i = 0, j = 255; i < 255; i++, j-- )
90 /* kludge: colors are indexed reversely because color 255 seems
91 * to be reserved for black even if we try to set it to white */
92 p_colors[ i ].pixel = j;
93 p_colors[ i ].pad = 0;
94 p_colors[ i ].flags = DoRed | DoGreen | DoBlue;
95 p_colors[ i ].red = red[ j ];
96 p_colors[ i ].blue = blue[ j ];
97 p_colors[ i ].green = green[ j ];
100 XStoreColors( p_vout->p_sys->p_display,
101 p_vout->p_sys->colormap, p_colors, 256 );