From 25c1b70edf496531f7184316d6a5712bf4ca2000 Mon Sep 17 00:00:00 2001
From: Mooffie <mooffie@gmail.com>
Date: Fri, 5 Feb 2016 16:23:54 +0200
Subject: [PATCH] fixup! WListbox: optimize mouse event processing.
---
lib/widget/listbox.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/lib/widget/listbox.c b/lib/widget/listbox.c
index 84da74e..70fb6d2 100644
a
|
b
|
static void |
497 | 497 | listbox_mouse_callback (Widget * w, mouse_msg_t msg, mouse_event_t * event) |
498 | 498 | { |
499 | 499 | WListbox *l = LISTBOX (w); |
| 500 | int old_pos; |
| 501 | |
| 502 | old_pos = l->pos; |
500 | 503 | |
501 | 504 | switch (msg) |
502 | 505 | { |
… |
… |
listbox_mouse_callback (Widget * w, mouse_msg_t msg, mouse_event_t * event) |
519 | 522 | break; |
520 | 523 | |
521 | 524 | case MSG_MOUSE_CLICK: |
522 | | if ((event->count & GPM_DOUBLE) != 0) /* Double click */ |
| 525 | /* We don't call listbox_select_entry() here: MSG_MOUSE_DOWN/DRAG did this already. */ |
| 526 | if (event->count == GPM_DOUBLE) /* Double click */ |
523 | 527 | listbox_do_action (l); |
524 | 528 | break; |
525 | 529 | |
… |
… |
listbox_mouse_callback (Widget * w, mouse_msg_t msg, mouse_event_t * event) |
527 | 531 | break; |
528 | 532 | } |
529 | 533 | |
530 | | if (msg != MSG_MOUSE_UP && w->owner->state == DLG_ACTIVE) |
531 | | listbox_draw (l, TRUE); |
| 534 | /* If the selection has changed, we redraw the widget and notify the dialog. */ |
| 535 | if (l->pos != old_pos) |
| 536 | listbox_on_change (l); |
532 | 537 | } |
533 | 538 | |
534 | 539 | /* --------------------------------------------------------------------------------------------- */ |