diff options
Diffstat (limited to 'platform/osx')
-rw-r--r-- | platform/osx/joypad_osx.cpp | 10 | ||||
-rw-r--r-- | platform/osx/os_osx.mm | 18 |
2 files changed, 17 insertions, 11 deletions
diff --git a/platform/osx/joypad_osx.cpp b/platform/osx/joypad_osx.cpp index 1a4b3a460e..96c660ad1d 100644 --- a/platform/osx/joypad_osx.cpp +++ b/platform/osx/joypad_osx.cpp @@ -217,10 +217,9 @@ static void joypad_added_callback(void *ctx, IOReturn res, void *sender, IOHIDDe } static bool is_joypad(IOHIDDeviceRef p_device_ref) { - CFTypeRef refCF = NULL; int usage_page = 0; int usage = 0; - refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDPrimaryUsagePageKey)); + CFTypeRef refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDPrimaryUsagePageKey)); if (refCF) { CFNumberGetValue((CFNumberRef)refCF, kCFNumberSInt32Type, &usage_page); } @@ -289,13 +288,11 @@ static String _hex_str(uint8_t p_byte) { bool JoypadOSX::configure_joypad(IOHIDDeviceRef p_device_ref, joypad *p_joy) { - CFTypeRef refCF = NULL; - p_joy->device_ref = p_device_ref; /* get device name */ String name; char c_name[256]; - refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDProductKey)); + CFTypeRef refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDProductKey)); if (!refCF) { refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDManufacturerKey)); } @@ -334,8 +331,7 @@ bool JoypadOSX::configure_joypad(IOHIDDeviceRef p_device_ref, joypad *p_joy) { input->joy_connection_changed(id, true, name, guid); } - CFArrayRef array = NULL; - array = IOHIDDeviceCopyMatchingElements(p_device_ref, NULL, kIOHIDOptionsTypeNone); + CFArrayRef array = IOHIDDeviceCopyMatchingElements(p_device_ref, NULL, kIOHIDOptionsTypeNone); if (array) { p_joy->add_hid_elements(array); CFRelease(array); diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index bf862f265c..a0fc53d517 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -137,6 +137,11 @@ static bool mouse_down_control = false; //_GodotInputMonitorChange(); } +- (void)showAbout:(id)sender { + if (OS_OSX::singleton->get_main_loop()) + OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_ABOUT); +} + @end @interface GodotWindowDelegate : NSObject { @@ -1526,9 +1531,14 @@ Point2 OS_OSX::get_window_position() const { void OS_OSX::set_window_position(const Point2 &p_position) { - Point2 size = p_position; - size /= display_scale; - [window_object setFrame:NSMakeRect(size.x, size.y, [window_object frame].size.width, [window_object frame].size.height) display:YES]; + Size2 scr = get_screen_size(); + NSPoint pos; + + pos.x = p_position.x / display_scale; + // For OS X the y starts at the bottom + pos.y = (scr.height - p_position.y) / display_scale; + + [window_object setFrameTopLeftPoint:pos]; _update_window(); }; @@ -1909,7 +1919,7 @@ OS_OSX::OS_OSX() { // Setup Apple menu NSMenu *apple_menu = [[NSMenu alloc] initWithTitle:@""]; title = [NSString stringWithFormat:NSLocalizedString(@"About %@", nil), nsappname]; - [apple_menu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; + [apple_menu addItemWithTitle:title action:@selector(showAbout:) keyEquivalent:@""]; [apple_menu addItem:[NSMenuItem separatorItem]]; |