diff options
author | marha <marha@users.sourceforge.net> | 2012-03-26 14:23:28 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-03-26 14:23:28 +0200 |
commit | 76bcc36ed305418a3ddc5752d287ede894243e1b (patch) | |
tree | bacb320c825768471ce56f058f17ce863d592376 /xorg-server/Xi/xichangehierarchy.c | |
parent | 7d894e32566b710952c44cbc71939ad1d9e2fa8d (diff) | |
parent | 0f834b91a4768673833ab4917e87d86c237bb1a6 (diff) | |
download | vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.gz vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.bz2 vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
pixman/pixman/pixman-mmx.c
xorg-server/Xext/shm.c
xorg-server/Xext/syncsrv.h
xorg-server/Xext/xvmain.c
xorg-server/Xi/exevents.c
xorg-server/Xi/opendev.c
xorg-server/composite/compalloc.c
xorg-server/composite/compoverlay.c
xorg-server/dix/colormap.c
xorg-server/dix/devices.c
xorg-server/dix/dispatch.c
xorg-server/dix/dixfonts.c
xorg-server/dix/eventconvert.c
xorg-server/dix/events.c
xorg-server/dix/gc.c
xorg-server/dix/getevents.c
xorg-server/dix/main.c
xorg-server/dix/privates.c
xorg-server/dix/registry.c
xorg-server/dix/resource.c
xorg-server/exa/exa_accel.c
xorg-server/exa/exa_migration_classic.c
xorg-server/exa/exa_unaccel.c
xorg-server/fb/fb.h
xorg-server/fb/fbcopy.c
xorg-server/fb/fbpixmap.c
xorg-server/glx/dispatch.h
xorg-server/glx/glapi.h
xorg-server/glx/glapi_gentable.c
xorg-server/glx/glapitable.h
xorg-server/glx/glprocs.h
xorg-server/glx/glxcmds.c
xorg-server/glx/glxcmdsswap.c
xorg-server/glx/glxdricommon.c
xorg-server/glx/glxdriswrast.c
xorg-server/glx/glxext.c
xorg-server/glx/indirect_dispatch.c
xorg-server/glx/indirect_dispatch.h
xorg-server/glx/indirect_dispatch_swap.c
xorg-server/glx/indirect_size.h
xorg-server/glx/indirect_size_get.h
xorg-server/glx/indirect_table.c
xorg-server/glx/indirect_util.c
xorg-server/glx/rensize.c
xorg-server/glx/single2swap.c
xorg-server/glx/singlepix.c
xorg-server/glx/singlepixswap.c
xorg-server/glx/singlesize.c
xorg-server/hw/dmx/dmxinit.c
xorg-server/hw/kdrive/ephyr/ephyr.c
xorg-server/hw/kdrive/ephyr/hostx.c
xorg-server/hw/kdrive/ephyr/hostx.h
xorg-server/hw/kdrive/src/kinput.c
xorg-server/hw/xfree86/common/compiler.h
xorg-server/hw/xwin/InitInput.c
xorg-server/hw/xwin/InitOutput.c
xorg-server/hw/xwin/ddraw.h
xorg-server/hw/xwin/glx/glwrap.c
xorg-server/hw/xwin/glx/indirect.c
xorg-server/hw/xwin/glx/wgl_ext_api.h
xorg-server/hw/xwin/glx/winpriv.c
xorg-server/hw/xwin/win.h
xorg-server/hw/xwin/winallpriv.c
xorg-server/hw/xwin/winauth.c
xorg-server/hw/xwin/winclipboard.h
xorg-server/hw/xwin/winclipboardinit.c
xorg-server/hw/xwin/winclipboardthread.c
xorg-server/hw/xwin/winclipboardunicode.c
xorg-server/hw/xwin/winclipboardwndproc.c
xorg-server/hw/xwin/winclipboardwrappers.c
xorg-server/hw/xwin/winclipboardxevents.c
xorg-server/hw/xwin/wincmap.c
xorg-server/hw/xwin/winconfig.c
xorg-server/hw/xwin/wincreatewnd.c
xorg-server/hw/xwin/wincursor.c
xorg-server/hw/xwin/windialogs.c
xorg-server/hw/xwin/winengine.c
xorg-server/hw/xwin/winerror.c
xorg-server/hw/xwin/wingc.c
xorg-server/hw/xwin/wingetsp.c
xorg-server/hw/xwin/winkeybd.c
xorg-server/hw/xwin/winkeybd.h
xorg-server/hw/xwin/winlayouts.h
xorg-server/hw/xwin/winmisc.c
xorg-server/hw/xwin/winmonitors.c
xorg-server/hw/xwin/winmouse.c
xorg-server/hw/xwin/winmsg.c
xorg-server/hw/xwin/winmsg.h
xorg-server/hw/xwin/winmultiwindowclass.c
xorg-server/hw/xwin/winmultiwindowicons.c
xorg-server/hw/xwin/winmultiwindowshape.c
xorg-server/hw/xwin/winmultiwindowwindow.c
xorg-server/hw/xwin/winmultiwindowwm.c
xorg-server/hw/xwin/winmultiwindowwndproc.c
xorg-server/hw/xwin/winnativegdi.c
xorg-server/hw/xwin/winpfbdd.c
xorg-server/hw/xwin/winpixmap.c
xorg-server/hw/xwin/winpolyline.c
xorg-server/hw/xwin/winprefs.c
xorg-server/hw/xwin/winprocarg.c
xorg-server/hw/xwin/winregistry.c
xorg-server/hw/xwin/winscrinit.c
xorg-server/hw/xwin/winsetsp.c
xorg-server/hw/xwin/winshaddd.c
xorg-server/hw/xwin/winshadddnl.c
xorg-server/hw/xwin/winshadgdi.c
xorg-server/hw/xwin/wintrayicon.c
xorg-server/hw/xwin/winwin32rootless.c
xorg-server/hw/xwin/winwin32rootlesswindow.c
xorg-server/hw/xwin/winwin32rootlesswndproc.c
xorg-server/hw/xwin/winwindow.c
xorg-server/hw/xwin/winwindow.h
xorg-server/hw/xwin/winwindowswm.c
xorg-server/hw/xwin/winwndproc.c
xorg-server/include/callback.h
xorg-server/include/dixstruct.h
xorg-server/include/misc.h
xorg-server/include/os.h
xorg-server/include/scrnintstr.h
xorg-server/mi/micmap.c
xorg-server/mi/miinitext.c
xorg-server/mi/mioverlay.c
xorg-server/mi/misprite.c
xorg-server/mi/mivaltree.c
xorg-server/mi/miwindow.c
xorg-server/miext/damage/damage.c
xorg-server/miext/rootless/rootlessGC.c
xorg-server/miext/rootless/rootlessWindow.c
xorg-server/os/WaitFor.c
xorg-server/os/access.c
xorg-server/os/connection.c
xorg-server/os/io.c
xorg-server/os/log.c
xorg-server/os/osinit.c
xorg-server/os/utils.c
xorg-server/os/xdmcp.c
xorg-server/os/xprintf.c
xorg-server/os/xstrans.c
xorg-server/render/mipict.c
xorg-server/xkb/xkbActions.c
xorg-server/xkb/xkbInit.c
xorg-server/xkeyboard-config/compat/default.in
Diffstat (limited to 'xorg-server/Xi/xichangehierarchy.c')
-rw-r--r-- | xorg-server/Xi/xichangehierarchy.c | 217 |
1 files changed, 93 insertions, 124 deletions
diff --git a/xorg-server/Xi/xichangehierarchy.c b/xorg-server/Xi/xichangehierarchy.c index 503404e64..756aaac06 100644 --- a/xorg-server/Xi/xichangehierarchy.c +++ b/xorg-server/Xi/xichangehierarchy.c @@ -30,16 +30,15 @@ * */ - #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif -#include <X11/X.h> /* for inputstr.h */ -#include <X11/Xproto.h> /* Request macro */ -#include "inputstr.h" /* DeviceIntPtr */ -#include "windowstr.h" /* window structure */ -#include "scrnintstr.h" /* screen structure */ +#include <X11/X.h> /* for inputstr.h */ +#include <X11/Xproto.h> /* Request macro */ +#include "inputstr.h" /* DeviceIntPtr */ +#include "windowstr.h" /* window structure */ +#include "scrnintstr.h" /* screen structure */ #include <X11/extensions/XI.h> #include <X11/extensions/XI2proto.h> #include <X11/extensions/geproto.h> @@ -48,7 +47,7 @@ #include "exglobals.h" #include "geext.h" #include "xace.h" -#include "xiquerydevice.h" /* for GetDeviceUse */ +#include "xiquerydevice.h" /* for GetDeviceUse */ #include "xkbsrv.h" @@ -57,7 +56,8 @@ /** * Send the current state of the device hierarchy to all clients. */ -void XISendDeviceHierarchyEvent(int flags[MAXDEVICES]) +void +XISendDeviceHierarchyEvent(int flags[MAXDEVICES]) { xXIHierarchyEvent *ev; xXIHierarchyInfo *info; @@ -69,7 +69,7 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES]) return; ev = calloc(1, sizeof(xXIHierarchyEvent) + - MAXDEVICES * sizeof(xXIHierarchyInfo)); + MAXDEVICES * sizeof(xXIHierarchyInfo)); if (!ev) return; ev->type = GenericEvent; @@ -79,9 +79,8 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES]) ev->flags = 0; ev->num_info = inputInfo.numDevices; - info = (xXIHierarchyInfo*)&ev[1]; - for (dev = inputInfo.devices; dev; dev = dev->next) - { + info = (xXIHierarchyInfo *) & ev[1]; + for (dev = inputInfo.devices; dev; dev = dev->next) { info->deviceid = dev->id; info->enabled = dev->enabled; info->use = GetDeviceUse(dev, &info->attachment); @@ -89,8 +88,7 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES]) ev->flags |= info->flags; info++; } - for (dev = inputInfo.off_devices; dev; dev = dev->next) - { + for (dev = inputInfo.off_devices; dev; dev = dev->next) { info->deviceid = dev->id; info->enabled = dev->enabled; info->use = GetDeviceUse(dev, &info->attachment); @@ -99,11 +97,8 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES]) info++; } - - for (i = 0; i < MAXDEVICES; i++) - { - if (flags[i] & (XIMasterRemoved | XISlaveRemoved)) - { + for (i = 0; i < MAXDEVICES; i++) { + if (flags[i] & (XIMasterRemoved | XISlaveRemoved)) { info->deviceid = i; info->enabled = FALSE; info->flags = flags[i]; @@ -119,11 +114,11 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES]) memset(&dummyDev, 0, sizeof(dummyDev)); dummyDev.id = XIAllDevices; dummyDev.type = SLAVE; - SendEventToAllWindows(&dummyDev, (XI_HierarchyChangedMask >> 8), (xEvent*)ev, 1); + SendEventToAllWindows(&dummyDev, (XI_HierarchyChangedMask >> 8), + (xEvent *) ev, 1); free(ev); } - /*********************************************************************** * * This procedure allows a client to change the device hierarchy through @@ -131,7 +126,8 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES]) * */ -int SProcXIChangeHierarchy(ClientPtr client) +int +SProcXIChangeHierarchy(ClientPtr client) { REQUEST(xXIChangeHierarchyReq); swaps(&stuff->length); @@ -139,14 +135,14 @@ int SProcXIChangeHierarchy(ClientPtr client) } static int -add_master(ClientPtr client, xXIAddMasterInfo *c, int flags[MAXDEVICES]) +add_master(ClientPtr client, xXIAddMasterInfo * c, int flags[MAXDEVICES]) { DeviceIntPtr ptr, keybd, XTestptr, XTestkeybd; - char* name; + char *name; int rc; name = calloc(c->name_len + 1, sizeof(char)); - strncpy(name, (char*)&c[1], c->name_len); + strncpy(name, (char *) &c[1], c->name_len); rc = AllocDevicePair(client, name, &ptr, &keybd, CorePointerProc, CoreKeyboardProc, TRUE); @@ -154,12 +150,11 @@ add_master(ClientPtr client, xXIAddMasterInfo *c, int flags[MAXDEVICES]) goto unwind; if (!c->send_core) - ptr->coreEvents = keybd->coreEvents = FALSE; + ptr->coreEvents = keybd->coreEvents = FALSE; /* Allocate virtual slave devices for xtest events */ rc = AllocXTestDevice(client, name, &XTestptr, &XTestkeybd, ptr, keybd); - if (rc != Success) - { + if (rc != Success) { DeleteInputDeviceRequest(ptr); DeleteInputDeviceRequest(keybd); goto unwind; @@ -175,8 +170,7 @@ add_master(ClientPtr client, xXIAddMasterInfo *c, int flags[MAXDEVICES]) flags[XTestptr->id] |= XISlaveAdded; flags[XTestkeybd->id] |= XISlaveAdded; - if (c->enable) - { + if (c->enable) { EnableDevice(ptr, FALSE); EnableDevice(keybd, FALSE); flags[ptr->id] |= XIDeviceEnabled; @@ -195,7 +189,7 @@ add_master(ClientPtr client, xXIAddMasterInfo *c, int flags[MAXDEVICES]) flags[XTestptr->id] |= XISlaveAttached; flags[XTestkeybd->id] |= XISlaveAttached; -unwind: + unwind: free(name); return rc; } @@ -205,44 +199,39 @@ disable_clientpointer(DeviceIntPtr dev) { int i; - for (i = 0; i < currentMaxClients; i++) - { + for (i = 0; i < currentMaxClients; i++) { ClientPtr client = clients[i]; + if (client && client->clientPtr == dev) client->clientPtr = NULL; } } static int -remove_master(ClientPtr client, xXIRemoveMasterInfo *r, - int flags[MAXDEVICES]) +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) + 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)) - { + 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) - { + 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) @@ -258,8 +247,7 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo *r, goto unwind; XTestkeybd = GetXTestDevice(keybd); - rc = dixLookupDevice(&XTestkeybd, XTestkeybd->id, client, - DixDestroyAccess); + rc = dixLookupDevice(&XTestkeybd, XTestkeybd->id, client, DixDestroyAccess); if (rc != Success) goto unwind; @@ -267,18 +255,14 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo *r, /* Disabling sends the devices floating, reattach them if * desired. */ - if (r->return_mode == XIAttachToMaster) - { - DeviceIntPtr attached, - newptr, - newkeybd; + 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)) - { + if (!IsMaster(newptr)) { client->errorValue = r->return_pointer; rc = BadDevice; goto unwind; @@ -289,23 +273,19 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo *r, if (rc != Success) goto unwind; - if (!IsMaster(newkeybd)) - { + if (!IsMaster(newkeybd)) { client->errorValue = r->return_keyboard; rc = BadDevice; goto unwind; } - for (attached = inputInfo.devices; attached; attached = attached->next) - { + for (attached = inputInfo.devices; attached; attached = attached->next) { if (!IsMaster(attached)) { - if (GetMaster(attached, MASTER_ATTACHED) == ptr) - { + if (GetMaster(attached, MASTER_ATTACHED) == ptr) { AttachDevice(client, attached, newptr); flags[attached->id] |= XISlaveAttached; } - if (GetMaster(attached, MASTER_ATTACHED) == keybd) - { + if (GetMaster(attached, MASTER_ATTACHED) == keybd) { AttachDevice(client, attached, newkeybd); flags[attached->id] |= XISlaveAttached; } @@ -339,12 +319,12 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo *r, flags[keybd->id] |= XIMasterRemoved; flags[ptr->id] |= XIMasterRemoved; -unwind: + unwind: return rc; } static int -detach_slave(ClientPtr client, xXIDetachSlaveInfo *c, int flags[MAXDEVICES]) +detach_slave(ClientPtr client, xXIDetachSlaveInfo * c, int flags[MAXDEVICES]) { DeviceIntPtr dev; int rc; @@ -353,16 +333,14 @@ detach_slave(ClientPtr client, xXIDetachSlaveInfo *c, int flags[MAXDEVICES]) if (rc != Success) goto unwind; - if (IsMaster(dev)) - { + 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)) - { + if (IsXTestDevice(dev, NULL)) { client->errorValue = c->deviceid; rc = BadDevice; goto unwind; @@ -372,13 +350,12 @@ detach_slave(ClientPtr client, xXIDetachSlaveInfo *c, int flags[MAXDEVICES]) AttachDevice(client, dev, NULL); flags[dev->id] |= XISlaveDetached; -unwind: + unwind: return rc; } static int -attach_slave(ClientPtr client, xXIAttachSlaveInfo *c, - int flags[MAXDEVICES]) +attach_slave(ClientPtr client, xXIAttachSlaveInfo * c, int flags[MAXDEVICES]) { DeviceIntPtr dev; DeviceIntPtr newmaster; @@ -388,16 +365,14 @@ attach_slave(ClientPtr client, xXIAttachSlaveInfo *c, if (rc != Success) goto unwind; - if (IsMaster(dev)) - { + 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)) - { + if (IsXTestDevice(dev, NULL)) { client->errorValue = c->deviceid; rc = BadDevice; goto unwind; @@ -406,16 +381,14 @@ attach_slave(ClientPtr client, xXIAttachSlaveInfo *c, rc = dixLookupDevice(&newmaster, c->new_master, client, DixAddAccess); if (rc != Success) goto unwind; - if (!IsMaster(newmaster)) - { + if (!IsMaster(newmaster)) { client->errorValue = c->new_master; rc = BadDevice; goto unwind; } if (!((IsPointerDevice(newmaster) && IsPointerDevice(dev)) || - (IsKeyboardDevice(newmaster) && IsKeyboardDevice(dev)))) - { + (IsKeyboardDevice(newmaster) && IsKeyboardDevice(dev)))) { rc = BadDevice; goto unwind; } @@ -424,12 +397,10 @@ attach_slave(ClientPtr client, xXIAttachSlaveInfo *c, AttachDevice(client, dev, newmaster); flags[dev->id] |= XISlaveAttached; -unwind: + unwind: return rc; } - - #define SWAPIF(cmd) if (client->swapped) { cmd; } int @@ -438,7 +409,7 @@ ProcXIChangeHierarchy(ClientPtr client) xXIAnyHierarchyChangeInfo *any; int required_len = sizeof(xXIChangeHierarchyReq); int rc = Success; - int flags[MAXDEVICES] = {0}; + int flags[MAXDEVICES] = { 0 }; REQUEST(xXIChangeHierarchyReq); REQUEST_AT_LEAST_SIZE(xXIChangeHierarchyReq); @@ -446,9 +417,8 @@ ProcXIChangeHierarchy(ClientPtr client) if (!stuff->num_changes) return rc; - any = (xXIAnyHierarchyChangeInfo*)&stuff[1]; - while(stuff->num_changes--) - { + any = (xXIAnyHierarchyChangeInfo *) &stuff[1]; + while (stuff->num_changes--) { SWAPIF(swaps(&any->type)); SWAPIF(swaps(&any->length)); @@ -456,53 +426,52 @@ ProcXIChangeHierarchy(ClientPtr client) if ((stuff->length * 4) < required_len) return BadLength; - switch(any->type) + switch (any->type) { + case XIAddMaster: { - case XIAddMaster: - { - xXIAddMasterInfo* c = (xXIAddMasterInfo*)any; - SWAPIF(swaps(&c->name_len)); - - rc = add_master(client, c, flags); - if (rc != Success) - goto unwind; - } - break; - case XIRemoveMaster: - { - xXIRemoveMasterInfo* r = (xXIRemoveMasterInfo*)any; - - rc = remove_master(client, r, flags); - if (rc != Success) - goto unwind; - } - break; - case XIDetachSlave: - { - xXIDetachSlaveInfo* c = (xXIDetachSlaveInfo*)any; - - rc = detach_slave(client, c, flags); - if (rc != Success) - goto unwind; - } - break; - case XIAttachSlave: - { - xXIAttachSlaveInfo* c = (xXIAttachSlaveInfo*)any; - - rc = attach_slave(client, c, flags); - if (rc != Success) - goto unwind; - } - break; + xXIAddMasterInfo *c = (xXIAddMasterInfo *) any; + + SWAPIF(swaps(&c->name_len)); + + rc = add_master(client, c, flags); + if (rc != Success) + goto unwind; } + break; + case XIRemoveMaster: + { + xXIRemoveMasterInfo *r = (xXIRemoveMasterInfo *) any; + + rc = remove_master(client, r, flags); + if (rc != Success) + goto unwind; + } + break; + case XIDetachSlave: + { + xXIDetachSlaveInfo *c = (xXIDetachSlaveInfo *) any; - any = (xXIAnyHierarchyChangeInfo*)((char*)any + any->length * 4); + rc = detach_slave(client, c, flags); + if (rc != Success) + goto unwind; + } + break; + case XIAttachSlave: + { + xXIAttachSlaveInfo *c = (xXIAttachSlaveInfo *) any; + + rc = attach_slave(client, c, flags); + if (rc != Success) + goto unwind; + } + break; + } + + any = (xXIAnyHierarchyChangeInfo *) ((char *) any + any->length * 4); } -unwind: + unwind: XISendDeviceHierarchyEvent(flags); return rc; } - |