~hp/shells_bells.lv2

423197576cd6bd645e84f82fe330b673a9be3c9f — Hanspeter Portner 11 months ago 7247933
Squashed 'subprojects/d2tk/' changes from 45140bbc5..857f7fd77

857f7fd77 Only trigger email upon failures
c0c69c830 Add build recipes for alpine
0d875fb94 beautify build recipe
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: 857f7fd77a21b1fd43510a0e8cc4a3ba3d88403d
96 files changed, 975 insertions(+), 1352 deletions(-)

A .builds/alpine-latest.yml
M .gitignore
D .gitlab-ci.yml
A .reuse/dep5
D COPYING
M Doxyfile
A LICENSES/Artistic-2.0.txt
A LICENSES/BSD-2-Clause.txt
A LICENSES/CC0-1.0.txt
A LICENSES/ISC.txt
A LICENSES/MIT.txt
A LICENSES/OFL-1.1.txt
A LICENSES/Unlicense.txt
A LICENSES/Zlib.txt
M README.md
D VERSION
M check_for_font
M d2tk/backend.h
M d2tk/base.h
M d2tk/config.h.in
M d2tk/core.h
M d2tk/d2tk.h
M d2tk/frontend.h
M d2tk/frontend_fbdev.h
M d2tk/frontend_glfw.h
M d2tk/frontend_pugl.h
M d2tk/hash.h
M d2tk/util.h
M example/custom_cairo.c
M example/custom_nanovg.c
M example/d2tk_fbdev.c
M example/d2tk_glfw.c
M example/d2tk_pugl.c
M example/example.c
M example/example.h
A example/libre-arrow-circle-right.png.license
A example/libre-gui-file.png.license
A example/libre-gui-folder.png.license
M meson.build
M meson_options.txt
A robodoc.rc
A screenshots/screenshot_1.png.license
A screenshots/screenshot_2.png.license
A screenshots/screenshot_3.png.license
A screenshots/screenshot_4.png.license
A screenshots/screenshot_5.png.license
A screenshots/screenshot_6.png.license
A screenshots/screenshot_7.png.license
A screenshots/screenshot_8.png.license
M src/backend_cairo.c
M src/backend_nanovg.c
M src/base.c
M src/base_bar.c
M src/base_bitmap.c
M src/base_button.c
M src/base_combo.c
M src/base_cursor.c
M src/base_custom.c
M src/base_dial.c
M src/base_flowmatrix.c
M src/base_frame.c
M src/base_image.c
M src/base_internal.h
M src/base_label.c
M src/base_layout.c
M src/base_lineedit.c
M src/base_link.c
M src/base_meter.c
M src/base_pane.c
M src/base_pty.c
M src/base_scrollbar.c
M src/base_separator.c
M src/base_spinner.c
M src/base_table.c
M src/base_textfield.c
M src/base_tooltip.c
M src/base_vkb.c
M src/base_wave.c
M src/core.c
M src/core_internal.h
M src/frontend_fbdev.c
M src/frontend_glfw.c
M src/frontend_pugl.c
M src/hash.c
M src/mum.h
M src/util_spawn.c
M test/base.c
M test/core.c
M test/mock.c
M test/mock.h
A ttf/FiraCode-Bold.ttf.license
A ttf/FiraCode-Light.ttf.license
A ttf/FiraCode-Medium.ttf.license
A ttf/FiraCode-Regular.ttf.license
A ttf/FiraSans-Bold.ttf.license
D ttf/LICENSE
A .builds/alpine-latest.yml => .builds/alpine-latest.yml +45 -0
@@ 0,0 1,45 @@
# SPDX-FileCopyrightText: Hanspeter Portner <dev@open-music-kontrollers.ch>
# 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

environment:
  project: d2tk

tasks:
  - setup: |
      cd "${project}"
      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 "${project}"
      ninja -C build
  - test: |
      cd "${project}"
      ninja -C build test

triggers:
  - action: email
    condition: failure 
    to: "<dev@open-music-kontrollers.ch>"
...

M .gitignore => .gitignore +5 -2
@@ 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

D .gitlab-ci.yml => .gitlab-ci.yml +0 -108
@@ 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/

A .reuse/dep5 => .reuse/dep5 +24 -0
@@ 0,0 1,24 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: d2tk
Upstream-Contact: Hanspeter Portner <dev@open-music-kontrollers.ch>
Source: https://git.open-music-kontrollers.ch/lad/d2tk/

Files: pugl/*
Copyright: David Robillard <d@drobilla.net>
License: ISC

Files: linenoise/*
Copyright: Salvatore Sanfilippo <antirez@gmail.com>
License: BSD-2-Clause

Files: nanovg/*
Copyright: Mikko Mononen <memon@inside.org>
License: Zlib

Files: utf8.h/*
Copyright: Neil Henning <github.com/sheredom/utf8.h>
License: Unlicense

Files: src/mum.h
Copyright: 2016, 2017, 2018 Vladimir Makarov <vmakarov@gcc.gnu.org>
License: MIT

D COPYING => COPYING +0 -201
@@ 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.

M Doxyfile => Doxyfile +3 -0
@@ 1,3 1,6 @@
# SPDX-FileCopyrightText: Hanspeter Portner <dev@open-music-kontrollers.ch>
# SPDX-License-Identifier: CC0-1.0

# Doxyfile 1.8.14

# This file describes the settings to be used by the documentation system

A LICENSES/Artistic-2.0.txt => LICENSES/Artistic-2.0.txt +85 -0
@@ 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.

A LICENSES/BSD-2-Clause.txt => LICENSES/BSD-2-Clause.txt +9 -0
@@ 0,0 1,9 @@
Copyright (c) <year> <owner> 

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.

A LICENSES/CC0-1.0.txt => LICENSES/CC0-1.0.txt +121 -0
@@ 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.

A LICENSES/ISC.txt => LICENSES/ISC.txt +8 -0
@@ 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.

A LICENSES/MIT.txt => LICENSES/MIT.txt +9 -0
@@ 0,0 1,9 @@
MIT License

Copyright (c) <year> <copyright holders>

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.

A LICENSES/OFL-1.1.txt => LICENSES/OFL-1.1.txt +43 -0
@@ 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.

A LICENSES/Unlicense.txt => LICENSES/Unlicense.txt +10 -0
@@ 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 <http://unlicense.org/>

A LICENSES/Zlib.txt => LICENSES/Zlib.txt +11 -0
@@ 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.

M README.md => README.md +50 -26
@@ 1,18 1,59 @@
<!--
  -- (SPDX-FileCopyrightText: Hanspeter Portner <dev@open-music-kontrollers.ch>
  -- (SPDX-License-Identifier: CC0-1.0
  -->
# 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
<http://www.perlfoundation.org/artistic_license_2_0>.
![Screenshot 8](screenshots/screenshot_8.png)

D VERSION => VERSION +0 -1
@@ 1,1 0,0 @@
0.1.1259

M check_for_font => check_for_font +3 -0
@@ 1,3 1,6 @@
#!/bin/sh

# SPDX-FileCopyrightText: Hanspeter Portner <dev@open-music-kontrollers.ch>
# SPDX-License-Identifier: CC0-1.0

fc-list | grep "$1"

M d2tk/backend.h => d2tk/backend.h +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#ifndef _D2TK_BACKEND_H

M d2tk/base.h => d2tk/base.h +6 -15
@@ 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 <dev@open-music-kontrollers.ch>
 * 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);

M d2tk/config.h.in => d2tk/config.h.in +6 -0
@@ 1,4 1,10 @@
/*
 * SPDX-FileCopyrightText: Hanspeter Portner <dev@open-music-kontrollers.ch>
 * 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@

M d2tk/core.h => d2tk/core.h +4 -15
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#ifndef _D2TK_CORE_H


@@ 21,8 9,9 @@
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <sys/types.h>

#include "config.h"
#include "d2tk_config.h"
#include <d2tk/d2tk.h>

#ifdef __cplusplus

M d2tk/d2tk.h => d2tk/d2tk.h +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#ifndef _D2TK_H

M d2tk/frontend.h => d2tk/frontend.h +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#ifndef _D2TK_FRONTEND_H

M d2tk/frontend_fbdev.h => d2tk/frontend_fbdev.h +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#ifndef _D2TK_FRONTEND_FBDEV_H

M d2tk/frontend_glfw.h => d2tk/frontend_glfw.h +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#ifndef _D2TK_FRONTEND_GLFW_H

M d2tk/frontend_pugl.h => d2tk/frontend_pugl.h +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#ifndef _D2TK_FRONTEND_PUGL_H

M d2tk/hash.h => d2tk/hash.h +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#ifndef _D2TK_HASH_H

M d2tk/util.h => d2tk/util.h +3 -15
@@ 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 <dev@open-music-kontrollers.ch>
 * 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 <d2tk/d2tk.h>

/****f* util/d2tk_util_spawn

M example/custom_cairo.c => example/custom_cairo.c +5 -0
@@ 1,3 1,8 @@
/*
 * SPDX-FileCopyrightText: Hanspeter Portner <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <stdint.h>

#include <d2tk/core.h>

M example/custom_nanovg.c => example/custom_nanovg.c +5 -0
@@ 1,3 1,8 @@
/*
 * SPDX-FileCopyrightText: Hanspeter Portner <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <stdint.h>
#include <math.h>


M example/d2tk_fbdev.c => example/d2tk_fbdev.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <stdio.h>

M example/d2tk_glfw.c => example/d2tk_glfw.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <stdio.h>

M example/d2tk_pugl.c => example/d2tk_pugl.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <stdio.h>

M example/example.c => example/example.c +4 -15
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <stdio.h>


@@ 23,6 11,7 @@
#include <dirent.h>
#include <string.h>
#include <stdatomic.h>
#include <limits.h>

#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++);

M example/example.h => example/example.h +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#ifndef _D2TK_EXAMPLE_H

A example/libre-arrow-circle-right.png.license => example/libre-arrow-circle-right.png.license +2 -0
@@ 0,0 1,2 @@
SPDX-FileCopyrightText: LibreICONS <github.com/DiemenDesign/LibreICONS>
SPDX-License-Identifier: MIT

A example/libre-gui-file.png.license => example/libre-gui-file.png.license +2 -0
@@ 0,0 1,2 @@
SPDX-FileCopyrightText: LibreICONS <github.com/DiemenDesign/LibreICONS>
SPDX-License-Identifier: MIT

A example/libre-gui-folder.png.license => example/libre-gui-folder.png.license +2 -0
@@ 0,0 1,2 @@
SPDX-FileCopyrightText: LibreICONS <github.com/DiemenDesign/LibreICONS>
SPDX-License-Identifier: MIT

M meson.build => meson.build +26 -12
@@ 1,8 1,11 @@
# SPDX-FileCopyrightText: Hanspeter Portner <dev@open-music-kontrollers.ch>
# 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

M meson_options.txt => meson_options.txt +10 -0
@@ 1,3 1,6 @@
# SPDX-FileCopyrightText: Hanspeter Portner <dev@open-music-kontrollers.ch>
# 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.1309')

A robodoc.rc => robodoc.rc +16 -0
@@ 0,0 1,16 @@
# SPDX-FileCopyrightText: Hanspeter Portner <dev@open-music-kontrollers.ch>
# SPDX-License-Identifier: CC0-1.0

items:
	SUMMARY
	SYNOPSIS
	FUNCTION
	INPUTS
	OUTPUT
	SEE ALSO
source items:
	SYNOPSIS
remark begin markers:
	/*
remark end markers:
	*/

A screenshots/screenshot_1.png.license => screenshots/screenshot_1.png.license +2 -0
@@ 0,0 1,2 @@
SPDX-FileCopyrightText: Hanspeter Portner <dev@open-music-kontrollers.ch>
SPDX-License-Identifier: CC0-1.0

A screenshots/screenshot_2.png.license => screenshots/screenshot_2.png.license +2 -0
@@ 0,0 1,2 @@
SPDX-FileCopyrightText: Hanspeter Portner <dev@open-music-kontrollers.ch>
SPDX-License-Identifier: CC0-1.0

A screenshots/screenshot_3.png.license => screenshots/screenshot_3.png.license +2 -0
@@ 0,0 1,2 @@
SPDX-FileCopyrightText: Hanspeter Portner <dev@open-music-kontrollers.ch>
SPDX-License-Identifier: CC0-1.0

A screenshots/screenshot_4.png.license => screenshots/screenshot_4.png.license +2 -0
@@ 0,0 1,2 @@
SPDX-FileCopyrightText: Hanspeter Portner <dev@open-music-kontrollers.ch>
SPDX-License-Identifier: CC0-1.0

A screenshots/screenshot_5.png.license => screenshots/screenshot_5.png.license +2 -0
@@ 0,0 1,2 @@
SPDX-FileCopyrightText: Hanspeter Portner <dev@open-music-kontrollers.ch>
SPDX-License-Identifier: CC0-1.0

A screenshots/screenshot_6.png.license => screenshots/screenshot_6.png.license +2 -0
@@ 0,0 1,2 @@
SPDX-FileCopyrightText: Hanspeter Portner <dev@open-music-kontrollers.ch>
SPDX-License-Identifier: CC0-1.0

A screenshots/screenshot_7.png.license => screenshots/screenshot_7.png.license +2 -0
@@ 0,0 1,2 @@
SPDX-FileCopyrightText: Hanspeter Portner <dev@open-music-kontrollers.ch>
SPDX-License-Identifier: CC0-1.0

A screenshots/screenshot_8.png.license => screenshots/screenshot_8.png.license +2 -0
@@ 0,0 1,2 @@
SPDX-FileCopyrightText: Hanspeter Portner <dev@open-music-kontrollers.ch>
SPDX-License-Identifier: CC0-1.0

M src/backend_cairo.c => src/backend_cairo.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <math.h>

M src/backend_nanovg.c => src/backend_nanovg.c +18 -31
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <math.h>


@@ 20,17 8,28 @@
#include <stdlib.h>
#include <assert.h>
#include <sys/stat.h>
#include <string.h>

#include "d2tk_config.h"

#include <nanovg.h>

#if defined(__APPLE__)
#	include <OpenGL/gl.h>
#	include <OpenGL/glext.h>
#if D2TK_GLES_VERSION == 2
#	include <GLES2/gl2.h>
#	include <GLES2/gl2ext.h>
#	define NANOVG_GLES2_IMPLEMENTATION
#elif D2TK_GLES_VERSION == 3
#	include <GLES3/gl3.h>
#	include <GLES2/gl2ext.h>
#	define NANOVG_GLES3_IMPLEMENTATION
#else
#	include <GL/glew.h>
#	error 'invalid GLES version'
#endif

#ifndef GL_BGRA
#	define GL_BGRA GL_BGRA_EXT
#endif

#define NANOVG_GLES3_IMPLEMENTATION
#include <nanovg_gl.h>
#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)
	{

M src/base.c => src/base.c +16 -32
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <inttypes.h>
#if !defined(_WIN32)
#	include <poll.h>
#endif
#include <errno.h>
#include <poll.h>

#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)
{

M src/base_bar.c => src/base_bar.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <inttypes.h>

M src/base_bitmap.c => src/base_bitmap.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include "base_internal.h"

M src/base_button.c => src/base_button.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <string.h>

M src/base_combo.c => src/base_combo.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <string.h>

M src/base_cursor.c => src/base_cursor.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include "base_internal.h"

M src/base_custom.c => src/base_custom.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include "base_internal.h"

M src/base_dial.c => src/base_dial.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <inttypes.h>

M src/base_flowmatrix.c => src/base_flowmatrix.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <math.h>

M src/base_frame.c => src/base_frame.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <string.h>

M src/base_image.c => src/base_image.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <string.h>

M src/base_internal.h => src/base_internal.h +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <stdatomic.h>

M src/base_label.c => src/base_label.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <string.h>

M src/base_layout.c => src/base_layout.c +31 -34
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <math.h>

#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;

M src/base_lineedit.c => src/base_lineedit.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <string.h>

M src/base_link.c => src/base_link.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <string.h>

M src/base_meter.c => src/base_meter.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <stdio.h>

M src/base_pane.c => src/base_pane.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <math.h>

M src/base_pty.c => src/base_pty.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <signal.h>

M src/base_scrollbar.c => src/base_scrollbar.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include "base_internal.h"

M src/base_separator.c => src/base_separator.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <string.h>

M src/base_spinner.c => src/base_spinner.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <inttypes.h>

M src/base_table.c => src/base_table.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include "base_internal.h"

M src/base_textfield.c => src/base_textfield.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <stdio.h>

M src/base_tooltip.c => src/base_tooltip.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <string.h>

M src/base_vkb.c => src/base_vkb.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <stddef.h>

M src/base_wave.c => src/base_wave.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <inttypes.h>

M src/core.c => src/core.c +3 -19
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <stdint.h>


@@ 24,11 12,7 @@
#include <inttypes.h>
#include <limits.h>
#include <assert.h>
#if defined(_WIN32)
#	include <winsock2.h>
#else
#	include <arpa/inet.h>
#endif
#include <arpa/inet.h>

#include "core_internal.h"
#include <d2tk/hash.h>

M src/core_internal.h => src/core_internal.h +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#ifndef _D2TK_CORE_INTERNAL_H

M src/frontend_fbdev.c => src/frontend_fbdev.c +6 -18
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <fcntl.h>


@@ 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

M src/frontend_glfw.c => src/frontend_glfw.c +259 -56
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <stdio.h>


@@ 20,11 8,17 @@
#include <time.h>

#include "core_internal.h"
#include "d2tk_config.h"
#include <d2tk/frontend_glfw.h>

#include <d2tk/backend.h>

#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 <GLFW/glfw3.h>



@@ 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;
}

M src/frontend_pugl.c => src/frontend_pugl.c +10 -42
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <stdio.h>
#include <string.h>
#include <time.h>

#if defined(__APPLE__)
// FIXME
#elif defined(_WIN32)
# include <windows.h>
#else
# include <X11/Xresource.h>
#endif
#include <X11/Xresource.h>

#include <pugl/pugl.h>
#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;
}

M src/hash.c => src/hash.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <stdarg.h>

M src/mum.h => src/mum.h +1 -1
@@ 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;

M src/util_spawn.c => src/util_spawn.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <unistd.h>

M test/base.c => test/base.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <inttypes.h>

M test/core.c => test/core.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <inttypes.h>

M test/mock.c => test/mock.c +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#include <assert.h>

M test/mock.h => test/mock.h +2 -14
@@ 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 <dev@open-music-kontrollers.ch>
 * SPDX-License-Identifier: Artistic-2.0
 */

#ifndef _D2TK_MOCK_H

A ttf/FiraCode-Bold.ttf.license => ttf/FiraCode-Bold.ttf.license +2 -0
@@ 0,0 1,2 @@
SPDX-FileCopyrightText: Nikita Prokopov <github.com/tonsky/FiraCode>
SPDX-License-Identifier: OFL-1.1

A ttf/FiraCode-Light.ttf.license => ttf/FiraCode-Light.ttf.license +2 -0
@@ 0,0 1,2 @@
SPDX-FileCopyrightText: Nikita Prokopov <github.com/tonsky/FiraCode>
SPDX-License-Identifier: OFL-1.1

A ttf/FiraCode-Medium.ttf.license => ttf/FiraCode-Medium.ttf.license +2 -0
@@ 0,0 1,2 @@
SPDX-FileCopyrightText: Nikita Prokopov <github.com/tonsky/FiraCode>
SPDX-License-Identifier: OFL-1.1

A ttf/FiraCode-Regular.ttf.license => ttf/FiraCode-Regular.ttf.license +2 -0
@@ 0,0 1,2 @@
SPDX-FileCopyrightText: Nikita Prokopov <github.com/tonsky/FiraCode>
SPDX-License-Identifier: OFL-1.1

A ttf/FiraSans-Bold.ttf.license => ttf/FiraSans-Bold.ttf.license +2 -0
@@ 0,0 1,2 @@
SPDX-FileCopyrightText: Carrois Apostrophe <https://github.com/mozilla/Fira>
SPDX-License-Identifier: OFL-1.1

D ttf/LICENSE => ttf/LICENSE +0 -93
@@ 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.