Closed sandsc closed 2 months ago
Can you please provide a (small) reproducer? That way triage will go a lot faster.
using code
SDL_SetNumberProperty(sdlPid, SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER, reinterpret_cast<Sint64>(handle));
instead of
SDL_Setroperty(sdlPid, SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER, handle);
now NativeControlHost's can embedded in Avalonia window, I guess that x11 window handle should be passed as number value, or a toplevel window created, but a new issue has arisen, I can't receive any input events if it is a embedded child window.
I will provide a small app to reproduce the bugs later, thanks for any helps.
Here is small app to reproduce issue, prebuilt libraries are included for both windows x64 and Linux x64 platform.
Here is screenshot on Linux x11, only SDL_EVENT_WINDOW_SHOWN
and SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED
events received when app started. but all input and window events can be received on Windows platform.
Also found that the red line is not rendered on Linux either.
In SDL_x11window When creating window for external window, add some code for set event mask for external window, then events can be received, I'm not very familiar with x11 programming and don't know if this's the right way to fix.
if (w) {
window->flags |= SDL_WINDOW_EXTERNAL;
if (SetupWindowData(_this, window, w) < 0) {
return -1;
}
unsigned int keyboard_events = KeyPressMask | KeyReleaseMask;
unsigned int pointer_events = ButtonPressMask | ButtonReleaseMask | PointerMotionMask | ButtonMotionMask;
X11_Xinput2SelectMouseAndKeyboard(_this, window);
SDL_WindowData *wd = window->driverdata;
/* If XInput2 can handle pointer and keyboard events, we don't track them here */
if (wd->xinput2_keyboard_enabled) {
keyboard_events = 0;
}
if (wd->xinput2_mouse_enabled) {
pointer_events = 0;
}
Display *display = _this->driverdata->display;
X11_XSelectInput(display, w,
(FocusChangeMask | EnterWindowMask | LeaveWindowMask | StructureNotifyMask |
keyboard_events | pointer_events));
return 0;
}
Fixed, thanks!
Create a sdl window by Avalonia NativeControlHost's platform handle shows black window on x11, it seems underlying window can't gets resized, when I resize underlying window manually, it shows, however it detached from Avalonia window, can't embedded in main window. It works no problem on windows platform, I don't know if this is a SDL bug, or an Avalonia bug? Avalonia x11 bug