changeset 35771:07057fd75c51

Relocate uiMainEvent(). Move the code to actions.c, because it's general ui code and not really related to the main window. As a result, uiMainRender can't be static any longer. Additionally, format moved code to MPlayer coding style.
author ib
date Fri, 25 Jan 2013 10:18:13 +0000
parents 36f87d7432c7
children 3fec1d4b2736
files gui/ui/actions.c gui/ui/main.c gui/ui/ui.h
diffstat 3 files changed, 452 insertions(+), 331 deletions(-) [+]
line wrap: on
line diff
--- a/gui/ui/actions.c	Thu Jan 24 21:52:14 2013 +0000
+++ b/gui/ui/actions.c	Fri Jan 25 10:18:13 2013 +0000
@@ -27,7 +27,9 @@
 #include "actions.h"
 #include "ui.h"
 #include "gui/app/app.h"
+#include "gui/app/cfg.h"
 #include "gui/app/gui.h"
+#include "gui/dialog/dialog.h"
 #include "gui/interface.h"
 #include "gui/skin/skin.h"
 #include "gui/util/list.h"
@@ -36,13 +38,461 @@
 #include "gui/wm/ws.h"
 #include "gui/wm/wsxdnd.h"
 
+#include "access_mpcontext.h"
+#include "config.h"
 #include "help_mp.h"
 #include "input/input.h"
+#include "libmpcodecs/vd.h"
 #include "libmpdemux/demuxer.h"
 #include "libvo/video_out.h"
+#include "libvo/wskeys.h"
+#include "libvo/x11_common.h"
+#include "m_property.h"
+#include "mixer.h"
 #include "mp_core.h"
 #include "mp_msg.h"
+#include "mpcommon.h"
 #include "mplayer.h"
+#include "osdep/timer.h"
+#include "stream/stream.h"
+#include "sub/sub.h"
+
+#define GUI_REDRAW_WAIT 375
+
+static unsigned last_redraw_time = 0;
+
+static void MediumPrepare(int type)
+{
+    switch (type) {
+    case STREAMTYPE_DVD:
+        listMgr(PLAYLIST_DELETE, 0);
+        break;
+
+    case STREAMTYPE_CDDA:
+    case STREAMTYPE_VCD:
+        listMgr(PLAYLIST_DELETE, 0);
+    case STREAMTYPE_FILE:
+    case STREAMTYPE_STREAM:
+    case STREAMTYPE_PLAYLIST:
+        guiInfo.AudioStreams = 0;
+        guiInfo.Subtitles    = 0;
+        guiInfo.Chapters     = 0;
+        guiInfo.Angles       = 0;
+        break;
+    }
+}
+
+void uiMainEvent(int msg, float param)
+{
+    int iparam     = (int)param, osd;
+    mixer_t *mixer = mpctx_get_mixer(guiInfo.mpcontext);
+
+    switch (msg) {
+/* user events */
+    case evExit:
+        mplayer(MPLAYER_EXIT_GUI, EXIT_QUIT, 0);
+        break;
+
+    case evLoadURL:
+        gtkShow(evLoadURL, NULL);
+        break;
+
+    case ivSetAudio:
+
+        if (!mpctx_get_demuxer(guiInfo.mpcontext) || audio_id == iparam)
+            break;
+
+        mp_property_do("switch_audio", M_PROPERTY_SET, &iparam, guiInfo.mpcontext);
+        break;
+
+    case ivSetVideo:
+
+        if (!mpctx_get_demuxer(guiInfo.mpcontext) || video_id == iparam)
+            break;
+
+        mp_property_do("switch_video", M_PROPERTY_SET, &iparam, guiInfo.mpcontext);
+        break;
+
+    case ivSetSubtitle:
+        mp_property_do("sub", M_PROPERTY_SET, &iparam, guiInfo.mpcontext);
+        break;
+
+#ifdef CONFIG_CDDA
+    case ivSetCDTrack:
+        guiInfo.Track = iparam;
+
+    case evPlayCD:
+        guiInfo.StreamType = STREAMTYPE_CDDA;
+        goto play;
+
+#endif
+#ifdef CONFIG_VCD
+    case ivSetVCDTrack:
+        guiInfo.Track = iparam;
+
+    case evPlayVCD:
+        guiInfo.StreamType = STREAMTYPE_VCD;
+        goto play;
+
+#endif
+#ifdef CONFIG_DVDREAD
+    case ivSetDVDSubtitle:
+        dvdsub_id = iparam;
+        uiMainEvent(ivPlayDVD, 0);
+        break;
+
+    case ivSetDVDAudio:
+        audio_id = iparam;
+        uiMainEvent(ivPlayDVD, 0);
+        break;
+
+    case ivSetDVDChapter:
+        guiInfo.Chapter = iparam;
+        uiMainEvent(ivPlayDVD, 0);
+        break;
+
+    case ivSetDVDTitle:
+        guiInfo.Track   = iparam;
+        guiInfo.Chapter = 1;
+        guiInfo.Angle   = 1;
+        uiMainEvent(ivPlayDVD, 0);
+        break;
+
+    case evPlayDVD:
+        guiInfo.Chapter = 1;
+        guiInfo.Angle   = 1;
+
+    case ivPlayDVD:
+        guiInfo.StreamType = STREAMTYPE_DVD;
+        goto play;
+
+#endif
+    case evPlay:
+    case evPlaySwitchToPause:
+play:
+
+        if ((msg == evPlaySwitchToPause) && (guiInfo.Playing == GUI_PAUSE))
+            goto NoPause;
+
+        MediumPrepare(guiInfo.StreamType);
+
+        switch (guiInfo.StreamType) {
+        case STREAMTYPE_FILE:
+        case STREAMTYPE_STREAM:
+        case STREAMTYPE_PLAYLIST:
+
+            if (!guiInfo.Track)
+                guiInfo.Track = 1;
+
+            guiInfo.NewPlay = GUI_FILE_NEW;
+            break;
+
+        case STREAMTYPE_CDDA:
+
+            if (guiInfo.Playing != GUI_PAUSE) {
+                if (!guiInfo.Track)
+                    guiInfo.Track = 1;
+
+                guiInfo.NewPlay = GUI_FILE_SAME;
+            }
+
+            break;
+
+        case STREAMTYPE_VCD:
+
+            if (guiInfo.Playing != GUI_PAUSE) {
+                if (!guiInfo.Track)
+                    guiInfo.Track = 2;
+
+                guiInfo.NewPlay = GUI_FILE_SAME;
+            }
+
+            break;
+
+        case STREAMTYPE_DVD:
+
+            if (guiInfo.Playing != GUI_PAUSE) {
+                if (!guiInfo.Track)
+                    guiInfo.Track = 1;
+
+                guiInfo.NewPlay = GUI_FILE_SAME;
+            }
+
+            break;
+        }
+
+        uiPlay();
+        break;
+
+    case evPause:
+    case evPauseSwitchToPlay:
+NoPause:
+        uiPause();
+        break;
+
+    case evStop:
+        guiInfo.Playing = GUI_STOP;
+        uiState();
+        break;
+
+    case evLoadPlay:
+        uiLoadPlay = True;
+
+//      guiInfo.StreamType=STREAMTYPE_FILE;
+    case evLoad:
+        gtkShow(evLoad, NULL);
+        break;
+
+    case evLoadSubtitle:
+        gtkShow(evLoadSubtitle, NULL);
+        break;
+
+    case evDropSubtitle:
+        nfree(guiInfo.SubtitleFilename);
+        mplayerLoadSubtitle(NULL);
+        break;
+
+    case evLoadAudioFile:
+        gtkShow(evLoadAudioFile, NULL);
+        break;
+
+    case evPrev:
+        uiPrev();
+        break;
+
+    case evNext:
+        uiNext();
+        break;
+
+    case evPlaylist:
+        gtkShow(evPlaylist, NULL);
+        break;
+
+    case evSkinBrowser:
+        gtkShow(evSkinBrowser, skinName);
+        break;
+
+    case evAbout:
+        gtkShow(evAbout, NULL);
+        break;
+
+    case evPreferences:
+        gtkShow(evPreferences, NULL);
+        break;
+
+    case evEqualizer:
+        gtkShow(evEqualizer, NULL);
+        break;
+
+    case evForward10min:
+        uiRelSeek(600);
+        break;
+
+    case evBackward10min:
+        uiRelSeek(-600);
+        break;
+
+    case evForward1min:
+        uiRelSeek(60);
+        break;
+
+    case evBackward1min:
+        uiRelSeek(-60);
+        break;
+
+    case evForward10sec:
+        uiRelSeek(10);
+        break;
+
+    case evBackward10sec:
+        uiRelSeek(-10);
+        break;
+
+    case evSetMoviePosition:
+        uiAbsSeek(param);
+        break;
+
+    case evIncVolume:
+        vo_x11_putkey(wsGrayMul);
+        break;
+
+    case evDecVolume:
+        vo_x11_putkey(wsGrayDiv);
+        break;
+
+    case evMute:
+        mixer_mute(mixer);
+        break;
+
+    case evSetVolume:
+        guiInfo.Volume = param;
+        {
+            float l = guiInfo.Volume * ((100.0 - guiInfo.Balance) / 50.0);
+            float r = guiInfo.Volume * ((guiInfo.Balance) / 50.0);
+            mixer_setvolume(mixer, FFMIN(l, guiInfo.Volume), FFMIN(r, guiInfo.Volume));
+        }
+
+        if (osd_level) {
+            osd_visible = (GetTimerMS() + 1000) | 1;
+            vo_osd_progbar_type  = OSD_VOLUME;
+            vo_osd_progbar_value = ((guiInfo.Volume) * 256.0) / 100.0;
+            vo_osd_changed(OSDTYPE_PROGBAR);
+        }
+
+        break;
+
+    case evSetBalance:
+        guiInfo.Balance = param;
+        mixer_setbalance(mixer, (guiInfo.Balance - 50.0) / 50.0);     // transform 0..100 to -1..1
+        osd       = osd_level;
+        osd_level = 0;
+        uiMainEvent(evSetVolume, guiInfo.Volume);
+        osd_level = osd;
+
+        if (osd_level) {
+            osd_visible = (GetTimerMS() + 1000) | 1;
+            vo_osd_progbar_type  = OSD_BALANCE;
+            vo_osd_progbar_value = ((guiInfo.Balance) * 256.0) / 100.0;
+            vo_osd_changed(OSDTYPE_PROGBAR);
+        }
+
+        break;
+
+    case evMenu:
+        /*if (guiApp.menuIsPresent)   NOTE TO MYSELF: Uncomment only after mouse
+         * {                                            pointer and cursor keys work
+         * gtkShow( ivHidePopUpMenu,NULL );            with this menu from skin as
+         * uiMenuShow( 0,0 );                          they do with normal menus.
+         * }
+         * else*/gtkShow(ivShowPopUpMenu, NULL);
+        break;
+
+    case evIconify:
+
+        switch (iparam) {
+        case 0:
+            wsWindowIconify(&guiApp.mainWindow);
+            break;
+
+        case 1:
+            wsWindowIconify(&guiApp.videoWindow);
+            break;
+        }
+
+        break;
+
+    case evHalfSize:
+
+        if (guiInfo.VideoWindow && guiInfo.Playing) {
+            if (guiApp.videoWindow.isFullScreen) {
+                uiFullScreen();
+            }
+
+            wsWindowResize(&guiApp.videoWindow, guiInfo.VideoWidth / 2, guiInfo.VideoHeight / 2);
+            btnSet(evFullScreen, btnReleased);
+        }
+
+        break;
+
+    case evDoubleSize:
+
+        if (guiInfo.VideoWindow && guiInfo.Playing) {
+            if (guiApp.videoWindow.isFullScreen) {
+                uiFullScreen();
+            }
+
+            wsWindowResize(&guiApp.videoWindow, guiInfo.VideoWidth * 2, guiInfo.VideoHeight * 2);
+            wsWindowMoveWithin(&guiApp.videoWindow, False, guiApp.video.x, guiApp.video.y);
+            btnSet(evFullScreen, btnReleased);
+        }
+
+        break;
+
+    case evNormalSize:
+
+        if (guiInfo.VideoWindow && guiInfo.Playing) {
+            if (guiApp.videoWindow.isFullScreen) {
+                uiFullScreen();
+            }
+
+            wsWindowResize(&guiApp.videoWindow, guiInfo.VideoWidth, guiInfo.VideoHeight);
+            btnSet(evFullScreen, btnReleased);
+            break;
+        } else if (!guiApp.videoWindow.isFullScreen)
+            break;
+
+    case evFullScreen:
+
+        if (guiInfo.VideoWindow && (guiInfo.Playing || !iparam)) {
+            uiFullScreen();
+
+            if (!guiApp.videoWindow.isFullScreen)
+                wsWindowResize(&guiApp.videoWindow, iparam ? guiInfo.VideoWidth : guiApp.video.width, iparam ? guiInfo.VideoHeight : guiApp.video.height);
+        }
+
+        if (guiApp.videoWindow.isFullScreen)
+            btnSet(evFullScreen, btnPressed);
+        else
+            btnSet(evFullScreen, btnReleased);
+
+        break;
+
+    case evSetAspect:
+
+        switch (iparam) {
+        case 2:
+            movie_aspect = 16.0f / 9.0f;
+            break;
+
+        case 3:
+            movie_aspect = 4.0f / 3.0f;
+            break;
+
+        case 4:
+            movie_aspect = 2.35;
+            break;
+
+        case 1:
+        default:
+            movie_aspect = -1;
+        }
+
+        if (guiInfo.StreamType == STREAMTYPE_VCD)
+            uiMainEvent(evPlayVCD, 0);
+        else if (guiInfo.StreamType == STREAMTYPE_DVD)
+            uiMainEvent(ivPlayDVD, 0);
+        else
+            guiInfo.NewPlay = GUI_FILE_NEW;
+
+        break;
+
+/* timer events */
+    case ivRedraw:
+    {
+        unsigned now = GetTimerMS();
+
+        if ((now > last_redraw_time) &&
+            (now < last_redraw_time + GUI_REDRAW_WAIT) &&
+            !uiPlaybarFade && (iparam == 0))
+            break;
+
+        last_redraw_time = now;
+    }
+        uiMainRender = True;
+        wsWindowRedraw(&guiApp.mainWindow);
+        wsWindowRedraw(&guiApp.playbarWindow);
+        break;
+
+/* system events */
+    case evNone:
+        mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[actions] uiMainEvent: evNone\n");
+        break;
+
+    default:
+        mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[actions] uiMainEvent: unknown event %d, param %.2f\n", msg, param);
+        break;
+    }
+}
 
 /**
  * @brief Switch video window fullscreen mode.
--- a/gui/ui/main.c	Thu Jan 24 21:52:14 2013 +0000
+++ b/gui/ui/main.c	Fri Jan 25 10:18:13 2013 +0000
@@ -24,7 +24,6 @@
 #include <unistd.h>
 #include <string.h>
 
-#include "config.h"
 #include "ui.h"
 #include "gui/app/app.h"
 #include "gui/app/gui.h"
@@ -44,29 +43,18 @@
 
 #include "stream/stream.h"
 #include "stream/url.h"
-#include "mixer.h"
-#include "sub/sub.h"
-#include "access_mpcontext.h"
 
-#include "libmpcodecs/vd.h"
 #include "libmpdemux/demuxer.h"
 #include "libmpdemux/stheader.h"
 #include "codec-cfg.h"
 #include "m_option.h"
-#include "m_property.h"
 #include "mp_core.h"
-#include "mpcommon.h"
 #include "libavutil/common.h"
 
-#define GUI_REDRAW_WAIT 375
-
 #include "actions.h"
-#include "gui/dialog/dialog.h"
-
-unsigned int GetTimerMS( void );
 
 unsigned char * mainDrawBuffer = NULL;
-static int      uiMainRender = True;
+int             uiMainRender = True;
 
 int             uiLoadPlay = False;
 
@@ -101,324 +89,6 @@
 // XFlush( wsDisplay );
 }
 
-static void MediumPrepare (int type)
-{
-  switch (type)
-  {
-    case STREAMTYPE_DVD:
-      listMgr(PLAYLIST_DELETE, 0);
-      break;
-
-    case STREAMTYPE_CDDA:
-    case STREAMTYPE_VCD:
-      listMgr(PLAYLIST_DELETE, 0);
-    case STREAMTYPE_FILE:
-    case STREAMTYPE_STREAM:
-    case STREAMTYPE_PLAYLIST:
-      guiInfo.AudioStreams = 0;
-      guiInfo.Subtitles = 0;
-      guiInfo.Chapters = 0;
-      guiInfo.Angles = 0;
-      break;
-  }
-}
-
-static unsigned last_redraw_time = 0;
-
-void uiMainEvent( int msg,float param )
-{
- int iparam = (int)param, osd;
- mixer_t *mixer = mpctx_get_mixer(guiInfo.mpcontext);
-
- switch( msg )
-  {
-/* user events */
-   case evExit:
-        mplayer( MPLAYER_EXIT_GUI, EXIT_QUIT, 0 );
-        break;
-
-   case evLoadURL:
-        gtkShow( evLoadURL,NULL );
-	break;
-
-   case ivSetAudio:
-        if ( !mpctx_get_demuxer(guiInfo.mpcontext) || audio_id == iparam ) break;
-	mp_property_do("switch_audio",M_PROPERTY_SET,&iparam,guiInfo.mpcontext);
-	break;
-
-   case ivSetVideo:
-        if ( !mpctx_get_demuxer(guiInfo.mpcontext) || video_id == iparam ) break;
-	mp_property_do("switch_video",M_PROPERTY_SET,&iparam,guiInfo.mpcontext);
-	break;
-
-   case ivSetSubtitle:
-        mp_property_do("sub",M_PROPERTY_SET,&iparam,guiInfo.mpcontext);
-	break;
-
-#ifdef CONFIG_CDDA
-   case ivSetCDTrack:
-        guiInfo.Track=iparam;
-   case evPlayCD:
-	guiInfo.StreamType=STREAMTYPE_CDDA;
-	goto play;
-#endif
-#ifdef CONFIG_VCD
-   case ivSetVCDTrack:
-        guiInfo.Track=iparam;
-   case evPlayVCD:
-	guiInfo.StreamType=STREAMTYPE_VCD;
-	goto play;
-#endif
-#ifdef CONFIG_DVDREAD
-   case ivSetDVDSubtitle:
-        dvdsub_id=iparam;
-        uiMainEvent( ivPlayDVD, 0 );
-        break;
-   case ivSetDVDAudio:
-        audio_id=iparam;
-        uiMainEvent( ivPlayDVD, 0 );
-        break;
-   case ivSetDVDChapter:
-        guiInfo.Chapter=iparam;
-        uiMainEvent( ivPlayDVD, 0 );
-        break;
-   case ivSetDVDTitle:
-        guiInfo.Track=iparam;
-        guiInfo.Chapter=1;
-        guiInfo.Angle=1;
-        uiMainEvent( ivPlayDVD, 0 );
-        break;
-   case evPlayDVD:
-        guiInfo.Chapter=1;
-        guiInfo.Angle=1;
-   case ivPlayDVD:
-        guiInfo.StreamType=STREAMTYPE_DVD;
-	goto play;
-#endif
-   case evPlay:
-   case evPlaySwitchToPause:
-play:
-
-        if ( ( msg == evPlaySwitchToPause )&&( guiInfo.Playing == GUI_PAUSE ) ) goto NoPause;
-
-        MediumPrepare( guiInfo.StreamType );
-
-        switch ( guiInfo.StreamType )
-         {
-	  case STREAMTYPE_FILE:
-	  case STREAMTYPE_STREAM:
-	  case STREAMTYPE_PLAYLIST:
-	       if ( !guiInfo.Track )
-	         guiInfo.Track=1;
-	       guiInfo.NewPlay=GUI_FILE_NEW;
-	       break;
-
-          case STREAMTYPE_CDDA:
-	       if ( guiInfo.Playing != GUI_PAUSE )
-	        {
-		 if ( !guiInfo.Track )
-                   guiInfo.Track=1;
-                 guiInfo.NewPlay=GUI_FILE_SAME;
-		}
-	       break;
-
-          case STREAMTYPE_VCD:
-	       if ( guiInfo.Playing != GUI_PAUSE )
-	        {
-		 if ( !guiInfo.Track )
-                   guiInfo.Track=2;
-                 guiInfo.NewPlay=GUI_FILE_SAME;
-		}
-	       break;
-
-          case STREAMTYPE_DVD:
-	       if ( guiInfo.Playing != GUI_PAUSE )
-	        {
-		 if ( !guiInfo.Track )
-                   guiInfo.Track=1;
-                 guiInfo.NewPlay=GUI_FILE_SAME;
-		}
-               break;
-         }
-        uiPlay();
-        break;
-
-   case evPause:
-   case evPauseSwitchToPlay:
-NoPause:
-        uiPause();
-        break;
-
-   case evStop:
-	guiInfo.Playing=GUI_STOP;
-	uiState();
-	break;
-
-   case evLoadPlay:
-        uiLoadPlay=True;
-//	guiInfo.StreamType=STREAMTYPE_FILE;
-   case evLoad:
-        gtkShow( evLoad,NULL );
-        break;
-   case evLoadSubtitle:  gtkShow( evLoadSubtitle,NULL );  break;
-   case evDropSubtitle:
-	nfree( guiInfo.SubtitleFilename );
-	mplayerLoadSubtitle( NULL );
-	break;
-   case evLoadAudioFile: gtkShow( evLoadAudioFile,NULL ); break;
-   case evPrev: uiPrev(); break;
-   case evNext: uiNext(); break;
-
-   case evPlaylist:    gtkShow( evPlaylist,NULL );        break;
-   case evSkinBrowser: gtkShow( evSkinBrowser,skinName ); break;
-   case evAbout:       gtkShow( evAbout,NULL );           break;
-   case evPreferences: gtkShow( evPreferences,NULL );     break;
-   case evEqualizer:   gtkShow( evEqualizer,NULL );       break;
-
-   case evForward10min:	    uiRelSeek( 600 ); break;
-   case evBackward10min:    uiRelSeek( -600 );break;
-   case evForward1min:      uiRelSeek( 60 );  break;
-   case evBackward1min:     uiRelSeek( -60 ); break;
-   case evForward10sec:     uiRelSeek( 10 );  break;
-   case evBackward10sec:    uiRelSeek( -10 ); break;
-   case evSetMoviePosition: uiAbsSeek( param ); break;
-
-   case evIncVolume:  vo_x11_putkey( wsGrayMul ); break;
-   case evDecVolume:  vo_x11_putkey( wsGrayDiv ); break;
-   case evMute:       mixer_mute( mixer ); break;
-
-   case evSetVolume:
-        guiInfo.Volume=param;
-        {
-	 float l = guiInfo.Volume * ( ( 100.0 - guiInfo.Balance ) / 50.0 );
-	 float r = guiInfo.Volume * ( ( guiInfo.Balance ) / 50.0 );
-         mixer_setvolume( mixer,FFMIN(l,guiInfo.Volume),FFMIN(r,guiInfo.Volume) );
-	}
-	if ( osd_level )
-	 {
-	  osd_visible=(GetTimerMS() + 1000) | 1;
-	  vo_osd_progbar_type=OSD_VOLUME;
-	  vo_osd_progbar_value=( ( guiInfo.Volume ) * 256.0 ) / 100.0;
-	  vo_osd_changed( OSDTYPE_PROGBAR );
-	 }
-        break;
-
-   case evSetBalance:
-        guiInfo.Balance=param;
-        mixer_setbalance( mixer,(guiInfo.Balance - 50.0 ) / 50.0 );   // transform 0..100 to -1..1
-        osd = osd_level;
-        osd_level = 0;
-        uiMainEvent(evSetVolume, guiInfo.Volume);
-        osd_level = osd;
-        if ( osd_level )
-         {
-          osd_visible=(GetTimerMS() + 1000) | 1;
-          vo_osd_progbar_type=OSD_BALANCE;
-          vo_osd_progbar_value=( ( guiInfo.Balance ) * 256.0 ) / 100.0;
-          vo_osd_changed( OSDTYPE_PROGBAR );
-         }
-        break;
-
-   case evMenu:
-        /*if (guiApp.menuIsPresent)   NOTE TO MYSELF: Uncomment only after mouse
-         {                                            pointer and cursor keys work
-          gtkShow( ivHidePopUpMenu,NULL );            with this menu from skin as
-          uiMenuShow( 0,0 );                          they do with normal menus.
-         }
-        else*/ gtkShow( ivShowPopUpMenu,NULL );
-        break;
-
-   case evIconify:
-        switch ( iparam )
-         {
-          case 0: wsWindowIconify( &guiApp.mainWindow ); break;
-          case 1: wsWindowIconify( &guiApp.videoWindow ); break;
-         }
-        break;
-   case evHalfSize:
-        if ( guiInfo.VideoWindow && guiInfo.Playing )
-         {
-          if ( guiApp.videoWindow.isFullScreen )
-           {
-            uiFullScreen();
-           }
-          wsWindowResize( &guiApp.videoWindow, guiInfo.VideoWidth / 2, guiInfo.VideoHeight / 2 );
-          btnSet( evFullScreen,btnReleased );
-         }
-        break;
-   case evDoubleSize:
-        if ( guiInfo.VideoWindow && guiInfo.Playing )
-         {
-          if ( guiApp.videoWindow.isFullScreen )
-           {
-            uiFullScreen();
-           }
-          wsWindowResize( &guiApp.videoWindow, guiInfo.VideoWidth * 2, guiInfo.VideoHeight * 2 );
-          wsWindowMoveWithin( &guiApp.videoWindow, False, guiApp.video.x, guiApp.video.y );
-          btnSet( evFullScreen,btnReleased );
-         }
-        break;
-   case evNormalSize:
-        if ( guiInfo.VideoWindow && guiInfo.Playing )
-         {
-          if ( guiApp.videoWindow.isFullScreen )
-           {
-            uiFullScreen();
-           }
-          wsWindowResize( &guiApp.videoWindow, guiInfo.VideoWidth, guiInfo.VideoHeight );
-          btnSet( evFullScreen,btnReleased );
-	  break;
-         } else if ( !guiApp.videoWindow.isFullScreen ) break;
-   case evFullScreen:
-        if ( guiInfo.VideoWindow && ( guiInfo.Playing || !iparam ) )
-         {
-          uiFullScreen();
-          if ( !guiApp.videoWindow.isFullScreen )
-            wsWindowResize( &guiApp.videoWindow, iparam ? guiInfo.VideoWidth : guiApp.video.width, iparam ? guiInfo.VideoHeight : guiApp.video.height );
-         }
-	if ( guiApp.videoWindow.isFullScreen ) btnSet( evFullScreen,btnPressed );
-	 else btnSet( evFullScreen,btnReleased );
-        break;
-
-   case evSetAspect:
-	switch ( iparam )
-	 {
-	  case 2:  movie_aspect=16.0f / 9.0f; break;
-	  case 3:  movie_aspect=4.0f / 3.0f;  break;
-	  case 4:  movie_aspect=2.35;         break;
-	  case 1:
-	  default: movie_aspect=-1;
-	 }
-	if ( guiInfo.StreamType == STREAMTYPE_VCD ) uiMainEvent( evPlayVCD, 0 );
-	 else if ( guiInfo.StreamType == STREAMTYPE_DVD ) uiMainEvent( ivPlayDVD, 0 );
-	 else
-	 guiInfo.NewPlay=GUI_FILE_NEW;
-	break;
-
-/* timer events */
-   case ivRedraw:
-        {
-          unsigned now = GetTimerMS();
-          if ((now > last_redraw_time) &&
-              (now < last_redraw_time + GUI_REDRAW_WAIT) &&
-              !uiPlaybarFade && (iparam == 0))
-            break;
-          last_redraw_time = now;
-        }
-        uiMainRender=True;
-        wsWindowRedraw( &guiApp.mainWindow );
-	wsWindowRedraw( &guiApp.playbarWindow );
-        break;
-/* system events */
-   case evNone:
-        mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] uiMainEvent: evNone\n" );
-        break;
-   default:
-        mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] uiMainEvent: unknown event %d, param %.2f\n", msg, param );
-        break;
-  }
-}
-
 void uiMainMouse( int Button,int X,int Y,int RX,int RY )
 {
  static int     itemtype = 0;
--- a/gui/ui/ui.h	Thu Jan 24 21:52:14 2013 +0000
+++ b/gui/ui/ui.h	Fri Jan 25 10:18:13 2013 +0000
@@ -24,6 +24,7 @@
 extern int             mainVisible;
 
 extern int             uiLoadPlay;
+extern int             uiMainRender;
 extern int             uiPlaybarFade;
 
 extern int             sx, sy;