From 7fe0acdb259c7dd9f3b6214ba16f272da81beadb Mon Sep 17 00:00:00 2001 From: Tim Wiederhake Date: Sat, 30 Dec 2023 20:49:48 +0100 Subject: Accomodate different field names when compiling with c++ Signed-off-by: Tim Wiederhake --- src/events.c | 4 ++++ src/twm.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/events.c b/src/events.c index f8a5207..585ae16 100644 --- a/src/events.c +++ b/src/events.c @@ -391,7 +391,11 @@ HandleColormapNotify(void) cmap = cwin->colormap; +#if defined(__cplusplus) || defined(c_plusplus) + if (cevent->c_new) { +#else if (cevent->new) { +#endif if (XFindContext(dpy, cevent->colormap, ColormapContext, &context_data) == XCNOENT) cwin->colormap = CreateTwmColormap(cevent->colormap); diff --git a/src/twm.c b/src/twm.c index 57f50ad..1c1e522 100644 --- a/src/twm.c +++ b/src/twm.c @@ -474,7 +474,11 @@ main(int argc, char *argv[]) if (DisplayCells(dpy, scrnum) < 3) Scr->Monochrome = MONOCHROME; +#if defined(__cplusplus) || defined(c_plusplus) + else if (DefaultVisual(dpy, scrnum)->c_class == GrayScale) +#else else if (DefaultVisual(dpy, scrnum)->class == GrayScale) +#endif Scr->Monochrome = GRAYSCALE; else Scr->Monochrome = COLOR; -- cgit v1.2.3