3

Note: this may not be the best place for this question, so if there's a better place, please let me know.

There's a wonderful application called easystroke which is a gesture-recognition application for X11. However, the last code update was in 2013, and it's got a few problems in Ubuntu GNOME 17.04.

It still works in Ubuntu GNOME 17.04, but I have two problems.

  1. it doesn't remember one of its preferences (Method to show gestures - XShape)
  2. it compiles with errors

The Wiki is located at https://github.com/thjaeger/easystroke/wiki

The code can be easily obtained with git clone git://github.com/thjaeger/easystroke.git

Build requirements and build instructions are at https://github.com/thjaeger/easystroke/wiki/BuildInstructions

You compile it with make -j2

Along with some compilation warnings, here's the show-stopping error...

actions.cc: In constructor ‘TreeViewMulti::TreeViewMulti()’:
actions.cc:57:39: error: ‘group’ is not a member of ‘sigc’
  get_selection()->set_select_function(sigc::group(&negate, sigc::ref(pending)));
                                       ^~~~
Makefile:74: recipe for target 'actions.o' failed
make: *** [actions.o] Error 1
make: *** Waiting for unfinished jobs....

Any C++ folks out there that can lend a hand?

heynnema
  • 70,711
  • I suggest you ping Nathan Osman in chat. He is a C++ guy and has written programs for Ubuntu. – You'reAGitForNotUsingGit Jul 07 '17 at 14:59
  • @AndroidDev thanks! How do I get to chat, and I assume that I ping him with @nathanosman? – heynnema Jul 07 '17 at 15:01
  • https://chat.stackexchange.com/rooms/201/ask-ubuntu-general-room – muru Jul 07 '17 at 15:02
  • Yeah when you start typing @nath it will give you a pop-up suggesting to auto complete it for you. Go to the AUGR that Muru linked above – You'reAGitForNotUsingGit Jul 07 '17 at 15:04
  • I found this, does it help any? https://reviews.freebsd.org/D10815 – ravery Jul 07 '17 at 15:18
  • @ravery good find! Thanks. I've downloaded the .diff code. Now all I've got to do is figure out what to do with it! I suppose I'll have to use patch? – heynnema Jul 07 '17 at 15:39
  • @heynnema --patch sounds reasonable but I have never used C++. I don't know how to proceed. – ravery Jul 07 '17 at 15:49
  • Did you manage to get easystroke to run smoothly on Ubuntu 17 and higher? It is indeed a great program. I'm not sure how I'll manage without it. – Jus12 Jun 07 '19 at 20:35
  • @Jus12 There are a number of patches for easystroke, and it got to be too much to keep unsupported code running... so no, I don't use it any more. Too bad. – heynnema Jun 07 '19 at 22:36

2 Answers2

2

As it turns out, the patch at https://reviews.freebsd.org/D10815 suggested by @ravery (thank you) turned out to be a patch for freebsd... however it did get me thinking that there might be a patch elsewhere that would work in Ubuntu.

I ended up emailing back and forth with tobias.kortkamp@gmail.com, and Tobias provided me a link at https://aur.archlinux.org/cgit/aur.git/plain/sigc.patch?h=easystroke-git&id=3d16f0584c8cf0ade6c181cb56c12d7abe2e17b7 that will allow the Git code to compile (with lots of warnings) after applying the patch with patch -p1 -i /path/to/sigc.patch.

Fix build with libsigc++ 2.4+ (group was removed).
diff -Naur a/actions.cc b/actions.cc
--- a/actions.cc    2015-11-04 19:56:49.351107678 +0100
+++ b/actions.cc    2015-11-04 19:57:07.161246969 +0100
@@ -51,10 +51,8 @@
    context->set_icon(pb, pb->get_width(), pb->get_height());
 }

-bool negate(bool b) { return !b; }
-
 TreeViewMulti::TreeViewMulti() : Gtk::TreeView(), pending(false) {
-   get_selection()->set_select_function(sigc::group(&negate, sigc::ref(pending)));
+    get_selection()->set_select_function(sigc::mem_fun(*this, &TreeViewMulti::negate_pending));
 }

 enum Type { COMMAND, KEY, TEXT, SCROLL, IGNORE, BUTTON, MISC };
diff -Naur a/actions.h b/actions.h
--- a/actions.h 2015-11-04 19:56:49.351107678 +0100
+++ b/actions.h 2015-11-04 19:57:07.161246969 +0100
@@ -30,6 +30,11 @@
    virtual void on_drag_begin(const Glib::RefPtr<Gdk::DragContext> &context);
 public:
    TreeViewMulti();
+    bool negate_pending(const Glib::RefPtr<Gtk::TreeModel>& model,
+                        const Gtk::TreeModel::Path& path,
+                        bool path_currently_selected) {
+        return !pending;
+    }
 };

 class Actions {
heynnema
  • 70,711
2

easystroke works fine on Arch (I'm using it myself, from the repos). The version there is built from the original sourceforge page, and has two patches.

This first patch is for building with gcc7

From 9e2c32390c5c253aade3bb703e51841748d2c37e Mon Sep 17 00:00:00 2001
From: Jonathan Wakely <jwakely@redhat.com>
Date: Sat, 28 Jan 2017 01:26:00 +0000
Subject: [PATCH] Remove abs(float) function that clashes with std::abs(float)

Depending on which C++ standard library headers have been included there
might an abs(float) function already declared in the global namespace,
so the definition in this file conflicts with it. This cause a build
failure with GCC 7, which conforms more closely to the C++ standard with
respect to overloads of abs.

Including <cmath> and adding a using-declaration for std::abs ensures
that the standard std::abs(float) function is available. This solution
should be portable to all compilers.
---
 handler.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/handler.cc b/handler.cc
index 8830ea2..685b1ff 100644
--- a/handler.cc
+++ b/handler.cc
@@ -23,6 +23,8 @@
 #include <X11/extensions/XTest.h>
 #include <X11/XKBlib.h>
 #include <X11/Xproto.h>
+#include <cmath>  // std::abs(float)
+using std::abs;

 XState *xstate = nullptr;

@@ -533,8 +535,6 @@ class WaitForPongHandler : public Handler, protected Timeout {
    virtual Grabber::State grab_mode() { return parent->grab_mode(); }
 };

-static inline float abs(float x) { return x > 0 ? x : -x; }
-
 class AbstractScrollHandler : public Handler {
    bool have_x, have_y;
    float last_x, last_y;

This second one is for the problem you've mentioned

diff -uprb easystroke-0.6.0.orig/actions.cc easystroke-0.6.0/actions.cc
--- easystroke-0.6.0.orig/actions.cc    2013-03-27 17:52:38.000000000 +0200
+++ easystroke-0.6.0/actions.cc 2015-12-07 22:07:17.720041171 +0200
@@ -51,10 +51,11 @@ void TreeViewMulti::on_drag_begin(const
    context->set_icon(pb, pb->get_width(), pb->get_height());
 }

-bool negate(bool b) { return !b; }
-
 TreeViewMulti::TreeViewMulti() : Gtk::TreeView(), pending(false) {
-   get_selection()->set_select_function(sigc::group(&negate, sigc::ref(pending)));
+   get_selection()->set_select_function(
+       [this](Glib::RefPtr<Gtk::TreeModel> const&, Gtk::TreeModel::Path const&, bool) {
+           return !pending;
+       });
 }

 enum Type { COMMAND, KEY, TEXT, SCROLL, IGNORE, BUTTON, MISC };
diff -uprb easystroke-0.6.0.orig/Makefile easystroke-0.6.0/Makefile
--- easystroke-0.6.0.orig/Makefile  2013-03-27 17:52:38.000000000 +0200
+++ easystroke-0.6.0/Makefile   2015-12-07 21:54:47.926776791 +0200
@@ -21,8 +21,7 @@ LOCALEDIR= $(PREFIX)/share/locale
 DFLAGS   =
 OFLAGS   = -O2
 AOFLAGS  = -O3
-STROKEFLAGS  = -Wall -std=c99 $(DFLAGS)
-CXXFLAGS = -Wall $(DFLAGS) -DLOCALEDIR=\"$(LOCALEDIR)\" `pkg-config gtkmm-3.0 dbus-glib-1 --cflags`
+CXXFLAGS = -Wall $(DFLAGS) -std=c++11 -DLOCALEDIR=\"$(LOCALEDIR)\" `pkg-config gtkmm-3.0 dbus-glib-1 --cflags`
 CFLAGS   = -Wall $(DFLAGS) -DLOCALEDIR=\"$(LOCALEDIR)\" `pkg-config gtk+-3.0 --cflags` -DGETTEXT_PACKAGE='"easystroke"'
 LDFLAGS  = $(DFLAGS)

@@ -63,7 +62,7 @@ $(BINARY): $(OFILES)
    $(CXX) $(LDFLAGS) -o $@ $(OFILES) $(LIBS)

 stroke.o: stroke.c
-   $(CC) $(STROKEFLAGS) $(AOFLAGS) -MT $@ -MMD -MP -MF $*.Po -o $@ -c $<
+   $(CC) $(CFLAGS) $(AOFLAGS) -MT $@ -MMD -MP -MF $*.Po -o $@ -c $<

 %.o: %.c
    $(CC) $(CFLAGS) $(OFLAGS) -MT $@ -MMD -MP -MF $*.Po -o $@ -c $<

The AUR package has 4 patches, you can check it out here. You can download the patches from there, and also click View PKGBUILD to see the build instructions (quite simple really, apply patches and then make). That one builds from git, but for a project like this which is basically dead, -git isn't much of a difference I think. There's only one commit in the last 2 years.

  • Great resource! Thanks! Do you know if the patches also solve the crash on quit? – heynnema Jul 13 '17 at 13:26
  • I can't apply the 2nd patch file. The first part of the part looks very much like a portion of sigc.patch... so I don't know if I need to apply both. The second part fails like the first part. Hunk failed messages. – heynnema Jul 13 '17 at 20:33