[client] x11: fix failure to paste clipboard into the guest

The clipboard atoms may not exist yet and as such we must create them if
this is the case. Failure to do so results in `SEL_DATA` being zero
breaking the clipboard paste mechanics
This commit is contained in:
Geoffrey McRae 2021-04-29 12:22:54 +10:00
parent ec81a353c2
commit 9015706fcb
2 changed files with 18 additions and 17 deletions

View File

@ -24,7 +24,8 @@ struct X11DSAtoms x11atoms = { 0 };
void X11AtomsInit(void)
{
#define DEF_ATOM(x) x11atoms.x = XInternAtom(x11.display, #x, True);
#define DEF_ATOM(x, onlyIfExists) \
x11atoms.x = XInternAtom(x11.display, #x, onlyIfExists);
DEF_ATOMS()
#undef DEF_ATOM
}

View File

@ -21,26 +21,26 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#define _H_X11DS_ATOMS_
#define DEF_ATOMS() \
DEF_ATOM(_NET_REQUEST_FRAME_EXTENTS) \
DEF_ATOM(_NET_FRAME_EXTENTS) \
DEF_ATOM(_NET_WM_STATE) \
DEF_ATOM(_NET_WM_STATE_FULLSCREEN) \
DEF_ATOM(_NET_WM_STATE_MAXIMIZED_HORZ) \
DEF_ATOM(_NET_WM_STATE_MAXIMIZED_VERT) \
DEF_ATOM(_NET_WM_WINDOW_TYPE) \
DEF_ATOM(_NET_WM_WINDOW_TYPE_NORMAL) \
DEF_ATOM(_NET_WM_WINDOW_TYPE_UTILITY) \
DEF_ATOM(WM_DELETE_WINDOW) \
DEF_ATOM(_MOTIF_WM_HINTS) \
DEF_ATOM(_NET_REQUEST_FRAME_EXTENTS, True) \
DEF_ATOM(_NET_FRAME_EXTENTS, True) \
DEF_ATOM(_NET_WM_STATE, True) \
DEF_ATOM(_NET_WM_STATE_FULLSCREEN, True) \
DEF_ATOM(_NET_WM_STATE_MAXIMIZED_HORZ, True) \
DEF_ATOM(_NET_WM_STATE_MAXIMIZED_VERT, True) \
DEF_ATOM(_NET_WM_WINDOW_TYPE, True) \
DEF_ATOM(_NET_WM_WINDOW_TYPE_NORMAL, True) \
DEF_ATOM(_NET_WM_WINDOW_TYPE_UTILITY, True) \
DEF_ATOM(WM_DELETE_WINDOW, True) \
DEF_ATOM(_MOTIF_WM_HINTS, True) \
\
DEF_ATOM(CLIPBOARD) \
DEF_ATOM(TARGETS) \
DEF_ATOM(SEL_DATA) \
DEF_ATOM(INCR)
DEF_ATOM(CLIPBOARD, False) \
DEF_ATOM(TARGETS, False) \
DEF_ATOM(SEL_DATA, False) \
DEF_ATOM(INCR, False)
#include <X11/Xlib.h>
#define DEF_ATOM(x) Atom x;
#define DEF_ATOM(x, onlyIfExists) Atom x;
struct X11DSAtoms
{
DEF_ATOMS()