Usermode/AxWin3 - Adding pop-up menu support (via a new window type)
[tpg/acess2.git] / Usermode / Applications / axwin3_src / libaxwin3.so_src / r_widget.c
index f63e0f7..17dd16e 100644 (file)
@@ -2,8 +2,8 @@
  * AxWin3 Interface Library
  * - By John Hodge (thePowersGang)
  *
- * main.c
- * - Entrypoint and setup
+ * r_widget.c
+ * - Widget window type interface
  */
 #include <axwin3/axwin.h>
 #include <axwin3/widget.h>
@@ -118,10 +118,12 @@ tAxWin3_Widget *AxWin3_Widget_AddWidget(tAxWin3_Widget *Parent, int Type, int Fl
        }
        if( newID == info->nElements )
        {
-               info->nElements ++;
+               const int size_step = 4;
+               info->nElements += 4;
                info->Elements = realloc(info->Elements, sizeof(*info->Elements)*info->nElements);
-               newID = info->nElements - 1;
-               _SysDebug("Expanded and allocated %i", newID);
+               newID = info->nElements - 4;
+               memset( &info->Elements[newID+1], 0, (size_step-1)*sizeof(info->Elements));
+               _SysDebug("Expanded to %i and allocated %i", info->nElements, newID);
        }
        else
                _SysDebug("Allocated %i", newID);

UCC git Repository :: git.ucc.asn.au