nanogui: Thread: X11 drivers for Microwindows


[<<] [<] Page 1 of 1 [>] [>>]
Subject: X11 drivers for Microwindows
From: Greg Haerr ####@####.####
Date: 29 Nov 1999 18:58:49 -0000
Message-Id: <796896539E6CD311B0E70060083DFEFB076B2D@NBA-SLAM.CenSoft.COM>

Tony,
	I have integrated the X11 drivers into the Microwindows
codebase, and have found them very useful.  Thanks.

I did find, for some strange reason, that the rgb values in
the PIXELVAL_to_pixel routine to _still_ be reversed
in the 16 bit PF_TRUECOLOR565 mode though, so I
reversed them and now the colors are completely correct.

I've also solved the XFlush() problem (that of not completing
all Xlib i/o before hanging on our select()) by extending the
driver interface to include a scrdev.PreSelect() call that
is called (guess) before the main loop select().  Dan
had contributed a patch to this but it involved #including
X11 in the device-independent main loop.

There's one other annoyance that I haven't solved: 
Your driver waits for a FocusIn event before installing
the colormap, with the result that the microwindows
display is incorrect right after running it, until the mouse
is moved.  I tried changing this to Expose, with no
effect.  Isn't there another event we can wait for,
or install the Colormap right after MapWindow?

I'm going to place the modifed scr_x11.c file on my ftp server,
the XFlush() part won't work until 0.87 is released,
but the color code is better.

	ftp://microwindows.censoft.com/pub/microwindows/X11/scr_x11.c

I should have 0.87 out here early this week.

Greg
Subject: Re: X11 drivers for Microwindows
From: Morten Rolland ####@####.####
Date: 30 Nov 1999 09:50:45 -0000
Message-Id: <3843AA5A.FCAA1547@screenmedia.no>

Greg Haerr wrote:
> Tony,
>         I have integrated the X11 drivers into the Microwindows
> codebase, and have found them very useful.  Thanks.

The same goes for me/us at Screen Media, thanks a lot!

We found one strange little bit of code in scr_x11.c that we
had to change, the patch is:

Index: scr_x11.c
===================================================================
RCS file: /sw/CVSROOT/freepad/mwin/src/drivers/scr_x11.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- scr_x11.c   1999/11/24 14:34:59     1.1
+++ scr_x11.c   1999/11/30 08:08:51     1.2
@@ -301,12 +301,9 @@
        char* name;
        int i;

-       if ((name = (char*) getenv("DISPLAY")) == NULL)
+       name = getenv("DISPLAY");
+       if ( name == 0 )
            name = ":0";
-       else if ((name = strchr(name, '=')) == NULL)
-           name = ":0";
-       else
-           name++;
        if ((x11_dpy = XOpenDisplay(name)) == NULL)
            return -1;

My mailer probably garbles this patch, but it should be simple
enough to read.  It removes the search for '=' as 'getenv'
should have done that itself.

I'm looking forward to 0.87!

Regards,
Morten Rolland
Subject: Re: X11 drivers for Microwindows
From: Daniel R Risacher ####@####.####
Date: 1 Dec 1999 12:17:56 -0000
Message-Id: <m2bt8ax3oj.fsf@alum.mit.edu>

Actually, I suspect that this code can be simplified even further.
According to the man page for XOpenDisplay(), :

  On a POSIX-conformant system, if the display_name is NULL, it defaults
  to the value of the DISPLAY environment variable.

I believe the dependence on POSIX-ness is required for the getenv()
call to work.  Since we need this anyway, I propose the following patch:

--- scr_x11.c.old       Wed Dec  1 06:03:13 1999
+++ scr_x11.c   Wed Dec  1 06:05:48 1999
@@ -298,16 +298,9 @@
     static int setup_needed = 1;
     
     if (setup_needed) {
-       char* name;
        int i;
 
-       if ((name = (char*) getenv("DISPLAY")) == NULL)
-           name = ":0";
-       else if ((name = strchr(name, '=')) == NULL)
-           name = ":0";
-       else
-           name++;
-       if ((x11_dpy = XOpenDisplay(name)) == NULL)
+       if ((x11_dpy = XOpenDisplay(NULL)) == NULL)
            return -1;
 
        XSetErrorHandler(x11_error);

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


Powered by ezmlm-browse 0.20.