Commit c1e4c8d3ee3300f363a52fd4cf3d90fdf5098f5a

Authored by Pavel Machek
Committed by Linus Torvalds
1 parent 8bd7f125e2

[PATCH] fix jumpy mouse cursor on console

Do not send empty events to gpm.  (Keyboards are assumed to have scroll
wheel these days, that makes them part-mouse.  That means typing on
keyboard generates empty mouse events).

From: Dmitry Torokhov <dtor_core@ameritech.net>
Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 1 changed file with 10 additions and 5 deletions Side-by-side Diff

drivers/input/mousedev.c
... ... @@ -101,6 +101,7 @@
101 101 unsigned char ready, buffer, bufsiz;
102 102 unsigned char imexseq, impsseq;
103 103 enum mousedev_emul mode;
  104 + unsigned long last_buttons;
104 105 };
105 106  
106 107 #define MOUSEDEV_SEQ_LEN 6
... ... @@ -224,7 +225,7 @@
224 225 spin_lock_irqsave(&list->packet_lock, flags);
225 226  
226 227 p = &list->packets[list->head];
227   - if (list->ready && p->buttons != packet->buttons) {
  228 + if (list->ready && p->buttons != mousedev->packet.buttons) {
228 229 unsigned int new_head = (list->head + 1) % PACKET_QUEUE_LEN;
229 230 if (new_head != list->tail) {
230 231 p = &list->packets[list->head = new_head];
231 232  
... ... @@ -249,10 +250,13 @@
249 250 p->dz += packet->dz;
250 251 p->buttons = mousedev->packet.buttons;
251 252  
252   - list->ready = 1;
  253 + if (p->dx || p->dy || p->dz || p->buttons != list->last_buttons)
  254 + list->ready = 1;
253 255  
254 256 spin_unlock_irqrestore(&list->packet_lock, flags);
255   - kill_fasync(&list->fasync, SIGIO, POLL_IN);
  257 +
  258 + if (list->ready)
  259 + kill_fasync(&list->fasync, SIGIO, POLL_IN);
256 260 }
257 261  
258 262 wake_up_interruptible(&mousedev->wait);
259 263  
... ... @@ -477,9 +481,10 @@
477 481 }
478 482  
479 483 if (!p->dx && !p->dy && !p->dz) {
480   - if (list->tail == list->head)
  484 + if (list->tail == list->head) {
481 485 list->ready = 0;
482   - else
  486 + list->last_buttons = p->buttons;
  487 + } else
483 488 list->tail = (list->tail + 1) % PACKET_QUEUE_LEN;
484 489 }
485 490