void-packages/srcpkgs/mouseemu/patches/004-defaults.patch

71 lines
1.8 KiB
Diff

Author: <gaudenz@debian.org>
Description: change defaults to not emaulate mouse buttons for \!powerpc
--- a/mouseemu.c
+++ b/mouseemu.c
@@ -24,11 +24,15 @@
#include <signal.h>
#include <wait.h>
#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include <linux/input.h>
#include <linux/uinput.h>
#include "mouseemu.h"
#include "defkeys.h"
+static int use_defaults = 0;
+
static int b2_mod = BUTTON2MOD;
static int b2_key = BUTTON2KEY;
@@ -534,10 +538,16 @@
"Use decimal values. BTN_LEFT(272) is usable as "
"B2_KEY or B3_KEY.\n\n");
fprintf(stream, "Default uinput device: " DEFAULT_UINPUT ".\n");
- fprintf(stream, "Default keys:\n"
+ fprintf(stream, "Default keys:\n");
+ if (use_defaults)
+ fprintf(stream,
"\tMiddle click : F10 (0 68)\n"
- "\tRight click : F11 (0 87)\n"
- "\tScroll mod. : Alt (56)\n"
+ "\tRight click : F11 (0 87)\n");
+ else
+ fprintf(stream,
+ "\tMiddle click : none (0 0)\n"
+ "\tRight click : none (0 0)\n");
+ fprintf(stream, "\tScroll mod. : Alt (56)\n"
"\tDefault blocking time while typing: 300ms\n");
exit(0);
@@ -556,6 +566,29 @@
install_sighandler();
+#ifdef __powerpc__
+ use_defaults = 1;
+#else
+#if defined(__i386__) || defined(__amd64__)
+ {
+ FILE *dmidecode;
+ char line[1024];
+ dmidecode = popen("dmidecode -s system-manufacturer 2>/dev/null", "r");
+ if (dmidecode) {
+ if (fgets(line, 1024, dmidecode) && !strncmp(line, "Apple", 5))
+ use_defaults = 1;
+ pclose(dmidecode);
+ }
+ }
+#endif
+#endif
+ if (!use_defaults) {
+ b2_mod = 0;
+ b2_key = 0;
+ b3_mod = 0;
+ b3_key = 0;
+ }
+
uinputdev = DEFAULT_UINPUT;
if (argc > 1) {
int i = 0;