patch: some X11 compliance fixed: set ClassHint and better fullscreen mode

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1138 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi_esp 2001-06-17 01:22:09 +00:00
parent 255ab08f9d
commit 9e90ab5430
7 changed files with 40 additions and 7 deletions

View File

@ -188,6 +188,7 @@ create_window(Display *display)
mywindow = XCreateWindow(display, RootWindow(display,screen),
hint.x, hint.y, hint.width, hint.height, 4, bpp,CopyFromParent,vinfo.visual,xswamask,&xswa);
vo_x11_classhint( display,mywindow,"3dfx" );
XSelectInput(display, mywindow, StructureNotifyMask);

View File

@ -183,6 +183,8 @@ init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint3
mywindow = XCreateWindow(mydisplay, RootWindow(mydisplay,screen),
hint.x, hint.y, hint.width, hint.height, 4, vinfo->depth,CopyFromParent,vinfo->visual,xswamask,&xswa);
vo_x11_classhint( mydisplay,mywindow,"gl" );
vo_hidecursor(mydisplay,mywindow);
wsGLXContext=glXCreateContext( mydisplay,vinfo,NULL,True );

View File

@ -117,6 +117,7 @@ static uint32_t init( uint32_t width,uint32_t height,uint32_t d_width,uint32_t d
{
// int screen;
int fullscreen=0;
int vm=0;
// int interval, prefer_blank, allow_exp, nothing;
unsigned int fg,bg;
char *hello=( title == NULL ) ? "X11 render" : title;
@ -141,11 +142,12 @@ static uint32_t init( uint32_t width,uint32_t height,uint32_t d_width,uint32_t d
hint.width=image_width;
hint.height=image_height;
if( flags&0x01 ) fullscreen = 1;
if( flags&0x03 ) fullscreen = 1;
if( flags&0x02 ) vm = 1;
if( flags&0x08 ) Flip_Flag = 1;
#ifdef HAVE_XF86VM
if (fullscreen) {
if (vm) {
unsigned int modeline_width, modeline_height, vm_event, vm_error;
unsigned int vm_ver, vm_rev;
int i,j,have_vm=0,X,Y;
@ -221,6 +223,7 @@ static uint32_t init( uint32_t width,uint32_t height,uint32_t d_width,uint32_t d
hint.x,hint.y,
hint.width,hint.height,
xswa.border_pixel,depth,CopyFromParent,vinfo.visual,xswamask,&xswa );
vo_x11_classhint( mDisplay,mywindow,"x11" );
vo_hidecursor(mDisplay,mywindow);
if ( fullscreen ) vo_x11_decoration( mDisplay,mywindow,0 );
@ -315,7 +318,7 @@ static uint32_t init( uint32_t width,uint32_t height,uint32_t d_width,uint32_t d
bpp=myximage->bits_per_pixel;
printf( "X11 color mask: R:%lX G:%lX B:%lX\n",myximage->red_mask,myximage->green_mask,myximage->blue_mask );
// printf( "X11 color mask: R:%lX G:%lX B:%lX\n",myximage->red_mask,myximage->green_mask,myximage->blue_mask );
// If we have blue in the lowest bit then obviously RGB
mode=( ( myximage->blue_mask & 0x01 ) != 0 ) ? MODE_RGB : MODE_BGR;
@ -325,8 +328,9 @@ static uint32_t init( uint32_t width,uint32_t height,uint32_t d_width,uint32_t d
if ( myximage->byte_order != LSBFirst )
#endif
{
printf( "No support fon non-native XImage byte order!\n" );
return -1;
mode=( ( myximage->blue_mask & 0x01 ) != 0 ) ? MODE_BGR : MODE_RGB;
// printf( "No support fon non-native XImage byte order!\n" );
// return -1;
}
if( format==IMGFMT_YV12 ) yuv2rgb_init( ( depth == 24 ) ? bpp : depth,mode );

View File

@ -273,6 +273,7 @@ static uint32_t init( uint32_t width, uint32_t height, uint32_t d_width, uint32_
mDepth,
InputOutput,
vinfo.visual,xswamask,&xWAttribs );
vo_x11_classhint( mDisplay,mWindow,"xmga" );
vo_hidecursor(mDisplay,mWindow);
if ( mFullscreen ) vo_x11_decoration( mDisplay,mWindow,0 );

View File

@ -141,6 +141,7 @@ static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t
mywindow = XCreateWindow(mDisplay, RootWindow(mDisplay,mScreen),
hint.x, hint.y, hint.width, hint.height,
0, depth,CopyFromParent,vinfo.visual,xswamask,&xswa);
vo_x11_classhint( mDisplay,mywindow,"xv" );
vo_hidecursor(mDisplay,mywindow);
XSelectInput(mDisplay, mywindow, StructureNotifyMask | KeyPressMask );

View File

@ -49,6 +49,7 @@ int vo_init( void )
{
// int mScreen;
int bpp;
unsigned int mask;
// char * DisplayName = ":0.0";
// Display * mDisplay;
XImage * mXImage;
@ -78,12 +79,19 @@ int vo_init( void )
// get bits/pixel:
mXImage=XGetImage( mDisplay,mRootWin,0,0,1,1,AllPlanes,ZPixmap );
bpp=mXImage->bits_per_pixel;
if((vo_depthonscreen+7)/8 != (bpp+7)/8) vo_depthonscreen=bpp; // by A'rpi
mask=mXImage->red_mask|mXImage->green_mask|mXImage->blue_mask;
printf("vo: X11 color mask: %X (R:%lX G:%lX B:%lX)\n",
mask,mXImage->red_mask,mXImage->green_mask,mXImage->blue_mask);
if(((vo_depthonscreen+7)/8)==2){
if(mask==0x7FFF) vo_depthonscreen=15; else
if(mask==0xFFFF) vo_depthonscreen=16;
}
XDestroyImage( mXImage );
if((vo_depthonscreen+7)/8 != (bpp+7)/8) vo_depthonscreen=bpp; // by A'rpi
// XCloseDisplay( mDisplay );
#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");
printf("vo: X11 running at %dx%d depth: %d (\"%s\" => %s display)\n",vo_screenwidth,vo_screenheight,vo_depthonscreen,mDisplayName,mLocalDisplay?"local":"remote");
return 1;
}
@ -149,6 +157,14 @@ static Atom vo_MotifHints = None;
void vo_x11_decoration( Display * vo_Display,Window w,int d )
{
#if 1
XSetWindowAttributes attr;
attr.override_redirect = True;
XChangeWindowAttributes(vo_Display, w, CWOverrideRedirect, &attr);
// XMapWindow(vo_Display], w);
#endif
vo_MotifHints=XInternAtom( vo_Display,"_MOTIF_WM_HINTS",0 );
if ( vo_MotifHints != None )
{
@ -159,6 +175,13 @@ void vo_x11_decoration( Display * vo_Display,Window w,int d )
}
}
void vo_x11_classhint( Display * display,Window window,char *name ){
XClassHint wmClass;
wmClass.res_name = name;
wmClass.res_class = "MPlayer";
XSetClassHint(display,window,&wmClass);
}
#ifdef HAVE_GUI
Window vo_window = None;
GC vo_gc;

View File

@ -16,6 +16,7 @@ extern int mLocalDisplay;
int vo_init( void );
int vo_hidecursor ( Display* , Window );
void vo_x11_decoration( Display * vo_Display,Window w,int d );
void vo_x11_classhint( Display * display,Window window,char *name );
int vo_x11_check_events(Display *mydisplay);
#endif