Subject: lib/17631: libcdk, refreshCDKScreen() fails to refresh.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <rtr@wasabisystems.com>
List: netbsd-bugs
Date: 07/19/2002 05:17:55
>Number:         17631
>Category:       lib
>Synopsis:       libcdk, refreshCDKScreen() doesn't refresh, perhaps intended?
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 18 02:14:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Robert Retzlaff
>Release:        NetBSD 1.6D
>Organization:
	Wasabi Systems
>Environment:
System: NetBSD elysium 1.6D NetBSD 1.6D (elysium) #0: Mon Jul 15 06:43:10 EST 2002 rtr@elysium:/usr/src/sys/arch/i386/compile/elysium i386
Architecture: i386
Machine: i386
>Description:

	After creating a cdk widget, drawing it to the screen with
	drawCDK*() then calling refreshCDKScreen() widget does not appear.

	This could be intended behavior, a doc bug or a software bug.  I
	interpret the documentation to mean the widget will appear on screen
	for the source code included below.


>How-To-Repeat:

{
	CDKSCREEN *screen;
	CDKENTRY  *entry;

	screen = initCDKScreen(initscr());
	entry  = newCDKEntry(screen, LEFT, TOP, NULL, "label:", A_REVERSE,
		'.', vINT, 4, 1, 3, FALSE, FALSE);

	drawCDKEntry(entry, FALSE);
	refreshCDKScreen(screen);

	/* uncommenting this refresh will cause the widget to appear */
	/* but as per the docs this shouldn't be necessary? (maybe)  */
	/*
	refresh(); 
	*/
	sleep(5); /* so we can see the output before exit */

	destroyCDKEntry(entry);
	endCDK();

}

>Fix:
	It would behave as I expect if wnoutrefresh(cdkscreen->window); were
	called after the children of the CDKSCREEN's drawObj function were
	called instead of before.

	If whomever deals with this agrees with the solution here's a patch.

*** cdkscreen.c Mon Jul 15 06:14:15 2002
--- ../cdkscreen.c      Fri Jul 19 05:09:27 2002
***************
*** 199,219 ****
  void refreshCDKScreen (CDKSCREEN *cdkscreen)
  {
     int objectCount = cdkscreen->objectCount;
     int x;

-    /* Refresh the screen. */
-    wnoutrefresh (cdkscreen->window);

     /* We just call the drawObject function. */
     for (x=0; x < objectCount; x++)
     {
        CDKOBJS *obj = cdkscreen->object[x];

        if (validObjType (cdkscreen->cdktype[x]))
         obj->fn->drawObj(obj, obj->box);
     }
  }

  /*
   * This clears all the objects in the screen.
   */
--- 199,220 ----
  void refreshCDKScreen (CDKSCREEN *cdkscreen)
  {
     int objectCount = cdkscreen->objectCount;
     int x;


     /* We just call the drawObject function. */
     for (x=0; x < objectCount; x++)
     {
        CDKOBJS *obj = cdkscreen->object[x];

        if (validObjType (cdkscreen->cdktype[x]))
         obj->fn->drawObj(obj, obj->box);
     }
+
+    /* Refresh the screen. */
+    wnoutrefresh (cdkscreen->window);
  }

  /*
   * This clears all the objects in the screen.
   */

>Release-Note:
>Audit-Trail:
>Unformatted: