From 0bde86b4577fbf2580dbffc3892de2e06e74b95d Mon Sep 17 00:00:00 2001 From: Mary Guillemard Date: Mon, 29 Jan 2024 10:19:31 +0100 Subject: [PATCH] Use popupParent as X11 parent window (#14366) Previously, the popupParent was ignored when present causing popups to have the X root window as its parent. This cause issues on gamescope (SteamOS session compositor) where that window would end up behind the main window. Signed-off-by: Mary Guillemard Co-authored-by: Max Katz --- src/Avalonia.X11/X11Window.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.X11/X11Window.cs b/src/Avalonia.X11/X11Window.cs index f4e3be29c4..fc15a05e3e 100644 --- a/src/Avalonia.X11/X11Window.cs +++ b/src/Avalonia.X11/X11Window.cs @@ -142,7 +142,9 @@ namespace Avalonia.X11 defaultWidth = Math.Max(defaultWidth, 300); defaultHeight = Math.Max(defaultHeight, 200); - _handle = XCreateWindow(_x11.Display, _x11.RootWindow, 10, 10, defaultWidth, defaultHeight, 0, + var parentHandle = popupParent != null ? ((X11Window)popupParent)._handle : _x11.RootWindow; + + _handle = XCreateWindow(_x11.Display, parentHandle, 10, 10, defaultWidth, defaultHeight, 0, depth, (int)CreateWindowArgs.InputOutput, visual,