Skip to content

Commit

Permalink
ui_cocoa: fix mouse input for cocoa
Browse files Browse the repository at this point in the history
This brings back two lines of code that have been removed over time but
appear to be required in order for mouse input to work on macOS.
  • Loading branch information
alexkornitzer committed Apr 16, 2020
1 parent 5303ece commit ac4b49f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ui/drivers/ui_cocoa.m
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ - (void)sendEvent:(NSEvent *)event {
#if defined(HAVE_COCOA_METAL)
pos = [apple_platform.renderView convertPoint:[event locationInWindow] fromView:nil];
#elif defined(HAVE_COCOA)
pos = [[CocoaView get] convertPoint:[event locationInWindow] fromView:nil];
#endif
apple->touches[0].screen_x = (int16_t)pos.x;
apple->touches[0].screen_y = (int16_t)pos.y;
Expand Down Expand Up @@ -172,6 +173,7 @@ - (void)sendEvent:(NSEvent *)event {
if (!apple || pos.y < 0)
return;
apple->mouse_buttons |= (1 << event.buttonNumber);
apple->touch_count = 1;
}
break;
case NSEventTypeLeftMouseUp:
Expand Down Expand Up @@ -431,10 +433,10 @@ - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sende

- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames
{
if ((filenames.count == 1) && [filenames objectAtIndex:0])
if ((filenames.count == 1) && [filenames objectAtIndex:0])
{
struct retro_system_info *system = runloop_get_libretro_system_info();
NSString *__core = [filenames objectAtIndex:0];
NSString *__core = [filenames objectAtIndex:0];
const char *core_name = system->library_name;

if (core_name)
Expand Down Expand Up @@ -483,7 +485,7 @@ static void open_core_handler(ui_browser_window_state_t *state, bool result)
path_set(RARCH_PATH_CORE, state->result);
ui_companion_event_command(CMD_EVENT_LOAD_CORE);

if (info
if (info
&& info->load_no_content
&& set_supports_no_game_enable)
{
Expand Down Expand Up @@ -554,7 +556,7 @@ - (void)openDocument:(id)sender

if (browser)
{
ui_browser_window_state_t
ui_browser_window_state_t
browser_state = {{0}};
bool result = false;
settings_t *settings = config_get_ptr();
Expand Down

0 comments on commit ac4b49f

Please sign in to comment.