From fd6fa7ac1514821a96a34d455756ff5da1157702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= Date: Sun, 2 Jun 2024 11:26:02 +0200 Subject: [PATCH] iosvlc: add support for visionOS This enables the pinch gesture and solves a problem with UIScreen being unavailable on this platform --- test/Makefile.am | 4 ++++ test/iosvlc.m | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/test/Makefile.am b/test/Makefile.am index f9aaf97116..6737ab2afe 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -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 diff --git a/test/iosvlc.m b/test/iosvlc.m index 0505ebb965..e74900af92 100644 --- a/test/iosvlc.m +++ b/test/iosvlc.m @@ -46,7 +46,7 @@ UIWindow *window; UIView *subview; -#if TARGET_OS_IOS +#if !TARGET_OS_TV UIPinchGestureRecognizer *_pinchRecognizer; #endif @@ -58,7 +58,7 @@ @implementation AppDelegate -#if TARGET_OS_IOS +#if !TARGET_OS_TV - (void)pinchRecognized:(UIPinchGestureRecognizer *)pinchRecognizer { UIGestureRecognizerState state = [pinchRecognizer state]; @@ -113,7 +113,12 @@ 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]; @@ -122,7 +127,7 @@ [window addSubview:subview]; [window makeKeyAndVisible]; -#if TARGET_OS_IOS +#if !TARGET_OS_TV _pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinchRecognized:)]; [window addGestureRecognizer:_pinchRecognizer];