[PATCH 1/4] [kdrive] Remove trailing whitespace

Mikhail Gusarov dottedmag at dottedmag.net
Fri Jan 1 15:43:25 PST 2010


Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
---
 hw/kdrive/fbdev/fbdev.c    |   78 ++++++------
 hw/kdrive/fbdev/fbdev.h    |    6 +-
 hw/kdrive/fbdev/fbinit.c   |   10 +-
 hw/kdrive/linux/evdev.c    |   24 ++--
 hw/kdrive/linux/keyboard.c |    8 +-
 hw/kdrive/linux/linux.c    |   20 ++--
 hw/kdrive/linux/mouse.c    |   48 ++++----
 hw/kdrive/linux/ms.c       |    6 +-
 hw/kdrive/linux/ps2.c      |    4 +-
 hw/kdrive/linux/tslib.c    |    8 +-
 hw/kdrive/src/kcmap.c      |   24 ++--
 hw/kdrive/src/kcurscol.c   |    6 +-
 hw/kdrive/src/kdrive.c     |  124 ++++++++++----------
 hw/kdrive/src/kdrive.h     |   20 ++--
 hw/kdrive/src/kinfo.c      |    4 +-
 hw/kdrive/src/kinput.c     |   74 ++++++------
 hw/kdrive/src/kmap.c       |    8 +-
 hw/kdrive/src/kmode.c      |   28 ++--
 hw/kdrive/src/kxv.c        |  284 ++++++++++++++++++++++----------------------
 hw/kdrive/src/kxv.h        |   38 +++---
 20 files changed, 411 insertions(+), 411 deletions(-)

diff --git a/hw/kdrive/fbdev/fbdev.c b/hw/kdrive/fbdev/fbdev.c
index 4eeca28..cdb4b5c 100644
--- a/hw/kdrive/fbdev/fbdev.c
+++ b/hw/kdrive/fbdev/fbdev.c
@@ -38,12 +38,12 @@ fbdevInitialize (KdCardInfo *card, FbdevPriv *priv)
     int		    k;
     unsigned long   off;
 
-    if (fbdevDevicePath == NULL) 
+    if (fbdevDevicePath == NULL)
       fbdevDevicePath = "/dev/fb0";
 
     if ((priv->fd = open(fbdevDevicePath, O_RDWR)) < 0)
       {
-	ErrorF("Error opening framebuffer %s: %s\n", 
+	ErrorF("Error opening framebuffer %s: %s\n",
 	       fbdevDevicePath, strerror(errno));
         return FALSE;
       }
@@ -68,8 +68,8 @@ fbdevInitialize (KdCardInfo *card, FbdevPriv *priv)
 				   PROT_READ|PROT_WRITE,
 				   MAP_SHARED,
 				   priv->fd, 0);
-    
-    if (priv->fb_base == (char *)-1) 
+
+    if (priv->fb_base == (char *)-1)
     {
         perror("ERROR: mmap framebuffer fails!");
 	close (priv->fd);
@@ -88,14 +88,14 @@ fbdevCardInit (KdCardInfo *card)
     priv = (FbdevPriv *) xalloc (sizeof (FbdevPriv));
     if (!priv)
 	return FALSE;
-    
+
     if (!fbdevInitialize (card, priv))
     {
 	xfree (priv);
 	return FALSE;
     }
     card->driver = priv;
-    
+
     return TRUE;
 }
 
@@ -124,7 +124,7 @@ static void
 fbdevConvertMonitorTiming (const KdMonitorTiming *t, struct fb_var_screeninfo *var)
 {
     memset (var, 0, sizeof (struct fb_var_screeninfo));
-    
+
     var->xres = t->horizontal;
     var->yres = t->vertical;
     var->xres_virtual = t->horizontal;
@@ -160,10 +160,10 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv)
     int k;
 
     k = ioctl (priv->fd, FBIOGET_VSCREENINFO, &var);
-    
+
     if (!screen->width || !screen->height)
     {
-	if (k >= 0) 
+	if (k >= 0)
 	{
 	    screen->width = var.xres;
 	    screen->height = var.yres;
@@ -177,7 +177,7 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv)
     }
     if (!screen->fb[0].depth)
     {
-	if (k >= 0) 
+	if (k >= 0)
 	    screen->fb[0].depth = var.bits_per_pixel;
 	else
 	    screen->fb[0].depth = 16;
@@ -217,7 +217,7 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv)
     ioctl (priv->fd, FBIOGET_VSCREENINFO, &priv->var);
     depth = priv->var.bits_per_pixel;
     gray = priv->var.grayscale;
-    
+
     switch (priv->fix.visual) {
     case FB_VISUAL_PSEUDOCOLOR:
 	if (gray)
@@ -309,7 +309,7 @@ fbdevScreenInit (KdScreenInfo *screen)
     }
     return TRUE;
 }
-    
+
 void *
 fbdevWindowLinear (ScreenPtr	pScreen,
 		   CARD32	row,
@@ -338,19 +338,19 @@ fbdevMapFramebuffer (KdScreenInfo *screen)
 	scrpriv->shadow = TRUE;
     else
 	scrpriv->shadow = FALSE;
-    
+
     KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height);
-    
+
     KdSetPointerMatrix (&m);
-    
+
     screen->width = priv->var.xres;
     screen->height = priv->var.yres;
     screen->memory_base = (CARD8 *) (priv->fb);
     screen->memory_size = priv->fix.smem_len;
-    
+
     if (scrpriv->shadow)
     {
-	if (!KdShadowFbAlloc (screen, 0, 
+	if (!KdShadowFbAlloc (screen, 0,
 			      scrpriv->randr & (RR_Rotate_90|RR_Rotate_270)))
 	    return FALSE;
 	screen->off_screen_base = screen->memory_size;
@@ -358,12 +358,12 @@ fbdevMapFramebuffer (KdScreenInfo *screen)
     else
     {
         screen->fb[0].byteStride = priv->fix.line_length;
-        screen->fb[0].pixelStride = (priv->fix.line_length * 8 / 
+        screen->fb[0].pixelStride = (priv->fix.line_length * 8 /
     				 priv->var.bits_per_pixel);
         screen->fb[0].frameBuffer = (CARD8 *) (priv->fb);
 	screen->off_screen_base = screen->fb[0].byteStride * screen->height;
     }
-    
+
     return TRUE;
 }
 
@@ -458,25 +458,25 @@ fbdevRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
     RRScreenSizePtr	    pSize;
     Rotation		    randr;
     int			    n;
-    
+
     *rotations = RR_Rotate_All|RR_Reflect_All;
-    
+
     for (n = 0; n < pScreen->numDepths; n++)
 	if (pScreen->allowedDepths[n].numVids)
 	    break;
     if (n == pScreen->numDepths)
 	return FALSE;
-    
+
     pSize = RRRegisterSize (pScreen,
 			    screen->width,
 			    screen->height,
 			    screen->width_mm,
 			    screen->height_mm);
-    
+
     randr = KdSubRotation (scrpriv->randr, screen->randr);
-    
+
     RRSetCurrentConfig (pScreen, randr, 0, pSize);
-    
+
     return TRUE;
 }
 
@@ -512,20 +512,20 @@ fbdevRandRSetConfig (ScreenPtr		pScreen,
 	KdDisableScreen (pScreen);
 
     oldscr = *scrpriv;
-    
+
     oldwidth = screen->width;
     oldheight = screen->height;
     oldmmwidth = pScreen->mmWidth;
     oldmmheight = pScreen->mmHeight;
-    
+
     /*
      * Set new configuration
      */
-    
+
     scrpriv->randr = KdAddRotation (screen->randr, randr);
 
     fbdevUnmapFramebuffer (screen);
-    
+
     if (!fbdevMapFramebuffer (screen))
 	goto bail4;
 
@@ -546,9 +546,9 @@ fbdevRandRSetConfig (ScreenPtr		pScreen,
 				    screen->fb[0].bitsPerPixel,
 				    screen->fb[0].byteStride,
 				    screen->fb[0].frameBuffer);
-    
+
     /* set the subpixel order */
-    
+
     KdSetSubpixelOrder (pScreen, scrpriv->randr);
     if (wasEnabled)
 	KdEnableScreen (pScreen);
@@ -563,7 +563,7 @@ bail4:
     pScreen->height = oldheight;
     pScreen->mmWidth = oldmmwidth;
     pScreen->mmHeight = oldmmheight;
-    
+
     if (wasEnabled)
 	KdEnableScreen (pScreen);
     return FALSE;
@@ -573,7 +573,7 @@ Bool
 fbdevRandRInit (ScreenPtr pScreen)
 {
     rrScrPrivPtr    pScrPriv;
-    
+
     if (!RRScreenInit (pScreen))
 	return FALSE;
 
@@ -594,7 +594,7 @@ fbdevCreateColormap (ColormapPtr pmap)
     int			i;
     int			nent;
     xColorItem		*pdefs;
-    
+
     switch (priv->fix.visual) {
     case FB_VISUAL_STATIC_PSEUDOCOLOR:
 	pVisual = pmap->pVisual;
@@ -639,7 +639,7 @@ fbdevFinishInitScreen (ScreenPtr pScreen)
     if (!fbdevRandRInit (pScreen))
 	return FALSE;
 #endif
-    
+
     return TRUE;
 }
 
@@ -663,7 +663,7 @@ fbdevEnable (ScreenPtr pScreen)
     int			k;
 
     priv->var.activate = FB_ACTIVATE_NOW|FB_CHANGE_CMAP_VBL;
-    
+
     /* display it on the LCD */
     k = ioctl (priv->fd, FBIOPUT_VSCREENINFO, &priv->var);
     if (k < 0)
@@ -671,13 +671,13 @@ fbdevEnable (ScreenPtr pScreen)
 	perror ("FBIOPUT_VSCREENINFO");
 	return FALSE;
     }
-    
+
     if (priv->fix.visual == FB_VISUAL_DIRECTCOLOR)
     {
 	struct fb_cmap	cmap;
 	int		i;
 
-	for (i = 0; 
+	for (i = 0;
 	     i < (1 << priv->var.red.length) ||
 	     i < (1 << priv->var.green.length) ||
 	     i < (1 << priv->var.blue.length); i++)
@@ -742,7 +742,7 @@ void
 fbdevCardFini (KdCardInfo *card)
 {
     FbdevPriv	*priv = card->driver;
-    
+
     munmap (priv->fb_base, priv->fix.smem_len);
     close (priv->fd);
     xfree (priv);
diff --git a/hw/kdrive/fbdev/fbdev.h b/hw/kdrive/fbdev/fbdev.h
index 9e322da..2125ec8 100644
--- a/hw/kdrive/fbdev/fbdev.h
+++ b/hw/kdrive/fbdev/fbdev.h
@@ -42,7 +42,7 @@ typedef struct _fbdevPriv {
     char			*fb;
     char			*fb_base;
 } FbdevPriv;
-    
+
 typedef struct _fbdevScrPriv {
     Rotation			randr;
     Bool			shadow;
@@ -63,7 +63,7 @@ fbdevScreenInit (KdScreenInfo *screen);
 
 Bool
 fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv);
-    
+
 Bool
 fbdevInitScreen (ScreenPtr pScreen);
 
@@ -122,7 +122,7 @@ fbdevSetShadow (ScreenPtr pScreen);
 
 Bool
 fbdevCreateColormap (ColormapPtr pmap);
-    
+
 #ifdef RANDR
 Bool
 fbdevRandRGetInfo (ScreenPtr pScreen, Rotation *rotations);
diff --git a/hw/kdrive/fbdev/fbinit.c b/hw/kdrive/fbdev/fbinit.c
index de80c79..77d66f4 100644
--- a/hw/kdrive/fbdev/fbinit.c
+++ b/hw/kdrive/fbdev/fbinit.c
@@ -60,11 +60,11 @@ ddxProcessArgument (int argc, char **argv, int i)
 {
   if (!strcmp (argv[i], "-fb"))
     {
-      if (i+1 < argc) 
+      if (i+1 < argc)
 	{
 	  fbdevDevicePath = argv[i+1];
 	  return 2;
-	} 
+	}
       UseMsg();
       exit(1);
     }
@@ -86,18 +86,18 @@ KdCardFuncs	fbdevFuncs = {
     fbdevRestore,	    /* restore */
     fbdevScreenFini,	    /* scrfini */
     fbdevCardFini,	    /* cardfini */
-    
+
     0,			    /* initCursor */
     0,			    /* enableCursor */
     0,			    /* disableCursor */
     0,			    /* finiCursor */
     0,			    /* recolorCursor */
-    
+
     0,			    /* initAccel */
     0,			    /* enableAccel */
     0,			    /* disableAccel */
     0,			    /* finiAccel */
-    
+
     fbdevGetColors,    	    /* getColors */
     fbdevPutColors,	    /* putColors */
 };
diff --git a/hw/kdrive/linux/evdev.c b/hw/kdrive/linux/evdev.c
index 096a2dd..485a2b5 100644
--- a/hw/kdrive/linux/evdev.c
+++ b/hw/kdrive/linux/evdev.c
@@ -48,7 +48,7 @@ typedef struct _kevdev {
     int                            abs[ABS_MAX + 1];
     int                            prevabs[ABS_MAX + 1];
     long                    key[NBITS(KEY_MAX + 1)];
-    
+
     /* supported device info */
     long                    relbits[NBITS(REL_MAX + 1)];
     long                    absbits[NBITS(ABS_MAX + 1)];
@@ -106,12 +106,12 @@ EvdevPtrMotion (KdPointerInfo    *pi, struct input_event *ev)
             int a;
             for (a = 0; a <= ke->max_rel; a++)
             {
-                if (ISBITSET (ke->relbits, a)) 
+                if (ISBITSET (ke->relbits, a))
 		{
                     if (a == 0)
                         KdEnqueuePointerEvent(pi, flags, ke->rel[a], 0, 0);
                     else if (a == 1)
-                        KdEnqueuePointerEvent(pi, flags, 0, ke->rel[a], 0); 
+                        KdEnqueuePointerEvent(pi, flags, 0, ke->rel[a], 0);
                 }
 		ke->rel[a] = 0;
             }
@@ -131,9 +131,9 @@ EvdevPtrMotion (KdPointerInfo    *pi, struct input_event *ev)
             ErrorF ("\n");
             break;
         }
-    
-    if (ev->code == REL_WHEEL) {           
-      for (i = 0; i < abs (ev->value); i++) 
+
+    if (ev->code == REL_WHEEL) {
+      for (i = 0; i < abs (ev->value); i++)
       {
         if (ev->value > 0)
           flags |= KD_BUTTON_4;
@@ -150,7 +150,7 @@ EvdevPtrMotion (KdPointerInfo    *pi, struct input_event *ev)
         KdEnqueuePointerEvent (pi, flags, 0, 0, 0);
       }
     }
-    
+
 }
 
 static void
@@ -164,7 +164,7 @@ EvdevPtrRead (int evdevPort, void *closure)
 
     n = read (evdevPort, &events, NUM_EVENTS * sizeof (struct input_event));
     if (n <= 0) {
-        if (errno == ENODEV) 
+        if (errno == ENODEV)
             DeleteInputDeviceRequest(pi->dixdev);
         return;
     }
@@ -231,7 +231,7 @@ EvdevPtrInit (KdPointerInfo *pi)
 
 static Status
 EvdevPtrEnable (KdPointerInfo *pi)
-{        
+{
     int fd;
     unsigned long   ev[NBITS(EV_MAX)];
     Kevdev            *ke;
@@ -352,7 +352,7 @@ EvdevPtrFini (KdPointerInfo *pi)
 
 
 /*
- * Evdev keyboard functions 
+ * Evdev keyboard functions
  */
 
 static void
@@ -374,7 +374,7 @@ EvdevKbdRead (int evdevPort, void *closure)
 
     n = read (evdevPort, &events, NUM_EVENTS * sizeof (struct input_event));
     if (n <= 0) {
-        if (errno == ENODEV) 
+        if (errno == ENODEV)
             DeleteInputDeviceRequest(ki->dixdev);
         return;
     }
@@ -395,7 +395,7 @@ static Status
 EvdevKbdInit (KdKeyboardInfo *ki)
 {
     int fd;
-    
+
     if (!ki->path) {
         ErrorF("Couldn't find evdev device path\n");
         return BadValue;
diff --git a/hw/kdrive/linux/keyboard.c b/hw/kdrive/linux/keyboard.c
index 79cf598..53d3c3a 100644
--- a/hw/kdrive/linux/keyboard.c
+++ b/hw/kdrive/linux/keyboard.c
@@ -231,7 +231,7 @@ readKernelMapping(KdKeyboardInfo *ki)
         return;
 
     fd = LinuxConsoleFd;
-    
+
     minKeyCode = NR_KEYS;
     maxKeyCode = 0;
     row = 0;
@@ -241,7 +241,7 @@ readKernelMapping(KdKeyboardInfo *ki)
         kbe.kb_index = LNX_KEY_INDEX(i);
 
         k = ki->keySyms.map + row * ki->keySyms.mapWidth;
-	
+
 	for (j = 0; j < ki->keySyms.mapWidth; ++j)
 	{
 	    unsigned short kval;
@@ -463,7 +463,7 @@ readKernelMapping(KdKeyboardInfo *ki)
 		k[j] = (kbe.kb_value & 0xFF) + 0x1008FF00;
 		break;
 #endif
-		
+
 	    default:
 		break;
 	    }
@@ -720,7 +720,7 @@ static void
 LinuxKeyboardDisable (KdKeyboardInfo *ki)
 {
     int fd;
-    
+
     if (!ki)
         return;
 
diff --git a/hw/kdrive/linux/linux.c b/hw/kdrive/linux/linux.c
index b41066f..1ec68fc 100644
--- a/hw/kdrive/linux/linux.c
+++ b/hw/kdrive/linux/linux.c
@@ -79,7 +79,7 @@ LinuxInit (void)
 	vtno = kdVirtualTerminal;
     else
     {
-	if ((fd = open("/dev/tty0",O_WRONLY,0)) < 0) 
+	if ((fd = open("/dev/tty0",O_WRONLY,0)) < 0)
 	{
 	    FatalError(
 		       "LinuxInit: Cannot open /dev/tty0 (%s)\n",
@@ -129,8 +129,8 @@ LinuxSetSwitchMode (int mode)
 {
     struct sigaction	act;
     struct vt_mode	VT;
-    
-    if (ioctl(LinuxConsoleFd, VT_GETMODE, &VT) < 0) 
+
+    if (ioctl(LinuxConsoleFd, VT_GETMODE, &VT) < 0)
     {
 	FatalError ("LinuxInit: VT_GETMODE failed\n");
     }
@@ -141,7 +141,7 @@ LinuxSetSwitchMode (int mode)
 	sigemptyset (&act.sa_mask);
 	act.sa_flags = 0;
 	sigaction (SIGUSR1, &act, 0);
-    
+
 	VT.mode = mode;
 	VT.relsig = SIGUSR1;
 	VT.acqsig = SIGUSR1;
@@ -152,12 +152,12 @@ LinuxSetSwitchMode (int mode)
 	sigemptyset (&act.sa_mask);
 	act.sa_flags = 0;
 	sigaction (SIGUSR1, &act, 0);
-    
+
 	VT.mode = mode;
 	VT.relsig = 0;
 	VT.acqsig = 0;
     }
-    if (ioctl(LinuxConsoleFd, VT_SETMODE, &VT) < 0) 
+    if (ioctl(LinuxConsoleFd, VT_SETMODE, &VT) < 0)
     {
 	FatalError("LinuxInit: VT_SETMODE failed\n");
     }
@@ -237,7 +237,7 @@ LinuxEnable (void)
      */
     LinuxApmFd = open ("/dev/apm_bios", 2);
     if (LinuxApmFd < 0 && errno == ENOENT)
-	LinuxApmFd = open ("/dev/misc/apm_bios", 2); 
+	LinuxApmFd = open ("/dev/misc/apm_bios", 2);
     if (LinuxApmFd >= 0)
     {
 	LinuxApmRunning = TRUE;
@@ -245,7 +245,7 @@ LinuxEnable (void)
 	RegisterBlockAndWakeupHandlers (LinuxApmBlock, LinuxApmWakeup, 0);
 	AddEnabledDevice (LinuxApmFd);
     }
-	
+
     /*
      * now get the VT
      */
@@ -308,8 +308,8 @@ LinuxFini (void)
 	 * Find a legal VT to switch to, either the one we started from
 	 * or the lowest active one that isn't ours
 	 */
-	if (activeVT < 0 || 
-	    activeVT == vts.v_active || 
+	if (activeVT < 0 ||
+	    activeVT == vts.v_active ||
 	    !(vts.v_state & (1 << activeVT)))
 	{
 	    for (activeVT = 1; activeVT < 16; activeVT++)
diff --git a/hw/kdrive/linux/mouse.c b/hw/kdrive/linux/mouse.c
index 6f399b5..007263e 100644
--- a/hw/kdrive/linux/mouse.c
+++ b/hw/kdrive/linux/mouse.c
@@ -112,7 +112,7 @@ MouseFlush (Kbufio *b, char *buf, int size)
     CARD32  done = now + 100;
     int	    c;
     int	    n = 0;
-    
+
     while ((c = MouseReadByte (b, done - now)) != -1)
     {
 	if (buf)
@@ -170,7 +170,7 @@ static Bool
 MouseWriteByte (int fd, unsigned char c, int timeout)
 {
     int	ret;
-    
+
 #ifdef DEBUG_BYTES
     ErrorF ("\tput %02x\n", c);
 #endif
@@ -234,7 +234,7 @@ typedef struct _kmouse {
     int			invalid;/* total invalid bytes for this protocol */
     unsigned long	state;	/* private per protocol, init to prot->state */
 } Kmouse;
-    
+
 static int mouseValid (KdPointerInfo *pi, unsigned char *ev, int ne)
 {
     Kmouse		*km = pi->driverPrivate;
@@ -271,16 +271,16 @@ static Bool MouseReasonable (KdPointerInfo *pi, unsigned long flags, int dx, int
 {
     Kmouse		*km = pi->driverPrivate;
 
-    if (km->stage == MouseWorking) 
+    if (km->stage == MouseWorking)
 	return TRUE;
-    if (dx < -50 || dx > 50) 
+    if (dx < -50 || dx > 50)
     {
 #ifdef DEBUG
 	ErrorF ("Large X %d\n", dx);
 #endif
 	return FALSE;
     }
-    if (dy < -50 || dy > 50) 
+    if (dy < -50 || dy > 50)
     {
 #ifdef DEBUG
 	ErrorF ("Large Y %d\n", dy);
@@ -299,7 +299,7 @@ static Bool ps2Parse (KdPointerInfo *pi, unsigned char *ev, int ne)
     int		    dx, dy, dz;
     unsigned long   flags;
     unsigned long   flagsrelease = 0;
-    
+
     flags = KD_MOUSE_DELTA;
     if (ev[0] & 4)
 	flags |= KD_BUTTON_2;
@@ -307,7 +307,7 @@ static Bool ps2Parse (KdPointerInfo *pi, unsigned char *ev, int ne)
 	flags |= KD_BUTTON_3;
     if (ev[0] & 1)
 	flags |= KD_BUTTON_1;
-    
+
     if (ne > 3)
     {
 	dz = (int) (signed char) ev[3];
@@ -322,7 +322,7 @@ static Bool ps2Parse (KdPointerInfo *pi, unsigned char *ev, int ne)
 	    flagsrelease = KD_BUTTON_5;
 	}
     }
-	
+
     dx = ev[1];
     if (ev[0] & 0x10)
 	dx -= 256;
@@ -407,14 +407,14 @@ static const KmouseProt exps2Prot = {
 #define PSM_4DMOUSE_ID          6
 #define PSM_4DPLUS_ID           8
 
-static unsigned char	ps2_init[] = { 
+static unsigned char	ps2_init[] = {
     PSMC_ENABLE_DEV,
     0,
 };
 
 #define NINIT_PS2   1
 
-static unsigned char    wheel_3button_init[] = { 
+static unsigned char    wheel_3button_init[] = {
     PSMC_SET_SAMPLING_RATE, 200,
     PSMC_SET_SAMPLING_RATE, 100,
     PSMC_SET_SAMPLING_RATE,  80,
@@ -431,7 +431,7 @@ static unsigned char    wheel_5button_init[] = {
     PSMC_SET_SAMPLING_RATE, 200,
     PSMC_SET_SAMPLING_RATE, 200,
     PSMC_SET_SAMPLING_RATE,  80,
-    PSMC_SEND_DEV_ID, 
+    PSMC_SEND_DEV_ID,
     0
 };
 
@@ -439,8 +439,8 @@ static unsigned char    wheel_5button_init[] = {
 
 static unsigned char	intelli_init[] = {
     PSMC_SET_SAMPLING_RATE, 200,
-    PSMC_SET_SAMPLING_RATE, 100, 
-    PSMC_SET_SAMPLING_RATE,  80, 
+    PSMC_SET_SAMPLING_RATE, 100,
+    PSMC_SET_SAMPLING_RATE,  80,
     0
 };
 
@@ -453,7 +453,7 @@ ps2SkipInit (KdPointerInfo *pi, int ninit, Bool ret_next)
     int	    c = -1;
     int	    skipping;
     Bool    waiting;
-    
+
     skipping = 0;
     waiting = FALSE;
     while (ninit || ret_next)
@@ -486,7 +486,7 @@ ps2Init (KdPointerInfo *pi)
     int		    id;
     unsigned char   *init;
     int		    ninit;
-    
+
     /* Send Intellimouse initialization sequence */
     MouseWriteBytes (km->iob.fd, intelli_init, strlen ((char *) intelli_init), 100);
     /*
@@ -530,7 +530,7 @@ static Bool busParse (KdPointerInfo *pi, unsigned char *ev, int ne)
     Kmouse	    *km = pi->driverPrivate;
     int		    dx, dy;
     unsigned long   flags;
-    
+
     flags = KD_MOUSE_DELTA;
     dx = (signed char) ev[1];
     dy = -(signed char) ev[2];
@@ -636,14 +636,14 @@ static Bool logiParse (KdPointerInfo *pi, unsigned char *ev, int ne)
     unsigned long   flags;
 
     flags = KD_MOUSE_DELTA;
-    
+
     if (ne == 3)
     {
 	if (ev[0] & 0x20)
 	    flags |= KD_BUTTON_1;
 	if (ev[0] & 0x10)
 	    flags |= KD_BUTTON_3;
-    
+
 	dx = (signed char)(((ev[0] & 0x03) << 6) | (ev[1] & 0x3F));
 	dy = (signed char)(((ev[0] & 0x0C) << 4) | (ev[2] & 0x3F));
 	flags |= km->state & KD_BUTTON_2;
@@ -686,7 +686,7 @@ static Bool mscParse (KdPointerInfo *pi, unsigned char *ev, int ne)
     unsigned long   flags;
 
     flags = KD_MOUSE_DELTA;
-    
+
     if (!(ev[0] & 0x4))
 	flags |= KD_BUTTON_1;
     if (!(ev[0] & 0x2))
@@ -871,7 +871,7 @@ MouseRead (int mousePort, void *closure)
 		    switch (km->stage)
 		    {
 		    case MouseBroken:
-#ifdef DEBUG			
+#ifdef DEBUG
 			ErrorF ("Mouse protocol %s seems OK\n",
 				km->prot->name);
 #endif
@@ -939,7 +939,7 @@ MouseInit (KdPointerInfo *pi)
 
     if (!pi)
         return BadImplementation;
-    
+
     if (!pi->path || strcmp(pi->path, "auto") == 0) {
         for (i = 0; i < NUM_DEFAULT_MOUSE; i++) {
             fd = open (kdefaultMouse[i], 2);
@@ -952,7 +952,7 @@ MouseInit (KdPointerInfo *pi)
     else {
         fd = open (pi->path, 2);
     }
-	    
+
     if (fd < 0)
         return BadMatch;
 
@@ -1008,7 +1008,7 @@ MouseDisable (KdPointerInfo *pi)
     Kmouse *km;
     if (!pi || !pi->driverPrivate)
         return;
-    
+
     km = pi->driverPrivate;
     KdUnregisterFd (pi, km->iob.fd, TRUE);
 }
diff --git a/hw/kdrive/linux/ms.c b/hw/kdrive/linux/ms.c
index 5786ed1..b6151cd 100644
--- a/hw/kdrive/linux/ms.c
+++ b/hw/kdrive/linux/ms.c
@@ -83,7 +83,7 @@ MsRead (int port, void *closure)
 		flags |= KD_BUTTON_1;
 	    if (b[0] & 0x10)
 		flags |= KD_BUTTON_3;
-	    
+
 	    dx = (char)(((b[0] & 0x03) << 6) | (b[1] & 0x3F));
 	    dy = (char)(((b[0] & 0x0C) << 4) | (b[2] & 0x3F));
             n -= 3;
@@ -103,8 +103,8 @@ MsInit (KdPointerInfo *pi)
         pi->path = strdup("/dev/mouse");
     if (!pi->name)
         pi->name = strdup("Microsoft protocol mouse");
-    
-    return Success; 
+
+    return Success;
 }
 
 static Status
diff --git a/hw/kdrive/linux/ps2.c b/hw/kdrive/linux/ps2.c
index 3967584..552a3c7 100644
--- a/hw/kdrive/linux/ps2.c
+++ b/hw/kdrive/linux/ps2.c
@@ -99,7 +99,7 @@ Ps2Read (int ps2Port, void *closure)
 		flags |= right_button;
 	    if (b[0] & 1)
 		flags |= left_button;
-		
+
 	    dx = b[1];
 	    if (b[0] & 0x10)
 		dx -= 256;
@@ -146,7 +146,7 @@ static Status
 Ps2Enable (KdPointerInfo *pi)
 {
     int fd;
-    
+
     if (!pi)
         return BadImplementation;
 
diff --git a/hw/kdrive/linux/tslib.c b/hw/kdrive/linux/tslib.c
index 7cc23e6..a0b989d 100644
--- a/hw/kdrive/linux/tslib.c
+++ b/hw/kdrive/linux/tslib.c
@@ -9,7 +9,7 @@
  * Copyright © 2002 MontaVista Software Inc.
  * Copyright © 2005 OpenedHand Ltd.
  * Copyright © 2006 Nokia Corporation
- * 
+ *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
  * the above copyright notice appear in all copies and that both that
@@ -76,7 +76,7 @@ TsRead (int fd, void *closure)
         if (event.pressure) {
             flags = KD_BUTTON_1;
 
-            /* 
+            /*
              * Here we test for the touch screen driver actually being on the
              * touch screen, if it is we send absolute coordinates. If not,
              * then we send delta's so that we can track the entire vga screen.
@@ -127,7 +127,7 @@ TslibEnable (KdPointerInfo *pi)
     }
 
     KdRegisterFd(private->fd, TsRead, pi);
-  
+
     return Success;
 }
 
@@ -155,7 +155,7 @@ TslibInit (KdPointerInfo *pi)
 
     if (!pi || !pi->dixdev)
         return !Success;
-    
+
     pi->driverPrivate = (struct TslibPrivate *)
                         xcalloc(sizeof(struct TslibPrivate), 1);
     if (!pi->driverPrivate)
diff --git a/hw/kdrive/src/kcmap.c b/hw/kdrive/src/kcmap.c
index 2c33e79..053e719 100644
--- a/hw/kdrive/src/kcmap.c
+++ b/hw/kdrive/src/kcmap.c
@@ -43,10 +43,10 @@ KdSetColormap (ScreenPtr pScreen, int fb)
 	return;
     if (pScreenPriv->screen->fb[fb].depth > KD_MAX_PSEUDO_DEPTH)
 	return;
-    
+
     if (!pScreenPriv->enabled)
 	return;
-    
+
     if (!pCmap)
 	return;
 
@@ -54,12 +54,12 @@ KdSetColormap (ScreenPtr pScreen, int fb)
      * Make DIX convert pixels into RGB values -- this handles
      * true/direct as well as pseudo/static visuals
      */
-    
+
     for (i = 0; i < (1 << pScreenPriv->screen->fb[fb].depth); i++)
 	pixels[i] = i;
 
     QueryColors (pCmap, (1 << pScreenPriv->screen->fb[fb].depth), pixels, colors);
-    
+
     for (i = 0; i < (1 << pScreenPriv->screen->fb[fb].depth); i++)
     {
 	defs[i].pixel = i;
@@ -187,7 +187,7 @@ KdInstallColormap (ColormapPtr pCmap)
     pScreenPriv->pInstalledmap[fb] = pCmap;
 
     KdSetColormap (pCmap->pScreen, fb);
-    
+
     /* Tell X clients of the new colormap */
     WalkTree(pCmap->pScreen, TellGainedMap, (pointer) &(pCmap->mid));
 }
@@ -195,7 +195,7 @@ KdInstallColormap (ColormapPtr pCmap)
 /*
  * KdUninstallColormap
  *
- * This function uninstalls a colormap by either installing 
+ * This function uninstalls a colormap by either installing
  * the default X colormap or erasing the installed colormap pointer.
  * The default X colormap itself cannot be uninstalled.
  */
@@ -236,7 +236,7 @@ KdListInstalledColormaps (ScreenPtr pScreen, Colormap *pCmaps)
     KdScreenPriv(pScreen);
     int		fb;
     int		n = 0;
-    
+
     for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
     {
 	if (pScreenPriv->pInstalledmap[fb])
@@ -265,16 +265,16 @@ KdStoreColors (ColormapPtr pCmap, int ndef, xColorItem *pdefs)
 
     if (pCmap != pScreenPriv->pInstalledmap[fb])
 	return;
-    
+
     if (!pScreenPriv->card->cfuncs->putColors)
 	return;
-    
+
     if (pScreenPriv->screen->fb[fb].depth > KD_MAX_PSEUDO_DEPTH)
 	return;
-    
+
     if (!pScreenPriv->enabled)
 	return;
-    
+
     /* Check for DirectColor or TrueColor being simulated on a PseudoColor device. */
     pVisual = pCmap->pVisual;
     if ((pVisual->class | DynamicClass) == DirectColor)
@@ -288,7 +288,7 @@ KdStoreColors (ColormapPtr pCmap, int ndef, xColorItem *pdefs)
     }
 
     (*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen, fb, ndef, pdefs);
-    
+
     /* recolor hardware cursor */
     if (pScreenPriv->card->cfuncs->recolorCursor)
 	(*pScreenPriv->card->cfuncs->recolorCursor) (pCmap->pScreen, ndef, pdefs);
diff --git a/hw/kdrive/src/kcurscol.c b/hw/kdrive/src/kcurscol.c
index 6a17df3..2eef6d9 100644
--- a/hw/kdrive/src/kcurscol.c
+++ b/hw/kdrive/src/kcurscol.c
@@ -31,7 +31,7 @@ KdComputeCmapShift (unsigned long mask)
 {
     int	shift;
     unsigned long   bit;
-    
+
     shift = 16;
     bit = 0x80000000;
     while (!(mask & bit))
@@ -47,7 +47,7 @@ KdComputeCmapShift (unsigned long mask)
 void
 KdAllocateCursorPixels (ScreenPtr	pScreen,
 			int		fb,
-			CursorPtr	pCursor, 
+			CursorPtr	pCursor,
 			Pixel		*source,
 			Pixel		*mask)
 {
@@ -77,7 +77,7 @@ KdAllocateCursorPixels (ScreenPtr	pScreen,
 	 */
 	*source = ~0;
 	*mask = ~0;
-	
+
 	sourceColor.red = pCursor->foreRed;
 	sourceColor.green = pCursor->foreGreen;
 	sourceColor.blue = pCursor->foreBlue;
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index 5cfe54f..76c03fd 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -148,9 +148,9 @@ KdSetRootClip (ScreenPtr pScreen, BOOL enable)
 	REGION_EMPTY(pScreen, &pWin->borderClip);
 	REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
     }
-    
+
     ResizeChildrenWinSize (pWin, 0, 0, 0, 0);
-    
+
     if (WasViewable)
     {
 	if (pWin->firstChild)
@@ -185,7 +185,7 @@ void
 KdDisableScreen (ScreenPtr pScreen)
 {
     KdScreenPriv(pScreen);
-    
+
     if (!pScreenPriv->enabled)
 	return;
     if (!pScreenPriv->closed)
@@ -209,7 +209,7 @@ KdDoSwitchCmd (char *reason)
     {
 	char    *command = xalloc (strlen (kdSwitchCmd) +
 				   1 +
-				   strlen (reason) + 
+				   strlen (reason) +
 				   1);
 	if (!command)
 	    return;
@@ -392,7 +392,7 @@ KdParseScreen (KdScreenInfo *screen,
     int	    fb;
     int	    i;
     int	    pixels, mm;
-    
+
     screen->dumb = kdDumbDriver;
     screen->softCursor = kdSoftCursor;
     screen->origin = kdOrigin;
@@ -409,16 +409,16 @@ KdParseScreen (KdScreenInfo *screen,
 	return;
     if (strlen (arg) >= sizeof (save))
 	return;
-    
+
     for (i = 0; i < 2; i++)
     {
 	arg = KdParseFindNext (arg, "x/@XY", save, &delim);
 	if (!save[0])
 	    return;
-	
+
 	pixels = atoi(save);
 	mm = 0;
-	
+
 	if (delim == '/')
 	{
 	    arg = KdParseFindNext (arg, "x at XY", save, &delim);
@@ -426,7 +426,7 @@ KdParseScreen (KdScreenInfo *screen,
 		return;
 	    mm = atoi(save);
 	}
-	
+
 	if (i == 0)
 	{
 	    screen->width = pixels;
@@ -476,7 +476,7 @@ KdParseScreen (KdScreenInfo *screen,
 	arg = KdParseFindNext (arg, "xY", save, &delim);
 	screen->randr |= RR_Reflect_Y;
     }
-    
+
     fb = 0;
     while (fb < KD_MAX_FB)
     {
@@ -691,7 +691,7 @@ KdOsInit (KdOsFuncs *pOsFuncs)
     kdOsFuncs = pOsFuncs;
     if (pOsFuncs)
     {
-	if (serverGeneration == 1) 
+	if (serverGeneration == 1)
 	{
 	    KdDoSwitchCmd ("start");
             if (pOsFuncs->Init)
@@ -704,7 +704,7 @@ Bool
 KdAllocatePrivates (ScreenPtr pScreen)
 {
     KdPrivScreenPtr	pScreenPriv;
-    
+
     if (kdGeneration != serverGeneration)
 	kdGeneration = serverGeneration;
 
@@ -741,20 +741,20 @@ KdCloseScreen (int index, ScreenPtr pScreen)
     KdScreenInfo    *screen = pScreenPriv->screen;
     KdCardInfo	    *card = pScreenPriv->card;
     Bool	    ret;
-    
+
     pScreenPriv->closed = TRUE;
     pScreen->CloseScreen = pScreenPriv->CloseScreen;
     if(pScreen->CloseScreen)
         ret = (*pScreen->CloseScreen) (index, pScreen);
     else
 	ret = TRUE;
-    
+
     if (pScreenPriv->dpmsState != KD_DPMS_NORMAL)
 	(*card->cfuncs->dpms) (pScreen, KD_DPMS_NORMAL);
-    
+
     if (screen->mynum == card->selected)
 	KdDisableScreen (pScreen);
-    
+
     /*
      * Restore video hardware when last screen is closed
      */
@@ -763,7 +763,7 @@ KdCloseScreen (int index, ScreenPtr pScreen)
 	if (kdEnabled && card->cfuncs->restore)
 	    (*card->cfuncs->restore) (card);
     }
-	
+
     if (!pScreenPriv->screen->dumb && card->cfuncs->finiAccel)
 	(*card->cfuncs->finiAccel) (pScreen);
 
@@ -794,9 +794,9 @@ KdCloseScreen (int index, ScreenPtr pScreen)
 	    }
 	}
     }
-    
+
     pScreenPriv->screen->pScreen = 0;
-    
+
     xfree ((pointer) pScreenPriv);
     return ret;
 }
@@ -806,10 +806,10 @@ KdSaveScreen (ScreenPtr pScreen, int on)
 {
     KdScreenPriv(pScreen);
     int	    dpmsState;
-    
+
     if (!pScreenPriv->card->cfuncs->dpms)
 	return FALSE;
-    
+
     dpmsState = pScreenPriv->dpmsState;
     switch (on) {
     case SCREEN_SAVER_OFF:
@@ -861,7 +861,7 @@ KdSetSubpixelOrder (ScreenPtr pScreen, Rotation randr)
     int			subpixel_order = screen->subpixel_order;
     Rotation		subpixel_dir;
     int			i;
-    
+
     static struct {
 	int	    subpixel_order;
 	Rotation    direction;
@@ -874,7 +874,7 @@ KdSetSubpixelOrder (ScreenPtr pScreen, Rotation randr)
 
     static struct {
 	int	bit;
-	int	normal; 
+	int	normal;
 	int	reflect;
     } reflects[] = {
 	{ RR_Reflect_X, SubPixelHorizontalRGB,	SubPixelHorizontalBGR },
@@ -882,7 +882,7 @@ KdSetSubpixelOrder (ScreenPtr pScreen, Rotation randr)
 	{ RR_Reflect_Y, SubPixelVerticalRGB,	SubPixelVerticalBGR },
 	{ RR_Reflect_Y, SubPixelVerticalRGB,	SubPixelVerticalRGB },
     };
-    
+
     /* map subpixel to direction */
     for (i = 0; i < 4; i++)
 	if (orders[i].subpixel_order == subpixel_order)
@@ -890,7 +890,7 @@ KdSetSubpixelOrder (ScreenPtr pScreen, Rotation randr)
     if (i < 4)
     {
 	subpixel_dir = KdAddRotation (randr & RR_Rotate_All, orders[i].direction);
-	
+
 	/* map back to subpixel order */
 	for (i = 0; i < 4; i++)
 	    if (orders[i].direction & subpixel_dir)
@@ -931,7 +931,7 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
     KdAllocatePrivates (pScreen);
 
     pScreenPriv = KdGetScreenPriv(pScreen);
-    
+
     if (!rotated)
     {
 	width = screen->width;
@@ -963,10 +963,10 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
      * our GC functions; fbFinishScreenInit initializes MI
      * backing store
      */
-    if (!fbSetupScreen (pScreen, 
-			screen->fb[0].frameBuffer, 
-			width, height, 
-			monitorResolution, monitorResolution, 
+    if (!fbSetupScreen (pScreen,
+			screen->fb[0].frameBuffer,
+			width, height,
+			monitorResolution, monitorResolution,
 			screen->fb[0].pixelStride,
 			screen->fb[0].bitsPerPixel))
     {
@@ -980,17 +980,17 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
     pScreen->UninstallColormap	= KdUninstallColormap;
     pScreen->ListInstalledColormaps = KdListInstalledColormaps;
     pScreen->StoreColors	= KdStoreColors;
-     
+
     pScreen->SaveScreen		= KdSaveScreen;
     pScreen->CreateWindow	= KdCreateWindow;
 
 #if KD_MAX_FB > 1
     if (screen->fb[1].depth)
     {
-	if (!fbOverlayFinishScreenInit (pScreen, 
-					screen->fb[0].frameBuffer, 
-					screen->fb[1].frameBuffer, 
-					width, height, 
+	if (!fbOverlayFinishScreenInit (pScreen,
+					screen->fb[0].frameBuffer,
+					screen->fb[1].frameBuffer,
+					width, height,
 					monitorResolution, monitorResolution,
 					screen->fb[0].pixelStride,
 					screen->fb[1].pixelStride,
@@ -1005,8 +1005,8 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
     else
 #endif
     {
-	if (!fbFinishScreenInit (pScreen, 
-				 screen->fb[0].frameBuffer, 
+	if (!fbFinishScreenInit (pScreen,
+				 screen->fb[0].frameBuffer,
 				 width, height,
 				 monitorResolution, monitorResolution,
 				 screen->fb[0].pixelStride,
@@ -1015,7 +1015,7 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
 	    return FALSE;
 	}
     }
-    
+
     /*
      * Fix screen sizes; for some reason mi takes dpi instead of mm.
      * Rounding errors are annoying
@@ -1028,14 +1028,14 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
 	pScreen->mmHeight = *height_mmp;
     else
 	*height_mmp = pScreen->mmHeight;
-    
+
     /*
      * Plug in our own block/wakeup handlers.
      * miScreenInit installs NoopDDA in both places
      */
     pScreen->BlockHandler	= KdBlockHandler;
     pScreen->WakeupHandler	= KdWakeupHandler;
-    
+
 #ifdef RENDER
     if (!fbPictureInit (pScreen, 0, 0))
 	return FALSE;
@@ -1043,26 +1043,26 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
     if (card->cfuncs->initScreen)
 	if (!(*card->cfuncs->initScreen) (pScreen))
 	    return FALSE;
-	    
+
     if (!screen->dumb && card->cfuncs->initAccel)
 	if (!(*card->cfuncs->initAccel) (pScreen))
 	    screen->dumb = TRUE;
-    
+
     if (card->cfuncs->finishInitScreen)
 	if (!(*card->cfuncs->finishInitScreen) (pScreen))
 	    return FALSE;
-	    
+
 #if 0
     fbInitValidateTree (pScreen);
 #endif
-    
+
 #if 0
     pScreen->backingStoreSupport = Always;
     miInitializeBackingStore (pScreen);
 #endif
 
 
-    /* 
+    /*
      * Wrap CloseScreen, the order now is:
      *	KdCloseScreen
      *	miBSCloseScreen
@@ -1073,9 +1073,9 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
 
     pScreenPriv->CreateScreenResources = pScreen->CreateScreenResources;
     pScreen->CreateScreenResources = KdCreateScreenResources;
-    
+
     if (screen->softCursor ||
-	!card->cfuncs->initCursor || 
+	!card->cfuncs->initCursor ||
 	!(*card->cfuncs->initCursor) (pScreen))
     {
 	/* Use MI for cursor display and event queueing. */
@@ -1083,7 +1083,7 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
 	miDCInitialize(pScreen, &kdPointerScreenFuncs);
     }
 
-    
+
     if (!fbCreateDefColormap (pScreen))
     {
 	return FALSE;
@@ -1100,7 +1100,7 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
 	if(kdOsFuncs->Enable)
 	    (*kdOsFuncs->Enable) ();
     }
-    
+
     if (screen->mynum == card->selected)
     {
 	if(card->cfuncs->preserve)
@@ -1115,7 +1115,7 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
 	if (!screen->dumb && card->cfuncs->enableAccel)
 	    (*card->cfuncs->enableAccel) (pScreen);
     }
-    
+
     return TRUE;
 }
 
@@ -1126,9 +1126,9 @@ KdInitScreen (ScreenInfo    *pScreenInfo,
 	      char	    **argv)
 {
     KdCardInfo	*card = screen->card;
-    
+
     (*card->cfuncs->scrinit) (screen);
-    
+
     if (!card->cfuncs->initAccel)
 	screen->dumb = TRUE;
     if (!card->cfuncs->initCursor)
@@ -1166,26 +1166,26 @@ KdSetPixmapFormats (ScreenInfo	*pScreenInfo)
 		    bpp = 32;
 		if (!depthToBpp[screen->fb[fb].depth])
 		    depthToBpp[screen->fb[fb].depth] = bpp;
-		else if (depthToBpp[screen->fb[fb].depth] != bpp) 
+		else if (depthToBpp[screen->fb[fb].depth] != bpp)
 		    return FALSE;
 	    }
 	}
     }
-    
+
     /*
      * Fill in additional formats
      */
     for (i = 0; i < NUM_KD_DEPTHS; i++)
 	if (!depthToBpp[kdDepths[i].depth])
 	    depthToBpp[kdDepths[i].depth] = kdDepths[i].bpp;
-	
+
     pScreenInfo->imageByteOrder     = IMAGE_BYTE_ORDER;
     pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
     pScreenInfo->bitmapScanlinePad  = BITMAP_SCANLINE_PAD;
     pScreenInfo->bitmapBitOrder     = BITMAP_BIT_ORDER;
-    
+
     pScreenInfo->numPixmapFormats = 0;
-    
+
     for (i = 1; i <= 32; i++)
     {
 	if (depthToBpp[i])
@@ -1196,7 +1196,7 @@ KdSetPixmapFormats (ScreenInfo	*pScreenInfo)
 	    format->scanlinePad = BITMAP_SCANLINE_PAD;
 	}
     }
-    
+
     return TRUE;
 }
 
@@ -1215,7 +1215,7 @@ KdAddScreen (ScreenInfo	    *pScreenInfo,
 	unsigned long	visuals;
 	Pixel		rm, gm, bm;
 	int		fb;
-	
+
 	visuals = 0;
 	rm = gm = bm = 0;
 	for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
@@ -1236,7 +1236,7 @@ KdAddScreen (ScreenInfo	    *pScreenInfo,
     }
 
     kdCurrentScreen = screen;
-    
+
     AddScreen (KdScreenInit, argc, argv);
 }
 
@@ -1292,14 +1292,14 @@ KdInitOutput (ScreenInfo    *pScreenInfo,
 		KdInitScreen (pScreenInfo, screen, argc, argv);
 	}
     }
-    
+
     /*
      * Merge the various pixmap formats together, this can fail
      * when two screens share depth but not bitsPerPixel
      */
     if (!KdSetPixmapFormats (pScreenInfo))
 	return;
-    
+
     /*
      * Add all of the screens
      */
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index 9620391..2041d71 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -242,7 +242,7 @@ struct _KdPointerInfo {
         int z;
         int flags;
         int absrel;
-    } heldEvent;         
+    } heldEvent;
     unsigned char         buttonState;
     Bool                  transformCoordinates;
     int                   pressureThreshold;
@@ -421,7 +421,7 @@ KdStoreColors (ColormapPtr pCmap, int ndef, xColorItem *pdefs);
 void
 KdAllocateCursorPixels (ScreenPtr	pScreen,
 			int		fb,
-			CursorPtr	pCursor, 
+			CursorPtr	pCursor,
 			Pixel		*source,
 			Pixel		*mask);
 
@@ -517,13 +517,13 @@ void
 KdInitOutput (ScreenInfo    *pScreenInfo,
 	      int	    argc,
 	      char	    **argv);
- 
+
 void
 KdSetSubpixelOrder (ScreenPtr pScreen, Rotation randr);
 
 void
 KdBacktrace (int signum);
-    
+
 /* kinfo.c */
 KdCardInfo *
 KdCardInfoAdd (KdCardFuncs  *funcs,
@@ -584,7 +584,7 @@ _KdEnqueuePointerEvent(KdPointerInfo *pi, int type, int x, int y, int z,
 
 void
 KdReleaseAllKeys (void);
-    
+
 void
 KdSetLed (KdKeyboardInfo *ki, int led, Bool on);
 
@@ -604,7 +604,7 @@ KdBlockHandler (int		screen,
 		pointer		readmask);
 
 void
-KdWakeupHandler (int		screen, 
+KdWakeupHandler (int		screen,
 		 pointer    	data,
 		 unsigned long	result,
 		 pointer	readmask);
@@ -669,14 +669,14 @@ KdTuneMode (KdScreenInfo    *screen,
 
 #ifdef RANDR
 Bool
-KdRandRGetInfo (ScreenPtr pScreen, 
+KdRandRGetInfo (ScreenPtr pScreen,
 		int randr,
-		Bool (*supported) (ScreenPtr pScreen, 
+		Bool (*supported) (ScreenPtr pScreen,
 				   const KdMonitorTiming *));
 
 const KdMonitorTiming *
 KdRandRGetTiming (ScreenPtr	    pScreen,
-		  Bool		    (*supported) (ScreenPtr pScreen, 
+		  Bool		    (*supported) (ScreenPtr pScreen,
 						  const KdMonitorTiming *),
 		  int		    rate,
 		  RRScreenSizePtr   pSize);
@@ -691,7 +691,7 @@ KdShadowFbFree (KdScreenInfo *screen, int fb);
 
 Bool
 KdShadowSet (ScreenPtr pScreen, int randr, ShadowUpdateProc update, ShadowWindowProc window);
-    
+
 void
 KdShadowUnset (ScreenPtr pScreen);
 
diff --git a/hw/kdrive/src/kinfo.c b/hw/kdrive/src/kinfo.c
index 4551fd7..af64156 100644
--- a/hw/kdrive/src/kinfo.c
+++ b/hw/kdrive/src/kinfo.c
@@ -155,10 +155,10 @@ KdFreePointer(KdPointerInfo *pi)
 
     if (prev)
         xfree(prev);
-    
+
     xfree(pi);
 }
- 
+
 void
 KdFreeKeyboard(KdKeyboardInfo *ki)
 {
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 09b5d3b..a88f2dc 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -76,7 +76,7 @@ static KdPointerMatrix	kdPointerMatrix = {
 };
 
 void KdResetInputMachine (void);
-    
+
 #define KD_MAX_INPUT_FDS    8
 
 typedef struct _kdInputFd {
@@ -105,7 +105,7 @@ static void
 KdBlockSigio (void)
 {
     sigset_t	set;
-    
+
     sigemptyset (&set);
     sigaddset (&set, SIGIO);
     sigprocmask (SIG_BLOCK, &set, 0);
@@ -115,7 +115,7 @@ static void
 KdUnblockSigio (void)
 {
     sigset_t	set;
-    
+
     sigemptyset (&set);
     sigaddset (&set, SIGIO);
     sigprocmask (SIG_UNBLOCK, &set, 0);
@@ -175,7 +175,7 @@ KdAddFd (int fd)
 {
     struct sigaction	act;
     sigset_t		set;
-    
+
     kdnFds++;
     fcntl (fd, F_SETOWN, getpid());
     KdNonBlockFd (fd);
@@ -196,7 +196,7 @@ KdRemoveFd (int fd)
 {
     struct sigaction	act;
     int			flags;
-    
+
     kdnFds--;
     RemoveEnabledDevice (fd);
     flags = fcntl (fd, F_GETFL);
@@ -324,7 +324,7 @@ KdEnableInput (void)
     InternalEvent ev;
     KdKeyboardInfo *ki;
     KdPointerInfo *pi;
-    
+
     kdInputEnabled = TRUE;
 
     for (ki = kdKeyboards; ki; ki = ki->next) {
@@ -352,7 +352,7 @@ KdFindKeyboardDriver (char *name)
     /* ask a stupid question ... */
     if (!name)
         return NULL;
-    
+
     for (ret = kdKeyboardDrivers; ret; ret = ret->next) {
         if (strcmp(ret->name, name) == 0)
             return ret;
@@ -487,11 +487,11 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
                           pi->name ? pi->name : "Generic KDrive Pointer");
 
 	return Success;
-	
+
     case DEVICE_ON:
         if (pDev->on == TRUE)
             return Success;
-        
+
         if (!pi->driver->Enable) {
             ErrorF("no enable function\n");
             return BadImplementation;
@@ -538,7 +538,7 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
         (*pi->driver->Fini) (pi);
 
         KdRemovePointer(pi);
-        
+
         return Success;
     }
 
@@ -557,7 +557,7 @@ KdBell (int volume, DeviceIntPtr pDev, pointer arg, int something)
 {
     KeybdCtrl *ctrl = arg;
     KdKeyboardInfo *ki = NULL;
-    
+
     for (ki = kdKeyboards; ki; ki = ki->next) {
         if (ki->dixdev && ki->dixdev->id == pDev->id)
             break;
@@ -565,7 +565,7 @@ KdBell (int volume, DeviceIntPtr pDev, pointer arg, int something)
 
     if (!ki || !ki->dixdev || ki->dixdev->id != pDev->id || !ki->driver)
         return;
-    
+
     KdRingBell(ki, volume, ctrl->bell_pitch, ctrl->bell_duration);
 }
 
@@ -590,7 +590,7 @@ KdRingBell(KdKeyboardInfo *ki, int volume, int pitch, int duration)
 {
     if (!ki || !ki->driver || !ki->driver->Bell)
         return;
-        
+
     if (kdInputEnabled)
         (*ki->driver->Bell) (ki, volume, pitch, duration);
 }
@@ -691,7 +691,7 @@ KdKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl)
 
     KdSetLeds(ki, ctrl->leds);
     ki->bellPitch = ctrl->bell_pitch;
-    ki->bellDuration = ctrl->bell_duration; 
+    ki->bellDuration = ctrl->bell_duration;
 }
 
 extern KeybdCtrl defaultKeyboardControl;
@@ -794,7 +794,7 @@ KdKeyboardProc(DeviceIntPtr pDevice, int onoff)
         pDev->on = FALSE;
 
         return Success;
-        
+
         break;
 
     case DEVICE_CLOSE:
@@ -935,7 +935,7 @@ KdAddKeyboard (KdKeyboardInfo *ki)
 
     if (!ki)
         return !Success;
-    
+
     ki->dixdev = AddInputDevice(serverClient, KdKeyboardProc, TRUE);
     if (!ki->dixdev) {
         ErrorF("Couldn't register keyboard device %s\n",
@@ -1042,12 +1042,12 @@ KdRemovePointer (KdPointerInfo *pi)
     KdFreePointer(pi);
 }
 
-/* 
+/*
  * You can call your kdriver server with something like:
  * $ ./hw/kdrive/yourserver/X :1 -mouse evdev,,device=/dev/input/event4 -keybd
- * evdev,,device=/dev/input/event1,xkbmodel=abnt2,xkblayout=br 
+ * evdev,,device=/dev/input/event1,xkbmodel=abnt2,xkblayout=br
  */
-static Bool 
+static Bool
 KdGetOptions (InputOption **options, char *string)
 {
     InputOption     *newopt = NULL, **tmpo = NULL;
@@ -1058,7 +1058,7 @@ KdGetOptions (InputOption **options, char *string)
         return FALSE;
 
     for (tmpo = options; *tmpo; tmpo = &(*tmpo)->next)
-        ; /* Hello, I'm here */ 
+        ; /* Hello, I'm here */
     *tmpo = newopt;
 
     if (strchr(string, '='))
@@ -1099,7 +1099,7 @@ KdParseKbdOptions (KdKeyboardInfo *ki)
         else if (!strcasecmp (option->key, "device"))
             ki->path = strdup(option->value);
         else
-           ErrorF("Kbd option key (%s) of value (%s) not assigned!\n", 
+           ErrorF("Kbd option key (%s) of value (%s) not assigned!\n",
                     option->key, option->value);
     }
 }
@@ -1160,11 +1160,11 @@ KdParseKeyboard (char *arg)
     {
         arg = KdParseFindNext (arg, ",", save, &delim);
 
-	if (!KdGetOptions(&options, save)) 
+	if (!KdGetOptions(&options, save))
 	{
 	    KdFreeKeyboard(ki);
 	    return NULL;
-        }    
+        }
     }
 
     if (options)
@@ -1196,7 +1196,7 @@ KdParsePointerOptions (KdPointerInfo *pi)
         else if (!strcasecmp (option->key, "protocol"))
             pi->protocol = strdup(option->value);
         else
-            ErrorF("Pointer option key (%s) of value (%s) not assigned!\n", 
+            ErrorF("Pointer option key (%s) of value (%s) not assigned!\n",
                     option->key, option->value);
     }
 }
@@ -1448,7 +1448,7 @@ KdInitInput (void)
  *	<>  -> (deliver) synthetic_2_down_1
  *	k   -> (deliver) synthetic_2_down_1
  */
- 
+
 typedef enum _inputClass {
     down_1, up_1,
     down_2, up_2,
@@ -1628,7 +1628,7 @@ KdInsideEmulationWindow (KdPointerInfo *pi, int x, int y, int z)
     return (abs (pi->emulationDx) < EMULATION_WINDOW &&
 	    abs (pi->emulationDy) < EMULATION_WINDOW);
 }
-				     
+
 static KdInputClass
 KdClassifyInput (KdPointerInfo *pi, int type, int x, int y, int z, int b)
 {
@@ -1906,7 +1906,7 @@ KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry,
 
     if (!pi)
 	return;
-    
+
     ms = GetTimeInMillis();
 
     /* we don't need to transform z, so we don't. */
@@ -2001,7 +2001,7 @@ KdBlockHandler (int		screen,
 	if (pi->timeoutPending)
 	{
 	    int	ms;
-    
+
 	    ms = pi->emulationTimeout - GetTimeInMillis ();
 	    if (ms < 1)
 		ms = 1;
@@ -2020,7 +2020,7 @@ KdBlockHandler (int		screen,
 }
 
 void
-KdWakeupHandler (int		screen, 
+KdWakeupHandler (int		screen,
 		 pointer    	data,
 		 unsigned long	lresult,
 		 pointer	readmask)
@@ -2029,7 +2029,7 @@ KdWakeupHandler (int		screen,
     fd_set	*pReadmask = (fd_set *) readmask;
     int		i;
     KdPointerInfo	*pi;
-    
+
     if (kdInputEnabled && result > 0)
     {
 	for (i = 0; i < kdNumInputFds; i++)
@@ -2069,13 +2069,13 @@ KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
     int		best_x, best_y;
     int		n_best_x, n_best_y;
     CARD32	ms;
-    
+
     if (kdDisableZaphod || screenInfo.numScreens <= 1)
 	return FALSE;
 
     if (0 <= *x && *x < pScreen->width && 0 <= *y && *y < pScreen->height)
 	return FALSE;
-	
+
     ms = GetTimeInMillis ();
     if (kdOffScreen && (int) (ms - kdOffScreenTime) < 1000)
 	return FALSE;
@@ -2088,7 +2088,7 @@ KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
     for (n = 0; n < screenInfo.numScreens; n++)
     {
 	pNewScreen = screenInfo.screens[n];
-	if (pNewScreen == pScreen) 
+	if (pNewScreen == pScreen)
 	    continue;
 	dx = KdScreenOrigin(pNewScreen)->x - KdScreenOrigin(pScreen)->x;
 	dy = KdScreenOrigin(pNewScreen)->y - KdScreenOrigin(pScreen)->y;
@@ -2130,17 +2130,17 @@ KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
     if (n_best_x == -1)
 	return FALSE;
     pNewScreen = screenInfo.screens[n_best_x];
-    
+
     if (*x < 0)
 	*x += pNewScreen->width;
     if (*y < 0)
 	*y += pNewScreen->height;
-    
+
     if (*x >= pScreen->width)
 	*x -= pScreen->width;
     if (*y >= pScreen->height)
 	*y -= pScreen->height;
-    
+
     *ppScreen = pNewScreen;
     return TRUE;
 }
@@ -2167,7 +2167,7 @@ KdWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
     KdUnblockSigio ();
 }
 
-miPointerScreenFuncRec kdPointerScreenFuncs = 
+miPointerScreenFuncRec kdPointerScreenFuncs =
 {
     KdCursorOffScreen,
     KdCrossScreen,
diff --git a/hw/kdrive/src/kmap.c b/hw/kdrive/src/kmap.c
index 60e8ae1..2bf0840 100644
--- a/hw/kdrive/src/kmap.c
+++ b/hw/kdrive/src/kmap.c
@@ -45,7 +45,7 @@ KdMapDevice (CARD32 addr, CARD32 size)
     DRAW_DEBUG ((DEBUG_S3INIT, "Virtual address of 0x%x is 0x%x", addr, d));
     a = VirtualCopyAddr (addr);
     DRAW_DEBUG ((DEBUG_S3INIT, "Translated address is 0x%x", a));
-    if (!VirtualCopy (d, a, size, 
+    if (!VirtualCopy (d, a, size,
 		      PAGE_READWRITE|PAGE_NOCACHE|PAGE_PHYSICAL))
     {
 	DRAW_DEBUG ((DEBUG_FAILURE, "VirtualCopy failed %d",
@@ -67,7 +67,7 @@ KdMapDevice (CARD32 addr, CARD32 size)
     if (fd < 0)
 	FatalError ("KdMapDevice: failed to open /dev/mem (%s)\n",
 		    strerror (errno));
-    
+
     a = mmap ((caddr_t) 0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, addr);
     close (fd);
     if ((long) a == -1)
@@ -124,7 +124,7 @@ KdSetMappedMode (CARD32 addr, CARD32 size, int mode)
 	sentry.base = base;
 	sentry.size = nsize;
 	sentry.type = type;
-	
+
 	if (ioctl (mtrr, MTRRIOC_ADD_ENTRY, &sentry) < 0)
 	    ErrorF ("MTRRIOC_ADD_ENTRY failed 0x%x 0x%x %d (%s)\n",
 		    base, bound - base, type, strerror(errno));
@@ -163,7 +163,7 @@ KdResetMappedMode (CARD32 addr, CARD32 size, int mode)
 	sentry.base = base;
 	sentry.size = nsize;
 	sentry.type = type;
-	
+
 	if (ioctl (mtrr, MTRRIOC_DEL_ENTRY, &sentry) < 0)
 	    ErrorF ("MTRRIOC_DEL_ENTRY failed 0x%x 0x%x %d (%s)\n",
 		    base, bound - base, type, strerror(errno));
diff --git a/hw/kdrive/src/kmode.c b/hw/kdrive/src/kmode.c
index d02cb55..1c3c240 100644
--- a/hw/kdrive/src/kmode.c
+++ b/hw/kdrive/src/kmode.c
@@ -15,7 +15,7 @@
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
  * Author:  Keith Packard, SuSE, Inc.
@@ -38,7 +38,7 @@ const KdMonitorTiming  kdMonitorTimings[] = {
 	            17,	    12,	    32,     KdSyncNegative,
 	            1,      11,     14,     KdSyncNegative,
     },
-    
+
     /* Other VESA modes */
     {	640,	350,	85,	31500,			    /* VESA */
 		    32,	    96,	    192,    KdSyncPositive, /* 26.413 */
@@ -60,7 +60,7 @@ const KdMonitorTiming  kdMonitorTimings[] = {
         16,     80,  160, KdSyncPositive, /* 32.954 */
         1,      45,   49, KdSyncPositive, /* 52.727 */
     },
-    
+
     /* 640x480 modes */
     {	640,	480,	85,	36000,			    /* VESA */
 		    56,	    80,	    192,    KdSyncNegative, /* 43.269 */
@@ -78,7 +78,7 @@ const KdMonitorTiming  kdMonitorTimings[] = {
 		   16,	    48,	    160,    KdSyncNegative, /* 31.469 */
 		   10,	    33,	    45,	    KdSyncNegative, /* 59.940 */
     },
-    
+
     /* 800x600 modes */
     {	800,	600,	85,	56250,			    /* VESA */
 		    32,	    152,    248,    KdSyncPositive, /* 53.674 */
@@ -102,7 +102,7 @@ const KdMonitorTiming  kdMonitorTimings[] = {
 		    24,	    128,    224,    KdSyncPositive, /* 35.156 */
 		    1,	    22,	    25,	    KdSyncPositive, /* 56.250 */
     },
-    
+
     /* 1024x768 modes */
     {	1024,	768,	85,	94500,			    /* VESA */
 		    48,	    208,    352,    KdSyncPositive, /* 68.677 */
@@ -120,13 +120,13 @@ const KdMonitorTiming  kdMonitorTimings[] = {
 		    24,	    160,    320,    KdSyncNegative, /* 48.363 */
 		    3,	    29,	    38,	    KdSyncNegative, /* 60.004 */
     },
-    
+
     /* 1152x864 mode */
     {	1152,	864,	75,	108000,			    /* VESA */
 		    64,	    256,    448,    KdSyncPositive, /* 67.500 */
 		    1,	    32,	    36,	    KdSyncPositive, /* 75.000 */
     },
-    
+
     /* 1152x900 modes */
     {	1152,	900,	85,	122500,			    /* ADDED */
 		    48,	    208,    384,    KdSyncPositive, /* 79.753 */
@@ -315,7 +315,7 @@ KdTuneMode (KdScreenInfo    *screen,
 					  const KdMonitorTiming *))
 {
     const KdMonitorTiming   *t;
-    
+
     while (!(*usable) (screen))
     {
 	/*
@@ -327,7 +327,7 @@ KdTuneMode (KdScreenInfo    *screen,
 	    screen->fb[0].depth = 16;
 	else if (screen->fb[0].depth > 8)
 	    screen->fb[0].depth = 8;
-	else 
+	else
 	{
 	    t = kdFindPrevSize (KdFindMode (screen, supported));
 	    if (!t)
@@ -344,14 +344,14 @@ KdTuneMode (KdScreenInfo    *screen,
 Bool
 KdRandRGetInfo (ScreenPtr pScreen,
 		int randr,
-		Bool (*supported) (ScreenPtr pScreen, 
+		Bool (*supported) (ScreenPtr pScreen,
 				   const KdMonitorTiming *))
 {
     KdScreenPriv(pScreen);
     KdScreenInfo	    *screen = pScreenPriv->screen;
     int			    i;
     const KdMonitorTiming   *t;
-    
+
     for (i = 0, t = kdMonitorTimings; i < NUM_MONITOR_TIMINGS; i++, t++)
     {
 	if ((*supported) (pScreen, t))
@@ -373,20 +373,20 @@ KdRandRGetInfo (ScreenPtr pScreen,
 		RRSetCurrentConfig (pScreen, randr, t->rate, pSize);
 	}
     }
-    
+
     return TRUE;
 }
 
 const KdMonitorTiming *
 KdRandRGetTiming (ScreenPtr	    pScreen,
-		  Bool		    (*supported) (ScreenPtr pScreen, 
+		  Bool		    (*supported) (ScreenPtr pScreen,
 						  const KdMonitorTiming *),
 		  int		    rate,
 		  RRScreenSizePtr   pSize)
 {
     int			    i;
     const KdMonitorTiming   *t;
-    
+
     for (i = 0, t = kdMonitorTimings; i < NUM_MONITOR_TIMINGS; i++, t++)
     {
 	if (t->horizontal == pSize->width &&
diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index 9a74654..1ceb8c6 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -1,6 +1,6 @@
-/* 
+/*
 
-   XFree86 Xv DDX written by Mark Vojkovich (markv at valinux.com) 
+   XFree86 Xv DDX written by Mark Vojkovich (markv at valinux.com)
    Adapted for KDrive by Pontus Lidman <pontus.lidman at nokia.com>
 
    Copyright (C) 2000, 2001 - Nokia Home Communications
@@ -67,29 +67,29 @@ static int KdXVQueryAdaptors(ScreenPtr, XvAdaptorPtr *, int *);
 static int KdXVAllocatePort(unsigned long, XvPortPtr, XvPortPtr*);
 static int KdXVFreePort(XvPortPtr);
 static int KdXVPutVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
-   				INT16, INT16, CARD16, CARD16, 
+   				INT16, INT16, CARD16, CARD16,
 				INT16, INT16, CARD16, CARD16);
 static int KdXVPutStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
-   				INT16, INT16, CARD16, CARD16, 
+   				INT16, INT16, CARD16, CARD16,
 				INT16, INT16, CARD16, CARD16);
 static int KdXVGetVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
-   				INT16, INT16, CARD16, CARD16, 
+   				INT16, INT16, CARD16, CARD16,
 				INT16, INT16, CARD16, CARD16);
 static int KdXVGetStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
-   				INT16, INT16, CARD16, CARD16, 
+   				INT16, INT16, CARD16, CARD16,
 				INT16, INT16, CARD16, CARD16);
 static int KdXVStopVideo(ClientPtr, XvPortPtr, DrawablePtr);
 static int KdXVSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32);
 static int KdXVGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32 *);
 static int KdXVQueryBestSize(ClientPtr, XvPortPtr, CARD8,
-   				CARD16, CARD16,CARD16, CARD16, 
+   				CARD16, CARD16,CARD16, CARD16,
 				unsigned int*, unsigned int*);
 static int KdXVPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
-   				INT16, INT16, CARD16, CARD16, 
+   				INT16, INT16, CARD16, CARD16,
 				INT16, INT16, CARD16, CARD16,
 				XvImagePtr, unsigned char*, Bool,
 				CARD16, CARD16);
-static int KdXVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr, 
+static int KdXVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr,
 				CARD16*, CARD16*, int*, int*);
 
 
@@ -134,12 +134,12 @@ KdXVRegisterGenericAdaptorDriver(
 
 /*   fprintf(stderr,"KdXVRegisterGenericAdaptorDriver\n"); */
 
-  newdrivers = xrealloc(GenDrivers, sizeof(KdXVInitGenericAdaptorPtr) * 
+  newdrivers = xrealloc(GenDrivers, sizeof(KdXVInitGenericAdaptorPtr) *
 			(1 + NumGenDrivers));
   if (!newdrivers)
     return 0;
   GenDrivers = newdrivers;
-  
+
   GenDrivers[NumGenDrivers++] = InitFunc;
 
   return 1;
@@ -184,7 +184,7 @@ KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr)
 
 Bool
 KdXVScreenInit(
-   ScreenPtr pScreen, 
+   ScreenPtr pScreen,
    KdVideoAdaptorPtr *adaptors,
    int num
 ){
@@ -197,7 +197,7 @@ KdXVScreenInit(
       KdXVGeneration = serverGeneration;
 
   if(!XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc)
-	return FALSE;  
+	return FALSE;
 
   if(Success != (*XvScreenInitProc)(pScreen)) return FALSE;
 
@@ -259,7 +259,7 @@ KdXVFreeAdaptor(XvAdaptorPtr pAdaptor)
       xfree(pAdaptor->pEncodings);
    }
 
-   if(pAdaptor->pFormats) 
+   if(pAdaptor->pFormats)
       xfree(pAdaptor->pFormats);
 
    if(pAdaptor->pPorts) {
@@ -269,9 +269,9 @@ KdXVFreeAdaptor(XvAdaptorPtr pAdaptor)
       for(i = 0; i < pAdaptor->nPorts; i++, pPort++) {
           pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
 	  if(pPriv) {
-	     if(pPriv->clientClip) 
+	     if(pPriv->clientClip)
 		REGION_DESTROY(pAdaptor->pScreen, pPriv->clientClip);
-             if(pPriv->pCompositeClip && pPriv->FreeCompositeClip) 
+             if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
 		REGION_DESTROY(pAdaptor->pScreen, pPriv->pCompositeClip);
 	     xfree(pPriv);
 	  }
@@ -291,14 +291,14 @@ KdXVFreeAdaptor(XvAdaptorPtr pAdaptor)
 
    if(pAdaptor->nImages)
       xfree(pAdaptor->pImages);
-	
+
    if(pAdaptor->devPriv.ptr)
       xfree(pAdaptor->devPriv.ptr);
 }
 
 static Bool
 KdXVInitAdaptors(
-   ScreenPtr pScreen, 
+   ScreenPtr pScreen,
    KdVideoAdaptorPtr *infoPtr,
    int number
 ) {
@@ -329,7 +329,7 @@ KdXVInitAdaptors(
   pxvs->nAdaptors = 0;
   pxvs->pAdaptors = NULL;
 
-  if(!(pAdaptor = xcalloc(number, sizeof(XvAdaptorRec)))) 
+  if(!(pAdaptor = xcalloc(number, sizeof(XvAdaptorRec))))
       return FALSE;
 
   for(pa = pAdaptor, na = 0, numAdaptor = 0; na < number; na++, adaptorPtr++) {
@@ -343,7 +343,7 @@ KdXVInitAdaptors(
       if(!adaptorPtr->nEncodings || !adaptorPtr->pEncodings)
 	   continue;
 
-      pa->type = adaptorPtr->type; 
+      pa->type = adaptorPtr->type;
 
       if(!adaptorPtr->PutVideo && !adaptorPtr->GetVideo)
 	 pa->type &= ~XvVideoMask;
@@ -354,19 +354,19 @@ KdXVInitAdaptors(
       if(!adaptorPtr->PutImage || !adaptorPtr->QueryImageAttributes)
 	 pa->type &= ~XvImageMask;
 
-      if(!adaptorPtr->PutVideo && !adaptorPtr->PutImage && 
+      if(!adaptorPtr->PutVideo && !adaptorPtr->PutImage &&
 							  !adaptorPtr->PutStill)
 	 pa->type &= ~XvInputMask;
 
       if(!adaptorPtr->GetVideo && !adaptorPtr->GetStill)
 	 pa->type &= ~XvOutputMask;
-	 
-      if(!(adaptorPtr->type & (XvPixmapMask | XvWindowMask))) 
+
+      if(!(adaptorPtr->type & (XvPixmapMask | XvWindowMask)))
 	  continue;
-      if(!(adaptorPtr->type & (XvImageMask | XvVideoMask | XvStillMask))) 
+      if(!(adaptorPtr->type & (XvImageMask | XvVideoMask | XvStillMask)))
 	  continue;
 
-      pa->pScreen = pScreen; 
+      pa->pScreen = pScreen;
       pa->ddAllocatePort = KdXVAllocatePort;
       pa->ddFreePort = KdXVFreePort;
       pa->ddPutVideo = KdXVPutVideo;
@@ -385,8 +385,8 @@ KdXVInitAdaptors(
       if(adaptorPtr->nEncodings &&
 	(pEncode = xcalloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) {
 
-	for(pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0; 
-	    i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++) 
+	for(pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0;
+	    i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++)
         {
 	    pe->id = encodingPtr->id;
 	    pe->pScreen = pScreen;
@@ -398,14 +398,14 @@ KdXVInitAdaptors(
 	    pe->rate.denominator = encodingPtr->rate.denominator;
 	}
 	pa->nEncodings = adaptorPtr->nEncodings;
-	pa->pEncodings = pEncode;  
-      } 
+	pa->pEncodings = pEncode;
+      }
 
       if(adaptorPtr->nImages &&
          (pImage = xcalloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
 
           for(i = 0, pi = pImage, imagePtr = adaptorPtr->pImages;
-	      i < adaptorPtr->nImages; i++, pi++, imagePtr++) 
+	      i < adaptorPtr->nImages; i++, pi++, imagePtr++)
   	  {
 	     pi->id = imagePtr->id;
 	     pi->type = imagePtr->type;
@@ -437,8 +437,8 @@ KdXVInitAdaptors(
       if(adaptorPtr->nAttributes &&
 	(pAttribute = xcalloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec))))
       {
-	for(pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = 0; 
-	    i < adaptorPtr->nAttributes; pat++, i++, attributePtr++) 
+	for(pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = 0;
+	    i < adaptorPtr->nAttributes; pat++, i++, attributePtr++)
         {
 	    pat->flags = attributePtr->flags;
 	    pat->min_value = attributePtr->min_value;
@@ -447,8 +447,8 @@ KdXVInitAdaptors(
                 strcpy(pat->name, attributePtr->name);
 	}
 	pa->nAttributes = adaptorPtr->nAttributes;
-	pa->pAttributes = pAttribute;  
-      } 
+	pa->pAttributes = pAttribute;
+      }
 
 
       totFormat = adaptorPtr->nFormats;
@@ -457,8 +457,8 @@ KdXVInitAdaptors(
           KdXVFreeAdaptor(pa);
           continue;
       }
-      for(pf = pFormat, i = 0, numFormat = 0, formatPtr = adaptorPtr->pFormats; 
-	  i < adaptorPtr->nFormats; i++, formatPtr++) 
+      for(pf = pFormat, i = 0, numFormat = 0, formatPtr = adaptorPtr->pFormats;
+	  i < adaptorPtr->nFormats; i++, formatPtr++)
       {
 	  numVisuals = pScreen->numVisuals;
           pVisual = pScreen->visuals;
@@ -468,26 +468,26 @@ KdXVInitAdaptors(
                  (pVisual->nplanes == formatPtr->depth)) {
 
 		   if(numFormat >= totFormat) {
-			void *moreSpace; 
+			void *moreSpace;
 			totFormat *= 2;
-			moreSpace = xrealloc(pFormat, 
+			moreSpace = xrealloc(pFormat,
 					     totFormat * sizeof(XvFormatRec));
 			if(!moreSpace) break;
 			pFormat = moreSpace;
 			pf = pFormat + numFormat;
 		   }
 
-                   pf->visual = pVisual->vid; 
+                   pf->visual = pVisual->vid;
 		   pf->depth = formatPtr->depth;
 
 		   pf++;
 		   numFormat++;
               }
               pVisual++;
-          }	
+          }
       }
       pa->nFormats = numFormat;
-      pa->pFormats = pFormat;  
+      pa->pFormats = pFormat;
       if(!numFormat) {
           KdXVFreeAdaptor(pa);
           continue;
@@ -517,15 +517,15 @@ KdXVInitAdaptors(
           KdXVFreeAdaptor(pa);
           continue;
       }
-      for(pp = pPort, i = 0, numPort = 0; 
+      for(pp = pPort, i = 0, numPort = 0;
 	  i < adaptorPtr->nPorts; i++) {
 
-          if(!(pp->id = FakeClientID(0))) 
+          if(!(pp->id = FakeClientID(0)))
 		continue;
 
-	  if(!(portPriv = xcalloc(1, sizeof(XvPortRecPrivate)))) 
+	  if(!(portPriv = xcalloc(1, sizeof(XvPortRecPrivate))))
 		continue;
-	  
+
 	  if(!AddResource(pp->id, PortResource, pp)) {
 		xfree(portPriv);
 		continue;
@@ -542,7 +542,7 @@ KdXVInitAdaptors(
 	  portPriv->screen = screen;
 	  portPriv->AdaptorRec = adaptorPriv;
           portPriv->DevPriv.ptr = adaptorPtr->pPortPrivates[i].ptr;
-	
+
           pp++;
           numPort++;
       }
@@ -554,7 +554,7 @@ KdXVInitAdaptors(
       }
 
       pa->base_id = pPort->id;
-      
+
       pa++;
       numAdaptor++;
   }
@@ -580,13 +580,13 @@ KdXVInitAdaptors(
    the GC and used it's clip list when they needed to reclip the window,
    even if the client clip was different from the one the video was
    initialized with.  If the original GC was destroyed, they had to stop
-   the video.  I like the new method better (MArk). 
+   the video.  I like the new method better (MArk).
 
    This function only works for windows.  Will need to rewrite when
    (if) we support pixmap rendering.
 */
 
-static void  
+static void
 KdXVUpdateCompositeClip(XvPortRecPrivatePtr portPriv)
 {
    RegionPtr	pregWin, pCompositeClip;
@@ -623,7 +623,7 @@ KdXVUpdateCompositeClip(XvPortRecPrivatePtr portPriv)
 
    if(freeCompClip) {
    	REGION_DESTROY(pWin->pScreen, pregWin);
-   }    
+   }
 }
 
 /* Save the current clientClip and update the CompositeClip whenever
@@ -631,7 +631,7 @@ KdXVUpdateCompositeClip(XvPortRecPrivatePtr portPriv)
 
 static void
 KdXVCopyClip(
-   XvPortRecPrivatePtr portPriv, 
+   XvPortRecPrivatePtr portPriv,
    GCPtr pGC
 ){
     /* copy the new clip if it exists */
@@ -672,12 +672,12 @@ KdXVRegetVideo(XvPortRecPrivatePtr portPriv)
   WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
   WinBox.x2 = WinBox.x1 + portPriv->drw_w;
   WinBox.y2 = WinBox.y1 + portPriv->drw_h;
-  
+
   /* clip to the window composite clip */
   REGION_INIT(portPriv->pDraw->pScreen, &WinRegion, &WinBox, 1);
   REGION_INIT(portPriv->pDraw->pScreen, &ClipRegion, NullBox, 1);
-  REGION_INTERSECT(portPriv->pDraw->pScreen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); 
-  
+  REGION_INTERSECT(portPriv->pDraw->pScreen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
+
   /* that's all if it's totally obscured */
   if(!REGION_NOTEMPTY(portPriv->pDraw->pScreen, &ClipRegion)) {
 	clippedAway = TRUE;
@@ -689,10 +689,10 @@ KdXVRegetVideo(XvPortRecPrivatePtr portPriv)
   }
 
   ret = (*portPriv->AdaptorRec->GetVideo)(portPriv->screen, portPriv->pDraw,
-			portPriv->vid_x, portPriv->vid_y, 
-			WinBox.x1, WinBox.y1, 
-			portPriv->vid_w, portPriv->vid_h, 
-			portPriv->drw_w, portPriv->drw_h, 
+			portPriv->vid_x, portPriv->vid_y,
+			WinBox.x1, WinBox.y1,
+			portPriv->vid_w, portPriv->vid_h,
+			portPriv->drw_w, portPriv->drw_h,
 			&ClipRegion, portPriv->DevPriv.ptr);
 
   if(ret == Success)
@@ -736,11 +736,11 @@ KdXVReputVideo(XvPortRecPrivatePtr portPriv)
   WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
   WinBox.x2 = WinBox.x1 + portPriv->drw_w;
   WinBox.y2 = WinBox.y1 + portPriv->drw_h;
-  
+
   /* clip to the window composite clip */
   REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
   REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
-  REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); 
+  REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
 
   /* clip and translate to the viewport */
   if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
@@ -753,10 +753,10 @@ KdXVReputVideo(XvPortRecPrivatePtr portPriv)
      VPBox.y2 = screen->height;
 
      REGION_INIT(pScreen, &VPReg, &VPBox, 1);
-     REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); 
+     REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg);
      REGION_UNINIT(pScreen, &VPReg);
   }
-  
+
   /* that's all if it's totally obscured */
   if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
 	clippedAway = TRUE;
@@ -767,8 +767,8 @@ KdXVReputVideo(XvPortRecPrivatePtr portPriv)
   if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
      BoxPtr clipBox = REGION_RECTS(&ClipRegion);
      if(  (REGION_NUM_RECTS(&ClipRegion) != 1) ||
-	  (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || 
-	  (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) 
+	  (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+	  (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
      {
 	    clippedAway = TRUE;
 	    goto CLIP_VIDEO_BAILOUT;
@@ -780,10 +780,10 @@ KdXVReputVideo(XvPortRecPrivatePtr portPriv)
   }
 
   ret = (*portPriv->AdaptorRec->PutVideo)(portPriv->screen, portPriv->pDraw,
-			portPriv->vid_x, portPriv->vid_y, 
+			portPriv->vid_x, portPriv->vid_y,
 			WinBox.x1, WinBox.y1,
-			portPriv->vid_w, portPriv->vid_h, 
-			portPriv->drw_w, portPriv->drw_h, 
+			portPriv->vid_w, portPriv->vid_h,
+			portPriv->drw_w, portPriv->drw_h,
 			&ClipRegion, portPriv->DevPriv.ptr);
 
   if(ret == Success) portPriv->isOn = XV_ON;
@@ -825,11 +825,11 @@ KdXVReputImage(XvPortRecPrivatePtr portPriv)
   WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
   WinBox.x2 = WinBox.x1 + portPriv->drw_w;
   WinBox.y2 = WinBox.y1 + portPriv->drw_h;
-  
+
   /* clip to the window composite clip */
   REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
   REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
-  REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); 
+  REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
 
   /* clip and translate to the viewport */
   if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
@@ -842,10 +842,10 @@ KdXVReputImage(XvPortRecPrivatePtr portPriv)
      VPBox.y2 = screen->height;
 
      REGION_INIT(pScreen, &VPReg, &VPBox, 1);
-     REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); 
+     REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg);
      REGION_UNINIT(pScreen, &VPReg);
   }
-  
+
   /* that's all if it's totally obscured */
   if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
 	clippedAway = TRUE;
@@ -856,8 +856,8 @@ KdXVReputImage(XvPortRecPrivatePtr portPriv)
   if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
      BoxPtr clipBox = REGION_RECTS(&ClipRegion);
      if(  (REGION_NUM_RECTS(&ClipRegion) != 1) ||
-	  (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || 
-	  (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) 
+	  (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+	  (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
      {
 	    clippedAway = TRUE;
 	    goto CLIP_VIDEO_BAILOUT;
@@ -897,10 +897,10 @@ static int
 KdXVReputAllVideo(WindowPtr pWin, pointer data)
 {
     KdXVWindowPtr WinPriv;
-    
+
     if (pWin->drawable.type != DRAWABLE_WINDOW)
 	return WT_DONTWALKCHILDREN;
-    
+
     WinPriv = GET_KDXV_WINDOW(pWin);
 
     while(WinPriv) {
@@ -917,7 +917,7 @@ KdXVReputAllVideo(WindowPtr pWin, pointer data)
 static int
 KdXVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
 {
-   KdXVWindowPtr winPriv, PrivRoot;    
+   KdXVWindowPtr winPriv, PrivRoot;
 
    winPriv = PrivRoot = GET_KDXV_WINDOW(pWin);
 
@@ -934,7 +934,7 @@ KdXVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
 	winPriv->PortRec = portPriv;
 	winPriv->next = PrivRoot;
 	dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv);
-   }   
+   }
    return Success;
 }
 
@@ -948,14 +948,14 @@ KdXVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
 
      while(winPriv) {
 	if(winPriv->PortRec == portPriv) {
-	    if(prevPriv) 
+	    if(prevPriv)
 		prevPriv->next = winPriv->next;
-	    else 
+	    else
 		dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv->next);
 	    xfree(winPriv);
 	    break;
 	}
-	prevPriv = winPriv; 
+	prevPriv = winPriv;
 	winPriv = winPriv->next;
      }
      portPriv->pDraw = NULL;
@@ -1033,7 +1033,7 @@ KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
 
   /* filter out XClearWindow/Area */
   if (!pWin->valdata) return;
-   
+
   pPrev = NULL;
 
   while(WinPriv) {
@@ -1044,10 +1044,10 @@ KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
      switch(pPriv->type) {
      case XvInputMask:
 	KdXVReputVideo(pPriv);
-	break;	     
+	break;
      case XvOutputMask:
-	KdXVRegetVideo(pPriv);	
-	break;     
+	KdXVRegetVideo(pPriv);
+	break;
      default:  /* overlaid still/image*/
 	if (pPriv->AdaptorRec->ReputImage)
 	   KdXVReputImage(pPriv);
@@ -1061,7 +1061,7 @@ KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
 	    }
 	    pPriv->pDraw = NULL;
 
-	    if(!pPrev) 
+	    if(!pPrev)
 		dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, WinPriv->next);
 	    else
 	       pPrev->next = WinPriv->next;
@@ -1078,7 +1078,7 @@ KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
 }
 
 
-static void 
+static void
 KdXVClipNotify(WindowPtr pWin, int dx, int dy)
 {
   ScreenPtr pScreen = pWin->drawable.pScreen;
@@ -1097,7 +1097,7 @@ KdXVClipNotify(WindowPtr pWin, int dx, int dy)
 
      pPriv->pCompositeClip = NULL;
 
-     /* Stop everything except images, but stop them too if the 
+     /* Stop everything except images, but stop them too if the
 	window isn't visible.  But we only remove the images. */
 
      if(pPriv->type || !visible) {
@@ -1110,7 +1110,7 @@ KdXVClipNotify(WindowPtr pWin, int dx, int dy)
 	if(!pPriv->type) {  /* overlaid still/image */
 	    pPriv->pDraw = NULL;
 
-	    if(!pPrev) 
+	    if(!pPrev)
 		dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, WinPriv->next);
 	    else
 	       pPrev->next = WinPriv->next;
@@ -1153,7 +1153,7 @@ KdXVCloseScreen(int i, ScreenPtr pScreen)
 
 /*   fprintf(stderr,"XV: Unwrapping screen funcs\n"); */
 
-  for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) { 
+  for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) {
        KdXVFreeAdaptor(pa);
   }
 
@@ -1193,9 +1193,9 @@ KdXVEnable(ScreenPtr pScreen)
 {
     if (!KdXVRunning (pScreen))
 	return TRUE;
-    
-    WalkTree(pScreen, KdXVReputAllVideo, 0); 
- 
+
+    WalkTree(pScreen, KdXVReputAllVideo, 0);
+
     return TRUE;
 }
 
@@ -1214,7 +1214,7 @@ KdXVDisable(ScreenPtr pScreen)
 
     pxvs = GET_XV_SCREEN(pScreen);
     ScreenPriv = GET_KDXV_SCREEN(pScreen);
-    
+
     for(i = 0; i < pxvs->nAdaptors; i++) {
 	pAdaptor = &pxvs->pAdaptors[i];
 	for(j = 0; j < pAdaptor->nPorts; j++) {
@@ -1263,8 +1263,8 @@ KdXVPutVideo(
    DrawablePtr pDraw,
    XvPortPtr pPort,
    GCPtr pGC,
-   INT16 vid_x, INT16 vid_y, 
-   CARD16 vid_w, CARD16 vid_h, 
+   INT16 vid_x, INT16 vid_y,
+   CARD16 vid_w, CARD16 vid_h,
    INT16 drw_x, INT16 drw_y,
    CARD16 drw_w, CARD16 drw_h
 ){
@@ -1277,7 +1277,7 @@ KdXVPutVideo(
       pPort->pDraw = (DrawablePtr)NULL;
       return BadAlloc;
   }
-  
+
   /* If we are changing windows, unregister our port in the old window */
   if(portPriv->pDraw && (portPriv->pDraw != pDraw))
      KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
@@ -1302,7 +1302,7 @@ KdXVPutVideo(
   pPort->pDraw = pDraw;
 
   if (!pScreenPriv->enabled) return Success;
-  
+
   return(KdXVReputVideo(portPriv));
 }
 
@@ -1312,13 +1312,13 @@ KdXVPutStill(
    DrawablePtr pDraw,
    XvPortPtr pPort,
    GCPtr pGC,
-   INT16 vid_x, INT16 vid_y, 
-   CARD16 vid_w, CARD16 vid_h, 
+   INT16 vid_x, INT16 vid_y,
+   CARD16 vid_w, CARD16 vid_h,
    INT16 drw_x, INT16 drw_y,
    CARD16 drw_w, CARD16 drw_h
 ){
   XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
-  ScreenPtr pScreen = pDraw->pScreen;  
+  ScreenPtr pScreen = pDraw->pScreen;
   KdScreenPriv(pScreen);
   KdScreenInfo *screen=pScreenPriv->screen;
   RegionRec WinRegion;
@@ -1336,10 +1336,10 @@ KdXVPutStill(
   WinBox.y1 = pDraw->y + drw_y;
   WinBox.x2 = WinBox.x1 + drw_w;
   WinBox.y2 = WinBox.y1 + drw_h;
-  
+
   REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
   REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
-  REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);   
+  REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);
 
   if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
      RegionRec VPReg;
@@ -1351,7 +1351,7 @@ KdXVPutStill(
      VPBox.y2 = screen->height;
 
      REGION_INIT(pScreen, &VPReg, &VPBox, 1);
-     REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); 
+     REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg);
      REGION_UNINIT(pScreen, &VPReg);
   }
 
@@ -1367,7 +1367,7 @@ KdXVPutStill(
   if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
      BoxPtr clipBox = REGION_RECTS(&ClipRegion);
      if(  (REGION_NUM_RECTS(&ClipRegion) != 1) ||
-	  (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || 
+	  (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
 	  (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
      {
 	  clippedAway = TRUE;
@@ -1417,8 +1417,8 @@ KdXVGetVideo(
    DrawablePtr pDraw,
    XvPortPtr pPort,
    GCPtr pGC,
-   INT16 vid_x, INT16 vid_y, 
-   CARD16 vid_w, CARD16 vid_h, 
+   INT16 vid_x, INT16 vid_y,
+   CARD16 vid_w, CARD16 vid_h,
    INT16 drw_x, INT16 drw_y,
    CARD16 drw_w, CARD16 drw_h
 ){
@@ -1431,7 +1431,7 @@ KdXVGetVideo(
       pPort->pDraw = (DrawablePtr)NULL;
       return BadAlloc;
   }
-  
+
   /* If we are changing windows, unregister our port in the old window */
   if(portPriv->pDraw && (portPriv->pDraw != pDraw))
      KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
@@ -1454,7 +1454,7 @@ KdXVGetVideo(
 
   /* To indicate to the DI layer that we were successful */
   pPort->pDraw = pDraw;
-  
+
   if(!pScreenPriv->enabled) return Success;
 
   return(KdXVRegetVideo(portPriv));
@@ -1466,8 +1466,8 @@ KdXVGetStill(
    DrawablePtr pDraw,
    XvPortPtr pPort,
    GCPtr pGC,
-   INT16 vid_x, INT16 vid_y, 
-   CARD16 vid_w, CARD16 vid_h, 
+   INT16 vid_x, INT16 vid_y,
+   CARD16 vid_w, CARD16 vid_h,
    INT16 drw_x, INT16 drw_y,
    CARD16 drw_w, CARD16 drw_h
 ){
@@ -1489,10 +1489,10 @@ KdXVGetStill(
   WinBox.y1 = pDraw->y + drw_y;
   WinBox.x2 = WinBox.x1 + drw_w;
   WinBox.y2 = WinBox.y1 + drw_h;
-  
+
   REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
   REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
-  REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);   
+  REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);
 
   if(portPriv->pDraw) {
      KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
@@ -1526,7 +1526,7 @@ GET_STILL_BAILOUT:
   return ret;
 }
 
- 
+
 
 static int
 KdXVStopVideo(
@@ -1539,7 +1539,7 @@ KdXVStopVideo(
 
   if(pDraw->type != DRAWABLE_WINDOW)
       return BadAlloc;
-  
+
   KdXVRemovePortFromWindow((WindowPtr)pDraw, portPriv);
 
   if(!pScreenPriv->enabled) return Success;
@@ -1563,8 +1563,8 @@ KdXVSetPortAttribute(
    INT32 value
 ){
   XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
-     
-  return((*portPriv->AdaptorRec->SetPortAttribute)(portPriv->screen, 
+
+  return((*portPriv->AdaptorRec->SetPortAttribute)(portPriv->screen,
 		attribute, value, portPriv->DevPriv.ptr));
 }
 
@@ -1577,8 +1577,8 @@ KdXVGetPortAttribute(
    INT32 *p_value
 ){
   XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
-     
-  return((*portPriv->AdaptorRec->GetPortAttribute)(portPriv->screen, 
+
+  return((*portPriv->AdaptorRec->GetPortAttribute)(portPriv->screen,
 		attribute, (int *) p_value, portPriv->DevPriv.ptr));
 }
 
@@ -1594,8 +1594,8 @@ KdXVQueryBestSize(
    unsigned int *p_w, unsigned int *p_h
 ){
   XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
-     
-  (*portPriv->AdaptorRec->QueryBestSize)(portPriv->screen, 
+
+  (*portPriv->AdaptorRec->QueryBestSize)(portPriv->screen,
 		(Bool)motion, vid_w, vid_h, drw_w, drw_h,
 		p_w, p_h, portPriv->DevPriv.ptr);
 
@@ -1603,14 +1603,14 @@ KdXVQueryBestSize(
 }
 
 
-static int 
+static int
 KdXVPutImage(
-   ClientPtr client, 
-   DrawablePtr pDraw, 
-   XvPortPtr pPort, 
+   ClientPtr client,
+   DrawablePtr pDraw,
+   XvPortPtr pPort,
    GCPtr pGC,
-   INT16 src_x, INT16 src_y, 
-   CARD16 src_w, CARD16 src_h, 
+   INT16 src_x, INT16 src_y,
+   CARD16 src_w, CARD16 src_h,
    INT16 drw_x, INT16 drw_y,
    CARD16 drw_w, CARD16 drw_h,
    XvImagePtr format,
@@ -1636,10 +1636,10 @@ KdXVPutImage(
   WinBox.y1 = pDraw->y + drw_y;
   WinBox.x2 = WinBox.x1 + drw_w;
   WinBox.y2 = WinBox.y1 + drw_h;
-  
+
   REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
   REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
-  REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);   
+  REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);
 
   if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
      RegionRec VPReg;
@@ -1651,7 +1651,7 @@ KdXVPutImage(
      VPBox.y2 = pScreen->height;
 
      REGION_INIT(pScreen, &VPReg, &VPBox, 1);
-     REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); 
+     REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg);
      REGION_UNINIT(pScreen, &VPReg);
   }
 
@@ -1667,7 +1667,7 @@ KdXVPutImage(
   if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
      BoxPtr clipBox = REGION_RECTS(&ClipRegion);
      if(  (REGION_NUM_RECTS(&ClipRegion) != 1) ||
-	  (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || 
+	  (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
 	  (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
      {
 	  clippedAway = TRUE;
@@ -1712,19 +1712,19 @@ PUT_IMAGE_BAILOUT:
 }
 
 
-static  int 
+static  int
 KdXVQueryImageAttributes(
-   ClientPtr client, 
+   ClientPtr client,
    XvPortPtr pPort,
-   XvImagePtr format, 
-   CARD16 *width, 
-   CARD16 *height, 
+   XvImagePtr format,
+   CARD16 *width,
+   CARD16 *height,
    int *pitches,
    int *offsets
 ){
   XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
 
-  return (*portPriv->AdaptorRec->QueryImageAttributes)(portPriv->screen, 
+  return (*portPriv->AdaptorRec->QueryImageAttributes)(portPriv->screen,
 			format->id, width, height, pitches, offsets);
 }
 
@@ -1878,7 +1878,7 @@ KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg)
     xRectangle	*rects, *r;
     BoxPtr	pBox = REGION_RECTS (pRgn);
     int		nBox = REGION_NUM_RECTS (pRgn);
-    
+
     rects = xalloc (nBox * sizeof (xRectangle));
     if (!rects)
 	goto bail0;
@@ -1892,18 +1892,18 @@ KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg)
 	r++;
 	pBox++;
     }
-    
+
     pGC = GetScratchGC (pDraw->depth, pDraw->pScreen);
     if (!pGC)
 	goto bail1;
-    
+
     val[0] = fg;
     val[1] = IncludeInferiors;
     ChangeGC (pGC, GCForeground|GCSubwindowMode, val);
-    
+
     ValidateGC (pDraw, pGC);
-    
-    (*pGC->ops->PolyFillRect) (pDraw, pGC, 
+
+    (*pGC->ops->PolyFillRect) (pDraw, pGC,
 			       REGION_NUM_RECTS (pRgn), rects);
 
     FreeScratchGC (pGC);
diff --git a/hw/kdrive/src/kxv.h b/hw/kdrive/src/kxv.h
index 900baef..21a295b 100644
--- a/hw/kdrive/src/kxv.h
+++ b/hw/kdrive/src/kxv.h
@@ -1,6 +1,6 @@
-/* 
+/*
 
-   XFree86 Xv DDX written by Mark Vojkovich (markv at valinux.com) 
+   XFree86 Xv DDX written by Mark Vojkovich (markv at valinux.com)
    Adapted for KDrive by Pontus Lidman <pontus.lidman at nokia.com>
 
    Copyright (C) 2000, 2001 - Nokia Home Communications
@@ -60,21 +60,21 @@ typedef struct {
   int id;
   int type;
   int byte_order;
-  unsigned char guid[16];               
+  unsigned char guid[16];
   int bits_per_pixel;
   int format;
   int num_planes;
 
   /* for RGB formats only */
   int depth;
-  unsigned int red_mask;       
-  unsigned int green_mask;   
-  unsigned int blue_mask;   
+  unsigned int red_mask;
+  unsigned int green_mask;
+  unsigned int blue_mask;
 
   /* for YUV formats only */
   unsigned int y_sample_bits;
   unsigned int u_sample_bits;
-  unsigned int v_sample_bits;   
+  unsigned int v_sample_bits;
   unsigned int horz_y_period;
   unsigned int horz_u_period;
   unsigned int horz_v_period;
@@ -83,7 +83,7 @@ typedef struct {
   unsigned int vert_v_period;
   char component_order[32];
   int scanline_order;
-} KdImageRec, *KdImagePtr; 
+} KdImageRec, *KdImagePtr;
 
 
 typedef struct {
@@ -92,7 +92,7 @@ typedef struct {
   unsigned short width, height;
   int *pitches; /* bytes */
   int *offsets; /* in bytes from start of framebuffer */
-  DevUnion devPrivate;  
+  DevUnion devPrivate;
 } KdSurfaceRec, *KdSurfacePtr;
 
 
@@ -118,7 +118,7 @@ typedef int (* SetPortAttributeFuncPtr)(KdScreenInfo * screen, Atom attribute,
 typedef int (* GetPortAttributeFuncPtr)(KdScreenInfo * screen, Atom attribute,
 	int *value, pointer data);
 typedef void (* QueryBestSizeFuncPtr)(KdScreenInfo * screen, Bool motion,
-	short vid_w, short vid_h, short drw_w, short drw_h, 
+	short vid_w, short vid_h, short drw_w, short drw_h,
 	unsigned int *p_w, unsigned int *p_h, pointer data);
 typedef int (* PutImageFuncPtr)( KdScreenInfo * screen,  DrawablePtr pDraw,
 	short src_x, short src_y, short drw_x, short drw_y,
@@ -128,8 +128,8 @@ typedef int (* PutImageFuncPtr)( KdScreenInfo * screen,  DrawablePtr pDraw,
 typedef int (* ReputImageFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
 				  short drw_x, short drw_y,
 				  RegionPtr clipBoxes, pointer data );
-typedef int (*QueryImageAttributesFuncPtr)(KdScreenInfo * screen, 
-	int image, unsigned short *width, unsigned short *height, 
+typedef int (*QueryImageAttributesFuncPtr)(KdScreenInfo * screen,
+	int image, unsigned short *width, unsigned short *height,
 	int *pitches, int *offsets);
 
 typedef enum {
@@ -148,7 +148,7 @@ typedef struct {
 } KdVideoEncodingRec, *KdVideoEncodingPtr;
 
 typedef struct {
-  char 	depth;  
+  char 	depth;
   short class;
 } KdVideoFormatRec, *KdVideoFormatPtr;
 
@@ -160,13 +160,13 @@ typedef struct {
 } KdAttributeRec, *KdAttributePtr;
 
 typedef struct {
-  unsigned int type; 
+  unsigned int type;
   int flags;
   char *name;
   int nEncodings;
-  KdVideoEncodingPtr pEncodings;  
+  KdVideoEncodingPtr pEncodings;
   int nFormats;
-  KdVideoFormatPtr pFormats;  
+  KdVideoFormatPtr pFormats;
   int nPorts;
   DevUnion *pPortPrivates;
   int nAttributes;
@@ -188,7 +188,7 @@ typedef struct {
 
 Bool
 KdXVScreenInit(
-   ScreenPtr pScreen, 
+   ScreenPtr pScreen,
    KdVideoAdaptorPtr 	*Adaptors,
    int num
 );
@@ -239,7 +239,7 @@ typedef struct {
 } KdXVScreenRec, *KdXVScreenPtr;
 
 typedef struct {
-  int flags;  
+  int flags;
   PutVideoFuncPtr PutVideo;
   PutStillFuncPtr PutStill;
   GetVideoFuncPtr GetVideo;
@@ -276,4 +276,4 @@ typedef struct _KdXVWindowRec{
 } KdXVWindowRec, *KdXVWindowPtr;
 
 #endif  /* _XVDIX_H_ */
- 
+
-- 
1.6.3.3



More information about the xorg-devel mailing list