[PATCH]: menu doesn't appear on right info panel

Pavel Tsekov ptsekov at gmx.net
Tue Oct 26 08:25:44 UTC 2004


Hello,

Attached is a patch to address this issue:
http://mail.gnome.org/archives/mc-devel/2004-January/msg00007.html

Changes introduced with rev. 1.22 of dialog.c can, under certain
conditions, break the next widget selection alogrithm. In the
past the routines `select_other_widget' and `dlg_select_widget'
used to loop until they find a widget that would accept the
focus i.e. one that accepts WIDGET_FOCUS messages. Currently it
could happen that the new `do_select_widget' would finish without
selecting a widget that accepts `WIDGET_FOCUS' messages. This
is the source of the problem described in the link above.

It is not immediatly clear, so I provide info from a debbuggin
session:

(gdb) p *h->current
$3 = {x = 0, y = 0, cols = 125, lines = 1, options = 4, dlg_id = 0, next = 0x1009baf0, prev = 0x100a02b0,
callback = 0x42d89a <menubar_callback>, mouse = 0x42d9d9 <menubar_event>, parent = 0x1009bab0}

(gdb) p *h->current->next
$4 = {x = 0, y = 0, cols = 62, lines = 48, options = 0, dlg_id = 1, next = 0x100adab0, prev = 0x100a03a0,
callback = 0x4417b9 <panel_callback>, mouse = 0x441f03 <panel_event>, parent = 0x1009bab0}

(gdb) p *h->current->next->next
$5 = {x = 62, y = 0, cols = 63, lines = 48, options = 0, dlg_id = 2, next = 0x100a0360, prev = 0x1009baf0,
callback = 0x422f57 <info_callback>, mouse = 0, parent = 0x1009bab0}

(gdb) p *h->current->next->next->next
$6 = {x = 0, y = 48, cols = 125, lines = 1, options = 0, dlg_id = 3, next = 0x1009fdd0, prev = 0x100adab0,
callback = 0x456a74 <label_callback>, mouse = 0, parent = 0x1009bab0}

(gdb) p *h->current->next->next->next->next
$7 = {x = 2, y = 49, cols = 123, lines = 1, options = 20, dlg_id = 4, next = 0x100a0260, prev = 0x100a0360,
callback = 0x40b598 <command_callback>, mouse = 0x458c91 <input_event>, parent = 0x1009bab0}

(gdb) p *h->current->next->next->next->next->next
$8 = {x = 0, y = 49, cols = 2, lines = 1, options = 0, dlg_id = 5, next = 0x100a02b0, prev = 0x1009fdd0,
callback = 0x456a74 <label_callback>, mouse = 0, parent = 0x1009bab0}

(gdb) p *h->current->next->next->next->next->next->next
$9 = {x = 0, y = 50, cols = 125, lines = 1, options = 2, dlg_id = 6, next = 0x100a03a0, prev = 0x100a0260,
callback = 0x45a092 <buttonbar_callback>, mouse = 0x45a3f7 <buttonbar_event>, parent = 0x1009bab0}
(gdb) p *h->current->next->next->next->next->next->next->next

$10 = {x = 0, y = 0, cols = 125, lines = 1, options = 4, dlg_id = 0, next = 0x1009baf0, prev = 0x100a02b0,
callback = 0x42d89a <menubar_callback>, mouse = 0x42d9d9 <menubar_event>, parent = 0x1009bab0}
(gdb)

Here is the list of all widgets of `midnight_dlg'. The current widget is
the menubar and we want to select as the next widget the info panel, which
doesn't accept WIDGET_FOCUS messages. In this case `do_select_widget'
keeps walking the widget list starting at the info view up to the
menbar (last in the list). There it decides that its job is done due
to this check:

  while (h->current != w0) {

Unfortunately it misses the left panel which would accept the WIDGET_FOCUS
message, while the old routine would keep walking.
-------------- next part --------------
Index: src/dialog.c
===================================================================
RCS file: /cvsroot/mc/mc/src/dialog.c,v
retrieving revision 1.26
diff -u -p -r1.26 dialog.c
--- src/dialog.c	24 Sep 2004 22:22:35 -0000	1.26
+++ src/dialog.c	26 Oct 2004 10:01:36 -0000
@@ -427,10 +427,7 @@ do_select_widget (Dlg_head *h, Widget *w
 	return;
 
     h->current = w;
-    while (h->current != w0) {
-	if (dlg_focus (h))
-	    break;
-
+    while (!dlg_focus (h)) {
 	switch (dir) {
 	case SELECT_NEXT:
 	    h->current = h->current->next;


More information about the mc-devel mailing list