diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2005-01-30 21:55:51 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2005-01-30 21:55:51 +0000 |
commit | 971299eb3e37dcc90641f726688aa48ad0e10aaf (patch) | |
tree | 3c17d932e5bf92e7987c48a21f2a0044de2aaad7 /sys | |
parent | c6e1d4ec4345fac036356b1d20888b041494dd13 (diff) |
Hack to allow emulation of mouse buttons for now, incorrectly shares
global between zkbd and zts, until a better solution is found.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/zaurus/dev/zaurus_kbd.c | 9 | ||||
-rw-r--r-- | sys/arch/zaurus/dev/zts.c | 36 |
2 files changed, 40 insertions, 5 deletions
diff --git a/sys/arch/zaurus/dev/zaurus_kbd.c b/sys/arch/zaurus/dev/zaurus_kbd.c index 9fa68cff985..d7ec1d0c7be 100644 --- a/sys/arch/zaurus/dev/zaurus_kbd.c +++ b/sys/arch/zaurus/dev/zaurus_kbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zaurus_kbd.c,v 1.11 2005/01/28 14:47:31 drahn Exp $ */ +/* $OpenBSD: zaurus_kbd.c,v 1.12 2005/01/30 21:55:50 drahn Exp $ */ /* * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org> * @@ -119,6 +119,8 @@ int zkbd_on(void *v); int zkbd_sync(void *v); int zkbd_hinge(void *v); +int zkbd_modstate; + struct cfattach zkbd_ca = { sizeof(struct zkbd_softc), zkbd_match, zkbd_attach }; @@ -339,6 +341,11 @@ zkbd_poll(void *v) /* process after resetting interrupt */ + zkbd_modstate = ( + (sc->sc_keystate[84] ? (1 << 0) : 0) | /* shift */ + (sc->sc_keystate[93] ? (1 << 1) : 0) | /* Fn */ + (sc->sc_keystate[14] ? (1 << 2) : 0)); /* 'alt' */ + for (i = 0; i < (sc->sc_nsense * sc->sc_nstrobe); i++) { stuck = 0; /* extend xt_keymap to do this faster. */ diff --git a/sys/arch/zaurus/dev/zts.c b/sys/arch/zaurus/dev/zts.c index ec31a3fb9a4..8d7921578a0 100644 --- a/sys/arch/zaurus/dev/zts.c +++ b/sys/arch/zaurus/dev/zts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zts.c,v 1.2 2005/01/28 23:26:54 drahn Exp $ */ +/* $OpenBSD: zts.c,v 1.3 2005/01/30 21:55:50 drahn Exp $ */ /* * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org> * @@ -99,7 +99,9 @@ zts_attach(struct device *parent, struct device *self, void *aux) timeout_set(&(sc->sc_ts_poll), zts_poll, sc); - timeout_add(&sc->sc_ts_poll, POLL_TIMEOUT_RATE); + + sc->sc_enabled = 0; + sc->sc_buttons = 0; /* pxa2x0_gpio_set_function(IRQ_GPIO_TP_INT_C3K, GPIO_IN); @@ -181,11 +183,32 @@ zts_irq(void *v) * relative mode here is really just a hack until abs mode * really works in X. */ - if (t0 != 0 && t1 != 0) { + if (t0 > 10 && t1 > 10) { int dx, dy; int skip = 0; if ( sc->sc_oldx == -1) { + extern int zkbd_modstate; + if (zkbd_modstate != 0) { + /* + * use motifiers with touchpress to indicate + * buttons. + */ + + if(zkbd_modstate & (1 << 0)) { + /* shift */ + sc->sc_buttons |= (1 << 0); + } + if(zkbd_modstate & (1 << 1)) { + /* Fn */ + sc->sc_buttons |= (1 << 1); + } + if(zkbd_modstate & (1 << 2)) { + /* 'Alt' */ + sc->sc_buttons |= (1 << 2); + } + + } skip = 1; } @@ -202,9 +225,14 @@ zts_irq(void *v) sc->sc_oldx = x; sc->sc_oldy = y; if (!skip) - wsmouse_input(sc->sc_wsmousedev, 0/* XXX buttons */, + wsmouse_input(sc->sc_wsmousedev, sc->sc_buttons, dx, dy, 0 /* XXX*/, WSMOUSE_INPUT_DELTA); } else { + + sc->sc_buttons = 0; + wsmouse_input(sc->sc_wsmousedev, sc->sc_buttons, + 0, 0, 0 /* XXX*/, WSMOUSE_INPUT_DELTA); + sc->sc_oldx = -1; sc->sc_oldy = -1; } |