xserver: Branch 'server-1.11-branch' - 4 commits
Jeremy Huddleston
jeremyhu at kemper.freedesktop.org
Mon Oct 24 18:32:41 PDT 2011
hw/xnest/Keyboard.c | 25 ++++++-
hw/xquartz/xpr/appledri.c | 149 ++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 160 insertions(+), 14 deletions(-)
New commits:
commit 7be5492bcfab540676d6f849b85ad3db64a5ada0
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Fri Oct 21 10:27:16 2011 -0700
XQuartz: appledri: Allow byte swapped requests
Even though it's only valid when local, it is possible for a local
client and the server to not match endianness, such as when running
a ppc application under Rosetta.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
(cherry picked from commit 1c8bda798b4480bab0f0da6f531e4770c7a1f771)
diff --git a/hw/xquartz/xpr/appledri.c b/hw/xquartz/xpr/appledri.c
index 1d37de2..129fc78 100644
--- a/hw/xquartz/xpr/appledri.c
+++ b/hw/xquartz/xpr/appledri.c
@@ -2,7 +2,7 @@
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
Copyright 2000 VA Linux Systems, Inc.
-Copyright (c) 2002, 2009 Apple Computer, Inc.
+Copyright (c) 2002, 2009-2011 Apple Inc.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
@@ -416,21 +416,113 @@ SProcAppleDRIQueryVersion(
}
static int
+SProcAppleDRIQueryDirectRenderingCapable(
+ register ClientPtr client
+)
+{
+ register int n;
+ REQUEST(xAppleDRIQueryDirectRenderingCapableReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->screen, n);
+ return ProcAppleDRIQueryDirectRenderingCapable(client);
+}
+
+static int
+SProcAppleDRIAuthConnection(
+ register ClientPtr client
+)
+{
+ register int n;
+ REQUEST(xAppleDRIAuthConnectionReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->screen, n);
+ swapl(&stuff->magic, n);
+ return ProcAppleDRIAuthConnection(client);
+}
+
+static int
+SProcAppleDRICreateSurface(
+ register ClientPtr client
+)
+{
+ register int n;
+ REQUEST(xAppleDRICreateSurfaceReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->screen, n);
+ swapl(&stuff->drawable, n);
+ swapl(&stuff->client_id, n);
+ return ProcAppleDRICreateSurface(client);
+}
+
+static int
+SProcAppleDRIDestroySurface(
+ register ClientPtr client
+)
+{
+ register int n;
+ REQUEST(xAppleDRIDestroySurfaceReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->screen, n);
+ swapl(&stuff->drawable, n);
+ return ProcAppleDRIDestroySurface(client);
+}
+
+static int
+SProcAppleDRICreatePixmap(
+ register ClientPtr client
+)
+{
+ register int n;
+ REQUEST(xAppleDRICreatePixmapReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->screen, n);
+ swapl(&stuff->drawable, n);
+ return ProcAppleDRICreatePixmap(client);
+}
+
+static int
+SProcAppleDRIDestroyPixmap(
+ register ClientPtr client
+)
+{
+ register int n;
+ REQUEST(xAppleDRIDestroyPixmapReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->drawable, n);
+ return ProcAppleDRIDestroyPixmap(client);
+}
+
+static int
SProcAppleDRIDispatch (
register ClientPtr client
)
{
REQUEST(xReq);
- /* It is bound to be non-local when there is byte swapping */
+ switch (stuff->data)
+ {
+ case X_AppleDRIQueryVersion:
+ return SProcAppleDRIQueryVersion(client);
+ case X_AppleDRIQueryDirectRenderingCapable:
+ return SProcAppleDRIQueryDirectRenderingCapable(client);
+ }
+
if (!LocalClient(client))
return DRIErrorBase + AppleDRIClientNotLocal;
- /* only local clients are allowed DRI access */
switch (stuff->data)
{
- case X_AppleDRIQueryVersion:
- return SProcAppleDRIQueryVersion(client);
+ case X_AppleDRIAuthConnection:
+ return SProcAppleDRIAuthConnection(client);
+ case X_AppleDRICreateSurface:
+ return SProcAppleDRICreateSurface(client);
+ case X_AppleDRIDestroySurface:
+ return SProcAppleDRIDestroySurface(client);
+ case X_AppleDRICreatePixmap:
+ return SProcAppleDRICreatePixmap(client);
+ case X_AppleDRIDestroyPixmap:
+ return SProcAppleDRIDestroyPixmap(client);
+
default:
return BadRequest;
}
commit 0ad049706d2fa8ff2758c42bdd412fb62bb1e86a
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Thu Oct 20 22:34:44 2011 -0700
XQuartz: appledri: Fix byte swapping in replies
Even though it's only valid when local, it is possible for a local
client and the server to not match endianness, such as when running
a ppc application under Rosetta.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
Reviewed-by: Jamey Sharp <jamey at minilop.net>
(cherry picked from commit 14205ade0c750191bf43fba8bd55c65dba912cf4)
Conflicts:
hw/xquartz/xpr/appledri.c
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/xpr/appledri.c b/hw/xquartz/xpr/appledri.c
index e1b4134..1d37de2 100644
--- a/hw/xquartz/xpr/appledri.c
+++ b/hw/xquartz/xpr/appledri.c
@@ -91,7 +91,6 @@ ProcAppleDRIQueryVersion(
)
{
xAppleDRIQueryVersionReply rep;
- register int n;
REQUEST_SIZE_MATCH(xAppleDRIQueryVersionReq);
rep.type = X_Reply;
@@ -101,8 +100,12 @@ ProcAppleDRIQueryVersion(
rep.minorVersion = SERVER_APPLEDRI_MINOR_VERSION;
rep.patchVersion = SERVER_APPLEDRI_PATCH_VERSION;
if (client->swapped) {
+ register int n;
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
+ swaps(&rep.majorVersion, n);
+ swaps(&rep.minorVersion, n);
+ swapl(&rep.patchVersion, n);
}
WriteToClient(client, sizeof(xAppleDRIQueryVersionReply), (char *)&rep);
return Success;
@@ -134,6 +137,12 @@ ProcAppleDRIQueryDirectRenderingCapable(
if (!LocalClient(client))
rep.isCapable = 0;
+ if (client->swapped) {
+ register int n;
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ }
+
WriteToClient(client,
sizeof(xAppleDRIQueryDirectRenderingCapableReply), (char *)&rep);
return Success;
@@ -158,6 +167,14 @@ ProcAppleDRIAuthConnection(
ErrorF("Failed to authenticate %u\n", (unsigned int)stuff->magic);
rep.authenticated = 0;
}
+
+ if (client->swapped) {
+ register int n;
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.authenticated, n); /* Yes, this is a CARD32 ... sigh */
+ }
+
WriteToClient(client, sizeof(xAppleDRIAuthConnectionReply), (char *)&rep);
return Success;
}
@@ -217,6 +234,15 @@ ProcAppleDRICreateSurface(
rep.key_1 = key[1];
rep.uid = sid;
+ if (client->swapped) {
+ register int n;
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.key_0, n);
+ swapl(&rep.key_1, n);
+ swapl(&rep.uid, n);
+ }
+
WriteToClient(client, sizeof(xAppleDRICreateSurfaceReply), (char *)&rep);
return Success;
}
@@ -278,7 +304,6 @@ ProcAppleDRICreatePixmap(ClientPtr client)
rep.stringLength = strlen(path) + 1;
- /* No need for swapping, because this only runs if LocalClient is true. */
rep.type = X_Reply;
rep.length = bytes_to_int32(rep.stringLength);
rep.sequenceNumber = client->sequence;
@@ -291,8 +316,20 @@ ProcAppleDRICreatePixmap(ClientPtr client)
if(sizeof(rep) != sz_xAppleDRICreatePixmapReply)
ErrorF("error sizeof(rep) is %zu\n", sizeof(rep));
- WriteReplyToClient(client, sizeof(rep), &rep);
- (void)WriteToClient(client, rep.stringLength, path);
+ if (client->swapped) {
+ register int n;
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.stringLength, n);
+ swapl(&rep.width, n);
+ swapl(&rep.height, n);
+ swapl(&rep.pitch, n);
+ swapl(&rep.bpp, n);
+ swapl(&rep.size, n);
+ }
+
+ WriteToClient(client, sizeof(rep), &rep);
+ WriteToClient(client, rep.stringLength, path);
return Success;
}
commit 3b931c92764fc4e6417f1f38a67114b8c7442fc2
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Thu Oct 20 22:23:07 2011 -0700
XQuartz: appledri: Set the correct reply length for XAppleDRICreatePixmap
http://xquartz.macosforge.org/trac/ticket/508
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
Reviewed-by: Jamey Sharp <jamey at minilop.net>
(cherry picked from commit 2ba0ac202ad64eb4a555715980ba538de19c9fd7)
diff --git a/hw/xquartz/xpr/appledri.c b/hw/xquartz/xpr/appledri.c
index ff70a38..e1b4134 100644
--- a/hw/xquartz/xpr/appledri.c
+++ b/hw/xquartz/xpr/appledri.c
@@ -280,7 +280,7 @@ ProcAppleDRICreatePixmap(ClientPtr client)
/* No need for swapping, because this only runs if LocalClient is true. */
rep.type = X_Reply;
- rep.length = sizeof(rep) + rep.stringLength;
+ rep.length = bytes_to_int32(rep.stringLength);
rep.sequenceNumber = client->sequence;
rep.width = width;
rep.height = height;
commit f22a41416b9795c778deeae6406cd33d18f13fa3
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sun Oct 16 02:12:38 2011 -0700
Xnest: Match the host's keymap
This was a regression.
Introduced by: 08363c5830bdea34012dcd954b45ccfdc79a3a7e and
32db27a7f867b503c2840ca7b815e96d10be9210
Masked by: 1e69fd4a60147287b31e53bfc61543fb17bb82c8
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
Reviewed-by: Jamey Sharp <jamey at minilop.net>
(cherry picked from commit 83fef4235db86343477b4ec9858c6ba35e1aa7d9)
diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c
index ec629dc..5ef376b 100644
--- a/hw/xnest/Keyboard.c
+++ b/hw/xnest/Keyboard.c
@@ -114,11 +114,13 @@ xnestChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl)
int
xnestKeyboardProc(DeviceIntPtr pDev, int onoff)
{
+ XModifierKeymap *modifier_keymap;
KeySym *keymap;
int mapWidth;
int min_keycode, max_keycode;
KeySymsRec keySyms;
- int i;
+ CARD8 modmap[MAP_LENGTH];
+ int i, j;
XKeyboardState values;
XkbDescPtr xkb;
int op, event, error, major, minor;
@@ -130,7 +132,7 @@ xnestKeyboardProc(DeviceIntPtr pDev, int onoff)
#ifdef _XSERVER64
{
KeySym64 *keymap64;
- int i, len;
+ int len;
keymap64 = XGetKeyboardMapping(xnestDisplay,
min_keycode,
max_keycode - min_keycode + 1,
@@ -147,7 +149,17 @@ xnestKeyboardProc(DeviceIntPtr pDev, int onoff)
max_keycode - min_keycode + 1,
&mapWidth);
#endif
-
+
+ memset(modmap, 0, sizeof(modmap));
+ modifier_keymap = XGetModifierMapping(xnestDisplay);
+ for (j = 0; j < 8; j++)
+ for(i = 0; i < modifier_keymap->max_keypermod; i++) {
+ CARD8 keycode;
+ if ((keycode = modifier_keymap->modifiermap[j * modifier_keymap->max_keypermod + i]))
+ modmap[keycode] |= 1<<j;
+ }
+ XFreeModifiermap(modifier_keymap);
+
keySyms.minKeyCode = min_keycode;
keySyms.maxKeyCode = max_keycode;
keySyms.mapWidth = mapWidth;
@@ -165,7 +177,12 @@ xnestKeyboardProc(DeviceIntPtr pDev, int onoff)
XkbGetControls(xnestDisplay, XkbAllControlsMask, xkb);
InitKeyboardDeviceStruct(pDev, NULL,
- xnestBell, xnestChangeKeyboardControl);
+ xnestBell, xnestChangeKeyboardControl);
+
+ XkbApplyMappingChange(pDev, &keySyms, keySyms.minKeyCode,
+ keySyms.maxKeyCode - keySyms.minKeyCode + 1,
+ modmap, serverClient);
+
XkbDDXChangeControls(pDev, xkb->ctrls, xkb->ctrls);
XkbFreeKeyboard(xkb, 0, False);
free(keymap);
More information about the xorg-commit
mailing list