C# - Problem with custom SDL_CreateWindow for advanced mode with multiple window or parent as desktop holder

Hello everyone,

I have tried to create simple custom like I would like to create custom "SDL_CreateWindow as SDL_CreateDesktopWindow().

I know with XLib like I saw sdl2 source.
But I have created XLIbSharp ( made by me ) with SDL_CreateWindowFrom() like SDL_SysWM. But I am not sure that.

I show you about C#

using System;
using static SDL2.SDL;
using static XLibSharp.XLib;
namespace XLibSharp_WithSDL2_Test
{
    public static class SDL_Custom
    {
        public static IntPtr SDL_CreateDesktopWindow(IntPtr sdl_window_parent ,string title, int x, int y, int width, int height)
        {
            IntPtr display = XOpenDisplay(string.Empty);
            int screen_number = XDefaultScreen(display);
            IntPtr rootwin = XDefaultRootWindow(display); 
            ulong black = XBlackPixel(display, screen_number);
            ulong white = XWhitePixel(display, screen_number);

            IntPtr window = XCreateSimpleWindow(display, rootwin, x, y, (uint)width, (uint)height, 0, black, 0xff5000);

            XSelectInput(display, window, XEventMask.KeyPressMask | XEventMask.ResizeRedirectMask);
            XMapWindow(display, window);

            XEvent evt = new XEvent();
            while (XPending(display) != 0)
            {
                XNextEvent(display, ref evt);

                if (evt.type == XEventType.ResizeRequest)
                {
                    XResizeWindow(display, window, (uint)white, (uint)height);
                    break;
                }

                if (evt.type == XEventType.KeyPress)
                {
                    if (evt.KeyEvent.keycode == (uint)XKeySym.WF_Escape)
                    {
                        XDestroyWindow(display, window);
                        XCloseDisplay(display);
                        break;
                    }
                }
            }

            IntPtr sdl_win = SDL_CreateWindowFrom(window);
            SDL_SetWindowTitle(sdl_win, title);
            SDL_SetWindowSize(sdl_win, width, height);
            SDL_SetWindowPosition(sdl_win, x, y);
            SDL_SetWindowResizable(sdl_win, SDL_bool.SDL_TRUE);

            // sdl_window_parent


            return sdl_win;
        }
    }
}

And I tried to test but why does my custom CreateWindow can’t show up. Where is example like custom createwindow alternative. Because I would like to make SDL2 as my advanced sdl2 window creators

using System;
using static SDL2.SDL;
using static XLibSharp_WithSDL2_Test.SDL_Custom;
namespace XLibSharp_WithSDL2_Test
{
    class MainClass
    {
        static void Main(string[] args)
        {
            SDL_Init(SDL_INIT_EVERYTHING);

            IntPtr desktop_window = SDL_CreateDesktopWindow(IntPtr.Zero ,"Test Desktop Window", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 900, 630);
            SDL_ShowWindow(desktop_window);

        //    IntPtr desktop_window_2 = SDL_CreateDesktopWindow(desktop_window, "window 2", 200, 100, 300, 400);
        //    SDL_ShowWindow(desktop_window_2);

            var isClosed = false;
            while(!isClosed)
            {
                while(SDL_PollEvent(out SDL_Event sdl_evt) != 0)
                {
                    if (sdl_evt.type == SDL_EventType.SDL_QUIT)
                    {
                        isClosed = true;
                    }

                    if (sdl_evt.type == SDL_EventType.SDL_KEYDOWN)
                    {
                        if (sdl_evt.key.keysym.sym == SDL_Keycode.SDLK_ESCAPE)
                        {
                            isClosed = true;
                        }
                    }

                    break;
                }
            }

            SDL_DestroyWindow(desktop_window);
            SDL_Quit();
        }
    }
}

It works as well but Press key if i want quit of SDL_Window.
Why do I write "IntPtr.Zero in SDL_CreateDesktopWindow() because it is not finish for parent of SDL_Window. - I will look for catching of sibling and owned mode .