~ubuntu-branches/ubuntu/utopic/vlc/utopic

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Benjamin Drung
  • Date: 2012-07-21 17:52:21 UTC
  • mfrom: (1.1.48) (3.5.44 sid)
  • Revision ID: package-import@ubuntu.com-20120721175221-53m5pclzo992kawy
Tags: 2.0.3-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * intf.m: MacOS X interface module
3
3
 *****************************************************************************
4
4
 * Copyright (C) 2002-2012 VLC authors and VideoLAN
5
 
 * $Id: 9df99fc329710e50a4d662cbf24aae95efb777a4 $
 
5
 * $Id: cfadf2dc1b4ac7c2d37b9b9f58cdd5b0a2d2e3fd $
6
6
 *
7
7
 * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
8
8
 *          Christophe Massiot <massiot@via.ecp.fr>
168
168
    else if( i_query == VOUT_WINDOW_SET_FULLSCREEN )
169
169
    {
170
170
        NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
171
 
        // we already have our playlist "fullscreen" callback, do not repeat the same call here
172
 
        //[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(fullscreenChanged) withObject: nil waitUntilDone: NO];
 
171
        int i_full = va_arg( args, int );
 
172
        [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(checkFullscreenChange:) withObject:[NSNumber numberWithInt: i_full] waitUntilDone:NO];
173
173
        [o_pool release];
174
174
    }
175
175
    else
973
973
                [[VLCCoreInteraction sharedInstance] backward];
974
974
                break;
975
975
            case kRemoteButtonVolume_Plus_Hold:
976
 
                [[VLCCoreInteraction sharedInstance] volumeUp];
 
976
                if( p_intf )
 
977
                    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_VOL_UP );
977
978
                break;
978
979
            case kRemoteButtonVolume_Minus_Hold:
979
 
                [[VLCCoreInteraction sharedInstance] volumeDown];
 
980
                if( p_intf )
 
981
                    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_VOL_DOWN );
980
982
                break;
981
983
        }
982
984
        if(b_remote_button_hold)
1010
1012
            }
1011
1013
            break;
1012
1014
        case kRemoteButtonVolume_Plus:
1013
 
            [[VLCCoreInteraction sharedInstance] volumeUp];
 
1015
            if( p_intf )
 
1016
                var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_VOL_UP );
1014
1017
            break;
1015
1018
        case kRemoteButtonVolume_Minus:
1016
 
            [[VLCCoreInteraction sharedInstance] volumeDown];
 
1019
            if( p_intf )
 
1020
                var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_VOL_DOWN );
1017
1021
            break;
1018
1022
        case kRemoteButtonRight:
1019
1023
            [[VLCCoreInteraction sharedInstance] next];
1305
1309
 * shortcut key.  If it is, pass it off to VLC for handling and return YES,
1306
1310
 * otherwise ignore it and return NO (where it will get handled by Cocoa).
1307
1311
 *****************************************************************************/
1308
 
- (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event
 
1312
- (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event force:(BOOL)b_force
1309
1313
{
1310
1314
    unichar key = 0;
1311
1315
    vlc_value_t val;
1327
1331
        val.i_int |= KEY_MODIFIER_COMMAND;
1328
1332
    }
1329
1333
 
1330
 
    key = [[o_event charactersIgnoringModifiers] characterAtIndex: 0];
 
1334
    key = [[[o_event charactersIgnoringModifiers] lowercaseString] characterAtIndex: 0];
1331
1335
 
1332
1336
    /* handle Lion's default key combo for fullscreen-toggle in addition to our own hotkeys */
1333
1337
    if( key == 'f' && i_pressed_modifiers & NSControlKeyMask && i_pressed_modifiers & NSCommandKeyMask )
1336
1340
        return YES;
1337
1341
    }
1338
1342
 
1339
 
    if( val.i_int == 0 ) // ignore only when no modifier is pressed
 
1343
    if( !b_force )
1340
1344
    {
1341
1345
        switch( key )
1342
1346
        {
1447
1451
            input_thread_t * p_input = pl_CurrentInput( VLCIntf );
1448
1452
            if( p_input != NULL && [self activeVideoPlayback] )
1449
1453
            {
 
1454
                // activate app, as method can also be triggered from outside the app (prevents nasty window layout)
 
1455
                [NSApp activateIgnoringOtherApps:YES];
1450
1456
                [o_mainwindow performSelectorOnMainThread:@selector(enterFullscreen) withObject:nil waitUntilDone:NO];
1451
1457
            }
1452
1458
            if (p_input)
1460
1466
    }
1461
1467
}
1462
1468
 
 
1469
- (void)checkFullscreenChange:(NSNumber *)o_full
 
1470
{
 
1471
    BOOL b_full = [o_full boolValue];    
 
1472
    if( p_intf && !var_GetBool( pl_Get( p_intf ), "fullscreen" ) != !b_full )
 
1473
    {
 
1474
        var_SetBool( pl_Get(p_intf), "fullscreen", b_full );        
 
1475
    }
 
1476
}
 
1477
 
1463
1478
- (void)PlaylistItemChanged
1464
1479
{
1465
1480
    if( p_current_input && ( p_current_input->b_dead || !vlc_object_alive( p_current_input ) ))