Skip to content

Commit b7066af

Browse files
kekekeksmaxkatz6
authored andcommitted
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 556696f commit b7066af

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
@@ -53,7 +53,6 @@ internal unsafe partial class X11Window : IWindowImpl, IPopupImpl, IXI2Client
5353
private PixelSize _realSize;
5454
private bool _cleaningUp;
5555
private IntPtr _handle;
56-
private IntPtr _parentHandle;
5756
private IntPtr _xic;
5857
private IntPtr _renderHandle;
5958
private IntPtr _xSyncCounter;
@@ -85,7 +84,6 @@ public X11Window(AvaloniaX11Platform platform, IWindowImpl? popupParent, bool ov
8584
_mouse = new MouseDevice();
8685
_touch = new TouchDevice();
8786
_keyboard = platform.KeyboardDevice;
88-
_parentHandle = popupParent != null ? ((X11Window)popupParent)._handle : _x11.RootWindow;
8987

9088
var glfeature = AvaloniaLocator.Current.GetService<IPlatformGraphics>();
9189
XSetWindowAttributes attr = new XSetWindowAttributes();
@@ -123,7 +121,7 @@ public X11Window(AvaloniaX11Platform platform, IWindowImpl? popupParent, bool ov
123121
{
124122
visual = visualInfo.Value.visual;
125123
depth = (int)visualInfo.Value.depth;
126-
attr.colormap = XCreateColormap(_x11.Display, _parentHandle, visualInfo.Value.visual, 0);
124+
attr.colormap = XCreateColormap(_x11.Display, _x11.RootWindow, visualInfo.Value.visual, 0);
127125
valueMask |= SetWindowValuemask.ColorMap;
128126
}
129127

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

149-
_handle = XCreateWindow(_x11.Display, _parentHandle, 10, 10, defaultWidth, defaultHeight, 0,
147+
_handle = XCreateWindow(_x11.Display, _x11.RootWindow, 10, 10, defaultWidth, defaultHeight, 0,
150148
depth,
151149
(int)CreateWindowArgs.InputOutput,
152150
visual,
@@ -517,7 +515,7 @@ private void OnEvent(ref XEvent ev)
517515
_configurePoint = new PixelPoint(ev.ConfigureEvent.x, ev.ConfigureEvent.y);
518516
else
519517
{
520-
XTranslateCoordinates(_x11.Display, _handle, _parentHandle,
518+
XTranslateCoordinates(_x11.Display, _handle, _x11.RootWindow,
521519
0, 0,
522520
out var tx, out var ty, out _);
523521
_configurePoint = new PixelPoint(tx, ty);
@@ -1100,12 +1098,10 @@ public PixelPoint Position
11001098
UpdateSizeHints(null);
11011099
}
11021100

1103-
XTranslateCoordinates(_x11.Display, _parentHandle, _x11.RootWindow, 0, 0, out var wx, out var wy, out _);
1104-
11051101
var changes = new XWindowChanges
11061102
{
1107-
x = value.X - wx,
1108-
y = (int)value.Y - wy
1103+
x = value.X,
1104+
y = (int)value.Y
11091105
};
11101106

11111107
XConfigureWindow(_x11.Display, _handle, ChangeWindowFlags.CWX | ChangeWindowFlags.CWY,
@@ -1168,7 +1164,7 @@ private void SendNetWMMessage(IntPtr message_type, IntPtr l0,
11681164
}
11691165
};
11701166
xev.ClientMessageEvent.ptr4 = l4 ?? IntPtr.Zero;
1171-
XSendEvent(_x11.Display, _parentHandle, false,
1167+
XSendEvent(_x11.Display, _x11.RootWindow, false,
11721168
new IntPtr((int)(EventMask.SubstructureRedirectMask | EventMask.SubstructureNotifyMask)), ref xev);
11731169

11741170
}

0 commit comments

Comments
 (0)