mirror of
https://github.com/mpv-player/mpv.git
synced 2024-09-20 12:02:23 +02:00
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@923 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
d7f6f3e341
commit
f61ffa92b9
@ -32,6 +32,7 @@ G
|
|||||||
- Makefile improvements
|
- Makefile improvements
|
||||||
- prelimenary DVD support
|
- prelimenary DVD support
|
||||||
- another GUI code (is that so..?)
|
- another GUI code (is that so..?)
|
||||||
|
- various X11 cleanups and fixes
|
||||||
|
|
||||||
Gábor Bérczi (Gabucino): <gabucino@k2.jozsef.kando.hu>
|
Gábor Bérczi (Gabucino): <gabucino@k2.jozsef.kando.hu>
|
||||||
- documentation maintainer
|
- documentation maintainer
|
||||||
|
@ -26,6 +26,10 @@ extern int vo_dbpp;
|
|||||||
extern int osd_level;
|
extern int osd_level;
|
||||||
extern int sub_unicode;
|
extern int sub_unicode;
|
||||||
|
|
||||||
|
#ifdef HAVE_X11
|
||||||
|
extern char *mDisplayName;
|
||||||
|
#endif
|
||||||
|
|
||||||
struct config conf[]={
|
struct config conf[]={
|
||||||
/* name, pointer, type, flags, min, max */
|
/* name, pointer, type, flags, min, max */
|
||||||
{"include", cfg_include, CONF_TYPE_FUNC_PARAM, 0, 0, 0}, /* this must be the first!!! */
|
{"include", cfg_include, CONF_TYPE_FUNC_PARAM, 0, 0, 0}, /* this must be the first!!! */
|
||||||
@ -34,6 +38,9 @@ struct config conf[]={
|
|||||||
{"vo", &video_driver, CONF_TYPE_STRING, 0, 0, 0},
|
{"vo", &video_driver, CONF_TYPE_STRING, 0, 0, 0},
|
||||||
{"dsp", &dsp, CONF_TYPE_STRING, 0, 0, 0},
|
{"dsp", &dsp, CONF_TYPE_STRING, 0, 0, 0},
|
||||||
{"mixer", &mixer_device, CONF_TYPE_STRING, 0, 0, 0},
|
{"mixer", &mixer_device, CONF_TYPE_STRING, 0, 0, 0},
|
||||||
|
#ifdef HAVE_X11
|
||||||
|
{"display", &mDisplayName, CONF_TYPE_STRING, 0, 0, 0},
|
||||||
|
#endif
|
||||||
{"master", &mixer_usemaster, CONF_TYPE_FLAG, 0, 0, 1},
|
{"master", &mixer_usemaster, CONF_TYPE_FLAG, 0, 0, 1},
|
||||||
{"osdlevel", &osd_level, CONF_TYPE_INT, CONF_RANGE, 0, 2 },
|
{"osdlevel", &osd_level, CONF_TYPE_INT, CONF_RANGE, 0, 2 },
|
||||||
#ifdef HAVE_LIBCSS
|
#ifdef HAVE_LIBCSS
|
||||||
|
@ -61,7 +61,7 @@ XF86VidModeModeInfo **vidmodes=NULL;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* X11 related variables */
|
/* X11 related variables */
|
||||||
static Display *mDisplay;
|
//static Display *mDisplay;
|
||||||
static Window mywindow;
|
static Window mywindow;
|
||||||
static GC mygc;
|
static GC mygc;
|
||||||
static XImage *myximage;
|
static XImage *myximage;
|
||||||
@ -120,7 +120,7 @@ static uint32_t init( uint32_t width,uint32_t height,uint32_t d_width,uint32_t d
|
|||||||
int interval, prefer_blank, allow_exp, nothing;
|
int interval, prefer_blank, allow_exp, nothing;
|
||||||
unsigned int fg,bg;
|
unsigned int fg,bg;
|
||||||
char *hello=( title == NULL ) ? "X11 render" : title;
|
char *hello=( title == NULL ) ? "X11 render" : title;
|
||||||
char *name=":0.0";
|
// char *name=":0.0";
|
||||||
XSizeHints hint;
|
XSizeHints hint;
|
||||||
XVisualInfo vinfo;
|
XVisualInfo vinfo;
|
||||||
XEvent xev;
|
XEvent xev;
|
||||||
@ -136,17 +136,6 @@ static uint32_t init( uint32_t width,uint32_t height,uint32_t d_width,uint32_t d
|
|||||||
if ( X_already_started ) return -1;
|
if ( X_already_started ) return -1;
|
||||||
if( !vo_init() ) return 0; // Can't open X11
|
if( !vo_init() ) return 0; // Can't open X11
|
||||||
|
|
||||||
if( getenv( "DISPLAY" ) ) name=getenv( "DISPLAY" );
|
|
||||||
|
|
||||||
mDisplay=XOpenDisplay( name );
|
|
||||||
|
|
||||||
if ( mDisplay == NULL )
|
|
||||||
{
|
|
||||||
printf( "Can not open display\n" );
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
screen=DefaultScreen( mDisplay );
|
|
||||||
|
|
||||||
hint.x=0;
|
hint.x=0;
|
||||||
hint.y=0;
|
hint.y=0;
|
||||||
hint.width=image_width;
|
hint.width=image_width;
|
||||||
@ -172,7 +161,7 @@ static uint32_t init( uint32_t width,uint32_t height,uint32_t d_width,uint32_t d
|
|||||||
|
|
||||||
if (have_vm) {
|
if (have_vm) {
|
||||||
if (vidmodes==NULL)
|
if (vidmodes==NULL)
|
||||||
XF86VidModeGetAllModeLines(mDisplay,screen,&modecount,&vidmodes);
|
XF86VidModeGetAllModeLines(mDisplay,mScreen,&modecount,&vidmodes);
|
||||||
j=0;
|
j=0;
|
||||||
modeline_width=vidmodes[0]->hdisplay;
|
modeline_width=vidmodes[0]->hdisplay;
|
||||||
modeline_height=vidmodes[0]->vdisplay;
|
modeline_height=vidmodes[0]->vdisplay;
|
||||||
@ -191,12 +180,12 @@ static uint32_t init( uint32_t width,uint32_t height,uint32_t d_width,uint32_t d
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf("XF86VM: Selected video mode %dx%d for image size %dx%d.\n",modeline_width, modeline_height, image_width, image_height);
|
printf("XF86VM: Selected video mode %dx%d for image size %dx%d.\n",modeline_width, modeline_height, image_width, image_height);
|
||||||
XF86VidModeLockModeSwitch(mDisplay,screen,0);
|
XF86VidModeLockModeSwitch(mDisplay,mScreen,0);
|
||||||
XF86VidModeSwitchToMode(mDisplay,screen,vidmodes[j]);
|
XF86VidModeSwitchToMode(mDisplay,mScreen,vidmodes[j]);
|
||||||
XF86VidModeSwitchToMode(mDisplay,screen,vidmodes[j]);
|
XF86VidModeSwitchToMode(mDisplay,mScreen,vidmodes[j]);
|
||||||
X=(vo_screenwidth-modeline_width)/2;
|
X=(vo_screenwidth-modeline_width)/2;
|
||||||
Y=(vo_screenheight-modeline_height)/2;
|
Y=(vo_screenheight-modeline_height)/2;
|
||||||
XF86VidModeSetViewPort(mDisplay,screen,X,Y);
|
XF86VidModeSetViewPort(mDisplay,mScreen,X,Y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -211,16 +200,16 @@ static uint32_t init( uint32_t width,uint32_t height,uint32_t d_width,uint32_t d
|
|||||||
vo_dheight=hint.height;
|
vo_dheight=hint.height;
|
||||||
hint.flags=PPosition | PSize;
|
hint.flags=PPosition | PSize;
|
||||||
|
|
||||||
bg=WhitePixel( mDisplay,screen );
|
bg=WhitePixel( mDisplay,mScreen );
|
||||||
fg=BlackPixel( mDisplay,screen );
|
fg=BlackPixel( mDisplay,mScreen );
|
||||||
|
|
||||||
XGetWindowAttributes( mDisplay,DefaultRootWindow( mDisplay ),&attribs );
|
XGetWindowAttributes( mDisplay,DefaultRootWindow( mDisplay ),&attribs );
|
||||||
depth=attribs.depth;
|
depth=attribs.depth;
|
||||||
|
|
||||||
if ( depth != 15 && depth != 16 && depth != 24 && depth != 32 ) depth=24;
|
if ( depth != 15 && depth != 16 && depth != 24 && depth != 32 ) depth=24;
|
||||||
XMatchVisualInfo( mDisplay,screen,depth,TrueColor,&vinfo );
|
XMatchVisualInfo( mDisplay,mScreen,depth,TrueColor,&vinfo );
|
||||||
|
|
||||||
theCmap =XCreateColormap( mDisplay,RootWindow( mDisplay,screen ),
|
theCmap =XCreateColormap( mDisplay,RootWindow( mDisplay,mScreen ),
|
||||||
vinfo.visual,AllocNone );
|
vinfo.visual,AllocNone );
|
||||||
|
|
||||||
xswa.background_pixel=0;
|
xswa.background_pixel=0;
|
||||||
@ -228,7 +217,7 @@ static uint32_t init( uint32_t width,uint32_t height,uint32_t d_width,uint32_t d
|
|||||||
xswa.colormap=theCmap;
|
xswa.colormap=theCmap;
|
||||||
xswamask=CWBackPixel | CWBorderPixel |CWColormap;
|
xswamask=CWBackPixel | CWBorderPixel |CWColormap;
|
||||||
|
|
||||||
mywindow=XCreateWindow( mDisplay,RootWindow( mDisplay,screen ),
|
mywindow=XCreateWindow( mDisplay,RootWindow( mDisplay,mScreen ),
|
||||||
hint.x,hint.y,
|
hint.x,hint.y,
|
||||||
hint.width,hint.height,
|
hint.width,hint.height,
|
||||||
xswa.border_pixel,depth,CopyFromParent,vinfo.visual,xswamask,&xswa );
|
xswa.border_pixel,depth,CopyFromParent,vinfo.visual,xswamask,&xswa );
|
||||||
@ -248,7 +237,7 @@ static uint32_t init( uint32_t width,uint32_t height,uint32_t d_width,uint32_t d
|
|||||||
mygc=XCreateGC( mDisplay,mywindow,0L,&xgcv );
|
mygc=XCreateGC( mDisplay,mywindow,0L,&xgcv );
|
||||||
|
|
||||||
#ifdef SH_MEM
|
#ifdef SH_MEM
|
||||||
if ( XShmQueryExtension( mDisplay ) ) Shmem_Flag=1;
|
if ( mLocalDisplay && XShmQueryExtension( mDisplay ) ) Shmem_Flag=1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Shmem_Flag=0;
|
Shmem_Flag=0;
|
||||||
|
@ -62,7 +62,7 @@ static vo_info_t vo_info =
|
|||||||
""
|
""
|
||||||
};
|
};
|
||||||
|
|
||||||
static Display * mDisplay;
|
//static Display * mDisplay;
|
||||||
static Window mWindow;
|
static Window mWindow;
|
||||||
static GC mGC;
|
static GC mGC;
|
||||||
static XGCValues wGCV;
|
static XGCValues wGCV;
|
||||||
@ -225,17 +225,7 @@ static uint32_t init( uint32_t width, uint32_t height, uint32_t d_width, uint32_
|
|||||||
|
|
||||||
if ( X_already_started ) return -1;
|
if ( X_already_started ) return -1;
|
||||||
|
|
||||||
vo_init();
|
if (!vo_init()) return -1;
|
||||||
|
|
||||||
if ( getenv( "DISPLAY" ) ) name=getenv( "DISPLAY" );
|
|
||||||
mDisplay=XOpenDisplay(name);
|
|
||||||
if ( mDisplay == NULL )
|
|
||||||
{
|
|
||||||
printf( "Can not open X11 display\n" );
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
mScreen=DefaultScreen( mDisplay );
|
|
||||||
|
|
||||||
mvWidth=width; mvHeight=height;
|
mvWidth=width; mvHeight=height;
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ int XShmGetEventBase(Display*);
|
|||||||
static unsigned char *ImageData;
|
static unsigned char *ImageData;
|
||||||
|
|
||||||
/* X11 related variables */
|
/* X11 related variables */
|
||||||
static Display *mydisplay;
|
//static Display *mydisplay;
|
||||||
static Window mywindow;
|
static Window mywindow;
|
||||||
static GC mygc;
|
static GC mygc;
|
||||||
static XImage *myximage;
|
static XImage *myximage;
|
||||||
@ -95,9 +95,9 @@ static uint32_t drwcX,drwcY,dwidth,dheight,mFullscreen;
|
|||||||
*/
|
*/
|
||||||
static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format)
|
static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format)
|
||||||
{
|
{
|
||||||
int screen;
|
// int screen;
|
||||||
char *hello = (title == NULL) ? "Xv render" : title;
|
char *hello = (title == NULL) ? "Xv render" : title;
|
||||||
char *name = ":0.0";
|
// char *name = ":0.0";
|
||||||
XSizeHints hint;
|
XSizeHints hint;
|
||||||
XVisualInfo vinfo;
|
XVisualInfo vinfo;
|
||||||
XEvent xev;
|
XEvent xev;
|
||||||
@ -112,18 +112,8 @@ static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t
|
|||||||
|
|
||||||
mFullscreen=flags&1;
|
mFullscreen=flags&1;
|
||||||
dwidth=d_width; dheight=d_height;
|
dwidth=d_width; dheight=d_height;
|
||||||
|
|
||||||
if(getenv("DISPLAY")) name = getenv("DISPLAY");
|
if (!vo_init()) return -1;
|
||||||
|
|
||||||
mydisplay = XOpenDisplay(name);
|
|
||||||
|
|
||||||
if (mydisplay == NULL)
|
|
||||||
{
|
|
||||||
printf("Can't open display\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
screen = DefaultScreen(mydisplay);
|
|
||||||
|
|
||||||
#ifdef HAVE_GUI
|
#ifdef HAVE_GUI
|
||||||
if ( vo_window == None )
|
if ( vo_window == None )
|
||||||
@ -139,26 +129,26 @@ static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t
|
|||||||
hint.height=vo_screenheight;
|
hint.height=vo_screenheight;
|
||||||
}
|
}
|
||||||
hint.flags = PPosition | PSize;
|
hint.flags = PPosition | PSize;
|
||||||
XGetWindowAttributes(mydisplay, DefaultRootWindow(mydisplay), &attribs);
|
XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &attribs);
|
||||||
depth=attribs.depth;
|
depth=attribs.depth;
|
||||||
if (depth != 15 && depth != 16 && depth != 24 && depth != 32) depth = 24;
|
if (depth != 15 && depth != 16 && depth != 24 && depth != 32) depth = 24;
|
||||||
XMatchVisualInfo(mydisplay, screen, depth, TrueColor, &vinfo);
|
XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo);
|
||||||
|
|
||||||
xswa.background_pixel = 0;
|
xswa.background_pixel = 0;
|
||||||
xswa.border_pixel = 0;
|
xswa.border_pixel = 0;
|
||||||
xswamask = CWBackPixel | CWBorderPixel;
|
xswamask = CWBackPixel | CWBorderPixel;
|
||||||
|
|
||||||
mywindow = XCreateWindow(mydisplay, RootWindow(mydisplay,screen),
|
mywindow = XCreateWindow(mDisplay, RootWindow(mDisplay,mScreen),
|
||||||
hint.x, hint.y, hint.width, hint.height,
|
hint.x, hint.y, hint.width, hint.height,
|
||||||
0, depth,CopyFromParent,vinfo.visual,xswamask,&xswa);
|
0, depth,CopyFromParent,vinfo.visual,xswamask,&xswa);
|
||||||
vo_hidecursor(mydisplay,mywindow);
|
vo_hidecursor(mDisplay,mywindow);
|
||||||
|
|
||||||
XSelectInput(mydisplay, mywindow, StructureNotifyMask | KeyPressMask );
|
XSelectInput(mDisplay, mywindow, StructureNotifyMask | KeyPressMask );
|
||||||
XSetStandardProperties(mydisplay, mywindow, hello, hello, None, NULL, 0, &hint);
|
XSetStandardProperties(mDisplay, mywindow, hello, hello, None, NULL, 0, &hint);
|
||||||
if ( mFullscreen ) vo_x11_decoration( mydisplay,mywindow,0 );
|
if ( mFullscreen ) vo_x11_decoration( mDisplay,mywindow,0 );
|
||||||
XMapWindow(mydisplay, mywindow);
|
XMapWindow(mDisplay, mywindow);
|
||||||
XFlush(mydisplay);
|
XFlush(mDisplay);
|
||||||
XSync(mydisplay, False);
|
XSync(mDisplay, False);
|
||||||
#ifdef HAVE_GUI
|
#ifdef HAVE_GUI
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -167,20 +157,20 @@ static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t
|
|||||||
mygc=vo_gc;
|
mygc=vo_gc;
|
||||||
if ( vo_screenwidth != d_width )
|
if ( vo_screenwidth != d_width )
|
||||||
{
|
{
|
||||||
XMoveWindow( mydisplay,mywindow,( vo_screenwidth - d_width ) / 2,( vo_screenheight - d_height ) / 2 );
|
XMoveWindow( mDisplay,mywindow,( vo_screenwidth - d_width ) / 2,( vo_screenheight - d_height ) / 2 );
|
||||||
XResizeWindow( mydisplay,mywindow,d_width,d_height );
|
XResizeWindow( mDisplay,mywindow,d_width,d_height );
|
||||||
}
|
}
|
||||||
else mFullscreen=1;
|
else mFullscreen=1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mygc = XCreateGC(mydisplay, mywindow, 0L, &xgcv);
|
mygc = XCreateGC(mDisplay, mywindow, 0L, &xgcv);
|
||||||
|
|
||||||
xv_port = 0;
|
xv_port = 0;
|
||||||
if (Success == XvQueryExtension(mydisplay,&ver,&rel,&req,&ev,&err))
|
if (Success == XvQueryExtension(mDisplay,&ver,&rel,&req,&ev,&err))
|
||||||
{
|
{
|
||||||
/* check for Xvideo support */
|
/* check for Xvideo support */
|
||||||
if (Success != XvQueryAdaptors(mydisplay,DefaultRootWindow(mydisplay), &adaptors,&ai))
|
if (Success != XvQueryAdaptors(mDisplay,DefaultRootWindow(mDisplay), &adaptors,&ai))
|
||||||
{
|
{
|
||||||
printf("Xv: XvQueryAdaptors failed");
|
printf("Xv: XvQueryAdaptors failed");
|
||||||
return -1;
|
return -1;
|
||||||
@ -193,7 +183,7 @@ static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t
|
|||||||
/* check image formats */
|
/* check image formats */
|
||||||
if (xv_port != 0)
|
if (xv_port != 0)
|
||||||
{
|
{
|
||||||
fo = XvListImageFormats(mydisplay, xv_port, (int*)&formats);
|
fo = XvListImageFormats(mDisplay, xv_port, (int*)&formats);
|
||||||
xv_format=0;
|
xv_format=0;
|
||||||
for(i = 0; i < formats; i++)
|
for(i = 0; i < formats; i++)
|
||||||
{
|
{
|
||||||
@ -216,9 +206,9 @@ static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t
|
|||||||
|
|
||||||
current_buf=0;
|
current_buf=0;
|
||||||
|
|
||||||
XGetGeometry( mydisplay,mywindow,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth );
|
XGetGeometry( mDisplay,mywindow,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth );
|
||||||
drwX=0; drwY=0;
|
drwX=0; drwY=0;
|
||||||
XTranslateCoordinates( mydisplay,mywindow,mRoot,0,0,&drwcX,&drwcY,&mRoot );
|
XTranslateCoordinates( mDisplay,mywindow,mRoot,0,0,&drwcX,&drwcY,&mRoot );
|
||||||
printf( "[xv] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
|
printf( "[xv] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
|
||||||
|
|
||||||
if ( mFullscreen )
|
if ( mFullscreen )
|
||||||
@ -232,7 +222,7 @@ static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t
|
|||||||
printf( "[xv-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
|
printf( "[xv-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
|
||||||
}
|
}
|
||||||
|
|
||||||
saver_off(mydisplay); // turning off screen saver
|
saver_off(mDisplay); // turning off screen saver
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -251,15 +241,15 @@ static void allocate_xvimage(int foo)
|
|||||||
* allocate XvImages. FIXME: no error checking, without
|
* allocate XvImages. FIXME: no error checking, without
|
||||||
* mit-shm this will bomb...
|
* mit-shm this will bomb...
|
||||||
*/
|
*/
|
||||||
xvimage[foo] = XvShmCreateImage(mydisplay, xv_port, xv_format, 0, image_width, image_height, &Shminfo[foo]);
|
xvimage[foo] = XvShmCreateImage(mDisplay, xv_port, xv_format, 0, image_width, image_height, &Shminfo[foo]);
|
||||||
|
|
||||||
Shminfo[foo].shmid = shmget(IPC_PRIVATE, xvimage[foo]->data_size, IPC_CREAT | 0777);
|
Shminfo[foo].shmid = shmget(IPC_PRIVATE, xvimage[foo]->data_size, IPC_CREAT | 0777);
|
||||||
Shminfo[foo].shmaddr = (char *) shmat(Shminfo[foo].shmid, 0, 0);
|
Shminfo[foo].shmaddr = (char *) shmat(Shminfo[foo].shmid, 0, 0);
|
||||||
Shminfo[foo].readOnly = False;
|
Shminfo[foo].readOnly = False;
|
||||||
|
|
||||||
xvimage[foo]->data = Shminfo[foo].shmaddr;
|
xvimage[foo]->data = Shminfo[foo].shmaddr;
|
||||||
XShmAttach(mydisplay, &Shminfo[foo]);
|
XShmAttach(mDisplay, &Shminfo[foo]);
|
||||||
XSync(mydisplay, False);
|
XSync(mDisplay, False);
|
||||||
shmctl(Shminfo[foo].shmid, IPC_RMID, 0);
|
shmctl(Shminfo[foo].shmid, IPC_RMID, 0);
|
||||||
memset(xvimage[foo]->data,128,xvimage[foo]->data_size);
|
memset(xvimage[foo]->data,128,xvimage[foo]->data_size);
|
||||||
return;
|
return;
|
||||||
@ -267,12 +257,12 @@ static void allocate_xvimage(int foo)
|
|||||||
|
|
||||||
static void check_events(void)
|
static void check_events(void)
|
||||||
{
|
{
|
||||||
int e=vo_x11_check_events(mydisplay);
|
int e=vo_x11_check_events(mDisplay);
|
||||||
if(e&VO_EVENT_RESIZE)
|
if(e&VO_EVENT_RESIZE)
|
||||||
{
|
{
|
||||||
XGetGeometry( mydisplay,mywindow,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth );
|
XGetGeometry( mDisplay,mywindow,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth );
|
||||||
drwX=0; drwY=0;
|
drwX=0; drwY=0;
|
||||||
XTranslateCoordinates( mydisplay,mywindow,mRoot,0,0,&drwcX,&drwcY,&mRoot );
|
XTranslateCoordinates( mDisplay,mywindow,mRoot,0,0,&drwcX,&drwcY,&mRoot );
|
||||||
printf( "[xv] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
|
printf( "[xv] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
|
||||||
|
|
||||||
#ifdef HAVE_GUI
|
#ifdef HAVE_GUI
|
||||||
@ -327,11 +317,11 @@ static void flip_page(void)
|
|||||||
{
|
{
|
||||||
vo_draw_text(image_width,image_height,draw_alpha);
|
vo_draw_text(image_width,image_height,draw_alpha);
|
||||||
check_events();
|
check_events();
|
||||||
XvShmPutImage(mydisplay, xv_port, mywindow, mygc, xvimage[current_buf],
|
XvShmPutImage(mDisplay, xv_port, mywindow, mygc, xvimage[current_buf],
|
||||||
0, 0, image_width, image_height,
|
0, 0, image_width, image_height,
|
||||||
drwX,drwY,drwWidth,(mFullscreen?drwHeight - 1:drwHeight),
|
drwX,drwY,drwWidth,(mFullscreen?drwHeight - 1:drwHeight),
|
||||||
False);
|
False);
|
||||||
XFlush(mydisplay);
|
XFlush(mDisplay);
|
||||||
current_buf=(current_buf+1)%NUM_BUFFERS;
|
current_buf=(current_buf+1)%NUM_BUFFERS;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -436,7 +426,7 @@ static uint32_t query_format(uint32_t format)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void uninit(void) {
|
static void uninit(void) {
|
||||||
saver_on(mydisplay); // screen saver back on
|
saver_on(mDisplay); // screen saver back on
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,6 +22,12 @@
|
|||||||
static int dpms_disabled=0;
|
static int dpms_disabled=0;
|
||||||
static int timeout_save=0;
|
static int timeout_save=0;
|
||||||
|
|
||||||
|
char* mDisplayName=NULL;
|
||||||
|
Display* mDisplay;
|
||||||
|
Window mRootWin;
|
||||||
|
int mScreen;
|
||||||
|
int mLocalDisplay;
|
||||||
|
|
||||||
|
|
||||||
void vo_hidecursor ( Display *disp , Window win )
|
void vo_hidecursor ( Display *disp , Window win )
|
||||||
{
|
{
|
||||||
@ -42,21 +48,24 @@ void vo_hidecursor ( Display *disp , Window win )
|
|||||||
int vo_init( void )
|
int vo_init( void )
|
||||||
{
|
{
|
||||||
int CompletionType = -1;
|
int CompletionType = -1;
|
||||||
int mScreen;
|
// int mScreen;
|
||||||
int bpp;
|
int bpp;
|
||||||
char * DisplayName = ":0.0";
|
// char * DisplayName = ":0.0";
|
||||||
Display * mDisplay;
|
// Display * mDisplay;
|
||||||
XImage * mXImage;
|
XImage * mXImage;
|
||||||
Window mRootWin;
|
// Window mRootWin;
|
||||||
static XWindowAttributes attribs;
|
static XWindowAttributes attribs;
|
||||||
|
|
||||||
if(vo_depthonscreen) return 1; // already called
|
if(vo_depthonscreen) return 1; // already called
|
||||||
|
|
||||||
if ( getenv( "DISPLAY" ) ) DisplayName=getenv( "DISPLAY" );
|
if (!mDisplayName)
|
||||||
mDisplay=XOpenDisplay( DisplayName );
|
if (!(mDisplayName=getenv("DISPLAY")))
|
||||||
|
mDisplayName=strdup(":0.0");
|
||||||
|
|
||||||
|
mDisplay=XOpenDisplay(mDisplayName);
|
||||||
if ( !mDisplay )
|
if ( !mDisplay )
|
||||||
{
|
{
|
||||||
printf( "vo: couldn't open the X11 display!\n" );
|
printf( "vo: couldn't open the X11 display (%s)!\n",mDisplayName );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
mScreen=DefaultScreen( mDisplay ); // Screen ID.
|
mScreen=DefaultScreen( mDisplay ); // Screen ID.
|
||||||
@ -72,8 +81,10 @@ int vo_init( void )
|
|||||||
bpp=mXImage->bits_per_pixel;
|
bpp=mXImage->bits_per_pixel;
|
||||||
XDestroyImage( mXImage );
|
XDestroyImage( mXImage );
|
||||||
if((vo_depthonscreen+7)/8 != (bpp+7)/8) vo_depthonscreen=bpp; // by A'rpi
|
if((vo_depthonscreen+7)/8 != (bpp+7)/8) vo_depthonscreen=bpp; // by A'rpi
|
||||||
XCloseDisplay( mDisplay );
|
// XCloseDisplay( mDisplay );
|
||||||
printf("X11 running at %dx%d depth: %d\n",vo_screenwidth,vo_screenheight,vo_depthonscreen);
|
#warning Better local display detection method is needed.
|
||||||
|
if (*mDisplayName==':') mLocalDisplay=1; else mLocalDisplay=0;
|
||||||
|
printf("X11 running at %dx%d depth: %d (\"%s\" => %s display)\n",vo_screenwidth,vo_screenheight,vo_depthonscreen,mDisplayName,mLocalDisplay?"local":"remote");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,12 @@ extern int vo_screenheight;
|
|||||||
extern int vo_dwidth;
|
extern int vo_dwidth;
|
||||||
extern int vo_dheight;
|
extern int vo_dheight;
|
||||||
|
|
||||||
|
extern char *mDisplayName;
|
||||||
|
extern Display *mDisplay;
|
||||||
|
extern Window *mRootWin;
|
||||||
|
extern int mScreen;
|
||||||
|
extern int mLocalDisplay;
|
||||||
|
|
||||||
int vo_init( void );
|
int vo_init( void );
|
||||||
int vo_hidecursor ( Display* , Window );
|
int vo_hidecursor ( Display* , Window );
|
||||||
void vo_x11_decoration( Display * vo_Display,Window w,int d );
|
void vo_x11_decoration( Display * vo_Display,Window w,int d );
|
||||||
|
Loading…
Reference in New Issue
Block a user