{"record":{"id":"d7ac3f4a5932744f","repo":"stride3d/stride","slug":"current-platform-doesn-t-let-you-set-the-position-of-the","errorCode":null,"errorMessage":"Current platform doesn't let you set the position of the mouse cursor.","messagePattern":"Current platform doesn't let you set the position of the mouse cursor\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Graphics/SDL/Application.cs","lineNumber":68,"sourceCode":"        /// </summary>\n        public static Window WindowWithFocus { get; private set; }\n\n        /// <summary>\n        /// Screen coordinate of the mouse.\n        /// </summary>\n        public static Point MousePosition\n        {\n            get\n            {\n                int x, y;\n                SDL.GetGlobalMouseState(&x, &y);\n                return new Point(x, y);\n            }\n            set\n            {\n                int err = SDL.WarpMouseGlobal(value.X, value.Y);\n                if (err != 0)\n                    throw new NotSupportedException(\"Current platform doesn't let you set the position of the mouse cursor.\");\n            }\n        }\n\n        /// <summary>\n        /// List of windows managed by the application.\n        /// </summary>\n        public static List<Window> Windows\n        {\n            get\n            {\n                lock (InternalWindows)\n                {\n                    var res = new List<Window>(InternalWindows.Count);\n                    List<IntPtr> toRemove = null;\n                    foreach (var weakRef in InternalWindows)\n                    {\n                        Window ctrl;\n                        if (weakRef.Value.TryGetTarget(out ctrl))","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Graphics/SDL/Application.cs#L50-L86","documentation":"The SDL Application's MousePosition setter calls SDL.WarpMouseGlobal and throws NotSupportedException when SDL returns a non-zero error, i.e. the current platform/SDL build does not support warping the global mouse cursor position.","triggerScenarios":"Setting Application.MousePosition on a platform where SDL.WarpMouseGlobal fails (returns != 0), such as Wayland or other backends without global cursor control.","commonSituations":"Running a Stride app under Wayland where global pointer warp is disallowed by the compositor, or on platforms whose SDL video driver lacks warp support.","solutions":["Avoid setting MousePosition on unsupported platforms; wrap in a platform capability check","Run under X11 (or a session that supports global cursor warping) instead of Wayland","Use window-relative SDL.WarpMouseInWindow if global positioning is not required"],"exampleFix":"// before\napp.MousePosition = new Point(x, y);\n// after\ntry { app.MousePosition = new Point(x, y); }\ncatch (NotSupportedException) { /* platform does not support global warp */ }","handlingStrategy":"try-catch","validationCode":"// On Wayland or unsupported backends, skip global warp\nbool canWarp = Environment.GetEnvironmentVariable(\"WAYLAND_DISPLAY\") == null;","typeGuard":null,"tryCatchPattern":"try { app.MousePosition = p; } catch (NotSupportedException) { /* fall back to window-relative warp */ }","preventionTips":["Check platform capabilities before setting MousePosition","Prefer window-relative mouse control when global warp is unnecessary"],"tags":["sdl","mouse","platform"],"backgroundTag":"unsupported-platform","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}