Skip to content

Commit

Permalink
iosvlc: add support for visionOS
Browse files Browse the repository at this point in the history
This enables the pinch gesture and solves a problem with UIScreen being
unavailable on this platform
  • Loading branch information
fkuehne authored and robUx4 committed Jun 3, 2024
1 parent c27a4b9 commit fd6fa7a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,10 @@ if HAVE_TVOS
noinst_PROGRAMS += vlccoreios
endif

if HAVE_XROS
noinst_PROGRAMS += vlccoreios
endif

vlc_window_SOURCES = vlc-window.c
vlc_window_CPPFLAGS = $(AM_CPPFLAGS) -I../include/
vlc_window_LDADD = ../lib/libvlc.la ../src/libvlccore.la ../compat/libcompat.la
Expand Down
11 changes: 8 additions & 3 deletions test/iosvlc.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ @interface AppDelegate : UIResponder <UIApplicationDelegate> {
UIWindow *window;
UIView *subview;

#if TARGET_OS_IOS
#if !TARGET_OS_TV
UIPinchGestureRecognizer *_pinchRecognizer;
#endif

Expand All @@ -58,7 +58,7 @@ @interface AppDelegate : UIResponder <UIApplicationDelegate> {


@implementation AppDelegate
#if TARGET_OS_IOS
#if !TARGET_OS_TV
- (void)pinchRecognized:(UIPinchGestureRecognizer *)pinchRecognizer
{
UIGestureRecognizerState state = [pinchRecognizer state];
Expand Down Expand Up @@ -113,7 +113,12 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
return NO;

/* Initialize main window */
#if TARGET_OS_VISION
/* UIScreen is unavailable so we need create a size on our own */
window = [[UIWindow alloc] initWithFrame:CGRectMake(0., 0., 1200., 800.)];
#else
window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
#endif
window.rootViewController = [[UIViewController alloc] init];
window.backgroundColor = [UIColor whiteColor];

Expand All @@ -122,7 +127,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[window addSubview:subview];
[window makeKeyAndVisible];

#if TARGET_OS_IOS
#if !TARGET_OS_TV
_pinchRecognizer = [[UIPinchGestureRecognizer alloc]
initWithTarget:self action:@selector(pinchRecognized:)];
[window addGestureRecognizer:_pinchRecognizer];
Expand Down

0 comments on commit fd6fa7a

Please sign in to comment.