PageRenderTime 122ms CodeModel.GetById 60ms app.highlight 5ms RepoModel.GetById 56ms app.codeStats 0ms

/thirdparty/SPMediaKeyTap/SPMediaKeyTapDelegate.m

http://github.com/tomahawk-player/tomahawk
Objective C | 25 lines | 18 code | 7 blank | 0 comment | 9 complexity | b64bf3d75f4f8281a2512401a06c2b92 MD5 | raw file
 1-(void)mediaKeyTap:(SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event;
 2{
 3	assert([event type] == NSSystemDefined && [event subtype] == SPSystemDefinedEventMediaKeys);
 4
 5	int keyCode = (([event data1] & 0xFFFF0000) >> 16);
 6	int keyFlags = ([event data1] & 0x0000FFFF);
 7	int keyState = (((keyFlags & 0xFF00) >> 8)) == 0xA;
 8	int keyRepeat = (keyFlags & 0x1);
 9		
10	if (keyState == 1 && windowController != NULL) {
11		
12		
13		switch (keyCode) {
14				
15			case NX_KEYTYPE_PLAY:
16...				return;
17				
18			case NX_KEYTYPE_FAST:
19...				return;
20				
21			case NX_KEYTYPE_REWIND:
22...				return;
23		}
24	}
25}