Github messages for voidlinux
 help / color / mirror / Atom feed
From: nadevko <nadevko@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] New package: gebaar-0.1.5
Date: Sat, 07 May 2022 19:18:42 +0200	[thread overview]
Message-ID: <20220507171842.b2C5l-BLxCJ4Z_eqjuzGM6_jwUGmlx8VIBGS-HkHijE@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-37024@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 653 bytes --]

There is an updated pull request by nadevko against master on the void-packages repository

https://github.com/nadevko/void-packages gebaar
https://github.com/void-linux/void-packages/pull/37024

New package: gebaar-0.1.5
#### Testing the changes
- I tested the changes in this PR: **NO**

#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc

A patch file from https://github.com/void-linux/void-packages/pull/37024.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-gebaar-37024.patch --]
[-- Type: text/x-diff, Size: 6882 bytes --]

From 92618398fbd8b60b09475f5fe8d072ad4e3560ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nade=C5=ADka?= <nadevko@riseup.net>
Date: Sat, 7 May 2022 17:32:06 +0300
Subject: [PATCH] New package: gebaar-0.1.5

---
 ...0001-Add-tablet-pen-button-remapping.patch | 167 ++++++++++++++++++
 srcpkgs/gebaar/template                       |  19 ++
 2 files changed, 186 insertions(+)
 create mode 100644 srcpkgs/gebaar/patch/0001-Add-tablet-pen-button-remapping.patch
 create mode 100644 srcpkgs/gebaar/template

diff --git a/srcpkgs/gebaar/patch/0001-Add-tablet-pen-button-remapping.patch b/srcpkgs/gebaar/patch/0001-Add-tablet-pen-button-remapping.patch
new file mode 100644
index 000000000000..92ec1dd51f07
--- /dev/null
+++ b/srcpkgs/gebaar/patch/0001-Add-tablet-pen-button-remapping.patch
@@ -0,0 +1,167 @@
+From 1c883a01a016f632d9636de289150fb05bd8c4b3 Mon Sep 17 00:00:00 2001
+From: Aleix Quintana Alsius <kinta@communia.org>
+Date: Sun, 9 Jan 2022 17:59:19 +0100
+Subject: [PATCH] Add tablet pen button remapping
+
+---
+ src/config/config.cpp |  3 +++
+ src/config/config.h   |  2 ++
+ src/io/input.cpp      | 43 +++++++++++++++++++++++++++++++++++++++++++
+ src/io/input.h        | 12 ++++++++++++
+ 4 files changed, 60 insertions(+)
+
+diff --git a/src/config/config.cpp b/src/config/config.cpp
+index 0bbd0cc..b98e60f 100644
+--- a/src/config/config.cpp
++++ b/src/config/config.cpp
+@@ -74,6 +74,9 @@ void gebaar::config::Config::load_config()
+             settings.pinch_threshold = config->get_qualified_as<double>("pinch.settings.threshold").value_or(0.25);
+             settings.pinch_one_shot = config->get_qualified_as<bool>("pinch.settings.one_shot").value_or(false);
+ 
++            /* pen button settings */
++            pen_button_commands = *config->get_qualified_as<std::string>("pen_button.commands.command");
++            settings.pen_button_trigger_on_release = config->get_qualified_as<bool>("pen_button.settings.trigger_on_release").value_or(true);
+ 
+             loaded = true;
+         }
+diff --git a/src/config/config.h b/src/config/config.h
+index 34d7a42..c28fc2b 100644
+--- a/src/config/config.h
++++ b/src/config/config.h
+@@ -41,12 +41,14 @@ namespace gebaar::config {
+           bool swipe_one_shot;
+           double swipe_threshold;
+           bool swipe_trigger_on_release;
++          bool pen_button_trigger_on_release;
+         } settings;
+ 
+         enum pinch {PINCH_IN, PINCH_OUT};
+         std::string swipe_three_commands[10];
+         std::string swipe_four_commands[10];
+         std::string pinch_commands[10];
++        std::string pen_button_commands;
+ 
+     private:
+ 
+diff --git a/src/io/input.cpp b/src/io/input.cpp
+index 415fdab..73fdb47 100644
+--- a/src/io/input.cpp
++++ b/src/io/input.cpp
+@@ -30,6 +30,8 @@ gebaar::io::Input::Input(
+   config = config_ptr;
+   gesture_swipe_event = {};
+ 
++  pen_button_event = {};
++
+   gesture_pinch_event = {};
+   gesture_pinch_event.scale = DEFAULT_SCALE;
+ }
+@@ -62,6 +64,13 @@ void gebaar::io::Input::reset_pinch_event() {
+   gesture_pinch_event.executed = false;
+ }
+ 
++/**
++ * Reset pen button event struct to defaults
++ */
++void gebaar::io::Input::reset_pen_button_event() {
++  pen_button_event = {};
++}
++
+ /**
+  * Pinch one_shot gesture handle
+  * @param new_scale last reported scale between the fingers
+@@ -149,6 +158,30 @@ void gebaar::io::Input::handle_swipe_event_without_coords(
+   }
+ }
+ 
++/**
++ * This event has no coordinates, so it's an event that gives us a begin or end
++ * signal. If it begins, we get the amount of fingers used. If it ends, we check
++ * what kind of gesture we received.
++ *
++ * @param gev Gesture Event
++ * @param begin Boolean to denote begin or end of gesture
++ */
++void gebaar::io::Input::handle_pen_button_event_without_coords(
++    libinput_event_tablet_tool *ttev) {
++    pen_button_event.state = libinput_event_tablet_tool_get_button_state(ttev);
++
++    if (config->settings.pen_button_trigger_on_release) {
++        if (pen_button_event.state == LIBINPUT_BUTTON_STATE_RELEASED) {
++          trigger_pen_button_command();
++        }
++    } else {
++        if (pen_button_event.state == LIBINPUT_BUTTON_STATE_PRESSED) {
++          trigger_pen_button_command();
++        }
++    }
++    reset_pen_button_event();
++}
++
+ /**
+  * Swipe events with coordinates, add it to the current tally
+  * @param gev Gesture Event
+@@ -212,6 +245,13 @@ void gebaar::io::Input::trigger_swipe_command() {
+   }
+ }
+ 
++/**
++ * Making calculation for swipe direction and triggering
++ * command accordingly
++ */
++void gebaar::io::Input::trigger_pen_button_command() {
++  std::system(config->pen_button_commands.c_str());
++}
+ /**
+  * Initialize the input system
+  * @return bool
+@@ -320,6 +360,9 @@ void gebaar::io::Input::handle_event() {
+     case LIBINPUT_EVENT_TABLET_TOOL_TIP:
+       break;
+     case LIBINPUT_EVENT_TABLET_TOOL_BUTTON:
++      handle_pen_button_event_without_coords(
++          libinput_event_get_tablet_tool_event(libinput_event));
++
+       break;
+     case LIBINPUT_EVENT_TABLET_PAD_BUTTON:
+       break;
+diff --git a/src/io/input.h b/src/io/input.h
+index 2f62a29..5937690 100644
+--- a/src/io/input.h
++++ b/src/io/input.h
+@@ -47,6 +47,10 @@ namespace gebaar::io {
+         int step;
+     };
+ 
++    struct pen_button_event {
++        bool state;
++    };
++
+     class Input {
+     public:
+         Input(std::shared_ptr<gebaar::config::Config> const& config_ptr);
+@@ -66,6 +70,7 @@ namespace gebaar::io {
+ 
+         struct gesture_swipe_event gesture_swipe_event;
+         struct gesture_pinch_event gesture_pinch_event;
++        struct pen_button_event pen_button_event;
+ 
+         bool initialize_context();
+ 
+@@ -119,6 +124,13 @@ namespace gebaar::io {
+ 
+         void handle_pinch_event(libinput_event_gesture* gev, bool begin);
+ 
++
++        void trigger_pen_button_command();
++
++        void handle_pen_button_event_without_coords(libinput_event_tablet_tool* ttev);
++
++        void reset_pen_button_event();
++
+     };
+ }
+ 
+-- 
+2.36.0
+
diff --git a/srcpkgs/gebaar/template b/srcpkgs/gebaar/template
new file mode 100644
index 000000000000..c2406eae71fa
--- /dev/null
+++ b/srcpkgs/gebaar/template
@@ -0,0 +1,19 @@
+# Template file for 'gebaar'
+pkgname=gebaar
+version=0.1.5
+revision=1
+wrksrc=gebaar-libinput-fork-$version
+build_style=cmake
+hostmakedepends=pkg-config
+makedepends=libinput-devel
+short_desc="wm-independent touchpad gesture daemon for libinput"
+maintainer="Nadeŭka <nadevko@riseup.net>"
+license=GPL-3.0-or-later
+homepage=https://github.com/9ary/gebaar-libinput-fork
+distfiles=https://github.com/9ary/gebaar-libinput-fork/archive/refs/tags/v$version.tar.gz
+checksum=54ac5734353492cdbc0315ec7684c46890def1aa978c66880e78a961b196feab
+
+pre_install() {
+	vlicense LICENSE
+	vdoc README.md
+}

  reply	other threads:[~2022-05-07 17:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-07 15:48 [PR PATCH] " nadevko
2022-05-07 17:18 ` nadevko [this message]
2022-05-07 17:47 ` [PR PATCH] [Updated] " nadevko
2022-05-08 12:19 ` nadevko
2022-05-19 12:56 ` nadevko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220507171842.b2C5l-BLxCJ4Z_eqjuzGM6_jwUGmlx8VIBGS-HkHijE@z \
    --to=nadevko@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).