8000 fix a crash hapenning since updating Ubuntu 18.04 by dkondor · Pull Request #10 · thjaeger/easystroke · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix a crash hapenning since updating Ubuntu 18.04 #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
ccc0dca
Fix black squares on gnome3
RaphaelRochet Jan 17, 2014
cf8d05d
Merge branch 'master' of github.com:thjaeger/easystroke
RaphaelRochet Jul 7, 2015
ffe356c
French translation update
RaphaelRochet Jul 7, 2015
0e60f16
switch from fork to g_spawn_async
trengrj May 21, 2015
22b28d2
fix build failed in libsignc++ version 2.5.1 or newer
nagae-memooff Oct 1, 2016
9e2c323
Remove abs(float) function that clashes with std::abs(float)
jwakely Jan 28, 2017
5f6885c
Remove requirement for current device to be in absolute mode, this wi…
p2rkw Feb 1, 2017
c328ef3
Increase required scores
p2rkw Feb 1, 2017
77921c8
minor fixes to make Easystroke compile on Ubuntu 18.04
dkondor Sep 22, 2018
140b9ca
fixed recurring crash when trying to render 0x0 tray icon
dkondor Sep 22, 2018
1b14b00
Merge pull request #1 from RaphaelRochet/master
markdstjohn Sep 25, 2018
63a1ab6
Merge pull request #2 from trengrj/master
markdstjohn Sep 25, 2018
5ce8518
Merge pull request #3 from jwakely/abs
markdstjohn Sep 25, 2018
70a7b4f
Merge pull request #4 from p2rkw/master
markdstjohn Sep 25, 2018
ddc8859
Merging in pull request
Sep 25, 2018
32bfe86
Merge branch 'dkondor-master'
Sep 25, 2018
686b777
Move Stroke::save() and load() into header
mhillenbrand Apr 14, 2020
217673f
Merge pull request #6 from mhillenibm/fix_stroke_template
markdstjohn May 12, 2020
f93455b
Merge pull request #5 from dkondor/master
markdstjohn May 12, 2020
5b5ebeb
Merge pull request #1 from markdstjohn/master
dkondor May 14, 2020
14b2a37
Fix not being able to select Misc actions
dkondor Aug 28, 2020
2e67925
decrease scores for stroke comparison
dkondor Aug 29, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions actiondb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,9 @@ template<class Archive> void StrokeInfo::serialize(Archive & ar, const unsigned
using namespace std;

void Command::run() {
pid_t pid = fork();
switch (pid) {
case 0:
execlp("/bin/sh", "sh", "-c", cmd.c_str(), nullptr);
exit(1);
case -1:
printf(_("Error: can't execute command \"%s\": fork() failed\n"), cmd.c_str());
}
gchar* argv[] = {(gchar*) "/bin/sh", (gchar*) "-c", NULL, NULL};
argv[2] = (gchar *) cmd.c_str();
g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);
}

ButtonInfo Button::get_button_info() const {
Expand Down
9 changes: 5 additions & 4 deletions actions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ void TreeViewMulti::on_drag_begin(const Glib::RefPtr<Gdk::DragContext> &context)
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 };
Expand Down Expand Up @@ -474,7 +475,7 @@ void Actions::on_type_edited(const Glib::ustring &path, const Glib::ustring &new
update_actions();
}
editing_new = false;
focus(row[cols.id], 3, edit);
if (new_type != MISC) focus(row[cols.id], 3, edit);
}

void Actions::on_button_delete() {
Expand Down
842 changes: 530 additions & 312 deletions cellrenderertextish.c

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions cellrenderertextish.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/* cellrenderertextish.h generated by valac 0.18.1, the Vala compiler, do not modify */
/* cellrenderertextish.h generated by valac 0.40.23, the Vala compiler, do not modify */


#ifndef __CELLRENDERERTEXTISH_H__
#define __CELLRENDERERTEXTISH_H__

#include <glib.h>
#include <gtk/gtk.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>

Expand All @@ -22,16 +23,16 @@ G_BEGIN_DECLS
typedef struct _CellRendererTextish CellRendererTextish;
typedef struct _CellRendererTextishClass CellRendererTextishClass;
typedef struct _CellRendererTextishPrivate CellRendererTextishPrivate;

#define CELL_RENDERER_TEXTISH_TYPE_MODE (cell_renderer_textish_mode_get_type ())

typedef enum {
CELL_RENDERER_TEXTISH_MODE_Text,
CELL_RENDERER_TEXTISH_MODE_Key,
CELL_RENDERER_TEXTISH_MODE_Popup,
CELL_RENDERER_TEXTISH_MODE_Combo
} CellRendererTextishMode;


#define CELL_RENDERER_TEXTISH_TYPE_MODE (cell_renderer_textish_mode_get_type ())

struct _CellRendererTextish {
GtkCellRendererText parent_instance;
CellRendererTextishPrivate * priv;
Expand All @@ -49,8 +50,11 @@ GType cell_renderer_textish_get_type (void) G_GNUC_CONST;
GType cell_renderer_textish_mode_get_type (void) G_GNUC_CONST;
CellRendererTextish* cell_renderer_textish_new (void);
CellRendererTextish* cell_renderer_textish_construct (GType object_type);
CellRendererTextish* cell_renderer_textish_new_with_items (gchar** items, int items_length1);
CellRendererTextish* cell_renderer_textish_construct_with_items (GType object_type, gchar** items, int items_length1);
CellRendererTextish* cell_renderer_textish_new_with_items (gchar** items,
int items_length1);
CellRendererTextish* cell_renderer_textish_construct_with_items (GType object_type,
gchar** items,
int items_length1);


G_END_DECLS
Expand Down
10 changes: 8 additions & 2 deletions cellrenderertextish.vala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class CellRendererTextish : Gtk.CellRendererText {
this.items = items;
}

public override unowned Gtk.CellEditable start_editing (Gdk.Event? event, Gtk.Widget widget, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gtk.CellRendererState flags) {
public override unowned Gtk.CellEditable? start_editing (Gdk.Event? event, Gtk.Widget widget, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gtk.CellRendererState flags) {
cell = null;
if (!editable)
return cell;
Expand Down Expand Up @@ -112,7 +112,7 @@ class CellEditableAccel : Gtk.EventBox, Gtk.CellEditable {
}


class CellEditableCombo : Gtk.ComboBoxText {
class CellEditableCombo : Gtk.ComboBoxText, Gtk.CellEditable {
new CellRendererTextish parent;
new string path;

Expand All @@ -124,4 +124,10 @@ class CellEditableCombo : Gtk.ComboBoxText {
}
changed.connect(() => parent.combo_edited(path, active));
}

public virtual void start_editing(Gdk.Event? event) {
base.start_editing(event);
show_all();
}
}

36 changes: 0 additions & 36 deletions gesture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "gesture.h"
#include "prefdb.h"

#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
Expand All @@ -35,41 +34,6 @@ RTriple create_triple(float x, float y, Time t) {
return e;
}

template<class Archive> void Stroke::save(Archive & ar, const unsigned int version) const {
std::vector<Point> ps;
for (unsigned int i = 0; i < size(); i++)
ps.push_back(points(i));
ar & ps;
ar & button;
ar & trigger;
ar & timeout;
ar & modifiers;
}

template<class Archive> void Stroke::load(Archive & ar, const unsigned int version) {
std::vector<Point> ps;
ar & ps;
if (ps.size()) {
stroke_t *s = stroke_alloc(ps.size());
for (std::vector<Point>::iterator i = ps.begin(); i != ps.end(); ++i)
stroke_add_point(s, i->x, i->y);
stroke_finish(s);
stroke.reset(s, &stroke_free);
}
if (version == 0) return;
ar & button;
if (version >= 2)
ar & trigger;
if (version < 4 && (!button || trigger == (int)prefs.button.get().button))
trigger = 0;
if (version < 3)
return;
ar & timeout;
if (version < 5)
return;
ar & modifiers;
}

Stroke::Stroke(PreStroke &ps, int trigger_, int button_, unsigned int modifiers_, bool timeout_) : trigger(trigger_), button(button_), modifiers(modifiers_), timeout(timeout_) {
if (ps.valid()) {
stroke_t *s = stroke_alloc(ps.size());
Expand Down
37 changes: 35 additions & 2 deletions gesture.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#ifndef __GESTURE_H__
#define __GESTURE_H__

#include "prefdb.h"
#include "stroke.h"
#include <gdkmm.h>
#include <vector>
Expand Down Expand Up @@ -83,8 +84,40 @@ class Stroke {
static Glib::RefPtr<Gdk::Pixbuf> pbEmpty;

BOOST_SERIALIZATION_SPLIT_MEMBER()
template<class Archive> void load(Archive & ar, const unsigned int version);
template<class Archive> void save(Archive & ar, const unsigned int version) const;
template<class Archive> void load(Archive & ar, const unsigned int version) {
std::vector<Point> ps;
ar & ps;
if (ps.size()) {
stroke_t *s = stroke_alloc(ps.size());
for (std::vector<Point>::iterator i = ps.begin(); i != ps.end(); ++i)
stroke_add_point(s, i->x, i->y);
stroke_finish(s);
stroke.reset(s, &stroke_free);
}
if (version == 0) return;
ar & button;
if (version >= 2)
ar & trigger;
if (version < 4 && (!button || trigger == (int)prefs.button.get().button))
trigger = 0;
if (version < 3)
return;
ar & timeout;
if (version < 5)
return;
ar & modifiers;

}
template<class Archive> void save(Archive & ar, const unsigned int version) const {
std::vector<Point> ps;
for (unsigned int i = 0; i < size(); i++)
ps.push_back(points(i));
ar & ps;
ar & button;
ar & trigger;
ar & timeout;
ar & modifiers;
}
public:
int trigger;
int button;
Expand Down
8 changes: 5 additions & 3 deletions handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -533,7 +535,7 @@ 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; }
/* static inline float abs(float x) { return x > 0 ? x : -x; } */

class AbstractScrollHandler : public Handler {
bool have_x, have_y;
Expand Down Expand Up @@ -563,7 +565,7 @@ class AbstractScrollHandler : public Handler {
}
protected:
void move_back() {
if (!prefs.move_back.get() || (xstate->current_dev && xstate->current_dev->absolute))
if (!prefs.move_back.get())
return;
XTestFakeMotionEvent(dpy, DefaultScreen(dpy), orig_x, orig_y, 0);
}
Expand Down Expand Up @@ -968,7 +970,7 @@ class StrokeHandler : public Handler, public sigc::trackable {
virtual void release(guint b, RTriple e) {
RStroke s = finish(0);

if (prefs.move_back.get() && !xstate->current_dev->absolute)
if (prefs.move_back.get())
XTestFakeMotionEvent(dpy, DefaultScreen(dpy), orig->x, orig->y, 0);
else
XTestFakeMotionEvent(dpy, DefaultScreen(dpy), e->x, e->y, 0);
Expand Down
17 changes: 9 additions & 8 deletions po/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ msgstr ""
"Project-Id-Version: easystroke\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2013-03-14 00:24-0400\n"
"PO-Revision-Date: 2012-10-28 10:42+0000\n"
"Last-Translator: Penegal <Unknown>\n"
"PO-Revision-Date: 2015-07-07 13:11+0200\n"
"Last-Translator: Raphael Rochet <raphael@rri.fr>\n"
"Language-Team: French <fr@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Launchpad-Export-Date: 2013-03-14 04:28+0000\n"
"X-Generator: Launchpad (build 16532)\n"
"X-Generator: Poedit 1.8.2\n"
"Language: fr\n"

#, c-format
msgid "Error: can't execute command \"%s\": fork() failed\n"
Expand Down Expand Up @@ -46,8 +47,7 @@ msgstr "rename() a échoué"

#, c-format
msgid "Error: Couldn't save action database: %s.\n"
msgstr ""
"Erreur : impossible d'enregistrer la base de données des actions %s.\n"
msgstr "Erreur : impossible d'enregistrer la base de données des actions %s.\n"

msgid ""
"Couldn't save %1. Your changes will be lost. Make sure that \"%2\" is a "
Expand Down Expand Up @@ -292,7 +292,7 @@ msgid "D_isabled"
msgstr "D_ésactivé"

msgid "<unnamed>"
msgstr ""
msgstr "<sansnom>"

msgid "Connection to DBus failed"
msgstr "La connexion à DBus a échoué"
Expand Down Expand Up @@ -390,7 +390,7 @@ msgid "Show popups ("
msgstr "Afficher les popups ("

msgid "to the right of the cursor)"
msgstr ""
msgstr "à droite du curseur)"

msgid "Show tray icon"
msgstr "Afficher l'icône dans la barre des tâches"
Expand Down Expand Up @@ -418,6 +418,8 @@ msgstr "Préférences"

msgid "Only enable easystroke for applications listed on 'Actions' tab"
msgstr ""
"N'activer easystroke que pour les applications listées dans l'onglet "
"'Actions'"

msgid "Timeout Gestures"
msgstr "Gestes de temps mort"
Expand Down Expand Up @@ -483,6 +485,5 @@ msgstr "Désactiver"
#~ msgid "(window manager frame)"
#~ msgstr "(cadre du gestionnaire de fenêtres)"

#, c-format
#~ msgid "Error: A grab failed. Resetting...\n"
#~ msgstr "Erreur : une saisie a échoué. Redémarrage...\n"
2 changes: 1 addition & 1 deletion win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ void Win::timeout() {
}

void Win::set_icon(RStroke stroke, bool invert) {
if (!icon)
if (!icon || icon->get_size() <= 0)
return;
icon->set(stroke->draw(icon->get_size(), 2.0, invert));
set_timeout(10000);
Expand Down
0