Issue Description:
I am trying to right align an in game window to the game window, but sometimes it will not be aligned properly when changePosition
is called. Either it will be too far left (there’s a gap between the border and the in game window)
or it’s too far right and the the in game window is cut off. Most of the time though it works and the window is right aligned.
I am getting the in game window’s width with obtainDeclaredWindow()
and the game’s logical width with getRunningGameInfo()
and storing them in the component state windowWidth
and gameLogicalWidth
. These two values are used in changePosition()
to calculate the left
value by doing gameLogicalWidth - windowWidth
. changePosition()
will be called whenever gameLogicalWidth
or windowWidth
changes.
The gameLogicalWidth
is updated when the game resolution changes (through GameInfoUpdatedEvent
event) or when the onGameLaunched
event occurs.
The portion of the manifest.json for the window is below.
"notification": {
"file": "index.html",
"clickthrough": true,
"in_game_only": true,
"keep_window_location": true,
"transparent": true,
"override_on_update": true,
"size": {
"width": 330,
"height": 300
},
"min_size": {
"width": 330,
"height": 300
},
"max_size": {
"width": 330,
"height": 300
},
"start_position": {
"top": 50,
"left": 90000
},
"block_top_window_navigation": true,
"restrict_to_game_bounds": true
}
Can you reproduce it (exact steps to reproduce):
This doesn’t always happen so I can’t pinpoint what’s causing the issue. I’ll list the cases where I see this happening.
- sometimes happens when resolution is changed through in game menu (not all resolutions has this behaviour)
- open Osu! in window mode with app started.
- lower the resolution through the in game menu.
- results in the menu being partially shifted out of the game window (to the right)
- sometimes happens when on app launch when switching games
- run game in windowed mode and have the app running
- close the game and start a different game (I was switching from Osu! to Hearthstone both in windows mode)
- the in game window is sometimes shifted left or right.
- Sometimes happens when changing resolution by dragging edge of game window
- open Hearthstone in window mode
- drag the border to change the resolution of the game
- in a few cases the in game window will not be position by the game’s right edge.
- I have the
onGameInfoUpdated
callback function debounced by 500ms which seems to help, but doesn’t eliminate the issue.
- I have the
Impact for my app: Blocks new features
Do you currently have a workaround?
No. I can trigger another resolution change while testing which usually realigns the in game window, but it is not something we can expect a user to do.
Additional Info:
My Window scaling is set to 1.25x since I am on a laptop. This info may or may not be useful.
Please reproduce and attach a zip package of your OW client logs
Happens around 3PM on April 5, 2021. I launch Hearthstone and the in game window is shifted to the left leaving a gap between the window and the game border.
changePosition_problem_OverwolfLogs_2021-04-05_15-02-41.zip (1.3 MB)