diff options
author | David Robillard <d@drobilla.net> | 2021-05-27 18:43:20 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-05-27 19:04:08 -0400 |
commit | 5e1ca2099a912d88c57320f61a6f316d2e7c67b7 (patch) | |
tree | 807ffb9e40f13ffca6b1289095c263f545d2d640 | |
parent | 873fe784f2a003d8dfa8ee64bc05aba3b0754c86 (diff) | |
download | pugl-5e1ca2099a912d88c57320f61a6f316d2e7c67b7.tar.gz pugl-5e1ca2099a912d88c57320f61a6f316d2e7c67b7.tar.bz2 pugl-5e1ca2099a912d88c57320f61a6f316d2e7c67b7.zip |
Make code build cleanly as C++
-rw-r--r-- | meson.build | 3 | ||||
-rw-r--r-- | src/mac_cairo.m | 2 | ||||
-rw-r--r-- | src/x11.c | 16 |
3 files changed, 17 insertions, 4 deletions
diff --git a/meson.build b/meson.build index d91ef6b..50cc19f 100644 --- a/meson.build +++ b/meson.build @@ -86,6 +86,7 @@ if get_option('strict') if is_variable('cpp') if cpp.get_id() == 'clang' cpp_warnings += [ + '-Wno-documentation', # Cairo '-Wno-documentation-unknown-command', # Cairo '-Wno-old-style-cast', '-Wno-padded', @@ -95,7 +96,9 @@ if get_option('strict') ] elif cpp.get_id() == 'gcc' cpp_warnings += [ + '-Wno-conditionally-supported', '-Wno-effc++', + '-Wno-float-equal', '-Wno-inline', '-Wno-old-style-cast', '-Wno-padded', diff --git a/src/mac_cairo.m b/src/mac_cairo.m index 59e4bc1..a2888ab 100644 --- a/src/mac_cairo.m +++ b/src/mac_cairo.m @@ -101,7 +101,7 @@ puglMacCairoEnter(PuglView* view, const PuglExposeEvent* expose) assert(!drawView->cr); const double scale = 1.0 / [[NSScreen mainScreen] backingScaleFactor]; - CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort]; + CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; const CGSize sizePx = {view->frame.width, view->frame.height}; const CGSize sizePt = CGContextConvertSizeToUserSpace(context, sizePx); @@ -66,6 +66,16 @@ # define MAX(a, b) (((a) > (b)) ? (a) : (b)) #endif +#ifdef __cplusplus +# define PUGL_INIT_STRUCT \ + {} +#else +# define PUGL_INIT_STRUCT \ + { \ + 0 \ + } +#endif + enum WmClientStateMessageAction { WM_STATE_REMOVE, WM_STATE_ADD, @@ -209,7 +219,7 @@ updateSizeHints(const PuglView* const view) } Display* display = view->world->impl->display; - XSizeHints sizeHints = {0}; + XSizeHints sizeHints = PUGL_INIT_STRUCT; if (!view->hints[PUGL_RESIZABLE]) { sizeHints.flags = PBaseSize | PMinSize | PMaxSize; @@ -280,7 +290,7 @@ puglRealize(PuglView* const view) const int screen = DefaultScreen(display); const Window root = RootWindow(display, screen); const Window parent = view->parent ? (Window)view->parent : root; - XSetWindowAttributes attr = {0}; + XSetWindowAttributes attr = PUGL_INIT_STRUCT; PuglStatus st = PUGL_SUCCESS; // Ensure that we're unrealized and that a reasonable backend has been set @@ -1458,7 +1468,7 @@ PuglStatus puglX11Configure(PuglView* view) { PuglInternals* const impl = view->impl; - XVisualInfo pat = {0}; + XVisualInfo pat = PUGL_INIT_STRUCT; int n = 0; pat.screen = impl->screen; |