Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Locking the cursor doesn't work on iPhone (iOS limitation?) #2

Open
tnmendes opened this issue Jul 27, 2021 · 10 comments
Open

Locking the cursor doesn't work on iPhone (iOS limitation?) #2

tnmendes opened this issue Jul 27, 2021 · 10 comments

Comments

@tnmendes
Copy link

Wowww....this project really worked well on iPadOS + external screen Kudos to you :D

I changed the priorities to work also with iPhone but that didn't work do you have any "hack" to have this working with iPhone?

Thanks in advance!!!

conath added a commit that referenced this issue Aug 1, 2021
This adds the iPhone family to target devices for the app in Xcode, and removes the "iPad" mention in the UI.
Note that Apple does not offer official pointer support on iPhone, so mice must be paired through Accessibility settings. See #2 for more discussion of the topic. iPad will remain the primary targeted device for this project.
@conath conath changed the title how to make this work iPhone How to make this work on iPhone Aug 1, 2021
@conath
Copy link
Owner

conath commented Aug 1, 2021

Hi @tnmendes, thanks for your kind feedback and the suggestion to make it work on iPhone. I have tested the project on my iPhone 11 by connecting a bluetooth mouse. It works fine, however getting to this point is tricky.

Apple doesn't support connecting mice to iPhone, so when you try to pair a mouse with Bluetooth settings, the mouse might not show up in the list of available devices to pair with. Additionally, there is no system-level cursor available on iPhone.

To work around the Bluetooth settings not showing a mouse you can go to Accessibility settings => Switch Control => Switches => Bluetooth devices… and pair the mouse there. (in the past this has also worked for Magic Mouse however mine didn't show up in there, either)

Since I couldn't get my Magic Mouse 2 connected to my iPhone, I used my Logitech MX Master 2S instead. Here's a brief video showing the cursor moving from iPhone to external display.

iPhoneCursorToExternal.MOV

I have updated the project to build for iPhone and am therefore closing this issue. If you have any further suggestions, please do let me know.

@conath conath closed this as completed Aug 1, 2021
@tnmendes
Copy link
Author

tnmendes commented Aug 1, 2021

Hey @conath thank you for your answer.
I downloaded your latest version of the project. My iPhone behaves differently than yours (iOS 14.7)

You can check it out here: (its connect via dongle to screen)
https://youtu.be/uGG-oprSNlo

As you can see the app never changed the cursor

But if open your project without being connect to external screen this is what happen:
https://youtu.be/TdjRHo-ouOA

As you can see the mouse curser is in one location and the real mouse circle is one other location it's really strange the different behaviors.

@conath
Copy link
Owner

conath commented Aug 1, 2021

In the video I can see that you are using the AssistiveTouch cursor. Please try disabling that. It could be preventing the cursor from getting locked. (the bottom of the two switches indicates the locked state which is required “on” for moving the cursor to the external display)

@tnmendes
Copy link
Author

tnmendes commented Aug 2, 2021

I had the idea that it was mandatory to have the AssistiveTouch on for the mouse to work.
I disable the AssistiveTouch

https://youtu.be/OiJMLc91y6Q

Using the external screen the same thing happens but using just the app without an external screen I can now use the mouse pointer to click on the button.

I think that I have some configuration causing the issue of the behavior being different from yours. Can you have a look at this print screen to check if are equal to yours?

IMG_5305
IMG_5304
IMG_5303
IMG_5301
IMG_5300
IMG_5302

@conath
Copy link
Owner

conath commented Aug 2, 2021

I have the same settings, both Assistive Touch and Switch Control are off. The difference was that I didn’t get the iOS cursor at all on my iPhone - turns out I had somehow managed to turn it invisible using various other settings.

Anyway, all of this to say that I have no idea why it’s not locking the cursor on iPhone. According to Apple Documentation, it is supported on iOS. https://developer.apple.com/documentation/uikit/uiviewcontroller/3601235-preferspointerlocked/

@conath conath reopened this Aug 2, 2021
@conath
Copy link
Owner

conath commented Aug 2, 2021

However, in the WWDC20 talk where it was introduced, the pointer locking feature was only demoed and mentioned in connection with iPadOS. https://developer.apple.com/videos/play/wwdc2020/10617/

@tnmendes
Copy link
Author

tnmendes commented Aug 4, 2021

September is coming soon, it may be that iOS 15 has new features for iPhones regarding support for mouse 🙏

@conath conath changed the title How to make this work on iPhone Locking the cursor doesn't work on iPhone (iOS limitation) Aug 4, 2021
@conath conath changed the title Locking the cursor doesn't work on iPhone (iOS limitation) Locking the cursor doesn't work on iPhone (iOS limitation?) Aug 4, 2021
@tnmendes
Copy link
Author

tnmendes commented Aug 4, 2021

After all, I have new updates! I am not sure what I did, maybe was the reboot of the phone but now it's working as you have on your phone.

I can't see the assistance circle but I know it's there. In the video you can see that I have the mouse a little more to the left of the button but when I click it works so it's the circle that is there.

https://youtu.be/tCGOzmSLVnk

@conath
Copy link
Owner

conath commented Aug 4, 2021

We may have found an iOS bug where the cursor goes invisible. ¯_(ツ)_/¯

@omerien
Copy link

omerien commented Jul 14, 2022

I'm finding that a year after, and a long time ago with a USB to lightning cable I connected a mouse and the mouse was invisible, yet it worked.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants