I'm trying to implement a wrapper around a modified VNC viewer applet (VNC = a remote display protocol) to provide an enhanced user experience (using javascript) but have run into problems with handling rotation.
The width/height of the applet are fixed (1) - so when the user rotates the device, the applet overlows the screen or is resized:
+------------+ +-------+ +-------+
|............| |.......|... |.......|
|. X.| |. | X. or |. x.|
|. .| > |. | . |.......|
|............| |.......|... | |
+------------+ | | | |
| | | |
+-------+ :( +-------+ :(
But I want....
+------------+ +-------+
|............| |.......|
|. X.| |. .|
|. .| > |. .|
|............| |. .|
+------------+ |. X.|
|.......|
+-------+ :)
While I can detect the autorotation from the change in screen dimenions in javascript, and, if it were written in Java, I could suppress the autorotation, neither of these achieves my desired result: specifically, that
- the orientation of the display would not change when the device is rotated
- that my javascript would detect that device has been rotated and re-orient the content of the applet (by sending an OOB message to run xrandr at the vncserver).
I'm not totally averse to implementing the detection of rotation as a seperate applet exposed to the javascript / implementing the page via a webview but would prefer no to.
Is it possible to lock the orientation in a html app manifest file?
Is it possible to detect rotation using javascript when the orientation is locked?
Is there another way to solve this?
1 - this is a limitation of the underlying protocol, I'm already making changes to the Java applet, I don't really want to have to rewrite the server too!
Update
I'm aware that most versions of VNC (inclucding noVNC) have a problem with xrandr.
If someone can tell me how to suppress the automatic re-orientation of a browser page (without using an applet with a webview) that at least givers me part of the answer.