nanogui: Thread: Microwindows 0.87pre3 released


[<<] [<] Page 1 of 1 [>] [>>]
Subject: Microwindows 0.87pre3 released
From: "Greg Haerr" ####@####.####
Date: 20 Dec 1999 01:55:07 -0000
Message-Id: <005b01bf4a7b$b1c3df60$15320cd0@gregh>

A hopefully last prerelease to Microwindows 0.87 is available at:

ftp://microwindows.censoft.com/pub/microwindows/microwindows-0.87pre3.tar.gz

This prelease covers most all issues discussed on this list
in the last couple weeks.  Following are some major items:

    o Directory reorganization started.  The microwindows and
nanox specific source code, as well as the common engine
routines are now in their own directories.  Include files
are placed in a common directory, etc.  Although the source
file rearrangement is nearly complete, I still haven't added
Martin's new Makefile system (that will be coming, next cut).
Thus, there still aren't separate bin and lib directories, but
the source organization should make learning easier.

    o GrArea() modified to allow different types of pixel
data to be displayed.  Most of this is discussed in previous
email lists.  It all works and should be enough for Morten
to use as a base for his work.  This involved quite a bit
of work, but is worth it since Nano-X now supports
drawing in device dependent and device-independent
manners.

    o Quite a few bug fixes, including the Nano-X 64k
request packet fix, the GrMoveWindow fix for Nano-X
allowing windows to be moved and clipped properly,
fixing portrait mode in Microwindows offscreen
blitting, and the assert() fix that caused Microwindows
to exit sometimes.

For the next cut I plan on adding Martin's make system,
which allows for much better configurability, as well
as all demos and libraries to be made at once.  In addition,
I'm probably going to take a swipe at creating a window
manager base for Nano-X, so that it's windows
can look as cool as Microwindows API, if desired. (No,
this won't add much code)

Let me know if there are any issues found, I want
to make sure that 0.87 is a bug-free as 0.86 is.

Following is the detailed ChangeLog:

Version 0.87pre3 - 19th December 1999 - ####@####.####
 * started directory reorganization
 * changed LINUX meaning in Makefile, added UNIX for SOLARIS
 * fix negative blit index bug found under X11 by Piotr
 * set rootwp->parent = NULL for nano-X, fixes GrMoveWindow clip bug
 * added COLORVAL<->PIXELVAL conversion macros
 * modified GrArea to take packed pixel values of 8, 16 and 24 bits
 * modified GrArea to take RGB COLORVALs as well as PIXELVALs
 * renamed PF_TRUECOLOR24 to PF_TRUECOLOR888
 * added tunable MAXREQUESTSZ to limit max request length
 * modified Nano-X demo.c to GrArea() > 64k pixelvals for testing
 * fix client/server 64k length bug (request can be 24 bits in length)
 * fixed portrait mode in CreateCompatibleBitmap

Regards,

Greg


Subject: Re: Microwindows 0.87pre3 released
From: Daniel R Risacher ####@####.####
Date: 20 Dec 1999 05:29:37 -0000
Message-Id: <m266xunq3f.fsf@risacher.ebicom.net>

Sigh.  

I was working on NanoX tonight as well, but unfortunately against
87pre2, so the diff will probably not apply against 87pre3 (which I
haven't looked at yet.)  

Anyhow, as further prep work for nanox windowmanager support, I
implemented GrReparentWindow().  This includes changes to the move.c
demo to demonstrate and test the capability.

I also fixed a moderately serious bug in GrGetWindowInfo() that would
cause a server crash when called on any window without children and
siblings.

Finally, I just noticed that 
	#define GR_EVENT_TYPE_ERROR             ((GR_EVENT_TYPE) -1)
but 
	#define GR_EVENTMASK(n)                 (((GR_EVENT_MASK) 1) << (n))
and
	#define GR_EVENT_MASK_ERROR             GR_EVENTMASK(GR_EVENT_TYPE_ERROR)

Which I think means that GR_EVENT_MASK_ERROR is always zero.  Is this
what was intended?

Sleepily, 
	Daniel

Here's the patch, against 0.87pre2:

diff -u -w -r src.old/demos/nanox/move.c src/demos/nanox/move.c
--- src.old/demos/nanox/move.c	Tue Dec 14 00:23:38 1999
+++ src/demos/nanox/move.c	Sun Dec 19 22:52:34 1999
@@ -22,7 +22,7 @@
 
   window2 = GrNewWindow(GR_ROOT_WINDOW_ID, 20, 100, 100, 60, 4, BLACK, BLUE);
   subwindow2 = GrNewWindow(window2, 5, 5, 90, 50, 4, WHITE, RED);
-  subsubwin2 = GrNewWindow(subwindow2, 10, 10, 10, 10, 2, GREEN, BLUE);
+/*    subsubwin2 = GrNewWindow(subwindow2, 10, 10, 10, 10, 2, GREEN, BLUE); */
 
   GrSelectEvents(window1, 
   		 GR_EVENT_MASK_EXPOSURE |
@@ -42,6 +42,10 @@
 		 GR_EVENT_MASK_MOUSE_MOTION |
 		 0);
 
+  GrSelectEvents(subsubwin1, 
+		 GR_EVENT_MASK_BUTTON_DOWN |
+		 0);
+
   GrMapWindow(subsubwin1);
   GrMapWindow(subwindow1);
   GrMapWindow(window1);
@@ -57,18 +61,33 @@
     case GR_EVENT_TYPE_NONE:
       break;
     case GR_EVENT_TYPE_BUTTON_DOWN:
-      if (event.button.changebuttons & GR_BUTTON_L) {
 	offset_x = event.button.x;
 	offset_y = event.button.y;
-      }
+
       if (event.button.changebuttons & GR_BUTTON_R) {
 	GrRaiseWindow(event.button.wid);
       }
+      if (event.button.wid == subsubwin1) {
+	GR_WINDOW_INFO winfo;
+	GrGetWindowInfo(subsubwin1, &winfo);
+	if (winfo.parent == subwindow1) {
+	  GrReparentWindow(subsubwin1, subwindow2, 10, 10);
+	} else {
+	  GrReparentWindow(subsubwin1, subwindow1, 10, 10);
+	}
+      }
     case GR_EVENT_TYPE_MOUSE_MOTION:
-      if (event.mouse.buttons == GR_BUTTON_L)
+      if (event.mouse.buttons == GR_BUTTON_L && 
+	  (event.mouse.wid == window1 || event.mouse.wid == window2)) {
 	GrMoveWindow(event.mouse.wid, 
 		     event.mouse.rootx - offset_x, 
 		     event.mouse.rooty - offset_y);
+      }
+      if (event.mouse.buttons == GR_BUTTON_R) {
+	GrResizeWindow(event.mouse.wid, 
+		     event.mouse.x + 1, 
+		     event.mouse.y + 1);
+      }
       break;
     case GR_EVENT_TYPE_EXPOSURE:
       //GrFillRect(event.exposure.wid, defgc,
diff -u -w -r src.old/nano-X.h src/nano-X.h
--- src.old/nano-X.h	Thu Dec  2 01:58:09 1999
+++ src/nano-X.h	Sun Dec 19 23:02:49 1999
@@ -164,6 +164,7 @@
 #define	GR_EVENT_MASK_KEY_UP		GR_EVENTMASK(GR_EVENT_TYPE_KEY_UP)
 #define	GR_EVENT_MASK_FOCUS_IN		GR_EVENTMASK(GR_EVENT_TYPE_FOCUS_IN)
 #define	GR_EVENT_MASK_FOCUS_OUT		GR_EVENTMASK(GR_EVENT_TYPE_FOCUS_OUT)
+#define	GR_EVENT_MASK_FDINPUT		GR_EVENTMASK(GR_EVENT_TYPE_FDINPUT)
 #define	GR_EVENT_MASK_ALL		((GR_EVENT_MASK) -1L)
 
 /* Modifiers generated by special keyboard shift-like keys.
@@ -172,7 +173,7 @@
  */
 #define	GR_MODIFIER_SHIFT	((MODIFIER) 0x01)	/* shift */
 #define	GR_MODIFIER_CTRL	((MODIFIER) 0x02)	/* control */
-#define	GR_MODIFIER_META	((MODIFIER) 0x03)	/* meta or alt */
+#define	GR_MODIFIER_META	((MODIFIER) 0x04)	/* meta or alt */
 #define	GR_MODIFIER_ANY		((MODIFIER) 0x07)	/* any modifier */
 
 /* Button flags. */
@@ -297,6 +298,7 @@
 void		GrLowerWindow(GR_WINDOW_ID wid);
 void		GrMoveWindow(GR_WINDOW_ID wid, GR_COORD x, GR_COORD y);
 void		GrResizeWindow(GR_WINDOW_ID wid, GR_SIZE width, GR_SIZE height);
+void		GrReparentWindow(GR_WINDOW_ID wid, GR_WINDOW_ID pwid, GR_COORD x, GR_COORD y);
 void		GrGetWindowInfo(GR_WINDOW_ID wid, GR_WINDOW_INFO *infoptr);
 void		GrGetFontInfo(GR_FONT font, GR_FONT_INFO *fip);
 void		GrSetFocus(GR_WINDOW_ID wid);
diff -u -w -r src.old/nanox/client.c src/nanox/client.c
--- src.old/nanox/client.c	Thu Dec  2 01:52:03 1999
+++ src/nanox/client.c	Sun Dec 19 21:24:55 1999
@@ -631,6 +631,21 @@
 }
 
 /*
+ * Reparent the window to be the specified size.
+ */
+void 
+GrReparentWindow(GR_WINDOW_ID wid, GR_WINDOW_ID pwid, GR_COORD x, GR_COORD y)
+{
+	nxReparentWindowReq *req;
+
+	req = AllocReq(ReparentWindow);
+	req->windowid = wid;
+	req->parentid = pwid;
+	req->x = x;
+	req->y = y;
+}
+
+/*
  * Clear the specified window by setting it to its background color.
  * If the exposeflag is nonzero, then this also creates an exposure
  * event for the window.
diff -u -w -r src.old/nanox/nxproto.h src/nanox/nxproto.h
--- src.old/nanox/nxproto.h	Wed Dec  1 20:52:20 1999
+++ src/nanox/nxproto.h	Sun Dec 19 18:53:18 1999
@@ -519,4 +519,15 @@
 	UINT32	color;
 } nxFindColorReq;
 
-#define GrTotalNumCalls         47
+#define GrNumReparentWindow        47
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	UINT32	windowid;
+	UINT32	parentid;
+	INT16	x;
+	INT16	y;
+} nxReparentWindowReq;
+
+#define GrTotalNumCalls         48
diff -u -w -r src.old/nanox/serv.h src/nanox/serv.h
--- src.old/nanox/serv.h	Thu Dec  2 00:49:38 1999
+++ src/nanox/serv.h	Sun Dec 19 21:26:21 1999
@@ -210,6 +210,7 @@
 void		GrLowerWindowWrapper(void *);
 void		GrMoveWindowWrapper(void *);
 void		GrResizeWindowWrapper(void *);
+void		GrReparentWindowWrapper(void *);
 void		GrGetWindowInfoWrapper(void *);
 void		GrGetFontInfoWrapper(void *);
 void		GrSetFocusWrapper(void *);
diff -u -w -r src.old/nanox/srvfunc.c src/nanox/srvfunc.c
--- src.old/nanox/srvfunc.c	Tue Dec 14 00:54:18 1999
+++ src/nanox/srvfunc.c	Sun Dec 19 22:51:13 1999
@@ -166,9 +166,9 @@
 	}
 
 	infoptr->wid = wid;
-	infoptr->parent = wp->parent->id;
-	infoptr->child = wp->children->id;
-	infoptr->sibling = wp->siblings->id;
+	infoptr->parent = wp->parent?wp->parent->id:0;
+	infoptr->child = wp->children?wp->children->id:0;
+	infoptr->sibling = wp->siblings?wp->siblings->id:0;
 	infoptr->mapped = wp->mapped;
 	infoptr->unmapcount = wp->unmapcount;
 	infoptr->inputonly = !wp->output;
@@ -394,6 +394,50 @@
 	GsWpUnmapWindow(wp);
 	wp->width = width;
 	wp->height = height;
+	GsWpMapWindow(wp);
+}
+
+/*
+ * Move the window to the specified position relative to its parent.
+ */
+void
+GrReparentWindow(GR_WINDOW_ID wid, GR_WINDOW_ID pwid, GR_COORD x, GR_COORD y)
+{
+	GR_WINDOW	*wp;		/* window structure */
+	GR_WINDOW	*pwp;		/* parent window structure */
+	GR_WINDOW	**mysibptr;	/* handle to my sibling ptr */
+	GR_COORD	offx, offy;
+
+	wp = GsFindWindow(wid);
+	pwp = GsFindWindow(pwid);
+	if (wp == NULL || pwp == NULL)
+		return;
+	if (wp == rootwp) {
+		GsError(GR_ERROR_ILLEGAL_ON_ROOT_WINDOW, wid);
+		return;
+	}
+
+	x += pwp->x;
+	y += pwp->y;
+	offx = x - wp->x;
+	offy = y - wp->y;
+
+	if (wp->x == x && wp->y == y)
+		return;
+
+	/*
+	 * This should be optimized to not require redrawing of the window
+	 * when possible.
+	 */
+	GsWpUnmapWindow(wp);
+	for (mysibptr = &(wp->parent->children); 
+	     *mysibptr != wp; 
+	     mysibptr = &((*mysibptr)->siblings));
+	*mysibptr = wp->siblings;
+	wp->parent = pwp;
+	wp->siblings = pwp->children;
+	pwp->children = wp;
+	OffsetWindow(wp, offx, offy);
 	GsWpMapWindow(wp);
 }
 
diff -u -w -r src.old/nanox/srvnet.c src/nanox/srvnet.c
--- src.old/nanox/srvnet.c	Thu Dec  2 01:49:03 1999
+++ src/nanox/srvnet.c	Sun Dec 19 22:19:15 1999
@@ -169,6 +169,14 @@
 }
 
 void
+GrReparentWindowWrapper(void *r)
+{
+	nxReparentWindowReq *req = r;
+
+	GrReparentWindow(req->windowid, req->parentid, req->x, req->y);
+}
+
+void
 GrGetWindowInfoWrapper(void *r)
 {
 	nxGetWindowInfoReq *req = r;
@@ -543,7 +551,8 @@
 	{GrSetCursorWrapper, "GrSetCursor"},
 	{GrMoveCursorWrapper, "GrMoveCursor"},
 	{GrGetSystemPaletteWrapper, "GrGetSystemPalette"},
-	{GrFindColorWrapper, "GrFindColor"}
+	{GrFindColorWrapper, "GrFindColor"},
+	{GrReparentWindowWrapper, "GrReparentWindow"}
 };
 
 /*
Subject: Re: Microwindows 0.87pre3 released
From: Morten Rolland ####@####.####
Date: 20 Dec 1999 09:14:39 -0000
Message-Id: <385DFFD9.E4238D8F@screenmedia.no>

Greg Haerr wrote:
> 
> A hopefully last prerelease to Microwindows 0.87 is available at:

Some points to consider before a final release:

  * Some people (like myself..:) prefer a directory structure
    for include files like:

        .../microwin/include/microwin/*.h

    This makes it possible to say 'cc -I.../microwin/include' and
    specify '#include <microwin/nano-X.h>' in the source files.
    Specifying the header files as microwin/*.h helps avoid name
    space pollution/conflicts, and makes it obvious where the
    header files originate.  This is similar to how X11 does
    things fx.: /usr/include/X11/*.h

    This is a major rewrite of how applications are written, and
    should be considered now, before a release.  By including both
    -I$(TOPDIR)/include and -I$(TOPDIR)/include/microwin in the
    Makefile, the demos shouldn't need rewriting, but the standard
    could be defined (come to think of it, the demos probably should
    follow the standard...)

  * In gcc, sizeof(*(void *)) == 1, but this is not automatically
    the case IIRC (it may even be configurable), so the pixel
    increment code in GrArea in nanox/client.c should read something
    like (this is not tested):

    void 
    GrArea(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width,
           GR_SIZE height, void *pixels, int pixtype)
    ...

    req->width = width;
    req->height = chunk_y;
    req->pixtype = pixtype;
    memmove(GetReqData(req), pixels, size);
-    pixels += size;
+    pixels = (void *)(((char *)pixels)+size);
    y += chunk_y;
    height -= chunk_y;

... in order to be portable.

This is just my NOK 0.5 from quickly browsing the new release.  It looks
really good at first glance!

Regards,
Morten Rolland
Subject: Re: Microwindows 0.87pre3 released
From: "Greg Haerr" ####@####.####
Date: 20 Dec 1999 21:00:24 -0000
Message-Id: <00a801bf4b1b$a2f923a0$15320cd0@gregh>

: I was working on NanoX tonight as well, but unfortunately against
: 87pre2, so the diff will probably not apply against 87pre3 (which I
: haven't looked at yet.)

Thanks for the work.  I'll add the patch against 87pre3, don't worry
about it.  BTW, the patch was delivered as normal mail text; any chance
you could send it as an attachment?



:
: I also fixed a moderately serious bug in GrGetWindowInfo() that would
: cause a server crash when called on any window without children and
: siblings.

Thanks

:
: Finally, I just noticed that
: #define GR_EVENT_TYPE_ERROR             ((GR_EVENT_TYPE) -1)
: but
: #define GR_EVENTMASK(n)                 (((GR_EVENT_MASK) 1) << (n))
: and
: #define GR_EVENT_MASK_ERROR             GR_EVENTMASK(GR_EVENT_TYPE_ERROR)
:
: Which I think means that GR_EVENT_MASK_ERROR is always zero.  Is this
: what was intended?

I'll check into this.  Currently, errors are reported the way they should be,
but they
normally get passed back through an async call to a registered error handler,
not passed through the GetNextEvent event-masked mechanism...

Greg


Subject: Re: Microwindows 0.87pre3 released
From: "Greg Haerr" ####@####.####
Date: 20 Dec 1999 23:33:41 -0000
Message-Id: <015301bf4b31$0a108a00$15320cd0@gregh>

: I was working on NanoX tonight as well, but unfortunately against
: 87pre2, so the diff will probably not apply against 87pre3 (which I
: haven't looked at yet.)

Dan-
    I've applied your patches to the tree.  Thanks.
However, I think you've got a bug in GrReparentWindow.
Since you copied the code from GrMoveWindow, you
didn't remove the following statement:

 if (wp->x == x && wp->y == y)
     return;

Left in, GrReparentWindow will fail if you happen to specify
an x and y that match.  I removed the if statement.

Regards,

Greg




: +void
: +GrReparentWindow(GR_WINDOW_ID wid, GR_WINDOW_ID pwid, GR_COORD x, GR_COORD y)
: +{
: + GR_WINDOW *wp; /* window structure */
: + GR_WINDOW *pwp; /* parent window structure */
: + GR_WINDOW **mysibptr; /* handle to my sibling ptr */
: + GR_COORD offx, offy;
: +
: + wp = GsFindWindow(wid);
: + pwp = GsFindWindow(pwid);
: + if (wp == NULL || pwp == NULL)
: + return;
: + if (wp == rootwp) {
: + GsError(GR_ERROR_ILLEGAL_ON_ROOT_WINDOW, wid);
: + return;
: + }
: +
: + x += pwp->x;
: + y += pwp->y;
: + offx = x - wp->x;
: + offy = y - wp->y;
: +
: + if (wp->x == x && wp->y == y)
: + return;
: +
: + /*
: + * This should be optimized to not require redrawing of the window
: + * when possible.
: + */
: + GsWpUnmapWindow(wp);
: + for (mysibptr = &(wp->parent->children);
: +      *mysibptr != wp;
: +      mysibptr = &((*mysibptr)->siblings));
: + *mysibptr = wp->siblings;
: + wp->parent = pwp;
: + wp->siblings = pwp->children;
: + pwp->children = wp;
: + OffsetWindow(wp, offx, offy);
:   GsWpMapWindow(wp);
:  }


[<<] [<] Page 1 of 1 [>] [>>]


Powered by ezmlm-browse 0.20.