Compare commits
7 commits
Author | SHA1 | Date | |
---|---|---|---|
21a377707f | |||
15afe89aff | |||
07c5e54f59 | |||
a77f0c6c77 | |||
c65f420215 | |||
cc772e4bcb | |||
3366acf975 |
25 changed files with 1645 additions and 1075 deletions
8
.github/FUNDING.yml
vendored
8
.github/FUNDING.yml
vendored
|
@ -1,8 +0,0 @@
|
|||
# These are supported funding model platforms
|
||||
|
||||
github: raysan5
|
||||
patreon: # raylib
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # raysan
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
custom: # Replace with a single custom sponsorship URL
|
1
.github/ISSUE_TEMPLATE/config.yml
vendored
1
.github/ISSUE_TEMPLATE/config.yml
vendored
|
@ -1 +0,0 @@
|
|||
blank_issues_enabled: false
|
41
.github/ISSUE_TEMPLATE/new-issue-template.md
vendored
41
.github/ISSUE_TEMPLATE/new-issue-template.md
vendored
|
@ -1,41 +0,0 @@
|
|||
---
|
||||
name: new issue template
|
||||
about: generic template for new issues
|
||||
title: "[module] Short description of the issue/bug/feature"
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**WARNING: Please, read this note carefully before submitting a new issue:**
|
||||
|
||||
It is important to realise that **this is NOT A SUPPORT FORUM**, this is for reproducible BUGS with raylib ONLY.
|
||||
|
||||
There are lots of generous and helpful people ready to help you out on [raylib Discord forum](https://discord.gg/raylib) or [raylib reddit](https://www.reddit.com/r/raylib/).
|
||||
|
||||
Remember that asking for support questions here actively takes developer time away from improving raylib.
|
||||
|
||||
---
|
||||
|
||||
Please, before submitting a new issue verify and check:
|
||||
|
||||
- [ ] I tested it on latest raylib version from master branch
|
||||
- [ ] I checked there is no similar issue already reported
|
||||
- [ ] I checked the documentation on the [wiki](https://github.com/raysan5/raylib/wiki)
|
||||
- [ ] My code has no errors or misuse of raylib
|
||||
|
||||
### Issue description
|
||||
|
||||
*Briefly describe the issue you are experiencing (or the feature you want to see added to raylib). Tell us what you were trying to do and what happened instead. Remember, this is not the best place to ask questions. For questions, go to [raylib Discord server](https://discord.gg/raylib).*
|
||||
|
||||
### Environment
|
||||
|
||||
*Provide your Platform, Operating System, OpenGL version, GPU details where you experienced the issue.*
|
||||
|
||||
### Issue Screenshot
|
||||
|
||||
*If possible, provide a screenshot that illustrates the issue. Usually an image is better than a thousand words.*
|
||||
|
||||
### Code Example
|
||||
|
||||
*Provide minimal reproduction code to test the issue. Please, format the code properly and try to keep it as simple as possible, just focusing on the experienced issue.*
|
96
.github/workflows/android.yml
vendored
96
.github/workflows/android.yml
vendored
|
@ -1,96 +0,0 @@
|
|||
name: Android
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/android.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/android.yml'
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
permissions:
|
||||
contents: write # for actions/upload-release-asset to upload release asset
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 1
|
||||
matrix:
|
||||
ARCH: ["arm64", "x86_64"]
|
||||
|
||||
env:
|
||||
RELEASE_NAME: raylib-dev_android_api29_${{ matrix.ARCH }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Setup Release Version
|
||||
run: |
|
||||
echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_android_api29_${{ matrix.ARCH }}" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
if: github.event_name == 'release' && github.event.action == 'published'
|
||||
|
||||
- name: Setup Android NDK
|
||||
id: setup-ndk
|
||||
uses: nttld/setup-ndk@v1
|
||||
with:
|
||||
ndk-version: r25
|
||||
add-to-path: false
|
||||
env:
|
||||
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
|
||||
|
||||
- name: Setup Environment
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
mkdir ${{ env.RELEASE_NAME }}
|
||||
cd ${{ env.RELEASE_NAME }}
|
||||
mkdir include
|
||||
mkdir lib
|
||||
cd ../..
|
||||
|
||||
# Generating static + shared library for 64bit arquitectures and API version 29
|
||||
- name: Build Library
|
||||
run: |
|
||||
cd src
|
||||
make PLATFORM=PLATFORM_ANDROID ANDROID_ARCH=${{ matrix.ARCH }} ANDROID_API_VERSION=29 ANDROID_NDK=${{ env.ANDROID_NDK_HOME }} RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib"
|
||||
make PLATFORM=PLATFORM_ANDROID ANDROID_ARCH=${{ matrix.ARCH }} ANDROID_API_VERSION=29 ANDROID_NDK=${{ env.ANDROID_NDK_HOME }} RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
|
||||
cd ..
|
||||
shell: cmd
|
||||
|
||||
- name: Generate Artifacts
|
||||
run: |
|
||||
cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./src/raymath.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./src/rlgl.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./CHANGELOG ./build/${{ env.RELEASE_NAME }}/CHANGELOG
|
||||
cp -v ./README.md ./build/${{ env.RELEASE_NAME }}/README.md
|
||||
cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
|
||||
cd build
|
||||
tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
|
||||
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.RELEASE_NAME }}.tar.gz
|
||||
path: ./build/${{ env.RELEASE_NAME }}.tar.gz
|
||||
|
||||
- name: Upload Artifact to Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: ./build/${{ env.RELEASE_NAME }}.tar.gz
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
if: github.event_name == 'release' && github.event.action == 'published'
|
111
.github/workflows/cmake.yml
vendored
111
.github/workflows/cmake.yml
vendored
|
@ -1,111 +0,0 @@
|
|||
name: CMakeBuilds
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/cmake.yml'
|
||||
- 'CMakeList.txt'
|
||||
- 'CMakeOptions.txt'
|
||||
- 'cmake/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/cmake.yml'
|
||||
- 'CMakeList.txt'
|
||||
- 'CMakeOptions.txt'
|
||||
- 'cmake/**'
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
BUILD_TYPE: Release
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build_windows:
|
||||
name: Windows Build
|
||||
# The CMake configure and build commands are platform agnostic and should work equally
|
||||
# well on Windows or Mac. You can convert this to a matrix build if you need
|
||||
# cross-platform coverage.
|
||||
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Create Build Environment
|
||||
# Some projects don't allow in-source building, so create a separate build directory
|
||||
# We'll use this as our working directory for all subsequent commands
|
||||
run: cmake -E make_directory ${{github.workspace}}/build
|
||||
|
||||
- name: Configure CMake
|
||||
# Use a bash shell so we can use the same syntax for environment variable
|
||||
# access regardless of the host operating system
|
||||
shell: powershell
|
||||
working-directory: ${{github.workspace}}/build
|
||||
# Note the current convention is to use the -S and -B options here to specify source
|
||||
# and build directories, but this is only available with CMake 3.13 and higher.
|
||||
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
|
||||
run: cmake $env:GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$env:BUILD_TYPE -DPLATFORM=Desktop
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{github.workspace}}/build
|
||||
shell: powershell
|
||||
# Execute the build. You can specify a specific target with "--target <NAME>"
|
||||
run: cmake --build . --config $env:BUILD_TYPE
|
||||
|
||||
- name: Test
|
||||
working-directory: ${{github.workspace}}/build
|
||||
shell: powershell
|
||||
# Execute tests defined by the CMake configuration.
|
||||
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
|
||||
run: ctest -C $env:BUILD_TYPE
|
||||
|
||||
build_linux:
|
||||
name: Linux Build
|
||||
# The CMake configure and build commands are platform agnostic and should work equally
|
||||
# well on Windows or Mac. You can convert this to a matrix build if you need
|
||||
# cross-platform coverage.
|
||||
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Create Build Environment
|
||||
# Some projects don't allow in-source building, so create a separate build directory
|
||||
# We'll use this as our working directory for all subsequent commands
|
||||
run: cmake -E make_directory ${{github.workspace}}/build
|
||||
|
||||
- name: Setup Environment
|
||||
run: |
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install gcc-multilib
|
||||
sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-dev libwayland-bin libxkbcommon-dev
|
||||
- name: Configure CMake
|
||||
# Use a bash shell so we can use the same syntax for environment variable
|
||||
# access regardless of the host operating system
|
||||
shell: bash
|
||||
working-directory: ${{github.workspace}}/build
|
||||
# Note the current convention is to use the -S and -B options here to specify source
|
||||
# and build directories, but this is only available with CMake 3.13 and higher.
|
||||
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
|
||||
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPLATFORM=Desktop
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{github.workspace}}/build
|
||||
shell: bash
|
||||
# Execute the build. You can specify a specific target with "--target <NAME>"
|
||||
run: cmake --build . --config $BUILD_TYPE
|
||||
|
||||
- name: Test
|
||||
working-directory: ${{github.workspace}}/build
|
||||
shell: bash
|
||||
# Execute tests defined by the CMake configuration.
|
||||
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
|
||||
run: ctest -C $BUILD_TYPE
|
135
.github/workflows/codeql.yml
vendored
135
.github/workflows/codeql.yml
vendored
|
@ -1,135 +0,0 @@
|
|||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
# push:
|
||||
# branches: [ "main", "master" ]
|
||||
pull_request:
|
||||
branches: '*'
|
||||
schedule:
|
||||
- cron: '0 0 * * 1'
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
BUILD_TYPE: Release
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
# Runner size impacts CodeQL analysis time. To learn more, please see:
|
||||
# - https://gh.io/recommended-hardware-resources-for-running-codeql
|
||||
# - https://gh.io/supported-runners-and-hardware-resources
|
||||
# - https://gh.io/using-larger-runners
|
||||
# Consider using larger runners for possible analysis time improvements.
|
||||
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-20.04' }}
|
||||
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'cpp' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
|
||||
# Use only 'java' to analyze code written in Java, Kotlin or both
|
||||
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
|
||||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Create Build Environment
|
||||
# Some projects don't allow in-source building, so create a separate build directory
|
||||
# We'll use this as our working directory for all subsequent commands
|
||||
run: cmake -E make_directory ${{github.workspace}}/build
|
||||
|
||||
- name: Setup Environment
|
||||
run: |
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install gcc-multilib
|
||||
sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-dev libxkbcommon-dev
|
||||
|
||||
- name: Configure CMake
|
||||
# Use a bash shell so we can use the same syntax for environment variable
|
||||
# access regardless of the host operating system
|
||||
shell: bash
|
||||
working-directory: ${{github.workspace}}/build
|
||||
# Note the current convention is to use the -S and -B options here to specify source
|
||||
# and build directories, but this is only available with CMake 3.13 and higher.
|
||||
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
|
||||
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPLATFORM=Desktop
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
|
||||
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
||||
# queries: security-extended,security-and-quality
|
||||
queries: security-and-quality
|
||||
|
||||
- name: Build
|
||||
# Execute the build. You can specify a specific target with "--target <NAME>"
|
||||
run: |
|
||||
cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPLATFORM=Desktop
|
||||
cmake --build . --config $BUILD_TYPE
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
upload: false
|
||||
id: step1
|
||||
|
||||
# Filter out rules with low severity or high false positve rate
|
||||
# Also filter out warnings in third-party code
|
||||
- name: Filter out unwanted errors and warnings
|
||||
uses: advanced-security/filter-sarif@v1
|
||||
with:
|
||||
patterns: |
|
||||
-**:cpp/path-injection
|
||||
-**:cpp/world-writable-file-creation
|
||||
-**:cpp/poorly-documented-function
|
||||
-**:cpp/potentially-dangerous-function
|
||||
-**:cpp/use-of-goto
|
||||
-**:cpp/integer-multiplication-cast-to-long
|
||||
-**:cpp/comparison-with-wider-type
|
||||
-**:cpp/leap-year/*
|
||||
-**:cpp/ambiguously-signed-bit-field
|
||||
-**:cpp/suspicious-pointer-scaling
|
||||
-**:cpp/suspicious-pointer-scaling-void
|
||||
-**:cpp/unsigned-comparison-zero
|
||||
-**/cmake*/Modules/**
|
||||
-**/src/external/glfw/**
|
||||
-**/src/external/**
|
||||
input: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif
|
||||
output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif
|
||||
|
||||
- name: Upload CodeQL results to code scanning
|
||||
uses: github/codeql-action/upload-sarif@v2
|
||||
with:
|
||||
sarif_file: ${{ steps.step1.outputs.sarif-output }}
|
||||
category: "/language:${{matrix.language}}"
|
||||
|
||||
- name: Upload CodeQL results as an artifact
|
||||
if: success() || failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: codeql-results
|
||||
path: ${{ steps.step1.outputs.sarif-output }}
|
||||
retention-days: 5
|
108
.github/workflows/linux.yml
vendored
108
.github/workflows/linux.yml
vendored
|
@ -1,108 +0,0 @@
|
|||
name: Linux
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/linux.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/linux.yml'
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
permissions:
|
||||
contents: write # for actions/upload-release-asset to upload release asset
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 1
|
||||
matrix:
|
||||
bits: [32, 64]
|
||||
include:
|
||||
- bits: 32
|
||||
ARCH: "i386"
|
||||
ARCH_NAME: "i386"
|
||||
COMPILER_PATH: "/user/bin"
|
||||
- bits: 64
|
||||
ARCH: "x86_64"
|
||||
ARCH_NAME: "amd64"
|
||||
COMPILER_PATH: "/user/bin"
|
||||
|
||||
env:
|
||||
RELEASE_NAME: raylib-dev_linux_${{ matrix.ARCH_NAME }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Setup Release Version
|
||||
run: |
|
||||
echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_linux_${{ matrix.ARCH_NAME }}" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
if: github.event_name == 'release' && github.event.action == 'published'
|
||||
|
||||
- name: Setup Environment
|
||||
run: |
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install gcc-multilib
|
||||
sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-dev libxkbcommon-dev
|
||||
mkdir build
|
||||
cd build
|
||||
mkdir ${{ env.RELEASE_NAME }}
|
||||
cd ${{ env.RELEASE_NAME }}
|
||||
mkdir include
|
||||
mkdir lib
|
||||
cd ../../../raylib
|
||||
# ${{ matrix.ARCH }}-linux-gnu-gcc -v
|
||||
|
||||
# TODO: Support 32bit (i386) static/shared library building
|
||||
- name: Build Library
|
||||
run: |
|
||||
cd src
|
||||
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CUSTOM_CFLAGS="-m32" -B
|
||||
# make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
|
||||
cd ..
|
||||
if: matrix.bits == 32
|
||||
|
||||
- name: Build Library
|
||||
run: |
|
||||
cd src
|
||||
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
|
||||
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
|
||||
cd ..
|
||||
if: matrix.bits == 64
|
||||
|
||||
- name: Generate Artifacts
|
||||
run: |
|
||||
cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./src/raymath.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./src/rlgl.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./CHANGELOG ./build/${{ env.RELEASE_NAME }}/CHANGELOG
|
||||
cp -v ./README.md ./build/${{ env.RELEASE_NAME }}/README.md
|
||||
cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
|
||||
cd build
|
||||
tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
|
||||
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.RELEASE_NAME }}.tar.gz
|
||||
path: ./build/${{ env.RELEASE_NAME }}.tar.gz
|
||||
|
||||
- name: Upload Artifact to Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: ./build/${{ env.RELEASE_NAME }}.tar.gz
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
if: github.event_name == 'release' && github.event.action == 'published'
|
42
.github/workflows/linux_examples.yml
vendored
42
.github/workflows/linux_examples.yml
vendored
|
@ -1,42 +0,0 @@
|
|||
name: Linux Examples
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/linux_examples.yml'
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/linux_examples.yml'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Environment
|
||||
run: |
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-dev libxkbcommon-dev
|
||||
|
||||
- name: Build Library
|
||||
run: |
|
||||
cd src
|
||||
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC
|
||||
cd ..
|
||||
|
||||
- name: Build Examples
|
||||
run: |
|
||||
cd examples
|
||||
make PLATFORM=PLATFORM_DESKTOP -B
|
||||
cd ..
|
113
.github/workflows/macos.yml
vendored
113
.github/workflows/macos.yml
vendored
|
@ -1,113 +0,0 @@
|
|||
name: macOS
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/macos.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/macos.yml'
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
permissions:
|
||||
contents: write # for actions/upload-release-asset to upload release asset
|
||||
runs-on: macos-latest
|
||||
|
||||
env:
|
||||
RELEASE_NAME: raylib-dev_macos
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Setup Release Version
|
||||
run: |
|
||||
echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_macos" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
if: github.event_name == 'release' && github.event.action == 'published'
|
||||
|
||||
- name: Setup Environment
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
mkdir ${{ env.RELEASE_NAME }}
|
||||
cd ${{ env.RELEASE_NAME }}
|
||||
mkdir include
|
||||
mkdir lib
|
||||
cd ../..
|
||||
|
||||
# Generating static + shared library, note that i386 architecture is deprecated
|
||||
# Defining GL_SILENCE_DEPRECATION because OpenGL is deprecated on macOS
|
||||
- name: Build Library
|
||||
run: |
|
||||
cd src
|
||||
clang --version
|
||||
|
||||
# Extract version numbers from Makefile
|
||||
brew install grep
|
||||
RAYLIB_API_VERSION=`ggrep -Po 'RAYLIB_API_VERSION\s*=\s\K(.*)' Makefile`
|
||||
RAYLIB_VERSION=`ggrep -Po 'RAYLIB_VERSION\s*=\s\K(.*)' Makefile`
|
||||
|
||||
# Build raylib x86_64 static
|
||||
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC CUSTOM_CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION"
|
||||
mv libraylib.a /tmp/libraylib_x86_64.a
|
||||
make clean
|
||||
|
||||
# Build raylib arm64 static
|
||||
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC CUSTOM_CFLAGS="-target arm64-apple-macos11 -DGL_SILENCE_DEPRECATION" -B
|
||||
mv libraylib.a /tmp/libraylib_arm64.a
|
||||
make clean
|
||||
|
||||
# Join x86_64 and arm64 static
|
||||
lipo -create -output ../build/${{ env.RELEASE_NAME }}/lib/libraylib.a /tmp/libraylib_x86_64.a /tmp/libraylib_arm64.a
|
||||
|
||||
# Build raylib x86_64 dynamic
|
||||
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED CUSTOM_CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" CUSTOM_LDFLAGS="-target x86_64-apple-macos10.12" -B
|
||||
mv libraylib.${RAYLIB_VERSION}.dylib /tmp/libraylib_x86_64.${RAYLIB_VERSION}.dylib
|
||||
make clean
|
||||
|
||||
# Build raylib arm64 dynamic
|
||||
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED CUSTOM_CFLAGS="-target arm64-apple-macos11 -DGL_SILENCE_DEPRECATION" CUSTOM_LDFLAGS="-target arm64-apple-macos11" -B
|
||||
mv libraylib.${RAYLIB_VERSION}.dylib /tmp/libraylib_arm64.${RAYLIB_VERSION}.dylib
|
||||
|
||||
# Join x86_64 and arm64 dynamic
|
||||
lipo -create -output ../build/${{ env.RELEASE_NAME }}/lib/libraylib.${RAYLIB_VERSION}.dylib /tmp/libraylib_x86_64.${RAYLIB_VERSION}.dylib /tmp/libraylib_arm64.${RAYLIB_VERSION}.dylib
|
||||
ln -sv libraylib.${RAYLIB_VERSION}.dylib ../build/${{ env.RELEASE_NAME }}/lib/libraylib.dylib
|
||||
ln -sv libraylib.${RAYLIB_VERSION}.dylib ../build/${{ env.RELEASE_NAME }}/lib/libraylib.${RAYLIB_API_VERSION}.dylib
|
||||
cd ..
|
||||
|
||||
- name: Generate Artifacts
|
||||
run: |
|
||||
cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./src/raymath.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./src/rlgl.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./CHANGELOG ./build/${{ env.RELEASE_NAME }}/CHANGELOG
|
||||
cp -v ./README.md ./build/${{ env.RELEASE_NAME }}/README.md
|
||||
cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
|
||||
cd build
|
||||
tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
|
||||
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.RELEASE_NAME }}.tar.gz
|
||||
path: ./build/${{ env.RELEASE_NAME }}.tar.gz
|
||||
|
||||
- name: Upload Artifact to Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: ./build/${{ env.RELEASE_NAME }}.tar.gz
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
if: github.event_name == 'release' && github.event.action == 'published'
|
37
.github/workflows/parse.yml
vendored
37
.github/workflows/parse.yml
vendored
|
@ -1,37 +0,0 @@
|
|||
name: Parse raylib_api
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- "src/raylib.h"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Update parse files
|
||||
working-directory: parser
|
||||
run: |
|
||||
make raylib_api
|
||||
mv raylib_api.* output
|
||||
|
||||
- name: Diff parse files
|
||||
id: diff
|
||||
run: |
|
||||
git add -N parser
|
||||
git diff --name-only --exit-code
|
||||
continue-on-error: true
|
||||
|
||||
- name: Commit parse files
|
||||
if: steps.diff.outcome == 'failure'
|
||||
run: |
|
||||
set -x
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config user.name "github-actions[bot]"
|
||||
git add parser
|
||||
git commit -m "Update raylib_api.* by CI"
|
||||
git push
|
83
.github/workflows/webassembly.yml
vendored
83
.github/workflows/webassembly.yml
vendored
|
@ -1,83 +0,0 @@
|
|||
name: WebAssembly
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/webassembly.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/webassembly.yml'
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
|
||||
env:
|
||||
RELEASE_NAME: raylib-dev_webassembly
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Setup emsdk
|
||||
uses: mymindstorm/setup-emsdk@v14
|
||||
with:
|
||||
version: 3.1.71
|
||||
actions-cache-folder: 'emsdk-cache'
|
||||
|
||||
- name: Setup Release Version
|
||||
run: |
|
||||
echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_webassembly" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
if: github.event_name == 'release' && github.event.action == 'published'
|
||||
|
||||
- name: Setup Environment
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
mkdir ${{ env.RELEASE_NAME }}
|
||||
cd ${{ env.RELEASE_NAME }}
|
||||
mkdir include
|
||||
mkdir lib
|
||||
cd ../..
|
||||
|
||||
- name: Build Library
|
||||
run: |
|
||||
cd src
|
||||
emcc -v
|
||||
make PLATFORM=PLATFORM_WEB EMSDK_PATH="D:/a/raylib/raylib/emsdk-cache/emsdk-main" RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
|
||||
cd ..
|
||||
|
||||
- name: Generate Artifacts
|
||||
run: |
|
||||
copy /Y .\src\raylib.h .\build\${{ env.RELEASE_NAME }}\include\raylib.h
|
||||
copy /Y .\src\raymath.h .\build\${{ env.RELEASE_NAME }}\include\raymath.h
|
||||
copy /Y .\src\rlgl.h .\build\${{ env.RELEASE_NAME }}\include\rlgl.h
|
||||
copy /Y .\CHANGELOG .\build/${{ env.RELEASE_NAME }}\CHANGELOG
|
||||
copy /Y .\README.md .\build\${{ env.RELEASE_NAME }}\README.md
|
||||
copy /Y .\LICENSE .\build\${{ env.RELEASE_NAME }}\LICENSE
|
||||
cd build
|
||||
7z a ./${{ env.RELEASE_NAME }}.zip ./${{ env.RELEASE_NAME }}
|
||||
dir
|
||||
shell: cmd
|
||||
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.RELEASE_NAME }}.zip
|
||||
path: ./build/${{ env.RELEASE_NAME }}.zip
|
||||
|
||||
- name: Upload Artifact to Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: ./build/${{ env.RELEASE_NAME }}.zip
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
if: github.event_name == 'release' && github.event.action == 'published'
|
147
.github/workflows/windows.yml
vendored
147
.github/workflows/windows.yml
vendored
|
@ -1,147 +0,0 @@
|
|||
name: Windows
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/windows.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/windows.yml'
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
permissions:
|
||||
contents: write # for actions/upload-release-asset to upload release asset
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 1
|
||||
matrix:
|
||||
compiler: [mingw-w64, msvc16]
|
||||
bits: [32, 64]
|
||||
include:
|
||||
- compiler: mingw-w64
|
||||
bits: 32
|
||||
ARCH: "i686"
|
||||
WINDRES_ARCH: pe-i386
|
||||
- compiler: mingw-w64
|
||||
bits: 64
|
||||
ARCH: "x86_64"
|
||||
WINDRES_ARCH: pe-x86-64
|
||||
- compiler: msvc16
|
||||
bits: 32
|
||||
ARCH: "x86"
|
||||
VSARCHPATH: "Win32"
|
||||
- compiler: msvc16
|
||||
bits: 64
|
||||
ARCH: "x64"
|
||||
VSARCHPATH: "x64"
|
||||
|
||||
env:
|
||||
RELEASE_NAME: raylib-dev_win${{ matrix.bits }}_${{ matrix.compiler }}
|
||||
GNUTARGET: default
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Setup Release Version
|
||||
run: |
|
||||
echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_win${{ matrix.bits }}_${{ matrix.compiler }}" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
if: github.event_name == 'release' && github.event.action == 'published'
|
||||
|
||||
- name: Setup Environment
|
||||
run: |
|
||||
dir
|
||||
mkdir build
|
||||
cd build
|
||||
mkdir ${{ env.RELEASE_NAME }}
|
||||
cd ${{ env.RELEASE_NAME }}
|
||||
mkdir include
|
||||
mkdir lib
|
||||
cd ../../../raylib
|
||||
|
||||
# Setup MSBuild.exe path if required
|
||||
- name: Setup MSBuild
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
if: matrix.compiler == 'msvc16'
|
||||
|
||||
- name: Build Library (MinGW-w64 32bit)
|
||||
run: |
|
||||
cd src
|
||||
x86_64-w64-mingw32-gcc.exe --version
|
||||
windres.exe --version
|
||||
dir C:\msys64\mingw64\bin
|
||||
make PLATFORM=PLATFORM_DESKTOP CC=x86_64-w64-mingw32-gcc.exe RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CUSTOM_CFLAGS=-m32
|
||||
//windres.exe -i raylib.dll.rc -o raylib.dll.rc.data -O coff --target=${{ matrix.WINDRES_ARCH }}
|
||||
//make PLATFORM=PLATFORM_DESKTOP CC=${{ matrix.ARCH }}-w64-mingw32-gcc.exe RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
|
||||
cd ..
|
||||
shell: cmd
|
||||
if: |
|
||||
matrix.compiler == 'mingw-w64' &&
|
||||
matrix.bits == 32
|
||||
|
||||
- name: Build Library (MinGW-w64 64bit)
|
||||
run: |
|
||||
cd src
|
||||
${{ matrix.ARCH }}-w64-mingw32-gcc.exe --version
|
||||
windres.exe --version
|
||||
dir C:\msys64\mingw64\bin
|
||||
make PLATFORM=PLATFORM_DESKTOP CC=${{ matrix.ARCH }}-w64-mingw32-gcc.exe RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib"
|
||||
windres.exe -i raylib.dll.rc -o raylib.dll.rc.data -O coff --target=${{ matrix.WINDRES_ARCH }}
|
||||
make PLATFORM=PLATFORM_DESKTOP CC=${{ matrix.ARCH }}-w64-mingw32-gcc.exe RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
|
||||
cd ..
|
||||
shell: cmd
|
||||
if: |
|
||||
matrix.compiler == 'mingw-w64' &&
|
||||
matrix.bits == 64
|
||||
|
||||
- name: Build Library (MSVC16)
|
||||
run: |
|
||||
cd projects/VS2022
|
||||
msbuild.exe raylib.sln /target:raylib /property:Configuration=Release /property:Platform=${{ matrix.ARCH }}
|
||||
copy /Y .\build\raylib\bin\${{ matrix.VSARCHPATH }}\Release\raylib.lib .\..\..\build\${{ env.RELEASE_NAME }}\lib\raylib.lib
|
||||
msbuild.exe raylib.sln /target:raylib /property:Configuration=Release.DLL /property:Platform=${{ matrix.ARCH }}
|
||||
copy /Y .\build\raylib\bin\${{ matrix.VSARCHPATH }}\Release.DLL\raylib.dll .\..\..\build\${{ env.RELEASE_NAME }}\lib\raylib.dll
|
||||
copy /Y .\build\raylib\bin\${{ matrix.VSARCHPATH }}\Release.DLL\raylib.lib .\..\..\build\${{ env.RELEASE_NAME }}\lib\raylibdll.lib
|
||||
cd ../..
|
||||
shell: cmd
|
||||
if: matrix.compiler == 'msvc16'
|
||||
|
||||
- name: Generate Artifacts
|
||||
run: |
|
||||
copy /Y .\src\raylib.h .\build\${{ env.RELEASE_NAME }}\include\raylib.h
|
||||
copy /Y .\src\raymath.h .\build\${{ env.RELEASE_NAME }}\include\raymath.h
|
||||
copy /Y .\src\rlgl.h .\build\${{ env.RELEASE_NAME }}\include\rlgl.h
|
||||
copy /Y .\CHANGELOG .\build\${{ env.RELEASE_NAME }}\CHANGELOG
|
||||
copy /Y .\README.md .\build\${{ env.RELEASE_NAME }}\README.md
|
||||
copy /Y .\LICENSE .\build\${{ env.RELEASE_NAME }}\LICENSE
|
||||
cd build
|
||||
7z a ./${{ env.RELEASE_NAME }}.zip ./${{ env.RELEASE_NAME }}
|
||||
dir
|
||||
shell: cmd
|
||||
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.RELEASE_NAME }}.zip
|
||||
path: ./build/${{ env.RELEASE_NAME }}.zip
|
||||
|
||||
- name: Upload Artifact to Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: ./build/${{ env.RELEASE_NAME }}.zip
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
if: github.event_name == 'release' && github.event.action == 'published'
|
36
.github/workflows/windows_examples.yml
vendored
36
.github/workflows/windows_examples.yml
vendored
|
@ -1,36 +0,0 @@
|
|||
name: Windows Examples
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/windows_examples.yml'
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/windows_examples.yml'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Add MSBuild to PATH
|
||||
uses: microsoft/setup-msbuild@v1
|
||||
|
||||
- name: Build Library (MSVC16)
|
||||
run: |
|
||||
cd projects/VS2019
|
||||
msbuild.exe raylib.sln /property:Configuration=Release /property:Platform=x86
|
||||
cd ../..
|
||||
shell: cmd
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
# ## Config options ###
|
||||
### Config options ###
|
||||
include(CMakeDependentOption)
|
||||
include(EnumOption)
|
||||
|
||||
|
@ -27,6 +27,11 @@ option(GLFW_BUILD_X11 "Build the bundled GLFW with X11 support" ON)
|
|||
option(INCLUDE_EVERYTHING "Include everything disabled by default (for CI usage" OFF)
|
||||
set(OFF ${INCLUDE_EVERYTHING} CACHE INTERNAL "Replace any OFF by default with \${OFF} to have it covered by this option")
|
||||
|
||||
# DRM build options
|
||||
option(ENABLE_WAYLAND_DRM_LEASING "Enables DRM leasing in the DRM backend via the Wayland desktop" OFF)
|
||||
option(DISABLE_EVDEV_INPUT "Disable evdev input in the DRM backend" OFF)
|
||||
option(SUPPORT_SSH_KEYBOARD_RPI "Support using keyboard input from stdin" ON)
|
||||
|
||||
include(ParseConfigHeader)
|
||||
|
||||
foreach(FLAG IN LISTS CONFIG_HEADER_FLAGS)
|
||||
|
|
29
README.md
29
README.md
|
@ -1,9 +1,11 @@
|
|||
<img align="left" style="width:260px" src="https://github.com/raysan5/raylib/blob/master/logo/raylib_logo_animation.gif" width="288px">
|
||||
<img align="left" style="width:260px" src="https://git.terah.dev/imterah/raylib-drm-leasing/raw/branch/master/logo/raylib_logo_animation.gif" width="288px">
|
||||
|
||||
**raylib is a simple and easy-to-use library to enjoy videogames programming.**
|
||||
|
||||
raylib is highly inspired by Borland BGI graphics lib and by XNA framework and it's especially well suited for prototyping, tooling, graphical applications, embedded systems and education.
|
||||
|
||||
This is a fork of raylib designed to add DRM leasing support, which is used in [UnrealXR](https://git.terah.dev/imterah/unrealxr). Please go support the raylib developers!
|
||||
|
||||
*NOTE for ADVENTURERS: raylib is a programming library to enjoy videogames programming; no fancy interface, no visual helpers, no debug button... just coding in the most pure spartan-programmers way.*
|
||||
|
||||
Ready to learn? Jump to [code examples!](https://www.raylib.com/examples.html)
|
||||
|
@ -12,27 +14,6 @@ Ready to learn? Jump to [code examples!](https://www.raylib.com/examples.html)
|
|||
|
||||
<br>
|
||||
|
||||
[](https://github.com/raysan5/raylib/releases)
|
||||
[](https://github.com/raysan5/raylib/stargazers)
|
||||
[](https://github.com/raysan5/raylib/commits/master)
|
||||
[](https://github.com/sponsors/raysan5)
|
||||
[](https://repology.org/project/raylib/versions)
|
||||
[](LICENSE)
|
||||
|
||||
[](https://discord.gg/raylib)
|
||||
[](https://www.reddit.com/r/raylib/)
|
||||
[](https://www.youtube.com/c/raylib)
|
||||
[](https://www.twitch.tv/raysan5)
|
||||
|
||||
[](https://github.com/raysan5/raylib/actions?query=workflow%3AWindows)
|
||||
[](https://github.com/raysan5/raylib/actions?query=workflow%3ALinux)
|
||||
[](https://github.com/raysan5/raylib/actions?query=workflow%3AmacOS)
|
||||
[](https://github.com/raysan5/raylib/actions?query=workflow%3AWebAssembly)
|
||||
|
||||
[](https://github.com/raysan5/raylib/actions?query=workflow%3ACMakeBuilds)
|
||||
[](https://github.com/raysan5/raylib/actions/workflows/windows_examples.yml)
|
||||
[](https://github.com/raysan5/raylib/actions/workflows/linux_examples.yml)
|
||||
|
||||
features
|
||||
--------
|
||||
- **NO external dependencies**, all required libraries are [bundled into raylib](https://github.com/raysan5/raylib/tree/master/src/external)
|
||||
|
@ -42,7 +23,7 @@ features
|
|||
- **Unique OpenGL abstraction layer** (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h)
|
||||
- Multiple **Fonts** formats supported (TTF, OTF, FNT, BDF, sprite fonts)
|
||||
- Multiple texture formats supported, including **compressed formats** (DXT, ETC, ASTC)
|
||||
- **Full 3D support**, including 3D Shapes, Models, Billboards, Heightmaps and more!
|
||||
- **Full 3D support**, including 3D Shapes, Models, Billboards, Heightmaps and more!
|
||||
- Flexible Materials system, supporting classic maps and **PBR maps**
|
||||
- **Animated 3D models** supported (skeletal bones animation) (IQM, M3D, glTF)
|
||||
- Shaders support, including model shaders and **postprocessing** shaders
|
||||
|
@ -111,7 +92,7 @@ raylib has been developed on Windows platform using [Notepad++](https://notepad-
|
|||
learning and docs
|
||||
------------------
|
||||
|
||||
raylib is designed to be learned using [the examples](https://github.com/raysan5/raylib/tree/master/examples) as the main reference. There is no standard API documentation but there is a [**cheatsheet**](https://www.raylib.com/cheatsheet/cheatsheet.html) containing all the functions available on the library a short description of each one of them, input parameters and result value names should be intuitive enough to understand how each function works.
|
||||
raylib is designed to be learned using [the examples](https://github.com/raysan5/raylib/tree/master/examples) as the main reference. There is no standard API documentation but there is a [**cheatsheet**](https://www.raylib.com/cheatsheet/cheatsheet.html) containing all the functions available on the library a short description of each one of them, input parameters and result value names should be intuitive enough to understand how each function works.
|
||||
|
||||
Some additional documentation about raylib design can be found in [raylib GitHub Wiki](https://github.com/raysan5/raylib/wiki). Here are the relevant links:
|
||||
|
||||
|
|
|
@ -88,10 +88,29 @@ elseif ("${PLATFORM}" MATCHES "DRM")
|
|||
find_library(GBM gbm)
|
||||
|
||||
if (NOT CMAKE_CROSSCOMPILING OR NOT CMAKE_SYSROOT)
|
||||
include_directories(/usr/include/libdrm)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(DRM REQUIRED libdrm)
|
||||
include_directories(${DRM_INCLUDE_DIRS})
|
||||
endif ()
|
||||
set(LIBS_PRIVATE ${GLESV2} ${EGL} ${DRM} ${GBM} atomic pthread m dl)
|
||||
|
||||
if (ENABLE_WAYLAND_DRM_LEASING)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
add_definitions(-DENABLE_WAYLAND_DRM_LEASING)
|
||||
find_library(WAYLAND_CLIENT wayland-client)
|
||||
pkg_check_modules(WAYLAND_CLIENT_LIB REQUIRED wayland-client)
|
||||
include_directories(${WAYLAND_CLIENT_LIB})
|
||||
list(APPEND LIBS_PRIVATE ${WAYLAND_CLIENT})
|
||||
endif ()
|
||||
|
||||
if (DISABLE_EVDEV_INPUT)
|
||||
add_definitions(-DDISABLE_EVDEV_INPUT)
|
||||
endif ()
|
||||
|
||||
if (SUPPORT_SSH_KEYBOARD_RPI)
|
||||
add_definitions(-DSUPPORT_SSH_KEYBOARD_RPI)
|
||||
endif ()
|
||||
|
||||
elseif ("${PLATFORM}" MATCHES "SDL")
|
||||
find_package(SDL2 REQUIRED)
|
||||
set(PLATFORM_CPP "PLATFORM_DESKTOP_SDL")
|
||||
|
|
|
@ -474,6 +474,9 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
|||
# Libraries for DRM compiling
|
||||
# NOTE: Required packages: libasound2-dev (ALSA)
|
||||
LDLIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lgbm -ldrm -ldl -latomic
|
||||
ifeq ($(ENABLE_WAYLAND_DRM_LEASING), yes)
|
||||
LDFLAGS += $(shell pkg-config --libs wayland-client) -DENABLE_WAYLAND_DRM_LEASING
|
||||
endif
|
||||
endif
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
||||
# Libraries for web (HTML5) compiling
|
||||
|
|
|
@ -20,10 +20,12 @@ int main(void)
|
|||
{
|
||||
// Initialization
|
||||
//---------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
const int screenWidth = 1920;
|
||||
const int screenHeight = 1080;
|
||||
|
||||
SetTraceLogLevel(LOG_TRACE);
|
||||
SetConfigFlags(FLAG_MSAA_4X_HINT);
|
||||
SetTargetFPS(120); // Set our game to run at 60 frames-per-second
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - bouncing ball");
|
||||
|
||||
Vector2 ballPosition = { GetScreenWidth()/2.0f, GetScreenHeight()/2.0f };
|
||||
|
@ -33,7 +35,6 @@ int main(void)
|
|||
bool pause = 0;
|
||||
int framesCounter = 0;
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//----------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
|
@ -79,4 +80,4 @@ int main(void)
|
|||
//----------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
23
shell.nix
Normal file
23
shell.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
pkgs ? import <nixpkgs> { },
|
||||
}: pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
clang-tools
|
||||
pkg-config
|
||||
wayland-scanner
|
||||
wayland
|
||||
libGL
|
||||
libgbm
|
||||
libdrm
|
||||
xorg.libXi
|
||||
xorg.libXcursor
|
||||
xorg.libXrandr
|
||||
xorg.libXinerama
|
||||
xorg.libX11
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath [ pkgs.xorg.libX11 pkgs.libGL ]}:$LD_LIBRARY_PATH"
|
||||
export PKG_CONFIG_PATH="${pkgs.lib.makeLibraryPath [ pkgs.libGL pkgs.libgbm pkgs.libdrm ]}/pkgconfig:$PKG_CONFIG_PATH"
|
||||
'';
|
||||
}
|
|
@ -479,6 +479,10 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
|||
endif
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
||||
INCLUDE_PATHS += -I/usr/include/libdrm
|
||||
CFLAGS += $(shell pkg-config --cflags --libs libdrm)
|
||||
ifeq ($(ENABLE_WAYLAND_DRM_LEASING), yes)
|
||||
CFLAGS += $(shell pkg-config --cflags --libs wayland-client) -DENABLE_WAYLAND_DRM_LEASING
|
||||
endif
|
||||
ifeq ($(USE_RPI_CROSSCOMPILER), TRUE)
|
||||
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/usr/include
|
||||
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include
|
||||
|
@ -630,7 +634,7 @@ OBJS = rcore.o \
|
|||
rshapes.o \
|
||||
rtextures.o \
|
||||
rtext.o \
|
||||
utils.o
|
||||
utils.o
|
||||
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
||||
ifeq ($(USE_EXTERNAL_GLFW),FALSE)
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
// Mouse gestures are directly mapped like touches and processed by gestures system
|
||||
#define SUPPORT_MOUSE_GESTURES 1
|
||||
// Reconfigure standard input to receive key inputs, works with SSH connection.
|
||||
#define SUPPORT_SSH_KEYBOARD_RPI 1
|
||||
#define SUPPORT_SSH_KEYBOARD_RPI 0
|
||||
// Setting a higher resolution can improve the accuracy of time-out intervals in wait functions.
|
||||
// However, it can also reduce overall system performance, because the thread scheduler switches tasks more often.
|
||||
#define SUPPORT_WINMM_HIGHRES_TIMER 1
|
||||
|
|
116
src/platforms/drm-lease-v1.c
Normal file
116
src/platforms/drm-lease-v1.c
Normal file
|
@ -0,0 +1,116 @@
|
|||
/* Generated by wayland-scanner 1.23.1 */
|
||||
|
||||
/*
|
||||
* Copyright © 2018 NXP
|
||||
* Copyright © 2019 Status Research & Development GmbH.
|
||||
* Copyright © 2021 Xaver Hugl
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "wayland-util.h"
|
||||
|
||||
#ifndef __has_attribute
|
||||
# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
|
||||
#endif
|
||||
|
||||
#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4)
|
||||
#define WL_PRIVATE __attribute__ ((visibility("hidden")))
|
||||
#else
|
||||
#define WL_PRIVATE
|
||||
#endif
|
||||
|
||||
extern const struct wl_interface wp_drm_lease_connector_v1_interface;
|
||||
extern const struct wl_interface wp_drm_lease_request_v1_interface;
|
||||
extern const struct wl_interface wp_drm_lease_v1_interface;
|
||||
|
||||
static const struct wl_interface *drm_lease_v1_types[] = {
|
||||
NULL,
|
||||
&wp_drm_lease_request_v1_interface,
|
||||
&wp_drm_lease_connector_v1_interface,
|
||||
&wp_drm_lease_connector_v1_interface,
|
||||
&wp_drm_lease_v1_interface,
|
||||
};
|
||||
|
||||
static const struct wl_message wp_drm_lease_device_v1_requests[] = {
|
||||
{ "create_lease_request", "n", drm_lease_v1_types + 1 },
|
||||
{ "release", "", drm_lease_v1_types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message wp_drm_lease_device_v1_events[] = {
|
||||
{ "drm_fd", "h", drm_lease_v1_types + 0 },
|
||||
{ "connector", "n", drm_lease_v1_types + 2 },
|
||||
{ "done", "", drm_lease_v1_types + 0 },
|
||||
{ "released", "", drm_lease_v1_types + 0 },
|
||||
};
|
||||
|
||||
WL_PRIVATE const struct wl_interface wp_drm_lease_device_v1_interface = {
|
||||
"wp_drm_lease_device_v1", 1,
|
||||
2, wp_drm_lease_device_v1_requests,
|
||||
4, wp_drm_lease_device_v1_events,
|
||||
};
|
||||
|
||||
static const struct wl_message wp_drm_lease_connector_v1_requests[] = {
|
||||
{ "destroy", "", drm_lease_v1_types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message wp_drm_lease_connector_v1_events[] = {
|
||||
{ "name", "s", drm_lease_v1_types + 0 },
|
||||
{ "description", "s", drm_lease_v1_types + 0 },
|
||||
{ "connector_id", "u", drm_lease_v1_types + 0 },
|
||||
{ "done", "", drm_lease_v1_types + 0 },
|
||||
{ "withdrawn", "", drm_lease_v1_types + 0 },
|
||||
};
|
||||
|
||||
WL_PRIVATE const struct wl_interface wp_drm_lease_connector_v1_interface = {
|
||||
"wp_drm_lease_connector_v1", 1,
|
||||
1, wp_drm_lease_connector_v1_requests,
|
||||
5, wp_drm_lease_connector_v1_events,
|
||||
};
|
||||
|
||||
static const struct wl_message wp_drm_lease_request_v1_requests[] = {
|
||||
{ "request_connector", "o", drm_lease_v1_types + 3 },
|
||||
{ "submit", "n", drm_lease_v1_types + 4 },
|
||||
};
|
||||
|
||||
WL_PRIVATE const struct wl_interface wp_drm_lease_request_v1_interface = {
|
||||
"wp_drm_lease_request_v1", 1,
|
||||
2, wp_drm_lease_request_v1_requests,
|
||||
0, NULL,
|
||||
};
|
||||
|
||||
static const struct wl_message wp_drm_lease_v1_requests[] = {
|
||||
{ "destroy", "", drm_lease_v1_types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message wp_drm_lease_v1_events[] = {
|
||||
{ "lease_fd", "h", drm_lease_v1_types + 0 },
|
||||
{ "finished", "", drm_lease_v1_types + 0 },
|
||||
};
|
||||
|
||||
WL_PRIVATE const struct wl_interface wp_drm_lease_v1_interface = {
|
||||
"wp_drm_lease_v1", 1,
|
||||
1, wp_drm_lease_v1_requests,
|
||||
2, wp_drm_lease_v1_events,
|
||||
};
|
||||
|
743
src/platforms/drm-lease-v1.h
Normal file
743
src/platforms/drm-lease-v1.h
Normal file
|
@ -0,0 +1,743 @@
|
|||
/* Generated by wayland-scanner 1.23.1 */
|
||||
|
||||
#ifndef DRM_LEASE_V1_CLIENT_PROTOCOL_H
|
||||
#define DRM_LEASE_V1_CLIENT_PROTOCOL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "wayland-client.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @page page_drm_lease_v1 The drm_lease_v1 protocol
|
||||
* @section page_ifaces_drm_lease_v1 Interfaces
|
||||
* - @subpage page_iface_wp_drm_lease_device_v1 - lease device
|
||||
* - @subpage page_iface_wp_drm_lease_connector_v1 - a leasable DRM connector
|
||||
* - @subpage page_iface_wp_drm_lease_request_v1 - DRM lease request
|
||||
* - @subpage page_iface_wp_drm_lease_v1 - a DRM lease
|
||||
* @section page_copyright_drm_lease_v1 Copyright
|
||||
* <pre>
|
||||
*
|
||||
* Copyright © 2018 NXP
|
||||
* Copyright © 2019 Status Research & Development GmbH.
|
||||
* Copyright © 2021 Xaver Hugl
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
* </pre>
|
||||
*/
|
||||
struct wp_drm_lease_connector_v1;
|
||||
struct wp_drm_lease_device_v1;
|
||||
struct wp_drm_lease_request_v1;
|
||||
struct wp_drm_lease_v1;
|
||||
|
||||
#ifndef WP_DRM_LEASE_DEVICE_V1_INTERFACE
|
||||
#define WP_DRM_LEASE_DEVICE_V1_INTERFACE
|
||||
/**
|
||||
* @page page_iface_wp_drm_lease_device_v1 wp_drm_lease_device_v1
|
||||
* @section page_iface_wp_drm_lease_device_v1_desc Description
|
||||
*
|
||||
* This protocol is used by Wayland compositors which act as Direct
|
||||
* Rendering Manager (DRM) masters to lease DRM resources to Wayland
|
||||
* clients.
|
||||
*
|
||||
* The compositor will advertise one wp_drm_lease_device_v1 global for each
|
||||
* DRM node. Some time after a client binds to the wp_drm_lease_device_v1
|
||||
* global, the compositor will send a drm_fd event followed by zero, one or
|
||||
* more connector events. After all currently available connectors have been
|
||||
* sent, the compositor will send a wp_drm_lease_device_v1.done event.
|
||||
*
|
||||
* When the list of connectors available for lease changes the compositor
|
||||
* will send wp_drm_lease_device_v1.connector events for added connectors and
|
||||
* wp_drm_lease_connector_v1.withdrawn events for removed connectors,
|
||||
* followed by a wp_drm_lease_device_v1.done event.
|
||||
*
|
||||
* The compositor will indicate when a device is gone by removing the global
|
||||
* via a wl_registry.global_remove event. Upon receiving this event, the
|
||||
* client should destroy any matching wp_drm_lease_device_v1 object.
|
||||
*
|
||||
* To destroy a wp_drm_lease_device_v1 object, the client must first issue
|
||||
* a release request. Upon receiving this request, the compositor will
|
||||
* immediately send a released event and destroy the object. The client must
|
||||
* continue to process and discard drm_fd and connector events until it
|
||||
* receives the released event. Upon receiving the released event, the
|
||||
* client can safely cleanup any client-side resources.
|
||||
*
|
||||
* Warning! The protocol described in this file is currently in the testing
|
||||
* phase. Backward compatible changes may be added together with the
|
||||
* corresponding interface version bump. Backward incompatible changes can
|
||||
* only be done by creating a new major version of the extension.
|
||||
* @section page_iface_wp_drm_lease_device_v1_api API
|
||||
* See @ref iface_wp_drm_lease_device_v1.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_wp_drm_lease_device_v1 The wp_drm_lease_device_v1 interface
|
||||
*
|
||||
* This protocol is used by Wayland compositors which act as Direct
|
||||
* Rendering Manager (DRM) masters to lease DRM resources to Wayland
|
||||
* clients.
|
||||
*
|
||||
* The compositor will advertise one wp_drm_lease_device_v1 global for each
|
||||
* DRM node. Some time after a client binds to the wp_drm_lease_device_v1
|
||||
* global, the compositor will send a drm_fd event followed by zero, one or
|
||||
* more connector events. After all currently available connectors have been
|
||||
* sent, the compositor will send a wp_drm_lease_device_v1.done event.
|
||||
*
|
||||
* When the list of connectors available for lease changes the compositor
|
||||
* will send wp_drm_lease_device_v1.connector events for added connectors and
|
||||
* wp_drm_lease_connector_v1.withdrawn events for removed connectors,
|
||||
* followed by a wp_drm_lease_device_v1.done event.
|
||||
*
|
||||
* The compositor will indicate when a device is gone by removing the global
|
||||
* via a wl_registry.global_remove event. Upon receiving this event, the
|
||||
* client should destroy any matching wp_drm_lease_device_v1 object.
|
||||
*
|
||||
* To destroy a wp_drm_lease_device_v1 object, the client must first issue
|
||||
* a release request. Upon receiving this request, the compositor will
|
||||
* immediately send a released event and destroy the object. The client must
|
||||
* continue to process and discard drm_fd and connector events until it
|
||||
* receives the released event. Upon receiving the released event, the
|
||||
* client can safely cleanup any client-side resources.
|
||||
*
|
||||
* Warning! The protocol described in this file is currently in the testing
|
||||
* phase. Backward compatible changes may be added together with the
|
||||
* corresponding interface version bump. Backward incompatible changes can
|
||||
* only be done by creating a new major version of the extension.
|
||||
*/
|
||||
extern const struct wl_interface wp_drm_lease_device_v1_interface;
|
||||
#endif
|
||||
#ifndef WP_DRM_LEASE_CONNECTOR_V1_INTERFACE
|
||||
#define WP_DRM_LEASE_CONNECTOR_V1_INTERFACE
|
||||
/**
|
||||
* @page page_iface_wp_drm_lease_connector_v1 wp_drm_lease_connector_v1
|
||||
* @section page_iface_wp_drm_lease_connector_v1_desc Description
|
||||
*
|
||||
* Represents a DRM connector which is available for lease. These objects are
|
||||
* created via wp_drm_lease_device_v1.connector events, and should be passed
|
||||
* to lease requests via wp_drm_lease_request_v1.request_connector.
|
||||
* Immediately after the wp_drm_lease_connector_v1 object is created the
|
||||
* compositor will send a name, a description, a connector_id and a done
|
||||
* event. When the description is updated the compositor will send a
|
||||
* description event followed by a done event.
|
||||
* @section page_iface_wp_drm_lease_connector_v1_api API
|
||||
* See @ref iface_wp_drm_lease_connector_v1.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_wp_drm_lease_connector_v1 The wp_drm_lease_connector_v1 interface
|
||||
*
|
||||
* Represents a DRM connector which is available for lease. These objects are
|
||||
* created via wp_drm_lease_device_v1.connector events, and should be passed
|
||||
* to lease requests via wp_drm_lease_request_v1.request_connector.
|
||||
* Immediately after the wp_drm_lease_connector_v1 object is created the
|
||||
* compositor will send a name, a description, a connector_id and a done
|
||||
* event. When the description is updated the compositor will send a
|
||||
* description event followed by a done event.
|
||||
*/
|
||||
extern const struct wl_interface wp_drm_lease_connector_v1_interface;
|
||||
#endif
|
||||
#ifndef WP_DRM_LEASE_REQUEST_V1_INTERFACE
|
||||
#define WP_DRM_LEASE_REQUEST_V1_INTERFACE
|
||||
/**
|
||||
* @page page_iface_wp_drm_lease_request_v1 wp_drm_lease_request_v1
|
||||
* @section page_iface_wp_drm_lease_request_v1_desc Description
|
||||
*
|
||||
* A client that wishes to lease DRM resources will attach the list of
|
||||
* connectors advertised with wp_drm_lease_device_v1.connector that they
|
||||
* wish to lease, then use wp_drm_lease_request_v1.submit to submit the
|
||||
* request.
|
||||
* @section page_iface_wp_drm_lease_request_v1_api API
|
||||
* See @ref iface_wp_drm_lease_request_v1.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_wp_drm_lease_request_v1 The wp_drm_lease_request_v1 interface
|
||||
*
|
||||
* A client that wishes to lease DRM resources will attach the list of
|
||||
* connectors advertised with wp_drm_lease_device_v1.connector that they
|
||||
* wish to lease, then use wp_drm_lease_request_v1.submit to submit the
|
||||
* request.
|
||||
*/
|
||||
extern const struct wl_interface wp_drm_lease_request_v1_interface;
|
||||
#endif
|
||||
#ifndef WP_DRM_LEASE_V1_INTERFACE
|
||||
#define WP_DRM_LEASE_V1_INTERFACE
|
||||
/**
|
||||
* @page page_iface_wp_drm_lease_v1 wp_drm_lease_v1
|
||||
* @section page_iface_wp_drm_lease_v1_desc Description
|
||||
*
|
||||
* A DRM lease object is used to transfer the DRM file descriptor to the
|
||||
* client and manage the lifetime of the lease.
|
||||
*
|
||||
* Some time after the wp_drm_lease_v1 object is created, the compositor
|
||||
* will reply with the lease request's result. If the lease request is
|
||||
* granted, the compositor will send a lease_fd event. If the lease request
|
||||
* is denied, the compositor will send a finished event without a lease_fd
|
||||
* event.
|
||||
* @section page_iface_wp_drm_lease_v1_api API
|
||||
* See @ref iface_wp_drm_lease_v1.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_wp_drm_lease_v1 The wp_drm_lease_v1 interface
|
||||
*
|
||||
* A DRM lease object is used to transfer the DRM file descriptor to the
|
||||
* client and manage the lifetime of the lease.
|
||||
*
|
||||
* Some time after the wp_drm_lease_v1 object is created, the compositor
|
||||
* will reply with the lease request's result. If the lease request is
|
||||
* granted, the compositor will send a lease_fd event. If the lease request
|
||||
* is denied, the compositor will send a finished event without a lease_fd
|
||||
* event.
|
||||
*/
|
||||
extern const struct wl_interface wp_drm_lease_v1_interface;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_device_v1
|
||||
* @struct wp_drm_lease_device_v1_listener
|
||||
*/
|
||||
struct wp_drm_lease_device_v1_listener {
|
||||
/**
|
||||
* open a non-master fd for this DRM node
|
||||
*
|
||||
* The compositor will send this event when the
|
||||
* wp_drm_lease_device_v1 global is bound, although there are no
|
||||
* guarantees as to how long this takes - the compositor might need
|
||||
* to wait until regaining DRM master. The included fd is a
|
||||
* non-master DRM file descriptor opened for this device and the
|
||||
* compositor must not authenticate it. The purpose of this event
|
||||
* is to give the client the ability to query DRM and discover
|
||||
* information which may help them pick the appropriate DRM device
|
||||
* or select the appropriate connectors therein.
|
||||
* @param fd DRM file descriptor
|
||||
*/
|
||||
void (*drm_fd)(void *data,
|
||||
struct wp_drm_lease_device_v1 *wp_drm_lease_device_v1,
|
||||
int32_t fd);
|
||||
/**
|
||||
* advertise connectors available for leases
|
||||
*
|
||||
* The compositor will use this event to advertise connectors
|
||||
* available for lease by clients. This object may be passed into a
|
||||
* lease request to indicate the client would like to lease that
|
||||
* connector, see wp_drm_lease_request_v1.request_connector for
|
||||
* details. While the compositor will make a best effort to not
|
||||
* send disconnected connectors, no guarantees can be made.
|
||||
*
|
||||
* The compositor must send the drm_fd event before sending
|
||||
* connectors. After the drm_fd event it will send all available
|
||||
* connectors but may send additional connectors at any time.
|
||||
*/
|
||||
void (*connector)(void *data,
|
||||
struct wp_drm_lease_device_v1 *wp_drm_lease_device_v1,
|
||||
struct wp_drm_lease_connector_v1 *id);
|
||||
/**
|
||||
* signals grouping of connectors
|
||||
*
|
||||
* The compositor will send this event to indicate that it has
|
||||
* sent all currently available connectors after the client binds
|
||||
* to the global or when it updates the connector list, for example
|
||||
* on hotplug, drm master change or when a leased connector becomes
|
||||
* available again. It will similarly send this event to group
|
||||
* wp_drm_lease_connector_v1.withdrawn events of connectors of this
|
||||
* device.
|
||||
*/
|
||||
void (*done)(void *data,
|
||||
struct wp_drm_lease_device_v1 *wp_drm_lease_device_v1);
|
||||
/**
|
||||
* the compositor has finished using the device
|
||||
*
|
||||
* This event is sent in response to the release request and
|
||||
* indicates that the compositor is done sending connector events.
|
||||
* The compositor will destroy this object immediately after
|
||||
* sending the event and it will become invalid. The client should
|
||||
* release any resources associated with this device after
|
||||
* receiving this event.
|
||||
*/
|
||||
void (*released)(void *data,
|
||||
struct wp_drm_lease_device_v1 *wp_drm_lease_device_v1);
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_device_v1
|
||||
*/
|
||||
static inline int
|
||||
wp_drm_lease_device_v1_add_listener(struct wp_drm_lease_device_v1 *wp_drm_lease_device_v1,
|
||||
const struct wp_drm_lease_device_v1_listener *listener, void *data)
|
||||
{
|
||||
return wl_proxy_add_listener((struct wl_proxy *) wp_drm_lease_device_v1,
|
||||
(void (**)(void)) listener, data);
|
||||
}
|
||||
|
||||
#define WP_DRM_LEASE_DEVICE_V1_CREATE_LEASE_REQUEST 0
|
||||
#define WP_DRM_LEASE_DEVICE_V1_RELEASE 1
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_device_v1
|
||||
*/
|
||||
#define WP_DRM_LEASE_DEVICE_V1_DRM_FD_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_device_v1
|
||||
*/
|
||||
#define WP_DRM_LEASE_DEVICE_V1_CONNECTOR_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_device_v1
|
||||
*/
|
||||
#define WP_DRM_LEASE_DEVICE_V1_DONE_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_device_v1
|
||||
*/
|
||||
#define WP_DRM_LEASE_DEVICE_V1_RELEASED_SINCE_VERSION 1
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_device_v1
|
||||
*/
|
||||
#define WP_DRM_LEASE_DEVICE_V1_CREATE_LEASE_REQUEST_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_device_v1
|
||||
*/
|
||||
#define WP_DRM_LEASE_DEVICE_V1_RELEASE_SINCE_VERSION 1
|
||||
|
||||
/** @ingroup iface_wp_drm_lease_device_v1 */
|
||||
static inline void
|
||||
wp_drm_lease_device_v1_set_user_data(struct wp_drm_lease_device_v1 *wp_drm_lease_device_v1, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) wp_drm_lease_device_v1, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_wp_drm_lease_device_v1 */
|
||||
static inline void *
|
||||
wp_drm_lease_device_v1_get_user_data(struct wp_drm_lease_device_v1 *wp_drm_lease_device_v1)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) wp_drm_lease_device_v1);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
wp_drm_lease_device_v1_get_version(struct wp_drm_lease_device_v1 *wp_drm_lease_device_v1)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) wp_drm_lease_device_v1);
|
||||
}
|
||||
|
||||
/** @ingroup iface_wp_drm_lease_device_v1 */
|
||||
static inline void
|
||||
wp_drm_lease_device_v1_destroy(struct wp_drm_lease_device_v1 *wp_drm_lease_device_v1)
|
||||
{
|
||||
wl_proxy_destroy((struct wl_proxy *) wp_drm_lease_device_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_device_v1
|
||||
*
|
||||
* Creates a lease request object.
|
||||
*
|
||||
* See the documentation for wp_drm_lease_request_v1 for details.
|
||||
*/
|
||||
static inline struct wp_drm_lease_request_v1 *
|
||||
wp_drm_lease_device_v1_create_lease_request(struct wp_drm_lease_device_v1 *wp_drm_lease_device_v1)
|
||||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_flags((struct wl_proxy *) wp_drm_lease_device_v1,
|
||||
WP_DRM_LEASE_DEVICE_V1_CREATE_LEASE_REQUEST, &wp_drm_lease_request_v1_interface, wl_proxy_get_version((struct wl_proxy *) wp_drm_lease_device_v1), 0, NULL);
|
||||
|
||||
return (struct wp_drm_lease_request_v1 *) id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_device_v1
|
||||
*
|
||||
* Indicates the client no longer wishes to use this object. In response
|
||||
* the compositor will immediately send the released event and destroy
|
||||
* this object. It can however not guarantee that the client won't receive
|
||||
* connector events before the released event. The client must not send any
|
||||
* requests after this one, doing so will raise a wl_display error.
|
||||
* Existing connectors, lease request and leases will not be affected.
|
||||
*/
|
||||
static inline void
|
||||
wp_drm_lease_device_v1_release(struct wp_drm_lease_device_v1 *wp_drm_lease_device_v1)
|
||||
{
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) wp_drm_lease_device_v1,
|
||||
WP_DRM_LEASE_DEVICE_V1_RELEASE, NULL, wl_proxy_get_version((struct wl_proxy *) wp_drm_lease_device_v1), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_connector_v1
|
||||
* @struct wp_drm_lease_connector_v1_listener
|
||||
*/
|
||||
struct wp_drm_lease_connector_v1_listener {
|
||||
/**
|
||||
* name
|
||||
*
|
||||
* The compositor sends this event once the connector is created
|
||||
* to indicate the name of this connector. This will not change for
|
||||
* the duration of the Wayland session, but is not guaranteed to be
|
||||
* consistent between sessions.
|
||||
*
|
||||
* If the compositor supports wl_output version 4 and this
|
||||
* connector corresponds to a wl_output, the compositor should use
|
||||
* the same name as for the wl_output.
|
||||
* @param name connector name
|
||||
*/
|
||||
void (*name)(void *data,
|
||||
struct wp_drm_lease_connector_v1 *wp_drm_lease_connector_v1,
|
||||
const char *name);
|
||||
/**
|
||||
* description
|
||||
*
|
||||
* The compositor sends this event once the connector is created
|
||||
* to provide a human-readable description for this connector,
|
||||
* which may be presented to the user. The compositor may send this
|
||||
* event multiple times over the lifetime of this object to reflect
|
||||
* changes in the description.
|
||||
* @param description connector description
|
||||
*/
|
||||
void (*description)(void *data,
|
||||
struct wp_drm_lease_connector_v1 *wp_drm_lease_connector_v1,
|
||||
const char *description);
|
||||
/**
|
||||
* connector_id
|
||||
*
|
||||
* The compositor sends this event once the connector is created
|
||||
* to indicate the DRM object ID which represents the underlying
|
||||
* connector that is being offered. Note that the final lease may
|
||||
* include additional object IDs, such as CRTCs and planes.
|
||||
* @param connector_id DRM connector ID
|
||||
*/
|
||||
void (*connector_id)(void *data,
|
||||
struct wp_drm_lease_connector_v1 *wp_drm_lease_connector_v1,
|
||||
uint32_t connector_id);
|
||||
/**
|
||||
* all properties have been sent
|
||||
*
|
||||
* This event is sent after all properties of a connector have
|
||||
* been sent. This allows changes to the properties to be seen as
|
||||
* atomic even if they happen via multiple events.
|
||||
*/
|
||||
void (*done)(void *data,
|
||||
struct wp_drm_lease_connector_v1 *wp_drm_lease_connector_v1);
|
||||
/**
|
||||
* lease offer withdrawn
|
||||
*
|
||||
* Sent to indicate that the compositor will no longer honor
|
||||
* requests for DRM leases which include this connector. The client
|
||||
* may still issue a lease request including this connector, but
|
||||
* the compositor will send wp_drm_lease_v1.finished without
|
||||
* issuing a lease fd. Compositors are encouraged to send this
|
||||
* event when they lose access to connector, for example when the
|
||||
* connector is hot-unplugged, when the connector gets leased to a
|
||||
* client or when the compositor loses DRM master.
|
||||
*
|
||||
* If a client holds a lease for the connector, the status of the
|
||||
* lease remains the same. The client should destroy the object
|
||||
* after receiving this event.
|
||||
*/
|
||||
void (*withdrawn)(void *data,
|
||||
struct wp_drm_lease_connector_v1 *wp_drm_lease_connector_v1);
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_connector_v1
|
||||
*/
|
||||
static inline int
|
||||
wp_drm_lease_connector_v1_add_listener(struct wp_drm_lease_connector_v1 *wp_drm_lease_connector_v1,
|
||||
const struct wp_drm_lease_connector_v1_listener *listener, void *data)
|
||||
{
|
||||
return wl_proxy_add_listener((struct wl_proxy *) wp_drm_lease_connector_v1,
|
||||
(void (**)(void)) listener, data);
|
||||
}
|
||||
|
||||
#define WP_DRM_LEASE_CONNECTOR_V1_DESTROY 0
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_connector_v1
|
||||
*/
|
||||
#define WP_DRM_LEASE_CONNECTOR_V1_NAME_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_connector_v1
|
||||
*/
|
||||
#define WP_DRM_LEASE_CONNECTOR_V1_DESCRIPTION_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_connector_v1
|
||||
*/
|
||||
#define WP_DRM_LEASE_CONNECTOR_V1_CONNECTOR_ID_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_connector_v1
|
||||
*/
|
||||
#define WP_DRM_LEASE_CONNECTOR_V1_DONE_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_connector_v1
|
||||
*/
|
||||
#define WP_DRM_LEASE_CONNECTOR_V1_WITHDRAWN_SINCE_VERSION 1
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_connector_v1
|
||||
*/
|
||||
#define WP_DRM_LEASE_CONNECTOR_V1_DESTROY_SINCE_VERSION 1
|
||||
|
||||
/** @ingroup iface_wp_drm_lease_connector_v1 */
|
||||
static inline void
|
||||
wp_drm_lease_connector_v1_set_user_data(struct wp_drm_lease_connector_v1 *wp_drm_lease_connector_v1, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) wp_drm_lease_connector_v1, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_wp_drm_lease_connector_v1 */
|
||||
static inline void *
|
||||
wp_drm_lease_connector_v1_get_user_data(struct wp_drm_lease_connector_v1 *wp_drm_lease_connector_v1)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) wp_drm_lease_connector_v1);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
wp_drm_lease_connector_v1_get_version(struct wp_drm_lease_connector_v1 *wp_drm_lease_connector_v1)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) wp_drm_lease_connector_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_connector_v1
|
||||
*
|
||||
* The client may send this request to indicate that it will not use this
|
||||
* connector. Clients are encouraged to send this after receiving the
|
||||
* "withdrawn" event so that the server can release the resources
|
||||
* associated with this connector offer. Neither existing lease requests
|
||||
* nor leases will be affected.
|
||||
*/
|
||||
static inline void
|
||||
wp_drm_lease_connector_v1_destroy(struct wp_drm_lease_connector_v1 *wp_drm_lease_connector_v1)
|
||||
{
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) wp_drm_lease_connector_v1,
|
||||
WP_DRM_LEASE_CONNECTOR_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wp_drm_lease_connector_v1), WL_MARSHAL_FLAG_DESTROY);
|
||||
}
|
||||
|
||||
#ifndef WP_DRM_LEASE_REQUEST_V1_ERROR_ENUM
|
||||
#define WP_DRM_LEASE_REQUEST_V1_ERROR_ENUM
|
||||
enum wp_drm_lease_request_v1_error {
|
||||
/**
|
||||
* requested a connector from a different lease device
|
||||
*/
|
||||
WP_DRM_LEASE_REQUEST_V1_ERROR_WRONG_DEVICE = 0,
|
||||
/**
|
||||
* requested a connector twice
|
||||
*/
|
||||
WP_DRM_LEASE_REQUEST_V1_ERROR_DUPLICATE_CONNECTOR = 1,
|
||||
/**
|
||||
* requested a lease without requesting a connector
|
||||
*/
|
||||
WP_DRM_LEASE_REQUEST_V1_ERROR_EMPTY_LEASE = 2,
|
||||
};
|
||||
#endif /* WP_DRM_LEASE_REQUEST_V1_ERROR_ENUM */
|
||||
|
||||
#define WP_DRM_LEASE_REQUEST_V1_REQUEST_CONNECTOR 0
|
||||
#define WP_DRM_LEASE_REQUEST_V1_SUBMIT 1
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_request_v1
|
||||
*/
|
||||
#define WP_DRM_LEASE_REQUEST_V1_REQUEST_CONNECTOR_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_request_v1
|
||||
*/
|
||||
#define WP_DRM_LEASE_REQUEST_V1_SUBMIT_SINCE_VERSION 1
|
||||
|
||||
/** @ingroup iface_wp_drm_lease_request_v1 */
|
||||
static inline void
|
||||
wp_drm_lease_request_v1_set_user_data(struct wp_drm_lease_request_v1 *wp_drm_lease_request_v1, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) wp_drm_lease_request_v1, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_wp_drm_lease_request_v1 */
|
||||
static inline void *
|
||||
wp_drm_lease_request_v1_get_user_data(struct wp_drm_lease_request_v1 *wp_drm_lease_request_v1)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) wp_drm_lease_request_v1);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
wp_drm_lease_request_v1_get_version(struct wp_drm_lease_request_v1 *wp_drm_lease_request_v1)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) wp_drm_lease_request_v1);
|
||||
}
|
||||
|
||||
/** @ingroup iface_wp_drm_lease_request_v1 */
|
||||
static inline void
|
||||
wp_drm_lease_request_v1_destroy(struct wp_drm_lease_request_v1 *wp_drm_lease_request_v1)
|
||||
{
|
||||
wl_proxy_destroy((struct wl_proxy *) wp_drm_lease_request_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_request_v1
|
||||
*
|
||||
* Indicates that the client would like to lease the given connector.
|
||||
* This is only used as a suggestion, the compositor may choose to
|
||||
* include any resources in the lease it issues, or change the set of
|
||||
* leased resources at any time. Compositors are however encouraged to
|
||||
* include the requested connector and other resources necessary
|
||||
* to drive the connected output in the lease.
|
||||
*
|
||||
* Requesting a connector that was created from a different lease device
|
||||
* than this lease request raises the wrong_device error. Requesting a
|
||||
* connector twice will raise the duplicate_connector error.
|
||||
*/
|
||||
static inline void
|
||||
wp_drm_lease_request_v1_request_connector(struct wp_drm_lease_request_v1 *wp_drm_lease_request_v1, struct wp_drm_lease_connector_v1 *connector)
|
||||
{
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) wp_drm_lease_request_v1,
|
||||
WP_DRM_LEASE_REQUEST_V1_REQUEST_CONNECTOR, NULL, wl_proxy_get_version((struct wl_proxy *) wp_drm_lease_request_v1), 0, connector);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_request_v1
|
||||
*
|
||||
* Submits the lease request and creates a new wp_drm_lease_v1 object.
|
||||
* After calling submit the compositor will immediately destroy this
|
||||
* object, issuing any more requests will cause a wl_display error.
|
||||
* The compositor doesn't make any guarantees about the events of the
|
||||
* lease object, clients cannot expect an immediate response.
|
||||
* Not requesting any connectors before submitting the lease request
|
||||
* will raise the empty_lease error.
|
||||
*/
|
||||
static inline struct wp_drm_lease_v1 *
|
||||
wp_drm_lease_request_v1_submit(struct wp_drm_lease_request_v1 *wp_drm_lease_request_v1)
|
||||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_flags((struct wl_proxy *) wp_drm_lease_request_v1,
|
||||
WP_DRM_LEASE_REQUEST_V1_SUBMIT, &wp_drm_lease_v1_interface, wl_proxy_get_version((struct wl_proxy *) wp_drm_lease_request_v1), WL_MARSHAL_FLAG_DESTROY, NULL);
|
||||
|
||||
return (struct wp_drm_lease_v1 *) id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_v1
|
||||
* @struct wp_drm_lease_v1_listener
|
||||
*/
|
||||
struct wp_drm_lease_v1_listener {
|
||||
/**
|
||||
* shares the DRM file descriptor
|
||||
*
|
||||
* This event returns a file descriptor suitable for use with
|
||||
* DRM-related ioctls. The client should use drmModeGetLease to
|
||||
* enumerate the DRM objects which have been leased to them. The
|
||||
* compositor guarantees it will not use the leased DRM objects
|
||||
* itself until it sends the finished event. If the compositor
|
||||
* cannot or will not grant a lease for the requested connectors,
|
||||
* it will not send this event, instead sending the finished event.
|
||||
*
|
||||
* The compositor will send this event at most once during this
|
||||
* objects lifetime.
|
||||
* @param leased_fd leased DRM file descriptor
|
||||
*/
|
||||
void (*lease_fd)(void *data,
|
||||
struct wp_drm_lease_v1 *wp_drm_lease_v1,
|
||||
int32_t leased_fd);
|
||||
/**
|
||||
* sent when the lease has been revoked
|
||||
*
|
||||
* The compositor uses this event to either reject a lease
|
||||
* request, or if it previously sent a lease_fd, to notify the
|
||||
* client that the lease has been revoked. If the client requires a
|
||||
* new lease, they should destroy this object and submit a new
|
||||
* lease request. The compositor will send no further events for
|
||||
* this object after sending the finish event. Compositors should
|
||||
* revoke the lease when any of the leased resources become
|
||||
* unavailable, namely when a hot-unplug occurs or when the
|
||||
* compositor loses DRM master. Compositors may advertise the
|
||||
* connector for leasing again, if the resource is available, by
|
||||
* sending the connector event through the wp_drm_lease_device_v1
|
||||
* interface.
|
||||
*/
|
||||
void (*finished)(void *data,
|
||||
struct wp_drm_lease_v1 *wp_drm_lease_v1);
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_v1
|
||||
*/
|
||||
static inline int
|
||||
wp_drm_lease_v1_add_listener(struct wp_drm_lease_v1 *wp_drm_lease_v1,
|
||||
const struct wp_drm_lease_v1_listener *listener, void *data)
|
||||
{
|
||||
return wl_proxy_add_listener((struct wl_proxy *) wp_drm_lease_v1,
|
||||
(void (**)(void)) listener, data);
|
||||
}
|
||||
|
||||
#define WP_DRM_LEASE_V1_DESTROY 0
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_v1
|
||||
*/
|
||||
#define WP_DRM_LEASE_V1_LEASE_FD_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_v1
|
||||
*/
|
||||
#define WP_DRM_LEASE_V1_FINISHED_SINCE_VERSION 1
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_v1
|
||||
*/
|
||||
#define WP_DRM_LEASE_V1_DESTROY_SINCE_VERSION 1
|
||||
|
||||
/** @ingroup iface_wp_drm_lease_v1 */
|
||||
static inline void
|
||||
wp_drm_lease_v1_set_user_data(struct wp_drm_lease_v1 *wp_drm_lease_v1, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) wp_drm_lease_v1, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_wp_drm_lease_v1 */
|
||||
static inline void *
|
||||
wp_drm_lease_v1_get_user_data(struct wp_drm_lease_v1 *wp_drm_lease_v1)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) wp_drm_lease_v1);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
wp_drm_lease_v1_get_version(struct wp_drm_lease_v1 *wp_drm_lease_v1)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) wp_drm_lease_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_drm_lease_v1
|
||||
*
|
||||
* The client should send this to indicate that it no longer wishes to use
|
||||
* this lease. The compositor should use drmModeRevokeLease on the
|
||||
* appropriate file descriptor, if necessary.
|
||||
*
|
||||
* Upon destruction, the compositor should advertise the connector for
|
||||
* leasing again by sending the connector event through the
|
||||
* wp_drm_lease_device_v1 interface.
|
||||
*/
|
||||
static inline void
|
||||
wp_drm_lease_v1_destroy(struct wp_drm_lease_v1 *wp_drm_lease_v1)
|
||||
{
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) wp_drm_lease_v1,
|
||||
WP_DRM_LEASE_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wp_drm_lease_v1), WL_MARSHAL_FLAG_DESTROY);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
317
src/platforms/drm-lease-v1.xml
Normal file
317
src/platforms/drm-lease-v1.xml
Normal file
|
@ -0,0 +1,317 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="drm_lease_v1">
|
||||
<copyright>
|
||||
Copyright © 2018 NXP
|
||||
Copyright © 2019 Status Research & Development GmbH.
|
||||
Copyright © 2021 Xaver Hugl
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next
|
||||
paragraph) shall be included in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<interface name="wp_drm_lease_device_v1" version="1">
|
||||
<description summary="lease device">
|
||||
This protocol is used by Wayland compositors which act as Direct
|
||||
Rendering Manager (DRM) masters to lease DRM resources to Wayland
|
||||
clients.
|
||||
|
||||
The compositor will advertise one wp_drm_lease_device_v1 global for each
|
||||
DRM node. Some time after a client binds to the wp_drm_lease_device_v1
|
||||
global, the compositor will send a drm_fd event followed by zero, one or
|
||||
more connector events. After all currently available connectors have been
|
||||
sent, the compositor will send a wp_drm_lease_device_v1.done event.
|
||||
|
||||
When the list of connectors available for lease changes the compositor
|
||||
will send wp_drm_lease_device_v1.connector events for added connectors and
|
||||
wp_drm_lease_connector_v1.withdrawn events for removed connectors,
|
||||
followed by a wp_drm_lease_device_v1.done event.
|
||||
|
||||
The compositor will indicate when a device is gone by removing the global
|
||||
via a wl_registry.global_remove event. Upon receiving this event, the
|
||||
client should destroy any matching wp_drm_lease_device_v1 object.
|
||||
|
||||
To destroy a wp_drm_lease_device_v1 object, the client must first issue
|
||||
a release request. Upon receiving this request, the compositor will
|
||||
immediately send a released event and destroy the object. The client must
|
||||
continue to process and discard drm_fd and connector events until it
|
||||
receives the released event. Upon receiving the released event, the
|
||||
client can safely cleanup any client-side resources.
|
||||
|
||||
Warning! The protocol described in this file is currently in the testing
|
||||
phase. Backward compatible changes may be added together with the
|
||||
corresponding interface version bump. Backward incompatible changes can
|
||||
only be done by creating a new major version of the extension.
|
||||
</description>
|
||||
|
||||
<request name="create_lease_request">
|
||||
<description summary="create a lease request object">
|
||||
Creates a lease request object.
|
||||
|
||||
See the documentation for wp_drm_lease_request_v1 for details.
|
||||
</description>
|
||||
<arg name="id" type="new_id" interface="wp_drm_lease_request_v1" />
|
||||
</request>
|
||||
|
||||
<request name="release">
|
||||
<description summary="release this object">
|
||||
Indicates the client no longer wishes to use this object. In response
|
||||
the compositor will immediately send the released event and destroy
|
||||
this object. It can however not guarantee that the client won't receive
|
||||
connector events before the released event. The client must not send any
|
||||
requests after this one, doing so will raise a wl_display error.
|
||||
Existing connectors, lease request and leases will not be affected.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<event name="drm_fd">
|
||||
<description summary="open a non-master fd for this DRM node">
|
||||
The compositor will send this event when the wp_drm_lease_device_v1
|
||||
global is bound, although there are no guarantees as to how long this
|
||||
takes - the compositor might need to wait until regaining DRM master.
|
||||
The included fd is a non-master DRM file descriptor opened for this
|
||||
device and the compositor must not authenticate it.
|
||||
The purpose of this event is to give the client the ability to
|
||||
query DRM and discover information which may help them pick the
|
||||
appropriate DRM device or select the appropriate connectors therein.
|
||||
</description>
|
||||
<arg name="fd" type="fd" summary="DRM file descriptor" />
|
||||
</event>
|
||||
|
||||
<event name="connector">
|
||||
<description summary="advertise connectors available for leases">
|
||||
The compositor will use this event to advertise connectors available for
|
||||
lease by clients. This object may be passed into a lease request to
|
||||
indicate the client would like to lease that connector, see
|
||||
wp_drm_lease_request_v1.request_connector for details. While the
|
||||
compositor will make a best effort to not send disconnected connectors,
|
||||
no guarantees can be made.
|
||||
|
||||
The compositor must send the drm_fd event before sending connectors.
|
||||
After the drm_fd event it will send all available connectors but may
|
||||
send additional connectors at any time.
|
||||
</description>
|
||||
<arg name="id" type="new_id" interface="wp_drm_lease_connector_v1" />
|
||||
</event>
|
||||
|
||||
<event name="done">
|
||||
<description summary="signals grouping of connectors">
|
||||
The compositor will send this event to indicate that it has sent all
|
||||
currently available connectors after the client binds to the global or
|
||||
when it updates the connector list, for example on hotplug, drm master
|
||||
change or when a leased connector becomes available again. It will
|
||||
similarly send this event to group wp_drm_lease_connector_v1.withdrawn
|
||||
events of connectors of this device.
|
||||
</description>
|
||||
</event>
|
||||
|
||||
<event name="released" type="destructor">
|
||||
<description summary="the compositor has finished using the device">
|
||||
This event is sent in response to the release request and indicates
|
||||
that the compositor is done sending connector events.
|
||||
The compositor will destroy this object immediately after sending the
|
||||
event and it will become invalid. The client should release any
|
||||
resources associated with this device after receiving this event.
|
||||
</description>
|
||||
</event>
|
||||
</interface>
|
||||
|
||||
<interface name="wp_drm_lease_connector_v1" version="1">
|
||||
<description summary="a leasable DRM connector">
|
||||
Represents a DRM connector which is available for lease. These objects are
|
||||
created via wp_drm_lease_device_v1.connector events, and should be passed
|
||||
to lease requests via wp_drm_lease_request_v1.request_connector.
|
||||
Immediately after the wp_drm_lease_connector_v1 object is created the
|
||||
compositor will send a name, a description, a connector_id and a done
|
||||
event. When the description is updated the compositor will send a
|
||||
description event followed by a done event.
|
||||
</description>
|
||||
|
||||
<event name="name">
|
||||
<description summary="name">
|
||||
The compositor sends this event once the connector is created to
|
||||
indicate the name of this connector. This will not change for the
|
||||
duration of the Wayland session, but is not guaranteed to be consistent
|
||||
between sessions.
|
||||
|
||||
If the compositor supports wl_output version 4 and this connector
|
||||
corresponds to a wl_output, the compositor should use the same name as
|
||||
for the wl_output.
|
||||
</description>
|
||||
<arg name="name" type="string" summary="connector name" />
|
||||
</event>
|
||||
|
||||
<event name="description">
|
||||
<description summary="description">
|
||||
The compositor sends this event once the connector is created to provide
|
||||
a human-readable description for this connector, which may be presented
|
||||
to the user. The compositor may send this event multiple times over the
|
||||
lifetime of this object to reflect changes in the description.
|
||||
</description>
|
||||
<arg name="description" type="string" summary="connector description" />
|
||||
</event>
|
||||
|
||||
<event name="connector_id">
|
||||
<description summary="connector_id">
|
||||
The compositor sends this event once the connector is created to
|
||||
indicate the DRM object ID which represents the underlying connector
|
||||
that is being offered. Note that the final lease may include additional
|
||||
object IDs, such as CRTCs and planes.
|
||||
</description>
|
||||
<arg name="connector_id" type="uint" summary="DRM connector ID" />
|
||||
</event>
|
||||
|
||||
<event name="done">
|
||||
<description summary="all properties have been sent">
|
||||
This event is sent after all properties of a connector have been sent.
|
||||
This allows changes to the properties to be seen as atomic even if they
|
||||
happen via multiple events.
|
||||
</description>
|
||||
</event>
|
||||
|
||||
<event name="withdrawn">
|
||||
<description summary="lease offer withdrawn">
|
||||
Sent to indicate that the compositor will no longer honor requests for
|
||||
DRM leases which include this connector. The client may still issue a
|
||||
lease request including this connector, but the compositor will send
|
||||
wp_drm_lease_v1.finished without issuing a lease fd. Compositors are
|
||||
encouraged to send this event when they lose access to connector, for
|
||||
example when the connector is hot-unplugged, when the connector gets
|
||||
leased to a client or when the compositor loses DRM master.
|
||||
|
||||
If a client holds a lease for the connector, the status of the lease
|
||||
remains the same. The client should destroy the object after receiving
|
||||
this event.
|
||||
</description>
|
||||
</event>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroy connector">
|
||||
The client may send this request to indicate that it will not use this
|
||||
connector. Clients are encouraged to send this after receiving the
|
||||
"withdrawn" event so that the server can release the resources
|
||||
associated with this connector offer. Neither existing lease requests
|
||||
nor leases will be affected.
|
||||
</description>
|
||||
</request>
|
||||
</interface>
|
||||
|
||||
<interface name="wp_drm_lease_request_v1" version="1">
|
||||
<description summary="DRM lease request">
|
||||
A client that wishes to lease DRM resources will attach the list of
|
||||
connectors advertised with wp_drm_lease_device_v1.connector that they
|
||||
wish to lease, then use wp_drm_lease_request_v1.submit to submit the
|
||||
request.
|
||||
</description>
|
||||
|
||||
<enum name="error">
|
||||
<entry name="wrong_device" value="0"
|
||||
summary="requested a connector from a different lease device"/>
|
||||
<entry name="duplicate_connector" value="1"
|
||||
summary="requested a connector twice"/>
|
||||
<entry name="empty_lease" value="2"
|
||||
summary="requested a lease without requesting a connector"/>
|
||||
</enum>
|
||||
|
||||
<request name="request_connector">
|
||||
<description summary="request a connector for this lease">
|
||||
Indicates that the client would like to lease the given connector.
|
||||
This is only used as a suggestion, the compositor may choose to
|
||||
include any resources in the lease it issues, or change the set of
|
||||
leased resources at any time. Compositors are however encouraged to
|
||||
include the requested connector and other resources necessary
|
||||
to drive the connected output in the lease.
|
||||
|
||||
Requesting a connector that was created from a different lease device
|
||||
than this lease request raises the wrong_device error. Requesting a
|
||||
connector twice will raise the duplicate_connector error.
|
||||
</description>
|
||||
<arg name="connector" type="object"
|
||||
interface="wp_drm_lease_connector_v1" />
|
||||
</request>
|
||||
|
||||
<request name="submit" type="destructor">
|
||||
<description summary="submit the lease request">
|
||||
Submits the lease request and creates a new wp_drm_lease_v1 object.
|
||||
After calling submit the compositor will immediately destroy this
|
||||
object, issuing any more requests will cause a wl_display error.
|
||||
The compositor doesn't make any guarantees about the events of the
|
||||
lease object, clients cannot expect an immediate response.
|
||||
Not requesting any connectors before submitting the lease request
|
||||
will raise the empty_lease error.
|
||||
</description>
|
||||
<arg name="id" type="new_id" interface="wp_drm_lease_v1" />
|
||||
</request>
|
||||
</interface>
|
||||
|
||||
<interface name="wp_drm_lease_v1" version="1">
|
||||
<description summary="a DRM lease">
|
||||
A DRM lease object is used to transfer the DRM file descriptor to the
|
||||
client and manage the lifetime of the lease.
|
||||
|
||||
Some time after the wp_drm_lease_v1 object is created, the compositor
|
||||
will reply with the lease request's result. If the lease request is
|
||||
granted, the compositor will send a lease_fd event. If the lease request
|
||||
is denied, the compositor will send a finished event without a lease_fd
|
||||
event.
|
||||
</description>
|
||||
|
||||
<event name="lease_fd">
|
||||
<description summary="shares the DRM file descriptor">
|
||||
This event returns a file descriptor suitable for use with DRM-related
|
||||
ioctls. The client should use drmModeGetLease to enumerate the DRM
|
||||
objects which have been leased to them. The compositor guarantees it
|
||||
will not use the leased DRM objects itself until it sends the finished
|
||||
event. If the compositor cannot or will not grant a lease for the
|
||||
requested connectors, it will not send this event, instead sending the
|
||||
finished event.
|
||||
|
||||
The compositor will send this event at most once during this objects
|
||||
lifetime.
|
||||
</description>
|
||||
<arg name="leased_fd" type="fd" summary="leased DRM file descriptor" />
|
||||
</event>
|
||||
|
||||
<event name="finished">
|
||||
<description summary="sent when the lease has been revoked">
|
||||
The compositor uses this event to either reject a lease request, or if
|
||||
it previously sent a lease_fd, to notify the client that the lease has
|
||||
been revoked. If the client requires a new lease, they should destroy
|
||||
this object and submit a new lease request. The compositor will send
|
||||
no further events for this object after sending the finish event.
|
||||
Compositors should revoke the lease when any of the leased resources
|
||||
become unavailable, namely when a hot-unplug occurs or when the
|
||||
compositor loses DRM master. Compositors may advertise the connector
|
||||
for leasing again, if the resource is available, by sending the
|
||||
connector event through the wp_drm_lease_device_v1 interface.
|
||||
</description>
|
||||
</event>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroys the lease object">
|
||||
The client should send this to indicate that it no longer wishes to use
|
||||
this lease. The compositor should use drmModeRevokeLease on the
|
||||
appropriate file descriptor, if necessary.
|
||||
|
||||
Upon destruction, the compositor should advertise the connector for
|
||||
leasing again by sending the connector event through the
|
||||
wp_drm_lease_device_v1 interface.
|
||||
</description>
|
||||
</request>
|
||||
</interface>
|
||||
</protocol>
|
|
@ -21,10 +21,19 @@
|
|||
* Reconfigure standard input to receive key inputs, works with SSH connection.
|
||||
* WARNING: Reconfiguring standard input could lead to undesired effects, like breaking other
|
||||
* running processes orblocking the device if not restored properly. Use with care.
|
||||
* #define ENABLE_WAYLAND_DRM_LEASING
|
||||
* Instead of acquiring DRM exclusively, this leases a DRM instance from the currently running
|
||||
* Wayland compositor. This requires the screen to have the non-desktop property, which is set
|
||||
* through EDIDs. X11 is not supported, but it may be in the future.
|
||||
* See:
|
||||
* https://learn.microsoft.com/en-us/windows-hardware/drivers/display/specialized-monitors-edid-extension
|
||||
*
|
||||
* DEPENDENCIES:
|
||||
* - DRM and GLM: System libraries for display initialization and configuration
|
||||
* - gestures: Gestures system for touch-ready devices (or simulated from mouse inputs)
|
||||
* - wayland-client: Needed for DRM leasing. Only used if ENABLE_WAYLAND_DRM_LEASING is set.
|
||||
* - drm-lease-v1: Generated Wayland code for the DRM leasing extension. Only used if
|
||||
* ENABLE_WAYLAND_DRM_LEASING is set.
|
||||
*
|
||||
*
|
||||
* LICENSE: zlib/libpng
|
||||
|
@ -71,6 +80,15 @@
|
|||
#include "EGL/egl.h" // Native platform windowing system interface
|
||||
#include "EGL/eglext.h" // EGL extensions
|
||||
|
||||
#if defined(ENABLE_WAYLAND_DRM_LEASING)
|
||||
#include "wayland-client.h" // Wayland client. Used to do DRM leasing.
|
||||
// DRM leasing protocol that's used
|
||||
#if defined(ENABLE_WAYLAND_DRM_LEASING)
|
||||
#include "drm-lease-v1.c"
|
||||
#include "drm-lease-v1.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef EGL_OPENGL_ES3_BIT
|
||||
#define EGL_OPENGL_ES3_BIT 0x40
|
||||
#endif
|
||||
|
@ -127,6 +145,10 @@ typedef struct {
|
|||
int gamepadAbsAxisRange[MAX_GAMEPADS][MAX_GAMEPAD_AXIS][2]; // [0] = min, [1] = range value of the axis
|
||||
int gamepadAbsAxisMap[MAX_GAMEPADS][ABS_CNT]; // Maps the axes gamepads from the evdev api to a sequential one
|
||||
int gamepadCount; // The number of gamepads registered
|
||||
|
||||
#if defined(ENABLE_WAYLAND_DRM_LEASING)
|
||||
bool usingDRMLeasing; // True if we are using DRM leasing
|
||||
#endif
|
||||
} PlatformData;
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
@ -509,6 +531,15 @@ const char *GetClipboardText(void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#if defined(SUPPORT_CLIPBOARD_IMAGE)
|
||||
// Get clipboard image
|
||||
Image GetClipboardImage(void)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetClipboardImage() not implemented on target platform");
|
||||
return (Image){NULL,0,0,0,PIXELFORMAT_UNCOMPRESSED_GRAYSCALE};
|
||||
}
|
||||
#endif // SUPPORT_CLIPBOARD_IMAGE
|
||||
|
||||
// Show mouse cursor
|
||||
void ShowCursor(void)
|
||||
{
|
||||
|
@ -706,10 +737,200 @@ void PollInputEvents(void)
|
|||
// Module Internal Functions Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
#if defined(ENABLE_WAYLAND_DRM_LEASING)
|
||||
// Wayland state for DRM leasing
|
||||
struct wayland_state {
|
||||
struct wp_drm_lease_device_v1 *lease_device;
|
||||
struct wp_drm_lease_connector_v1 *lease_connector;
|
||||
};
|
||||
|
||||
// Called when we get a potential DRM lease
|
||||
void lease_handler(void *data, struct wp_drm_lease_v1 *wp_drm_lease_v1, int32_t leased_fd)
|
||||
{
|
||||
int *fd = data;
|
||||
*fd = leased_fd;
|
||||
}
|
||||
|
||||
void lease_remove_handler(void *data, struct wp_drm_lease_v1 *wp_drm_lease_v1)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
static const struct wp_drm_lease_v1_listener lease_listener = {
|
||||
.lease_fd = lease_handler,
|
||||
.finished = lease_remove_handler,
|
||||
};
|
||||
|
||||
// Called when we get a potential DRM lease
|
||||
static void lease_device_fd_handler(void *data, struct wp_drm_lease_device_v1 *lease_device, int fd)
|
||||
{
|
||||
close(fd);
|
||||
}
|
||||
|
||||
// Called when we get a lease connector
|
||||
static void lease_device_connector_handler(void *data, struct wp_drm_lease_device_v1 *lease_device, struct wp_drm_lease_connector_v1 *conn)
|
||||
{
|
||||
struct wayland_state *state = data;
|
||||
|
||||
if (!state->lease_connector) {
|
||||
state->lease_connector = conn;
|
||||
}
|
||||
}
|
||||
|
||||
static void lease_device_on_done(void *data, struct wp_drm_lease_device_v1 *lease_device)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
static void lease_device_on_release(void *data, struct wp_drm_lease_device_v1 *lease_device)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
static const struct wp_drm_lease_device_v1_listener lease_manager_listener = {
|
||||
.drm_fd = lease_device_fd_handler,
|
||||
.connector = lease_device_connector_handler,
|
||||
.done = lease_device_on_done,
|
||||
.released = lease_device_on_release,
|
||||
};
|
||||
|
||||
// Listen for protocol list/dump
|
||||
static void registry_handler(void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version)
|
||||
{
|
||||
struct wayland_state *state = data;
|
||||
|
||||
if (strcmp(interface, "wp_drm_lease_device_v1") == 0) {
|
||||
state->lease_device = wl_registry_bind(registry, name, &wp_drm_lease_device_v1_interface, version);
|
||||
wp_drm_lease_device_v1_add_listener(state->lease_device, &lease_manager_listener, state);
|
||||
}
|
||||
}
|
||||
|
||||
// Listen for remove event
|
||||
static void registry_remove_handler(void *data, struct wl_registry *registry, uint32_t name)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
static const struct wl_registry_listener registry_listener = {
|
||||
.global = registry_handler,
|
||||
.global_remove = registry_remove_handler,
|
||||
};
|
||||
|
||||
// Get the DRM device's file descriptor via DRM leasing. Seperate function due to readability concerns
|
||||
int GetDRMFDViaWaylandLeasing(void)
|
||||
{
|
||||
int fd = -1;
|
||||
|
||||
// Connect to the potentially running Wayland instance
|
||||
struct wayland_state state = { 0 };
|
||||
struct wl_display *display = wl_display_connect(NULL);
|
||||
|
||||
if (!display)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "DISPLAY: Failed to connect to Wayland server for DRM leasing! Is Wayland running? Cannot do DRM leasing");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Check the Wayland registry to determine if the DRM leasing protocol (wp_drm_lease_device_v1) is supported. If so, get the lease device and connector.
|
||||
struct wl_registry *registry = wl_display_get_registry(display);
|
||||
wl_registry_add_listener(registry, ®istry_listener, &state);
|
||||
wl_display_dispatch(display);
|
||||
wl_display_roundtrip(display);
|
||||
|
||||
if (!state.lease_device) {
|
||||
TRACELOG(LOG_WARNING, "DISPLAY: Failed to acquire leasing device");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!state.lease_connector) {
|
||||
TRACELOG(LOG_WARNING, "DISPLAY: No connectors offered for lease");
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct wp_drm_lease_request_v1 *req = wp_drm_lease_device_v1_create_lease_request(state.lease_device);
|
||||
wp_drm_lease_request_v1_request_connector(req, state.lease_connector);
|
||||
|
||||
struct wp_drm_lease_v1 *lease = wp_drm_lease_request_v1_submit(req);
|
||||
wp_drm_lease_v1_add_listener(lease, &lease_listener, &fd);
|
||||
wl_display_dispatch(display);
|
||||
wl_display_roundtrip(display);
|
||||
|
||||
if (fd < 0) {
|
||||
TRACELOG(LOG_WARNING, "DISPLAY: DRM file descriptor is not set. Cannot use DRM leased value");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return fd;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get the DRM device's file descriptor
|
||||
int GetDRMFD(void)
|
||||
{
|
||||
int fd;
|
||||
|
||||
#if defined(ENABLE_WAYLAND_DRM_LEASING)
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Attempting Wayland DRM leasing");
|
||||
fd = GetDRMFDViaWaylandLeasing();
|
||||
|
||||
if (fd != -1)
|
||||
{
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Leased DRM device opened successfully");
|
||||
platform.usingDRMLeasing = true;
|
||||
return fd;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(DEFAULT_GRAPHIC_DEVICE_DRM)
|
||||
fd = open(DEFAULT_GRAPHIC_DEVICE_DRM, O_RDWR);
|
||||
|
||||
if (fd != -1)
|
||||
{
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Default graphic device DRM opened successfully");
|
||||
return fd;
|
||||
}
|
||||
#else
|
||||
TRACELOG(LOG_WARNING, "DISPLAY: No graphic card set, trying platform-gpu-card");
|
||||
fd = open("/dev/dri/by-path/platform-gpu-card", O_RDWR); // VideoCore VI (Raspberry Pi 4)
|
||||
|
||||
if (fd != -1)
|
||||
{
|
||||
TRACELOG(LOG_INFO, "DISPLAY: platform-gpu-card opened successfully");
|
||||
return fd;
|
||||
}
|
||||
|
||||
if (drmModeGetResources(fd) == NULL)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "DISPLAY: Failed to open platform-gpu-card, trying card1");
|
||||
fd = open("/dev/dri/card1", O_RDWR); // Other Embedded
|
||||
|
||||
if (fd != -1)
|
||||
{
|
||||
TRACELOG(LOG_INFO, "DISPLAY: card1 opened successfully");
|
||||
return fd;
|
||||
}
|
||||
}
|
||||
|
||||
if (drmModeGetResources(fd) == NULL)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "DISPLAY: Failed to open graphic card1, trying card0");
|
||||
fd = open("/dev/dri/card0", O_RDWR); // VideoCore IV (Raspberry Pi 1-3)
|
||||
|
||||
if (fd != -1)
|
||||
{
|
||||
TRACELOG(LOG_INFO, "DISPLAY: card0 opened successfully");
|
||||
return fd;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
// Initialize platform: graphics, inputs and more
|
||||
int InitPlatform(void)
|
||||
{
|
||||
platform.fd = -1;
|
||||
platform.fd = GetDRMFD();
|
||||
platform.connector = NULL;
|
||||
platform.modeIndex = -1;
|
||||
platform.crtc = NULL;
|
||||
|
@ -723,25 +944,6 @@ int InitPlatform(void)
|
|||
CORE.Window.fullscreen = true;
|
||||
CORE.Window.flags |= FLAG_FULLSCREEN_MODE;
|
||||
|
||||
#if defined(DEFAULT_GRAPHIC_DEVICE_DRM)
|
||||
platform.fd = open(DEFAULT_GRAPHIC_DEVICE_DRM, O_RDWR);
|
||||
#else
|
||||
TRACELOG(LOG_INFO, "DISPLAY: No graphic card set, trying platform-gpu-card");
|
||||
platform.fd = open("/dev/dri/by-path/platform-gpu-card", O_RDWR); // VideoCore VI (Raspberry Pi 4)
|
||||
|
||||
if ((platform.fd == -1) || (drmModeGetResources(platform.fd) == NULL))
|
||||
{
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Failed to open platform-gpu-card, trying card1");
|
||||
platform.fd = open("/dev/dri/card1", O_RDWR); // Other Embedded
|
||||
}
|
||||
|
||||
if ((platform.fd == -1) || (drmModeGetResources(platform.fd) == NULL))
|
||||
{
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Failed to open graphic card1, trying card0");
|
||||
platform.fd = open("/dev/dri/card0", O_RDWR); // VideoCore IV (Raspberry Pi 1-3)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (platform.fd == -1)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "DISPLAY: Failed to open graphic card");
|
||||
|
@ -766,17 +968,48 @@ int InitPlatform(void)
|
|||
|
||||
// In certain cases the status of the conneciton is reported as UKNOWN, but it is still connected.
|
||||
// This might be a hardware or software limitation like on Raspberry Pi Zero with composite output.
|
||||
if (((con->connection == DRM_MODE_CONNECTED) || (con->connection == DRM_MODE_UNKNOWNCONNECTION)) && (con->encoder_id))
|
||||
{
|
||||
TRACELOG(LOG_TRACE, "DISPLAY: DRM mode connected");
|
||||
platform.connector = con;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACELOG(LOG_TRACE, "DISPLAY: DRM mode NOT connected (deleting)");
|
||||
drmModeFreeConnector(con);
|
||||
}
|
||||
#if defined(ENABLE_WAYLAND_DRM_LEASING)
|
||||
if (platform.usingDRMLeasing)
|
||||
{
|
||||
if (((con->connection == DRM_MODE_CONNECTED) || (con->connection == DRM_MODE_UNKNOWNCONNECTION)))
|
||||
{
|
||||
TRACELOG(LOG_TRACE, "DISPLAY: DRM mode connected");
|
||||
platform.connector = con;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACELOG(LOG_TRACE, "DISPLAY: DRM mode NOT connected (deleting)");
|
||||
drmModeFreeConnector(con);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (((con->connection == DRM_MODE_CONNECTED) || (con->connection == DRM_MODE_UNKNOWNCONNECTION)) && (con->encoder_id))
|
||||
{
|
||||
TRACELOG(LOG_TRACE, "DISPLAY: DRM mode connected");
|
||||
platform.connector = con;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACELOG(LOG_TRACE, "DISPLAY: DRM mode NOT connected (deleting)");
|
||||
drmModeFreeConnector(con);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (((con->connection == DRM_MODE_CONNECTED) || (con->connection == DRM_MODE_UNKNOWNCONNECTION)) && (con->encoder_id))
|
||||
{
|
||||
TRACELOG(LOG_TRACE, "DISPLAY: DRM mode connected");
|
||||
platform.connector = con;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACELOG(LOG_TRACE, "DISPLAY: DRM mode NOT connected (deleting)");
|
||||
drmModeFreeConnector(con);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!platform.connector)
|
||||
|
@ -786,22 +1019,83 @@ int InitPlatform(void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
drmModeEncoder *enc = drmModeGetEncoder(platform.fd, platform.connector->encoder_id);
|
||||
if (!enc)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "DISPLAY: Failed to get DRM mode encoder");
|
||||
drmModeFreeResources(res);
|
||||
return -1;
|
||||
}
|
||||
#if defined(ENABLE_WAYLAND_DRM_LEASING)
|
||||
drmModeEncoder *enc = NULL;
|
||||
|
||||
platform.crtc = drmModeGetCrtc(platform.fd, enc->crtc_id);
|
||||
if (!platform.crtc)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "DISPLAY: Failed to get DRM mode crtc");
|
||||
drmModeFreeEncoder(enc);
|
||||
drmModeFreeResources(res);
|
||||
return -1;
|
||||
}
|
||||
if (platform.usingDRMLeasing)
|
||||
{
|
||||
drmModeResPtr drm_resources = drmModeGetResources(platform.fd);
|
||||
|
||||
if (!drm_resources)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "DISPLAY: Failed to get DRM resources");
|
||||
drmModeFreeResources(res);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (res->count_crtcs == 0)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "DISPLAY: No CRTCs found for display");
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < res->count_crtcs; ++i)
|
||||
{
|
||||
platform.crtc = drmModeGetCrtc(platform.fd, res->crtcs[i]);
|
||||
|
||||
if (!platform.crtc)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "DISPLAY: Failed to get DRM mode crtc");
|
||||
drmModeFreeResources(drm_resources);
|
||||
drmModeFreeResources(res);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!platform.crtc)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "DISPLAY: Failed to get DRM mode crtc");
|
||||
drmModeFreeResources(drm_resources);
|
||||
drmModeFreeResources(res);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
enc = drmModeGetEncoder(platform.fd, platform.connector->encoder_id);
|
||||
if (!enc)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "DISPLAY: Failed to get DRM mode encoder");
|
||||
drmModeFreeResources(res);
|
||||
return -1;
|
||||
}
|
||||
|
||||
platform.crtc = drmModeGetCrtc(platform.fd, enc->crtc_id);
|
||||
if (!platform.crtc)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "DISPLAY: Failed to get DRM mode crtc");
|
||||
drmModeFreeEncoder(enc);
|
||||
drmModeFreeResources(res);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
drmModeEncoder *enc = drmModeGetEncoder(platform.fd, platform.connector->encoder_id);
|
||||
if (!enc)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "DISPLAY: Failed to get DRM mode encoder");
|
||||
drmModeFreeResources(res);
|
||||
return -1;
|
||||
}
|
||||
|
||||
platform.crtc = drmModeGetCrtc(platform.fd, enc->crtc_id);
|
||||
if (!platform.crtc)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "DISPLAY: Failed to get DRM mode crtc");
|
||||
drmModeFreeEncoder(enc);
|
||||
drmModeFreeResources(res);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
// If InitWindow should use the current mode find it in the connector's mode list
|
||||
if ((CORE.Window.screen.width <= 0) || (CORE.Window.screen.height <= 0))
|
||||
|
@ -813,7 +1107,11 @@ int InitPlatform(void)
|
|||
if (platform.modeIndex < 0)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "DISPLAY: No matching DRM connector mode found");
|
||||
drmModeFreeEncoder(enc);
|
||||
#if defined(ENABLE_WAYLAND_DRM_LEASING)
|
||||
if (!platform.usingDRMLeasing) drmModeFreeEncoder(enc);
|
||||
#else
|
||||
drmModeFreeEncoder(enc);
|
||||
#endif
|
||||
drmModeFreeResources(res);
|
||||
return -1;
|
||||
}
|
||||
|
@ -841,7 +1139,11 @@ int InitPlatform(void)
|
|||
if (platform.modeIndex < 0)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "DISPLAY: Failed to find a suitable DRM connector mode");
|
||||
drmModeFreeEncoder(enc);
|
||||
#if defined(ENABLE_WAYLAND_DRM_LEASING)
|
||||
if (!platform.usingDRMLeasing) drmModeFreeEncoder(enc);
|
||||
#else
|
||||
drmModeFreeEncoder(enc);
|
||||
#endif
|
||||
drmModeFreeResources(res);
|
||||
return -1;
|
||||
}
|
||||
|
@ -858,8 +1160,16 @@ int InitPlatform(void)
|
|||
CORE.Window.render.width = CORE.Window.screen.width;
|
||||
CORE.Window.render.height = CORE.Window.screen.height;
|
||||
|
||||
drmModeFreeEncoder(enc);
|
||||
enc = NULL;
|
||||
#if defined(ENABLE_WAYLAND_DRM_LEASING)
|
||||
if (!platform.usingDRMLeasing)
|
||||
{
|
||||
drmModeFreeEncoder(enc);
|
||||
enc = NULL;
|
||||
}
|
||||
#else
|
||||
drmModeFreeEncoder(enc);
|
||||
enc = NULL;
|
||||
#endif
|
||||
|
||||
drmModeFreeResources(res);
|
||||
res = NULL;
|
||||
|
@ -1329,46 +1639,52 @@ static void ProcessKeyboard(void)
|
|||
// this means mouse, keyboard or gamepad devices
|
||||
static void InitEvdevInput(void)
|
||||
{
|
||||
char path[MAX_FILEPATH_LENGTH] = { 0 };
|
||||
DIR *directory = NULL;
|
||||
struct dirent *entity = NULL;
|
||||
#if !defined(DISABLE_EVDEV_INPUT)
|
||||
char path[MAX_FILEPATH_LENGTH] = { 0 };
|
||||
DIR *directory = NULL;
|
||||
struct dirent *entity = NULL;
|
||||
|
||||
// Initialise keyboard file descriptor
|
||||
platform.keyboardFd = -1;
|
||||
platform.mouseFd = -1;
|
||||
// Initialise keyboard file descriptor
|
||||
platform.keyboardFd = -1;
|
||||
platform.mouseFd = -1;
|
||||
|
||||
// Reset variables
|
||||
for (int i = 0; i < MAX_TOUCH_POINTS; ++i)
|
||||
{
|
||||
CORE.Input.Touch.position[i].x = -1;
|
||||
CORE.Input.Touch.position[i].y = -1;
|
||||
}
|
||||
|
||||
// Reset keyboard key state
|
||||
for (int i = 0; i < MAX_KEYBOARD_KEYS; i++)
|
||||
{
|
||||
CORE.Input.Keyboard.currentKeyState[i] = 0;
|
||||
CORE.Input.Keyboard.keyRepeatInFrame[i] = 0;
|
||||
}
|
||||
|
||||
// Open the linux directory of "/dev/input"
|
||||
directory = opendir(DEFAULT_EVDEV_PATH);
|
||||
|
||||
if (directory)
|
||||
{
|
||||
while ((entity = readdir(directory)) != NULL)
|
||||
// Reset variables
|
||||
for (int i = 0; i < MAX_TOUCH_POINTS; ++i)
|
||||
{
|
||||
if ((strncmp("event", entity->d_name, strlen("event")) == 0) || // Search for devices named "event*"
|
||||
(strncmp("mouse", entity->d_name, strlen("mouse")) == 0)) // Search for devices named "mouse*"
|
||||
{
|
||||
sprintf(path, "%s%s", DEFAULT_EVDEV_PATH, entity->d_name);
|
||||
ConfigureEvdevDevice(path); // Configure the device if appropriate
|
||||
}
|
||||
CORE.Input.Touch.position[i].x = -1;
|
||||
CORE.Input.Touch.position[i].y = -1;
|
||||
}
|
||||
|
||||
closedir(directory);
|
||||
}
|
||||
else TRACELOG(LOG_WARNING, "INPUT: Failed to open linux event directory: %s", DEFAULT_EVDEV_PATH);
|
||||
// Reset keyboard key state
|
||||
for (int i = 0; i < MAX_KEYBOARD_KEYS; i++)
|
||||
{
|
||||
CORE.Input.Keyboard.currentKeyState[i] = 0;
|
||||
CORE.Input.Keyboard.keyRepeatInFrame[i] = 0;
|
||||
}
|
||||
|
||||
// Open the linux directory of "/dev/input"
|
||||
directory = opendir(DEFAULT_EVDEV_PATH);
|
||||
|
||||
if (directory)
|
||||
{
|
||||
while ((entity = readdir(directory)) != NULL)
|
||||
{
|
||||
if ((strncmp("event", entity->d_name, strlen("event")) == 0) || // Search for devices named "event*"
|
||||
(strncmp("mouse", entity->d_name, strlen("mouse")) == 0)) // Search for devices named "mouse*"
|
||||
{
|
||||
sprintf(path, "%s%s", DEFAULT_EVDEV_PATH, entity->d_name);
|
||||
ConfigureEvdevDevice(path); // Configure the device if appropriate
|
||||
}
|
||||
}
|
||||
|
||||
closedir(directory);
|
||||
}
|
||||
else TRACELOG(LOG_WARNING, "INPUT: Failed to open linux event directory: %s", DEFAULT_EVDEV_PATH);
|
||||
#else
|
||||
TRACELOG(LOG_INFO, "INPUT: Not doing evdev input configuration as it's disabled");
|
||||
platform.keyboardFd = -1;
|
||||
platform.mouseFd = -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Identifies a input device and configures it for use if appropriate
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue