From: Grazvydas Ignotas Date: Tue, 16 Oct 2012 21:18:26 +0000 (+0300) Subject: libgtkstylus: use alt-tap for rightclick X-Git-Tag: sz_152^0 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=527272c58cac35535123c873c0c38b90caf4539c;p=openembedded.git libgtkstylus: use alt-tap for rightclick also add ability to configure this --- diff --git a/recipes/libgtkstylus/files/alt_rightclick.patch b/recipes/libgtkstylus/files/alt_rightclick.patch new file mode 100644 index 0000000000..c6d7f25f0c --- /dev/null +++ b/recipes/libgtkstylus/files/alt_rightclick.patch @@ -0,0 +1,69 @@ +diff -urp libgtkstylus-0.3_/tap.c libgtkstylus-0.3/tap.c +--- libgtkstylus-0.3_/tap.c 2012-10-16 15:25:07.900784038 +0300 ++++ libgtkstylus-0.3/tap.c 2012-10-16 23:48:51.280784004 +0300 +@@ -17,6 +17,7 @@ + * Boston, MA 02111-1307, USA. + */ + ++#include + #include + #include + +@@ -102,11 +103,56 @@ filter (GdkEvent *ev, gpointer data) + gtk_main_do_event (ev); + } + ++static guint modifiers = GDK_MOD1_MASK; ++static int right_pressed; ++ ++static void ++filter2 (GdkEvent *ev, gpointer data) ++{ ++ if (ev->type == GDK_BUTTON_PRESS ++ && ev->button.button == 1 ++ && (ev->button.state & modifiers)) ++ { ++ ev->button.button = 3; ++ right_pressed = 1; ++ } ++ else if (ev->type == GDK_BUTTON_RELEASE ++ && ev->button.button == 1 ++ && right_pressed) ++ { ++ ev->button.button = 3; ++ right_pressed = 0; ++ } ++ ++ gtk_main_do_event (ev); ++} ++ + void + gtk_module_init (gint *argc, gchar ***argv) + { ++ char buf[256]; ++ int mode = 1; ++ int val; ++ char *home; ++ FILE *f; ++ + if (getenv ("GTK_STYLUS_DO_FN")) + do_fn = 1; + +- gdk_event_handler_set (filter, NULL, NULL); ++ home = getenv("XDG_CONFIG_HOME"); ++ if (home == NULL) ++ home = getenv("HOME"); ++ snprintf(buf, sizeof(buf), "%s/libgtkstylus.conf", home); ++ f = fopen(buf, "r"); ++ if (f != NULL) { ++ while (fgets(buf, sizeof(buf), f)) { ++ if (sscanf(buf, "mode = %d", &val) == 1) ++ mode = val; ++ else if (sscanf(buf, "modifiers = %d", &val) == 1) ++ modifiers = val; ++ } ++ fclose(f); ++ } ++ ++ gdk_event_handler_set (mode ? filter2 : filter, NULL, NULL); + } diff --git a/recipes/libgtkstylus/libgtkstylus_0.3.bb b/recipes/libgtkstylus/libgtkstylus_0.3.bb index 5912b2dab8..c14a5954aa 100644 --- a/recipes/libgtkstylus/libgtkstylus_0.3.bb +++ b/recipes/libgtkstylus/libgtkstylus_0.3.bb @@ -2,12 +2,13 @@ DESCRIPTION = "GTK plugin for stylus based systems" SECTION = "libs" DEPENDS = "gtk+" LICENSE = "LGPL" -PR = "r6" +PR = "r7" inherit autotools SRC_URI = "${GPE_MIRROR}/${PN}-${PV}.tar.bz2 \ file://makefile.patch;patch=1 \ + file://alt_rightclick.patch;patch=1 \ file://gtkstylus.sh" do_install_append() {