Skip to content

Commit 7dc9ff8

Browse files
committed
Fixes/revert x11 popup changes (#14573)
* Revert "Fix popups position on X11 (#14551)" This reverts commit 06f88f6. * Revert "Use popupParent as X11 parent window (#14366)" This reverts commit 0bde86b.
1 parent b1670ab commit 7dc9ff8

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/Avalonia.X11/X11Window.cs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ internal unsafe partial class X11Window : IWindowImpl, IPopupImpl, IXI2Client
5151
private PixelSize _realSize;
5252
private bool _cleaningUp;
5353
private IntPtr _handle;
54-
private IntPtr _parentHandle;
5554
private IntPtr _xic;
5655
private IntPtr _renderHandle;
5756
private IntPtr _xSyncCounter;
@@ -83,7 +82,6 @@ public X11Window(AvaloniaX11Platform platform, IWindowImpl? popupParent, bool ov
8382
_mouse = new MouseDevice();
8483
_touch = new TouchDevice();
8584
_keyboard = platform.KeyboardDevice;
86-
_parentHandle = popupParent != null ? ((X11Window)popupParent)._handle : _x11.RootWindow;
8785

8886
var glfeature = AvaloniaLocator.Current.GetService<IPlatformGraphics>();
8987
XSetWindowAttributes attr = new XSetWindowAttributes();
@@ -121,7 +119,7 @@ public X11Window(AvaloniaX11Platform platform, IWindowImpl? popupParent, bool ov
121119
{
122120
visual = visualInfo.Value.visual;
123121
depth = (int)visualInfo.Value.depth;
124-
attr.colormap = XCreateColormap(_x11.Display, _parentHandle, visualInfo.Value.visual, 0);
122+
attr.colormap = XCreateColormap(_x11.Display, _x11.RootWindow, visualInfo.Value.visual, 0);
125123
valueMask |= SetWindowValuemask.ColorMap;
126124
}
127125

@@ -144,7 +142,7 @@ public X11Window(AvaloniaX11Platform platform, IWindowImpl? popupParent, bool ov
144142
defaultWidth = Math.Max(defaultWidth, 300);
145143
defaultHeight = Math.Max(defaultHeight, 200);
146144

147-
_handle = XCreateWindow(_x11.Display, _parentHandle, 10, 10, defaultWidth, defaultHeight, 0,
145+
_handle = XCreateWindow(_x11.Display, _x11.RootWindow, 10, 10, defaultWidth, defaultHeight, 0,
148146
depth,
149147
(int)CreateWindowArgs.InputOutput,
150148
visual,
@@ -502,7 +500,7 @@ private void OnEvent(ref XEvent ev)
502500
_configurePoint = new PixelPoint(ev.ConfigureEvent.x, ev.ConfigureEvent.y);
503501
else
504502
{
505-
XTranslateCoordinates(_x11.Display, _handle, _parentHandle,
503+
XTranslateCoordinates(_x11.Display, _handle, _x11.RootWindow,
506504
0, 0,
507505
out var tx, out var ty, out _);
508506
_configurePoint = new PixelPoint(tx, ty);
@@ -1071,12 +1069,10 @@ public PixelPoint Position
10711069
UpdateSizeHints(null);
10721070
}
10731071

1074-
XTranslateCoordinates(_x11.Display, _parentHandle, _x11.RootWindow, 0, 0, out var wx, out var wy, out _);
1075-
10761072
var changes = new XWindowChanges
10771073
{
1078-
x = value.X - wx,
1079-
y = (int)value.Y - wy
1074+
x = value.X,
1075+
y = (int)value.Y
10801076
};
10811077

10821078
XConfigureWindow(_x11.Display, _handle, ChangeWindowFlags.CWX | ChangeWindowFlags.CWY,
@@ -1137,7 +1133,7 @@ private void SendNetWMMessage(IntPtr message_type, IntPtr l0,
11371133
}
11381134
};
11391135
xev.ClientMessageEvent.ptr4 = l4 ?? IntPtr.Zero;
1140-
XSendEvent(_x11.Display, _parentHandle, false,
1136+
XSendEvent(_x11.Display, _x11.RootWindow, false,
11411137
new IntPtr((int)(EventMask.SubstructureRedirectMask | EventMask.SubstructureNotifyMask)), ref xev);
11421138

11431139
}

0 commit comments

Comments
 (0)