Ticket #3766: 0001-Ticket-3766-add_widget_autopos-doesn-t-remove-focus-.patch

File 0001-Ticket-3766-add_widget_autopos-doesn-t-remove-focus-.patch, 1.9 KB (added by andrew_b, 2 years ago)
  • lib/widget/dialog.c

    From f26be579fe5843ef5a234394e9d08f1ec423e8e1 Mon Sep 17 00:00:00 2001
    From: Andrew Borodin <aborodin@vmail.ru>
    Date: Mon, 30 Jan 2017 22:06:13 +0300
    Subject: [PATCH] Ticket #3766: add_widget_autopos() doesn't remove focus from
     the previously focused widget.
    
    Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
    ---
     lib/widget/dialog.c | 13 ++++++++-----
     1 file changed, 8 insertions(+), 5 deletions(-)
    
    diff --git a/lib/widget/dialog.c b/lib/widget/dialog.c
    index 6dc6252..75f91ba 100644
    a b add_widget_autopos (WDialog * h, void *w, widget_pos_flags_t pos_flags, const vo 
    845845{ 
    846846    Widget *wh = WIDGET (h); 
    847847    Widget *widget; 
     848    GList *current; 
    848849 
    849850    /* Don't accept 0 widgets */ 
    850851    if (w == NULL) 
    add_widget_autopos (WDialog * h, void *w, widget_pos_flags_t pos_flags, const vo 
    867868    if (h->widgets == NULL || before == NULL) 
    868869    { 
    869870        h->widgets = g_list_append (h->widgets, widget); 
    870         h->current = g_list_last (h->widgets); 
     871        current = g_list_last (h->widgets); 
    871872    } 
    872873    else 
    873874    { 
    add_widget_autopos (WDialog * h, void *w, widget_pos_flags_t pos_flags, const vo 
    882883        b = g_list_next (b); 
    883884        h->widgets = g_list_insert_before (h->widgets, b, widget); 
    884885        if (b != NULL) 
    885             h->current = g_list_previous (b); 
     886            current = g_list_previous (b); 
    886887        else 
    887             h->current = g_list_last (h->widgets); 
     888            current = g_list_last (h->widgets); 
    888889    } 
    889890 
    890     /* widget has been added in runtime */ 
     891    /* widget has been added at runtime */ 
    891892    if (widget_get_state (wh, WST_ACTIVE)) 
    892893    { 
    893894        send_message (widget, NULL, MSG_INIT, 0, NULL); 
    894         widget_set_state (widget, WST_FOCUSED, TRUE); 
     895        widget_select (widget); 
    895896    } 
     897    else 
     898        h->current = current; 
    896899 
    897900    return widget->id; 
    898901}