I've hit a problem with the redraw of trees containing a textarea in the
RISC OS front-end, while working on /branches/paulblokus/treeview (ie. the
core treeview stuff). I think the issue lies in the core, but since I'm not
that familiar with it, it would be useful if someone else could verify what
follows before any changes get made. I'm certainly not discounting the
possibility that I've got the RISC OS redraw code wrong. :-)
Both of the commits I've made (10068 and 10056) have a bug whereby textareas
in trees (created when an edit is started with a Ctrl-Click) don't show up
on screen unless the entire window is redrawn (when the graphics clip area
is clearly "big" compared to the text area itself).
The problem only shows up if the tree is drawn at a location in the window
other than (0,0), and the cause seems to be that the tree origin isn't
correctly being taken into account when positioning the textarea. If the
origin isn't (0,0), then the rubout box drawn in tree_draw() appears in the
correct place, but the textarea itself seems to be placed as if the origin
was (0,0) -- that is, the origin passed to tree_draw() isn't taken into
account.
The fact that the initial rubout box always ends up in the correct place
makes me suspect that I'm passing the correct coordinates through to
tree_draw().
Looking at the code in tree_draw() (inside desktop/tree.c), my suspicion is
that the problem lies in the call to textarea_redraw() at the end of
the function:
textarea_redraw(tree->textarea, x, y, clip_x, clip_y,
clip_x + clip_width, clip_y + clip_height);
Unlike the rest of the calls in the function, it uses the clip_ coordinates
instead of the absolute_ ones which take into account the tree's origin when
placing the clip window. Although this seems wrong, I can't quite explain
why it results in the exact symptoms I'm seeing; from my reading of the
code, it would only seem to affect the textarea's clip rectangle, and not
the actual position of the area itself. However, if I change it to
textarea_redraw(tree->textarea, x, y, absolute_x, absolute_y,
absolute_x + clip_width, absolute_y + clip_height);
then the RISC OS redraw code works correctly, and the gtk version (which I
think draws the tree at (0,0)) isn't broken as far as I can tell.
Could anyone with a better understanding of the treeview and textarea code
comment?
--
Steve Fryatt - Leeds, England
http://www.stevefryatt.org.uk/