Code:
------------------------------------------------------------------------
r90 | dwk | 2008-04-05 02:00:42 -0600 (Sat, 05 Apr 2008) | 151 lines
=== Overview ===
+ Build system
- Changes
- File management
+ Valgrind
- Text cursors freed
- Memory errors
- Textbox memory errors
+ Windows support
- Better Windows support
- Problems with Windows support
+ Checkboxes
- Checkboxes are proper composite widgets
- Checkboxes selectable by text
+ Textboxes and labels
- Textbox click position bugfix
- Previous attempted fix
- Text cursor position rounding
+ Scrollbars
- Positions: ints to doubles
- Proper sized seek boxes
+ Refactorings
- paint_widget() etc static
- struct xuni_t first
- Function renaming
+ Reference counter
- Memory block types
- Fixed memory type errors
+ Miscellaneous
- percentdoc.pl
- Bugfixes
- Publishing
- Notes
=== Build system ===
*** Changes ***
- Added the DYNAMIC_HANDLERS conditional to configure.ac to allow easier
compilation with different loadso versions.
- Fixed filecount.sh so that it does not strip out real files. The make wc taret
has less output than it used to, which was not reflected here.
- Made runwin more space efficient -- it now creates symlinks instead of copies
of files.
*** File management ***
- Removed configure from SVN control.
- Removed all depend files from SVN control.
- Removed the entire dist/ directory, along with its files Makefile and Makewin.
The "make dist" target of autotools rendered it unnecessary.
- Moved calc.h, calc.y and the generated calc.c from src/ to src/resource/.
- Renamed src/resource/calc.h to calcfunc.h. calc.h is now automatically
generated by bison/yacc.
=== Valgrind ===
*** Text cursors freed ***
The SDL_Cursor for the textbox text cursor is now freed. It is implemented in a
kludgy way (though much better than it was -- there are at least no static
variables not). Still, xuni once more shows up no memory leaks in Valgrind. The
changes are mostly in graphics.h and loop.c.
*** Memory errors ***
Though there are no memory leaks under normal conditions, Valgrind reports
several memory errors. They all come from loop.c line 390 (at the call to
SDL_WaitEvent()), start_element() at libexpat.c:204, and the textbox code which
is explained in greater detail below. The cause of the former two cases is still
unknown.
*** Textbox memory errors ***
Elements of textboxes, including the text widget, are rescaled before the
textbox itself. However, the "text" label sub-widget of textboxes depends on the
size of its base widget (widget->base->pos->real.w) to tell how much to scroll
itself. This means that widget->base->pos->real.w is sometimes uninitialized.
The best way to fix this would be to have more specific events than just
"rescale" and "reposition". This should be done, anyway, for efficiency reasons.
=== Windows support ===
*** Better Windows support ***
Implemented a proper LOADSO_STATIC_VERSION, so that Windows executables are
possible. For this STATIC loadso type to work, each xuni application has to
implement its own xuni_loadso_load_function() that uses string_to_function() to
convert function names as string to function pointer addresses. All of the code
is then statically linked together so that the functions can be resolved.
Compiled and tested xuni under wine, and ran it on real XP system as well -- it
worked perfectly. Note that the static loadso version works just fine under
Linux as well.
*** Problems with Windows support ***
- Compiling a windows executable is still difficult. It requires editing
loadso.h and using custom Makewins.
- The xuni icon under Windows does not display on the window, but does on the
taskbar.
=== Checkboxes ===
*** Checkboxes are proper composite widgets ***
Checkboxes used to have click detection in "checkbox/box". In other words, the
button of checkboxes would receive the click rather than the checkbox widget
itself. (This is how it used to be set up for textboxes and so on, before the
advent of WIDGET_VISIBILITY_INDEPENDENT and WIDGET_VISIBILITY_NOT_COMPOSE.
*** Checkboxes selectable by text ***
Checkboxes can now be toggled by clicking on the text of the textbox. With the
help of some code in paint_box(), the box even displays the right hover and
active artwork. However, there are still some bugs relating to when the check
image is displayed.
=== Textboxes and labels ===
*** Textbox click position bugfix ***
In gui.c (new line 1014), "widget" was being used instead of "w". This made the
code that decides which where to put the text cursor when a textbox is clicked
on use the base textbox instead of the label widget, which was messing up the
alignment.
*** Previous attempted fix ***
This was attempted to be fixed by code in width_to_label_pos() to "round" the
position of the textbox cursor -- except it had to move it the wrong way to make
it look right. And with different theme roundnesses it all broke down.
*** Text cursor position rounding ***
The "rounding" of width_to_label_pos() works correctly now. The position that
the textbox editing cursor appears in is the closest position. For example, if
one clicks on the left half of a character, the cursor will go to the left of
that character, and likewise for the right.
=== Scrollbars ===
*** Positions: ints to doubles ***
Scrollbar positions, which used to be ints, are now doubles. This means that
they work much better when they are rescaled. Several functions, such as
get_scollbar_pos() and set_scrollbar_box(), were introduced or modified to
implement this change.
*** Proper sized seek boxes ***
Thanks mainly to calculate_seek_height(), the seek boxes of scrollbars are now
as expected. When all of the listbox or whatever data fits into one screen, the
scrollbar is as large as can be; and it gets progressively smaller as more data
is added.
=== Refactorings ===
*** paint_widget() etc static ***
Replaced nearly all calls to reposition_widget(), rescale_widget(),
paint_widget(), and free_widget() with calls to widget_event(). These functions
still exist and are still called in a convoluted series of functions in
widgets.c, but they are static now.
*** struct xuni_t first ***
Made a few more functions (such as call_deactivate_func()) take a struct xuni_t
as their first parameter. The most notable functions that still do not do this
are the application callback functions like paint_game(), which take a void
*vdata parameter first. (They take a xuni_t in varying positions.)
*** Function renaming ***
Renamed lookup_widget_nameid() to widget_nameid_follow(), which is intended to
be similar to widget_nameid_access(). (The "follow" function follows more than
one nameid, the "access" one only does one nameid.)
*** calc.y ***
- Renamed NUM to NUMBER.
- Tried to implement a [f]lex parser, which is why calc.h became automatically
generated.
=== Reference counter ===
*** Memory block types ***
Implemented memory block types a little further. Blocks allocated for the SDL
(i.e., for SDL_Surfaces) are now tags as such, though they are not freed
properly just yet for unknown reasons.
Added a yet-unused MEMORY_BLOCK_TYPE_LOADSO_OBJECT.
*** Fixed memory type errors ***
At old lines 579-581 (new lines 569-573), memory.data[pos].type was being used
after being freed. In effect, each block was freed according to the type of the
block following it. With only one block type, this did not matter very much, but
it was causing seg faults with the new block types. (SDL_FreeSurface() was being
called instead of free().)
=== Miscellaneous ===
*** percentdoc.pl ***
Created doc/percentdoc.pl, which figures out what percentages of xuni's
functions and other objects are documented. It parses the Doxygen output, and is
completely independent of xuni. Currently, it says:
*** Number and percentage of entities and functions that are documented ***
Source file name | All entities | Normal funcs | Static funcs
... details for each source file ...
*** Total *** | 73/515 14.17% | 45/249 18.07% | 4/168 2.38%
So 18% of xuni's non-static functions are documented. (This is up a few percent
from the last revision.)
*** Bugfixes ***
- Made the options->graphics menu no longer use options_theme_deactivate();
instead, it uses the proper options_graphics_deactivate(). This was preventing
the graphics screen mode textbox from working.
- The options menu was using options_theme_deactivate() as well. Now, it uses no
deactivate function at all.
- xuni::theme::current was not being initialized. On Linux, it was initialized
to zero by default and everything was fine. On some Windows/wine systems, it was
fine too; on others, it resulted in no theme being assigned. This was discovered
with Valgrind and helped debugged by memset()'ing malloc()'d memory.
- Made the arrays of function pointers in <widget>_widget_event() static.
Possible stack overflows were being encountered in some circumstances, and it
needed to be done anyway.
*** Publishing ***
- Registered xuni as a project on sourceforge.
- Changed xuni's version number from 1.0.0 to 0.3.0.
*** Notes ***
- Added Doxygen documentation comments to widgets.c, xuni.c and other source
files.
- Put [done] in several TODO list items, and added a few more items as well.
- xuni is now 11945 lines long!
------------------------------------------------------------------------
Now that I've set up an easy way to compile 32-bit Linux executables, I should be able to post binaries for this version pretty soon. Until then, check it out from sourceforge if you're interested. (I've asked sf to update my repository. It might be a little while.)