void mplHideMenu( int mx,int my,int w ) { int x,y,i=mplMenuItem; if ( !appMPlayer.menuIsPresent || !appMPlayer.menuBase.Bitmap.Image ) return; x=mx-mplMenuX; y=my-mplMenuY; // x=RX - appMPlayer.menuWindow.X; // y=RY - appMPlayer.menuWindow.Y; wsVisibleWindow( &appMPlayer.menuWindow,wsHideWindow ); if ( ( x < 0 ) || ( y < 0 ) ) return; // printf( "---------> %d %d,%d\n",i,x,y ); // printf( "--------> mi: %d,%d %dx%d\n",appMPlayer.MenuItems[i].x,appMPlayer.MenuItems[i].y,appMPlayer.MenuItems[i].width,appMPlayer.MenuItems[i].height ); if ( wgIsRect( x,y, appMPlayer.MenuItems[i].x,appMPlayer.MenuItems[i].y, appMPlayer.MenuItems[i].x+appMPlayer.MenuItems[i].width, appMPlayer.MenuItems[i].y+appMPlayer.MenuItems[i].height ) ) { mplEventHandling( appMPlayer.MenuItems[i].msg,(float)w ); } }
static void uiPlaybarDraw( void ) { int x; if ( !guiApp.subWindow.isFullScreen ) return; if ( !playbarVisible || !guiApp.playbarIsPresent ) return; // guiApp.playbar.x=( guiApp.subWindow.Width - guiApp.playbar.width ) / 2; switch( guiApp.playbar.x ) { case -1: x=( guiApp.subWindow.Width - guiApp.playbar.width ) / 2; break; case -2: x=( guiApp.subWindow.Width - guiApp.playbar.width ); break; default: x=guiApp.playbar.x; } switch ( uiPlaybarFade ) { case 1: // fade in playbarLength--; if ( guiApp.subWindow.Height - guiApp.playbar.height >= playbarLength ) { playbarLength=guiApp.subWindow.Height - guiApp.playbar.height; uiPlaybarFade=0; vo_mouse_autohide=0; } wsMoveWindow( &guiApp.playbarWindow,True,x,playbarLength ); break; case 2: // fade out playbarLength+=10; if ( playbarLength > guiApp.subWindow.Height ) { playbarLength=guiApp.subWindow.Height; uiPlaybarFade=playbarVisible=0; vo_mouse_autohide=1; wsVisibleWindow( &guiApp.playbarWindow,wsHideWindow ); return; } wsMoveWindow( &guiApp.playbarWindow,True,x,playbarLength ); break; } // --- render if ( guiApp.playbarWindow.State == wsWindowExpose ) { btnModify( evSetMoviePosition,guiInfo.Position ); btnModify( evSetVolume,guiInfo.Volume ); vo_mouse_autohide=0; fast_memcpy( playbarDrawBuffer,guiApp.playbar.Bitmap.Image,guiApp.playbar.Bitmap.ImageSize ); RenderAll( &guiApp.playbarWindow,guiApp.playbarItems,guiApp.IndexOfPlaybarItems,playbarDrawBuffer ); wsConvert( &guiApp.playbarWindow,playbarDrawBuffer ); } wsPutImage( &guiApp.playbarWindow ); }
void uiPlaybarShow( int x, int y ) { if ( !guiApp.playbarIsPresent || !gtkEnablePlayBar ) return; if ( !guiApp.subWindow.isFullScreen ) return; if ( y > guiApp.subWindow.Height - guiApp.playbar.height ) { if ( !uiPlaybarFade ) wsVisibleWindow( &guiApp.playbarWindow,wsShowWindow ); uiPlaybarFade=1; playbarVisible=1; wsPostRedisplay( &guiApp.playbarWindow ); } else if ( !uiPlaybarFade ) uiPlaybarFade=2; }
void mplEnd(void) { plItem *next; if (!mplGotoTheNext && guiIntfStruct.Playing) { mplGotoTheNext = 1; return; } if (guiIntfStruct.Playing && (next = gtkSet(gtkGetNextPlItem, 0, NULL)) && (plLastPlayed != next)) { plLastPlayed = next; guiSetDF(guiIntfStruct.Filename, next->path, next->name); guiIntfStruct.StreamType = STREAMTYPE_FILE; guiIntfStruct.FilenameChanged = guiIntfStruct.NewPlay = 1; gfree((void **)&guiIntfStruct.AudioFile); gfree((void **)&guiIntfStruct.Subtitlename); } else { if (guiIntfStruct.FilenameChanged || guiIntfStruct.NewPlay) return; guiIntfStruct.TimeSec = 0; guiIntfStruct.Position = 0; guiIntfStruct.AudioType = 0; guiIntfStruct.NoWindow = False; #ifdef CONFIG_DVDREAD guiIntfStruct.DVD.current_title = 1; guiIntfStruct.DVD.current_chapter = 1; guiIntfStruct.DVD.current_angle = 1; #endif if (!appMPlayer.subWindow.isFullScreen && gtkShowVideoWindow) { wsResizeWindow(&appMPlayer.subWindow, appMPlayer.sub.width, appMPlayer.sub.height); wsMoveWindow(&appMPlayer.subWindow, True, appMPlayer.sub.x, appMPlayer.sub.y); } else wsVisibleWindow(&appMPlayer.subWindow, wsHideWindow); guiGetEvent(guiCEvent, guiSetStop); mplSubRender = 1; wsSetBackgroundRGB(&appMPlayer.subWindow, appMPlayer.sub.R, appMPlayer.sub.G, appMPlayer.sub.B); wsClearWindow(appMPlayer.subWindow); wsPostRedisplay(&appMPlayer.subWindow); } }
void mplShowMenu( int mx,int my ) { int x,y; if ( !appMPlayer.menuIsPresent || !appMPlayer.menuBase.Bitmap.Image ) return; x=mx; if ( x + appMPlayer.menuWindow.Width > wsMaxX ) x=wsMaxX - appMPlayer.menuWindow.Width - 1 + wsOrgX; y=my; if ( y + appMPlayer.menuWindow.Height > wsMaxY ) y=wsMaxY - appMPlayer.menuWindow.Height - 1 + wsOrgY; mplMenuX=x; mplMenuY=y; mplMenuItem = 0; wsMoveWindow( &appMPlayer.menuWindow,False,x,y ); wsMoveTopWindow( wsDisplay,appMPlayer.menuWindow.WindowID ); wsSetLayer( wsDisplay,appMPlayer.menuWindow.WindowID,1 ); mplMenuRender=1; wsVisibleWindow( &appMPlayer.menuWindow,wsShowWindow ); wsPostRedisplay( &appMPlayer.menuWindow ); }
void ChangeSkin( char * name ) { int ret; int prev = appMPlayer.menuIsPresent; int bprev = appMPlayer.barIsPresent; mainVisible=0; appInitStruct( &tmpList ); skinAppMPlayer=&tmpList; fntFreeFont(); ret=skinRead( name ); appInitStruct( &tmpList ); skinAppMPlayer=&appMPlayer; appInitStruct( &appMPlayer ); if ( ret ) name=skinName; if ( skinRead( name ) ) { mainVisible=1; return; } // --- reload menu window if ( prev && appMPlayer.menuIsPresent ) { free( mplMenuDrawBuffer ); if ( ( mplMenuDrawBuffer = calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL ) { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; } wsResizeWindow( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height ); wsResizeImage( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height ); wsSetShape( &appMPlayer.menuWindow,appMPlayer.menuBase.Mask.Image ); wsVisibleWindow( &appMPlayer.menuWindow,wsHideWindow ); } else { mplMenuInit(); } // --- reload sub window if ( appMPlayer.sub.Bitmap.Image ) wsResizeImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height ); if ( ( !appMPlayer.subWindow.isFullScreen )&&( !guiIntfStruct.Playing ) ) { wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height ); wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); } if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize ); if ( !guiIntfStruct.Playing ) { mplSubRender=1; wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B ); wsClearWindow( appMPlayer.subWindow ); wsPostRedisplay( &appMPlayer.subWindow ); } // --- reload play bar if ( bprev ) wsDestroyWindow( &appMPlayer.barWindow ); mplPBInit(); // --- reload main window free( mplDrawBuffer ); if ( ( mplDrawBuffer = calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; } wsDestroyWindow( &appMPlayer.mainWindow ); wsCreateWindow( &appMPlayer.mainWindow, appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height, wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsMaxSize|wsHideWindow,"MPlayer" ); wsCreateImage( &appMPlayer.mainWindow,appMPlayer.main.Bitmap.Width,appMPlayer.main.Bitmap.Height ); wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); wsSetIcon( wsDisplay,appMPlayer.mainWindow.WindowID,guiIcon,guiIconMask ); appMPlayer.mainWindow.ReDraw=(void *)mplMainDraw; appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle; appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle; appMPlayer.mainWindow.DandDHandler=mplDandDHandler; wsXDNDMakeAwareness( &appMPlayer.mainWindow ); if ( !appMPlayer.mainDecoration ) wsWindowDecoration( &appMPlayer.mainWindow,0 ); wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow ); mainVisible=1; // --- btnModify( evSetVolume,guiIntfStruct.Volume ); btnModify( evSetBalance,guiIntfStruct.Balance ); btnModify( evSetMoviePosition,guiIntfStruct.Position ); btnModify( evFullScreen,!appMPlayer.subWindow.isFullScreen ); wsSetLayer( wsDisplay,appMPlayer.mainWindow.WindowID,appMPlayer.subWindow.isFullScreen ); wsSetLayer( wsDisplay,appMPlayer.menuWindow.WindowID,appMPlayer.subWindow.isFullScreen ); }
int guiGetEvent( int type,void * arg ) { const ao_functions_t *audio_out = NULL; const vo_functions_t *video_out = NULL; mixer_t *mixer = NULL; stream_t * stream = arg; #ifdef CONFIG_DVDREAD dvd_priv_t * dvdp = arg; #endif if (guiIntfStruct.mpcontext) { audio_out = mpctx_get_audio_out(guiIntfStruct.mpcontext); video_out = mpctx_get_video_out(guiIntfStruct.mpcontext); mixer = mpctx_get_mixer(guiIntfStruct.mpcontext); } switch ( type ) { case guiXEvent: guiIntfStruct.event_struct=arg; wsEvents( wsDisplay,arg,NULL ); gtkEventHandling(); break; case guiCEvent: switch ( (int)arg ) { case guiSetPlay: guiIntfStruct.Playing=1; // if ( !gtkShowVideoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); break; case guiSetStop: guiIntfStruct.Playing=0; // if ( !gtkShowVideoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); break; case guiSetPause: guiIntfStruct.Playing=2; break; } mplState(); break; case guiSetState: mplState(); break; case guiSetFileName: if ( arg ) guiSetFilename( guiIntfStruct.Filename,arg ); break; case guiSetAudioOnly: guiIntfStruct.AudioOnly=(int)arg; if ( (int)arg ) { guiIntfStruct.NoWindow=True; wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); } else wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); break; case guiSetContext: guiIntfStruct.mpcontext=arg; case guiSetDemuxer: guiIntfStruct.demuxer=arg; break; case guiSetAfilter: guiIntfStruct.afilter=arg; break; case guiSetShVideo: { if ( !appMPlayer.subWindow.isFullScreen ) { wsResizeWindow( &appMPlayer.subWindow,vo_dwidth,vo_dheight ); wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); } guiIntfStruct.MovieWidth=vo_dwidth; guiIntfStruct.MovieHeight=vo_dheight; if (guiWinID>=0) wsMoveWindow( &appMPlayer.mainWindow,0,0, vo_dheight); WinID = appMPlayer.subWindow.WindowID; } break; #ifdef CONFIG_DVDREAD case guiSetDVD: guiIntfStruct.DVD.titles=dvdp->vmg_file->tt_srpt->nr_of_srpts; guiIntfStruct.DVD.chapters=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts; guiIntfStruct.DVD.angles=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_angles; guiIntfStruct.DVD.nr_of_audio_channels=dvdp->nr_of_channels; memcpy( guiIntfStruct.DVD.audio_streams,dvdp->audio_streams,sizeof( dvdp->audio_streams ) ); guiIntfStruct.DVD.nr_of_subtitles=dvdp->nr_of_subtitles; memcpy( guiIntfStruct.DVD.subtitles,dvdp->subtitles,sizeof( dvdp->subtitles ) ); guiIntfStruct.DVD.current_title=dvd_title + 1; guiIntfStruct.DVD.current_chapter=dvd_chapter + 1; guiIntfStruct.DVD.current_angle=dvd_angle + 1; guiIntfStruct.Track=dvd_title + 1; break; #endif case guiSetStream: guiIntfStruct.StreamType=stream->type; switch( stream->type ) { #ifdef CONFIG_DVDREAD case STREAMTYPE_DVD: guiGetEvent( guiSetDVD,(char *)stream->priv ); break; #endif #ifdef CONFIG_VCD case STREAMTYPE_VCD: { int i; if (!stream->priv) { guiIntfStruct.VCDTracks=0; break; } for ( i=1;i < 100;i++ ) if ( vcd_seek_to_track( stream->priv,i ) < 0 ) break; vcd_seek_to_track( stream->priv,vcd_track ); guiIntfStruct.VCDTracks=--i; break; } #endif default: break; } break; case guiIEvent: mp_msg( MSGT_GPLAYER,MSGL_V,"cmd: %d\n",(int)arg ); switch( (int)arg ) { case MP_CMD_QUIT: mplEventHandling( evExit,0 ); break; case MP_CMD_VO_FULLSCREEN: mplEventHandling( evFullScreen,0 ); break; } break; case guiReDraw: mplEventHandling( evRedraw,0 ); break; case guiSetVolume: if ( audio_out ) { float l,r; mixer_getvolume( mixer,&l,&r ); guiIntfStruct.Volume=(r>l?r:l); if ( r != l ) guiIntfStruct.Balance=( ( r - l ) + 100 ) * 0.5f; else guiIntfStruct.Balance=50.0f; btnModify( evSetVolume,guiIntfStruct.Volume ); btnModify( evSetBalance,guiIntfStruct.Balance ); } break; case guiSetFileFormat: guiIntfStruct.FileFormat=(int)arg; break; case guiSetValues: // -- video guiIntfStruct.sh_video=arg; if ( arg ) { sh_video_t * sh = arg; guiIntfStruct.FPS=sh->fps; } if ( guiIntfStruct.NoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); if ( guiIntfStruct.StreamType == STREAMTYPE_STREAM ) btnSet( evSetMoviePosition,btnDisabled ); else btnSet( evSetMoviePosition,btnReleased ); // -- audio if ( audio_out ) { float l,r; mixer_getvolume( mixer,&l,&r ); guiIntfStruct.Volume=(r>l?r:l); if ( r != l ) guiIntfStruct.Balance=( ( r - l ) + 100 ) * 0.5f; else guiIntfStruct.Balance=50.0f; btnModify( evSetVolume,guiIntfStruct.Volume ); btnModify( evSetBalance,guiIntfStruct.Balance ); } if ( gtkEnableAudioEqualizer ) { equalizer_t eq; int i,j; for ( i=0;i<6;i++ ) for ( j=0;j<10;j++ ) { eq.channel=i; eq.band=j; eq.gain=gtkEquChannels[i][j]; gtkSet( gtkSetEqualizer,0,&eq ); } } // -- subtitle #ifdef CONFIG_DXR3 if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) && guiIntfStruct.FileFormat != DEMUXER_TYPE_MPEG_PS && !gtkVfLAVC ) { gtkMessageBox( GTK_MB_FATAL,MSGTR_NEEDLAVC ); guiIntfStruct.Playing=0; return True; } #endif break; case guiSetDefaults: // if ( guiIntfStruct.Playing == 1 && guiIntfStruct.FilenameChanged ) if ( guiIntfStruct.FilenameChanged ) { audio_id=-1; video_id=-1; dvdsub_id=-1; vobsub_id=-1; stream_cache_size=-1; autosync=0; vcd_track=0; dvd_title=0; force_fps=0; } guiIntfStruct.demuxer=NULL; guiIntfStruct.sh_video=NULL; wsPostRedisplay( &appMPlayer.subWindow ); break; case guiSetParameters: guiGetEvent( guiSetDefaults,NULL ); switch ( guiIntfStruct.StreamType ) { case STREAMTYPE_PLAYLIST: break; #ifdef CONFIG_VCD case STREAMTYPE_VCD: { char tmp[512]; sprintf( tmp,"vcd://%d",guiIntfStruct.Track + 1 ); guiSetFilename( guiIntfStruct.Filename,tmp ); } break; #endif #ifdef CONFIG_DVDREAD case STREAMTYPE_DVD: { char tmp[512]; sprintf( tmp,"dvd://%d",guiIntfStruct.Title ); guiSetFilename( guiIntfStruct.Filename,tmp ); } dvd_chapter=guiIntfStruct.Chapter; dvd_angle=guiIntfStruct.Angle; break; #endif } //if ( guiIntfStruct.StreamType != STREAMTYPE_PLAYLIST ) // Does not make problems anymore! { if ( guiIntfStruct.Filename ) filename=gstrdup( guiIntfStruct.Filename ); else if ( filename ) guiSetFilename( guiIntfStruct.Filename,filename ); } // --- video opts if ( !video_driver_list ) { int i = 0; while ( video_out_drivers[i++] ) if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE ) { gaddlist( &video_driver_list,(char *)video_out_drivers[i - 1]->info->short_name ); break; } } if ( !video_driver_list && !video_driver_list[0] ) { gtkMessageBox( GTK_MB_FATAL,MSGTR_IDFGCVD ); exit_player(EXIT_ERROR); } { int i = 0; guiIntfStruct.NoWindow=False; while ( video_out_drivers[i++] ) if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE ) { if ( ( video_driver_list && !gstrcmp( video_driver_list[0],(char *)video_out_drivers[i - 1]->info->short_name ) )&&( video_out_drivers[i - 1]->control( VOCTRL_GUI_NOWINDOW,NULL ) == VO_TRUE ) ) { guiIntfStruct.NoWindow=True; break; } } } #ifdef CONFIG_DXR3 remove_vf( "lavc" ); if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) ) { if ( ( guiIntfStruct.StreamType != STREAMTYPE_DVD)&&( guiIntfStruct.StreamType != STREAMTYPE_VCD ) ) { if ( gtkVfLAVC ) add_vf( "lavc" ); } } #endif // --- if ( gtkVfPP ) add_vf( "pp" ); else remove_vf( "pp" ); // --- audio opts // if ( ao_plugin_cfg.plugin_list ) { free( ao_plugin_cfg.plugin_list ); ao_plugin_cfg.plugin_list=NULL; } if (gtkAONorm) greplace(&af_cfg.list, "volnorm", "volnorm"); if (gtkEnableAudioEqualizer) greplace(&af_cfg.list, "equalizer", "equalizer"); if ( gtkAOExtraStereo ) { char *name = malloc(12 + 20 + 1); snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul); name[12 + 20] = 0; greplace(&af_cfg.list, "extrastereo", name); free(name); } #ifdef CONFIG_OSS_AUDIO if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"oss",3 ) ) { char *tmp; mixer_device = gtkAOOSSMixer; mixer_channel = gtkAOOSSMixerChannel; if (gtkAOOSSDevice) { tmp = calloc( 1,strlen( gtkAOOSSDevice ) + 7 ); sprintf( tmp,"oss:%s",gtkAOOSSDevice ); } else tmp = strdup("oss"); gaddlist( &audio_driver_list,tmp ); free(tmp); } #endif #ifdef CONFIG_ALSA if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"alsa",4 ) ) { char *tmp; mixer_device = gtkAOALSAMixer; mixer_channel = gtkAOALSAMixerChannel; if (gtkAOALSADevice) { tmp = calloc( 1,strlen( gtkAOALSADevice ) + 14 ); sprintf( tmp,"alsa:device=%s",gtkAOALSADevice ); } else tmp = strdup("alsa"); gaddlist( &audio_driver_list,tmp ); free(tmp); } #endif #ifdef CONFIG_SDL if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"sdl",3 ) ) { char *tmp; if (gtkAOSDLDriver) { tmp = calloc( 1,strlen( gtkAOSDLDriver ) + 10 ); sprintf( tmp,"sdl:%s",gtkAOSDLDriver ); } else tmp = strdup("sdl"); gaddlist( &audio_driver_list,tmp ); free(tmp); } #endif #ifdef CONFIG_ESD if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"esd",3 ) ) { char *tmp; if (gtkAOESDDevice) { tmp = calloc( 1,strlen( gtkAOESDDevice ) + 10 ); sprintf( tmp,"esd:%s",gtkAOESDDevice ); } else tmp = strdup("esd"); gaddlist( &audio_driver_list,tmp ); free(tmp); } #endif // -- subtitle //subdata->filename=gstrdup( guiIntfStruct.Subtitlename ); stream_dump_type=0; if ( gtkSubDumpMPSub ) stream_dump_type=4; if ( gtkSubDumpSrt ) stream_dump_type=6; gtkSubDumpMPSub=gtkSubDumpSrt=0; guiLoadFont(); // --- misc if ( gtkCacheOn ) stream_cache_size=gtkCacheSize; if ( gtkAutoSyncOn ) autosync=gtkAutoSync; if ( guiIntfStruct.AudioFile ) audio_stream=gstrdup( guiIntfStruct.AudioFile ); else if ( guiIntfStruct.FilenameChanged ) gfree( (void**)&audio_stream ); //audio_stream=NULL; guiIntfStruct.DiskChanged=0; guiIntfStruct.FilenameChanged=0; guiIntfStruct.NewPlay=0; #ifdef CONFIG_ASS ass_enabled = gtkASS.enabled; ass_use_margins = gtkASS.use_margins; ass_top_margin = gtkASS.top_margin; ass_bottom_margin = gtkASS.bottom_margin; #endif break; } return False; }
void guiInit( void ) { int i; memset( &guiIntfStruct,0,sizeof( guiIntfStruct ) ); guiIntfStruct.Balance=50.0f; guiIntfStruct.StreamType=-1; memset( >kEquChannels,0,sizeof( gtkEquChannels ) ); #ifdef CONFIG_DXR3 if ( !gtkDXR3Device ) gtkDXR3Device=strdup( "/dev/em8300-0" ); #endif if ( stream_cache_size > 0 ) { gtkCacheOn=1; gtkCacheSize=stream_cache_size; } else if ( stream_cache_size == 0 ) gtkCacheOn = 0; if ( autosync && autosync != gtkAutoSync ) { gtkAutoSyncOn=1; gtkAutoSync=autosync; } #ifdef CONFIG_ASS gtkASS.enabled = ass_enabled; gtkASS.use_margins = ass_use_margins; gtkASS.top_margin = ass_top_margin; gtkASS.bottom_margin = ass_bottom_margin; #endif gtkInit(); // --- initialize X wsXInit( (void *)mDisplay ); // --- load skin skinDirInHome=get_path("skins"); skinDirInHome_obsolete=get_path("Skin"); skinMPlayerDir=MPLAYER_DATADIR "/skins"; skinMPlayerDir_obsolete=MPLAYER_DATADIR "/Skin"; mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 1: '%s'\n",skinDirInHome); mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 1 (obsolete): '%s'\n",skinDirInHome_obsolete); mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 2: '%s'\n",skinMPlayerDir); mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 2 (obsolete): '%s'\n",skinMPlayerDir_obsolete); if ( !skinName ) skinName=strdup( "default" ); i = skinRead( skinName ); if ((i == -1) && strcmp(skinName,"default")) { mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_SKIN_SKINCFG_SelectedSkinNotFound, skinName); skinName=strdup( "default" ); i = skinRead( skinName ); } switch (i) { case -1: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinNotFound,skinName ); exit( 0 ); case -2: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinCfgReadError,skinName ); exit( 0 ); } // --- initialize windows if ( ( mplDrawBuffer = malloc( appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) { fprintf( stderr,MSGTR_NEMDB ); exit( 0 ); } if ( gui_save_pos ) { appMPlayer.main.x = gui_main_pos_x; appMPlayer.main.y = gui_main_pos_y; appMPlayer.sub.x = gui_sub_pos_x; appMPlayer.sub.y = gui_sub_pos_y; } if (WinID>0) { appMPlayer.subWindow.Parent=WinID; appMPlayer.sub.x=0; appMPlayer.sub.y=0; } if (guiWinID>=0) appMPlayer.mainWindow.Parent=guiWinID; wsCreateWindow( &appMPlayer.subWindow, appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height, wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsHideWindow,"MPlayer - Video" ); wsDestroyImage( &appMPlayer.subWindow ); wsCreateImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height ); wsXDNDMakeAwareness(&appMPlayer.subWindow); mplMenuInit(); mplPBInit(); // i=wsHideFrame|wsMaxSize|wsHideWindow; // if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow; i=wsShowFrame|wsMaxSize|wsHideWindow; wsCreateWindow( &appMPlayer.mainWindow, appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height, wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" ); wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); wsXDNDMakeAwareness(&appMPlayer.mainWindow); #ifdef DEBUG mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] depth on screen: %d\n",wsDepthOnScreen ); mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID ); mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID ); #endif appMPlayer.mainWindow.ReDraw=(void *)mplMainDraw; appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle; appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle; appMPlayer.mainWindow.DandDHandler=mplDandDHandler; appMPlayer.subWindow.ReDraw=(void *)mplSubDraw; appMPlayer.subWindow.MouseHandler=mplSubMouseHandle; appMPlayer.subWindow.KeyHandler=mplMainKeyHandle; appMPlayer.subWindow.DandDHandler=mplDandDHandler; wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B ); wsClearWindow( appMPlayer.subWindow ); if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize ); btnModify( evSetVolume,guiIntfStruct.Volume ); btnModify( evSetBalance,guiIntfStruct.Balance ); btnModify( evSetMoviePosition,guiIntfStruct.Position ); wsSetIcon( wsDisplay,appMPlayer.mainWindow.WindowID,guiIcon,guiIconMask ); wsSetIcon( wsDisplay,appMPlayer.subWindow.WindowID,guiIcon,guiIconMask ); guiIntfStruct.Playing=0; if ( !appMPlayer.mainDecoration ) wsWindowDecoration( &appMPlayer.mainWindow,0 ); wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow ); #if 0 wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); { XEvent xev; do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID ); appMPlayer.subWindow.Mapped=wsMapped; } if ( !fullscreen ) fullscreen=gtkLoadFullscreen; if ( fullscreen ) { mplFullScreen(); btnModify( evFullScreen,btnPressed ); } #else if ( !fullscreen ) fullscreen=gtkLoadFullscreen; if ( gtkShowVideoWindow ) { wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); { XEvent xev; do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID ); appMPlayer.subWindow.Mapped=wsMapped; } if ( fullscreen ) { mplFullScreen(); btnModify( evFullScreen,btnPressed ); } } else { if ( fullscreen ) { wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); { XEvent xev; do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID ); appMPlayer.subWindow.Mapped=wsMapped; } wsVisibleWindow( &appMPlayer.subWindow, wsShowWindow ); mplFullScreen(); btnModify( evFullScreen,btnPressed ); } } #endif mplSubRender=1; // --- if ( filename ) mplSetFileName( NULL,filename,STREAMTYPE_FILE ); if ( plCurrent && !filename ) mplSetFileName( plCurrent->path,plCurrent->name,STREAMTYPE_FILE ); if ( subdata ) guiSetFilename( guiIntfStruct.Subtitlename, subdata->filename ); guiLoadFont(); }
int gui(int what, void *arg) { mixer_t *mixer = NULL; stream_t *stream; #ifdef CONFIG_DVDREAD dvd_priv_t *dvd; #endif plItem *next; if (guiInfo.mpcontext) mixer = mpctx_get_mixer(guiInfo.mpcontext); switch (what) { case GUI_SET_CONTEXT: guiInfo.mpcontext = arg; break; case GUI_SET_STATE: switch ((int)arg) { case GUI_STOP: case GUI_PLAY: // if ( !gtkShowVideoWindow ) wsVisibleWindow( &guiApp.subWindow,wsHideWindow ); case GUI_PAUSE: guiInfo.Playing = (int)arg; break; } uiState(); break; case GUI_SET_FILE: // if ( guiInfo.Playing == 1 && guiInfo.FilenameChanged ) if (guiInfo.FilenameChanged) { audio_id = -1; video_id = -1; dvdsub_id = -1; vobsub_id = -1; stream_cache_size = -1; autosync = 0; dvd_title = 0; force_fps = 0; } guiInfo.sh_video = NULL; wsPostRedisplay(&guiApp.subWindow); break; case GUI_RUN_COMMAND: mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[interface] GUI_RUN_COMMAND: %d\n", (int)arg); switch ((int)arg) { case MP_CMD_VO_FULLSCREEN: uiEventHandling(evFullScreen, 0); break; case MP_CMD_PLAY_TREE_STEP: uiEventHandling(evNext, 0); break; case -MP_CMD_PLAY_TREE_STEP: uiEventHandling(evPrev, 0); break; case MP_CMD_STOP: uiEventHandling(evStop, 0); break; case MP_CMD_QUIT: uiEventHandling(evExit, 0); break; } break; case GUI_PREPARE: gui(GUI_SET_FILE, 0); switch (guiInfo.StreamType) { case STREAMTYPE_PLAYLIST: break; #ifdef CONFIG_VCD case STREAMTYPE_VCD: { char tmp[512]; sprintf(tmp, "vcd://%d", guiInfo.Track + 1); guiSetFilename(guiInfo.Filename, tmp); } break; #endif #ifdef CONFIG_DVDREAD case STREAMTYPE_DVD: { char tmp[512]; sprintf(tmp, "dvd://%d", guiInfo.Title); guiSetFilename(guiInfo.Filename, tmp); } dvd_chapter = guiInfo.Chapter; dvd_angle = guiInfo.Angle; break; #endif } // if ( guiInfo.StreamType != STREAMTYPE_PLAYLIST ) // Does not make problems anymore! { if (guiInfo.Filename) filename = gstrdup(guiInfo.Filename); else if (filename) guiSetFilename(guiInfo.Filename, filename); } // video opts if (!video_driver_list) { int i = 0; while (video_out_drivers[i++]) { if (video_out_drivers[i - 1]->control(VOCTRL_GUISUPPORT, NULL) == VO_TRUE) { gaddlist(&video_driver_list, (char *)video_out_drivers[i - 1]->info->short_name); break; } } } if (!video_driver_list && !video_driver_list[0]) { gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_IDFGCVD); guiExit(EXIT_ERROR); } { int i = 0; guiInfo.MovieWindow = True; while (video_out_drivers[i++]) { if (video_out_drivers[i - 1]->control(VOCTRL_GUISUPPORT, NULL) == VO_TRUE) { if ((video_driver_list && !gstrcmp(video_driver_list[0], (char *)video_out_drivers[i - 1]->info->short_name)) && (video_out_drivers[i - 1]->control(VOCTRL_GUI_NOWINDOW, NULL) == VO_TRUE)) { guiInfo.MovieWindow = False; break; } } } } #ifdef CONFIG_DXR3 if (video_driver_list && !gstrcmp(video_driver_list[0], "dxr3")) if (guiInfo.StreamType != STREAMTYPE_DVD && guiInfo.StreamType != STREAMTYPE_VCD) if (gtkVfLAVC) add_vf("lavc"); #endif if (gtkVfPP) add_vf("pp"); // audio opts // if ( ao_plugin_cfg.plugin_list ) { free( ao_plugin_cfg.plugin_list ); ao_plugin_cfg.plugin_list=NULL; } if (gtkAONorm) greplace(&af_cfg.list, "volnorm", "volnorm"); if (gtkEnableAudioEqualizer) greplace(&af_cfg.list, "equalizer", "equalizer"); if (gtkAOExtraStereo) { char *name; name = malloc(12 + 20 + 1); snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul); name[12 + 20] = 0; greplace(&af_cfg.list, "extrastereo", name); free(name); } #ifdef CONFIG_OSS_AUDIO if (audio_driver_list && !gstrncmp(audio_driver_list[0], "oss", 3)) { char *tmp; mixer_device = gtkAOOSSMixer; mixer_channel = gtkAOOSSMixerChannel; if (gtkAOOSSDevice) { tmp = calloc(1, strlen(gtkAOOSSDevice) + 7); sprintf(tmp, "oss:%s", gtkAOOSSDevice); } else tmp = strdup("oss"); gaddlist(&audio_driver_list, tmp); free(tmp); } #endif #ifdef CONFIG_ALSA if (audio_driver_list && !gstrncmp(audio_driver_list[0], "alsa", 4)) { char *tmp; mixer_device = gtkAOALSAMixer; mixer_channel = gtkAOALSAMixerChannel; if (gtkAOALSADevice) { tmp = calloc(1, strlen(gtkAOALSADevice) + 14); sprintf(tmp, "alsa:device=%s", gtkAOALSADevice); } else tmp = strdup("alsa"); gaddlist(&audio_driver_list, tmp); free(tmp); } #endif #ifdef CONFIG_SDL if (audio_driver_list && !gstrncmp(audio_driver_list[0], "sdl", 3)) { char *tmp; if (gtkAOSDLDriver) { tmp = calloc(1, strlen(gtkAOSDLDriver) + 10); sprintf(tmp, "sdl:%s", gtkAOSDLDriver); } else tmp = strdup("sdl"); gaddlist(&audio_driver_list, tmp); free(tmp); } #endif #ifdef CONFIG_ESD if (audio_driver_list && !gstrncmp(audio_driver_list[0], "esd", 3)) { char *tmp; if (gtkAOESDDevice) { tmp = calloc(1, strlen(gtkAOESDDevice) + 10); sprintf(tmp, "esd:%s", gtkAOESDDevice); } else tmp = strdup("esd"); gaddlist(&audio_driver_list, tmp); free(tmp); } #endif // subtitle // subdata->filename=gstrdup( guiInfo.Subtitlename ); stream_dump_type = 0; if (gtkSubDumpMPSub) stream_dump_type = 4; if (gtkSubDumpSrt) stream_dump_type = 6; gtkSubDumpMPSub = gtkSubDumpSrt = 0; guiLoadFont(); // misc if (gtkCacheOn) stream_cache_size = gtkCacheSize; if (gtkAutoSyncOn) autosync = gtkAutoSync; if (guiInfo.AudioFile) audio_stream = gstrdup(guiInfo.AudioFile); else if (guiInfo.FilenameChanged) gfree((void **)&audio_stream); // audio_stream = NULL; guiInfo.DiskChanged = 0; guiInfo.FilenameChanged = 0; guiInfo.NewPlay = 0; #ifdef CONFIG_ASS ass_enabled = gtkASS.enabled; ass_use_margins = gtkASS.use_margins; ass_top_margin = gtkASS.top_margin; ass_bottom_margin = gtkASS.bottom_margin; #endif break; case GUI_SET_STREAM: stream = arg; guiInfo.StreamType = stream->type; switch (guiInfo.StreamType) { #ifdef CONFIG_DVDREAD case STREAMTYPE_DVD: dvd = stream->priv; guiInfo.DVD.titles = dvd->vmg_file->tt_srpt->nr_of_srpts; guiInfo.DVD.chapters = dvd->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts; guiInfo.DVD.angles = dvd->vmg_file->tt_srpt->title[dvd_title].nr_of_angles; guiInfo.DVD.nr_of_audio_channels = dvd->nr_of_channels; memcpy(guiInfo.DVD.audio_streams, dvd->audio_streams, sizeof(dvd->audio_streams)); guiInfo.DVD.nr_of_subtitles = dvd->nr_of_subtitles; memcpy(guiInfo.DVD.subtitles, dvd->subtitles, sizeof(dvd->subtitles)); guiInfo.DVD.current_title = dvd_title + 1; guiInfo.DVD.current_chapter = dvd_chapter + 1; guiInfo.DVD.current_angle = dvd_angle + 1; guiInfo.Track = dvd_title + 1; break; #endif #ifdef CONFIG_VCD case STREAMTYPE_VCD: guiInfo.VCDTracks = 0; stream_control(stream, STREAM_CTRL_GET_NUM_CHAPTERS, &guiInfo.VCDTracks); break; #endif default: break; } break; case GUI_SET_AFILTER: guiInfo.afilter = arg; break; case GUI_SET_VIDEO: // video guiInfo.sh_video = arg; if (arg) { sh_video_t *sh = arg; guiInfo.FPS = sh->fps; } if (guiInfo.StreamType == STREAMTYPE_STREAM) btnSet(evSetMoviePosition, btnDisabled); else btnSet(evSetMoviePosition, btnReleased); #ifdef CONFIG_DXR3 if (video_driver_list && !gstrcmp(video_driver_list[0], "dxr3") && (((demuxer_t *)mpctx_get_demuxer(guiInfo.mpcontext))->file_format != DEMUXER_TYPE_MPEG_PS) && !gtkVfLAVC) { gtkMessageBox(GTK_MB_FATAL, MSGTR_NEEDLAVC); return False; } #endif break; case GUI_SET_AUDIO: guiInfo.AudioChannels = arg ? ((sh_audio_t *)arg)->channels : 0; if (arg && !guiInfo.sh_video) guiInfo.MovieWindow = False; gui(GUI_SET_MIXER, 0); if (gtkEnableAudioEqualizer) { equalizer_t eq; unsigned int i, j; for (i = 0; i < FF_ARRAY_ELEMS(gtkEquChannels); i++) { for (j = 0; j < FF_ARRAY_ELEMS(*gtkEquChannels); j++) { eq.channel = i; eq.band = j; eq.gain = gtkEquChannels[i][j]; gtkSet(gtkSetEqualizer, 0, &eq); } } } wsVisibleWindow(&guiApp.subWindow, (guiInfo.MovieWindow ? wsShowWindow : wsHideWindow)); break; case GUI_SET_MIXER: if (mixer) { float l, r; static float last_balance = -1; mixer_getvolume(mixer, &l, &r); guiInfo.Volume = FFMAX(l, r); btnModify(evSetVolume, guiInfo.Volume); if (guiInfo.Balance != last_balance) { if (guiInfo.Volume) guiInfo.Balance = ((r - l) / guiInfo.Volume + 1.0) * 50.0; else guiInfo.Balance = 50.0f; last_balance = guiInfo.Balance; btnModify(evSetBalance, guiInfo.Balance); } } break; case GUI_REDRAW: uiEventHandling(evRedraw, 0); break; case GUI_SETUP_VIDEO_WINDOW: if (!guiApp.subWindow.isFullScreen) { wsResizeWindow(&guiApp.subWindow, vo_dwidth, vo_dheight); wsMoveWindow(&guiApp.subWindow, True, guiApp.sub.x, guiApp.sub.y); } guiInfo.MovieWidth = vo_dwidth; guiInfo.MovieHeight = vo_dheight; if (guiWinID >= 0) wsMoveWindow(&guiApp.mainWindow, False, 0, vo_dheight); WinID = guiApp.subWindow.WindowID; break; case GUI_X_EVENT: guiInfo.event_struct = arg; wsEvents(wsDisplay, arg); gtkEventHandling(); break; case GUI_END_FILE: if (!uiGotoTheNext && guiInfo.Playing) { uiGotoTheNext = 1; break; } if (guiInfo.Playing && (next = gtkSet(gtkGetNextPlItem, 0, NULL)) && (plLastPlayed != next)) { plLastPlayed = next; guiSetDF(guiInfo.Filename, next->path, next->name); guiInfo.StreamType = STREAMTYPE_FILE; guiInfo.FilenameChanged = guiInfo.NewPlay = 1; gfree((void **)&guiInfo.AudioFile); gfree((void **)&guiInfo.Subtitlename); } else { if (guiInfo.FilenameChanged || guiInfo.NewPlay) break; guiInfo.TimeSec = 0; guiInfo.Position = 0; guiInfo.AudioChannels = 0; guiInfo.MovieWindow = True; #ifdef CONFIG_DVDREAD guiInfo.DVD.current_title = 1; guiInfo.DVD.current_chapter = 1; guiInfo.DVD.current_angle = 1; #endif if (!guiApp.subWindow.isFullScreen && gtkShowVideoWindow) { wsResizeWindow(&guiApp.subWindow, guiApp.sub.width, guiApp.sub.height); wsMoveWindow(&guiApp.subWindow, True, guiApp.sub.x, guiApp.sub.y); } else wsVisibleWindow(&guiApp.subWindow, wsHideWindow); gui(GUI_SET_STATE, (void *)GUI_STOP); uiSubRender = 1; wsSetBackgroundRGB(&guiApp.subWindow, guiApp.sub.R, guiApp.sub.G, guiApp.sub.B); wsClearWindow(guiApp.subWindow); wsPostRedisplay(&guiApp.subWindow); } break; } return True; }
void guiInit(void) { int i; mp_msg(MSGT_GPLAYER, MSGL_V, "GUI init.\n"); #ifdef CONFIG_DXR3 if (!gtkDXR3Device) gtkDXR3Device = strdup("/dev/em8300-0"); #endif if (stream_cache_size > 0) { gtkCacheOn = 1; gtkCacheSize = stream_cache_size; } else if (stream_cache_size == 0) gtkCacheOn = 0; if (autosync && (autosync != gtkAutoSync)) { gtkAutoSyncOn = 1; gtkAutoSync = autosync; } #ifdef CONFIG_ASS gtkASS.enabled = ass_enabled; gtkASS.use_margins = ass_use_margins; gtkASS.top_margin = ass_top_margin; gtkASS.bottom_margin = ass_bottom_margin; #endif gtkInit(); // initialize X wsXInit(mDisplay); // load skin skinDirInHome = get_path("skins"); skinMPlayerDir = MPLAYER_DATADIR "/skins"; mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[interface] skin directory #1: %s\n", skinDirInHome); mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[interface] skin directory #2: %s\n", skinMPlayerDir); if (!skinName) skinName = strdup("default"); i = skinRead(skinName); if (i == -1 && strcmp(skinName, "default") != 0) { mp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_SKIN_SKINCFG_SelectedSkinNotFound, skinName); skinName = strdup("default"); i = skinRead(skinName); } switch (i) { case -1: gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_SKIN_SKINCFG_SkinNotFound, skinName); guiExit(EXIT_ERROR); case -2: gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_SKIN_SKINCFG_SkinCfgError, skinName); guiExit(EXIT_ERROR); } // initialize windows mainDrawBuffer = malloc(guiApp.main.Bitmap.ImageSize); if (!mainDrawBuffer) { gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_NEMDB); guiExit(EXIT_ERROR); } if (gui_save_pos) { if (gui_main_pos_x != -3) guiApp.main.x = gui_main_pos_x; if (gui_main_pos_y != -3) guiApp.main.y = gui_main_pos_y; if (gui_sub_pos_x != -3) guiApp.sub.x = gui_sub_pos_x; if (gui_sub_pos_y != -3) guiApp.sub.y = gui_sub_pos_y; } if (WinID > 0) { guiApp.subWindow.Parent = WinID; guiApp.sub.x = 0; guiApp.sub.y = 0; } if (guiWinID >= 0) guiApp.mainWindow.Parent = guiWinID; wsCreateWindow(&guiApp.subWindow, guiApp.sub.x, guiApp.sub.y, guiApp.sub.width, guiApp.sub.height, wsNoBorder, wsShowMouseCursor | wsHandleMouseButton | wsHandleMouseMove, wsShowFrame | wsHideWindow, "MPlayer - Video"); wsDestroyImage(&guiApp.subWindow); wsCreateImage(&guiApp.subWindow, guiApp.sub.Bitmap.Width, guiApp.sub.Bitmap.Height); wsXDNDMakeAwareness(&guiApp.subWindow); uiMenuInit(); uiPlaybarInit(); // i=wsHideFrame|wsMaxSize|wsHideWindow; // if ( guiApp.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow; i = wsShowFrame | wsMaxSize | wsHideWindow; wsCreateWindow(&guiApp.mainWindow, guiApp.main.x, guiApp.main.y, guiApp.main.width, guiApp.main.height, wsNoBorder, wsShowMouseCursor | wsHandleMouseButton | wsHandleMouseMove, i, "MPlayer"); wsSetShape(&guiApp.mainWindow, guiApp.main.Mask.Image); wsXDNDMakeAwareness(&guiApp.mainWindow); mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[interface] screen depth: %d\n", wsDepthOnScreen); mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[interface] mainWindow ID: 0x%x\n", (int)guiApp.mainWindow.WindowID); mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[interface] subWindow ID: 0x%x\n", (int)guiApp.subWindow.WindowID); guiApp.mainWindow.ReDraw = (void *)uiMainDraw; guiApp.mainWindow.MouseHandler = uiMainMouseHandle; guiApp.mainWindow.KeyHandler = uiMainKeyHandle; guiApp.mainWindow.DandDHandler = uiDandDHandler; guiApp.subWindow.ReDraw = (void *)uiSubDraw; guiApp.subWindow.MouseHandler = uiSubMouseHandle; guiApp.subWindow.KeyHandler = uiMainKeyHandle; guiApp.subWindow.DandDHandler = uiDandDHandler; wsSetBackgroundRGB(&guiApp.subWindow, guiApp.sub.R, guiApp.sub.G, guiApp.sub.B); wsClearWindow(guiApp.subWindow); if (guiApp.sub.Bitmap.Image) wsConvert(&guiApp.subWindow, guiApp.sub.Bitmap.Image); btnModify(evSetVolume, guiInfo.Volume); btnModify(evSetBalance, guiInfo.Balance); btnModify(evSetMoviePosition, guiInfo.Position); wsSetIcon(wsDisplay, guiApp.mainWindow.WindowID, &guiIcon); wsSetIcon(wsDisplay, guiApp.subWindow.WindowID, &guiIcon); if (!guiApp.mainDecoration) wsWindowDecoration(&guiApp.mainWindow, 0); wsVisibleWindow(&guiApp.mainWindow, wsShowWindow); #if 0 wsVisibleWindow(&guiApp.subWindow, wsShowWindow); { XEvent xev; do XNextEvent(wsDisplay, &xev); while (xev.type != MapNotify || xev.xmap.event != guiApp.subWindow.WindowID); guiApp.subWindow.Mapped = wsMapped; } if (!fullscreen) fullscreen = gtkLoadFullscreen; if (fullscreen) { uiFullScreen(); btnModify(evFullScreen, btnPressed); } #else if (!fullscreen) fullscreen = gtkLoadFullscreen; if (gtkShowVideoWindow) { wsVisibleWindow(&guiApp.subWindow, wsShowWindow); { XEvent xev; do XNextEvent(wsDisplay, &xev); while (xev.type != MapNotify || xev.xmap.event != guiApp.subWindow.WindowID); guiApp.subWindow.Mapped = wsMapped; } if (fullscreen) { uiFullScreen(); btnModify(evFullScreen, btnPressed); } } else { if (fullscreen) { wsVisibleWindow(&guiApp.subWindow, wsShowWindow); { XEvent xev; do XNextEvent(wsDisplay, &xev); while (xev.type != MapNotify || xev.xmap.event != guiApp.subWindow.WindowID); guiApp.subWindow.Mapped = wsMapped; } guiInfo.Playing = GUI_PAUSE; // because of !gtkShowVideoWindow... uiFullScreen(); // ...guiInfo.Playing is required wsVisibleWindow(&guiApp.subWindow, wsHideWindow); btnModify(evFullScreen, btnPressed); } } #endif guiInfo.Playing = GUI_STOP; uiSubRender = 1; if (plCurrent && !filename) uiSetFileName(plCurrent->path, plCurrent->name, STREAMTYPE_FILE); if (subdata) guiSetFilename(guiInfo.Subtitlename, subdata->filename); guiLoadFont(); initialized = 1; }