From c1c486d3492ccc23215726f2ac472c4785534038 Mon Sep 17 00:00:00 2001 From: Hanspeter Portner Date: Sun, 23 Apr 2023 20:20:41 +0200 Subject: [PATCH] Squashed 'subprojects/d2tk/' changes from 45140bbc5..28a753f44 28a753f44 add sr.ht build recipe d0f344928 cleanup readme 85094ee19 cleanup readme f1a4a003d cleanup readme 392c83e3b update readme dc72b1980 fix last commit 80a324cdf rename config.h to d2tk_config.h 00b04cd7c remove glew dep, add gles version config option 0230ba5b3 finalize glfw frontend 882775229 base: support empty layout elements 94b78beb2 base: add d2tk_base_get_core to API 2f16a1d45 register glfw window close callback 40ef0b650 add missing include for PATH_MAX bdab9ffdf add missing include for ssize_t 5cffed4b2 update mum hash 91b33d4c1 meson: enable lto by default 050d33af5 meson: use meson.current_source_dir 1d403090c spdx: put contact address in angle brackets b09c4ec61 doc: readd Doxyfile ec349f3b0 readme: update 1c88f7036 make compliant with REUSE spec 3.0 git-subtree-dir: subprojects/d2tk git-subtree-split: 28a753f44b51a2077da6720219637191f37fe2f3 --- .build.yml | 25 ++ .gitignore | 7 +- .gitlab-ci.yml | 108 ------- .reuse/dep5 | 24 ++ COPYING | 201 ------------ Doxyfile | 3 + LICENSES/Artistic-2.0.txt | 85 +++++ LICENSES/BSD-2-Clause.txt | 9 + LICENSES/CC0-1.0.txt | 121 +++++++ LICENSES/ISC.txt | 8 + LICENSES/MIT.txt | 9 + LICENSES/OFL-1.1.txt | 43 +++ LICENSES/Unlicense.txt | 10 + LICENSES/Zlib.txt | 11 + README.md | 76 +++-- VERSION | 1 - check_for_font | 3 + d2tk/backend.h | 16 +- d2tk/base.h | 21 +- d2tk/config.h.in | 6 + d2tk/core.h | 19 +- d2tk/d2tk.h | 16 +- d2tk/frontend.h | 16 +- d2tk/frontend_fbdev.h | 16 +- d2tk/frontend_glfw.h | 16 +- d2tk/frontend_pugl.h | 16 +- d2tk/hash.h | 16 +- d2tk/util.h | 18 +- example/custom_cairo.c | 5 + example/custom_nanovg.c | 5 + example/d2tk_fbdev.c | 16 +- example/d2tk_glfw.c | 16 +- example/d2tk_pugl.c | 16 +- example/example.c | 19 +- example/example.h | 16 +- example/libre-arrow-circle-right.png.license | 2 + example/libre-gui-file.png.license | 2 + example/libre-gui-folder.png.license | 2 + meson.build | 38 ++- meson_options.txt | 10 + robodoc.rc | 16 + screenshots/screenshot_1.png.license | 2 + screenshots/screenshot_2.png.license | 2 + screenshots/screenshot_3.png.license | 2 + screenshots/screenshot_4.png.license | 2 + screenshots/screenshot_5.png.license | 2 + screenshots/screenshot_6.png.license | 2 + screenshots/screenshot_7.png.license | 2 + screenshots/screenshot_8.png.license | 2 + src/backend_cairo.c | 16 +- src/backend_nanovg.c | 49 ++- src/base.c | 48 +-- src/base_bar.c | 16 +- src/base_bitmap.c | 16 +- src/base_button.c | 16 +- src/base_combo.c | 16 +- src/base_cursor.c | 16 +- src/base_custom.c | 16 +- src/base_dial.c | 16 +- src/base_flowmatrix.c | 16 +- src/base_frame.c | 16 +- src/base_image.c | 16 +- src/base_internal.h | 16 +- src/base_label.c | 16 +- src/base_layout.c | 65 ++-- src/base_lineedit.c | 16 +- src/base_link.c | 16 +- src/base_meter.c | 16 +- src/base_pane.c | 16 +- src/base_pty.c | 16 +- src/base_scrollbar.c | 16 +- src/base_separator.c | 16 +- src/base_spinner.c | 16 +- src/base_table.c | 16 +- src/base_textfield.c | 16 +- src/base_tooltip.c | 16 +- src/base_vkb.c | 16 +- src/base_wave.c | 16 +- src/core.c | 22 +- src/core_internal.h | 16 +- src/frontend_fbdev.c | 24 +- src/frontend_glfw.c | 315 +++++++++++++++---- src/frontend_pugl.c | 52 +-- src/hash.c | 16 +- src/mum.h | 2 +- src/util_spawn.c | 16 +- test/base.c | 16 +- test/core.c | 16 +- test/mock.c | 16 +- test/mock.h | 16 +- ttf/FiraCode-Bold.ttf.license | 2 + ttf/FiraCode-Light.ttf.license | 2 + ttf/FiraCode-Medium.ttf.license | 2 + ttf/FiraCode-Regular.ttf.license | 2 + ttf/FiraSans-Bold.ttf.license | 2 + ttf/LICENSE | 93 ------ 96 files changed, 955 insertions(+), 1352 deletions(-) create mode 100644 .build.yml delete mode 100644 .gitlab-ci.yml create mode 100644 .reuse/dep5 delete mode 100644 COPYING create mode 100644 LICENSES/Artistic-2.0.txt create mode 100644 LICENSES/BSD-2-Clause.txt create mode 100644 LICENSES/CC0-1.0.txt create mode 100644 LICENSES/ISC.txt create mode 100644 LICENSES/MIT.txt create mode 100644 LICENSES/OFL-1.1.txt create mode 100644 LICENSES/Unlicense.txt create mode 100644 LICENSES/Zlib.txt delete mode 100644 VERSION create mode 100644 example/libre-arrow-circle-right.png.license create mode 100644 example/libre-gui-file.png.license create mode 100644 example/libre-gui-folder.png.license create mode 100644 robodoc.rc create mode 100644 screenshots/screenshot_1.png.license create mode 100644 screenshots/screenshot_2.png.license create mode 100644 screenshots/screenshot_3.png.license create mode 100644 screenshots/screenshot_4.png.license create mode 100644 screenshots/screenshot_5.png.license create mode 100644 screenshots/screenshot_6.png.license create mode 100644 screenshots/screenshot_7.png.license create mode 100644 screenshots/screenshot_8.png.license create mode 100644 ttf/FiraCode-Bold.ttf.license create mode 100644 ttf/FiraCode-Light.ttf.license create mode 100644 ttf/FiraCode-Medium.ttf.license create mode 100644 ttf/FiraCode-Regular.ttf.license create mode 100644 ttf/FiraSans-Bold.ttf.license delete mode 100644 ttf/LICENSE diff --git a/.build.yml b/.build.yml new file mode 100644 index 0000000..7a1a954 --- /dev/null +++ b/.build.yml @@ -0,0 +1,25 @@ +# SPDX-FileCopyrightText: Hanspeter Portner +# SPDX-License-Identifier: CC0-1.0 + +image: alpine/latest +packages: + - reuse + - meson + - cairo-dev + - libinput-dev + - eudev-dev + - libevdev-dev + - glu-dev + - glfw-dev + - libvterm-dev + #- fontconfig-dev +tasks: + - setup: | + cd d2tk + meson setup build -Duse-backend-cairo=enabled -Duse-backend-nanovg=enabled -Duse-frontend-fbdev=enabled -Duse-frontend-pugl=enabled -Duse-frontend-glfw=enabled -Duse-fontconfig=disabled -Duse-evdev=enabled \ + - build: | + cd d2tk + ninja -C build + - test: | + cd d2tk + ninja -C build test diff --git a/.gitignore b/.gitignore index 651404e..6187fa8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ +# SPDX-FileCopyrightText: (c) Hanspeter Portner (dev@open-music-kontrollers.ch) +# SPDX-License-Identifier: CC0-1.0 + tags -types_c.taghl -build +*.taghl doc +configure diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 4847758..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,108 +0,0 @@ -stages: - - build - - deploy - -# templates -.variables_template: &variables_definition - variables: - BASE_NAME: "d2tk" - PKG_CONFIG_PATH: "/opt/lv2/lib/pkgconfig:/opt/${CI_BUILD_NAME}/lib/pkgconfig:/usr/lib/${CI_BUILD_NAME}/pkgconfig" - -.common_template: &common_definition - <<: *variables_definition - stage: build - artifacts: - name: "${BASE_NAME}-$(cat VERSION)-${CI_BUILD_NAME}" - paths: - - "${BASE_NAME}-$(cat VERSION)/" - -.build_template: &build_definition - <<: *common_definition - stage: build - script: - - meson --prefix="/" --libdir="lib" --cross-file "${CI_BUILD_NAME}" build - - sed -i -e '/framework/s/-Wl,-O1//g' -e '/framework/s/-Wl,--start-group//g' -e '/framework/s/-Wl,--end-group//g' build/build.ninja - - ninja -C build - - DESTDIR="${CI_PROJECT_DIR}/${BASE_NAME}-$(cat VERSION)/${CI_BUILD_NAME}" ninja -C build install - -.test_template: &test_definition - <<: *common_definition - stage: build - script: - - meson --prefix="/" --libdir="lib" --cross-file "${CI_BUILD_NAME}" build - - sed -i -e '/framework/s/-Wl,-O1//g' -e '/framework/s/-Wl,--start-group//g' -e '/framework/s/-Wl,--end-group//g' build/build.ninja - - ninja -C build - - DESTDIR="${CI_PROJECT_DIR}/${BASE_NAME}-$(cat VERSION)/${CI_BUILD_NAME}" ninja -C build install - - - meson test -C build - -.analyze_template: &analyze_definition - <<: *common_definition - stage: build - script: - - meson --prefix="/" --libdir="lib" --cross-file "${CI_BUILD_NAME}" build - - sed -i -e '/framework/s/-Wl,-O1//g' -e '/framework/s/-Wl,--start-group//g' -e '/framework/s/-Wl,--end-group//g' build/build.ninja - - ninja -C build - - DESTDIR="${CI_PROJECT_DIR}/${BASE_NAME}-$(cat VERSION)/${CI_BUILD_NAME}" ninja -C build install - - - meson test -C build - - meson test -C build --wrap=valgrind - - - CC=clang CXX=clang++ meson --prefix="/" --libdir="lib" --cross-file "${CI_BUILD_NAME}" clang - - ninja -C clang - - ninja -C clang test - - - scan-build --status-bugs meson --prefix="/" --libdir="lib" --cross-file "${CI_BUILD_NAME}" scanbuild - - scan-build --status-bugs ninja -C scanbuild - - scan-build --status-bugs ninja -C scanbuild test - -.universal_linux_template: &universal_linux_definition - image: ventosus/universal-linux-gnu:buster - <<: *analyze_definition - -.arm_linux_template: &arm_linux_definition - image: ventosus/arm-linux-gnueabihf:buster - <<: *test_definition - -# targets -x86_64-linux-gnu: - before_script: - - apt-get install -y libglu1-mesa-dev libevdev-dev libvterm-dev - <<: *universal_linux_definition - -i686-linux-gnu: - before_script: - - apt-get install -y libglu1-mesa-dev:i386 libevdev-dev:i386 libvterm-dev:i386 - <<: *universal_linux_definition - -arm-linux-gnueabihf: - before_script: - - apt-get install -y libglu1-mesa-dev:armhf libevdev-dev:armhf libvterm-dev:armhf - <<: *arm_linux_definition - -aarch64-linux-gnu: - before_script: - - apt-get install -y libglu1-mesa-dev:arm64 libevdev-dev:arm64 libvterm-dev:arm64 - <<: *arm_linux_definition - -pack: - <<: *variables_definition - stage: deploy - script: - - echo 'packing up...' - artifacts: - name: "${BASE_NAME}-$(cat VERSION)" - paths: - - "${BASE_NAME}-$(cat VERSION)/" - -pages: - stage: deploy - before_script: - - apt-get update -y - - apt-get install -y doxygen - script: - - doxygen - - cp -r doc/html public - artifacts: - paths: - - public/ diff --git a/.reuse/dep5 b/.reuse/dep5 new file mode 100644 index 0000000..d3399bb --- /dev/null +++ b/.reuse/dep5 @@ -0,0 +1,24 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: d2tk +Upstream-Contact: Hanspeter Portner +Source: https://git.open-music-kontrollers.ch/lad/d2tk/ + +Files: pugl/* +Copyright: David Robillard +License: ISC + +Files: linenoise/* +Copyright: Salvatore Sanfilippo +License: BSD-2-Clause + +Files: nanovg/* +Copyright: Mikko Mononen +License: Zlib + +Files: utf8.h/* +Copyright: Neil Henning +License: Unlicense + +Files: src/mum.h +Copyright: 2016, 2017, 2018 Vladimir Makarov +License: MIT diff --git a/COPYING b/COPYING deleted file mode 100644 index ddb9a46..0000000 --- a/COPYING +++ /dev/null @@ -1,201 +0,0 @@ - The Artistic License 2.0 - - Copyright (c) 2000-2006, The Perl Foundation. - - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -Preamble - -This license establishes the terms under which a given free software -Package may be copied, modified, distributed, and/or redistributed. -The intent is that the Copyright Holder maintains some artistic -control over the development of that Package while still keeping the -Package available as open source and free software. - -You are always permitted to make arrangements wholly outside of this -license directly with the Copyright Holder of a given Package. If the -terms of this license do not permit the full use that you propose to -make of the Package, you should contact the Copyright Holder and seek -a different licensing arrangement. - -Definitions - - "Copyright Holder" means the individual(s) or organization(s) - named in the copyright notice for the entire Package. - - "Contributor" means any party that has contributed code or other - material to the Package, in accordance with the Copyright Holder's - procedures. - - "You" and "your" means any person who would like to copy, - distribute, or modify the Package. - - "Package" means the collection of files distributed by the - Copyright Holder, and derivatives of that collection and/or of - those files. A given Package may consist of either the Standard - Version, or a Modified Version. - - "Distribute" means providing a copy of the Package or making it - accessible to anyone else, or in the case of a company or - organization, to others outside of your company or organization. - - "Distributor Fee" means any fee that you charge for Distributing - this Package or providing support for this Package to another - party. It does not mean licensing fees. - - "Standard Version" refers to the Package if it has not been - modified, or has been modified only in ways explicitly requested - by the Copyright Holder. - - "Modified Version" means the Package, if it has been changed, and - such changes were not explicitly requested by the Copyright - Holder. - - "Original License" means this Artistic License as Distributed with - the Standard Version of the Package, in its current version or as - it may be modified by The Perl Foundation in the future. - - "Source" form means the source code, documentation source, and - configuration files for the Package. - - "Compiled" form means the compiled bytecode, object code, binary, - or any other form resulting from mechanical transformation or - translation of the Source form. - - -Permission for Use and Modification Without Distribution - -(1) You are permitted to use the Standard Version and create and use -Modified Versions for any purpose without restriction, provided that -you do not Distribute the Modified Version. - - -Permissions for Redistribution of the Standard Version - -(2) You may Distribute verbatim copies of the Source form of the -Standard Version of this Package in any medium without restriction, -either gratis or for a Distributor Fee, provided that you duplicate -all of the original copyright notices and associated disclaimers. At -your discretion, such verbatim copies may or may not include a -Compiled form of the Package. - -(3) You may apply any bug fixes, portability changes, and other -modifications made available from the Copyright Holder. The resulting -Package will still be considered the Standard Version, and as such -will be subject to the Original License. - - -Distribution of Modified Versions of the Package as Source - -(4) You may Distribute your Modified Version as Source (either gratis -or for a Distributor Fee, and with or without a Compiled form of the -Modified Version) provided that you clearly document how it differs -from the Standard Version, including, but not limited to, documenting -any non-standard features, executables, or modules, and provided that -you do at least ONE of the following: - - (a) make the Modified Version available to the Copyright Holder - of the Standard Version, under the Original License, so that the - Copyright Holder may include your modifications in the Standard - Version. - - (b) ensure that installation of your Modified Version does not - prevent the user installing or running the Standard Version. In - addition, the Modified Version must bear a name that is different - from the name of the Standard Version. - - (c) allow anyone who receives a copy of the Modified Version to - make the Source form of the Modified Version available to others - under - - (i) the Original License or - - (ii) a license that permits the licensee to freely copy, - modify and redistribute the Modified Version using the same - licensing terms that apply to the copy that the licensee - received, and requires that the Source form of the Modified - Version, and of any works derived from it, be made freely - available in that license fees are prohibited but Distributor - Fees are allowed. - - -Distribution of Compiled Forms of the Standard Version -or Modified Versions without the Source - -(5) You may Distribute Compiled forms of the Standard Version without -the Source, provided that you include complete instructions on how to -get the Source of the Standard Version. Such instructions must be -valid at the time of your distribution. If these instructions, at any -time while you are carrying out such distribution, become invalid, you -must provide new instructions on demand or cease further distribution. -If you provide valid instructions or cease distribution within thirty -days after you become aware that the instructions are invalid, then -you do not forfeit any of your rights under this license. - -(6) You may Distribute a Modified Version in Compiled form without -the Source, provided that you comply with Section 4 with respect to -the Source of the Modified Version. - - -Aggregating or Linking the Package - -(7) You may aggregate the Package (either the Standard Version or -Modified Version) with other packages and Distribute the resulting -aggregation provided that you do not charge a licensing fee for the -Package. Distributor Fees are permitted, and licensing fees for other -components in the aggregation are permitted. The terms of this license -apply to the use and Distribution of the Standard or Modified Versions -as included in the aggregation. - -(8) You are permitted to link Modified and Standard Versions with -other works, to embed the Package in a larger work of your own, or to -build stand-alone binary or bytecode versions of applications that -include the Package, and Distribute the result without restriction, -provided the result does not expose a direct interface to the Package. - - -Items That are Not Considered Part of a Modified Version - -(9) Works (including, but not limited to, modules and scripts) that -merely extend or make use of the Package, do not, by themselves, cause -the Package to be a Modified Version. In addition, such works are not -considered parts of the Package itself, and are not subject to the -terms of this license. - - -General Provisions - -(10) Any use, modification, and distribution of the Standard or -Modified Versions is governed by this Artistic License. By using, -modifying or distributing the Package, you accept this license. Do not -use, modify, or distribute the Package, if you do not accept this -license. - -(11) If your Modified Version has been derived from a Modified -Version made by someone other than you, you are nevertheless required -to ensure that your Modified Version complies with the requirements of -this license. - -(12) This license does not grant you the right to use any trademark, -service mark, tradename, or logo of the Copyright Holder. - -(13) This license includes the non-exclusive, worldwide, -free-of-charge patent license to make, have made, use, offer to sell, -sell, import and otherwise transfer the Package with respect to any -patent claims licensable by the Copyright Holder that are necessarily -infringed by the Package. If you institute patent litigation -(including a cross-claim or counterclaim) against any party alleging -that the Package constitutes direct or contributory patent -infringement, then this Artistic License to you shall terminate on the -date that such litigation is filed. - -(14) Disclaimer of Warranty: -THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS -IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED -WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR -NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL -LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Doxyfile b/Doxyfile index 294d19d..c682364 100644 --- a/Doxyfile +++ b/Doxyfile @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: Hanspeter Portner +# SPDX-License-Identifier: CC0-1.0 + # Doxyfile 1.8.14 # This file describes the settings to be used by the documentation system diff --git a/LICENSES/Artistic-2.0.txt b/LICENSES/Artistic-2.0.txt new file mode 100644 index 0000000..eb2e968 --- /dev/null +++ b/LICENSES/Artistic-2.0.txt @@ -0,0 +1,85 @@ +The Artistic License 2.0 + +Copyright (c) 2000-2006, The Perl Foundation. + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +Preamble + +This license establishes the terms under which a given free software Package may be copied, modified, distributed, and/or redistributed. The intent is that the Copyright Holder maintains some artistic control over the development of that Package while still keeping the Package available as open source and free software. + +You are always permitted to make arrangements wholly outside of this license directly with the Copyright Holder of a given Package. If the terms of this license do not permit the full use that you propose to make of the Package, you should contact the Copyright Holder and seek a different licensing arrangement. + +Definitions + + "Copyright Holder" means the individual(s) or organization(s) named in the copyright notice for the entire Package. + + "Contributor" means any party that has contributed code or other material to the Package, in accordance with the Copyright Holder's procedures. + + "You" and "your" means any person who would like to copy, distribute, or modify the Package. + + "Package" means the collection of files distributed by the Copyright Holder, and derivatives of that collection and/or of those files. A given Package may consist of either the Standard Version, or a Modified Version. + + "Distribute" means providing a copy of the Package or making it accessible to anyone else, or in the case of a company or organization, to others outside of your company or organization. + + "Distributor Fee" means any fee that you charge for Distributing this Package or providing support for this Package to another party. It does not mean licensing fees. + + "Standard Version" refers to the Package if it has not been modified, or has been modified only in ways explicitly requested by the Copyright Holder. + + "Modified Version" means the Package, if it has been changed, and such changes were not explicitly requested by the Copyright Holder. + + "Original License" means this Artistic License as Distributed with the Standard Version of the Package, in its current version or as it may be modified by The Perl Foundation in the future. + + "Source" form means the source code, documentation source, and configuration files for the Package. + + "Compiled" form means the compiled bytecode, object code, binary, or any other form resulting from mechanical transformation or translation of the Source form. + +Permission for Use and Modification Without Distribution + +(1) You are permitted to use the Standard Version and create and use Modified Versions for any purpose without restriction, provided that you do not Distribute the Modified Version. + +Permissions for Redistribution of the Standard Version + +(2) You may Distribute verbatim copies of the Source form of the Standard Version of this Package in any medium without restriction, either gratis or for a Distributor Fee, provided that you duplicate all of the original copyright notices and associated disclaimers. At your discretion, such verbatim copies may or may not include a Compiled form of the Package. + +(3) You may apply any bug fixes, portability changes, and other modifications made available from the Copyright Holder. The resulting Package will still be considered the Standard Version, and as such will be subject to the Original License. + +Distribution of Modified Versions of the Package as Source + +(4) You may Distribute your Modified Version as Source (either gratis or for a Distributor Fee, and with or without a Compiled form of the Modified Version) provided that you clearly document how it differs from the Standard Version, including, but not limited to, documenting any non-standard features, executables, or modules, and provided that you do at least ONE of the following: + + (a) make the Modified Version available to the Copyright Holder of the Standard Version, under the Original License, so that the Copyright Holder may include your modifications in the Standard Version. + (b) ensure that installation of your Modified Version does not prevent the user installing or running the Standard Version. In addition, the Modified Version must bear a name that is different from the name of the Standard Version. + (c) allow anyone who receives a copy of the Modified Version to make the Source form of the Modified Version available to others under + + (i) the Original License or + (ii) a license that permits the licensee to freely copy, modify and redistribute the Modified Version using the same licensing terms that apply to the copy that the licensee received, and requires that the Source form of the Modified Version, and of any works derived from it, be made freely available in that license fees are prohibited but Distributor Fees are allowed. + +Distribution of Compiled Forms of the Standard Version or Modified Versions without the Source + +(5) You may Distribute Compiled forms of the Standard Version without the Source, provided that you include complete instructions on how to get the Source of the Standard Version. Such instructions must be valid at the time of your distribution. If these instructions, at any time while you are carrying out such distribution, become invalid, you must provide new instructions on demand or cease further distribution. If you provide valid instructions or cease distribution within thirty days after you become aware that the instructions are invalid, then you do not forfeit any of your rights under this license. + +(6) You may Distribute a Modified Version in Compiled form without the Source, provided that you comply with Section 4 with respect to the Source of the Modified Version. + +Aggregating or Linking the Package + +(7) You may aggregate the Package (either the Standard Version or Modified Version) with other packages and Distribute the resulting aggregation provided that you do not charge a licensing fee for the Package. Distributor Fees are permitted, and licensing fees for other components in the aggregation are permitted. The terms of this license apply to the use and Distribution of the Standard or Modified Versions as included in the aggregation. + +(8) You are permitted to link Modified and Standard Versions with other works, to embed the Package in a larger work of your own, or to build stand-alone binary or bytecode versions of applications that include the Package, and Distribute the result without restriction, provided the result does not expose a direct interface to the Package. + +Items That are Not Considered Part of a Modified Version + +(9) Works (including, but not limited to, modules and scripts) that merely extend or make use of the Package, do not, by themselves, cause the Package to be a Modified Version. In addition, such works are not considered parts of the Package itself, and are not subject to the terms of this license. + +General Provisions + +(10) Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. + +(11) If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. + +(12) This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. + +(13) This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. + +(14) Disclaimer of Warranty: +THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/LICENSES/BSD-2-Clause.txt b/LICENSES/BSD-2-Clause.txt new file mode 100644 index 0000000..5f662b3 --- /dev/null +++ b/LICENSES/BSD-2-Clause.txt @@ -0,0 +1,9 @@ +Copyright (c) + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/LICENSES/CC0-1.0.txt b/LICENSES/CC0-1.0.txt new file mode 100644 index 0000000..0e259d4 --- /dev/null +++ b/LICENSES/CC0-1.0.txt @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. diff --git a/LICENSES/ISC.txt b/LICENSES/ISC.txt new file mode 100644 index 0000000..b9c199c --- /dev/null +++ b/LICENSES/ISC.txt @@ -0,0 +1,8 @@ +ISC License: + +Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC") +Copyright (c) 1995-2003 by Internet Software Consortium + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/LICENSES/MIT.txt b/LICENSES/MIT.txt new file mode 100644 index 0000000..2071b23 --- /dev/null +++ b/LICENSES/MIT.txt @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) + +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 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. diff --git a/LICENSES/OFL-1.1.txt b/LICENSES/OFL-1.1.txt new file mode 100644 index 0000000..6fe84ee --- /dev/null +++ b/LICENSES/OFL-1.1.txt @@ -0,0 +1,43 @@ +SIL OPEN FONT LICENSE + +Version 1.1 - 26 February 2007 + +PREAMBLE + +The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others. + +The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives. + +DEFINITIONS + +"Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the copyright statement(s). + +"Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, or substituting — in part or in whole — any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment. + +"Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS + +Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission. + +5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software. + +TERMINATION + +This license becomes null and void if any of the above conditions are not met. + +DISCLAIMER + +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/LICENSES/Unlicense.txt b/LICENSES/Unlicense.txt new file mode 100644 index 0000000..cde4ac6 --- /dev/null +++ b/LICENSES/Unlicense.txt @@ -0,0 +1,10 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. + +In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. + +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 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. + +For more information, please refer to diff --git a/LICENSES/Zlib.txt b/LICENSES/Zlib.txt new file mode 100644 index 0000000..e0e3605 --- /dev/null +++ b/LICENSES/Zlib.txt @@ -0,0 +1,11 @@ +zlib License + +This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. + + 3. This notice may not be removed or altered from any source distribution. diff --git a/README.md b/README.md index 51c9529..b97f0eb 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,59 @@ + # d2tk ## Data Driven Tool Kit +[![builds.sr.ht status](https://builds.open-music-kontrollers.ch/~hp/d2tk/.svg)](https://builds.open-music-kontrollers.ch/~hp/d2tk/?) + A performant, dyamic, immediate-mode GUI tool kit in C which partially renders on-change only by massively hashing-and-cashing of vector drawing instructions and on-demand rendered sprites. ### Build / test - git clone https://git.open-music-kontrollers.ch/lad/d2tk + git clone https://git.open-music-kontrollers.ch/~hp/d2tk cd d2tk meson build cd build ninja -j4 + ninja test + +### Dependencies + +#### Cairo backend + +* freetype2 +* pixman-1 +* cairo + +#### NanoVG backend + +* gl +* glu + +#### fbdev frontend + +* libinput +* libudev +* libevdev + +#### GLFW frontend + +* glfw3 + +### PUGL frontend with Cairo backend + +* cairo-xlib + +#### Optional + +* vterm +* libevedev +* fontconfig +* [REUSE](https://git.fsfe.org/reuse/tool) (tool for compliance with the REUSE recommendations) #### Pugl/NanoVG backend @@ -28,35 +69,18 @@ and on-demand rendered sprites. ### Screenshots -![Screenshot 1](/screenshots/screenshot_1.png) - -![Screenshot 2](/screenshots/screenshot_2.png) - -![Screenshot 3](/screenshots/screenshot_3.png) - -![Screenshot 4](/screenshots/screenshot_4.png) - -![Screenshot 5](/screenshots/screenshot_5.png) - -![Screenshot 6](/screenshots/screenshot_6.png) +![Screenshot 1](screenshots/screenshot_1.png) -![Screenshot 7](/screenshots/screenshot_7.png) +![Screenshot 2](screenshots/screenshot_2.png) -![Screenshot 8](/screenshots/screenshot_8.png) +![Screenshot 3](screenshots/screenshot_3.png) -### License +![Screenshot 4](screenshots/screenshot_4.png) -Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) +![Screenshot 5](screenshots/screenshot_5.png) -This is free software: you can redistribute it and/or modify -it under the terms of the Artistic License 2.0 as published by -The Perl Foundation. +![Screenshot 6](screenshots/screenshot_6.png) -This source is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -Artistic License 2.0 for more details. +![Screenshot 7](screenshots/screenshot_7.png) -You should have received a copy of the Artistic License 2.0 -along the source as a COPYING file. If not, obtain it from -. +![Screenshot 8](screenshots/screenshot_8.png) diff --git a/VERSION b/VERSION deleted file mode 100644 index e5e81a2..0000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.1.1259 diff --git a/check_for_font b/check_for_font index befcbf4..5bde39d 100755 --- a/check_for_font +++ b/check_for_font @@ -1,3 +1,6 @@ #!/bin/sh +# SPDX-FileCopyrightText: Hanspeter Portner +# SPDX-License-Identifier: CC0-1.0 + fc-list | grep "$1" diff --git a/d2tk/backend.h b/d2tk/backend.h index 862f6d2..15cff64 100644 --- a/d2tk/backend.h +++ b/d2tk/backend.h @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #ifndef _D2TK_BACKEND_H diff --git a/d2tk/base.h b/d2tk/base.h index c37582c..e9b4344 100644 --- a/d2tk/base.h +++ b/d2tk/base.h @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #ifndef _D2TK_BASE_H @@ -767,7 +755,10 @@ D2TK_API void d2tk_base_post(d2tk_base_t *base); D2TK_API void -d2tk_base_probe(d2tk_base_t *base); +d2tk_base_probe(d2tk_base_t *base, int *fds, int numfds); + +D2TK_API d2tk_core_t * +d2tk_base_get_core(d2tk_base_t *base); D2TK_API int d2tk_base_get_file_descriptors(d2tk_base_t *base, int *fds, int numfds); diff --git a/d2tk/config.h.in b/d2tk/config.h.in index e8be923..fca007a 100644 --- a/d2tk/config.h.in +++ b/d2tk/config.h.in @@ -1,4 +1,10 @@ +/* + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 + */ + #define D2TK_EVDEV @D2TK_EVDEV@ #define D2TK_INPUT_1_15 @D2TK_INPUT_1_15@ #define D2TK_FONTCONFIG @D2TK_FONTCONFIG@ #define D2TK_DEBUG @D2TK_DEBUG@ +#define D2TK_GLES_VERSION @D2TK_GLES_VERSION@ diff --git a/d2tk/core.h b/d2tk/core.h index 265a06c..4780993 100644 --- a/d2tk/core.h +++ b/d2tk/core.h @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #ifndef _D2TK_CORE_H @@ -21,8 +9,9 @@ #include #include #include +#include -#include "config.h" +#include "d2tk_config.h" #include #ifdef __cplusplus diff --git a/d2tk/d2tk.h b/d2tk/d2tk.h index 2d12a82..d7a023f 100644 --- a/d2tk/d2tk.h +++ b/d2tk/d2tk.h @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #ifndef _D2TK_H diff --git a/d2tk/frontend.h b/d2tk/frontend.h index 716bad5..5cd1faf 100644 --- a/d2tk/frontend.h +++ b/d2tk/frontend.h @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #ifndef _D2TK_FRONTEND_H diff --git a/d2tk/frontend_fbdev.h b/d2tk/frontend_fbdev.h index 969c644..a4f6fd5 100644 --- a/d2tk/frontend_fbdev.h +++ b/d2tk/frontend_fbdev.h @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #ifndef _D2TK_FRONTEND_FBDEV_H diff --git a/d2tk/frontend_glfw.h b/d2tk/frontend_glfw.h index b7b934f..2f58435 100644 --- a/d2tk/frontend_glfw.h +++ b/d2tk/frontend_glfw.h @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #ifndef _D2TK_FRONTEND_GLFW_H diff --git a/d2tk/frontend_pugl.h b/d2tk/frontend_pugl.h index 4be0b86..9e46ab4 100644 --- a/d2tk/frontend_pugl.h +++ b/d2tk/frontend_pugl.h @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #ifndef _D2TK_FRONTEND_PUGL_H diff --git a/d2tk/hash.h b/d2tk/hash.h index a6cf614..bbf0082 100644 --- a/d2tk/hash.h +++ b/d2tk/hash.h @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #ifndef _D2TK_HASH_H diff --git a/d2tk/util.h b/d2tk/util.h index f8eebf8..9b9da01 100644 --- a/d2tk/util.h +++ b/d2tk/util.h @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #ifndef _D2TK_UTIL_H @@ -22,7 +10,7 @@ extern "C" { #endif -#include "config.h" +#include "d2tk_config.h" #include /****f* util/d2tk_util_spawn diff --git a/example/custom_cairo.c b/example/custom_cairo.c index 56904ed..5026250 100644 --- a/example/custom_cairo.c +++ b/example/custom_cairo.c @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 + */ + #include #include diff --git a/example/custom_nanovg.c b/example/custom_nanovg.c index 7bd2db3..96692b0 100644 --- a/example/custom_nanovg.c +++ b/example/custom_nanovg.c @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 + */ + #include #include diff --git a/example/d2tk_fbdev.c b/example/d2tk_fbdev.c index 47baed8..4303ca1 100644 --- a/example/d2tk_fbdev.c +++ b/example/d2tk_fbdev.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/example/d2tk_glfw.c b/example/d2tk_glfw.c index 31ce905..6215c4a 100644 --- a/example/d2tk_glfw.c +++ b/example/d2tk_glfw.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/example/d2tk_pugl.c b/example/d2tk_pugl.c index 4132547..08647b7 100644 --- a/example/d2tk_pugl.c +++ b/example/d2tk_pugl.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/example/example.c b/example/example.c index be8ed79..5a99549 100644 --- a/example/example.c +++ b/example/example.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include @@ -23,6 +11,7 @@ #include #include #include +#include #include "example/example.h" @@ -963,7 +952,7 @@ _render_c_copypaste_set(d2tk_frontend_t *frontend, d2tk_base_t *base, if(d2tk_base_button_is_changed(base, D2TK_ID, rect)) { static unsigned int count = 0; - static const char *type = "text/plain"; + static const char *type = "UTF8_STRING"; char buf [32]; const size_t buf_len = snprintf(buf, sizeof(buf), "d2tk #%u", count++); diff --git a/example/example.h b/example/example.h index bbb013b..2c5383c 100644 --- a/example/example.h +++ b/example/example.h @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #ifndef _D2TK_EXAMPLE_H diff --git a/example/libre-arrow-circle-right.png.license b/example/libre-arrow-circle-right.png.license new file mode 100644 index 0000000..5b057fc --- /dev/null +++ b/example/libre-arrow-circle-right.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: LibreICONS +SPDX-License-Identifier: MIT diff --git a/example/libre-gui-file.png.license b/example/libre-gui-file.png.license new file mode 100644 index 0000000..5b057fc --- /dev/null +++ b/example/libre-gui-file.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: LibreICONS +SPDX-License-Identifier: MIT diff --git a/example/libre-gui-folder.png.license b/example/libre-gui-folder.png.license new file mode 100644 index 0000000..5b057fc --- /dev/null +++ b/example/libre-gui-folder.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: LibreICONS +SPDX-License-Identifier: MIT diff --git a/meson.build b/meson.build index 8e8e9ed..ca11755 100644 --- a/meson.build +++ b/meson.build @@ -1,8 +1,11 @@ +# SPDX-FileCopyrightText: Hanspeter Portner +# SPDX-License-Identifier: CC0-1.0 + project('d2tk', 'c', default_options : [ 'buildtype=release', 'warning_level=3', 'werror=false', - 'b_lto=false', + 'b_lto=true', 'c_std=gnu11']) static_link = false #meson.is_cross_build() @@ -14,6 +17,7 @@ build_doc = get_option('build-doc') use_backend_cairo = get_option('use-backend-cairo') use_backend_nanovg = get_option('use-backend-nanovg') +use_gles_version = get_option('use-gles-version') use_frontend_fbdev = get_option('use-frontend-fbdev') use_frontend_pugl = get_option('use-frontend-pugl') use_frontend_glfw = get_option('use-frontend-glfw') @@ -33,6 +37,8 @@ check_for_font = find_program('check_for_font', robodoc = find_program('robodoc', native : true, required : build_doc) +reuse = find_program('reuse', + required : false) cc = meson.get_compiler('c') @@ -75,12 +81,11 @@ evdev_dep = dependency('libevdev', required : use_frontend_fbdev) # dependencies for backend_nanovg -glu_dep = dependency('glu', - version : '>=9.0.0', +gl_dep = dependency('gl', static : static_link, required : use_backend_nanovg) -glew_dep = dependency('glew', - version : '>=2.0.0', +glu_dep = dependency('glu', + version: '>=9.0.0', static : static_link, required : use_backend_nanovg) if use_frontend_glfw.enabled() @@ -115,13 +120,13 @@ nanovg_inc = include_directories(join_paths('nanovg', 'src')) linenoise_inc = include_directories('linenoise') inc_dir = [d2tk_inc, pugl_inc, nanovg_inc, linenoise_inc] -rawvers = run_command('cat', 'VERSION').stdout().strip() -version = rawvers.split('.') +version = get_option('version').split('.') conf_data = configuration_data() conf_data.set('MAJOR_VERSION', version[0]) conf_data.set('MINOR_VERSION', version[1]) conf_data.set('MICRO_VERSION', version[2]) +conf_data.set('D2TK_GLES_VERSION', use_gles_version) add_project_arguments('-D_GNU_SOURCE', language : 'c') @@ -310,7 +315,7 @@ if use_backend_nanovg.enabled() d2tk_nanovg = declare_dependency( compile_args : ['-DPUGL_STATIC'], include_directories : inc_dir, - dependencies : [deps, glu_dep, glew_dep], + dependencies : [deps, gl_dep, glu_dep], link_args : links, sources : [lib_srcs, nanovg_srcs, pugl_srcs, pugl_gl_srcs]) @@ -326,7 +331,7 @@ if use_backend_nanovg.enabled() if use_frontend_glfw.enabled() d2tk_glfw = declare_dependency( include_directories : inc_dir, - dependencies : [deps, glfw_dep, glew_dep], + dependencies : [deps, gl_dep, glu_dep, glfw_dep], link_args : links, sources : [lib_srcs, nanovg_srcs, glfw_srcs]) @@ -342,7 +347,7 @@ endif config_h = configure_file( input : join_paths('d2tk', 'config.h.in'), - output : 'config.h', + output : 'd2tk_config.h', configuration : conf_data, install : false) @@ -423,12 +428,21 @@ if build_tests endif endif +if reuse.found() + test('REUSE', reuse, args : [ + '--root', meson.current_source_dir(), + 'lint' + ]) +endif + if build_doc - run_command('rm', '-rf', 'doc') + run_command('rm', '-rf', 'doc', + check : true) run_command(robodoc, '--src', './d2tk', '--doc', 'doc', '--multidoc', '--troff', '--nosort', '--nodesc', '--cmode', - '--compress', 'gzip') + '--compress', 'gzip', + check : true) endif diff --git a/meson_options.txt b/meson_options.txt index 242cbe0..9faa50c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: Hanspeter Portner +# SPDX-License-Identifier: CC0-1.0 + option('build-debug-overlay', type : 'boolean', value : false, @@ -23,6 +26,12 @@ option('use-backend-nanovg', type : 'feature', value : 'disabled', yield : true) +option('use-gles-version', + type : 'integer', + min : 2, + max : 3, + value : 3, + yield : true) option('use-frontend-fbdev', type : 'feature', @@ -45,3 +54,4 @@ option('use-fontconfig', type : 'feature', value : 'disabled', yield : true) +option('version', type : 'string', value : '0.1.1303') diff --git a/robodoc.rc b/robodoc.rc new file mode 100644 index 0000000..51b99e1 --- /dev/null +++ b/robodoc.rc @@ -0,0 +1,16 @@ +# SPDX-FileCopyrightText: Hanspeter Portner +# SPDX-License-Identifier: CC0-1.0 + +items: + SUMMARY + SYNOPSIS + FUNCTION + INPUTS + OUTPUT + SEE ALSO +source items: + SYNOPSIS +remark begin markers: + /* +remark end markers: + */ diff --git a/screenshots/screenshot_1.png.license b/screenshots/screenshot_1.png.license new file mode 100644 index 0000000..20f496d --- /dev/null +++ b/screenshots/screenshot_1.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Hanspeter Portner +SPDX-License-Identifier: CC0-1.0 diff --git a/screenshots/screenshot_2.png.license b/screenshots/screenshot_2.png.license new file mode 100644 index 0000000..20f496d --- /dev/null +++ b/screenshots/screenshot_2.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Hanspeter Portner +SPDX-License-Identifier: CC0-1.0 diff --git a/screenshots/screenshot_3.png.license b/screenshots/screenshot_3.png.license new file mode 100644 index 0000000..20f496d --- /dev/null +++ b/screenshots/screenshot_3.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Hanspeter Portner +SPDX-License-Identifier: CC0-1.0 diff --git a/screenshots/screenshot_4.png.license b/screenshots/screenshot_4.png.license new file mode 100644 index 0000000..20f496d --- /dev/null +++ b/screenshots/screenshot_4.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Hanspeter Portner +SPDX-License-Identifier: CC0-1.0 diff --git a/screenshots/screenshot_5.png.license b/screenshots/screenshot_5.png.license new file mode 100644 index 0000000..20f496d --- /dev/null +++ b/screenshots/screenshot_5.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Hanspeter Portner +SPDX-License-Identifier: CC0-1.0 diff --git a/screenshots/screenshot_6.png.license b/screenshots/screenshot_6.png.license new file mode 100644 index 0000000..20f496d --- /dev/null +++ b/screenshots/screenshot_6.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Hanspeter Portner +SPDX-License-Identifier: CC0-1.0 diff --git a/screenshots/screenshot_7.png.license b/screenshots/screenshot_7.png.license new file mode 100644 index 0000000..20f496d --- /dev/null +++ b/screenshots/screenshot_7.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Hanspeter Portner +SPDX-License-Identifier: CC0-1.0 diff --git a/screenshots/screenshot_8.png.license b/screenshots/screenshot_8.png.license new file mode 100644 index 0000000..20f496d --- /dev/null +++ b/screenshots/screenshot_8.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Hanspeter Portner +SPDX-License-Identifier: CC0-1.0 diff --git a/src/backend_cairo.c b/src/backend_cairo.c index 4e17769..a3a7f4d 100644 --- a/src/backend_cairo.c +++ b/src/backend_cairo.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/src/backend_nanovg.c b/src/backend_nanovg.c index 4787164..d5203cb 100644 --- a/src/backend_nanovg.c +++ b/src/backend_nanovg.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include @@ -20,17 +8,28 @@ #include #include #include +#include + +#include "d2tk_config.h" #include -#if defined(__APPLE__) -# include -# include +#if D2TK_GLES_VERSION == 2 +# include +# include +# define NANOVG_GLES2_IMPLEMENTATION +#elif D2TK_GLES_VERSION == 3 +# include +# include +# define NANOVG_GLES3_IMPLEMENTATION #else -# include +# error 'invalid GLES version' +#endif + +#ifndef GL_BGRA +# define GL_BGRA GL_BGRA_EXT #endif -#define NANOVG_GLES3_IMPLEMENTATION #include #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wsign-compare" @@ -109,18 +108,6 @@ d2tk_nanovg_free(void *data) static void * d2tk_nanovg_new(const char *bundle_path) { -#if defined(__APPLE__) -//FIXME -#else - glewExperimental = GL_TRUE; - const GLenum err = glewInit(); - if(err != GLEW_OK) - { - fprintf(stderr, "glewInit failed: %s\n", glewGetErrorString(err)); - return NULL; - } -#endif - d2tk_backend_nanovg_t *backend = calloc(1, sizeof(d2tk_backend_nanovg_t)); if(!backend) { diff --git a/src/base.c b/src/base.c index ebd59c6..545b913 100644 --- a/src/base.c +++ b/src/base.c @@ -1,27 +1,14 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include #include #include #include -#if !defined(_WIN32) -# include -#endif +#include +#include #include "base_internal.h" @@ -909,7 +896,6 @@ _d2tk_base_probe(int fd) return 0; } -#if !defined(_WIN32) struct pollfd fds = { .fd = fd, .events = POLLIN, @@ -932,31 +918,29 @@ _d2tk_base_probe(int fd) //printf("[%s] ready\n", __func__); } return 1; } -#else - return 0; -#endif } D2TK_API void -d2tk_base_probe(d2tk_base_t *base) +d2tk_base_probe(d2tk_base_t *base, int *fds, int numfds) { - for(unsigned i = 0; i < _D2TK_MAX_ATOM; i++) + for(int i = 0; i < numfds; i++) { - d2tk_atom_t *atom = &base->atoms[i]; + const int fd = fds[i]; - if(atom->id && atom->type && atom->event) + if(_d2tk_base_probe(fd)) { - const int fd = atom->event(D2TK_ATOM_EVENT_FD, atom->body); - - if(_d2tk_base_probe(fd)) - { - d2tk_base_set_again(base); - break; - } + d2tk_base_set_again(base); + break; } } } +D2TK_API d2tk_core_t * +d2tk_base_get_core(d2tk_base_t *base) +{ + return base->core; +} + D2TK_API int d2tk_base_get_file_descriptors(d2tk_base_t *base, int *fds, int numfds) { diff --git a/src/base_bar.c b/src/base_bar.c index 67cbfb4..d567d9d 100644 --- a/src/base_bar.c +++ b/src/base_bar.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/src/base_bitmap.c b/src/base_bitmap.c index a542169..4542d01 100644 --- a/src/base_bitmap.c +++ b/src/base_bitmap.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include "base_internal.h" diff --git a/src/base_button.c b/src/base_button.c index 244e7d1..0724f29 100644 --- a/src/base_button.c +++ b/src/base_button.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/src/base_combo.c b/src/base_combo.c index 3ab073c..833534e 100644 --- a/src/base_combo.c +++ b/src/base_combo.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/src/base_cursor.c b/src/base_cursor.c index e9be4ed..e4e6ce4 100644 --- a/src/base_cursor.c +++ b/src/base_cursor.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include "base_internal.h" diff --git a/src/base_custom.c b/src/base_custom.c index 2396530..2914d6b 100644 --- a/src/base_custom.c +++ b/src/base_custom.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include "base_internal.h" diff --git a/src/base_dial.c b/src/base_dial.c index ae3c97a..c12f6be 100644 --- a/src/base_dial.c +++ b/src/base_dial.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/src/base_flowmatrix.c b/src/base_flowmatrix.c index 0edc1c5..51877c9 100644 --- a/src/base_flowmatrix.c +++ b/src/base_flowmatrix.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/src/base_frame.c b/src/base_frame.c index d78bdf0..3366b07 100644 --- a/src/base_frame.c +++ b/src/base_frame.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/src/base_image.c b/src/base_image.c index cfed2d1..4b3db29 100644 --- a/src/base_image.c +++ b/src/base_image.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/src/base_internal.h b/src/base_internal.h index f801418..c2dafa5 100644 --- a/src/base_internal.h +++ b/src/base_internal.h @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/src/base_label.c b/src/base_label.c index 64cbd4b..25c5949 100644 --- a/src/base_label.c +++ b/src/base_label.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/src/base_layout.c b/src/base_layout.c index 770e5df..919fbf9 100644 --- a/src/base_layout.c +++ b/src/base_layout.c @@ -1,28 +1,20 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ +#include + #include "base_internal.h" struct _d2tk_layout_t { unsigned N; const d2tk_coord_t *frac; d2tk_flag_t flag; - d2tk_coord_t dd; - d2tk_coord_t rem; + float dd; + float rem; + float a; + float b; unsigned k; d2tk_rect_t rect; }; @@ -57,36 +49,40 @@ d2tk_layout_begin(const d2tk_rect_t *rect, unsigned N, const d2tk_coord_t *frac, { if(lay->flag & D2TK_FLAG_LAYOUT_REL) { - lay->dd = tot ? (rect->h / tot) : 0; + lay->dd = tot ? ((float)rect->h / tot) : 0; + lay->rem = 0.f; } else { - lay->dd = 1; + lay->dd = 1.f; + lay->rem = missing ? ((float)rect->h - tot) / missing : 0; } - lay->rem = missing ? (rect->h - tot) / missing : 0; - - lay->rect.h = lay->frac[lay->k] + lay->a = rect->y; + lay->b = lay->frac[lay->k] ? lay->dd * lay->frac[lay->k] : lay->rem; + lay->rect.h = rintf(lay->b); lay->rect.w = rect->w; } else // D2TK_FLAG_LAYOUT_X { if(lay->flag & D2TK_FLAG_LAYOUT_REL) { - lay->dd = tot ? (rect->w / tot) : 0; + lay->dd = tot ? ((float)rect->w / tot) : 0; + lay->rem = 0.f; } else { - lay->dd = 1; + lay->dd = 1.f; + lay->rem = missing ? ((float)rect->w - tot) / missing : 0; } - lay->rem = missing ? (rect->w - tot) / missing : 0; - - lay->rect.w = lay->frac[lay->k] + lay->a = rect->x; + lay->b = lay->frac[lay->k] ? lay->dd * lay->frac[lay->k] : lay->rem; + lay->rect.w = rintf(lay->b); lay->rect.h = rect->h; } @@ -107,19 +103,20 @@ d2tk_layout_next(d2tk_layout_t *lay) return NULL; } + lay->a += lay->b; + lay->b = lay->frac[lay->k] + ? lay->dd * lay->frac[lay->k] + : lay->rem; + if(lay->flag & D2TK_FLAG_LAYOUT_Y) { - lay->rect.y += lay->rect.h; - lay->rect.h = lay->frac[lay->k] - ? lay->dd * lay->frac[lay->k] - : lay->rem; + lay->rect.y = rintf(lay->a); + lay->rect.h = rintf(lay->b); } else // D2TK_FLAG_LAYOUT_X { - lay->rect.x += lay->rect.w; - lay->rect.w = lay->frac[lay->k] - ? lay->dd * lay->frac[lay->k] - : lay->rem; + lay->rect.x = rintf(lay->a); + lay->rect.w = rintf(lay->b); } return lay; diff --git a/src/base_lineedit.c b/src/base_lineedit.c index dc741a4..91f267f 100644 --- a/src/base_lineedit.c +++ b/src/base_lineedit.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/src/base_link.c b/src/base_link.c index 355d394..7d47232 100644 --- a/src/base_link.c +++ b/src/base_link.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/src/base_meter.c b/src/base_meter.c index 6d8d080..ff0923d 100644 --- a/src/base_meter.c +++ b/src/base_meter.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/src/base_pane.c b/src/base_pane.c index 07b6b5d..63f3e4f 100644 --- a/src/base_pane.c +++ b/src/base_pane.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/src/base_pty.c b/src/base_pty.c index b380a4c..4dddb3d 100644 --- a/src/base_pty.c +++ b/src/base_pty.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/src/base_scrollbar.c b/src/base_scrollbar.c index c98b038..a614f62 100644 --- a/src/base_scrollbar.c +++ b/src/base_scrollbar.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include "base_internal.h" diff --git a/src/base_separator.c b/src/base_separator.c index f45afe3..dabf79b 100644 --- a/src/base_separator.c +++ b/src/base_separator.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/src/base_spinner.c b/src/base_spinner.c index e2c821c..d9801cd 100644 --- a/src/base_spinner.c +++ b/src/base_spinner.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/src/base_table.c b/src/base_table.c index eefa6e1..8ad042b 100644 --- a/src/base_table.c +++ b/src/base_table.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include "base_internal.h" diff --git a/src/base_textfield.c b/src/base_textfield.c index 9d0fbc1..56a5d49 100644 --- a/src/base_textfield.c +++ b/src/base_textfield.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/src/base_tooltip.c b/src/base_tooltip.c index d105470..f8a1ff1 100644 --- a/src/base_tooltip.c +++ b/src/base_tooltip.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/src/base_vkb.c b/src/base_vkb.c index bbe65c6..31b1a05 100644 --- a/src/base_vkb.c +++ b/src/base_vkb.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/src/base_wave.c b/src/base_wave.c index b9dddc6..66230cf 100644 --- a/src/base_wave.c +++ b/src/base_wave.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/src/core.c b/src/core.c index 5383776..5360641 100644 --- a/src/core.c +++ b/src/core.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include @@ -24,11 +12,7 @@ #include #include #include -#if defined(_WIN32) -# include -#else -# include -#endif +#include #include "core_internal.h" #include diff --git a/src/core_internal.h b/src/core_internal.h index d07252b..7cc1ef1 100644 --- a/src/core_internal.h +++ b/src/core_internal.h @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #ifndef _D2TK_CORE_INTERNAL_H diff --git a/src/frontend_fbdev.c b/src/frontend_fbdev.c index 3ae87ed..2768aaa 100644 --- a/src/frontend_fbdev.c +++ b/src/frontend_fbdev.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include @@ -782,10 +770,10 @@ d2tk_frontend_get_scale() } D2TK_API int -d2tk_frontend_set_clipboard(d2tk_frontend_t *dpugl, const char *type, +d2tk_frontend_set_clipboard(d2tk_frontend_t *fbdev, const char *type, const void *buf, size_t buf_len) { - (void)dpugl; + (void)fbdev; (void)type; (void)buf; (void)buf_len; @@ -793,10 +781,10 @@ d2tk_frontend_set_clipboard(d2tk_frontend_t *dpugl, const char *type, } D2TK_API const void * -d2tk_frontend_get_clipboard(d2tk_frontend_t *dpugl, const char **type, +d2tk_frontend_get_clipboard(d2tk_frontend_t *fbdev, const char **type, size_t *buf_len) { - (void)dpugl; + (void)fbdev; (void)type; (void)buf_len; return NULL; //FIXME diff --git a/src/frontend_glfw.c b/src/frontend_glfw.c index 6950c00..ab56c08 100644 --- a/src/frontend_glfw.c +++ b/src/frontend_glfw.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include @@ -20,11 +8,17 @@ #include #include "core_internal.h" +#include "d2tk_config.h" #include - #include -#define GLFW_INCLUDE_ES3 +#if D2TK_GLES_VERSION == 2 +# define GLFW_INCLUDE_ES2 +#elif D2TK_GLES_VERSION == 3 +# define GLFW_INCLUDE_ES3 +#else +# error 'invalid GLES version' +#endif #define GLFW_INCLUDE_GLEXT #include @@ -32,6 +26,7 @@ struct _d2tk_frontend_t { const d2tk_glfw_config_t *config; int w; int h; + sig_atomic_t done; GLFWwindow * window; d2tk_base_t *base; void *ctx; @@ -54,8 +49,8 @@ _d2tk_frontend_expose(d2tk_frontend_t *dglfw) } } -D2TK_API int -d2tk_frontend_poll(d2tk_frontend_t *dglfw, double timeout) +static void +_d2tk_frontend_update(d2tk_frontend_t *dglfw, double timeout) { d2tk_base_t *base = dglfw->base; int width; @@ -85,8 +80,26 @@ d2tk_frontend_poll(d2tk_frontend_t *dglfw, double timeout) _d2tk_frontend_expose(dglfw); glfwSwapBuffers(dglfw->window); +} - return 0; +D2TK_API int +d2tk_frontend_poll(d2tk_frontend_t *dglfw, double timeout) +{ +#define NUMFDS 32 + int fds [NUMFDS]; + const int numfds = d2tk_frontend_get_file_descriptors(dglfw, fds, NUMFDS); +#undef NUMFDS + + d2tk_base_probe(dglfw->base, fds, numfds); + + if(d2tk_base_get_again(dglfw->base)) + { + d2tk_frontend_redisplay(dglfw); + } + + _d2tk_frontend_update(dglfw, timeout); + + return dglfw->done; } D2TK_API int @@ -106,7 +119,7 @@ d2tk_frontend_run(d2tk_frontend_t *dglfw, const sig_atomic_t *done) { while(!*done) { - if(d2tk_frontend_poll(dglfw, -1.0)) + if(d2tk_frontend_poll(dglfw, 0.1)) { break; } @@ -149,7 +162,8 @@ _d2tk_frontend_modifiers(d2tk_base_t *base, int mods) } static void -_d2tk_key(GLFWwindow *window, int key, int scancode, int action, int mods) +_d2tk_key(GLFWwindow *window, int key, int scancode __attribute__((unused)), + int action, int mods) { d2tk_frontend_t *dglfw = glfwGetWindowUserPointer(window); d2tk_base_t *base = dglfw->base; @@ -157,7 +171,7 @@ _d2tk_key(GLFWwindow *window, int key, int scancode, int action, int mods) _d2tk_frontend_modifiers(base, mods); - fprintf(stderr, "[%s] %i %i %i %i\n", __func__, key, scancode, action, mods); + //fprintf(stderr, "[%s] %i %i %i %i\n", __func__, key, scancode, action, mods); d2tk_keymask_t mask = D2TK_KEYMASK_NONE; unsigned int codepoint = 0; @@ -167,75 +181,232 @@ _d2tk_key(GLFWwindow *window, int key, int scancode, int action, int mods) case GLFW_KEY_ENTER: { mask = D2TK_KEYMASK_ENTER; - codepoint = '\n'; - } break; + codepoint = '\r'; + } break; case GLFW_KEY_TAB: { mask = D2TK_KEYMASK_TAB; codepoint = '\t'; - } break; + } break; case GLFW_KEY_BACKSPACE: { mask = D2TK_KEYMASK_BACKSPACE; codepoint = '\b'; - } break; + } break; case GLFW_KEY_ESCAPE: { mask = D2TK_KEYMASK_ESCAPE; codepoint = 0x1B; - } break; + } break; case GLFW_KEY_UP: { mask = D2TK_KEYMASK_UP; - } break; + } break; case GLFW_KEY_DOWN: { mask = D2TK_KEYMASK_DOWN; - } break; + } break; case GLFW_KEY_LEFT: { mask = D2TK_KEYMASK_LEFT; - } break; + } break; case GLFW_KEY_RIGHT: { mask = D2TK_KEYMASK_RIGHT; - } break; + } break; case GLFW_KEY_INSERT: { mask = D2TK_KEYMASK_INS; - } break; + } break; case GLFW_KEY_DELETE: { mask = D2TK_KEYMASK_DEL; - } break; + } break; case GLFW_KEY_HOME: { mask = D2TK_KEYMASK_HOME; - } break; + } break; case GLFW_KEY_END: { mask = D2TK_KEYMASK_END; - } break; + } break; case GLFW_KEY_PAGE_UP: { mask = D2TK_KEYMASK_PAGEUP; - } break; + } break; case GLFW_KEY_PAGE_DOWN: { mask = D2TK_KEYMASK_PAGEDOWN; - } break; + } break; + + case GLFW_KEY_LEFT_SHIFT: + // fall-through + case GLFW_KEY_RIGHT_SHIFT: + { + d2tk_base_set_modmask(base, D2TK_MODMASK_SHIFT, pressed); + } break; + + case GLFW_KEY_LEFT_CONTROL: + // fall-through + case GLFW_KEY_RIGHT_CONTROL: + { + d2tk_base_set_modmask(base, D2TK_MODMASK_CTRL, pressed); + } break; + + case GLFW_KEY_LEFT_ALT: + // fall-through + case GLFW_KEY_RIGHT_ALT: + { + d2tk_base_set_modmask(base, D2TK_MODMASK_ALT, pressed); + } break; + + case GLFW_KEY_LEFT_SUPER: + // fall-through + case GLFW_KEY_RIGHT_SUPER: + // fall-through + case GLFW_KEY_MENU: + { + // nothing to do + } break; } + if(d2tk_base_get_modmask(base, D2TK_MODMASK_CTRL, false)) + { + switch(key) + { + case GLFW_KEY_SPACE: + { + codepoint = ' '; + } break; + case GLFW_KEY_APOSTROPHE: + { + codepoint = '\''; + } break; + case GLFW_KEY_COMMA: + { + codepoint = ','; + } break; + case GLFW_KEY_MINUS: + { + codepoint = '-'; + } break; + case GLFW_KEY_PERIOD: + { + codepoint = '.'; + } break; + case GLFW_KEY_SLASH: + { + codepoint = '/'; + } break; + + case GLFW_KEY_0: + // fall-through + case GLFW_KEY_1: + // fall-through + case GLFW_KEY_2: + // fall-through + case GLFW_KEY_3: + // fall-through + case GLFW_KEY_4: + // fall-through + case GLFW_KEY_5: + // fall-through + case GLFW_KEY_6: + // fall-through + case GLFW_KEY_7: + // fall-through + case GLFW_KEY_8: + // fall-through + case GLFW_KEY_9: + { + codepoint = (key - GLFW_KEY_0) + '0'; + } break; + + case GLFW_KEY_SEMICOLON: + { + codepoint = ';'; + } break; + case GLFW_KEY_EQUAL: + { + codepoint = '='; + } break; + + case GLFW_KEY_A: + // fall-through + case GLFW_KEY_B: + // fall-through + case GLFW_KEY_C: + // fall-through + case GLFW_KEY_D: + // fall-through + case GLFW_KEY_E: + // fall-through + case GLFW_KEY_F: + // fall-through + case GLFW_KEY_G: + // fall-through + case GLFW_KEY_H: + // fall-through + case GLFW_KEY_I: + // fall-through + case GLFW_KEY_J: + // fall-through + case GLFW_KEY_K: + // fall-through + case GLFW_KEY_L: + // fall-through + case GLFW_KEY_M: + // fall-through + case GLFW_KEY_N: + // fall-through + case GLFW_KEY_O: + // fall-through + case GLFW_KEY_P: + // fall-through + case GLFW_KEY_Q: + // fall-through + case GLFW_KEY_R: + // fall-through + case GLFW_KEY_S: + // fall-through + case GLFW_KEY_T: + // fall-through + case GLFW_KEY_U: + // fall-through + case GLFW_KEY_V: + // fall-through + case GLFW_KEY_W: + // fall-through + case GLFW_KEY_X: + // fall-through + case GLFW_KEY_Y: + // fall-through + case GLFW_KEY_Z: + { + codepoint = (key - GLFW_KEY_A) + 1; + } break; + } + } + + bool handled = false; + if(mask != D2TK_KEYMASK_NONE) { d2tk_base_set_keymask(base, mask, pressed); + handled = true; } if(codepoint && pressed) { d2tk_base_append_utf8(base, codepoint); + handled = true; + } + + if(handled) + { + d2tk_frontend_redisplay(dglfw); } } @@ -245,9 +416,10 @@ _d2tk_char(GLFWwindow *window, unsigned int codepoint) d2tk_frontend_t *dglfw = glfwGetWindowUserPointer(window); d2tk_base_t *base = dglfw->base; - fprintf(stderr, "[%s] %u\n", __func__, codepoint); + //fprintf(stderr, "[%s] %u\n", __func__, codepoint); d2tk_base_append_utf8(base, codepoint); + d2tk_frontend_redisplay(dglfw); } static void @@ -257,6 +429,7 @@ _d2tk_cursor_pos(GLFWwindow *window, double xpos, double ypos) d2tk_base_t *base = dglfw->base; d2tk_base_set_mouse_pos(base, xpos, ypos); + d2tk_frontend_redisplay(dglfw); } static void @@ -269,6 +442,7 @@ _d2tk_cursor_enter(GLFWwindow *window, int entered) { d2tk_base_set_full_refresh(base); } + d2tk_frontend_redisplay(dglfw); } static void @@ -277,6 +451,7 @@ _d2tk_mouse_button(GLFWwindow *window, int button, int action, int mods) d2tk_frontend_t *dglfw = glfwGetWindowUserPointer(window); d2tk_base_t *base = dglfw->base; const bool pressed = action == GLFW_PRESS; + bool handled = false; _d2tk_frontend_modifiers(base, mods); @@ -285,18 +460,26 @@ _d2tk_mouse_button(GLFWwindow *window, int button, int action, int mods) case 3: { d2tk_base_set_butmask(base, D2TK_BUTMASK_RIGHT, pressed); + handled = true; } break; case 2: { d2tk_base_set_butmask(base, D2TK_BUTMASK_MIDDLE, pressed); + handled = true; } break; case 1: // fall-through default: { d2tk_base_set_butmask(base, D2TK_BUTMASK_LEFT, pressed); + handled = true; } break; } + + if(handled) + { + d2tk_frontend_redisplay(dglfw); + } } static void @@ -306,6 +489,15 @@ _d2tk_scroll(GLFWwindow *window, double xoffset, double yoffset) d2tk_base_t *base = dglfw->base; d2tk_base_add_mouse_scroll(base, xoffset, yoffset); + d2tk_frontend_redisplay(dglfw); +} + +static void +_d2tk_close(GLFWwindow *window) +{ + d2tk_frontend_t *dglfw = glfwGetWindowUserPointer(window); + + dglfw->done = true; } D2TK_API d2tk_frontend_t * @@ -313,11 +505,13 @@ d2tk_glfw_new(const d2tk_glfw_config_t *config) { if(glfwInit() != GLFW_TRUE) { + fprintf(stderr, "glfwInit: 0x%x\n", glfwGetError(NULL)); return NULL; } - glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API); - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); + glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API); + glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_NATIVE_CONTEXT_API); + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, D2TK_GLES_VERSION); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); d2tk_frontend_t *dglfw = calloc(1, sizeof(d2tk_frontend_t)); @@ -333,6 +527,7 @@ d2tk_glfw_new(const d2tk_glfw_config_t *config) if(!dglfw->window) { + fprintf(stderr, "glfwCreateWindow: 0x%x\n", glfwGetError(NULL)); goto fail; } @@ -344,6 +539,7 @@ d2tk_glfw_new(const d2tk_glfw_config_t *config) glfwSetCursorEnterCallback(dglfw->window, _d2tk_cursor_enter); glfwSetMouseButtonCallback(dglfw->window, _d2tk_mouse_button); glfwSetScrollCallback(dglfw->window, _d2tk_scroll); + glfwSetWindowCloseCallback(dglfw->window, _d2tk_close); glfwMakeContextCurrent(dglfw->window); glfwSwapInterval(1); @@ -379,10 +575,9 @@ fail: } D2TK_API void -d2tk_frontend_redisplay(d2tk_frontend_t *dglfw) +d2tk_frontend_redisplay(d2tk_frontend_t *dglfw __attribute__((unused))) { - (void)dglfw; - //FIXME + glfwPostEmptyEvent(); } D2TK_API int @@ -415,22 +610,30 @@ d2tk_frontend_get_base(d2tk_frontend_t *dglfw) } D2TK_API int -d2tk_frontend_set_clipboard(d2tk_frontend_t *dpugl, const char *type, - const void *buf, size_t buf_len) +d2tk_frontend_set_clipboard(d2tk_frontend_t *dglfw __attribute__((unused)), + const char *type, const void *buf, size_t buf_len __attribute__((unused))) { - (void)dpugl; - (void)type; - (void)buf; - (void)buf_len; - return 1; //FIXME + if(strcmp(type, "UTF8_STRING")) + { + return 1; + } + + glfwSetClipboardString(NULL, buf); + + return 0; } D2TK_API const void * -d2tk_frontend_get_clipboard(d2tk_frontend_t *dpugl, const char **type, - size_t *buf_len) +d2tk_frontend_get_clipboard(d2tk_frontend_t *dglfw __attribute__((unused)), + const char **type, size_t *buf_len) { - (void)dpugl; - (void)type; - (void)buf_len; - return NULL; //FIXME + const char *text = glfwGetClipboardString(NULL); + + if(text && type && buf_len) + { + *type = "UTF8_STRING"; + *buf_len = strlen(text) + 1; + } + + return text; } diff --git a/src/frontend_pugl.c b/src/frontend_pugl.c index 62ade95..01e93cc 100644 --- a/src/frontend_pugl.c +++ b/src/frontend_pugl.c @@ -1,31 +1,13 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include #include #include -#if defined(__APPLE__) -// FIXME -#elif defined(_WIN32) -# include -#else -# include -#endif +#include #include #if defined(PUGL_HAVE_CAIRO) @@ -480,7 +462,12 @@ _d2tk_frontend_event_func(PuglView *view, const PuglEvent *e) D2TK_API int d2tk_frontend_poll(d2tk_frontend_t *dpugl, double timeout) { - d2tk_base_probe(dpugl->base); +#define NUMFDS 32 + int fds [NUMFDS]; + const int numfds = d2tk_frontend_get_file_descriptors(dpugl, fds, NUMFDS); +#undef NUMFDS + + d2tk_base_probe(dpugl->base, fds, numfds); if(d2tk_base_get_again(dpugl->base)) { @@ -498,15 +485,6 @@ d2tk_frontend_get_file_descriptors(d2tk_frontend_t *dpugl, int *fds, int numfds) { int idx = 0; -#if defined(__APPLE__) || de - //FIXME - (void)dpugl; - return -1; -#elif defined(_WIN32) - //FIXME - (void)dpugl; - return -1; -#else Display *disp = puglGetNativeWorld(dpugl->world); const int fd = disp ? ConnectionNumber(disp) : 0; @@ -514,7 +492,6 @@ d2tk_frontend_get_file_descriptors(d2tk_frontend_t *dpugl, int *fds, int numfds) { fds[idx++] = fd; } -#endif return idx + d2tk_base_get_file_descriptors(dpugl->base, &fds[idx], numfds-idx); } @@ -530,7 +507,7 @@ d2tk_frontend_run(d2tk_frontend_t *dpugl, const sig_atomic_t *done) { while(!*done) { - if(d2tk_frontend_poll(dpugl, -1.0)) + if(d2tk_frontend_poll(dpugl, 0.1)) { break; } @@ -564,14 +541,6 @@ d2tk_frontend_get_scale() const float dpi0 = 96.f; // reference DPI we're designing for float dpi1 = dpi0; -#if defined(__APPLE__) - // FIXME -#elif defined(_WIN32) - // GetDpiForSystem/Monitor/Window is Win10 only - HDC screen = GetDC(NULL); - dpi1 = GetDeviceCaps(screen, LOGPIXELSX); - ReleaseDC(NULL, screen); -#else Display *disp = XOpenDisplay(0); if(disp) { @@ -601,7 +570,6 @@ d2tk_frontend_get_scale() XCloseDisplay(disp); } -#endif return scale * dpi1 / dpi0; } diff --git a/src/hash.c b/src/hash.c index f02b7f2..962bec3 100644 --- a/src/hash.c +++ b/src/hash.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/src/mum.h b/src/mum.h index e42e2d7..72d0be3 100644 --- a/src/mum.h +++ b/src/mum.h @@ -109,7 +109,7 @@ _mum (uint64_t v, uint64_t p) { multiplication. If we use a generic code we actually call a function doing 128x128->128 bit multiplication. The function is very slow. */ - lo = v * p, hi; + lo = v * p; asm ("umulh %0, %1, %2" : "=r" (hi) : "r" (v), "r" (p)); #else __uint128_t r = (__uint128_t) v * (__uint128_t) p; diff --git a/src/util_spawn.c b/src/util_spawn.c index 28aff32..2146c62 100644 --- a/src/util_spawn.c +++ b/src/util_spawn.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/test/base.c b/test/base.c index cfb31a2..c76a7f3 100644 --- a/test/base.c +++ b/test/base.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/test/core.c b/test/core.c index 5389ed3..efa54e5 100644 --- a/test/core.c +++ b/test/core.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/test/mock.c b/test/mock.c index 5986109..b7112b9 100644 --- a/test/mock.c +++ b/test/mock.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include diff --git a/test/mock.h b/test/mock.h index 8b18ddb..e08d2bf 100644 --- a/test/mock.h +++ b/test/mock.h @@ -1,18 +1,6 @@ /* - * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #ifndef _D2TK_MOCK_H diff --git a/ttf/FiraCode-Bold.ttf.license b/ttf/FiraCode-Bold.ttf.license new file mode 100644 index 0000000..df07e40 --- /dev/null +++ b/ttf/FiraCode-Bold.ttf.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Nikita Prokopov +SPDX-License-Identifier: OFL-1.1 diff --git a/ttf/FiraCode-Light.ttf.license b/ttf/FiraCode-Light.ttf.license new file mode 100644 index 0000000..df07e40 --- /dev/null +++ b/ttf/FiraCode-Light.ttf.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Nikita Prokopov +SPDX-License-Identifier: OFL-1.1 diff --git a/ttf/FiraCode-Medium.ttf.license b/ttf/FiraCode-Medium.ttf.license new file mode 100644 index 0000000..df07e40 --- /dev/null +++ b/ttf/FiraCode-Medium.ttf.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Nikita Prokopov +SPDX-License-Identifier: OFL-1.1 diff --git a/ttf/FiraCode-Regular.ttf.license b/ttf/FiraCode-Regular.ttf.license new file mode 100644 index 0000000..df07e40 --- /dev/null +++ b/ttf/FiraCode-Regular.ttf.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Nikita Prokopov +SPDX-License-Identifier: OFL-1.1 diff --git a/ttf/FiraSans-Bold.ttf.license b/ttf/FiraSans-Bold.ttf.license new file mode 100644 index 0000000..0ef64f0 --- /dev/null +++ b/ttf/FiraSans-Bold.ttf.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Carrois Apostrophe +SPDX-License-Identifier: OFL-1.1 diff --git a/ttf/LICENSE b/ttf/LICENSE deleted file mode 100644 index 805e0b3..0000000 --- a/ttf/LICENSE +++ /dev/null @@ -1,93 +0,0 @@ -Copyright (c) 2014, The Fira Code Project Authors (https://github.com/tonsky/FiraCode) - -This Font Software is licensed under the SIL Open Font License, Version 1.1. -This license is copied below, and is also available with a FAQ at: -http://scripts.sil.org/OFL - - ------------------------------------------------------------ -SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 ------------------------------------------------------------ - -PREAMBLE -The goals of the Open Font License (OFL) are to stimulate worldwide -development of collaborative font projects, to support the font creation -efforts of academic and linguistic communities, and to provide a free and -open framework in which fonts may be shared and improved in partnership -with others. - -The OFL allows the licensed fonts to be used, studied, modified and -redistributed freely as long as they are not sold by themselves. The -fonts, including any derivative works, can be bundled, embedded, -redistributed and/or sold with any software provided that any reserved -names are not used by derivative works. The fonts and derivatives, -however, cannot be released under any other type of license. The -requirement for fonts to remain under this license does not apply -to any document created using the fonts or their derivatives. - -DEFINITIONS -"Font Software" refers to the set of files released by the Copyright -Holder(s) under this license and clearly marked as such. This may -include source files, build scripts and documentation. - -"Reserved Font Name" refers to any names specified as such after the -copyright statement(s). - -"Original Version" refers to the collection of Font Software components as -distributed by the Copyright Holder(s). - -"Modified Version" refers to any derivative made by adding to, deleting, -or substituting -- in part or in whole -- any of the components of the -Original Version, by changing formats or by porting the Font Software to a -new environment. - -"Author" refers to any designer, engineer, programmer, technical -writer or other person who contributed to the Font Software. - -PERMISSION & CONDITIONS -Permission is hereby granted, free of charge, to any person obtaining -a copy of the Font Software, to use, study, copy, merge, embed, modify, -redistribute, and sell modified and unmodified copies of the Font -Software, subject to the following conditions: - -1) Neither the Font Software nor any of its individual components, -in Original or Modified Versions, may be sold by itself. - -2) Original or Modified Versions of the Font Software may be bundled, -redistributed and/or sold with any software, provided that each copy -contains the above copyright notice and this license. These can be -included either as stand-alone text files, human-readable headers or -in the appropriate machine-readable metadata fields within text or -binary files as long as those fields can be easily viewed by the user. - -3) No Modified Version of the Font Software may use the Reserved Font -Name(s) unless explicit written permission is granted by the corresponding -Copyright Holder. This restriction only applies to the primary font name as -presented to the users. - -4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font -Software shall not be used to promote, endorse or advertise any -Modified Version, except to acknowledge the contribution(s) of the -Copyright Holder(s) and the Author(s) or with their explicit written -permission. - -5) The Font Software, modified or unmodified, in part or in whole, -must be distributed entirely under this license, and must not be -distributed under any other license. The requirement for fonts to -remain under this license does not apply to any document created -using the Font Software. - -TERMINATION -This license becomes null and void if any of the above conditions are -not met. - -DISCLAIMER -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT -OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM -OTHER DEALINGS IN THE FONT SOFTWARE. -- 2.38.5