HomeAbout Us A-Z IndexSearch * Contact Us Register LoginPress Shop

The Open Brand -- Problem Reporting and Interpretations System


Problem Report 2175 Details

Help Show help | Quick Search | Submit a Test Suite Support Request | Click here to view your privileges

This page provides all information on Problem Report 2175.


Report 2175 Actions


    Problem Report Number 2175
    Submitter's Classification Specification problem
    State Resolved
    Resolution Temporary Interpretation (TIN)
    Problem Resolution ID TIN.X.0115
    Raised 1970-01-01 08:00
    Updated 2003-03-13 08:00
    Published 1998-05-26 08:00
    Product Standard Motif Toolkit
    Certification Program The Open Brand certification program
    Test Suite VSM version 4.0.0
    Test Identification vsm4/tset/funcs/XmScrolledWindowSetAreas 1,2,3
    Specification Motif Toolkit API
    Location in Spec See Problem Text
    Problem Summary TIN4M.00022 What VSM4 testcase for XmScrolledWindowSetAreas says here is: for scrollbars and work_region, if you pass them as NULL, for the interface, the scrollbar(s) and work_region should still be there. For M...
    Problem Text

    What VSM4 testcase for XmScrolledWindowSetAreas says here is:
    for scrollbars and work_region, if you pass them as NULL, for the interface,
    the scrollbar(s) and work_region should still be there.
    For Motif1.2, the behave for XmScrolledWindowSetAreas is not as
    what this testcase expects, so we have 3 failure cases here. But if you
    run VSM4 against Motif2.1, all above 3 cases can pass, the reason is because
    underline code implementation different.
    Since the spec doesn't clearly state this kind of behave as VSM4 states
    here for this function, probably it's better to keep Motif1.2 the old way
    for binary backward compatibility. Another reason is I found that this function
    XmScrolledWindowSetAreas seems to be the only one to make scrollbars disappear,
    I'll explain this later.


    Here is the test case, if you compile it against Motif1.2 and Motif2.1,
    you will see the interfaces are different, there is no scrollbar in Motif1.2 and
    Motif2.1 does:

    /************************************ cut here **********************/
    #include <stdio.h>
    #include <Xm/Xm.h>
    #include <Xm/List.h>
    #include <Xm/ScrolledW.h>
    #include <Xm/ScrolledWP.h>

    char *months[] = {
    "January", "February", "March", "April", "May", "June", "July",
    "August", "Septemberaaaaaaaaaaaaaaaaaaaaa", "October", "November", "December"
    };

    /* even if you use this short list, you will still see the scrollbar attached.




    char *months[] = {
    "January", "February", "March", "April"
    };
    */

    main(argc, argv)
    int argc;
    char *argv[];
    {
    Widget toplevel, list_w;
    XtAppContext app;
    int i, n = XtNumber(months);
    XmStringCharSet charset = XmSTRING_DEFAULT_CHARSET;
    XmStringTable str_list;
    Arg args[7];
    unsigned char scrlpolicy, sbarpolicy;

    toplevel = XtVaAppInitialize(&app, "Demos", NULL, 0,
    &argc, argv, NULL, NULL);

    str_list = (XmStringTable)XtMalloc(n * sizeof (XmString *));

    for (i = 0; i < n; i++)
    str_list[i] = XmStringCreateLtoR(months[i], charset);

    /* We can put a XmFrameWidgetClass widget here inbetween toplevel and list_w,
    like the VSM4 does(it create an application shell widget first, then creates
    a frame widget, then create a XmScrolledWindowWidgetClass widget as the frame
    widget child), but no visual difference. */
    /*
    XtSetArg(args[0], XmNlistSizePolicy, XmCONSTANT);
    list_w = XmCreateScrolledList(toplevel, "months", args, 1);
    XtVaSetValues(list_w,
    XmNitems, str_list,
    XmNitemCount, n,
    XmNvisibleItemCount, 5,
    XmNscrollBarDisplayPolicy, XmSTATIC,
    XmNscrollingPolicy, XmAUTOMATIC,
    NULL);

    original code, we can make it change it to the following , but no difference

    */

    i = 0;
    XtSetArg(args[i], XmNlistSizePolicy, XmCONSTANT); i++;
    XtSetArg(args[i], XmNitems, str_list); i++;
    XtSetArg(args[i], XmNitemCount, n); i++;
    XtSetArg(args[i], XmNvisibleItemCount, 5); i++;
    /* the following 2 lines of code make no difference */




    XtSetArg(args[i], XmNscrollBarDisplayPolicy, XmSTATIC); i++;
    XtSetArg(args[i], XmNscrollingPolicy, XmAUTOMATIC); i++;
    list_w = XmCreateScrolledList(toplevel, "months", args, i);

    i=0;
    XtSetArg(args[i], XmNscrollingPolicy, &scrlpolicy); i++;
    XtSetArg(args[i], XmNscrollBarDisplayPolicy, &sbarpolicy); i++;
    XtGetValues(XtParent(list_w) , args, i);

    if(scrlpolicy == XmAPPLICATION_DEFINED)
    puts("XmNscrollingPolicy is XmAPPLICATION_DEFINED");
    if(sbarpolicy == XmSTATIC)
    puts("XmNscrollBarDisplayPolicy is XmSTATIC");
    /* from above printf results we know that XmNscrollingPolicy is hard coded
    to be XmAPPLICATION_DEFINED, and XmNscrollBarDisplayPolicy is hard coded
    to be XmSTATIC. This is true for both Motif1.2 and Motif2.1, which turns
    out the scrollbars will always be created and attached when the "list_w"
    is created. */

    XmScrolledWindowSetAreas(XtParent(list_w), NULL, NULL, list_w);

    XtManageChild(list_w);

    for (i = 0; i < n; i++)
    XmStringFree(str_list[i]);
    XtFree(str_list);

    XtRealizeWidget(toplevel);
    XtAppMainLoop(app);
    }

    /****************************** end of testcase.c ***********************/

    If I change the souce code in XmScrolledWindowSetAreas(which I did) so
    that I can pass VSM4 for above 3 cases, I found out it's impossible to make
    the scrollbar(s) disappear once they are there, especially for this testcase.c.

    For XmScrolledWindow' XmNscrollBarDisplayPolicy, the spec says "A
    resource value of XmSTATIC causes the ScrolledWindow to display the ScrollBars
    whenever they are managed, regardless of the relationship between the clip
    window and the work area." Evenif the testcase.c doesn't set
    XmNscrollBarDisplayPolicy to be XmSTATIC, the souce code for XmCreateScrolledList
    in libXm.a/List.c actually hardcoded it to be XmSTATIC, same XmNscrollingPolicy
    is hard coded to be XmAPPLICATION_DEFINED. The conclusion here
    is no matter what, whenever a xmScrolledListWidgetClass widget is created, it
    has scrollbars. See the XmScrolledWindow' XmNscrollingPolicy for more information.

    From this aspect, it seems VSM4 is right, since xmScrolledWindowWidgetClass widget




    has hardcoded XmNscrollBarDisplayPolicy to be XmSTATIC so that there should
    always be scrollbars displayed, and passed in NULL values in XmScrolledWinddowSetAreas
    should not be able to make the scrollbar(s) disppear according to spec.

    1. Notice that XmCreateScrolledList is different in Motif1.2/List.c and
    Motif2.1/List.c, here I attach the source code:
    /****************************************
    Motif 1.2
    ****************************************/
    Widget
    #ifdef _NO_PROTO
    XmCreateScrolledList( parent, name, args, argCount )
    Widget parent ;
    char *name ;
    ArgList args ;
    Cardinal argCount ;
    #else
    XmCreateScrolledList(
    Widget parent,
    char *name,
    ArgList args,
    Cardinal argCount )
    #endif /* _NO_PROTO */
    {
    Widget sw, lw;
    int i;
    char *s;
    ArgList Args;

    s = ALLOCATE_LOCAL(((name) ? strlen(name) : 0) + 3); /* Name+NULL+"SW" */
    if (name) {
    strcpy(s, name);
    strcat(s, "SW");
    } else {
    strcpy(s, "SW");
    }

    Args = (ArgList) XtCalloc(argCount+4, sizeof(Arg));
    for (i = 0; i < argCount; i++)
    {
    Args[i].name = args[i].name;
    Args[i].value = args[i].value;
    }

    XtSetArg (Args[i], XmNscrollingPolicy, (XtArgVal )XmAPPLICATION_DEFINED); i+
    +;
    XtSetArg (Args[i], XmNvisualPolicy, (XtArgVal )XmVARIABLE); i++;
    XtSetArg (Args[i], XmNscrollBarDisplayPolicy, (XtArgVal )XmSTATIC); i++;
    XtSetArg (Args[i], XmNshadowThickness, (XtArgVal ) 0); i++;
    sw = XtCreateManagedWidget(s , xmScrolledWindowWidgetClass, parent,
    (ArgList)Args, i);
    DEALLOCATE_LOCAL(s);




    /* BEGIN OSF Fix CR 5460 */

    i=argCount;
    XtSetArg (Args[i], XmNscrollBarDisplayPolicy, (XtArgVal )XmSTATIC); i++;
    lw = XtCreateWidget( name, xmListWidgetClass, sw, args, argCount);
    XtFree((char *) Args);

    /* END OSF Fix CR 5460 */
    XtAddCallback (lw, XmNdestroyCallback, _XmDestroyParentCallback, NULL);
    return (lw);

    }

    /*************************************
    Motif2.1
    ****************************************/
    Widget
    XmCreateScrolledList(Widget parent,
    char *name,
    ArgList args,
    Cardinal argCount)
    {
    Widget sw, lw;
    char *s;
    ArgList Args;
    Arg my_args[4];
    Cardinal nargs;

    s = (char*) ALLOCATE_LOCAL(XmStrlen(name) + 3); /* Name+"SW"+NULL */
    if (name)
    {
    strcpy(s, name);
    strcat(s, "SW");
    }
    else
    {
    strcpy(s, "SW");
    }

    nargs = 0;
    XtSetArg(my_args[nargs], XmNscrollingPolicy, XmAPPLICATION_DEFINED), nargs++;
    XtSetArg(my_args[nargs], XmNvisualPolicy, XmVARIABLE), nargs++;
    XtSetArg(my_args[nargs], XmNscrollBarDisplayPolicy, XmSTATIC), nargs++;
    XtSetArg(my_args[nargs], XmNshadowThickness, 0), nargs++;
    assert(nargs <= XtNumber(my_args));
    Args = XtMergeArgLists(args, argCount, my_args, nargs);
    sw = XtCreateManagedWidget(s , xmScrolledWindowWidgetClass, parent,
    Args, argCount + nargs);
    DEALLOCATE_LOCAL(s);
    XtFree((char *) Args);




    lw = XtCreateWidget(name, xmListWidgetClass, sw, args, argCount);

    XtAddCallback (lw, XmNdestroyCallback, _XmDestroyParentCallback, NULL);
    return (lw);
    }

    /************************* end of XmCreateScrolledList ********************/

    2. Here is souce code for Motif2.1 XmScrolledWindowSetAreas

    /************************************************************************
    * *
    * XmScrolledWindowSetAreas - set a new widget set. *
    * a NULL means: don't change the parameter *
    * - deprecated in favor of SetValues, which it uses *
    ************************************************************************/
    void
    XmScrolledWindowSetAreas(
    Widget w,
    Widget hscroll,
    Widget vscroll,
    Widget wregion )
    {
    Arg args[5] ;
    Cardinal n;

    n = 0;
    if (hscroll) {
    XtSetArg (args[n], XmNhorizontalScrollBar, hscroll); n++;
    }
    if (vscroll) {
    XtSetArg (args[n], XmNverticalScrollBar, vscroll); n++;
    }
    if (wregion) {
    XtSetArg (args[n], XmNworkWindow, wregion); n++;
    }
    XtSetValues(w, args, n);
    }
    /************************* end function *****************/

    Here is the changes I made
    in XmScrolledWindowSetAreas function source in Motif1.2 libXm.a/ScrolledW.c, I append
    it here so that you can check also whether I did the right thing or not:

    void
    #ifdef _NO_PROTO
    XmScrolledWindowSetAreas( w, hscroll, vscroll, wregion )
    Widget w ;




    Widget hscroll ;
    Widget vscroll ;
    Widget wregion ;
    #else
    XmScrolledWindowSetAreas(
    Widget w,
    Widget hscroll,
    Widget vscroll,
    Widget wregion )
    #endif /* _NO_PROTO */
    {
    XmScrolledWindowWidget sw = (XmScrolledWindowWidget) w;
    if (sw->swindow.WorkWindow != wregion && wregion != NULL )
    ^^^^^^^^^^^^^^^^^
    {
    if (sw->swindow.WorkWindow != NULL)
    {
    XtRemoveCallback(sw->swindow.WorkWindow, XmNdestroyCallback,
    KidKilled, NULL);
    }
    /* if (wregion != NULL) -- took out, not necessary now */
    ^^^^^^^^^^^^^^^^^^^^
    XtAddCallback(wregion, XmNdestroyCallback, KidKilled, NULL);

    sw->swindow.WorkWindow = wregion;
    }
    if (sw->swindow.ScrollPolicy != XmAUTOMATIC)
    {
    if ((sw->swindow.hScrollBar) && (hscroll != NULL) &&
    (hscroll != (Widget )sw->swindow.hScrollBar))
    if (XtIsRealized(sw->swindow.hScrollBar))
    XtUnmapWidget(sw->swindow.hScrollBar);
    else
    XtSetMappedWhenManaged((Widget) sw->swindow.hScrollBar, FALSE);

    if ((sw->swindow.vScrollBar) && (vscroll != NULL) &&
    (vscroll != (Widget )sw->swindow.vScrollBar))
    if (XtIsRealized(sw->swindow.vScrollBar))
    XtUnmapWidget(sw->swindow.vScrollBar);
    else
    XtSetMappedWhenManaged((Widget) sw->swindow.vScrollBar, FALSE);

    if(hscroll != NULL) /* added, defect 220967 */
    sw->swindow.hScrollBar = (XmScrollBarWidget) hscroll;
    if(vscroll != NULL) /* added, defect 220967 */
    sw->swindow.vScrollBar = (XmScrollBarWidget) vscroll;
    _XmInitializeScrollBars( (Widget) sw);
    SetBoxSize(sw);
    }
    else
    _XmInitializeScrollBars( (Widget) sw);




    if (XtIsRealized(sw))
    (* (sw->core.widget_class->core_class.resize))
    ((Widget) sw) ;
    }

    /***********************************************************************/

    Test Output

    TEST CASE: XmScrolledWindowSetAreas

    TEST PURPOSE #1
    A call to void XmScrolledWindowSetAreas(Widget widget,
    Widget horizontal_scrollbar, Widget
    vertical_scrollbar, Widget work_region) when
    horizontal_scrollbar is non-NULL shall add the
    scrollbar specified to the ScrolledWindow widget
    specified by widget.
    TEST: Horizontal scroll bar is added.
    TEST: Horizontal scroll bar can be changed.
    TEST: NULL value for horizontal scrollbar does not alter scrollbar.
    ERROR: Incorrect horizontal scroll bar ID. Expected: 204c2c68 Observed: 204c2d78

    1 FAIL

    TEST PURPOSE #2
    A call to void XmScrolledWindowSetAreas(Widget widget,
    Widget horizontal_scrollbar, Widget
    vertical_scrollbar, Widget work_region) when
    vertical_scrollbar is non-NULL shall add the scrollbar
    specified to the ScrolledWindow widget specified by widget.
    TEST: Vertical scroll bar is added.
    TEST: Vertical scroll bar can be changed.
    TEST: NULL value for vertical scrollbar does not alter scrollbar.
    ERROR: Incorrect vertical scroll bar ID. Expected: 204c2de8 Observed: 204c2ef8




    2 FAIL

    TEST PURPOSE #3
    A call to void XmScrolledWindowSetAreas(Widget widget,
    Widget horizontal_scrollbar, Widget
    vertical_scrollbar, Widget work_region) when
    work_region is non-NULL shall add the work region
    specified to the ScrolledWindow widget specified by widget.
    TEST: Work region is added.
    TEST: Work region can be changed.
    TEST: NULL value for work region does not alter existing work region.
    ERROR: Incorrect work region ID. Expected: 204c2de8 Observed: 204c2ef8
    3 FAIL

    Review Information

    Review Type TSMA Review
    Start Date null
    Completed null
    Status Complete
    Review Recommendation No Resolution Given
    Review Response
    A non-alignment between the reference code and its specification is
    under investigation. Thus it is recommended that a Temporary
    Interpretation be granted for this test while it remains subject to review.
    If a change to the specification results from the conclusion of this
    investigation, then this Temporary Interpretation will be converted
    to a Permanent Waiver. Otherwise this Temporary Interpretation will
    be converted to a Temporary Waiver (Minor System Fault).


    Review Type SA Review
    Start Date null
    Completed null
    Status Complete
    Review Resolution Temporary Interpretation (TIN)
    Review Conclusion
    A Temporary Interpretation is granted.

    Applicability: VSM4.0.0 only.


    Problem Reporting System Options:

     

    Back   


Contact the Certification Authority