Mercurial > mplayer.hg
diff libvo/vo_xv.c @ 723:c3e0bdb64027
add gui support
author | pontscho |
---|---|
date | Tue, 08 May 2001 12:17:03 +0000 |
parents | 428755f858f7 |
children | 108ea5157cbc |
line wrap: on
line diff
--- a/libvo/vo_xv.c Tue May 08 01:58:59 2001 +0000 +++ b/libvo/vo_xv.c Tue May 08 12:17:03 2001 +0000 @@ -85,6 +85,10 @@ static uint32_t drwX,drwY,drwWidth,drwHeight,drwBorderWidth,drwDepth; static uint32_t drwcX,drwcY,dwidth,dheight,mFullscreen; +#ifdef HAVE_GUI + static uint32_t mdwidth,mdheight; +#endif + /* * connect to server, create and map window, * allocate colors and (shared) memory @@ -121,36 +125,54 @@ screen = DefaultScreen(mydisplay); - hint.x = 0; - hint.y = 0; - hint.width = d_width; - hint.height = d_height; - if ( fullscreen ) +#ifdef HAVE_GUI + if ( vo_window == None ) { - hint.width=vo_screenwidth; - hint.height=vo_screenheight; - } - hint.flags = PPosition | PSize; - XGetWindowAttributes(mydisplay, DefaultRootWindow(mydisplay), &attribs); - depth=attribs.depth; - if (depth != 15 && depth != 16 && depth != 24 && depth != 32) depth = 24; - XMatchVisualInfo(mydisplay, screen, depth, TrueColor, &vinfo); +#endif + hint.x = 0; + hint.y = 0; + hint.width = d_width; + hint.height = d_height; + if ( fullscreen ) + { + hint.width=vo_screenwidth; + hint.height=vo_screenheight; + } + hint.flags = PPosition | PSize; + XGetWindowAttributes(mydisplay, DefaultRootWindow(mydisplay), &attribs); + depth=attribs.depth; + if (depth != 15 && depth != 16 && depth != 24 && depth != 32) depth = 24; + XMatchVisualInfo(mydisplay, screen, depth, TrueColor, &vinfo); + + xswa.background_pixel = 0; + xswa.border_pixel = 0; + xswamask = CWBackPixel | CWBorderPixel; - xswa.background_pixel = 0; - xswa.border_pixel = 0; - xswamask = CWBackPixel | CWBorderPixel; + mywindow = XCreateWindow(mydisplay, RootWindow(mydisplay,screen), + hint.x, hint.y, hint.width, hint.height, + 0, depth,CopyFromParent,vinfo.visual,xswamask,&xswa); + vo_hidecursor(mydisplay,mywindow); - mywindow = XCreateWindow(mydisplay, RootWindow(mydisplay,screen), - hint.x, hint.y, hint.width, hint.height, - 0, depth,CopyFromParent,vinfo.visual,xswamask,&xswa); - vo_hidecursor(mydisplay,mywindow); - - XSelectInput(mydisplay, mywindow, StructureNotifyMask | KeyPressMask ); - XSetStandardProperties(mydisplay, mywindow, hello, hello, None, NULL, 0, &hint); - if ( fullscreen ) vo_x11_decoration( mydisplay,mywindow,0 ); - XMapWindow(mydisplay, mywindow); - XFlush(mydisplay); - XSync(mydisplay, False); + XSelectInput(mydisplay, mywindow, StructureNotifyMask | KeyPressMask ); + XSetStandardProperties(mydisplay, mywindow, hello, hello, None, NULL, 0, &hint); + if ( fullscreen ) vo_x11_decoration( mydisplay,mywindow,0 ); + XMapWindow(mydisplay, mywindow); + XFlush(mydisplay); + XSync(mydisplay, False); +#ifdef HAVE_GUI + } + else + { + mywindow=vo_window; + mygc=vo_gc; + if ( vo_screenwidth != d_width ) + { + XMoveWindow( mydisplay,mywindow,( vo_screenwidth - d_width ) / 2,( vo_screenheight - d_height ) / 2 ); + XResizeWindow( mydisplay,mywindow,d_width,d_height ); + } + else mFullscreen=1; + } +#endif mygc = XCreateGC(mydisplay, mywindow, 0L, &xgcv); @@ -253,6 +275,20 @@ XTranslateCoordinates( mydisplay,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 ); + #ifdef HAVE_GUI + if ( vo_window != None ) + { + mFullscreen=0; + dwidth=mdwidth; dheight=mdheight; + if ( ( drwWidth == vo_screenwidth )&&( drwHeight == vo_screenheight ) ) + { + mFullscreen=1; + dwidth=vo_screenwidth; + dheight=vo_screenwidth * mdheight / mdwidth; + } + } + #endif + if ( mFullscreen ) { drwX=( vo_screenwidth - (dwidth > vo_screenwidth?vo_screenwidth:dwidth) ) / 2;