Ticket #3766: 3766-add_widget_autopos-doesnt-remove-focus.patch

File 3766-add_widget_autopos-doesnt-remove-focus.patch, 1.0 KB (added by mooffie, 8 years ago)
  • lib/widget/dialog.c

    From 911d906fd9cce8471249fa3e3489c93ace3259d2 Mon Sep 17 00:00:00 2001
    From: Mooffie <mooffie@gmail.com>
    Date: Thu, 26 Jan 2017 18:40:14 +0200
    Subject: [PATCH] Ticket #3766: add_widget_autopos() doesn't remove focus from
     the previously focused widget.
    
    Signed-off-by: Mooffie <mooffie@gmail.com>
    ---
     lib/widget/dialog.c | 8 ++++++++
     1 file changed, 8 insertions(+)
    
    diff --git a/lib/widget/dialog.c b/lib/widget/dialog.c
    index 6dc6252..0a7aa7e 100644
    a b add_widget_autopos (WDialog * h, void *w, widget_pos_flags_t pos_flags, const vo 
    864864    widget->pos_flags = pos_flags; 
    865865    widget->id = h->widget_id++; 
    866866 
     867    /* widget is to be added in runtime */ 
     868    if (widget_get_state (wh, WST_ACTIVE)) 
     869    { 
     870        /* clear focus from the soon-to-be inactive widget. */ 
     871        if (h->current != NULL) 
     872            widget_set_state (h->current->data, WST_FOCUSED, FALSE); 
     873    } 
     874 
    867875    if (h->widgets == NULL || before == NULL) 
    868876    { 
    869877        h->widgets = g_list_append (h->widgets, widget);