Query page
Enter new bug
| Description: |
Opened: 2011-01-17 09:28 |
Hello,
Recently our organisation migrated to OpenMotif 2.3 and I discovered that some
part of old Motif code became very very slow. In particular I am using XmList
widget to show log output of an application (the XmList is used to highlight
errors and warning in different colors since XmText does not allow to do this).
After a new line of log is inserted, I am scrolling the list to show last line
using XmListSetPos(). Since Motif 2.3.1 it is very very slow, especially when
application is running on remote computer. Please fix the problem.
The simple application is below. Run, put odd and even numbers (like 1000 and
1001) and see performance issue with auto-scrolling for odd ones.
---
#include <Xm/List.h>
#include <Xm/RowColumn.h>
#include <Xm/TextF.h>
main (int argc, char *argv[])
{
Widget toplevel, rowcol, list_w, text_w;
XtAppContext app;
Arg args[5];
int n = 0;
void add_item(Widget, XtPointer, XtPointer);
XtSetLanguageProc (NULL, NULL, NULL);
toplevel = XtVaOpenApplication (&app, "Demos", NULL, 0, &argc, argv, NULL,
sessionShellWidgetClass, NULL);
rowcol = XmCreateRowColumn (toplevel, "rowcol", NULL, 0);
XtSetArg (args[n], XmNvisibleItemCount, 5); n++;
list_w = XmCreateScrolledList (rowcol, "scrolled_list", args, n);
XtManageChild (list_w);
n = 0;
XtSetArg (args[n], XmNcolumns, 25); n++;
text_w = XmCreateTextField (rowcol, "text", args, n);
XtAddCallback (text_w, XmNactivateCallback, add_item,
(XtPointer) list_w);
XtManageChild (text_w);
XtManageChild (rowcol);
XtRealizeWidget (toplevel);
XtAppMainLoop (app);
}
void add_item (Widget text_w, XtPointer client_data, XtPointer call_data)
{
Widget list_w = (Widget) client_data;
char *text, *newtext = XmTextFieldGetString (text_w);
XmString str, *strlist;
int u_bound, l_bound = 0;
int i, count = 0;
int auto_scroll = 0;
if (!newtext || !*newtext) {
XtFree (newtext);
return;
}
sscanf(newtext, "%i", &count);
if(count < 0) {
printf("bad input, put positive integer\n");
return;
}
if(count%2 == 0) {
printf("insert %i items and autoscroll list widget to show last line\n");
auto_scroll = 1;
}
else {
printf("insert %i items without autoscroll list widget\n");
}
XmListDeleteAllItems(list_w);
for(i = 1; i <= count; ++i) {
char buf[32];
sprintf(buf, "%i", i);
str = XmStringCreateLocalized (buf);
XmListAddItemUnselected (list_w, str, i);
XmStringFree (str);
if(auto_scroll) {
int visibleItemCount;
XtVaGetValues(list_w, XmNvisibleItemCount, &visibleItemCount, NULL);
XmListSetPos(list_w, i - visibleItemCount + 1);
}
}
XmTextFieldSetString (text_w, "");
}
------- Additional Comments From Igor.Soloviev@cern.ch 2011-01-17 09:52 -------
Created an attachment (id=297)
The test program
------- Additional Comments From Igor Gala 2011-03-04 12:18 -------
Created an attachment (id=302)
Proposed patch
------- Additional Comments From Igor Gala 2011-07-06 08:40 -------
Fixed as proposed in CVS HEAD and openmotif_2_3 branches.
Query page
Enter new bug