2013-08-14 10:07:36 -04:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2014-01-01 01:50:59 +01:00
|
|
|
* Copyright (C) 2013-2014 - Jason Fetters
|
2015-01-07 18:24:13 +01:00
|
|
|
* Copyright (C) 2011-2015 - Daniel De Matteis
|
2013-08-14 10:07:36 -04:00
|
|
|
*
|
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2015-04-20 11:21:01 +02:00
|
|
|
#include <objc/objc-runtime.h>
|
2013-08-14 10:07:36 -04:00
|
|
|
#include <string.h>
|
|
|
|
|
2015-04-20 12:52:16 +02:00
|
|
|
#include "../../ui/drivers/cocoa/cocoa_common.h"
|
2015-04-19 17:58:15 +02:00
|
|
|
#include "../../input/drivers/cocoa_input.h"
|
2014-10-17 05:03:51 +02:00
|
|
|
#include "../../frontend/frontend.h"
|
2015-01-09 17:44:00 +01:00
|
|
|
#include "../../retroarch.h"
|
2013-08-14 10:07:36 -04:00
|
|
|
|
2014-10-18 05:46:30 +02:00
|
|
|
id<RetroArch_Platform> apple_platform;
|
|
|
|
|
|
|
|
void apple_rarch_exited(void);
|
|
|
|
|
|
|
|
void apple_rarch_exited(void)
|
|
|
|
{
|
|
|
|
[apple_platform unloadingCore];
|
|
|
|
}
|
2013-11-22 15:30:02 +01:00
|
|
|
|
2013-08-14 10:07:36 -04:00
|
|
|
@interface RApplication : NSApplication
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation RApplication
|
|
|
|
|
|
|
|
- (void)sendEvent:(NSEvent *)event
|
|
|
|
{
|
2015-03-18 20:15:40 +01:00
|
|
|
NSEventType event_type;
|
2015-04-19 17:58:15 +02:00
|
|
|
cocoa_input_data_t *apple = NULL;
|
2015-03-18 20:15:40 +01:00
|
|
|
driver_t *driver = driver_get_ptr();
|
2013-08-14 10:07:36 -04:00
|
|
|
[super sendEvent:event];
|
2014-10-14 08:42:15 -04:00
|
|
|
|
2015-04-19 17:58:15 +02:00
|
|
|
apple = (cocoa_input_data_t*)driver->input_data;
|
2015-03-18 20:15:40 +01:00
|
|
|
event_type = event.type;
|
2014-10-18 06:07:43 +02:00
|
|
|
|
|
|
|
if (!apple)
|
|
|
|
return;
|
2014-10-14 08:42:15 -04:00
|
|
|
|
2015-03-30 17:10:31 +02:00
|
|
|
switch ((int32_t)event_type)
|
2014-01-09 18:16:20 -05:00
|
|
|
{
|
2014-10-05 23:49:37 +02:00
|
|
|
case NSKeyDown:
|
|
|
|
case NSKeyUp:
|
2014-01-09 18:16:20 -05:00
|
|
|
{
|
2014-10-05 23:49:37 +02:00
|
|
|
NSString* ch = (NSString*)event.characters;
|
2014-10-18 06:06:27 +02:00
|
|
|
uint32_t character = 0;
|
|
|
|
uint32_t mod = 0;
|
|
|
|
|
|
|
|
if (ch && ch.length != 0)
|
2014-10-05 23:49:37 +02:00
|
|
|
{
|
2015-03-30 17:10:31 +02:00
|
|
|
uint32_t i;
|
2014-10-18 06:06:27 +02:00
|
|
|
character = [ch characterAtIndex:0];
|
2015-01-15 21:30:14 +01:00
|
|
|
|
|
|
|
if (event.modifierFlags & NSAlphaShiftKeyMask)
|
|
|
|
mod |= RETROKMOD_CAPSLOCK;
|
|
|
|
if (event.modifierFlags & NSShiftKeyMask)
|
|
|
|
mod |= RETROKMOD_SHIFT;
|
|
|
|
if (event.modifierFlags & NSControlKeyMask)
|
|
|
|
mod |= RETROKMOD_CTRL;
|
|
|
|
if (event.modifierFlags & NSAlternateKeyMask)
|
|
|
|
mod |= RETROKMOD_ALT;
|
|
|
|
if (event.modifierFlags & NSCommandKeyMask)
|
|
|
|
mod |= RETROKMOD_META;
|
|
|
|
if (event.modifierFlags & NSNumericPadKeyMask)
|
|
|
|
mod |= RETROKMOD_NUMLOCK;
|
2014-10-18 06:06:27 +02:00
|
|
|
|
2015-03-30 17:10:31 +02:00
|
|
|
for (i = 1; i < ch.length; i++)
|
2015-04-19 20:02:00 +02:00
|
|
|
cocoa_input_keyboard_event(event_type == NSKeyDown,
|
2015-01-29 23:59:46 +01:00
|
|
|
0, [ch characterAtIndex:i], mod, RETRO_DEVICE_KEYBOARD);
|
2014-10-05 23:49:37 +02:00
|
|
|
}
|
2014-10-18 06:06:27 +02:00
|
|
|
|
2015-04-19 20:02:00 +02:00
|
|
|
cocoa_input_keyboard_event(event_type == NSKeyDown,
|
2015-01-29 23:59:46 +01:00
|
|
|
event.keyCode, character, mod, RETRO_DEVICE_KEYBOARD);
|
2014-01-09 18:16:20 -05:00
|
|
|
}
|
2014-10-05 23:49:37 +02:00
|
|
|
break;
|
|
|
|
case NSFlagsChanged:
|
|
|
|
{
|
|
|
|
static uint32_t old_flags = 0;
|
|
|
|
uint32_t new_flags = event.modifierFlags;
|
|
|
|
bool down = (new_flags & old_flags) == old_flags;
|
|
|
|
old_flags = new_flags;
|
2014-10-14 08:42:15 -04:00
|
|
|
|
2015-04-19 20:02:00 +02:00
|
|
|
cocoa_input_keyboard_event(down, event.keyCode,
|
2015-01-29 23:59:46 +01:00
|
|
|
0, event.modifierFlags, RETRO_DEVICE_KEYBOARD);
|
2014-10-05 23:49:37 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NSMouseMoved:
|
|
|
|
case NSLeftMouseDragged:
|
|
|
|
case NSRightMouseDragged:
|
|
|
|
case NSOtherMouseDragged:
|
|
|
|
{
|
|
|
|
NSPoint pos;
|
2015-03-11 18:30:14 +01:00
|
|
|
/* Relative */
|
2015-03-10 18:44:55 +01:00
|
|
|
apple->mouse_x = event.deltaX;
|
|
|
|
apple->mouse_y = event.deltaY;
|
2014-10-14 08:42:15 -04:00
|
|
|
|
2015-03-11 18:30:14 +01:00
|
|
|
/* Absolute */
|
2014-10-05 23:49:37 +02:00
|
|
|
pos = [[RAGameView get] convertPoint:[event locationInWindow] fromView:nil];
|
|
|
|
apple->touches[0].screen_x = pos.x;
|
|
|
|
apple->touches[0].screen_y = pos.y;
|
|
|
|
}
|
|
|
|
break;
|
2015-03-11 00:35:26 +01:00
|
|
|
case NSScrollWheel:
|
|
|
|
/* TODO/FIXME - properly implement. */
|
|
|
|
break;
|
2014-10-05 23:49:37 +02:00
|
|
|
case NSLeftMouseDown:
|
|
|
|
case NSRightMouseDown:
|
|
|
|
case NSOtherMouseDown:
|
|
|
|
apple->mouse_buttons |= 1 << event.buttonNumber;
|
|
|
|
apple->touch_count = 1;
|
|
|
|
break;
|
|
|
|
case NSLeftMouseUp:
|
|
|
|
case NSRightMouseUp:
|
|
|
|
case NSOtherMouseUp:
|
|
|
|
apple->mouse_buttons &= ~(1 << event.buttonNumber);
|
|
|
|
apple->touch_count = 0;
|
|
|
|
break;
|
2013-12-11 02:22:46 -05:00
|
|
|
}
|
2013-08-14 10:07:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2014-01-03 17:16:02 -05:00
|
|
|
static int waiting_argc;
|
|
|
|
static char** waiting_argv;
|
|
|
|
|
2013-12-13 19:23:22 -05:00
|
|
|
@interface RetroArch_OSX()
|
|
|
|
@property (nonatomic, retain) NSWindowController* settingsWindow;
|
|
|
|
@end
|
|
|
|
|
2013-08-14 10:07:36 -04:00
|
|
|
@implementation RetroArch_OSX
|
2013-12-13 19:23:22 -05:00
|
|
|
|
|
|
|
@synthesize window = _window;
|
|
|
|
@synthesize settingsWindow = _settingsWindow;
|
|
|
|
|
|
|
|
- (void)dealloc
|
|
|
|
{
|
|
|
|
[_window release];
|
|
|
|
[_settingsWindow release];
|
|
|
|
[super dealloc];
|
2013-08-14 10:07:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (RetroArch_OSX*)get
|
|
|
|
{
|
|
|
|
return (RetroArch_OSX*)[[NSApplication sharedApplication] delegate];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
|
|
|
|
{
|
|
|
|
apple_platform = self;
|
|
|
|
|
2014-01-04 14:05:22 -05:00
|
|
|
|
|
|
|
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
|
|
|
[self.window setCollectionBehavior:[self.window collectionBehavior] | NSWindowCollectionBehaviorFullScreenPrimary];
|
|
|
|
#endif
|
|
|
|
|
2013-12-14 20:35:47 -05:00
|
|
|
[self.window setAcceptsMouseMovedEvents: YES];
|
2014-10-14 08:42:15 -04:00
|
|
|
|
2013-12-14 20:35:47 -05:00
|
|
|
[[RAGameView get] setFrame: [[self.window contentView] bounds]];
|
|
|
|
[[self.window contentView] setAutoresizesSubviews:YES];
|
2014-05-23 01:09:46 +02:00
|
|
|
[[self.window contentView] addSubview:[RAGameView get]];
|
2013-12-14 20:35:47 -05:00
|
|
|
[self.window makeFirstResponder:[RAGameView get]];
|
2014-10-14 08:42:15 -04:00
|
|
|
|
2014-04-26 04:49:47 +02:00
|
|
|
self.settingsWindow = [[[NSWindowController alloc] initWithWindowNibName:BOXSTRING("Settings")] autorelease];
|
2014-10-14 08:42:15 -04:00
|
|
|
|
2014-10-18 05:46:30 +02:00
|
|
|
[apple_platform loadingCore:nil withFile:nil];
|
|
|
|
|
|
|
|
if (rarch_main(waiting_argc, waiting_argv))
|
|
|
|
apple_rarch_exited();
|
2013-08-14 10:07:36 -04:00
|
|
|
|
2014-01-03 17:16:02 -05:00
|
|
|
waiting_argc = 0;
|
2014-07-14 03:52:35 +02:00
|
|
|
}
|
2013-12-11 02:22:46 -05:00
|
|
|
|
2015-03-12 05:02:53 +01:00
|
|
|
static void poll_iteration(void)
|
2015-03-07 21:33:17 +01:00
|
|
|
{
|
2015-03-18 20:15:40 +01:00
|
|
|
NSEvent *event = NULL;
|
|
|
|
driver_t *driver = driver_get_ptr();
|
2015-04-19 17:58:15 +02:00
|
|
|
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
|
2015-03-10 18:44:55 +01:00
|
|
|
|
|
|
|
if (!apple)
|
|
|
|
return;
|
|
|
|
|
|
|
|
apple->mouse_x = 0;
|
|
|
|
apple->mouse_y = 0;
|
2015-03-07 21:33:17 +01:00
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES];
|
|
|
|
|
|
|
|
[NSApp sendEvent: event];
|
|
|
|
}while(event != nil);
|
|
|
|
}
|
|
|
|
|
2015-03-10 17:11:14 +01:00
|
|
|
- (void) rarch_main
|
2015-03-07 21:33:17 +01:00
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
while (ret != -1)
|
|
|
|
{
|
2015-03-12 05:02:53 +01:00
|
|
|
poll_iteration();
|
2015-03-07 21:33:17 +01:00
|
|
|
ret = rarch_main_iterate();
|
|
|
|
while(CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.002, FALSE) == kCFRunLoopRunHandledSource);
|
|
|
|
}
|
|
|
|
|
|
|
|
main_exit(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) apple_start_iteration
|
|
|
|
{
|
2015-03-10 17:11:14 +01:00
|
|
|
[self performSelectorOnMainThread:@selector(rarch_main) withObject:nil waitUntilDone:NO];
|
2015-03-07 21:33:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void) apple_stop_iteration
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-07-14 03:52:35 +02:00
|
|
|
- (void)applicationDidBecomeActive:(NSNotification *)notification
|
|
|
|
{
|
2015-03-07 21:33:17 +01:00
|
|
|
[self apple_start_iteration];
|
2013-08-14 10:07:36 -04:00
|
|
|
}
|
|
|
|
|
2014-07-14 03:52:35 +02:00
|
|
|
- (void)applicationWillResignActive:(NSNotification *)notification
|
|
|
|
{
|
2015-03-07 21:33:17 +01:00
|
|
|
[self apple_stop_iteration];
|
2014-07-14 03:52:35 +02:00
|
|
|
}
|
|
|
|
|
2013-08-14 10:07:36 -04:00
|
|
|
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
|
|
|
|
{
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
|
|
|
|
{
|
2015-03-21 05:42:49 +01:00
|
|
|
NSApplicationTerminateReply reply = NSTerminateNow;
|
|
|
|
global_t *global = global_get_ptr();
|
|
|
|
|
2015-03-29 18:09:15 +02:00
|
|
|
if (global && global->main_is_init)
|
2015-03-21 05:42:49 +01:00
|
|
|
reply = NSTerminateCancel;
|
2013-08-14 10:07:36 -04:00
|
|
|
|
2015-04-13 11:26:02 +02:00
|
|
|
event_command(EVENT_CMD_QUIT);
|
2013-08-14 10:07:36 -04:00
|
|
|
|
2014-07-10 22:02:54 +02:00
|
|
|
return reply;
|
2013-08-14 10:07:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames
|
|
|
|
{
|
2014-05-02 16:43:08 +02:00
|
|
|
if (filenames.count == 1 && [filenames objectAtIndex:0])
|
2013-08-14 10:07:36 -04:00
|
|
|
{
|
2015-03-21 05:42:49 +01:00
|
|
|
global_t *global = global_get_ptr();
|
|
|
|
NSString *__core = [filenames objectAtIndex:0];
|
2015-03-29 18:17:29 +02:00
|
|
|
const char *core_name = global ? global->menu.info.library_name : NULL;
|
|
|
|
|
|
|
|
if (global)
|
|
|
|
strlcpy(global->fullpath, __core.UTF8String, sizeof(global->fullpath));
|
2015-03-21 05:42:49 +01:00
|
|
|
|
|
|
|
if (core_name)
|
2015-04-13 11:26:02 +02:00
|
|
|
event_command(EVENT_CMD_LOAD_CONTENT);
|
2015-03-21 05:42:49 +01:00
|
|
|
|
2013-08-14 10:07:36 -04:00
|
|
|
[sender replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-05-03 21:34:13 +02:00
|
|
|
apple_display_alert("Cannot open multiple files", "RetroArch");
|
2013-08-14 10:07:36 -04:00
|
|
|
[sender replyToOpenOrPrint:NSApplicationDelegateReplyFailure];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)openDocument:(id)sender
|
|
|
|
{
|
2014-05-12 16:37:02 +02:00
|
|
|
NSOpenPanel* panel = (NSOpenPanel*)[NSOpenPanel openPanel];
|
2014-05-12 18:11:22 +02:00
|
|
|
#if defined(MAC_OS_X_VERSION_10_6)
|
2013-12-13 19:23:22 -05:00
|
|
|
[panel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result)
|
2013-08-14 10:07:36 -04:00
|
|
|
{
|
2013-12-14 20:35:47 -05:00
|
|
|
[[NSApplication sharedApplication] stopModal];
|
2015-03-21 05:42:49 +01:00
|
|
|
|
2014-04-26 03:58:07 +02:00
|
|
|
if (result == NSOKButton && panel.URL)
|
2013-08-14 10:07:36 -04:00
|
|
|
{
|
2015-03-21 05:42:49 +01:00
|
|
|
global_t *global = global_get_ptr();
|
|
|
|
NSURL *url = (NSURL*)panel.URL;
|
|
|
|
NSString *__core = url.path;
|
2015-03-29 18:17:29 +02:00
|
|
|
const char *core_name = global ? global->menu.info.library_name : NULL;
|
|
|
|
|
|
|
|
if (global)
|
|
|
|
strlcpy(global->fullpath, __core.UTF8String, sizeof(global->fullpath));
|
2015-03-21 05:42:49 +01:00
|
|
|
|
|
|
|
if (core_name)
|
2015-04-13 11:26:02 +02:00
|
|
|
event_command(EVENT_CMD_LOAD_CONTENT);
|
2015-03-21 05:42:49 +01:00
|
|
|
else
|
|
|
|
[self performSelector:@selector(chooseCore) withObject:nil afterDelay:.5f];
|
2013-08-14 10:07:36 -04:00
|
|
|
}
|
|
|
|
}];
|
2014-04-14 18:30:21 +02:00
|
|
|
#else
|
2015-03-21 05:42:49 +01:00
|
|
|
[panel beginSheetForDirectory:nil file:nil modalForWindopw:[self window] modalDelegate:self didEndSelector:@selector(didEndSaveSheet:returnCode:contextInfo:) contextInfo:NULL];
|
2014-04-14 18:30:21 +02:00
|
|
|
#endif
|
2013-12-14 20:35:47 -05:00
|
|
|
[[NSApplication sharedApplication] runModalForWindow:panel];
|
2013-08-14 10:07:36 -04:00
|
|
|
}
|
|
|
|
|
2013-11-22 15:30:02 +01:00
|
|
|
- (void)loadingCore:(const NSString*)core withFile:(const char*)file
|
2013-08-14 10:07:36 -04:00
|
|
|
{
|
|
|
|
if (file)
|
2013-12-14 20:35:47 -05:00
|
|
|
[[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:[NSURL fileURLWithPath:BOXSTRING(file)]];
|
2013-08-14 10:07:36 -04:00
|
|
|
}
|
|
|
|
|
2014-07-20 07:00:02 +02:00
|
|
|
- (void)unloadingCore
|
2013-08-14 10:07:36 -04:00
|
|
|
{
|
2014-07-24 03:51:57 +02:00
|
|
|
[[NSApplication sharedApplication] terminate:nil];
|
2013-08-14 10:07:36 -04:00
|
|
|
}
|
|
|
|
|
2013-08-25 19:40:31 -04:00
|
|
|
- (IBAction)showCoresDirectory:(id)sender
|
|
|
|
{
|
2015-03-20 22:41:15 +01:00
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
[[NSWorkspace sharedWorkspace] openFile:BOXSTRING(settings->libretro_directory)];
|
2013-08-25 19:40:31 -04:00
|
|
|
}
|
|
|
|
|
2013-08-14 10:07:36 -04:00
|
|
|
- (IBAction)showPreferences:(id)sender
|
|
|
|
{
|
2013-12-14 20:35:47 -05:00
|
|
|
[NSApp runModalForWindow:[self.settingsWindow window]];
|
2013-08-14 10:07:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
- (IBAction)basicEvent:(id)sender
|
|
|
|
{
|
2015-03-21 05:42:49 +01:00
|
|
|
unsigned cmd;
|
|
|
|
unsigned sender_tag = (unsigned)[sender tag];
|
|
|
|
global_t *global = global_get_ptr();
|
2014-10-29 06:05:50 +01:00
|
|
|
|
|
|
|
RARCH_LOG("Gets here, sender tag is: %d\n", sender_tag);
|
2014-07-22 04:02:53 +02:00
|
|
|
|
|
|
|
switch (sender_tag)
|
|
|
|
{
|
|
|
|
case 1:
|
2015-04-13 10:29:15 +02:00
|
|
|
cmd = EVENT_CMD_RESET;
|
2014-07-22 04:02:53 +02:00
|
|
|
break;
|
|
|
|
case 2:
|
2015-04-13 10:29:15 +02:00
|
|
|
cmd = EVENT_CMD_LOAD_STATE;
|
2014-07-22 04:02:53 +02:00
|
|
|
break;
|
|
|
|
case 3:
|
2015-04-13 10:29:15 +02:00
|
|
|
cmd = EVENT_CMD_SAVE_STATE;
|
2014-07-22 04:02:53 +02:00
|
|
|
break;
|
2014-10-29 05:09:37 +01:00
|
|
|
case 4:
|
2015-04-13 10:29:15 +02:00
|
|
|
cmd = EVENT_CMD_DISK_EJECT_TOGGLE;
|
2014-10-29 05:09:37 +01:00
|
|
|
break;
|
|
|
|
case 5:
|
2015-04-13 10:29:15 +02:00
|
|
|
cmd = EVENT_CMD_DISK_PREV;
|
2014-10-29 05:09:37 +01:00
|
|
|
break;
|
|
|
|
case 6:
|
2015-04-13 10:29:15 +02:00
|
|
|
cmd = EVENT_CMD_DISK_NEXT;
|
2014-10-29 05:09:37 +01:00
|
|
|
break;
|
|
|
|
case 7:
|
2015-04-13 10:29:15 +02:00
|
|
|
cmd = EVENT_CMD_GRAB_MOUSE_TOGGLE;
|
2014-10-29 05:09:37 +01:00
|
|
|
break;
|
|
|
|
case 8:
|
2015-04-13 10:29:15 +02:00
|
|
|
cmd = EVENT_CMD_MENU_TOGGLE;
|
2014-10-29 05:09:37 +01:00
|
|
|
break;
|
2014-10-29 05:11:32 +01:00
|
|
|
case 9:
|
2015-04-13 10:29:15 +02:00
|
|
|
cmd = EVENT_CMD_PAUSE_TOGGLE;
|
2014-10-29 05:11:32 +01:00
|
|
|
break;
|
2014-10-29 06:41:45 +01:00
|
|
|
case 20:
|
2015-04-13 10:29:15 +02:00
|
|
|
cmd = EVENT_CMD_FULLSCREEN_TOGGLE;
|
2014-10-29 06:41:45 +01:00
|
|
|
break;
|
2014-09-05 23:19:40 -04:00
|
|
|
default:
|
2015-04-13 10:29:15 +02:00
|
|
|
cmd = EVENT_CMD_NONE;
|
2014-09-05 23:19:40 -04:00
|
|
|
break;
|
2014-07-22 04:02:53 +02:00
|
|
|
}
|
2014-10-29 06:34:07 +01:00
|
|
|
|
|
|
|
if (sender_tag >= 10 && sender_tag <= 19)
|
|
|
|
{
|
|
|
|
unsigned idx = (sender_tag - (10-1));
|
2015-03-21 05:42:49 +01:00
|
|
|
global->pending.windowed_scale = idx;
|
2015-04-13 10:29:15 +02:00
|
|
|
cmd = EVENT_CMD_RESIZE_WINDOWED_SCALE;
|
2014-10-29 06:34:07 +01:00
|
|
|
}
|
2014-05-12 16:37:02 +02:00
|
|
|
|
2015-04-13 11:26:02 +02:00
|
|
|
event_command(cmd);
|
2013-08-14 10:07:36 -04:00
|
|
|
}
|
|
|
|
|
2015-03-30 17:10:31 +02:00
|
|
|
- (void)alertDidEnd:(NSAlert *)alert returnCode:(int32_t)returnCode contextInfo:(void *)contextInfo
|
2013-08-14 10:07:36 -04:00
|
|
|
{
|
2013-12-14 20:35:47 -05:00
|
|
|
[[NSApplication sharedApplication] stopModal];
|
2013-08-14 10:07:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2014-05-11 01:59:24 +02:00
|
|
|
int i;
|
|
|
|
for (i = 0; i < argc; i ++)
|
|
|
|
{
|
2013-08-27 12:07:59 -04:00
|
|
|
if (strcmp(argv[i], "--") == 0)
|
|
|
|
{
|
2014-01-03 17:16:02 -05:00
|
|
|
waiting_argc = argc - i;
|
|
|
|
waiting_argv = argv + i;
|
|
|
|
break;
|
2013-08-27 12:07:59 -04:00
|
|
|
}
|
2014-05-11 01:59:24 +02:00
|
|
|
}
|
2013-08-27 12:07:59 -04:00
|
|
|
|
2013-08-14 10:07:36 -04:00
|
|
|
return NSApplicationMain(argc, (const char **) argv);
|
|
|
|
}
|
|
|
|
|