Merge lp:~ace17/wizardpen/trunk into lp:wizardpen

Proposed by Sebastien Alaiwan
Status: Needs review
Proposed branch: lp:~ace17/wizardpen/trunk
Merge into: lp:wizardpen
Diff against target: 127 lines (+9/-52)
1 file modified
src/wizardpen.c (+9/-52)
To merge this branch: bzr merge lp:~ace17/wizardpen/trunk
Reviewer Review Type Date Requested Status
Wizardpen Developers Pending
Review via email: mp+220680@code.launchpad.net

Description of the change

Cleanup dead code + set default value for MouseSpeed, otherwise it defaults to zero, making the mouse impossible to move.

To post a comment you must log in.

Unmerged revisions

58. By Sebastien Alaiwan

Cleanup unused default options

57. By Sebastien Alaiwan

Set a non-zero default value for MouseSpeed.

56. By Sebastien Alaiwan

Remove dead code

55. By Sebastien Alaiwan

Fix warning about 'const'

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/wizardpen.c'
2--- src/wizardpen.c 2011-11-11 00:49:02 +0000
3+++ src/wizardpen.c 2014-05-22 16:01:51 +0000
4@@ -92,13 +92,8 @@
5
6 static const char *default_options[] =
7 {
8- "BaudRate", "9600",
9- "StopBits", "1",
10- "DataBits", "8",
11- "Parity", "Odd",
12- "Vmin", "1",
13- "Vtime", "10",
14- "FlowControl", "Xoff",
15+ "MouseSpeed", "24",
16+ "MouseAccel", "1",
17 NULL
18 };
19
20@@ -186,7 +181,7 @@
21 snprintf(str, EV_DEV_NAME_MAXLEN, "%s%d", DEV_INPUT_EVENT, num)
22
23 static Bool
24-fd_query_wizardpen(int fd, char *wizardpen_name) {
25+fd_query_wizardpen(int fd, const char *wizardpen_name) {
26 char name[256] = "Unknown";
27 int cmp_at = strlen(wizardpen_name);
28 if (cmp_at > 255)
29@@ -208,7 +203,7 @@
30 Bool have_evdev = FALSE;
31 int noent_cnt = 0;
32 const int max_skip = 10;
33- char *wizardpen_name = xf86FindOptionValue(local->options, "Name");
34+ const char *wizardpen_name = xf86FindOptionValue(local->options, "Name");
35 char fname[EV_DEV_NAME_MAXLEN];
36 int np;
37
38@@ -337,7 +332,7 @@
39 {
40 WizardPenPrivatePtr priv = calloc (1, sizeof(WizardPenPrivateRec));
41 int msgtype;
42- char *s;
43+ const char *s;
44 int rc = Success;
45
46 if (!priv) {
47@@ -466,7 +461,7 @@
48 if (s && strlen(s) > 0) {
49 priv->bottomZ = parsePercentage(s, priv->maxZ);
50 }
51-
52+
53 s = xf86FindOptionValue(local->options, "KeepShape");
54 if (s && strlen(s) > 0) {
55 priv->keepShape = parseBool(s);
56@@ -535,7 +530,7 @@
57 priv->mouseAccel = parseBool(s);
58 xf86Msg(X_CONFIG, "%s: MouseAccel = %d\n", local->name, priv->mouseAccel);
59 }
60-
61+
62 s = xf86FindOptionValue(local->options, "ReportScreen");
63 if (s && strlen(s) > 0) {
64 priv->reportScreen = parseBool(s);
65@@ -1125,7 +1120,7 @@
66 if(event->value)
67 priv->activeButtons |= WIZARDPEN_BTN_TOUCH;
68 else
69- priv->activeButtons &= ~WIZARDPEN_BTN_TOUCH;
70+ priv->activeButtons &= ~WIZARDPEN_BTN_TOUCH;
71 if(!event->value)
72 {
73 buttons = set_bit(buttons, 2, 0); /* try to clear events to prevent some becoming 'locked' in the active state */
74@@ -1292,44 +1287,6 @@
75 }
76 #endif // #ifdef LINUX_INPUT
77
78-#define WriteString(str)\
79- XisbWrite (priv->buffer, (unsigned char *)(str), strlen(str))
80-
81-static Bool
82-QueryHardware (WizardPenPrivatePtr priv)
83-{
84- /* Reset */
85- WriteString(WIZARDPEN_RESET);
86-
87- /* Wait */
88- milisleep (250);
89-
90- /* Prompt Mode in order to not be disturbed */
91- WriteString(WIZARDPEN_PROMPT_MODE);
92-
93- /* Flush */
94- while (XisbRead(priv->buffer) >= 0);
95-
96- /* Ask for Config packet*/
97- WriteString(WIZARDPEN_CONFIG);
98-
99- /* Read the packet */
100- XisbBlockDuration (priv->buffer, 1000000);
101- NewPacket (priv);
102-
103- if ((WizardPenGetPacket (priv) == Success))
104- {
105- priv->maxX = (int)priv->packet[1] + ((int)priv->packet[2] << 7);
106- priv->maxY = (int)priv->packet[3] + ((int)priv->packet[4] << 7);
107- priv->maxZ = 512; // FIXME: some tablets go to 1024
108- xf86Msg(X_PROBED, "Wizardpen Tablet MaxX:%d MaxY:%d\n", priv->maxX, priv->maxY);
109- }
110- else
111- return !Success;
112-
113- return Success;
114-}
115-
116 #define BITS_PER_LONG (sizeof(long) * 8)
117 #define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
118 #define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)
119@@ -1383,7 +1340,7 @@
120 }
121 }
122 }
123-
124+
125 // FIXME: do we need to check this or is it always the same?
126 if (aX + aY > bX + bY)
127 {

Subscribers

People subscribed via source and target branches