Skip to content

Commit a5e4af2

Browse files
authored
FIX: Fixed control scheme popup window in input action asset editor window showing in the correct screen position on windows. (#833)
1 parent fdd6ea1 commit a5e4af2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ however, it has to be formatted properly to pass verification tests.
1212
### Fixed
1313

1414
- Exceptions in scenes of `Visualizers` sample if respective device was not present on system (e.g. in `PenVisualizer` if no pen was present in system).
15+
- Fixed control scheme popup window in input action asset editor window showing in the correct screen position on windows.
1516

1617
#### Actions
1718

Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorToolbar.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ private void DrawSchemeSelection()
4949

5050
if (GUI.Button(buttonRect, buttonGUI, EditorStyles.toolbarPopup))
5151
{
52-
buttonRect = new Rect(EditorGUIUtility.GUIToScreenPoint(new Vector2(buttonRect.x, buttonRect.y)), Vector2.zero);
52+
// PopupWindow.Show already takes the current OnGUI EditorWindow context into account for window coordinates.
53+
// However, on macOS, menu commands are performed asynchronously, so we don't have a current OnGUI context.
54+
// So in that case, we need to translate the rect to screen coordinates. Don't do that on windows, as we will
55+
// overcompensate otherwise.
56+
if (Application.platform == RuntimePlatform.OSXEditor)
57+
buttonRect = new Rect(EditorGUIUtility.GUIToScreenPoint(new Vector2(buttonRect.x, buttonRect.y)), Vector2.zero);
58+
5359
var menu = new GenericMenu();
5460

5561
// Add entries to select control scheme, if we have some.

0 commit comments

Comments
 (0)