Todo List for SXLib

Legend: Urgent Internal Changes - important Not vital.
  1. Current Problems
  2. GC Related Material
  3. Database Management
  4. Installation
  5. Bugs and Checks
  6. Memory Management
  7. Efficiency Changes to Code
  8. Widget Hierarchies
  9. Validity
  10. Example Widgets and Scripts
  11. Help
  12. Images
  13. Resource Material
  14. Converters
  15. Threaded Material
  16. Features
  17. Features to be implemented much Later

Completed Fixes and Features


Current Problems

  1. setCursor seems to be broken.
  2. Way to make actions available to all new applications created. E.g. Knvas stuff from koala.
  3. Bug that makes the addValid.XDisplay stupid. It has to assign the same thing twice to ensure it gets there.
  4. Fix addValid.XDisplay to get the names correct in duplications. Problem with list and names(tbl@displays)[n] = value not getting set.
  5. When creating a widget object but not an X widget (realize=F) should we do a lookup anyway to make sure the class/type is available. Should be an (another) option to Widget()?
  6. Problem that manifests itself with Application Hash Table problems. See the Koala note below.
  7. Create Action handler classes for Callback,EventHandler and Action.

    Callbacks

  8. Function to remove a callback, etc.
    Look at function removeCallback() in Callbacks.S. This is where the beginnings of that function are started, for callbacks.
  9. Fix the Xit() function.
  10. Done! ??????
    Allow the callbacks to contain the frame in which the evaluation should take place. This should handle the Xit() function correctly.
    This will also be redone correctly by specifying the thread in which to evaluate the callback.
  11. Change the XTime class to be numeric and make sure the C code gets updated to place the object in the right field of the union! XTime_to_SObject in ExtractRaw.web
    Check the Motif code also. And all other widgets using a grep for -i time.

    GC Related Material

  12. GCGetValues requires coerce to pass the 'to' argument.
  13. Get the foreground and background correct for the draw-start.s GCs from the widget. Figure out the color stuff. This needs the coerce method to behave correctly with the to argument as we use GCGetValues.
  14. GCSetDashes for GC to allow more complicated dashes and use the XGCDashList class to full extent. Defined the class.
    Now use it in GC.web.
  15. Look at merging as_pixel and as_S_color.
    as_S_color uses as_pixel as expected.
  16. CHECK - made the changes. Should be no problem as the value slot is still there representing a pixel.
    Need XColor to Pixel.
    GC should have Pixel rather than XColor as the class for Foreground and Background!
  17. Fix the Copy GC routine. Also check do we have pointer or GC contexts.
  18. Fix the setting and retrieval of the plane mask to ensure that the -1 gets interpreted correctly on both sides. Seems to work, but AllPlanes = ~0L so very very large!
  19. GC stuff not getting evaluated correctly the old way with match.call. Fix this out of interest in evaluation.
  20. get the GC color conversion to use the same display.
    ChangeGC needs to be able to coerce a GC to an XDisplay object so as_pixel can compute values easily without opening new display.
  21. Changing color in a GC gone screwy. SIGSEV'ing
  22. Check GC examples. Seems to bomb somewhere.
  23. GC.S:
    Handle all converters and named objects for GC fields classes (e.g. LineStyle, JoinStyle, etc.) See XGC.S Works if coerce changes to pass the 'to' argument.
  24. Need a way to get the contents of gc.
    Needs to convert values to the correct types of classes. Will be easy when we do the converters from integers to these classes (above).
  25. All drawing functions should take an XWindow or a Widget and coerce the object to an XWindow. C routines must be changed for this.
  26. Also handle Pixmaps! That's a must.

    Resource Material

  27. Document how to add a converter. Also for threaded version.
  28. If resource converter fails, getting an S object of class missing ! Where is this coming from.
  29. (Make sure to remove options(check=T) in getResource in Resources.S)
    getResource should put names on the returned list. (at least for the database - getContents()) Slow in the S code, so doing it (partially) in the C code. And in getResourceList.
    Also puts qualifier into the object for widget resources.
  30. Check and Fix the getResource function to not bomb. Seems ok except for character strings. See XmString note.
  31. XmString -> String converter doesn't seem to want to do it.
    btn1.s
  32. Handle the case where user asks for a resource using a list() return type but converters only apply for primitive type. Convert primtive to S object for return.
  33. Allow no value to be specified for the resource type and leave it to the internals to decide which to use.
  34. Fix the print function for XResource. with resource of name *toolbar, we get .*toolbar:. Problem is in creating a resource without checking the name for a qualifier.
  35. Setting pairs (or more) resources simultaneously!
    Need to get creation time resources. See below.
  36. print(getResource(l, items=list(),"itemCount")) Doesn't work if itemCount=1
    Does now.
              > tmp = getResourceList("XmList")[[1]][["itemCount"]]
              > tmp@class
              [1] "Int"
              > lookupConverter(tmp@class)
             [1] "Long"
          
  37. res = getResource(draw,XResource("width",1),XResource("height",1)) gives an error I think. and gives a SIGSEV later on (next event!) Wrong type as there is no converter from HorizontalDimension to integer. NULL instead of 1 works.
    Seems ok now.
            lookupConverter("HorizontalDimension")
            [1] "Long"
          
  38. What has happened to the Tree widget and setting the treeParent resource? Doesn't have any effect anymore. See S-Tests/Tree.S and S_src/XTree.S.
    Resources weren't getting set as argument to Widget()! Have to call setResource explicitly.
  39. Can't get X tree widget to work inside the function XTree and DisplayTree.
    Never set the treeParent to new("Widget") or effectively NULL. Instead, don't set it.

    Fonts

  40. Need a way to unload a font. and all X server resources. These must invalidate the relevant object in the validity tables. I think we have this for font, at least.
  41. check get_X_fonts for the extract_display(). Is the S object consistent with this.

    Database Management

  42. Load and unload won't reload the chapter!
  43. X Error handlers kicking us out of the process in certain cases. Make sure others are getting set. Can we fix this or do we have to override the X code.
  44. Killing a window does this. Could turn off the facilities for that on a window by window basis.
  45. Shells/secondary windows (and different displays).
    Done but get Validity working.
  46. When detach a widget set, unload the symbol table and remove the widget table entry. Call unload but we can use the .on.detach in the database!
  47. Check the prototypes for all classes ensuring the correct order.
  48. Documentation and all code.
    Add the newly created classes and functions.
    Use documentation functions in Html-S chapter.
  49. Should we separate the Widget class into Description and RealizeWidget. Same for all the important descriptive classes (XApplication, GC, etc.)
  50. Why do we hash the XApplication's on the C side Do we need this for callbacks and Exiting. If the latter, can't the thread do this in the threaded version.
    get_events needs to know the application object when called and has to look this up based on the connection. At one point, John and I discussed setReader passing back the object used to create it rather than just the connection. So passing an XApplication would mean we could get this back.
    The threaded version should make this easier as we can create a loop in a thread that never exits and so only needs to be passed the application pointer when called by XRealize.
  51. Null objects for windows, widget, pixmaps, etc. Just use new(class-name) (e.g. new("Widget"))
    Arrange to have these recognized by the different functions and casting functions that accept NULL and return these objects.
  52. Problem with sapply.
                sapply(.StandardWidgetSets,load.WidgetSet)
                 Problem: Internal error: data for decrementing ref. count didn't point to a
          	     valid arena (0x85c2080)
          
    but
                sapply(.StandardWidgetSets,function(x)list(a=1,b=2))
          
    is ok.
  53. as_Display routine needs to be checked if passed an XDisplay or XAppDisplay object as the slots have changed (dpy.info -> value)
  54. Make sure the database code works now that we have changed the represenation of the base class to not have any dpy.info slot.
  55. Fix the PID for all references to widgets.
  56. (Seems to be working)
    Check the 'load' code to make sure nothing screwy going on there.
    1. returning s_name_table * rather than s_object * from create_?_class_table.
    2. (Working again!)
      When unloading, we free the table associated with that widget set, nasty things used to happen in comparison with not freeing it.
  57. instance doesn't work after one as the second item doesn't have that name. So get's different name! Need to have a counter or do we really care.
  58. Widget frame slot should be a list I think to contain the parent's frame slot if different from its own and so on up. Perhaps not as we should pass this information down when needed! Wait until threads are used. The application should know about all its threads and associated frames
  59. Tidy up and consolidate all classes and then retest everything!
  60. Move the AppId slot to the ValidApp.... class and out of the individual objects and make them all inherit the slots.
  61. Tidy up classes and the SharedPointer,etc. crap with duplicated slots! Also make the AppId consistent and put it into one of these slots. Make sure the prototypes work
  62. Make widget take a WidgetSet object rather than a character string. The C level routines might need to change. This will allow the idea of a remote Widget set.
    Either NULL or coerced to a widget set. Then extract just the name and pass that to the C routine. The S object contains the full WidgetSet object.
  63. Class names for widgets should match C ClassName() routine for simplicity. Fixed it with a hack for Motif. Allocated more memory that never gets free'd so fix this.
    Have to go through each widget individually. New ones added are done this way.
  64. Big bug in creating applications. Put into a loop to see this. Use options(check=T) also. Really wierd.
    Problem assigning into frame 0. Fixed by JMC - April 1st.
  65. Fix S classes relating to S objects. Make sure they all point to the correct things and are consistent e.g. Are XColor and XPixel the same class!

    Installation

  66. Make the SXLib work from a different directory ? Is it a problem with Xt? or Motif?
    It is a problem with Motif. If we link the S.so in library/main and insert a dummy reference to an object type in the Motif library, then things work fine. Perhaps there is a common object/symbol that is gettng higher precedence and being used in the call the Drop Site Manager widget creation.
    In _XmGetDropSiteManagerObject in Display.c of Motif library. Attempts to create a widget
  67. Clean up S databases and get installation working correctly.
  68. Fix the recursive make problem.
  69. Fix the installation to create the S named list of Standard Widget sets based on the ones selected by the installation.

    Bugs and Checks

  70. ? Dialogs? Fix the callback data to accurately mirror the Motif callback structures. Test the dialogs.
    Have to find out what is wrong with it - i.e. what did I mean here?
  71. Popup menus - check these but remember that the grab is on so try to figure out a good debugging techinique. Maybe go to school.
  72. Fix the RadioGroup functions to handle objects rather than lists properly. See htmlhelp.S for current required use.
  73. Fix the initial expose event problem to realize the entire widget hierarchy.
    This is the waiting for events so that we always see the complete widget hierarchy. Kludge - call Update() after XRealize(). Weird problem. Getting the focus seems to do it, but seems to happen to odd composite widgets.
    Call XSync as often as is needed.
    This should go away with Pthreads, I think as the event loop will be in its own thread.
  74. Fix the WidgetSets to pass a valid pointer to XWindow_to_SObject that's non NULL. i.e. extract widget user data from somewhere.
  75. Fix cursors so that we can define them on a window. Works (Cursor.S), but check the validity.
  76. Can all other information (e.g. that in XFontStruct) be retrieved using the Font ID? What about XCharStruct
  77. (Internal C code) Change the widget class pointers in the widget tables to be non-pointer but actual widget classes. Check that this is appropriate.
    See Resources.web in widget_resource changes things around when a widget is passed rather than a string.

    Action Handlers

  78. Assigning in callbacks to the widgets frame.
  79. Evaluate functions correctly in callbacks with the frame as the top entry in the search path.
    Leave this for threads. Should be handled there more appropriately.
  80. Fix the evaluation of actions and event handlers and include ability to handle evaluation in other frames. Fix action and event handler evaluation routines. Get the quoting correct for strings in actions. Maybe reorganize the evaluation frame.
  81. Databases of resources and accessing entries. Use a Find command to locate the files. But need to avoid using the application. FindFile can do this. Three methods - one uses XtFindFile and no application and the other two use an XAppDisplay. The latter two just handle the usual X mechanism of finding files (by default using XUSERFILESEARCHPATH)
  82. Routine to extract entries of a database. See Database.web and XrmEnumerateDatabase(). getContents() in S_src/DatabaseResources.S

    Memory Management

  83. Made the argv values peramently allocated space. Make sure this is correct! At least free the ones that X didn't use. I don't know what happens to the ones that X has swallowed.
    Seems to work now.
  84. release methods and free resources and user data in widget.
  85. When removing an object with a raw slot entry make sure we call some sort of freeing mechanism if appropriate.
  86. Should release the memory associated with callback objects when we replace them with subsequent callback instances.
    Does this happen automatically?
  87. Make sure we release the memory used in setting and retrieving resources. Make sure threaded version also works!
  88. When widgets are destroyed, make sure user data pointer is freed. If we allocate the space in the frame for the widget, this should work. S_alloc() and set_alloc(). See add_callbacks in XCallbacks.web. Check this works. Seems to cause some problems.
    See Widget.web set_widget_user_data().

    Efficiency Changes to Code

  89. Fix all lookups so as to make them once off initialization and think about making tables or global variables shared by routines for each type of object. Don't do this in the case that the class of the s_object passed to the routine changes across calls.
  90. Implement Parent correctly like Children

    Widget Hierarchies.

  91. Realize methods using apply.tree or some such method.
  92. XAppHierarchy, PullDownMenuHierarchy, etc.
  93. Callback Hierarchy
  94. Integrate Hierarchies! - make class that contains a description of the hierarchy and use apply.tree to realize the widgets.
    See items below.
  95. Hierarchies - assigning and manipulating, realizing, mixing with callback and resource hierarchies, creating databases from them, create hierarchy from an already instantiated application or widget.
  96. Fix assignments and extraction of NODES in STree
    Was a Problem with validObject(). Call isValid() instead.
  97. Problem with names in [[<- and [[. Had to handle conditional on the number of nodes >1 or == 1. Ugly but effective!

    Validity

  98. is_widget_valid in Validity.web since we are removing the cookie slot in widget. Make sure all references to the cookie disappear.
  99. isOpen method for XDisplays - isValid. But get it right and all the coerce methods that use it.
  100. remove the frames or the need to update the app slot in the AppValidityTable. Only need one.
  101. XShell command
  102. Cursors
  103. All functions must check validity.
  104. GC that is created temporarily shouln't add the object to the validity table.
  105. Get window ids for a hierarchy so as to avoid overhead of inefficient validity checking routine. Can be done in XRealize when passed a tree. Traverse the tree and hand back the complete version with the widget ids filled in.
  106. When IO error occurs, remove the application and make sure everything is invalid about it.
  107. Validity Methods - working for single display pixmaps and bitmaps. Need for widgets and displays etc. Done for displays, applications. Fix creation of widgets - for toplevel/application widgets.
  108. Make the validity methods, etc. consistent. Do we use S objects or internal tables, etc.

    Images

  109. Make images loadable with just a display (xpm and xbm).
  110. Caching of pixmaps on the C or S side. Should be done on the S side as all the information is there and the events are there also as we have to keep the validity information.
  111. Image classes. Probably leave for the moment with basic Pixmap - bitmap and Xpm format. Want to think about reading JPEGs and GIFs. GIFs done. See libGif.so in /caviar/Scratch/Widgets/Utils/GifLib
    Get the S Image classes working.
    No real need yet.
  112. Gifs require a widget to handle the color correctly. Perhaps we can do this in a more consistent fashion when we look at JPEGS. Should use shared memory and plugins like Gimp.
  113. JPEG images

    Example Widgets and Scripts

  114. XEmacs widget! /Artecon3/Scratch/XEmacs
  115. Setup 2D and 1D plotting widgets from Plot widget set.
  116. Handle the xhdg widget.
  117. Example with the tree widget. See XTree and DisplayTree().
  118. Xbae Spreadsheet application.
    • Data Entry
    • Primitive recalculation of output
  119. Koala plots don't allow two instantiations without getting the hash table problem.
  120. Put the validity mechanism in for the Koala Objects on a per widget basis and share the layers!

    Help

    • Help wants to have an index - based on objects in current search path. Give list of all these. No cross referencing or different topics.
    • Move location of new help window to be offset.
                   use r = getResource(other top-level widget,  x=1,y=1)
      	     and then use these values
      	     
                     r[[1]]@value = r[[1]]@value + 10
      	       r[[2]]@value = r[[2]]@value + 10
      	     
      in setResource(new-widget,r)
    • Put toolbar into Help
    • Layout goes screwy when called as an Application rather than as a shell from within an application.
      Don't use MainWindow widget with command area.
      Still need to get layout right, but it works.
    • Menus get screwed up in this case.
    • Check callbacks for radio buttons in history menu when select using that.

    Devices

    • Merge resources for devices from the .Xdefaults database and application specific resource file.
      Should be able to do this at the S level given the database functions. In fact, these should automatically get picked up!
    • Devices created in drawing widget don't seem to resize properly! Check locator.
    • First resize might be a problem? Very wierd.
    • Fix the device event handler for a widget so as to use the XtEventHandler. I think we are losing events somehow.
      Is this the problem with the device not working at all. If so, that was fixed by fixing the flags to not use push backs which John started using at one point on the generic class of connections unaware that there were X connections that behaved differently.

    Converters

  121. Finish converters. Ongoing. Always could do with more. Long to HorizontalDimension (DONE), Pixel to SObject (DONE), etc.
  122. Put names on enumerated types etc in converters etc.

    Threaded Material

  123. Converters won't work in the threaded case! Need some sort of locks for the static data. (See XmString -> String in which we don't pass enough space of our own to the converter!)
  124. Output to text widgets via filter Leave to thread specific output.
  125. Fix the XpmHtml Resolve.c to avoid the global variable (will cause problem in threads!) Also, get the JPEG support in here from NCSA's code.
  126. See callback specification above.

    Features

  127. Make the validity mechanism be handled in a separate thread as a client-server style manager.
  128. Setting resources at creation time can be done by adding an entry for each resource with a fully qualified path to the Display database and then creating the widget and then restoring the original value of the database's resource.
    Inelegant but it works. We need a way to find a resource and save it and overwrite and restore it and efficiently.
  129. Synthetic events from within S.
    XSendEvent() function.
  130. Automatic way of indicating a busy status and estimate of percentage completed. Handle this in the callbacks, action handlers, etc. Generate the cursors for each application if necessary and cache them in an application structure and retrieve them. Want to be a little more discerning later as to how far up the widget hierarchy we set the busy cursor for. This depends on what other actions are permissible in parallel. This relates to automatic threading.

    This can be handled neatly with threads. The callback (or any function in general) starts by calling a function something like this

       completionStatus("obj-name",lock=threadLock-object,
                              total=total-length,widget=application,method=basic-update)
        
    This functon spawns a new thread by constructing the following sort of expression which is to be evaluated by that the thread
          dpy = createStatusDisplay(0,total,widget)  # create the status bar 
          setCursor("watch", widget)           # set the cursor to signify busy
    
          finished = F
          while(!finished) {    # do an endless loop an 
             obj = get(obj-name,where=threadLock-object)
             n = length(obj)
             updateStatusDisplay(n,total)
             if(total==n)
              finished = T
    
             wait(threadLock-object, obj-name)
             yieldLock(threadLock-object)
           }
          removeStatusDisplay(dpy)
        
    The mechanism this second thread uses is to watch for assignments to the relevant object and then compare the current length of that object with the target length. This generalizes to multiple threads performing the computations and all assigning to the the same object. The updateStatusDisplay()

    If the length of the target object is constant because it is pre-allocated, a more elaborate test such as counting the number of non-null slots can be used.