From 0dc3675e6afdf16e772c15f5c97797758ad3b0ec Mon Sep 17 00:00:00 2001
From: Jon TURNEY <jon.turney@dronecode.org.uk>
Date: Sat, 10 Oct 2009 14:12:55 +0100
Subject: [PATCH] Push RootlessColormapCallback down into XQuartz DDX


Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
---
 hw/xquartz/xpr/xprFrame.c       |    9 +++++++--
 miext/rootless/rootlessCommon.h |    3 ---
 miext/rootless/rootlessWindow.c |    7 -------
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index 48656e9..53dde7a 100644
--- a/hw/xquartz/xpr/xprFrame.c
+++ b/hw/xquartz/xpr/xprFrame.c
@@ -119,6 +119,11 @@ xprSetNativeProperty(RootlessWindowPtr pFrame)
     }
 }
 
+static xp_error
+xprColormapCallback(void *data, int first_color, int n_colors, uint32_t *colors)
+{
+    return (RootlessResolveColormap (data, first_color, n_colors, colors) ? XP_Success : XP_BadMatch);
+}
 
 /*
  * Create and display a new frame.
@@ -144,7 +149,7 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
     if (pWin->drawable.depth == 8)
     {
         wc.depth = XP_DEPTH_INDEX8;
-        wc.colormap = RootlessColormapCallback;
+        wc.colormap = xprColormapCallback;
         wc.colormap_data = pScreen;
         mask |= XP_COLORMAP;
     }
@@ -619,7 +624,7 @@ void xprUpdateColormap(RootlessFrameID wid, ScreenPtr pScreen)
 {
   /* This is how we tell xp that the colormap may have changed. */
   xp_window_changes wc;
-  wc.colormap = RootlessColormapCallback;
+  wc.colormap = xprColormapCallback;
   wc.colormap_data = pScreen;
 
   configure_window(MAKE_WINDOW_ID(wid), XP_COLORMAP, &wc);
diff --git a/miext/rootless/rootlessCommon.h b/miext/rootless/rootlessCommon.h
index ba121c0..2a5df5d 100644
--- a/miext/rootless/rootlessCommon.h
+++ b/miext/rootless/rootlessCommon.h
@@ -268,9 +268,6 @@ Bool RootlessResolveColormap (ScreenPtr pScreen, int first_color,
 void RootlessFlushWindowColormap (WindowPtr pWin);
 void RootlessFlushScreenColormaps (ScreenPtr pScreen);
 
-// xp_error
-int RootlessColormapCallback(void *data, int first_color, int n_colors, uint32_t *colors);
-
 // Move a window to its proper location on the screen.
 void RootlessRepositionWindow(WindowPtr pWin);
 
diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c
index 1b0ef1c..1ea324b 100644
--- a/miext/rootless/rootlessWindow.c
+++ b/miext/rootless/rootlessWindow.c
@@ -415,13 +415,6 @@ RootlessInitializeFrame(WindowPtr pWin, RootlessWindowRec *winRec)
 #endif
 }
 
-
-Bool
-RootlessColormapCallback (void *data, int first_color, int n_colors, uint32_t *colors)
-{
-    return RootlessResolveColormap (data, first_color, n_colors, colors);
-}
-
 /*
  * RootlessEnsureFrame
  *  Make sure the given window is framed. If the window doesn't have a
-- 
1.6.4.2

