Skip to content

Commit

Permalink
Merge pull request #60929 from bruvzg/macos_ios_includes
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga authored May 10, 2022
2 parents cc3ed63 + ffe61e0 commit 917fd65
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 46 deletions.
4 changes: 2 additions & 2 deletions drivers/coreaudio/audio_driver_coreaudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@

#include "servers/audio_server.h"

#include <AudioUnit/AudioUnit.h>
#import <AudioUnit/AudioUnit.h>
#ifdef OSX_ENABLED
#include <CoreAudio/AudioHardware.h>
#import <CoreAudio/AudioHardware.h>
#endif

class AudioDriverCoreAudio : public AudioDriver {
Expand Down
4 changes: 2 additions & 2 deletions drivers/coremidi/midi_driver_coremidi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@

#include "core/string/print_string.h"

#include <CoreAudio/HostTime.h>
#include <CoreServices/CoreServices.h>
#import <CoreAudio/HostTime.h>
#import <CoreServices/CoreServices.h>

void MIDIDriverCoreMidi::read(const MIDIPacketList *packet_list, void *read_proc_ref_con, void *src_conn_ref_con) {
MIDIPacket *packet = const_cast<MIDIPacket *>(packet_list->packet);
Expand Down
2 changes: 1 addition & 1 deletion drivers/coremidi/midi_driver_coremidi.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "core/os/midi_driver.h"
#include "core/templates/vector.h"

#include <CoreMIDI/CoreMIDI.h>
#import <CoreMIDI/CoreMIDI.h>
#include <stdio.h>

class MIDIDriverCoreMidi : public MIDIDriver {
Expand Down
4 changes: 2 additions & 2 deletions modules/mono/utils/osx_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@

#include "core/string/print_string.h"

#include <CoreFoundation/CoreFoundation.h>
#include <CoreServices/CoreServices.h>
#import <CoreFoundation/CoreFoundation.h>
#import <CoreServices/CoreServices.h>

bool osx_is_app_bundle_installed(const String &p_bundle_id) {
CFStringRef bundle_id = CFStringCreateWithCString(nullptr, p_bundle_id.utf8(), kCFStringEncodingUTF8);
Expand Down
6 changes: 5 additions & 1 deletion platform/iphone/tts_ios.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@
#ifndef TTS_IOS_H
#define TTS_IOS_H

#include <AVFAudio/AVSpeechSynthesis.h>
#if __has_include(<AVFAudio/AVSpeechSynthesis.h>)
#import <AVFAudio/AVSpeechSynthesis.h>
#else
#import <AVFoundation/AVFoundation.h>
#endif

#include "core/string/ustring.h"
#include "core/templates/list.h"
Expand Down
4 changes: 2 additions & 2 deletions platform/osx/dir_access_osx.mm
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@

#include <errno.h>

#include <AppKit/NSWorkspace.h>
#include <Foundation/Foundation.h>
#import <AppKit/NSWorkspace.h>
#import <Foundation/Foundation.h>

String DirAccessOSX::fix_unicode_name(const char *p_name) const {
String fname;
Expand Down
9 changes: 5 additions & 4 deletions platform/osx/display_server_osx.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@
#include "platform/osx/vulkan_context_osx.h"
#endif // VULKAN_ENABLED

#include <AppKit/AppKit.h>
#include <AppKit/NSCursor.h>
#include <ApplicationServices/ApplicationServices.h>
#include <CoreVideo/CoreVideo.h>
#import <AppKit/AppKit.h>
#import <AppKit/NSCursor.h>
#import <ApplicationServices/ApplicationServices.h>
#import <CoreVideo/CoreVideo.h>
#import <Foundation/Foundation.h>

#undef BitMap
#undef CursorShape
Expand Down
38 changes: 19 additions & 19 deletions platform/osx/display_server_osx.mm
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@
#include "main/main.h"
#include "scene/resources/texture.h"

#include <Carbon/Carbon.h>
#include <Cocoa/Cocoa.h>
#include <IOKit/IOCFPlugIn.h>
#include <IOKit/IOKitLib.h>
#include <IOKit/hid/IOHIDKeys.h>
#include <IOKit/hid/IOHIDLib.h>
#import <Carbon/Carbon.h>
#import <Cocoa/Cocoa.h>
#import <IOKit/IOCFPlugIn.h>
#import <IOKit/IOKitLib.h>
#import <IOKit/hid/IOHIDKeys.h>
#import <IOKit/hid/IOHIDLib.h>

#if defined(GLES3_ENABLED)
#include "drivers/gles3/rasterizer_gles3.h"
Expand Down Expand Up @@ -146,7 +146,7 @@
[wd.window_object setTabbingMode:NSWindowTabbingModeDisallowed];
}

CALayer *layer = [wd.window_view layer];
CALayer *layer = [(NSView *)wd.window_view layer];
if (layer) {
layer.contentsScale = scale;
}
Expand Down Expand Up @@ -174,7 +174,7 @@
wd.size.width = contentRect.size.width * scale;
wd.size.height = contentRect.size.height * scale;

CALayer *layer = [wd.window_view layer];
CALayer *layer = [(NSView *)wd.window_view layer];
if (layer) {
layer.contentsScale = scale;
}
Expand Down Expand Up @@ -209,16 +209,16 @@

if (borderless_full) {
// If the window covers up the screen set the level to above the main menu and hide on deactivate.
[p_wd.window_object setLevel:NSMainMenuWindowLevel + 1];
[p_wd.window_object setHidesOnDeactivate:YES];
[(NSWindow *)p_wd.window_object setLevel:NSMainMenuWindowLevel + 1];
[(NSWindow *)p_wd.window_object setHidesOnDeactivate:YES];
} else {
// Reset these when our window is not a borderless window that covers up the screen.
if (p_wd.on_top && !p_wd.fullscreen) {
[p_wd.window_object setLevel:NSFloatingWindowLevel];
[(NSWindow *)p_wd.window_object setLevel:NSFloatingWindowLevel];
} else {
[p_wd.window_object setLevel:NSNormalWindowLevel];
[(NSWindow *)p_wd.window_object setLevel:NSNormalWindowLevel];
}
[p_wd.window_object setHidesOnDeactivate:NO];
[(NSWindow *)p_wd.window_object setHidesOnDeactivate:NO];
}
}

Expand All @@ -234,7 +234,7 @@
[wd.window_object setBackgroundColor:[NSColor clearColor]];
[wd.window_object setOpaque:NO];
[wd.window_object setHasShadow:NO];
CALayer *layer = [wd.window_view layer];
CALayer *layer = [(NSView *)wd.window_view layer];
if (layer) {
[layer setBackgroundColor:[NSColor clearColor].CGColor];
[layer setOpaque:NO];
Expand All @@ -249,7 +249,7 @@
[wd.window_object setBackgroundColor:[NSColor colorWithCalibratedWhite:1 alpha:1]];
[wd.window_object setOpaque:YES];
[wd.window_object setHasShadow:YES];
CALayer *layer = [wd.window_view layer];
CALayer *layer = [(NSView *)wd.window_view layer];
if (layer) {
[layer setBackgroundColor:[NSColor colorWithCalibratedWhite:1 alpha:1].CGColor];
[layer setOpaque:YES];
Expand Down Expand Up @@ -2256,7 +2256,7 @@
} break;
case WINDOW_MODE_EXCLUSIVE_FULLSCREEN:
case WINDOW_MODE_FULLSCREEN: {
[wd.window_object setLevel:NSNormalWindowLevel];
[(NSWindow *)wd.window_object setLevel:NSNormalWindowLevel];
_set_window_per_pixel_transparency_enabled(true, p_window);
if (wd.resize_disabled) { // Restore resize disabled.
[wd.window_object setStyleMask:[wd.window_object styleMask] & ~NSWindowStyleMaskResizable];
Expand Down Expand Up @@ -2380,9 +2380,9 @@
return;
}
if (p_enabled) {
[wd.window_object setLevel:NSFloatingWindowLevel];
[(NSWindow *)wd.window_object setLevel:NSFloatingWindowLevel];
} else {
[wd.window_object setLevel:NSNormalWindowLevel];
[(NSWindow *)wd.window_object setLevel:NSNormalWindowLevel];
}
} break;
case WINDOW_FLAG_TRANSPARENT: {
Expand Down Expand Up @@ -2423,7 +2423,7 @@
if (wd.fullscreen) {
return wd.on_top;
} else {
return [wd.window_object level] == NSFloatingWindowLevel;
return [(NSWindow *)wd.window_object level] == NSFloatingWindowLevel;
}
} break;
case WINDOW_FLAG_TRANSPARENT: {
Expand Down
6 changes: 3 additions & 3 deletions platform/osx/gl_manager_osx_legacy.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
#include "core/templates/local_vector.h"
#include "servers/display_server.h"

#include <AppKit/AppKit.h>
#include <ApplicationServices/ApplicationServices.h>
#include <CoreVideo/CoreVideo.h>
#import <AppKit/AppKit.h>
#import <ApplicationServices/ApplicationServices.h>
#import <CoreVideo/CoreVideo.h>

class GLManager_OSX {
public:
Expand Down
10 changes: 5 additions & 5 deletions platform/osx/joypad_osx.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
#define JOYPADOSX_H

#ifdef MACOS_10_0_4
#include <IOKit/hidsystem/IOHIDUsageTables.h>
#import <IOKit/hidsystem/IOHIDUsageTables.h>
#else
#include <Kernel/IOKit/hidsystem/IOHIDUsageTables.h>
#import <Kernel/IOKit/hidsystem/IOHIDUsageTables.h>
#endif
#include <ForceFeedback/ForceFeedback.h>
#include <ForceFeedback/ForceFeedbackConstants.h>
#include <IOKit/hid/IOHIDLib.h>
#import <ForceFeedback/ForceFeedback.h>
#import <ForceFeedback/ForceFeedbackConstants.h>
#import <IOKit/hid/IOHIDLib.h>

#include "core/input/input.h"

Expand Down
4 changes: 2 additions & 2 deletions platform/osx/key_mapping_osx.mm
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

#include "key_mapping_osx.h"

#include <Carbon/Carbon.h>
#include <Cocoa/Cocoa.h>
#import <Carbon/Carbon.h>
#import <Cocoa/Cocoa.h>

bool KeyMappingOSX::is_numpad_key(unsigned int key) {
static const unsigned int table[] = {
Expand Down
9 changes: 7 additions & 2 deletions platform/osx/tts_osx.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@
#include "core/variant/array.h"
#include "servers/display_server.h"

#include <AVFAudio/AVSpeechSynthesis.h>
#include <AppKit/AppKit.h>
#import <AppKit/AppKit.h>

#if __has_include(<AVFAudio/AVSpeechSynthesis.h>)
#import <AVFAudio/AVSpeechSynthesis.h>
#else
#import <AVFoundation/AVFoundation.h>
#endif

@interface TTS_OSX : NSObject <AVSpeechSynthesizerDelegate> {
// AVSpeechSynthesizer
Expand Down
2 changes: 1 addition & 1 deletion platform/osx/vulkan_context_osx.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#define VULKAN_DEVICE_OSX_H

#include "drivers/vulkan/vulkan_context.h"
#include <AppKit/AppKit.h>
#import <AppKit/AppKit.h>

class VulkanContextOSX : public VulkanContext {
virtual const char *_get_platform_surface_extension() const;
Expand Down

0 comments on commit 917fd65

Please sign in to comment.