[gpm] [PATCH 7/18] absolute-device-attr.patch
Dmitry Torokhov
dtor_core@ameritech.net
Tue Aug 10 08:54:43 CEST 2004
===================================================================
ChangeSet@1.11, 2004-08-10 00:53:07-05:00, dtor_core@ameritech.net
Allow same protocol control devices in absolute and relative mode.
Before, if a protocold driver supported devices in both relative
and absolute mode it would, like Wacom, change absolute attribute
right in the Gpm_Type structure. It obviously does not work if you
have 2 devices using 2 different methods at the same time.
gpm.c | 12 ++++++------
gpn.c | 2 ++
headers/gpmInt.h | 3 +++
mice.c | 4 ++--
4 files changed, 13 insertions(+), 8 deletions(-)
===================================================================
diff -Nru a/src/gpm.c b/src/gpm.c
--- a/src/gpm.c 2004-08-10 01:17:59 -05:00
+++ b/src/gpm.c 2004-08-10 01:17:59 -05:00
@@ -163,12 +163,12 @@
}
}
-static void handle_repeater(struct Gpm_Type *m_type, Gpm_Event *new_event, Gpm_Event *event)
+static void handle_repeater(int absolute_dev, Gpm_Event *new_event, Gpm_Event *event)
{
static struct timeval last;
struct timeval now;
- if (m_type->absolute) {
+ if (absolute_dev) {
/* prepare the values from a absolute device for repeater mode */
gettimeofday(&now, (struct timezone *)NULL);
if (((now.tv_sec - last.tv_sec) * 1000 +
@@ -210,7 +210,7 @@
enum mouse_rslt rslt = MOUSE_DATA_OK;
if (attempt > 1) {
- if (type->absolute) { /* a pen or other absolute device */
+ if (opt->absolute) { /* a pen or other absolute device */
event->x = nEvent.x;
event->y = nEvent.y;
}
@@ -244,7 +244,7 @@
}
/* propagate movement */
- if (!type->absolute) { /* mouse */
+ if (!opt->absolute) { /* mouse */
if (abs(nEvent.dx) + abs(nEvent.dy) > opt->delta)
nEvent.dx *= opt->accel, nEvent.dy *= opt->accel;
@@ -274,7 +274,7 @@
if (!text_mode) {
if (repeater.fd != -1 && !repeater.raw)
- handle_repeater(type, &nEvent, event);
+ handle_repeater(opt->absolute, &nEvent, event);
oldB = nEvent.buttons;
return MOUSE_NO_DATA; /* no events nor information for clients */
}
@@ -282,7 +282,7 @@
/*....................................... no, we arent a repeater, go on */
/* use fine delta values now, if delta is the information */
- if (!mouse->type->absolute) {
+ if (!opt->absolute) {
fine_dx += event->dx;
fine_dy += event->dy;
event->dx = fine_dx / opt->scalex;
diff -Nru a/src/gpn.c b/src/gpn.c
--- a/src/gpn.c 2004-08-10 01:17:59 -05:00
+++ b/src/gpn.c 2004-08-10 01:17:59 -05:00
@@ -106,6 +106,8 @@
if (!mouse->type)
mouse->type = find_mouse_by_name(DEF_TYPE);
+ mouse->options.absolute = mouse->type->absolute;
+
if (!mouse->options.sequence)
init_button_sequence(&mouse->options, DEF_SEQUENCE);
}
diff -Nru a/src/headers/gpmInt.h b/src/headers/gpmInt.h
--- a/src/headers/gpmInt.h 2004-08-10 01:17:59 -05:00
+++ b/src/headers/gpmInt.h 2004-08-10 01:17:59 -05:00
@@ -114,6 +114,9 @@
int cluster;
int three_button;
int glidepoint_tap;
+ int absolute; /* device reports absolute coordinates - initially copied
+ from Gpm_Type; allows same protocol (type) control devices
+ in absolute and relative mode */
char *text; /* extra textual options supplied via '-o text' */
};
diff -Nru a/src/mice.c b/src/mice.c
--- a/src/mice.c 2004-08-10 01:17:59 -05:00
+++ b/src/mice.c 2004-08-10 01:17:59 -05:00
@@ -1632,7 +1632,7 @@
};
parse_options(type->name, opt->text, ',', optioninfo);
- type->absolute = WacomAbsoluteWanted;
+ opt->absolute = WacomAbsoluteWanted;
reset_wacom();
/* "Flush" input queque */
@@ -1654,7 +1654,7 @@
}
if(WacomModell >= (sizeof(wcmodell) / sizeof(struct WC_MODELL)))
WacomModell=-1;
- gpm_report(GPM_PR_INFO,GPM_MESS_WACOM_MOD, type->absolute? 'A':'R',
+ gpm_report(GPM_PR_INFO,GPM_MESS_WACOM_MOD, opt->absolute? 'A':'R',
(WacomModell==(-1))? "Unknown" : wcmodell[WacomModell].name,
buffer+2);
More information about the gpm
mailing list