Skip to content

Commit 6217684

Browse files
committed
ios: minor factor to collapse redunant preprocessor macros
1 parent 575754d commit 6217684

4 files changed

Lines changed: 11 additions & 33 deletions

File tree

pkg/apple/BaseConfig.xcconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,12 @@ OTHER_CFLAGS[sdk=appletvsimulator*] = $(inherited) $(OTHER_CFLAGS_IOS_TVOS_SHARE
140140
OTHER_CFLAGS_IOS = $(inherited) -DHAVE_AVF
141141
OTHER_CFLAGS_IOS = $(inherited) -DHAVE_COREMIDI
142142
OTHER_CFLAGS_IOS = $(inherited) -DHAVE_COREMOTION
143-
OTHER_CFLAGS_IOS = $(inherited) -DHAVE_IOS_CUSTOMKEYBOARD
144143
OTHER_CFLAGS_IOS = $(inherited) -DHAVE_IOS_SWIFT
145-
OTHER_CFLAGS_IOS = $(inherited) -DHAVE_IOS_TOUCHMOUSE
146144
OTHER_CFLAGS_IOS = $(inherited) -DHAVE_MATERIALUI
147145

148146
OTHER_CFLAGS[sdk=iphoneos*] = $(inherited) $(OTHER_CFLAGS_IOS)
149147
OTHER_CFLAGS[sdk=iphonesimulator*] = $(inherited) $(OTHER_CFLAGS_IOS)
148+
OTHER_SWIFT_FLAGS[sdk=iphoneos*] = $(inherited) -D HAVE_IOS_SWIFT
150149

151150
OTHER_CFLAGS[config=Debug] = $(inherited) -DDEBUG=1
152151
OTHER_CFLAGS[config=Release] = $(inherited) -DNDEBUG -DNS_BLOCK_ASSERTIONS=1

pkg/apple/RetroArch-Bridging-Header.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,10 @@
66
#define HAVE_COCOATOUCH
77
#endif
88

9-
#ifndef HAVE_IOS_CUSTOMKEYBOARD
10-
#define HAVE_IOS_CUSTOMKEYBOARD
11-
#endif
12-
139
#ifndef HAVE_IOS_SWIFT
1410
#define HAVE_IOS_SWIFT
1511
#endif
1612

17-
#ifndef HAVE_IOS_TOUCHMOUSE
18-
#define HAVE_IOS_TOUCHMOUSE
19-
#endif
20-
2113
#include "libretro-common/include/libretro.h"
2214
#include "../../input/drivers_keyboard/keyboard_event_apple.h"
2315
#include "../../input/input_keymaps.h"

ui/drivers/cocoa/cocoa_common.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,30 +42,25 @@
4242
#define UIUserInterfaceIdiomCarPlay 3
4343
#endif
4444

45-
#if TARGET_OS_IOS
45+
#ifdef HAVE_IOS_SWIFT
4646
@class EmulatorKeyboardController;
47-
48-
#ifdef HAVE_IOS_TOUCHMOUSE
4947
@class EmulatorTouchMouseHandler;
5048
#endif
5149

50+
#if TARGET_OS_IOS
5251
@interface CocoaView : UIViewController
5352

5453
#elif TARGET_OS_TV
5554
@interface CocoaView : GCEventViewController
5655
#endif
5756

58-
#if TARGET_OS_IOS && defined(HAVE_IOS_CUSTOMKEYBOARD)
57+
#ifdef HAVE_IOS_SWIFT
5958
@property(nonatomic,strong) EmulatorKeyboardController *keyboardController;
6059
@property(nonatomic,assign) unsigned int keyboardModifierState;
6160
-(void)toggleCustomKeyboard;
62-
#endif
6361

64-
#if TARGET_OS_IOS && defined(HAVE_IOS_TOUCHMOUSE)
6562
@property(nonatomic,strong) EmulatorTouchMouseHandler *mouseHandler;
66-
#endif
6763

68-
#if defined(HAVE_IOS_SWIFT)
6964
@property(nonatomic,strong) UIView *helperBarView;
7065
#endif
7166

ui/drivers/cocoa/cocoa_common.m

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ extern bool RAIsVoiceOverRunning(void)
9191
void cocoa_file_load_with_detect_core(const char *filename);
9292

9393
@interface CocoaView()<GCDWebUploaderDelegate, UIGestureRecognizerDelegate
94-
#ifdef HAVE_IOS_TOUCHMOUSE
94+
#ifdef HAVE_IOS_SWIFT
9595
,EmulatorTouchMouseHandlerDelegate
9696
#endif
9797
#if TARGET_OS_IOS
@@ -539,7 +539,7 @@ -(void) showNativeMenu
539539
});
540540
}
541541

542-
#ifdef HAVE_IOS_CUSTOMKEYBOARD
542+
#ifdef HAVE_IOS_SWIFT
543543
-(void)toggleCustomKeyboardUsingSwipe:(id)sender {
544544
UISwipeGestureRecognizer *gestureRecognizer = (UISwipeGestureRecognizer*)sender;
545545
[self.keyboardController.view setHidden:gestureRecognizer.direction == UISwipeGestureRecognizerDirectionDown];
@@ -550,19 +550,17 @@ -(void)toggleCustomKeyboard {
550550
[self.keyboardController.view setHidden:!self.keyboardController.view.isHidden];
551551
[self updateOverlayAndFocus];
552552
}
553-
#endif
554553

555554
-(void) updateOverlayAndFocus
556555
{
557-
#ifdef HAVE_IOS_CUSTOMKEYBOARD
558556
int cmdData = self.keyboardController.view.isHidden ? 0 : 1;
559557
command_event(CMD_EVENT_GAME_FOCUS_TOGGLE, &cmdData);
560558
if (self.keyboardController.view.isHidden)
561559
command_event(CMD_EVENT_OVERLAY_INIT, NULL);
562560
else
563561
command_event(CMD_EVENT_OVERLAY_UNLOAD, NULL);
564-
#endif
565562
}
563+
#endif
566564

567565
-(BOOL)prefersHomeIndicatorAutoHidden { return YES; }
568566
-(void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
@@ -653,11 +651,9 @@ -(void)adjustViewFrameForSafeArea
653651
- (void)viewWillLayoutSubviews
654652
{
655653
[self adjustViewFrameForSafeArea];
656-
#ifdef HAVE_IOS_CUSTOMKEYBOARD
654+
#ifdef HAVE_IOS_SWIFT
657655
[self.view bringSubviewToFront:self.keyboardController.view];
658-
#endif
659-
#if HAVE_IOS_SWIFT
660-
[self.view bringSubviewToFront:self.helperBarView];
656+
[self.view bringSubviewToFront:self.helperBarView];
661657
#endif
662658
}
663659

@@ -716,11 +712,9 @@ -(void)viewDidLoad {
716712
swipe.delegate = self;
717713
swipe.direction = UISwipeGestureRecognizerDirectionDown;
718714
[self.view addGestureRecognizer:swipe];
719-
#ifdef HAVE_IOS_TOUCHMOUSE
715+
#ifdef HAVE_IOS_SWIFT
720716
if (@available(iOS 13, *))
721717
[self setupMouseSupport];
722-
#endif
723-
#ifdef HAVE_IOS_CUSTOMKEYBOARD
724718
if (@available(iOS 13, *))
725719
[self setupEmulatorKeyboard];
726720
UISwipeGestureRecognizer *showKeyboardSwipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(toggleCustomKeyboardUsingSwipe:)];
@@ -733,8 +727,6 @@ -(void)viewDidLoad {
733727
hideKeyboardSwipe.direction = UISwipeGestureRecognizerDirectionDown;
734728
hideKeyboardSwipe.delegate = self;
735729
[self.view addGestureRecognizer:hideKeyboardSwipe];
736-
#endif
737-
#if defined(HAVE_IOS_TOUCHMOUSE) || defined(HAVE_IOS_CUSTOMKEYBOARDS)
738730
if (@available(iOS 13, *))
739731
[self setupHelperBar];
740732
#endif
@@ -780,7 +772,7 @@ -(void)viewWillAppear:(BOOL)animated
780772
#endif
781773
}
782774

783-
#if TARGET_OS_IOS && HAVE_IOS_TOUCHMOUSE
775+
#ifdef HAVE_IOS_SWIFT
784776

785777
#pragma mark EmulatorTouchMouseHandlerDelegate
786778

0 commit comments

Comments
 (0)