Hi all,
first of all I have to apologize. I did a very uneccessary change (that
also didn't make it to the sources complete). Attached you find a (quite
short) patch to lib/Xm/List.c, that removes it for the most part, while
still achieving the effect intentioned in the first place.
Rick, could you please check, if ml is doing ok with this version?
In short, I was so blindly staring at the undesired side effect of
flickering, while invisible items in a medium/large list were updated,
that I didn't realize, this could be checked in the _XmListRedraw() call.
But deliberatly, or because it never had been any other way, this check
was discarded by calling _XmListRedraw(w,True).
_XmListRedraw(w,False) yields exactly what I was looking for. And since
for the functions in question XmListReplaceItemsPos() and
XmListReplacePostions() the necessary invalidation of affected list
entries is done while calling _XmListDeselectPos().
Thanks Rick for pointing me at that LastTimeDrawn field, this was it!
And Alexander, my apologizes again for supplying so badly formed
patches. Hopefully this one applies better. It was done using the command
line:
diff -c List.c-orig List.c >List.c-diff
In net effect it replaces two
'True' words with two 'False' ones, looking from the original 0.91.4
version. My first patch version might be a little more effective, because
it avoids calling _XmListRedraw() all together, this way avoiding all the
checks done there. On the other hand, it is a cludge to do this kind of
trivial checks again and again all over the code. While testing it today,
I saw no negative impact on performance. And btw next to nobody cared
about the pre 0.91.8 redraws, that are much more expensive anyway.
So thanks again all for this great peace of software.
+-------------------------------------+-------------------------------+
| Peter Stein | |
| technische Datenverarbeitung (TB4) | Tel: (+49) (0) 5524-82 415 |
| DETA Akkumulatorenwerke GmbH | Fax: (+49) (0) 5524-82 439 |
| Odertal 35 | e-mail: [EMAIL PROTECTED] |
| 37431 Bad Lauterberg | [EMAIL PROTECTED] |
+-------------------------------------+-------------------------------+
Der Author erklaert sich fuer nicht richtungsweisend in allen Belangen
der deutschen Grammatik, Orthographie und Interpunktion !
Author denies any authority in respect to grammar, orthography and
punctuation of written material !
*** List.c-orig Mon Sep 4 12:16:44 2000
--- List.c Mon Sep 4 12:55:05 2000
***************
*** 5464,5472 ****
XmListReplaceItemsPos(Widget w, XmString *new_items, int item_count, int position)
{
int i, j = (position ? position : List_ItemCount(w)) - 1;
- /* Peter Stein 31 July 2000
- needed to get rid of flicker while updating display */
- Boolean need_refresh = False;
DEBUGOUT(XdbDebug(__FILE__, w, "XmListReplaceItemsPos(%d)\n", j));
--- 5464,5469 ----
***************
*** 5478,5488 ****
for (i = 0; i < item_count && j < List_ItemCount(w); ++i)
{
(void)_XmListDeselectPos(w, j + 1);
- if( ((j+1) >=List_TopPosition(w))
- && ( (j+1) <=List_TopPosition(w)+List_VisibleItemCount(w)-1)){
- /* Peter Stein: a visible item is changed */
- need_refresh = True;
- }
#ifdef OLD_31_OCT
XmStringFree(List_Items(w)[j]);
List_Items(w)[j] = XmStringCopy(new_items[i]);
--- 5475,5480 ----
***************
*** 5507,5517 ****
*/
_XmListSetGeometryIfNeeded(w);
! /* Peter Stein 31 Jul 2000
! Do redraw only if necessary */
! if( need_refresh ){
! _XmListRedraw(w, True);
! }
}
void
--- 5499,5505 ----
*/
_XmListSetGeometryIfNeeded(w);
! _XmListRedraw(w, False); /* Peter Stein 2000/09/04: redraw only changed items
*/
}
void
***************
*** 5580,5599 ****
XmListReplacePositions(Widget w, int *position_list, XmString *item_list, int
item_count)
{
int i, j;
- /* Peter Stein 31 July 2000
- optimize redisplay (like XmListReplaceItemsPos() above */
- Boolean need_refresh = False;
DEBUGOUT(XdbDebug(__FILE__, w, "XmListReplacePosition()\n"));
for (i = 0; i < item_count; ++i)
{
j = (position_list[i] ? position_list[i] : List_ItemCount(w)) - 1;
- /* Peter Stein 31 July 2000:
- optimize redisplay */
- if( (j >=List_TopPosition(w)) && ( j
<=List_TopPosition(w)+List_VisibleItemCount(w)-1)){
- need_refresh = True; /* a visible item is changed */
- }
(void)_XmListDeselectPos(w, j);
if (position_list[i] > List_ItemCount(w))
--- 5568,5579 ----
***************
*** 5614,5624 ****
}
_XmListSetGeometryIfNeeded(w);
! /* Peter Stein 31 July 2000:
! optimize redisplay */
! if( need_refresh ){
! _XmListRedraw(w, True);
! }
}
void
--- 5594,5600 ----
}
_XmListSetGeometryIfNeeded(w);
! _XmListRedraw(w, True); /* Peter Stein 2000/09/04: redraw only changed items
*/
}
void