Get X11 handles from HWND

Questions about Wine on Linux
Locked
evyatark2
Newbie
Newbie
Posts: 1
Joined: Mon Sep 19, 2022 4:01 am

Get X11 handles from HWND

Post by evyatark2 »

Hello,
I am reimplementing a graphics library that is available on Windows for Linux.
This library has a function that takes a HWND in order to initialize a surface on it.
The only change in my version of the library is that this function will take a (Display, Window) pair from Xlib and initialize a VkSurface on that.
I am following https://wiki.winehq.org/Winelib_User%27 ... nelib_DLLs in order to make a DLL that will communicate with my Linux library and use it in order to test the library with Windows applications that are using it.
I could rewrite the library identically and use the MinGW target but it is missing a bunch of useful features like TSAN and I can't seem to get ASAN or Valgrind to work with it under wine.
So my question is when writing the thunk for the function that takes a HWND, how can I get the underlying Xlib handles in order to pass it to my custom library?
madewokherd
Level 4
Level 4
Posts: 143
Joined: Mon Jun 02, 2008 5:03 pm

Re: Get X11 handles from HWND

Post by madewokherd »

The only way I can find to do this is to query the internal "__wine_x11_whole_window" property using the GetProp function.

The X11 driver also has some custom commands that can be passed to ExtEscape, one of which seems to return a Drawable, but I don't know if this is useful for your purposes.

It may not be possible to get the drawing interactions with Win32 correct.
Locked