| plan 9 kernel history: overview | file list | diff list |
2000/1207/bitsy/devpenmouse.c (diff list | history)
| 2000/1206/sys/src/9/bitsy/devpenmouse.c:28,37 – 2000/1207/sys/src/9/bitsy/devpenmouse.c:28,48 (short | long | prev | next) | ||
| 2000/1120 | -23 | |
| 2000/1021 | }; | |
| 2000/1207 | /* The pen goes down, tracks some and goes up again. The pen alone can * only simulate a one-button mouse. * To simulate a more-button (five, in this case) mouse, we use the four * keys along the the bottom of the iPaq as modifiers. * When one (or more) of the modifier keys is (are) down, a pen-down event * causes the corresponding bottons to go down. If no modifier key is * depressed, a pen-down event is translated into a button-one down event. * Releasing the modifier keys has no direct effect. The pen-up event is * the one that triggers mouse-up events. */ | |
| 2000/1021 | struct Mousestate { Point xy; /* mouse.xy */ int buttons; /* mouse.buttons */ | |
| 2000/1207 | int modifiers; /* state of physical buttons 2, 3, 4, 5 */ | |
| 2000/1021 | ulong counter; /* increments every update */ ulong msec; /* time of last event */ }; | |
| 2000/1206/sys/src/9/bitsy/devpenmouse.c:79,101 – 2000/1207/sys/src/9/bitsy/devpenmouse.c:90,123 | ||
| 2000/1021 | void penbutton(int up, int b) { | |
| 2000/1025 |
| |
| 2000/1021 |
| |
| 2000/1025 |
| |
| 2000/1021 |
| |
| 2000/1207 | if (b & 0x20) { if (up) mouse.buttons &= ~b; else mouse.buttons |= b; penmousetrack(mouse.buttons, -1, -1); } else { if (up) mouse.modifiers &= ~b; else mouse.modifiers |= b; } | |
| 2000/1021 | } void pentrackxy(int x, int y) { if (x == -1) { | |
| 2000/1024 |
| |
| 2000/1207 | /* pen up. associate with button 1 through 5 up */ mouse.buttons &= ~0x1f; | |
| 2000/1021 | } else { | |
| 2000/1101 | x = ((x*calibration.scalex)>>16) + calibration.transx; y = ((y*calibration.scaley)>>16) + calibration.transy; | |
| 2000/1024 |
| |
| 2000/1207 | if ((mouse.buttons & 0x1f) == 0) { if (mouse.modifiers) mouse.buttons |= mouse.modifiers; else mouse.buttons |= 0x1; } | |
| 2000/1021 | } penmousetrack(mouse.buttons, x, y); } | |