~bratsche/vlc/vlc-notify-add-actions-with-server-support

« back to all changes in this revision

Viewing changes to modules/gui/macosx/vout.m

  • Committer: Bazaar Package Importer
  • Date: 2008-11-28 09:29:51 UTC
  • Revision ID: jamesw@ubuntu.com-20081128092951-0y5ojboptscru17f
Tags: upstream-ubuntu-0.8.6.release.e+x264svn20071224+faad2.6.1
ImportĀ upstreamĀ versionĀ 0.8.6.release.e+x264svn20071224+faad2.6.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * vout.m: MacOS X video output module
3
3
 *****************************************************************************
4
4
 * Copyright (C) 2001-2007 the VideoLAN team
5
 
 * $Id: vout.m 23121 2007-11-18 15:07:03Z pdherbemont $
 
5
 * $Id: vout.m 24195 2008-01-08 13:22:38Z fkuehne $
6
6
 *
7
7
 * Authors: Colin Delacroix <colin@zoy.org>
8
8
 *          Florian G. Pflug <fgp@phlo.org>
71
71
- (id)init
72
72
{
73
73
    [super init];
74
 
    o_embedded_array = [NSMutableArray array];
 
74
    o_embedded_array = [[NSMutableArray alloc] init];
75
75
    return self;
76
76
}
77
77
 
 
78
- (void)dealloc
 
79
{
 
80
    [o_embedded_array release];
 
81
    [super dealloc];
 
82
}
 
83
 
78
84
- (id)getEmbeddedVout
79
85
{
80
86
    unsigned int i;
160
166
    int i_device;
161
167
    NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
162
168
    NSArray *o_screens = [NSScreen screens];
 
169
    NSScreen *o_fullscreen_screen = nil;
163
170
 
164
171
    p_vout  = vout;
165
172
    o_view  = view;
180
187
        i_device = var_GetInteger( p_real_vout->p_vlc, "video-device" );
181
188
    }
182
189
 
 
190
    o_fullscreen_screen = [NSScreen screenWithDisplayID: (CGDirectDisplayID)i_device];
 
191
    if( !o_fullscreen_screen )
 
192
        o_fullscreen_screen = [[self window] screen];
 
193
 
183
194
    /* Setup the menuitem for the multiple displays. */
184
195
    if( var_Type( p_real_vout, "video-device" ) == 0 )
185
196
    {
211
222
                      (int)s_rect.size.width, (int)s_rect.size.height );
212
223
 
213
224
            text.psz_string = psz_temp;
214
 
            val2.i_int = i;
 
225
            val2.i_int = (int)[o_screen displayID];
215
226
            var_Change( p_real_vout, "video-device",
216
227
                        VLC_VAR_ADDCHOICE, &val2, &text );
217
 
            if( i == i_device )
 
228
            if( [o_screen isScreen:o_fullscreen_screen] )
218
229
            {
219
230
                var_Set( p_real_vout, "video-device", val2 );
220
231
            }
413
424
- (void)manage
414
425
{
415
426
    /* Disable Screensaver, when we're playing something, but allow it on pause */
416
 
    if( VLCIntf->p_sys->i_play_status == PLAYING_S )
417
 
        UpdateSystemActivity( UsrActivity );
 
427
    if( VLCIntf->p_sys && !VLCIntf->b_die )
 
428
        if( VLCIntf->p_sys->i_play_status == PLAYING_S )
 
429
            UpdateSystemActivity( UsrActivity );
418
430
}
419
431
 
420
432
- (id)getWindow
937
949
{
938
950
    playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
939
951
                                               FIND_ANYWHERE );
 
952
    if( p_playlist )
 
953
    {
 
954
        if(!playlist_IsPlaying( p_playlist ))
 
955
            [o_window performSelectorOnMainThread: @selector(orderOut:) withObject: self waitUntilDone: YES];
940
956
 
941
 
    if(!playlist_IsPlaying( p_playlist ))
942
 
        [o_window performSelectorOnMainThread: @selector(orderOut:) withObject: self waitUntilDone: YES];
943
 
 
944
 
    vlc_object_release( p_playlist );
 
957
        vlc_object_release( p_playlist );
 
958
    }
945
959
 
946
960
    [super closeVout];
947
961
}
998
1012
    b_embedded = var_GetBool( p_vout, "macosx-embedded" );
999
1013
 
1000
1014
    /* Find out on which screen to open the window */
1001
 
    if( i_device <= 0 || i_device > (int)[o_screens count] )
1002
 
    {
1003
 
         /* No preference specified. Use the main screen */
1004
 
        o_screen = [NSScreen mainScreen];
1005
 
        i_device = [o_screens indexOfObject: o_screen];
1006
 
        if( o_screen == [o_screens objectAtIndex: 0] )
1007
 
            b_menubar_screen = VLC_TRUE;
1008
 
    }
1009
 
    else
1010
 
    {
1011
 
        i_device--;
1012
 
        o_screen = [o_screens objectAtIndex: i_device];
1013
 
        b_menubar_screen = ( i_device == 0 );
1014
 
    }
 
1015
    o_screen = [NSScreen screenWithDisplayID: (CGDirectDisplayID)i_device];
 
1016
    if( !o_screen )
 
1017
        o_screen = [self screen];
 
1018
    if( [o_screen isMainScreen] )
 
1019
        b_menubar_screen = VLC_TRUE;
1015
1020
 
1016
1021
    if( p_vout->b_fullscreen )
1017
1022
    {
1025
1030
            [[[[VLCMain sharedInstance] getControls] getFSPanel] setActive: nil];
1026
1031
 
1027
1032
        /* tell the fspanel to move itself to front next time it's triggered */
1028
 
        [[[[VLCMain sharedInstance] getControls] getFSPanel] setVoutWasUpdated: i_device];
 
1033
        [[[[VLCMain sharedInstance] getControls] getFSPanel] setVoutWasUpdated: o_screen];
1029
1034
 
1030
1035
        /* Creates a window with size: screen_rect on o_screen */
1031
1036
        [self initWithContentRect: screen_rect
1051
1056
                CGDisplayCount dspyCnt;
1052
1057
                CGPoint gPoint;
1053
1058
 
1054
 
                if( i == (unsigned int)i_device ) continue;
 
1059
                if( [[o_screens objectAtIndex:i] isScreen: o_screen] ) continue;
1055
1060
 
1056
1061
                screen_rect = [[o_screens objectAtIndex: i] frame];
1057
1062
 
1149
1154
{
1150
1155
    /* XXX waitUntilDone = NO to avoid a possible deadlock when hitting
1151
1156
       Command-Q */
1152
 
    [self setContentView: NULL];
1153
1157
    [self performSelectorOnMainThread: @selector(closeReal:)
1154
1158
        withObject: NULL waitUntilDone: NO];
1155
1159
}
1160
1164
    {
1161
1165
        CGDisplayFadeReservationToken token;
1162
1166
        CGAcquireDisplayFadeReservation(kCGMaxDisplayReservationInterval, &token);
1163
 
        CGDisplayFade( token, 2, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0, 0, 0, false );
 
1167
        CGDisplayFade( token, 0.3 , kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0, 0, 0, YES );
 
1168
        
 
1169
        [self disableScreenUpdatesUntilFlush];
 
1170
        [self orderOut: self];
 
1171
        
 
1172
        CGDisplayFade( token, 0.6 , kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0, 0, 0, YES );
1164
1173
        CGReleaseDisplayFadeReservation( token);
1165
1174
        CGDisplayRestoreColorSyncSettings();
1166
1175
    }
 
1176
    [NSScreen unblackoutScreens];
 
1177
    
1167
1178
    SetSystemUIMode( kUIModeNormal, 0);
1168
1179
    [super close];
1169
1180