Ticket #3661: wrong handling of mouse clicks in long listing mode.

This occurs if the left panel is in long listing mode and the right
panel is in full listing mode:
When the left panel is active and you click on the right side of the
panel, the click event is directed to the (inactive) right panel instead
of the (active) left panel.

This occurs if the right panel is in long listing mode:
When the left panel is active and you click on the left panel, the click
event is always directed to the (inactive) right panel. It's impossible
to click anything on the left panel, if the right panel is in long
listing mode.

Thanks Seray Rosh <seray.rosh@web.de> for intial patch.

Initial commit: refactoring of widget selection.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2016-06-28 15:39:03 +03:00
parent 5848342bb2
commit 7c74fd90f0

View File

@ -213,6 +213,23 @@ dlg_find_widget_callback (const void *a, const void *b)
return (w->callback == f) ? 0 : 1;
}
/* --------------------------------------------------------------------------------------------- */
/**
* Put widget on top or bottom of Z-order.
*/
static void
dlg_reorder_widgets (GList * l, gboolean set_top)
{
WDialog *h = WIDGET (l->data)->owner;
h->widgets = g_list_remove_link (h->widgets, l);
if (set_top)
h->widgets = g_list_concat (h->widgets, l);
else
h->widgets = g_list_concat (l, h->widgets);
}
/* --------------------------------------------------------------------------------------------- */
/**
* Try to select another widget. If forward is set, follow tab order.
@ -255,6 +272,9 @@ do_select_widget (WDialog * h, GList * w, select_dir_t dir)
}
while (h->current != w);
if (widget_get_options (WIDGET (h->current->data), WOP_TOP_SELECT))
dlg_reorder_widgets (h->current, TRUE);
if (widget_overlapped (w0, WIDGET (h->current->data)))
{
send_message (h->current->data, NULL, MSG_DRAW, 0, NULL);
@ -610,31 +630,6 @@ dlg_find_widget_by_id (gconstpointer a, gconstpointer b)
return w->id == id ? 0 : 1;
}
/* --------------------------------------------------------------------------------------------- */
static void
dlg_set_top_or_bottom_widget (void *w, gboolean set_top)
{
Widget *widget = WIDGET (w);
WDialog *h = widget->owner;
GList *l;
l = g_list_find (h->widgets, w);
if (l == NULL)
abort (); /* widget is not in dialog, this should not happen */
/* unfocus prevoius widget and focus current one before widget reordering */
if (set_top && widget_get_state (WIDGET (h), WST_ACTIVE))
do_select_widget (h, l, SELECT_EXACT);
/* widget reordering */
h->widgets = g_list_remove_link (h->widgets, l);
if (set_top)
h->widgets = g_list_concat (h->widgets, l);
else
h->widgets = g_list_concat (l, h->widgets);
}
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
@ -1145,10 +1140,7 @@ dlg_select_widget (void *w)
Widget *widget = WIDGET (w);
WDialog *h = widget->owner;
if (widget_get_options (widget, WOP_TOP_SELECT))
dlg_set_top_or_bottom_widget (w, TRUE);
else
do_select_widget (h, g_list_find (h->widgets, widget), SELECT_EXACT);
do_select_widget (h, g_list_find (h->widgets, widget), SELECT_EXACT);
}
/* --------------------------------------------------------------------------------------------- */
@ -1159,7 +1151,10 @@ dlg_select_widget (void *w)
void
dlg_set_bottom_widget (void *w)
{
dlg_set_top_or_bottom_widget (w, FALSE);
Widget *widget = WIDGET (w);
WDialog *h = widget->owner;
dlg_reorder_widgets (g_list_find (h->widgets, widget), FALSE);
}
/* --------------------------------------------------------------------------------------------- */