From 72293d48b5010957892b062110bc9ba6e28ab179 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 10 Jul 2023 23:47:53 +0900 Subject: [PATCH] internal/glfw/glfw: unify c_glfw_bsd.go and c_glfw_linux.go --- .../glfw/{c_glfw_bsd.go => c_glfw_linbsd.go} | 2 +- internal/glfw/glfw/c_glfw_linux.go | 30 ------------------- internal/glfw/glfw/glfw/src/x11_init.c | 4 +++ internal/glfw/glfw/glfw/src/x11_window.c | 4 ++- 4 files changed, 8 insertions(+), 32 deletions(-) rename internal/glfw/glfw/{c_glfw_bsd.go => c_glfw_linbsd.go} (95%) delete mode 100644 internal/glfw/glfw/c_glfw_linux.go diff --git a/internal/glfw/glfw/c_glfw_bsd.go b/internal/glfw/glfw/c_glfw_linbsd.go similarity index 95% rename from internal/glfw/glfw/c_glfw_bsd.go rename to internal/glfw/glfw/c_glfw_linbsd.go index dff3efa16..ee5347e04 100644 --- a/internal/glfw/glfw/c_glfw_bsd.go +++ b/internal/glfw/glfw/c_glfw_linbsd.go @@ -2,7 +2,7 @@ // SPDX-FileCopyrightText: 2012 The glfw3-go Authors // SPDX-FileCopyrightText: 2023 The Ebitengine Authors -//go:build freebsd || netbsd || openbsd +//go:build freebsd || linux || netbsd || openbsd package glfw diff --git a/internal/glfw/glfw/c_glfw_linux.go b/internal/glfw/glfw/c_glfw_linux.go deleted file mode 100644 index 24f0d299a..000000000 --- a/internal/glfw/glfw/c_glfw_linux.go +++ /dev/null @@ -1,30 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// SPDX-FileCopyrightText: 2012 The glfw3-go Authors -// SPDX-FileCopyrightText: 2023 The Ebitengine Authors - -package glfw - -/* -#ifdef _GLFW_WAYLAND - #include "glfw/src/wl_init.c" - #include "glfw/src/wl_monitor.c" - #include "glfw/src/wl_window.c" - #include "glfw/src/wayland-idle-inhibit-unstable-v1-client-protocol.c" - #include "glfw/src/wayland-pointer-constraints-unstable-v1-client-protocol.c" - #include "glfw/src/wayland-relative-pointer-unstable-v1-client-protocol.c" - #include "glfw/src/wayland-viewporter-client-protocol.c" - #include "glfw/src/wayland-xdg-decoration-unstable-v1-client-protocol.c" - #include "glfw/src/wayland-xdg-shell-client-protocol.c" -#endif -#ifdef _GLFW_X11 - #include "glfw/src/x11_window.c" - #include "glfw/src/x11_init.c" - #include "glfw/src/x11_monitor.c" - #include "glfw/src/glx_context.c" -#endif -#include "glfw/src/posix_time.c" -#include "glfw/src/posix_thread.c" -#include "glfw/src/xkb_unicode.c" -#include "glfw/src/egl_context.c" -*/ -import "C" diff --git a/internal/glfw/glfw/glfw/src/x11_init.c b/internal/glfw/glfw/glfw/src/x11_init.c index cfcaa95be..181691383 100644 --- a/internal/glfw/glfw/glfw/src/x11_init.c +++ b/internal/glfw/glfw/glfw/src/x11_init.c @@ -27,6 +27,10 @@ // It is fine to use C99 in this file because it will not be built with VS //======================================================================== +#if !defined(_GNU_SOURCE) + #define _GNU_SOURCE +#endif + #include "internal.h" #include diff --git a/internal/glfw/glfw/glfw/src/x11_window.c b/internal/glfw/glfw/glfw/src/x11_window.c index 5dbe876d6..319c4cae3 100644 --- a/internal/glfw/glfw/glfw/src/x11_window.c +++ b/internal/glfw/glfw/glfw/src/x11_window.c @@ -27,7 +27,9 @@ // It is fine to use C99 in this file because it will not be built with VS //======================================================================== -#define _GNU_SOURCE +#if !defined(_GNU_SOURCE) + #define _GNU_SOURCE +#endif #include "internal.h"