Subject:
Spring cleaning part 1: The essentials
From:
Jordan Crouse ####@####.####
Date:
8 May 2001 17:46:08 -0000
Message-Id: <01050811461602.28127@cosmic>
Happy spring everybody! I am in the midst of doing some spring cleaning on
my system(s), and I have some patches / tarballs ready for public consumption.
This one I call "the essentials", bug fixes and tweeks that I have
accumulated over the last couple of months. Please apply these when you can,
Greg.
Quick rundown of this patch:
* My environment variable fix for tty and ttyscan (you can set the
environment variable CONSOLE to the desired /dev/ttyX for input)
* Fixed a very nasty bug in scr_x11.c that hard coded the size (in bytes) of
a scanline instead of correctly calculating it for the desired depth.
* Changed the 'op' field of nxCopyAreaReq from INT16 to UINT32. This fixes
many of the alpha blending problems (since the values for the alpha blend
operations, MWROP_BLENDCONSTANT, MWROP_BLENDFBG, and MWROP_BLENDCHANNEL start
at 0x2000000, which is much larger than an INT16).
Please enjoy these, and there are more to come.
Jordan
diff -urN microwin-clean/src/drivers/kbd_tty.c
microwin-dirty/src/drivers/kbd_tty.c
--- microwin-clean/src/drivers/kbd_tty.c Sat Nov 25 21:42:42 2000
+++ microwin-dirty/src/drivers/kbd_tty.c Tue May 8 11:19:29 2001
@@ -6,6 +6,7 @@
*
* /dev/tty TTY Keyboard Driver
*/
+#include <stdlib.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
@@ -51,11 +52,21 @@
static int
TTY_Open(KBDDEVICE *pkd)
{
- struct termios new; /* new terminal modes */
+ char *env;
- fd = open(KEYBOARD, O_NONBLOCK);
- if (fd < 0)
- return -1;
+ int i;
+ int ledstate = 0;
+ struct termios new;
+
+ /* Open /dev/tty device*/
+
+ /* locate and open framebuffer, get info*/
+ if(!(env = getenv("CONSOLE")))
+ fd = open(KEYBOARD, O_NONBLOCK);
+ else
+ fd = open(env, O_NONBLOCK);
+
+ if (fd < 0) return -1;
if (tcgetattr(fd, &old) < 0)
goto err;
diff -urN microwin-clean/src/drivers/kbd_ttyscan.c
microwin-dirty/src/drivers/kbd_ttyscan.c
--- microwin-clean/src/drivers/kbd_ttyscan.c Mon Nov 27 20:39:09 2000
+++ microwin-dirty/src/drivers/kbd_ttyscan.c Tue May 8 11:19:02 2001
@@ -89,14 +89,21 @@
static int
TTY_Open(KBDDEVICE *pkd)
{
+ char *env;
+
int i;
int ledstate = 0;
struct termios new;
/* Open /dev/tty device*/
- fd = open(KEYBOARD, O_NONBLOCK);
- if (fd < 0)
- return -1;
+
+ /* locate and open framebuffer, get info*/
+ if(!(env = getenv("CONSOLE")))
+ fd = open(KEYBOARD, O_NONBLOCK);
+ else
+ fd = open(env, O_NONBLOCK);
+
+ if (fd < 0) return -1;
/* Save previous settings*/
if (ioctl(fd, KDGKBMODE, &old_kbd_mode) < 0) {
@@ -443,7 +450,7 @@
break;
}
-//printf("TranslateScancode %02x to mwkey %d\n", scancode, mwkey);
+ /* printf("TranslateScancode %02x to mwkey %d\n", scancode, mwkey); */
return mwkey;
}
diff -urN microwin-clean/src/drivers/scr_x11.c
microwin-dirty/src/drivers/scr_x11.c
--- microwin-clean/src/drivers/scr_x11.c Sun Jan 14 22:27:27 2001
+++ microwin-dirty/src/drivers/scr_x11.c Tue May 8 11:21:53 2001
@@ -592,6 +592,12 @@
psd->bpp = 8;
break;
}
+
+ /* Calculate the correct linelen here */
+
+ GdCalcMemGCAlloc(psd, psd->xres, psd->yres, psd->planes,
+ psd->bpp, &size, &psd->linelen);
+
psd->ncolors = psd->bpp >= 24? (1 << 24): (1 << psd->bpp);
psd->flags = PSF_SCREEN | PSF_HAVEBLIT;
psd->size = 0;
@@ -607,6 +613,8 @@
return NULL;
/* calc size and linelen of savebits alloc*/
+ /* JHC - Is this redundant now?? */
+
GdCalcMemGCAlloc(&savebits, savebits.xvirtres, savebits.yvirtres, 0, 0,
&size, &linelen);
savebits.linelen = linelen;
diff -urN microwin-clean/src/nanox/nxproto.h
microwin-dirty/src/nanox/nxproto.h
--- microwin-clean/src/nanox/nxproto.h Sat Jan 20 15:18:55 2001
+++ microwin-dirty/src/nanox/nxproto.h Tue May 8 11:25:50 2001
@@ -612,7 +612,7 @@
IDTYPE srcid;
INT16 srcx;
INT16 srcy;
- INT16 op;
+ UINT32 op;
} nxCopyAreaReq;
#define GrNumSetFontSize 52