Ticket #3571: 3571-fixup-WListbox-optimize-mouse-event-processing.patch

File 3571-fixup-WListbox-optimize-mouse-event-processing.patch, 1.5 KB (added by mooffie, 8 years ago)
  • lib/widget/listbox.c

    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 
    497497listbox_mouse_callback (Widget * w, mouse_msg_t msg, mouse_event_t * event) 
    498498{ 
    499499    WListbox *l = LISTBOX (w); 
     500    int old_pos; 
     501 
     502    old_pos = l->pos; 
    500503 
    501504    switch (msg) 
    502505    { 
    listbox_mouse_callback (Widget * w, mouse_msg_t msg, mouse_event_t * event) 
    519522        break; 
    520523 
    521524    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 */ 
    523527            listbox_do_action (l); 
    524528        break; 
    525529 
    listbox_mouse_callback (Widget * w, mouse_msg_t msg, mouse_event_t * event) 
    527531        break; 
    528532    } 
    529533 
    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); 
    532537} 
    533538 
    534539/* --------------------------------------------------------------------------------------------- */