internal/glfw: move Wayland files

This commit is contained in:
Hajime Hoshi 2023-07-21 01:27:56 +09:00
parent 0324db5657
commit c85c5b1884
20 changed files with 40 additions and 53 deletions

View File

@ -1,20 +0,0 @@
// SPDX-License-Identifier: BSD-3-Clause
// SPDX-FileCopyrightText: 2012 The glfw3-go Authors
// SPDX-FileCopyrightText: 2023 The Ebitengine Authors
//go:build required
package glfw
// This file exists purely to prevent the golang toolchain from stripping
// away the c source directories and files when `go mod vendor` is used
// to populate a `vendor/` directory of a project depending on `go-gl/glfw`.
//
// How it works:
// - every directory which only includes c source files receives a dummy.go file.
// - every directory we want to preserve is included here as a _ import.
// - this file is given a build to exclude it from the regular build.
import (
// Prevent go tooling from stripping out the c source files.
_ "github.com/hajimehoshi/ebiten/v2/internal/glfw/glfw/glfw/src"
)

View File

@ -1,22 +0,0 @@
// SPDX-License-Identifier: BSD-3-Clause
// SPDX-FileCopyrightText: 2012 The glfw3-go Authors
// SPDX-FileCopyrightText: 2023 The Ebitengine Authors
//go:build freebsd || linux || netbsd || openbsd
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
*/
import "C"

View File

@ -1,4 +0,0 @@
//go:build required
// Package dummy prevents go tooling from stripping the c dependencies.
package dummy

View File

@ -117,7 +117,7 @@ typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGIPROC)(GLenum,GLuint);
#elif defined(_GLFW_X11)
#include "x11_platform_linbsd.h"
#elif defined(_GLFW_WAYLAND)
#include "./glfw/src/wl_platform.h"
#include "wl_platform_linbsd.h"
#else
#error "No supported window creation API selected"
#endif

View File

@ -1,3 +1,5 @@
//go:build (freebsd || linux || netbsd || openbsd) && wayland
/* Generated by wayland-scanner 1.18.0 */
/*

View File

@ -1,3 +1,5 @@
//go:build (freebsd || linux || netbsd || openbsd) && wayland
/* Generated by wayland-scanner 1.18.0 */
#ifndef IDLE_INHIBIT_UNSTABLE_V1_CLIENT_PROTOCOL_H

View File

@ -1,3 +1,5 @@
//go:build (freebsd || linux || netbsd || openbsd) && wayland
/* Generated by wayland-scanner 1.18.0 */
/*

View File

@ -1,3 +1,5 @@
//go:build (freebsd || linux || netbsd || openbsd) && wayland
/* Generated by wayland-scanner 1.18.0 */
#ifndef POINTER_CONSTRAINTS_UNSTABLE_V1_CLIENT_PROTOCOL_H

View File

@ -1,3 +1,5 @@
//go:build (freebsd || linux || netbsd || openbsd) && wayland
/* Generated by wayland-scanner 1.18.0 */
/*

View File

@ -1,3 +1,5 @@
//go:build (freebsd || linux || netbsd || openbsd) && wayland
/* Generated by wayland-scanner 1.18.0 */
#ifndef RELATIVE_POINTER_UNSTABLE_V1_CLIENT_PROTOCOL_H

View File

@ -1,3 +1,5 @@
//go:build (freebsd || linux || netbsd || openbsd) && wayland
/* Generated by wayland-scanner 1.18.0 */
/*

View File

@ -1,3 +1,5 @@
//go:build (freebsd || linux || netbsd || openbsd) && wayland
/* Generated by wayland-scanner 1.18.0 */
#ifndef VIEWPORTER_CLIENT_PROTOCOL_H

View File

@ -1,3 +1,5 @@
//go:build (freebsd || linux || netbsd || openbsd) && wayland
/* Generated by wayland-scanner 1.18.0 */
#ifndef XDG_DECORATION_UNSTABLE_V1_CLIENT_PROTOCOL_H

View File

@ -1,3 +1,5 @@
//go:build (freebsd || linux || netbsd || openbsd) && wayland
/* Generated by wayland-scanner 1.18.0 */
/*

View File

@ -1,3 +1,5 @@
//go:build (freebsd || linux || netbsd || openbsd) && wayland
/* Generated by wayland-scanner 1.18.0 */
/*

View File

@ -1,3 +1,5 @@
//go:build (freebsd || linux || netbsd || openbsd) && wayland
/* Generated by wayland-scanner 1.18.0 */
#ifndef XDG_SHELL_CLIENT_PROTOCOL_H

View File

@ -26,6 +26,8 @@
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
//go:build (freebsd || linux || netbsd || openbsd) && wayland
#if !defined(_GNU_SOURCE)
#define _GNU_SOURCE
#endif

View File

@ -26,6 +26,8 @@
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
//go:build (freebsd || linux || netbsd || openbsd) && wayland
#include "internal.h"
#include <stdio.h>

View File

@ -24,6 +24,8 @@
//
//========================================================================
//go:build (freebsd || linux || netbsd || openbsd) && wayland
#include <wayland-client.h>
#include <xkbcommon/xkbcommon.h>
#include <xkbcommon/xkbcommon-compose.h>
@ -35,12 +37,12 @@
#include "egl_context.h"
#include "osmesa_context.h"
#include "wayland-xdg-shell-client-protocol.h"
#include "wayland-xdg-decoration-client-protocol.h"
#include "wayland-viewporter-client-protocol.h"
#include "wayland-relative-pointer-unstable-v1-client-protocol.h"
#include "wayland-pointer-constraints-unstable-v1-client-protocol.h"
#include "wayland-idle-inhibit-unstable-v1-client-protocol.h"
#include "wayland-xdg-shell-client-protocol_linbsd.h"
#include "wayland-xdg-decoration-client-protocol_linbsd.h"
#include "wayland-viewporter-client-protocol_linbsd.h"
#include "wayland-relative-pointer-unstable-v1-client-protocol_linbsd.h"
#include "wayland-pointer-constraints-unstable-v1-client-protocol_linbsd.h"
#include "wayland-idle-inhibit-unstable-v1-client-protocol_linbsd.h"
#define _glfw_dlopen(name) dlopen(name, RTLD_LAZY | RTLD_LOCAL)
#define _glfw_dlclose(handle) dlclose(handle)

View File

@ -26,6 +26,8 @@
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
//go:build (freebsd || linux || netbsd || openbsd) && wayland
#if !defined(_GNU_SOURCE)
#define _GNU_SOURCE
#endif
@ -44,6 +46,7 @@
#include <poll.h>
#include <signal.h>
#include <time.h>
#include <linux/input.h>
#define GLFW_BORDER_SIZE 4
#define GLFW_CAPTION_HEIGHT 24