@@ -53,7 +53,6 @@ internal unsafe partial class X11Window : IWindowImpl, IPopupImpl, IXI2Client
53
53
private PixelSize _realSize ;
54
54
private bool _cleaningUp ;
55
55
private IntPtr _handle ;
56
- private IntPtr _parentHandle ;
57
56
private IntPtr _xic ;
58
57
private IntPtr _renderHandle ;
59
58
private IntPtr _xSyncCounter ;
@@ -85,7 +84,6 @@ public X11Window(AvaloniaX11Platform platform, IWindowImpl? popupParent, bool ov
85
84
_mouse = new MouseDevice ( ) ;
86
85
_touch = new TouchDevice ( ) ;
87
86
_keyboard = platform . KeyboardDevice ;
88
- _parentHandle = popupParent != null ? ( ( X11Window ) popupParent ) . _handle : _x11 . RootWindow ;
89
87
90
88
var glfeature = AvaloniaLocator . Current . GetService < IPlatformGraphics > ( ) ;
91
89
XSetWindowAttributes attr = new XSetWindowAttributes ( ) ;
@@ -123,7 +121,7 @@ public X11Window(AvaloniaX11Platform platform, IWindowImpl? popupParent, bool ov
123
121
{
124
122
visual = visualInfo . Value . visual ;
125
123
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 ) ;
127
125
valueMask |= SetWindowValuemask . ColorMap ;
128
126
}
129
127
@@ -146,7 +144,9 @@ public X11Window(AvaloniaX11Platform platform, IWindowImpl? popupParent, bool ov
146
144
defaultWidth = Math . Max ( defaultWidth , 300 ) ;
147
145
defaultHeight = Math . Max ( defaultHeight , 200 ) ;
148
146
149
- _handle = XCreateWindow ( _x11 . Display , _parentHandle , 10 , 10 , defaultWidth , defaultHeight , 0 ,
147
+ var parentHandle = popupParent != null ? ( ( X11Window ) popupParent ) . _handle : _x11 . RootWindow ;
148
+
149
+ _handle = XCreateWindow ( _x11 . Display , parentHandle , 10 , 10 , defaultWidth , defaultHeight , 0 ,
150
150
depth ,
151
151
( int ) CreateWindowArgs . InputOutput ,
152
152
visual ,
@@ -517,7 +517,7 @@ private void OnEvent(ref XEvent ev)
517
517
_configurePoint = new PixelPoint ( ev . ConfigureEvent . x , ev . ConfigureEvent . y ) ;
518
518
else
519
519
{
520
- XTranslateCoordinates ( _x11 . Display , _handle , _parentHandle ,
520
+ XTranslateCoordinates ( _x11 . Display , _handle , _x11 . RootWindow ,
521
521
0 , 0 ,
522
522
out var tx , out var ty , out _ ) ;
523
523
_configurePoint = new PixelPoint ( tx , ty ) ;
@@ -1100,12 +1100,10 @@ public PixelPoint Position
1100
1100
UpdateSizeHints ( null ) ;
1101
1101
}
1102
1102
1103
- XTranslateCoordinates ( _x11 . Display , _parentHandle , _x11 . RootWindow , 0 , 0 , out var wx , out var wy , out _ ) ;
1104
-
1105
1103
var changes = new XWindowChanges
1106
1104
{
1107
- x = value . X - wx ,
1108
- y = ( int ) value . Y - wy
1105
+ x = value . X ,
1106
+ y = ( int ) value . Y
1109
1107
} ;
1110
1108
1111
1109
XConfigureWindow ( _x11 . Display , _handle , ChangeWindowFlags . CWX | ChangeWindowFlags . CWY ,
@@ -1168,7 +1166,7 @@ private void SendNetWMMessage(IntPtr message_type, IntPtr l0,
1168
1166
}
1169
1167
} ;
1170
1168
xev . ClientMessageEvent . ptr4 = l4 ?? IntPtr . Zero ;
1171
- XSendEvent ( _x11 . Display , _parentHandle , false ,
1169
+ XSendEvent ( _x11 . Display , _x11 . RootWindow , false ,
1172
1170
new IntPtr ( ( int ) ( EventMask . SubstructureRedirectMask | EventMask . SubstructureNotifyMask ) ) , ref xev ) ;
1173
1171
1174
1172
}
0 commit comments