tboxlibs wimp_update_window wanting wrong struct?
Chris Mahoney (1684) 2165 posts |
I’ve just been reading up about Wimp_UpdateWindow and found an oddity when trying to test it. wimp.h (Export.APCS-32.Lib.tboxlibs.h.wimp) defines a struct called WimpRedrawWindowBlock, with a comment that it’s for Wimp_RedrawWindow, and another struct called WimpUpdateWindowBlock, with a comment that it’s for Wimp_UpdateWindow. Both of them set up their blocks appropriately (PRM pages 3-126 and 3-128 respectively). No problems so far. On the other hand, wimplib.h (Export.APCS-32.Lib.tboxlibs.h.wimplib) has two lines of interest.
Shouldn’t wimp_update_window expect a WimpUpdateWindowBlock? Can someone please double-check that I’m not just going crazy? :) To be fair, using a WimpRedrawWindowBlock does work (it just ignores its additional variables), but should this be fixed? |
Colin (478) 2433 posts |
Yes it should be Edit: Typo |
Chris Mahoney (1684) 2165 posts |
Hah, you had me totally confused there at first! I decided to leave it and see whether it made any more sense when I came back… lo and behold :) |
Chris Mahoney (1684) 2165 posts |
Just to further complicate things, the latest Acorn C/C++ manual says that wimp_update_window expects a WimpRedrawWindowBlock. If tboxlibs is changed then the documentation will become wrong! |
Colin (478) 2433 posts |
WimpRedrawWindowBlock is correct. The window_handle and visible_area are used on entry to wimp_update_window and wimp_update window returns with the WimpRedrawWindow block filled in with WimpRedrawWindoblock information. After updating the window you call wimp_get_rectangle with the WimpRedrawWindow block like this:
|
Chris Mahoney (1684) 2165 posts |
Aha! Yes, that would indeed explain it :) So the only thing that’s actually wrong is the comment in wimp.h that says that WimpUpdateWindowBlock is for Wimp_UpdateWindow… and that may be valid in some cases too. Thanks for investigating :) |
Colin (478) 2433 posts |
I suppose if you were that way inclined you could use WimpUpdateWindowBlock to make what you are doing more readable/understandable like this:
then when you look at the code again some time later you can see you are filling in WimpUpdateWindowBlock details. |