]> code.ossystems Code Review - openembedded-core.git/commitdiff
Add hide cursor and root ppm patch
authorMatthew Allum <mallum@openedhand.com>
Mon, 22 Jan 2007 16:31:21 +0000 (16:31 +0000)
committerMatthew Allum <mallum@openedhand.com>
Mon, 22 Jan 2007 16:31:21 +0000 (16:31 +0000)
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@1191 311d38ba-8fff-0310-9ca6-ca027cbcb966

meta/packages/xorg-xserver/xserver-kdrive/hide-cursor-and-ppm-root.patch [new file with mode: 0644]
meta/packages/xorg-xserver/xserver-kdrive_X11R7.1-1.1.0.bb

diff --git a/meta/packages/xorg-xserver/xserver-kdrive/hide-cursor-and-ppm-root.patch b/meta/packages/xorg-xserver/xserver-kdrive/hide-cursor-and-ppm-root.patch
new file mode 100644 (file)
index 0000000..c160cd4
--- /dev/null
@@ -0,0 +1,307 @@
+diff -u -r xorg-server-X11R7.1-1.1.0.orig/dix/window.c xorg-server-X11R7.1-1.1.0/dix/window.c
+--- xorg-server-X11R7.1-1.1.0.orig/dix/window.c        2007-01-08 14:30:38.000000000 +0000
++++ xorg-server-X11R7.1-1.1.0/dix/window.c     2007-01-16 17:16:19.000000000 +0000
+@@ -185,6 +185,8 @@
+ _X_EXPORT int numSaveUndersViewable = 0;
+ _X_EXPORT int deltaSaveUndersViewable = 0;
++char* RootPPM = NULL;
++
+ #ifdef DEBUG
+ /******
+  * PrintWindowTree
+@@ -311,6 +313,115 @@
+ #endif
+ }
++static int
++get_int(FILE *fp)
++{
++  int c = 0;
++
++  while ((c = getc(fp)) != EOF)
++    {
++      if (isspace(c))
++      continue;
++
++      if (c == '#')
++      while (c = getc(fp))
++        if (c == EOF)
++          return 0;
++        else if (c == '\n')
++          break;
++
++      if (isdigit(c)) 
++      {
++        int val = c - '0';
++        while ((c = getc(fp)) && isdigit(c))
++          val = (val * 10) + (c - '0');
++        return val;
++      }
++    }
++
++  return 0;
++}
++
++static unsigned char*
++ppm_load (const char* path, int depth, int *width, int *height)
++{
++  FILE *fp;
++  int   max, n = 0, w, h, i, j, bytes_per_line;
++  unsigned char *data, *res, h1, h2;
++
++  if (depth < 16 || depth > 32)
++    return NULL;
++
++  if (depth > 16)
++    depth = 32;
++
++  fp = fopen (path, "r");
++  if (fp == NULL)
++    return FALSE;
++
++  h1 = getc(fp);
++  h2 = getc(fp);
++
++  /* magic is 'P6' for raw ppm */
++  if (h1 != 'P' && h2 != '6')
++      goto fail;
++
++  w = get_int(fp);
++  h = get_int(fp);
++
++  if (w == 0 || h == 0)
++    goto fail;
++
++  max = get_int(fp);
++
++  if (max != 255)
++      goto fail;
++
++  bytes_per_line = ((w * depth + 31) >> 5) << 2;
++
++  res = data = malloc(bytes_per_line * h);
++
++  for (i=0; i<h; i++)
++    {
++      for (j=0; j<w; j++)
++      {
++        unsigned char buf[3];
++        fread(buf, 1, 3, fp);
++        
++        switch (depth)
++          {
++          case 24:
++          case 32:
++            *data     = buf[2];
++            *(data+1) = buf[1];
++            *(data+2) = buf[0];
++            data += 4;
++            break;
++          case 16:
++          default:
++            *(unsigned short*)data
++              = ((buf[0] >> 3) << 11) | ((buf[1] >> 2) << 5) | (buf[2] >> 3);
++            data += 2;
++            break;
++          }
++      }
++      data += (bytes_per_line - (w*(depth>>3)));
++    }
++
++  data = res;
++
++  *width  = w;
++  *height = h;
++
++  fclose(fp);
++
++  return res;
++
++ fail:
++  fclose(fp);
++  return NULL;
++}
++
+ static void
+ MakeRootTile(WindowPtr pWin)
+ {
+@@ -321,6 +432,36 @@
+     register unsigned char *from, *to;
+     register int i, j;
++    if (RootPPM != NULL)
++      {
++      int            w, h;
++      unsigned char *data;
++
++      if ((data = ppm_load (RootPPM, pScreen->rootDepth, &w, &h)) != NULL)
++        {
++          pWin->background.pixmap 
++            = (*pScreen->CreatePixmap)(pScreen, w, h, pScreen->rootDepth);
++
++          pWin->backgroundState = BackgroundPixmap;
++          pGC = GetScratchGC(pScreen->rootDepth, pScreen);
++          if (!pWin->background.pixmap || !pGC)
++            FatalError("could not create root tile");
++
++          ValidateGC((DrawablePtr)pWin->background.pixmap, pGC);
++
++          (*pGC->ops->PutImage)((DrawablePtr)pWin->background.pixmap, 
++                                pGC, 
++                                pScreen->rootDepth,
++                                0, 0, w, h, 0, ZPixmap, (char *)data);
++          FreeScratchGC(pGC);
++          
++          free(data);
++          return;
++        }
++      else
++        ErrorF("Unable to load root window image.");
++      }
++
+     pWin->background.pixmap = (*pScreen->CreatePixmap)(pScreen, 4, 4,
+                                                   pScreen->rootDepth);
+@@ -357,6 +498,7 @@
+ }
++
+ WindowPtr
+ AllocateWindow(ScreenPtr pScreen)
+ {
+diff -u -r xorg-server-X11R7.1-1.1.0.orig/hw/kdrive/src/kdrive.c xorg-server-X11R7.1-1.1.0/hw/kdrive/src/kdrive.c
+--- xorg-server-X11R7.1-1.1.0.orig/hw/kdrive/src/kdrive.c      2007-01-08 14:30:38.000000000 +0000
++++ xorg-server-X11R7.1-1.1.0/hw/kdrive/src/kdrive.c   2007-01-15 17:53:06.000000000 +0000
+@@ -58,6 +58,9 @@
+     { 32, 32 }
+ };
++int 
++ProcXFixesHideCursor (ClientPtr client) ;
++
+ #define NUM_KD_DEPTHS (sizeof (kdDepths) / sizeof (kdDepths[0]))
+ int                 kdScreenPrivateIndex;
+@@ -84,6 +87,9 @@
+ KdOsFuncs     *kdOsFuncs;
+ extern WindowPtr *WindowTable;
++extern Bool CursorInitiallyHidden; /* See Xfixes cursor.c */
++extern char* RootPPM;            /* dix/window.c */
++
+ void
+ KdSetRootClip (ScreenPtr pScreen, BOOL enable)
+ {
+@@ -312,6 +318,7 @@
+     KdSetRootClip (pScreen, TRUE);
+     if (pScreenPriv->card->cfuncs->dpms)
+       (*pScreenPriv->card->cfuncs->dpms) (pScreen, pScreenPriv->dpmsState);
++
+     return TRUE;
+ }
+@@ -686,10 +693,14 @@
+     ErrorF("-mouse path[,n]  Filename of mouse device, n is number of buttons\n");
+     ErrorF("-switchCmd       Command to execute on vt switch\n");
+     ErrorF("-nozap           Don't terminate server on Ctrl+Alt+Backspace\n");
++    ErrorF("-hide-cursor     Start with cursor hidden\n");
++    ErrorF("-root-ppm [path] Specify ppm file to use as root window background.\n");
+     ErrorF("vtxx             Use virtual terminal xx instead of the next available\n");
+ #ifdef PSEUDO8
+     p8UseMsg ();
+ #endif
++
++
+ }
+ int
+@@ -761,6 +772,19 @@
+       kdSoftCursor = TRUE;
+       return 1;
+     }
++    if (!strcmp (argv[i], "-hide-cursor"))
++    {
++      CursorInitiallyHidden = TRUE;
++      return 1;
++    }
++    if (!strcmp (argv[i], "-root-ppm"))
++    {
++      if ((i+1) < argc)
++      RootPPM =  argv[i+1];
++      else
++      UseMsg ();
++      return 2;
++    }
+     if (!strcmp (argv[i], "-videoTest"))
+     {
+       kdVideoTest = TRUE;
+diff -u -r xorg-server-X11R7.1-1.1.0.orig/xfixes/cursor.c xorg-server-X11R7.1-1.1.0/xfixes/cursor.c
+--- xorg-server-X11R7.1-1.1.0.orig/xfixes/cursor.c     2007-01-08 14:30:38.000000000 +0000
++++ xorg-server-X11R7.1-1.1.0/xfixes/cursor.c  2007-01-11 16:33:00.000000000 +0000
+@@ -59,9 +59,12 @@
+ static RESTYPE                CursorWindowType;
+ static int            CursorScreenPrivateIndex = -1;
+ static int            CursorGeneration;
++static Bool             CursorGloballyHidden; 
+ static CursorPtr      CursorCurrent;
+ static CursorPtr        pInvisibleCursor = NULL;
++Bool CursorInitiallyHidden = FALSE;
++
+ static void deleteCursorHideCountsForScreen (ScreenPtr pScreen);
+ #define VERIFY_CURSOR(pCursor, cursor, client, access) { \
+@@ -130,7 +133,7 @@
+     Unwrap (cs, pScreen, DisplayCursor);
+-    if (cs->pCursorHideCounts != NULL) {
++    if (cs->pCursorHideCounts != NULL || CursorGloballyHidden) {
+       ret = (*pScreen->DisplayCursor) (pScreen, pInvisibleCursor);
+     } else {
+       ret = (*pScreen->DisplayCursor) (pScreen, pCursor);
+@@ -848,6 +851,12 @@
+       return BadWindow;
+     }
++    /* Is cursor set to be initially hidden ?, if so reset this 
++     * flag as now visibility assumed under control of client.
++    */
++    if (CursorGloballyHidden)
++      CursorGloballyHidden = FALSE;
++
+     /* 
+      * Has client hidden the cursor before on this screen? 
+      * If so, just increment the count. 
+@@ -899,9 +908,19 @@
+       return BadWindow;
+     }
++    /* X was started with cursor hidden, therefore just reset our flag
++     * (returning to normal client control) and cause cursor to now be
++     * shown.
++    */
++    if (CursorGloballyHidden == TRUE)
++      {
++      CursorGloballyHidden = FALSE;
++      return (client->noClientException);
++      }
++
+     /* 
+      * Has client hidden the cursor on this screen?
+-     * If not, generate an error.
++     * If so, generate an error.
+      */
+     pChc = findCursorHideCount(client, pWin->drawable.pScreen);
+     if (pChc == NULL) {
+@@ -1009,6 +1028,8 @@
+ XFixesCursorInit (void)
+ {
+     int       i;
++
++    CursorGloballyHidden = CursorInitiallyHidden;
+     
+     if (CursorGeneration != serverGeneration)
+     {
index 5f362412d3eaae0c43bf5477982174385bc72bfa..1182d7d4412d12d57b5729c924da1cff0fbfee86 100644 (file)
@@ -10,7 +10,7 @@ DESCRIPTION_xserver-kdrive-fbdev = "X server from freedesktop.org, supporting ge
 DESCRIPTION_xserver-kdrive-fake = "Fake X server"
 DESCRIPTION_xserver-kdrive-xephyr = "X server in an X window"
 
-PR="r1"
+PR="r2"
 
 FILES_${PN} = "${libdir}/xserver"
 FILES_xserver-kdrive-fbdev = "${bindir}/Xfbdev"
@@ -33,7 +33,8 @@ SRC_URI = "http://ftp.x.org/pub/X11R7.1/src/xserver/xorg-server-X11R7.1-1.1.0.ta
        file://disable-xf86-dga-xorgcfg.patch;patch=1 \
        file://enable-tslib.patch;patch=1 \
        file://xcalibrate.patch;patch=1 \
-       file://xfbdev-fb-opt.patch;patch=1"
+       file://xfbdev-fb-opt.patch;patch=1 \
+       file://hide-cursor-and-ppm-root.patch;patch=1"
 
 SRC_URI_append_mnci   = " file://onlyfb.patch;patch=1"
 SRC_URI_append_poodle = " file://xserver-kdrive-poodle.patch;patch=1"