Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/mobile/geom: Width and Height are not switched after device rotation on Android #10226

Closed
rakyll opened this issue Mar 23, 2015 · 2 comments
Closed

Comments

@rakyll
Copy link
Contributor

rakyll commented Mar 23, 2015

Steps to produce:

  1. Launch an app on Android.
  2. Print geom.Width and geom.Height. // prints 480pt and 360pt
  3. Rotate the screen and print Width and Height again.

Expected result: 360pt and 480pt
Actual result: 480pt and 360pt

@rakyll
Copy link
Contributor Author

rakyll commented Mar 25, 2015

A relevant issue is that we're not regenerating the GL display and surface after the orientation change. Android NDK seem to have a bug (or a feature) not to invoke onNativeWindowResized callback when device is rotated. onConfigurationChanged could have been alternative handler to resize the surface and call glViewport with the new width and height.

(Unlike onNativeWindowResized, onConfigurationChanged doesn't provide a reference to the current ANativeWindow object. Regenerating the display and the surface with the previous window reference may not work perfectly.)

@rakyll rakyll changed the title mobile/geom: Width and Height is not switched after rotation on Android mobile/geom: Width and Height are not switched after device rotation on Android Mar 27, 2015
@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title mobile/geom: Width and Height are not switched after device rotation on Android x/mobile/geom: Width and Height are not switched after device rotation on Android Apr 14, 2015
@rsc rsc modified the milestones: Unreleased, Unplanned Apr 14, 2015
@rsc rsc removed the repo-mobile label Apr 14, 2015
@gopherbot
Copy link

CL https://golang.org/cl/9708 mentions this issue.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 10, 2021
Config provides a way to concurrently access Width and Height.

Register provides a way for packages to run code on app state change
without plumbing changes all the way to the process main function.
This is motivated by gl/glutil.Image which needs to rebuild its
textures on start/stop and can be deeply nested.
(See golang.org/cl/9707 for the followup.)

Tested manually on android and darwin/amd64. Doing this kind makes it
clear any CL modifying this code needs a lot of manual testing right
now, so some kind of trybot support is something I'm going to
prioritise.

Fixes golang/go#10686
Fixes golang/go#10461
Fixes golang/go#10442
Fixes golang/go#10226
Updates golang/go#10327

Change-Id: I2882ebf3995b6ed857cda823e94fbb17c54b43a8
Reviewed-on: https://go-review.googlesource.com/9708
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 11, 2021
Config provides a way to concurrently access Width and Height.

Register provides a way for packages to run code on app state change
without plumbing changes all the way to the process main function.
This is motivated by gl/glutil.Image which needs to rebuild its
textures on start/stop and can be deeply nested.
(See golang.org/cl/9707 for the followup.)

Tested manually on android and darwin/amd64. Doing this kind makes it
clear any CL modifying this code needs a lot of manual testing right
now, so some kind of trybot support is something I'm going to
prioritise.

Fixes golang/go#10686
Fixes golang/go#10461
Fixes golang/go#10442
Fixes golang/go#10226
Updates golang/go#10327

Change-Id: I2882ebf3995b6ed857cda823e94fbb17c54b43a8
Reviewed-on: https://go-review.googlesource.com/9708
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants