Revision 5fafdf24 hw/adb.c
b/hw/adb.c | ||
---|---|---|
1 | 1 |
/* |
2 | 2 |
* QEMU ADB support |
3 |
*
|
|
3 |
* |
|
4 | 4 |
* Copyright (c) 2004 Fabrice Bellard |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | 7 |
* of this software and associated documentation files (the "Software"), to deal |
8 | 8 |
* in the Software without restriction, including without limitation the rights |
... | ... | |
96 | 96 |
return olen; |
97 | 97 |
} |
98 | 98 |
|
99 |
ADBDevice *adb_register_device(ADBBusState *s, int devaddr,
|
|
100 |
ADBDeviceRequest *devreq,
|
|
101 |
ADBDeviceReset *devreset,
|
|
99 |
ADBDevice *adb_register_device(ADBBusState *s, int devaddr, |
|
100 |
ADBDeviceRequest *devreq, |
|
101 |
ADBDeviceReset *devreset, |
|
102 | 102 |
void *opaque) |
103 | 103 |
{ |
104 | 104 |
ADBDevice *d; |
... | ... | |
299 | 299 |
if (s->last_buttons_state == s->buttons_state && |
300 | 300 |
s->dx == 0 && s->dy == 0) |
301 | 301 |
return 0; |
302 |
|
|
302 |
|
|
303 | 303 |
dx = s->dx; |
304 | 304 |
if (dx < -63) |
305 | 305 |
dx = -63; |
306 | 306 |
else if (dx > 63) |
307 | 307 |
dx = 63; |
308 |
|
|
308 |
|
|
309 | 309 |
dy = s->dy; |
310 | 310 |
if (dy < -63) |
311 | 311 |
dy = -63; |
312 | 312 |
else if (dy > 63) |
313 | 313 |
dy = 63; |
314 |
|
|
314 |
|
|
315 | 315 |
s->dx -= dx; |
316 | 316 |
s->dy -= dy; |
317 | 317 |
s->last_buttons_state = s->buttons_state; |
318 |
|
|
318 |
|
|
319 | 319 |
dx &= 0x7f; |
320 | 320 |
dy &= 0x7f; |
321 |
|
|
321 |
|
|
322 | 322 |
if (!(s->buttons_state & MOUSE_EVENT_LBUTTON)) |
323 | 323 |
dy |= 0x80; |
324 | 324 |
if (!(s->buttons_state & MOUSE_EVENT_RBUTTON)) |
325 | 325 |
dx |= 0x80; |
326 |
|
|
326 |
|
|
327 | 327 |
obuf[0] = dy; |
328 | 328 |
obuf[1] = dx; |
329 | 329 |
return 2; |
... | ... | |
334 | 334 |
{ |
335 | 335 |
MouseState *s = d->opaque; |
336 | 336 |
int cmd, reg, olen; |
337 |
|
|
337 |
|
|
338 | 338 |
if ((buf[0] & 0x0f) == ADB_FLUSH) { |
339 | 339 |
/* flush mouse fifo */ |
340 | 340 |
s->buttons_state = s->last_buttons_state; |
Also available in: Unified diff