Commit Graph

3 Commits

Author SHA1 Message Date
Jon Turney 9a4b62798b hw/xwin: Fix lingering uses of libX11 types and values 2020-04-15 14:13:58 +00:00
Jon Turney 6a64b9d7af hw/xwin: xcbify code for converting X11 icon to Win32 icon
Convert the code for converting an X11 icon to Win32 icon from Xlib to xcb.

v2: some warning fixes in winXIconToHICON()
v3: declaration-after-statement warning fixes
v4: printf format fixes
v5: convert in place rather than in a library

This also avoids the xlib/xserver namespace collision issues, so
winmultiwindowicons.h can be included everywhere it should be, which fixes
compilation with -Werror=implicit-function-declaration

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2016-04-07 10:30:48 +01:00
Jon TURNEY 527cf13135 hw/xwin: Make winOverrideIcon() thread-safe for icon data access
winOverrideIcon() is called from the internal WM client thread.

Accessing server-internal data structures to get icon data or window hints is
not safe, as there is no lock to ensure we do not collide with these data
structures being updated in the server thread.

Rewrite so the internal client thread uses X client calls to obtain this data
safely

We used to also set the icon inside the server when the window was initially
created.  For simplicity, we simply send a message to the internal WM to update
the icon when the window is created (rather than writing different icon update
code which can work in the server thread for that one case...)

extwm mode used to do the icon update in the server. I'm not sure that actually
made much sense.  Let's assume the external WM client can do it instead...

v2
Make sure that WM_WM_ICON_EVENT does nothing for override-redirect windows

v3
Reinstate check that native window actually has expected properties for an X
window before trying to update it's icon; some auxiliary windows owned by the
XWin process don't, which would cause a crash

v4
Various fixes to pixmap icon conversion:
- remove left-over malloc in winScaleXimageToWindowsIcon causing a memory leak
- don't recalculate DDBitmap stride in winScaleXimageToWindowsIcon, when we already have worked it out
- properly check that XGetWindowProperty(NET_WM_ICON) returned some data
- don't try to retrieve WM_HINTS icon_mask if it isn't set
- restore accidentally dropped calculation of effBpp, stride, maskStride of output DDBitmap
- make sure imageMask is zero-initalized before we use it to mask the DDBitmap

v5
Remove a left-over unused variable

v6
Avoid XDestroyImage(NULL) crash if XGetImage failed for icon_pixmap

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2012-08-03 22:47:42 +01:00