summaryrefslogtreecommitdiff
path: root/dix/dixutils.c
diff options
context:
space:
mode:
authorStuart Kreitman <stuart.kreitman@sun.com>2004-07-29 18:43:58 +0000
committerStuart Kreitman <stuart.kreitman@sun.com>2004-07-29 18:43:58 +0000
commit0bca00e1205bf1a4537cbf7be6339b3b1f9b953f (patch)
tree795826a8674bce5be5e464bb63224741c198bf7c /dix/dixutils.c
parentd4a101d4ef9943dcddf08b00b2d3ab4319597193 (diff)
Integration of DAMAGE-XFIXES branch to trunk
https://freedesktop.org/bugzilla/show_bug.cgi?id=859 Modified Files: dispatch.c dixutils.c events.c window.c
Diffstat (limited to 'dix/dixutils.c')
-rw-r--r--dix/dixutils.c80
1 files changed, 62 insertions, 18 deletions
diff --git a/dix/dixutils.c b/dix/dixutils.c
index 40f80d348..f78497b65 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -152,6 +152,22 @@ ClientTimeToServerTime(c)
* beware of too-small buffers
*/
+static unsigned char
+ISOLatin1ToLower (unsigned char source)
+{
+ unsigned char dest;
+ if ((source >= XK_A) && (source <= XK_Z))
+ dest = source + (XK_a - XK_A);
+ else if ((source >= XK_Agrave) && (source <= XK_Odiaeresis))
+ dest = source + (XK_agrave - XK_Agrave);
+ else if ((source >= XK_Ooblique) && (source <= XK_Thorn))
+ dest = source + (XK_oslash - XK_Ooblique);
+ else
+ dest = source;
+ return dest;
+}
+
+
void
CopyISOLatin1Lowered(dest, source, length)
register unsigned char *dest, *source;
@@ -160,17 +176,27 @@ CopyISOLatin1Lowered(dest, source, length)
register int i;
for (i = 0; i < length; i++, source++, dest++)
+ *dest = ISOLatin1ToLower (*source);
+ *dest = '\0';
+}
+
+int
+CompareISOLatin1Lowered(unsigned char *s1, int s1len,
+ unsigned char *s2, int s2len)
+{
+ unsigned char c1, c2;
+
+ for (;;)
{
- if ((*source >= XK_A) && (*source <= XK_Z))
- *dest = *source + (XK_a - XK_A);
- else if ((*source >= XK_Agrave) && (*source <= XK_Odiaeresis))
- *dest = *source + (XK_agrave - XK_Agrave);
- else if ((*source >= XK_Ooblique) && (*source <= XK_Thorn))
- *dest = *source + (XK_oslash - XK_Ooblique);
- else
- *dest = *source;
+ /* note -- compare against zero so that -1 ignores len */
+ c1 = s1len-- ? *s1++ : '\0';
+ c2 = s2len-- ? *s2++ : '\0';
+ if (!c1 ||
+ (c1 != c2 &&
+ (c1 = ISOLatin1ToLower (c1)) != (c2 = ISOLatin1ToLower (c2))))
+ break;
}
- *dest = '\0';
+ return (int) c1 - (int) c2;
}
#ifdef XCSECURITY
@@ -321,13 +347,18 @@ LookupClient(rid, client)
int
-AlterSaveSetForClient(client, pWin, mode)
- ClientPtr client;
- WindowPtr pWin;
- unsigned mode;
+AlterSaveSetForClient(ClientPtr client,
+ WindowPtr pWin,
+ unsigned mode,
+ Bool toRoot,
+ Bool remap)
{
int numnow;
+#ifdef XFIXES
+ SaveSetElt *pTmp = NULL;
+#else
pointer *pTmp = NULL;
+#endif
int j;
numnow = client->numSaved;
@@ -335,7 +366,7 @@ AlterSaveSetForClient(client, pWin, mode)
if (numnow)
{
pTmp = client->saveSet;
- while ((j < numnow) && (pTmp[j] != (pointer)pWin))
+ while ((j < numnow) && (SaveSetWindow(pTmp[j]) != (pointer)pWin))
j++;
}
if (mode == SetModeInsert)
@@ -343,12 +374,18 @@ AlterSaveSetForClient(client, pWin, mode)
if (j < numnow) /* duplicate */
return(Success);
numnow++;
+#ifdef XFIXES
+ pTmp = (SaveSetElt *)xrealloc(client->saveSet, sizeof(SaveSetElt) * numnow);
+#else
pTmp = (pointer *)xrealloc(client->saveSet, sizeof(pointer) * numnow);
+#endif
if (!pTmp)
return(BadAlloc);
client->saveSet = pTmp;
client->numSaved = numnow;
- client->saveSet[numnow - 1] = (pointer)pWin;
+ SaveSetAssignWindow(client->saveSet[numnow - 1], pWin);
+ SaveSetAssignToRoot(client->saveSet[numnow - 1], toRoot);
+ SaveSetAssignRemap(client->saveSet[numnow - 1], remap);
return(Success);
}
else if ((mode == SetModeDelete) && (j < numnow))
@@ -361,15 +398,22 @@ AlterSaveSetForClient(client, pWin, mode)
numnow--;
if (numnow)
{
- pTmp = (pointer *)xrealloc(client->saveSet,
- sizeof(pointer) * numnow);
+#ifdef XFIXES
+ pTmp = (SaveSetElt *)xrealloc(client->saveSet, sizeof(SaveSetElt) * numnow);
+#else
+ pTmp = (pointer *)xrealloc(client->saveSet, sizeof(pointer) * numnow);
+#endif
if (pTmp)
client->saveSet = pTmp;
}
else
{
xfree(client->saveSet);
+#ifdef XFIXES
+ client->saveSet = (SaveSetElt *)NULL;
+#else
client->saveSet = (pointer *)NULL;
+#endif
}
client->numSaved = numnow;
return(Success);
@@ -388,7 +432,7 @@ DeleteWindowFromAnySaveSet(pWin)
{
client = clients[i];
if (client && client->numSaved)
- (void)AlterSaveSetForClient(client, pWin, SetModeDelete);
+ (void)AlterSaveSetForClient(client, pWin, SetModeDelete, FALSE, TRUE);
}
}