Commit ad08a6d2 authored by Eugenio Jarosiewicz's avatar Eugenio Jarosiewicz

Cleaning code and a small fix to make quit work on OSX

parent 66ac85dc
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* *
* Authors: Colin Delacroix <colin@zoy.org> * Authors:
* Eugenio Jarosiewicz <ej0@cise.ufl.edu>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -40,9 +39,6 @@ ...@@ -40,9 +39,6 @@
#include "intf_msg.h" #include "intf_msg.h"
#include "interface.h" #include "interface.h"
/* FIXME: get rid of this and do menus & command keys*/
#include "keystrokes.h"
#include "modules.h" #include "modules.h"
#include "stream_control.h" #include "stream_control.h"
...@@ -100,12 +96,13 @@ enum ...@@ -100,12 +96,13 @@ enum
kMenuControls = 130, kMenuControls = 130,
kAppleAbout = 1, kAppleAbout = 1,
kAppleQuit = 7, //is this always the same? kAppleQuit = 8, //is this always the same?
kFileNew = 1, kFileNew = 1,
kFileOpen, kFileOpen,
kFileCloseDivisor, kFileCloseDivisor,
kFileClose, kFileClose,
kFileQuitHack,
kControlsPlayORPause = 1, kControlsPlayORPause = 1,
kControlsStop, kControlsStop,
...@@ -124,7 +121,6 @@ enum ...@@ -124,7 +121,6 @@ enum
kControlsEject kControlsEject
#if 0 #if 0
//virtual key codes ; raw subtract 0x40 from these values //virtual key codes ; raw subtract 0x40 from these values
//http://devworld.apple.com/techpubs/mac/Text/Text-577.html#HEADING577-0 //http://devworld.apple.com/techpubs/mac/Text/Text-577.html#HEADING577-0
...@@ -223,45 +219,12 @@ static int intf_Open( intf_thread_t *p_intf ) ...@@ -223,45 +219,12 @@ static int intf_Open( intf_thread_t *p_intf )
InitCursor(); InitCursor();
SetQDGlobalsRandomSeed( TickCount() ); SetQDGlobalsRandomSeed( TickCount() );
#if 0 // neat menu but don't know if we want it.
p_intf->p_intf_get_key = intf_GetKey;
intf_AssignKey( p_intf , 'Q', INTF_KEY_QUIT, 0);
intf_AssignKey( p_intf , 'q', INTF_KEY_QUIT, 0);
intf_AssignKey( p_intf , 27, INTF_KEY_QUIT, 0);
intf_AssignKey( p_intf , 3, INTF_KEY_QUIT, 0);
intf_AssignKey( p_intf , '0', INTF_KEY_SET_CHANNEL, 0);
intf_AssignKey( p_intf , '1', INTF_KEY_SET_CHANNEL, 1);
intf_AssignKey( p_intf , '2', INTF_KEY_SET_CHANNEL, 2);
intf_AssignKey( p_intf , '3', INTF_KEY_SET_CHANNEL, 3);
intf_AssignKey( p_intf , '4', INTF_KEY_SET_CHANNEL, 4);
intf_AssignKey( p_intf , '5', INTF_KEY_SET_CHANNEL, 5);
intf_AssignKey( p_intf , '6', INTF_KEY_SET_CHANNEL, 6);
intf_AssignKey( p_intf , '7', INTF_KEY_SET_CHANNEL, 7);
intf_AssignKey( p_intf , '8', INTF_KEY_SET_CHANNEL, 8);
intf_AssignKey( p_intf , '9', INTF_KEY_SET_CHANNEL, 9);
intf_AssignKey( p_intf , '0', INTF_KEY_SET_CHANNEL, 0);
intf_AssignKey( p_intf , '+', INTF_KEY_INC_VOLUME, 0);
intf_AssignKey( p_intf , '-', INTF_KEY_DEC_VOLUME, 0);
intf_AssignKey( p_intf , 'm', INTF_KEY_TOGGLE_VOLUME, 0);
intf_AssignKey( p_intf , 'M', INTF_KEY_TOGGLE_VOLUME, 0);
intf_AssignKey( p_intf , 'g', INTF_KEY_DEC_GAMMA, 0);
intf_AssignKey( p_intf , 'G', INTF_KEY_INC_GAMMA, 0);
intf_AssignKey( p_intf , 'c', INTF_KEY_TOGGLE_GRAYSCALE, 0);
intf_AssignKey( p_intf , ' ', INTF_KEY_TOGGLE_INTERFACE, 0);
intf_AssignKey( p_intf , 'i', INTF_KEY_TOGGLE_INFO, 0);
intf_AssignKey( p_intf , 's', INTF_KEY_TOGGLE_SCALING, 0);
intf_AssignKey( p_intf , 'd', INTF_KEY_DUMP_STREAM, 0);
//EJ - neat menu but don't know if we want it.
// Install the Windows menu. Free of charge! // Install the Windows menu. Free of charge!
// CreateStandardWindowMenu( 0, &windMenu ); // CreateStandardWindowMenu( 0, &windMenu );
// InsertMenu( windMenu, 0 ); // InsertMenu( windMenu, 0 );
// DrawMenuBar(); // DrawMenuBar();
#else
menu = NewMenu( kMenuApple, "\p\024" ); menu = NewMenu( kMenuApple, "\p\024" );
AppendMenu( menu, "\pAbout VLC/A" ); AppendMenu( menu, "\pAbout VLC/A" );
InsertMenu( menu, 0 ); InsertMenu( menu, 0 );
...@@ -271,6 +234,8 @@ static int intf_Open( intf_thread_t *p_intf ) ...@@ -271,6 +234,8 @@ static int intf_Open( intf_thread_t *p_intf )
AppendMenu( menu, "\pOpen/O" ); AppendMenu( menu, "\pOpen/O" );
AppendMenu( menu, "\p(-" ); AppendMenu( menu, "\p(-" );
AppendMenu( menu, "\pClose/W" ); AppendMenu( menu, "\pClose/W" );
//standard OS X application menu quit isn't working nicely
AppendMenu( menu, "\pQuit/Q" );
InsertMenu( menu, 0 ); InsertMenu( menu, 0 );
//BIG HONKING MENU - in order Mac OS 9 dvd player //BIG HONKING MENU - in order Mac OS 9 dvd player
...@@ -321,7 +286,8 @@ static int intf_Open( intf_thread_t *p_intf ) ...@@ -321,7 +286,8 @@ static int intf_Open( intf_thread_t *p_intf )
AppendMenu( menu, "\pEject/E" ); //14 AppendMenu( menu, "\pEject/E" ); //14
InsertMenu( menu, 0 ); InsertMenu( menu, 0 );
#endif
DrawMenuBar(); DrawMenuBar();
...@@ -346,6 +312,10 @@ static void intf_Run( intf_thread_t *p_intf ) ...@@ -346,6 +312,10 @@ static void intf_Run( intf_thread_t *p_intf )
EventLoopTimerUPP manageUPP; EventLoopTimerUPP manageUPP;
/*
Eventually we want to use Carbon events, or maybe even write this app in Cocoa
*/
// EventTypeSpec windowEventType = { kEventClassWindow, kEventWindowClose }; // EventTypeSpec windowEventType = { kEventClassWindow, kEventWindowClose };
// EventHandlerUPP windowHandlerUPP; // EventHandlerUPP windowHandlerUPP;
...@@ -369,7 +339,7 @@ static void intf_Run( intf_thread_t *p_intf ) ...@@ -369,7 +339,7 @@ static void intf_Run( intf_thread_t *p_intf )
*/ */
#ifndef CocoaEvents #ifndef CarbonEvents
//UGLY Event Loop! //UGLY Event Loop!
EventLoop( p_intf ); EventLoop( p_intf );
#else #else
...@@ -395,7 +365,7 @@ void CarbonManageCallback ( EventLoopTimerRef inTimer, void *inUserData ) ...@@ -395,7 +365,7 @@ void CarbonManageCallback ( EventLoopTimerRef inTimer, void *inUserData )
} }
} }
#ifndef CocoaEvents #ifndef CarbonEvents
void EventLoop( intf_thread_t *p_intf ) void EventLoop( intf_thread_t *p_intf )
{ {
...@@ -404,14 +374,16 @@ void EventLoop( intf_thread_t *p_intf ) ...@@ -404,14 +374,16 @@ void EventLoop( intf_thread_t *p_intf )
do do
{ {
p_intf->pf_manage( p_intf );
gotEvent = WaitNextEvent(everyEvent,&event,32767,nil); gotEvent = WaitNextEvent(everyEvent,&event,32767,nil);
if (gotEvent) if (gotEvent)
DoEvent( p_intf, &event); DoEvent( p_intf, &event);
} while (! p_intf->b_die ); } while (! p_intf->b_die );
ExitToShell(); //ExitToShell();
} }
void DoEvent( intf_thread_t *p_intf , EventRecord *event) void DoEvent( intf_thread_t *p_intf , EventRecord *event)
{ {
short part; short part;
...@@ -514,6 +486,8 @@ void DoMenuCommand( intf_thread_t *p_intf , long menuResult) ...@@ -514,6 +486,8 @@ void DoMenuCommand( intf_thread_t *p_intf , long menuResult)
case kAppleQuit: case kAppleQuit:
p_intf->b_die = true; p_intf->b_die = true;
//hrmm...
ExitToShell();
return; return;
break; break;
...@@ -554,6 +528,10 @@ void DoMenuCommand( intf_thread_t *p_intf , long menuResult) ...@@ -554,6 +528,10 @@ void DoMenuCommand( intf_thread_t *p_intf , long menuResult)
//DoAboutBox(); //DoAboutBox();
break; break;
case kFileQuitHack:
p_intf->b_die = true;
break;
default: default:
break; break;
} }
...@@ -630,13 +608,21 @@ void DoMenuCommand( intf_thread_t *p_intf , long menuResult) ...@@ -630,13 +608,21 @@ void DoMenuCommand( intf_thread_t *p_intf , long menuResult)
break; break;
case kControlsChapterNext: case kControlsChapterNext:
//Fixme if( p_intf->p_input != NULL )
SysBeep(30); {
/* FIXME: temporary hack */
p_intf->p_input->b_eof = 1;
}
break; break;
case kControlsChapterPrevious: case kControlsChapterPrevious:
//Fixme if( p_intf->p_input != NULL )
SysBeep(30); {
/* FIXME: temporary hack */
intf_PlaylistPrev( p_main->p_playlist );
intf_PlaylistPrev( p_main->p_playlist );
p_intf->p_input->b_eof = 1;
}
break; break;
case kControlsDVDMenu: case kControlsDVDMenu:
...@@ -799,4 +785,4 @@ static pascal OSStatus MyEventHandler(EventHandlerCallRef myHandler, EventRef ev ...@@ -799,4 +785,4 @@ static pascal OSStatus MyEventHandler(EventHandlerCallRef myHandler, EventRef ev
} }
return result; return result;
} }
#endif #endif
\ No newline at end of file
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* *
* Authors: Colin Delacroix <colin@zoy.org> * Authors:
* Eugenio Jarosiewicz <ej0@cise.ufl.edu>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -236,7 +235,6 @@ void FindBestMemoryLocation( vout_thread_t *p_vout ) ...@@ -236,7 +235,6 @@ void FindBestMemoryLocation( vout_thread_t *p_vout )
intf_ErrMsg( "FindBestMemoryLocation : gNewNewGWorld = false !" ); intf_ErrMsg( "FindBestMemoryLocation : gNewNewGWorld = false !" );
#if 0 #if 0
//EJ added
p_vout->i_screen_depth = wPixDepth; p_vout->i_screen_depth = wPixDepth;
p_vout->i_bytes_per_pixel = wPixDepth; p_vout->i_bytes_per_pixel = wPixDepth;
p_vout->i_bytes_per_line = p_vout->i_width * p_vout->i_bytes_per_pixel; p_vout->i_bytes_per_line = p_vout->i_width * p_vout->i_bytes_per_pixel;
...@@ -283,10 +281,8 @@ static int CreateDisplay( vout_thread_t *p_vout ) ...@@ -283,10 +281,8 @@ static int CreateDisplay( vout_thread_t *p_vout )
return( 1 ); return( 1 );
} }
//FIXME ? - lock this down until the end...
hPixmap0 = GetGWorldPixMap( p_vout->p_sys->p_gw[0] ); hPixmap0 = GetGWorldPixMap( p_vout->p_sys->p_gw[0] );
//FIXME BIGTIME - in SDL they just lock this down until the end...KLUDGE
//but alas sounds good to me to try it.
//well fuck a duck it works.
LockPixels(hPixmap0); LockPixels(hPixmap0);
hPixmap1 = GetGWorldPixMap( p_vout->p_sys->p_gw[1] ); hPixmap1 = GetGWorldPixMap( p_vout->p_sys->p_gw[1] );
LockPixels(hPixmap1); LockPixels(hPixmap1);
...@@ -310,7 +306,7 @@ static int CreateDisplay( vout_thread_t *p_vout ) ...@@ -310,7 +306,7 @@ static int CreateDisplay( vout_thread_t *p_vout )
return( 1 ); return( 1 );
} }
//FIXME TODO - if I ever dispose of the Gworlds and recreate them, i'll have a new address //FIXME - if I ever dispose of the Gworlds and recreate them, i'll have a new address
//and I'll need to tell vout about them... dunno what problems vout might have if we just updateGworld //and I'll need to tell vout about them... dunno what problems vout might have if we just updateGworld
vout_SetBuffers( p_vout, hPixmapBaseAddr0, hPixmapBaseAddr1 ); vout_SetBuffers( p_vout, hPixmapBaseAddr0, hPixmapBaseAddr1 );
...@@ -354,9 +350,7 @@ static int MakeWindow( vout_thread_t *p_vout ) ...@@ -354,9 +350,7 @@ static int MakeWindow( vout_thread_t *p_vout )
p_vout->i_bytes_per_line = p_vout->i_width * p_vout->i_bytes_per_pixel; p_vout->i_bytes_per_line = p_vout->i_width * p_vout->i_bytes_per_pixel;
p_vout->p_sys->i_page_size = p_vout->i_width * p_vout->i_height * p_vout->i_bytes_per_pixel; p_vout->p_sys->i_page_size = p_vout->i_width * p_vout->i_height * p_vout->i_bytes_per_pixel;
//EJ added p_vout->i_bytes_per_line = (**(**GetWindowDevice( p_vout )).gdPMap).rowBytes & 0x3FFF ;
#if 1
p_vout->i_bytes_per_line = (**(**GetWindowDevice( p_vout )).gdPMap).rowBytes & 0x3FFF ;
switch ( p_vout->i_screen_depth ) switch ( p_vout->i_screen_depth )
{ {
...@@ -375,9 +369,7 @@ p_vout->i_bytes_per_line = (**(**GetWindowDevice( p_vout )).gdPMap).rowBytes & 0 ...@@ -375,9 +369,7 @@ p_vout->i_bytes_per_line = (**(**GetWindowDevice( p_vout )).gdPMap).rowBytes & 0
default: default:
break; break;
} }
#endif
//EJ - not sure about these...
#if 0 #if 0
p_vout->i_red_lshift = 0x10; p_vout->i_red_lshift = 0x10;
p_vout->i_red_rshift = 0x0; p_vout->i_red_rshift = 0x0;
...@@ -574,15 +566,8 @@ void BlitToWindow( vout_thread_t *p_vout, short index ) ...@@ -574,15 +566,8 @@ void BlitToWindow( vout_thread_t *p_vout, short index )
GetPortBitMapForCopyBits( GetWindowPort( p_vout->p_sys->p_window ) ), GetPortBitMapForCopyBits( GetWindowPort( p_vout->p_sys->p_window ) ),
&rectSource, &rectDest, srcCopy, NULL); &rectSource, &rectDest, srcCopy, NULL);
// UnlockPixels( GetGWorldPixMap( p_vout->p_sys->p_gw[index] ) ); // UnlockPixels( GetGWorldPixMap( p_vout->p_sys->p_gw[index] ) );
//EJ
//flushQD( p_vout ); //flushQD( p_vout );
/* // }
}
else
{
intf_ErrMsg( "error: Could not LockPixels" );
}
*/
SetPort ( pCGrafSave ); SetPort ( pCGrafSave );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment