Skip to content

Commit

Permalink
list widget: Update "pos_name" attribute after every change to "pos"
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisschagt committed Apr 14, 2020
1 parent b7be405 commit 0cc16e7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions widgets/wt_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,12 @@ static void fix_offset_pos(struct stfl_widget *w)
int i;
int maxpos = -1;
struct stfl_widget *c;
struct stfl_widget *latest_widget = NULL;
for (i=0, c=w->first_child; c; i++, c=c->next_sibling) {
if (stfl_widget_getkv_int(c, L"can_focus", 1) &&
stfl_widget_getkv_int(c, L".display", 1))
stfl_widget_getkv_int(c, L".display", 1))
maxpos= i;
latest_widget = c;

if(maxpos == pos) break;
}
Expand All @@ -88,8 +90,8 @@ static void fix_offset_pos(struct stfl_widget *w)
if (pos != orig_pos)
stfl_widget_setkv_int(w, L"pos", pos);

if (c)
stfl_widget_setkv_str(w, L"pos_name", c->name ? c->name : L"");
if (latest_widget)
stfl_widget_setkv_str(w, L"pos_name", latest_widget->name ? latest_widget->name : L"");
}

static void stfl_focus_prev_pos(struct stfl_widget *w)
Expand Down

0 comments on commit 0cc16e7

Please sign in to comment.