Merge remote branch 'whot/for-keith'

This commit is contained in:
Keith Packard 2010-11-10 16:58:21 -08:00
commit 4ed4915bc0
28 changed files with 355 additions and 399 deletions

View File

@ -136,12 +136,286 @@ int SProcXIChangeHierarchy(ClientPtr client)
return (ProcXIChangeHierarchy(client)); return (ProcXIChangeHierarchy(client));
} }
static int
add_master(ClientPtr client, xXIAddMasterInfo *c, int flags[MAXDEVICES])
{
DeviceIntPtr ptr, keybd, XTestptr, XTestkeybd;
char* name;
int rc;
name = calloc(c->name_len + 1, sizeof(char));
strncpy(name, (char*)&c[1], c->name_len);
rc = AllocDevicePair(client, name, &ptr, &keybd,
CorePointerProc, CoreKeyboardProc, TRUE);
if (rc != Success)
goto unwind;
if (!c->send_core)
ptr->coreEvents = keybd->coreEvents = FALSE;
/* Allocate virtual slave devices for xtest events */
rc = AllocXTestDevice(client, name, &XTestptr, &XTestkeybd, ptr, keybd);
if (rc != Success)
{
DeleteInputDeviceRequest(ptr);
DeleteInputDeviceRequest(keybd);
goto unwind;
}
ActivateDevice(ptr, FALSE);
ActivateDevice(keybd, FALSE);
flags[ptr->id] |= XIMasterAdded;
flags[keybd->id] |= XIMasterAdded;
ActivateDevice(XTestptr, FALSE);
ActivateDevice(XTestkeybd, FALSE);
flags[XTestptr->id] |= XISlaveAdded;
flags[XTestkeybd->id] |= XISlaveAdded;
if (c->enable)
{
EnableDevice(ptr, FALSE);
EnableDevice(keybd, FALSE);
flags[ptr->id] |= XIDeviceEnabled;
flags[keybd->id] |= XIDeviceEnabled;
EnableDevice(XTestptr, FALSE);
EnableDevice(XTestkeybd, FALSE);
flags[XTestptr->id] |= XIDeviceEnabled;
flags[XTestkeybd->id] |= XIDeviceEnabled;
}
/* Attach the XTest virtual devices to the newly
created master device */
AttachDevice(NULL, XTestptr, ptr);
AttachDevice(NULL, XTestkeybd, keybd);
flags[XTestptr->id] |= XISlaveAttached;
flags[XTestkeybd->id] |= XISlaveAttached;
unwind:
free(name);
return rc;
}
static int
remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
int flags[MAXDEVICES])
{
DeviceIntPtr ptr, keybd, XTestptr, XTestkeybd;
int rc = Success;
if (r->return_mode != XIAttachToMaster &&
r->return_mode != XIFloating)
return BadValue;
rc = dixLookupDevice(&ptr, r->deviceid, client, DixDestroyAccess);
if (rc != Success)
goto unwind;
if (!IsMaster(ptr))
{
client->errorValue = r->deviceid;
rc = BadDevice;
goto unwind;
}
/* XXX: For now, don't allow removal of VCP, VCK */
if (ptr == inputInfo.pointer || ptr == inputInfo.keyboard)
{
rc = BadDevice;
goto unwind;
}
ptr = GetMaster(ptr, MASTER_POINTER);
rc = dixLookupDevice(&ptr, ptr->id, client, DixDestroyAccess);
if (rc != Success)
goto unwind;
keybd = GetMaster(ptr, MASTER_KEYBOARD);
rc = dixLookupDevice(&keybd, keybd->id, client, DixDestroyAccess);
if (rc != Success)
goto unwind;
XTestptr = GetXTestDevice(ptr);
rc = dixLookupDevice(&XTestptr, XTestptr->id, client, DixDestroyAccess);
if (rc != Success)
goto unwind;
XTestkeybd = GetXTestDevice(keybd);
rc = dixLookupDevice(&XTestkeybd, XTestkeybd->id, client,
DixDestroyAccess);
if (rc != Success)
goto unwind;
/* Disabling sends the devices floating, reattach them if
* desired. */
if (r->return_mode == XIAttachToMaster)
{
DeviceIntPtr attached,
newptr,
newkeybd;
rc = dixLookupDevice(&newptr, r->return_pointer, client, DixAddAccess);
if (rc != Success)
goto unwind;
if (!IsMaster(newptr))
{
client->errorValue = r->return_pointer;
rc = BadDevice;
goto unwind;
}
rc = dixLookupDevice(&newkeybd, r->return_keyboard,
client, DixAddAccess);
if (rc != Success)
goto unwind;
if (!IsMaster(newkeybd))
{
client->errorValue = r->return_keyboard;
rc = BadDevice;
goto unwind;
}
for (attached = inputInfo.devices; attached; attached = attached->next)
{
if (!IsMaster(attached)) {
if (attached->u.master == ptr)
{
AttachDevice(client, attached, newptr);
flags[attached->id] |= XISlaveAttached;
}
if (attached->u.master == keybd)
{
AttachDevice(client, attached, newkeybd);
flags[attached->id] |= XISlaveAttached;
}
}
}
}
/* can't disable until we removed pairing */
keybd->spriteInfo->paired = NULL;
ptr->spriteInfo->paired = NULL;
XTestptr->spriteInfo->paired = NULL;
XTestkeybd->spriteInfo->paired = NULL;
/* disable the remove the devices, XTest devices must be done first
else the sprites they rely on will be destroyed */
DisableDevice(XTestptr, FALSE);
DisableDevice(XTestkeybd, FALSE);
DisableDevice(keybd, FALSE);
DisableDevice(ptr, FALSE);
flags[XTestptr->id] |= XIDeviceDisabled | XISlaveDetached;
flags[XTestkeybd->id] |= XIDeviceDisabled | XISlaveDetached;
flags[keybd->id] |= XIDeviceDisabled;
flags[ptr->id] |= XIDeviceDisabled;
RemoveDevice(XTestptr, FALSE);
RemoveDevice(XTestkeybd, FALSE);
RemoveDevice(keybd, FALSE);
RemoveDevice(ptr, FALSE);
flags[XTestptr->id] |= XISlaveRemoved;
flags[XTestkeybd->id] |= XISlaveRemoved;
flags[keybd->id] |= XIMasterRemoved;
flags[ptr->id] |= XIMasterRemoved;
unwind:
return rc;
}
static int
detach_slave(ClientPtr client, xXIDetachSlaveInfo *c, int flags[MAXDEVICES])
{
DeviceIntPtr dev;
int rc;
rc = dixLookupDevice(&dev, c->deviceid, client, DixManageAccess);
if (rc != Success)
goto unwind;
if (IsMaster(dev))
{
client->errorValue = c->deviceid;
rc = BadDevice;
goto unwind;
}
/* Don't allow changes to XTest Devices, these are fixed */
if (IsXTestDevice(dev, NULL))
{
client->errorValue = c->deviceid;
rc = BadDevice;
goto unwind;
}
AttachDevice(client, dev, NULL);
flags[dev->id] |= XISlaveDetached;
unwind:
return rc;
}
static int
attach_slave(ClientPtr client, xXIAttachSlaveInfo *c,
int flags[MAXDEVICES])
{
DeviceIntPtr dev;
DeviceIntPtr newmaster;
int rc;
rc = dixLookupDevice(&dev, c->deviceid, client, DixManageAccess);
if (rc != Success)
goto unwind;
if (IsMaster(dev))
{
client->errorValue = c->deviceid;
rc = BadDevice;
goto unwind;
}
/* Don't allow changes to XTest Devices, these are fixed */
if (IsXTestDevice(dev, NULL))
{
client->errorValue = c->deviceid;
rc = BadDevice;
goto unwind;
}
rc = dixLookupDevice(&newmaster, c->new_master, client, DixAddAccess);
if (rc != Success)
goto unwind;
if (!IsMaster(newmaster))
{
client->errorValue = c->new_master;
rc = BadDevice;
goto unwind;
}
if (!((IsPointerDevice(newmaster) && IsPointerDevice(dev)) ||
(IsKeyboardDevice(newmaster) && IsKeyboardDevice(dev))))
{
rc = BadDevice;
goto unwind;
}
AttachDevice(client, dev, newmaster);
flags[dev->id] |= XISlaveAttached;
unwind:
return rc;
}
#define SWAPIF(cmd) if (client->swapped) { cmd; } #define SWAPIF(cmd) if (client->swapped) { cmd; }
int int
ProcXIChangeHierarchy(ClientPtr client) ProcXIChangeHierarchy(ClientPtr client)
{ {
DeviceIntPtr ptr, keybd, XTestptr, XTestkeybd;
xXIAnyHierarchyChangeInfo *any; xXIAnyHierarchyChangeInfo *any;
int required_len = sizeof(xXIChangeHierarchyReq); int required_len = sizeof(xXIChangeHierarchyReq);
char n; char n;
@ -169,276 +443,38 @@ ProcXIChangeHierarchy(ClientPtr client)
case XIAddMaster: case XIAddMaster:
{ {
xXIAddMasterInfo* c = (xXIAddMasterInfo*)any; xXIAddMasterInfo* c = (xXIAddMasterInfo*)any;
char* name;
SWAPIF(swaps(&c->name_len, n)); SWAPIF(swaps(&c->name_len, n));
name = calloc(c->name_len + 1, sizeof(char));
strncpy(name, (char*)&c[1], c->name_len);
rc = add_master(client, c, flags);
rc = AllocDevicePair(client, name, &ptr, &keybd,
CorePointerProc, CoreKeyboardProc,
TRUE);
if (rc != Success) if (rc != Success)
{
free(name);
goto unwind; goto unwind;
}
if (!c->send_core)
ptr->coreEvents = keybd->coreEvents = FALSE;
/* Allocate virtual slave devices for xtest events */
rc = AllocXTestDevice(client, name, &XTestptr, &XTestkeybd,
ptr, keybd);
if (rc != Success)
{
free(name);
goto unwind;
}
ActivateDevice(ptr, FALSE);
ActivateDevice(keybd, FALSE);
flags[ptr->id] |= XIMasterAdded;
flags[keybd->id] |= XIMasterAdded;
ActivateDevice(XTestptr, FALSE);
ActivateDevice(XTestkeybd, FALSE);
flags[XTestptr->id] |= XISlaveAdded;
flags[XTestkeybd->id] |= XISlaveAdded;
if (c->enable)
{
EnableDevice(ptr, FALSE);
EnableDevice(keybd, FALSE);
flags[ptr->id] |= XIDeviceEnabled;
flags[keybd->id] |= XIDeviceEnabled;
EnableDevice(XTestptr, FALSE);
EnableDevice(XTestkeybd, FALSE);
flags[XTestptr->id] |= XIDeviceEnabled;
flags[XTestkeybd->id] |= XIDeviceEnabled;
}
/* Attach the XTest virtual devices to the newly
created master device */
AttachDevice(NULL, XTestptr, ptr);
AttachDevice(NULL, XTestkeybd, keybd);
flags[XTestptr->id] |= XISlaveAttached;
flags[XTestkeybd->id] |= XISlaveAttached;
free(name);
} }
break; break;
case XIRemoveMaster: case XIRemoveMaster:
{ {
xXIRemoveMasterInfo* r = (xXIRemoveMasterInfo*)any; xXIRemoveMasterInfo* r = (xXIRemoveMasterInfo*)any;
if (r->return_mode != XIAttachToMaster && rc = remove_master(client, r, flags);
r->return_mode != XIFloating)
return BadValue;
rc = dixLookupDevice(&ptr, r->deviceid, client,
DixDestroyAccess);
if (rc != Success) if (rc != Success)
goto unwind; goto unwind;
if (!IsMaster(ptr))
{
client->errorValue = r->deviceid;
rc = BadDevice;
goto unwind;
}
/* XXX: For now, don't allow removal of VCP, VCK */
if (ptr == inputInfo.pointer ||
ptr == inputInfo.keyboard)
{
rc = BadDevice;
goto unwind;
}
ptr = GetMaster(ptr, MASTER_POINTER);
rc = dixLookupDevice(&ptr,
ptr->id,
client,
DixDestroyAccess);
if (rc != Success)
goto unwind;
keybd = GetMaster(ptr, MASTER_KEYBOARD);
rc = dixLookupDevice(&keybd,
keybd->id,
client,
DixDestroyAccess);
if (rc != Success)
goto unwind;
XTestptr = GetXTestDevice(ptr);
rc = dixLookupDevice(&XTestptr, XTestptr->id, client,
DixDestroyAccess);
if (rc != Success)
goto unwind;
XTestkeybd = GetXTestDevice(keybd);
rc = dixLookupDevice(&XTestkeybd, XTestkeybd->id, client,
DixDestroyAccess);
if (rc != Success)
goto unwind;
/* Disabling sends the devices floating, reattach them if
* desired. */
if (r->return_mode == XIAttachToMaster)
{
DeviceIntPtr attached,
newptr,
newkeybd;
rc = dixLookupDevice(&newptr, r->return_pointer,
client, DixAddAccess);
if (rc != Success)
goto unwind;
if (!IsMaster(newptr))
{
client->errorValue = r->return_pointer;
rc = BadDevice;
goto unwind;
}
rc = dixLookupDevice(&newkeybd, r->return_keyboard,
client, DixAddAccess);
if (rc != Success)
goto unwind;
if (!IsMaster(newkeybd))
{
client->errorValue = r->return_keyboard;
rc = BadDevice;
goto unwind;
}
for (attached = inputInfo.devices;
attached;
attached = attached->next)
{
if (!IsMaster(attached)) {
if (attached->u.master == ptr)
{
AttachDevice(client, attached, newptr);
flags[attached->id] |= XISlaveAttached;
}
if (attached->u.master == keybd)
{
AttachDevice(client, attached, newkeybd);
flags[attached->id] |= XISlaveAttached;
}
}
}
}
/* can't disable until we removed pairing */
keybd->spriteInfo->paired = NULL;
ptr->spriteInfo->paired = NULL;
XTestptr->spriteInfo->paired = NULL;
XTestkeybd->spriteInfo->paired = NULL;
/* disable the remove the devices, XTest devices must be done first
else the sprites they rely on will be destroyed */
DisableDevice(XTestptr, FALSE);
DisableDevice(XTestkeybd, FALSE);
DisableDevice(keybd, FALSE);
DisableDevice(ptr, FALSE);
flags[XTestptr->id] |= XIDeviceDisabled | XISlaveDetached;
flags[XTestkeybd->id] |= XIDeviceDisabled | XISlaveDetached;
flags[keybd->id] |= XIDeviceDisabled;
flags[ptr->id] |= XIDeviceDisabled;
RemoveDevice(XTestptr, FALSE);
RemoveDevice(XTestkeybd, FALSE);
RemoveDevice(keybd, FALSE);
RemoveDevice(ptr, FALSE);
flags[XTestptr->id] |= XISlaveRemoved;
flags[XTestkeybd->id] |= XISlaveRemoved;
flags[keybd->id] |= XIMasterRemoved;
flags[ptr->id] |= XIMasterRemoved;
} }
break; break;
case XIDetachSlave: case XIDetachSlave:
{ {
xXIDetachSlaveInfo* c = (xXIDetachSlaveInfo*)any; xXIDetachSlaveInfo* c = (xXIDetachSlaveInfo*)any;
rc = dixLookupDevice(&ptr, c->deviceid, client, rc = detach_slave(client, c, flags);
DixManageAccess);
if (rc != Success) if (rc != Success)
goto unwind; goto unwind;
if (IsMaster(ptr))
{
client->errorValue = c->deviceid;
rc = BadDevice;
goto unwind;
}
/* Don't allow changes to XTest Devices, these are fixed */
if (IsXTestDevice(ptr, NULL))
{
client->errorValue = c->deviceid;
rc = BadDevice;
goto unwind;
}
AttachDevice(client, ptr, NULL);
flags[ptr->id] |= XISlaveDetached;
} }
break; break;
case XIAttachSlave: case XIAttachSlave:
{ {
xXIAttachSlaveInfo* c = (xXIAttachSlaveInfo*)any; xXIAttachSlaveInfo* c = (xXIAttachSlaveInfo*)any;
DeviceIntPtr newmaster;
rc = dixLookupDevice(&ptr, c->deviceid, client, rc = attach_slave(client, c, flags);
DixManageAccess);
if (rc != Success) if (rc != Success)
goto unwind; goto unwind;
if (IsMaster(ptr))
{
client->errorValue = c->deviceid;
rc = BadDevice;
goto unwind;
}
/* Don't allow changes to XTest Devices, these are fixed */
if (IsXTestDevice(ptr, NULL))
{
client->errorValue = c->deviceid;
rc = BadDevice;
goto unwind;
}
rc = dixLookupDevice(&newmaster, c->new_master,
client, DixAddAccess);
if (rc != Success)
goto unwind;
if (!IsMaster(newmaster))
{
client->errorValue = c->new_master;
rc = BadDevice;
goto unwind;
}
if (!((IsPointerDevice(newmaster) &&
IsPointerDevice(ptr)) ||
(IsKeyboardDevice(newmaster) &&
IsKeyboardDevice(ptr))))
{
rc = BadDevice;
goto unwind;
}
AttachDevice(client, ptr, newmaster);
flags[ptr->id] |= XISlaveAttached;
} }
break; break;
} }

View File

@ -45,11 +45,6 @@
See the evdev documentation for more information. See the evdev documentation for more information.
You will probably want to add the following option to the ServerFlags of
your xorg.conf:
Option "AllowEmptyInput" "True"
FIXME: Support tablets too. FIXME: Support tablets too.
TODO: I think its fixed, can't test TODO: I think its fixed, can't test

View File

@ -117,11 +117,8 @@ CreateGrab(
static void static void
FreeGrab(GrabPtr pGrab) FreeGrab(GrabPtr pGrab)
{ {
if (pGrab->modifiersDetail.pMask != NULL) free(pGrab->modifiersDetail.pMask);
free(pGrab->modifiersDetail.pMask); free(pGrab->detail.pMask);
if (pGrab->detail.pMask != NULL)
free(pGrab->detail.pMask);
if (pGrab->cursor) if (pGrab->cursor)
FreeCursor(pGrab->cursor, (Cursor)0); FreeCursor(pGrab->cursor, (Cursor)0);

View File

@ -952,11 +952,9 @@ SetAccelerationProfile(
if(profile == NULL && profile_num != PROFILE_UNINITIALIZE) if(profile == NULL && profile_num != PROFILE_UNINITIALIZE)
return FALSE; return FALSE;
if(vel->profile_private != NULL){ /* Here one could free old profile-private data */
/* Here one could free old profile-private data */ free(vel->profile_private);
free(vel->profile_private); vel->profile_private = NULL;
vel->profile_private = NULL;
}
/* Here one could init profile-private data */ /* Here one could init profile-private data */
vel->Profile = profile; vel->Profile = profile;
vel->statistics.profile_number = profile_num; vel->statistics.profile_number = profile_num;

View File

@ -1158,9 +1158,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
*/ */
buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL); buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
if (buffer_size > 0) { if (buffer_size > 0) {
if (screen->base.GLXextensions != NULL) { free(screen->base.GLXextensions);
free(screen->base.GLXextensions);
}
screen->base.GLXextensions = xnfalloc(buffer_size); screen->base.GLXextensions = xnfalloc(buffer_size);
(void) __glXGetExtensionString(screen->glx_enable_bits, (void) __glXGetExtensionString(screen->glx_enable_bits,

View File

@ -792,9 +792,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
*/ */
buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL); buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
if (buffer_size > 0) { if (buffer_size > 0) {
if (screen->base.GLXextensions != NULL) { free(screen->base.GLXextensions);
free(screen->base.GLXextensions);
}
screen->base.GLXextensions = xnfalloc(buffer_size); screen->base.GLXextensions = xnfalloc(buffer_size);
(void) __glXGetExtensionString(screen->glx_enable_bits, (void) __glXGetExtensionString(screen->glx_enable_bits,

View File

@ -346,9 +346,7 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap)
cl->GLClientextensions); cl->GLClientextensions);
buf = __glXcombine_strings(buf1, buf = __glXcombine_strings(buf1,
cx->pGlxScreen->GLextensions); cx->pGlxScreen->GLextensions);
if (buf1 != NULL) { free(buf1);
free(buf1);
}
string = buf; string = buf;
} }
else if ( name == GL_VERSION ) { else if ( name == GL_VERSION ) {
@ -377,8 +375,7 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap)
__GLX_SEND_HEADER(); __GLX_SEND_HEADER();
WriteToClient(client, length, (char *) string); WriteToClient(client, length, (char *) string);
if (buf != NULL) free(buf);
free(buf);
return Success; return Success;
} }

View File

@ -2565,7 +2565,7 @@ int __glXClientInfo(__GLXclientState *cl, GLbyte *pc)
cl->GLClientmajorVersion = req->major; cl->GLClientmajorVersion = req->major;
cl->GLClientminorVersion = req->minor; cl->GLClientminorVersion = req->minor;
if (cl->GLClientextensions) free(cl->GLClientextensions); free(cl->GLClientextensions);
buf = (const char *)(req+1); buf = (const char *)(req+1);
cl->GLClientextensions = strdup(buf); cl->GLClientextensions = strdup(buf);

View File

@ -77,10 +77,10 @@ static void ResetClientState(int clientIndex)
Display **keep_be_displays; Display **keep_be_displays;
int i; int i;
if (cl->returnBuf) free(cl->returnBuf); free(cl->returnBuf);
if (cl->currentContexts) free(cl->currentContexts); free(cl->currentContexts);
if (cl->currentDrawables) free(cl->currentDrawables); free(cl->currentDrawables);
if (cl->largeCmdBuf) free(cl->largeCmdBuf); free(cl->largeCmdBuf);
for (i=0; i< screenInfo.numScreens; i++) { for (i=0; i< screenInfo.numScreens; i++) {
if (cl->be_displays[i]) if (cl->be_displays[i])
@ -97,7 +97,7 @@ static void ResetClientState(int clientIndex)
*/ */
cl->GLClientmajorVersion = 1; cl->GLClientmajorVersion = 1;
cl->GLClientminorVersion = 0; cl->GLClientminorVersion = 0;
if (cl->GLClientextensions) free(cl->GLClientextensions); free(cl->GLClientextensions);
memset(cl->be_displays, 0, screenInfo.numScreens * sizeof(Display *)); memset(cl->be_displays, 0, screenInfo.numScreens * sizeof(Display *));
} }
@ -222,10 +222,10 @@ GLboolean __glXFreeContext(__GLXcontext *cx)
{ {
if (cx->idExists || cx->isCurrent) return GL_FALSE; if (cx->idExists || cx->isCurrent) return GL_FALSE;
if (cx->feedbackBuf) free(cx->feedbackBuf); free(cx->feedbackBuf);
if (cx->selectBuf) free(cx->selectBuf); free(cx->selectBuf);
if (cx->real_ids) free(cx->real_ids); free(cx->real_ids);
if (cx->real_vids) free(cx->real_vids); free(cx->real_vids);
if (cx->pGlxPixmap) { if (cx->pGlxPixmap) {
/* /*

View File

@ -215,11 +215,8 @@ fakeUnmapFramebuffer (KdScreenInfo *screen)
{ {
FakePriv *priv = screen->card->driver; FakePriv *priv = screen->card->driver;
KdShadowFbFree (screen); KdShadowFbFree (screen);
if (priv->base) free(priv->base);
{ priv->base = NULL;
free (priv->base);
priv->base = 0;
}
return TRUE; return TRUE;
} }

View File

@ -742,8 +742,6 @@ static OptionInfoRec FlagOptions[] = {
{0}, FALSE }, {0}, FALSE },
{ FLAG_AIGLX, "AIGLX", OPTV_BOOLEAN, { FLAG_AIGLX, "AIGLX", OPTV_BOOLEAN,
{0}, FALSE }, {0}, FALSE },
{ FLAG_ALLOW_EMPTY_INPUT, "AllowEmptyInput", OPTV_BOOLEAN,
{0}, FALSE },
{ FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN, { FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN,
{0}, FALSE }, {0}, FALSE },
{ FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN, { FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN,
@ -956,7 +954,6 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
/* AllowEmptyInput is automatically true if we're hotplugging */ /* AllowEmptyInput is automatically true if we're hotplugging */
xf86Info.allowEmptyInput = (xf86Info.autoAddDevices && xf86Info.autoEnableDevices); xf86Info.allowEmptyInput = (xf86Info.autoAddDevices && xf86Info.autoEnableDevices);
xf86GetOptValBool(FlagOptions, FLAG_ALLOW_EMPTY_INPUT, &xf86Info.allowEmptyInput);
/* AEI on? Then we're not using kbd, so use the evdev rules set. */ /* AEI on? Then we're not using kbd, so use the evdev rules set. */
#if defined(linux) #if defined(linux)
@ -1437,8 +1434,10 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
"reconfigure %s or disable AutoAddDevices.\n", "reconfigure %s or disable AutoAddDevices.\n",
config_backend, config_backend); config_backend, config_backend);
#else #else
xf86Msg(X_INFO, "Hotplugging is disabled and no input devices were configured.\n" xf86Msg(X_WARNING, "Hotplugging requested but the server was "
"\tTry disabling AllowEmptyInput.\n"); "compiled without a config backend. "
"No input devices were configured, the server "
"will start without any input devices.\n");
#endif #endif
} }
@ -2353,7 +2352,7 @@ checkInput(serverLayoutPtr layout, Bool implicit_layout) {
IDevPtr *current; IDevPtr *current;
if (!warned) if (!warned)
{ {
xf86Msg(X_WARNING, "AllowEmptyInput is on, devices using " xf86Msg(X_WARNING, "Hotplugging is on, devices using "
"drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.\n"); "drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.\n");
warned = TRUE; warned = TRUE;
} }

View File

@ -558,9 +558,6 @@ Default: off.
This tells the mousedrv(__drivermansuffix__) and vmmouse(__drivermansuffix__) This tells the mousedrv(__drivermansuffix__) and vmmouse(__drivermansuffix__)
drivers to not report failure if the mouse device can't be opened/initialised. drivers to not report failure if the mouse device can't be opened/initialised.
It has no effect on the evdev(__drivermansuffix__) or other drivers. It has no effect on the evdev(__drivermansuffix__) or other drivers.
The previous functionality of allowing the server to start up even if
the mouse device can't be opened/initialised is now handled by the
AllowEmptyInput option.
Default: false. Default: false.
.TP 7 .TP 7
.BI "Option \*qVTSysReq\*q \*q" boolean \*q .BI "Option \*qVTSysReq\*q \*q" boolean \*q
@ -677,12 +674,6 @@ default.
Allow modules built for a different, potentially incompatible version of Allow modules built for a different, potentially incompatible version of
the X server to load. Disabled by default. the X server to load. Disabled by default.
.TP 7 .TP 7
.BI "Option \*qAllowEmptyInput\*q \*q" boolean \*q
If enabled, don't add the standard keyboard and mouse drivers, if there are no
input devices in the config file. Enabled by default if AutoAddDevices and
AutoEnableDevices is enabled, otherwise disabled.
If AllowEmptyInput is on, devices using the kbd, mouse or vmmouse driver are ignored.
.TP 7
.BI "Option \*qAutoAddDevices\*q \*q" boolean \*q .BI "Option \*qAutoAddDevices\*q \*q" boolean \*q
If this option is disabled, then no devices will be added from HAL events. If this option is disabled, then no devices will be added from HAL events.
Enabled by default. Enabled by default.

View File

@ -2964,8 +2964,7 @@ xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
int size; int size;
#endif #endif
if (output->MonInfo != NULL) free(output->MonInfo);
free(output->MonInfo);
output->MonInfo = edid_mon; output->MonInfo = edid_mon;

View File

@ -682,10 +682,7 @@ glxWinScreenProbe(ScreenPtr pScreen)
unsigned int buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL); unsigned int buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
if (buffer_size > 0) if (buffer_size > 0)
{ {
if (screen->base.GLXextensions != NULL) free(screen->base.GLXextensions);
{
free(screen->base.GLXextensions);
}
screen->base.GLXextensions = xnfalloc(buffer_size); screen->base.GLXextensions = xnfalloc(buffer_size);
__glXGetExtensionString(screen->glx_enable_bits, screen->base.GLXextensions); __glXGetExtensionString(screen->glx_enable_bits, screen->base.GLXextensions);

View File

@ -516,11 +516,8 @@ winGetPaletteDD (ScreenPtr pScreen, ColormapPtr pcmap)
pScreen->blackPixel = 0; pScreen->blackPixel = 0;
/* Free colormap */ /* Free colormap */
if (ppeColors != NULL) free(ppeColors);
{ ppeColors = NULL;
free (ppeColors);
ppeColors = NULL;
}
/* Free the DC */ /* Free the DC */
if (hdc != NULL) if (hdc != NULL)

View File

@ -163,11 +163,8 @@ winDestroyPixmapNativeGDI (PixmapPtr pPixmap)
if (pPixmapPriv->hBitmap) DeleteObject (pPixmapPriv->hBitmap); if (pPixmapPriv->hBitmap) DeleteObject (pPixmapPriv->hBitmap);
/* Free the bitmap info header memory */ /* Free the bitmap info header memory */
if (pPixmapPriv->pbmih != NULL) free(pPixmapPriv->pbmih);
{ pPixmapPriv->pbmih = NULL;
free (pPixmapPriv->pbmih);
pPixmapPriv->pbmih = NULL;
}
/* Free the pixmap memory */ /* Free the pixmap memory */
free (pPixmap); free (pPixmap);

View File

@ -215,7 +215,7 @@ void miAppendSpans(SpanGroup *spanGroup, SpanGroup *otherGroup, Spans *spans)
void miFreeSpanGroup(SpanGroup *spanGroup) void miFreeSpanGroup(SpanGroup *spanGroup)
{ {
if (spanGroup->group != NULL) free(spanGroup->group); free(spanGroup->group);
} }
static void QuickSortSpansX( static void QuickSortSpansX(

View File

@ -92,8 +92,7 @@ RootlessUpdateScreenPixmap(ScreenPtr pScreen)
rowbytes = PixmapBytePad(pScreen->width, pScreen->rootDepth); rowbytes = PixmapBytePad(pScreen->width, pScreen->rootDepth);
if (s->pixmap_data_size < rowbytes) { if (s->pixmap_data_size < rowbytes) {
if (s->pixmap_data != NULL) free(s->pixmap_data);
free(s->pixmap_data);
s->pixmap_data_size = rowbytes; s->pixmap_data_size = rowbytes;
s->pixmap_data = malloc(s->pixmap_data_size); s->pixmap_data = malloc(s->pixmap_data_size);

View File

@ -1140,10 +1140,8 @@ FinishFrameResize(WindowPtr pWin, Bool gravity, int oldX, int oldY,
} }
} }
if (gResizeDeathBits != NULL) { free(gResizeDeathBits);
free(gResizeDeathBits); gResizeDeathBits = NULL;
gResizeDeathBits = NULL;
}
if (gravity) { if (gravity) {
pScreen->CopyWindow = gResizeOldCopyWindowProc; pScreen->CopyWindow = gResizeOldCopyWindowProc;

View File

@ -481,8 +481,7 @@ AuditFlush(OsTimerPtr timer, CARD32 now, pointer arg)
ErrorF("%slast message repeated %d times\n", ErrorF("%slast message repeated %d times\n",
prefix != NULL ? prefix : "", nrepeat); prefix != NULL ? prefix : "", nrepeat);
nrepeat = 0; nrepeat = 0;
if (prefix != NULL) free(prefix);
free(prefix);
return AUDIT_TIMEOUT; return AUDIT_TIMEOUT;
} else { } else {
/* if the timer expires without anything to print, flush the message */ /* if the timer expires without anything to print, flush the message */
@ -515,8 +514,7 @@ VAuditF(const char *f, va_list args)
nrepeat = 0; nrepeat = 0;
auditTimer = TimerSet(auditTimer, 0, AUDIT_TIMEOUT, AuditFlush, NULL); auditTimer = TimerSet(auditTimer, 0, AUDIT_TIMEOUT, AuditFlush, NULL);
} }
if (prefix != NULL) free(prefix);
free(prefix);
} }
void void

View File

@ -15,8 +15,8 @@
*/ */
#ifdef HAVE_XORG_CONFIG_H #ifdef HAVE_DIX_CONFIG_H
#include <xorg-config.h> #include <dix-config.h>
#endif #endif
#include <sys/types.h> #include <sys/types.h>

View File

@ -14,8 +14,8 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#ifdef HAVE_XORG_CONFIG_H #ifdef HAVE_DIX_CONFIG_H
#include <xorg-config.h> #include <dix-config.h>
#endif #endif
#include <sys/types.h> #include <sys/types.h>

View File

@ -322,16 +322,10 @@ void
miCloseIndexed (ScreenPtr pScreen, miCloseIndexed (ScreenPtr pScreen,
PictFormatPtr pFormat) PictFormatPtr pFormat)
{ {
if (pFormat->index.devPrivate) free(pFormat->index.devPrivate);
{ pFormat->index.devPrivate = NULL;
free(pFormat->index.devPrivate); free(pFormat->index.pValues);
pFormat->index.devPrivate = 0; pFormat->index.pValues = NULL;
}
if (pFormat->index.pValues)
{
free(pFormat->index.pValues);
pFormat->index.pValues = 0;
}
} }
void void

View File

@ -1391,11 +1391,8 @@ SetPictureTransform (PicturePtr pPicture,
} }
else else
{ {
if (pPicture->transform) free(pPicture->transform);
{ pPicture->transform = NULL;
free(pPicture->transform);
pPicture->transform = 0;
}
} }
pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT; pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT;

View File

@ -212,10 +212,8 @@ XkbNamesPtr names;
register XkbKeyTypePtr type; register XkbKeyTypePtr type;
type= map->types; type= map->types;
for (i=0;i<map->num_types;i++,type++) { for (i=0;i<map->num_types;i++,type++) {
if (type->level_names!=NULL) { free(type->level_names);
free(type->level_names); type->level_names = NULL;
type->level_names= NULL;
}
} }
} }
} }

View File

@ -50,10 +50,8 @@ _XkbFreeGeomLeafElems( Bool freeAll,
{ {
if ((freeAll)||(*elems==NULL)) { if ((freeAll)||(*elems==NULL)) {
*num_inout= *sz_inout= 0; *num_inout= *sz_inout= 0;
if (*elems!=NULL) { free(*elems);
free(*elems); *elems = NULL;
*elems= NULL;
}
return; return;
} }
@ -373,22 +371,16 @@ XkbDoodadPtr doodad= (XkbDoodadPtr)doodad_in;
switch (doodad->any.type) { switch (doodad->any.type) {
case XkbTextDoodad: case XkbTextDoodad:
{ {
if (doodad->text.text!=NULL) { free(doodad->text.text);
free(doodad->text.text); doodad->text.text = NULL;
doodad->text.text= NULL; free(doodad->text.font);
} doodad->text.font = NULL;
if (doodad->text.font!=NULL) {
free(doodad->text.font);
doodad->text.font= NULL;
}
} }
break; break;
case XkbLogoDoodad: case XkbLogoDoodad:
{ {
if (doodad->logo.logo_name!=NULL) { free(doodad->logo.logo_name);
free(doodad->logo.logo_name); doodad->logo.logo_name = NULL;
doodad->logo.logo_name= NULL;
}
} }
break; break;
} }
@ -434,10 +426,8 @@ XkbFreeGeometry(XkbGeometryPtr geom,unsigned which,Bool freeMap)
if ((which&XkbGeomKeyAliasesMask)&&(geom->key_aliases!=NULL)) if ((which&XkbGeomKeyAliasesMask)&&(geom->key_aliases!=NULL))
XkbFreeGeomKeyAliases(geom,0,geom->num_key_aliases,TRUE); XkbFreeGeomKeyAliases(geom,0,geom->num_key_aliases,TRUE);
if (freeMap) { if (freeMap) {
if (geom->label_font!=NULL) { free(geom->label_font);
free(geom->label_font); geom->label_font = NULL;
geom->label_font= NULL;
}
free(geom); free(geom);
} }
return; return;

View File

@ -292,11 +292,9 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys;
} }
type= &xkb->map->types[type_ndx]; type= &xkb->map->types[type_ndx];
if (map_count==0) { if (map_count==0) {
if (type->map!=NULL) free(type->map);
free(type->map);
type->map= NULL; type->map= NULL;
if (type->preserve!=NULL) free(type->preserve);
free(type->preserve);
type->preserve= NULL; type->preserve= NULL;
type->map_count= 0; type->map_count= 0;
} }
@ -321,9 +319,9 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys;
return BadAlloc; return BadAlloc;
} }
} }
else if (type->preserve!=NULL) { else {
free(type->preserve); free(type->preserve);
type->preserve= NULL; type->preserve = NULL;
} }
type->map_count= map_count; type->map_count= map_count;
} }
@ -807,19 +805,13 @@ XkbClientMapPtr map;
register int i; register int i;
XkbKeyTypePtr type; XkbKeyTypePtr type;
for (i=0,type=map->types;i<map->num_types;i++,type++) { for (i=0,type=map->types;i<map->num_types;i++,type++) {
if (type->map!=NULL) { free(type->map);
free(type->map); type->map = NULL;
type->map= NULL; free(type->preserve);
} type->preserve = NULL;
if (type->preserve!=NULL) {
free(type->preserve);
type->preserve= NULL;
}
type->map_count= 0; type->map_count= 0;
if (type->level_names!=NULL) { free(type->level_names);
free(type->level_names); type->level_names = NULL;
type->level_names= NULL;
}
} }
} }
free(map->types); free(map->types);
@ -828,10 +820,8 @@ XkbClientMapPtr map;
} }
} }
if (what&XkbKeySymsMask) { if (what&XkbKeySymsMask) {
if (map->key_sym_map!=NULL) { free(map->key_sym_map);
free(map->key_sym_map); map->key_sym_map = NULL;
map->key_sym_map= NULL;
}
if (map->syms!=NULL) { if (map->syms!=NULL) {
free(map->syms); free(map->syms);
map->size_syms= map->num_syms= 0; map->size_syms= map->num_syms= 0;
@ -864,10 +854,8 @@ XkbServerMapPtr map;
map->explicit= NULL; map->explicit= NULL;
} }
if (what&XkbKeyActionsMask) { if (what&XkbKeyActionsMask) {
if (map->key_acts!=NULL) { free(map->key_acts);
free(map->key_acts); map->key_acts = NULL;
map->key_acts= NULL;
}
if (map->acts!=NULL) { if (map->acts!=NULL) {
free(map->acts); free(map->acts);
map->num_acts= map->size_acts= 0; map->num_acts= map->size_acts= 0;

View File

@ -267,8 +267,7 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
strncpy(nameRtrn,keymap,nameRtrnLen); strncpy(nameRtrn,keymap,nameRtrnLen);
nameRtrn[nameRtrnLen-1]= '\0'; nameRtrn[nameRtrnLen-1]= '\0';
} }
if (buf != NULL) free(buf);
free(buf);
return TRUE; return TRUE;
} }
else else
@ -287,8 +286,7 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
} }
if (nameRtrn) if (nameRtrn)
nameRtrn[0]= '\0'; nameRtrn[0]= '\0';
if (buf != NULL) free(buf);
free(buf);
return FALSE; return FALSE;
} }