6 * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
8 * This is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This software is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this software; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
26 Copyright (c) 1993 X Consortium
28 Permission is hereby granted, free of charge, to any person obtaining
29 a copy of this software and associated documentation files (the
30 "Software"), to deal in the Software without restriction, including
31 without limitation the rights to use, copy, modify, merge, publish,
32 distribute, sublicense, and/or sell copies of the Software, and to
33 permit persons to whom the Software is furnished to do so, subject to
34 the following conditions:
36 The above copyright notice and this permission notice shall be included
37 in all copies or substantial portions of the Software.
39 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
40 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
41 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
42 IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
43 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
44 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
45 OTHER DEALINGS IN THE SOFTWARE.
47 Except as contained in this notice, the name of the X Consortium shall
48 not be used in advertising or otherwise to promote the sale, use or
49 other dealings in this Software without prior written authorization
50 from the X Consortium.
55 #include "scrnintstr.h"
57 #include "colormapst.h"
60 ColormapPtr rfbInstalledColormap;
63 rfbListInstalledColormaps(pScreen, pmaps)
67 /* By the time we are processing requests, we can guarantee that there
68 * is always a colormap installed */
69 *pmaps = rfbInstalledColormap->mid;
75 rfbInstallColormap(pmap)
78 ColormapPtr oldpmap = rfbInstalledColormap;
80 if (pmap != oldpmap) {
82 if(oldpmap != (ColormapPtr)None)
83 WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid);
85 rfbInstalledColormap = pmap;
86 WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid);
88 rfbSetClientColourMaps(0, 0);
93 rfbUninstallColormap(pmap)
96 ColormapPtr curpmap = rfbInstalledColormap;
100 if (pmap->mid != pmap->pScreen->defColormap)
102 curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap,
104 (*pmap->pScreen->InstallColormap)(curpmap);
111 * rfbStoreColors. We have a set of pixels but they may be in any order.
112 * If some of them happen to be in continuous ascending order then we can
113 * group them together into a single call to rfbSetClientColourMaps.
117 rfbStoreColors(pmap, ndef, pdefs)
126 if (pmap == rfbInstalledColormap) {
127 for (i = 0; i < ndef; i++) {
128 if ((first != -1) && (first + n == pdefs[i].pixel)) {
132 rfbSetClientColourMaps(first, n);
134 first = pdefs[i].pixel;
138 rfbSetClientColourMaps(first, n);