mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
Merge branch '3766_add_widget_autopos'
* 3766_add_widget_autopos: Ticket #3766: add_widget_autopos() doesn't remove focus from the previously focused widget.
This commit is contained in:
commit
25b4096ace
@ -845,6 +845,7 @@ add_widget_autopos (WDialog * h, void *w, widget_pos_flags_t pos_flags, const vo
|
||||
{
|
||||
Widget *wh = WIDGET (h);
|
||||
Widget *widget;
|
||||
GList *new_current;
|
||||
|
||||
/* Don't accept 0 widgets */
|
||||
if (w == NULL)
|
||||
@ -867,7 +868,7 @@ add_widget_autopos (WDialog * h, void *w, widget_pos_flags_t pos_flags, const vo
|
||||
if (h->widgets == NULL || before == NULL)
|
||||
{
|
||||
h->widgets = g_list_append (h->widgets, widget);
|
||||
h->current = g_list_last (h->widgets);
|
||||
new_current = g_list_last (h->widgets);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -882,17 +883,19 @@ add_widget_autopos (WDialog * h, void *w, widget_pos_flags_t pos_flags, const vo
|
||||
b = g_list_next (b);
|
||||
h->widgets = g_list_insert_before (h->widgets, b, widget);
|
||||
if (b != NULL)
|
||||
h->current = g_list_previous (b);
|
||||
new_current = g_list_previous (b);
|
||||
else
|
||||
h->current = g_list_last (h->widgets);
|
||||
new_current = g_list_last (h->widgets);
|
||||
}
|
||||
|
||||
/* widget has been added in runtime */
|
||||
/* widget has been added at runtime */
|
||||
if (widget_get_state (wh, WST_ACTIVE))
|
||||
{
|
||||
send_message (widget, NULL, MSG_INIT, 0, NULL);
|
||||
widget_set_state (widget, WST_FOCUSED, TRUE);
|
||||
widget_select (widget);
|
||||
}
|
||||
else
|
||||
h->current = new_current;
|
||||
|
||||
return widget->id;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user