diff --git a/hw/dmx/dmxextension.c b/hw/dmx/dmxextension.c index fdae4b964..a7c70a571 100644 --- a/hw/dmx/dmxextension.c +++ b/hw/dmx/dmxextension.c @@ -304,14 +304,6 @@ int dmxGetInputAttributes(int deviceId, DMXInputAttributesPtr attr) return -1; /* Failure */ } -static void dmxBERestorePassiveGrab(pointer value, XID id, pointer closure) -{ - DMXInputInfo *dmxInput = (DMXInputInfo *) closure; - GrabPtr pGrab = value; - - dmxBEAddPassiveGrab (dmxInput, pGrab); -} - /** Add an input with the specified attributes. If the input is added, * the physical id is returned in \a deviceId. */ int dmxAddInput(DMXInputAttributesPtr attr, int *id) @@ -326,19 +318,11 @@ int dmxAddInput(DMXInputAttributesPtr attr, int *id) if (dmxScreen->beDisplay) { - int j; - ret = dmxInputAttach (&dmxScreen->input); if (ret != Success) return ret; dmxInputEnable (&dmxScreen->input); - - for (j = currentMaxClients; --j >= 0; ) - if (clients[j]) - FindClientResourcesByType (clients[j], RT_PASSIVEGRAB, - dmxBERestorePassiveGrab, - (pointer) &dmxScreen->input); } else { @@ -1657,12 +1641,6 @@ dmxEnableScreen (int idx) #endif dmxInputEnable (&dmxScreen->input); - - for (i = currentMaxClients; --i >= 0; ) - if (clients[i]) - FindClientResourcesByType (clients[i], RT_PASSIVEGRAB, - dmxBERestorePassiveGrab, - (pointer) &dmxScreen->input); } /* diff --git a/hw/dmx/dmxgrab.c b/hw/dmx/dmxgrab.c index 2cfb72a8f..6d4b5ba50 100644 --- a/hw/dmx/dmxgrab.c +++ b/hw/dmx/dmxgrab.c @@ -38,116 +38,8 @@ #include "panoramiXsrv.h" #endif -unsigned long DMX_PASSIVEGRAB; - static int (*dmxSaveProcVector[256]) (ClientPtr); -void -dmxBEAddPassiveGrab (DMXInputInfo *dmxInput, - GrabPtr pGrab) -{ - DMXScreenInfo *dmxScreen = (DMXScreenInfo *) dmxInput; - WindowPtr pWin = pGrab->window; - WindowPtr pConfineTo = pGrab->confineTo; - - if (dixLookupResource ((pointer *) &pGrab, - pGrab->resource, - DMX_PASSIVEGRAB, - serverClient, - DixReadAccess) != Success) - return; - -#ifdef PANORAMIX - if (!noPanoramiXExtension) - { - PanoramiXRes *win, *confineToWin; - - if (!(win = (PanoramiXRes *)SecurityLookupIDByType( - serverClient, pWin->drawable.id, XRT_WINDOW, - DixGetAttrAccess)) || - dixLookupWindow (&pWin, - win->info[dmxScreen->index].id, - serverClient, - DixGetAttrAccess) != Success) - return; - - if (pGrab->confineTo) - if (!(confineToWin = (PanoramiXRes *)SecurityLookupIDByType( - serverClient, pGrab->confineTo->drawable.id, XRT_WINDOW, - DixGetAttrAccess)) || - dixLookupWindow (&pConfineTo, - confineToWin->info[dmxScreen->index].id, - serverClient, - DixGetAttrAccess) != Success) - return; - } - else -#endif - if (dmxScreen->index != pWin->drawable.pScreen->myNum) - return; - - dmxInputGrabButton (dmxInput, - pGrab->device, - pGrab->modifierDevice, - pWin, - pConfineTo, - pGrab->detail.exact, - pGrab->modifiersDetail.exact, - pGrab->cursor); -} - -static int -dmxFreePassiveGrab (pointer value, - XID id) -{ - GrabPtr pGrab = (GrabPtr) value; - -#ifdef PANORAMIX - PanoramiXRes *win = NULL; -#endif - - WindowPtr pWin = pGrab->window; - int i; - -#ifdef PANORAMIX - if (!noPanoramiXExtension) - { - if (!(win = (PanoramiXRes *)SecurityLookupIDByType( - serverClient, pWin->drawable.id, XRT_WINDOW, - DixGetAttrAccess))) - return Success; - } -#endif - - for (i = 0; i < dmxNumScreens; i++) - { - DMXScreenInfo *dmxScreen = &dmxScreens[i]; - - if (!dmxScreen->beDisplay) - continue; - -#ifdef PANORAMIX - if (!noPanoramiXExtension) - dixLookupWindow (&pWin, - win->info[i].id, - serverClient, - DixGetAttrAccess); - else -#endif - if (i != pWin->drawable.pScreen->myNum) - continue; - - dmxInputUngrabButton (&dmxScreen->input, - pGrab->device, - pGrab->modifierDevice, - pWin, - pGrab->detail.exact, - pGrab->modifiersDetail.exact); - } - - return Success; -} - static void dmxGrabPointer (DeviceIntPtr pDev, GrabPtr pGrab) @@ -323,83 +215,6 @@ dmxDeactivateFakePointerGrab (DeviceIntPtr pDev) &pDev->deviceGrab); } -static int -dmxProcGrabButton (ClientPtr client) -{ - GrabPtr pGrab; - -#ifdef PANORAMIX - PanoramiXRes *win = NULL, *confineToWin = NULL; -#endif - - WindowPtr pWin, pConfineTo = NULL; - int i, err; - REQUEST(xGrabButtonReq); - - err = (*dmxSaveProcVector[X_GrabButton]) (client); - if (err != Success) - return err; - - return Success; /* PASSIVE GRABS DISABLED */ - - dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess); - pGrab = wPassiveGrabs (pWin); - - pConfineTo = pGrab->confineTo; - -#ifdef PANORAMIX - if (!noPanoramiXExtension) - { - if (!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->grabWindow, XRT_WINDOW, DixSetAttrAccess))) - return Success; - if (pConfineTo) - if (!(confineToWin = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->confineTo, XRT_WINDOW, DixSetAttrAccess))) - return Success; - } -#endif - - for (i = 0; i < dmxNumScreens; i++) - { - DMXScreenInfo *dmxScreen = &dmxScreens[i]; - - if (!dmxScreen->beDisplay) - continue; - -#ifdef PANORAMIX - if (!noPanoramiXExtension) - { - dixLookupWindow (&pWin, - win->info[i].id, - client, - DixSetAttrAccess); - if (confineToWin) - dixLookupWindow (&pConfineTo, - confineToWin->info[i].id, - client, - DixSetAttrAccess); - } - else -#endif - if (i != pWin->drawable.pScreen->myNum) - continue; - - dmxInputGrabButton (&dmxScreen->input, - pGrab->device, - pGrab->modifierDevice, - pWin, - pConfineTo, - pGrab->detail.exact, - pGrab->modifiersDetail.exact, - pGrab->cursor); - } - - AddResource (pGrab->resource, DMX_PASSIVEGRAB, pGrab); - - return Success; -} - static int dmxProcChangeActivePointerGrab (ClientPtr client) { @@ -423,12 +238,9 @@ void dmxInitGrabs (void) { int i; - DMX_PASSIVEGRAB = CreateNewResourceType (dmxFreePassiveGrab); - for (i = 0; i < 256; i++) dmxSaveProcVector[i] = ProcVector[i]; - ProcVector[X_GrabButton] = dmxProcGrabButton; ProcVector[X_ChangeActivePointerGrab] = dmxProcChangeActivePointerGrab; } diff --git a/hw/dmx/dmxgrab.h b/hw/dmx/dmxgrab.h index ed0de0a5a..0264b904b 100644 --- a/hw/dmx/dmxgrab.h +++ b/hw/dmx/dmxgrab.h @@ -28,9 +28,6 @@ #include "dmxinput.h" -extern void dmxBEAddPassiveGrab (DMXInputInfo *dmxInput, - GrabPtr pGrab); - extern void dmxActivatePointerGrab (DeviceIntPtr pDev, GrabPtr pGrab, TimeStamp time, diff --git a/hw/dmx/dmxinput.c b/hw/dmx/dmxinput.c index ae8e0e977..d5aa03f53 100644 --- a/hw/dmx/dmxinput.c +++ b/hw/dmx/dmxinput.c @@ -1027,202 +1027,6 @@ dmxInputEventCheck (DMXInputInfo *dmxInput, return FALSE; } -static void -dmxDeviceGrabButton (DeviceIntPtr pDevice, - DeviceIntPtr pModDevice, - WindowPtr pWindow, - WindowPtr pConfineTo, - int button, - int modifiers, - CursorPtr pCursor) -{ - dmxDevicePrivPtr pDevPriv = DMX_GET_DEVICE_PRIV (pDevice); - DMXScreenInfo *dmxScreen = (DMXScreenInfo *) pDevPriv->dmxInput; - ScreenPtr pScreen = screenInfo.screens[dmxScreen->index]; - Window window = (DMX_GET_WINDOW_PRIV (pWindow))->window; - Window confineTo = None; - Cursor cursor = None; - - if (pConfineTo) - confineTo = (DMX_GET_WINDOW_PRIV (pConfineTo))->window; - - if (pCursor) - cursor = (DMX_GET_CURSOR_PRIV (pCursor, pScreen))->cursor; - - if (pDevPriv->deviceId >= 0) - { - int id = pDevPriv->deviceId; - int modId = 0; - - if (pModDevice) - modId = DMX_GET_DEVICE_PRIV (pModDevice)->deviceId; - - /* this is really useless as XGrabDeviceButton doesn't allow us - to specify a confineTo window or cursor */ - xcb_input_grab_device_button (dmxScreen->connection, - window, - id, - modId, - 0, - modifiers, - XCB_GRAB_MODE_ASYNC, - XCB_GRAB_MODE_ASYNC, - button, - TRUE, - NULL); - } - else - { - xcb_grab_button (dmxScreen->connection, - TRUE, - window, - 0, - XCB_GRAB_MODE_ASYNC, - XCB_GRAB_MODE_ASYNC, - confineTo, - cursor, - button, - modifiers); - } -} - -static void -dmxDeviceUngrabButton (DeviceIntPtr pDevice, - DeviceIntPtr pModDevice, - WindowPtr pWindow, - int button, - int modifiers) -{ - dmxDevicePrivPtr pDevPriv = DMX_GET_DEVICE_PRIV (pDevice); - DMXScreenInfo *dmxScreen = (DMXScreenInfo *) pDevPriv->dmxInput; - Window window = (DMX_GET_WINDOW_PRIV (pWindow))->window; - - if (pDevPriv->deviceId >= 0) - { - int id = pDevPriv->deviceId; - int modId = 0; - - if (pModDevice) - modId = DMX_GET_DEVICE_PRIV (pModDevice)->deviceId; - - xcb_input_ungrab_device_button (dmxScreen->connection, - window, - modifiers, - modId, - button, - id); - } - else - { - xcb_ungrab_button (dmxScreen->connection, - button, - window, - modifiers); - } -} - -void -dmxInputGrabButton (DMXInputInfo *dmxInput, - DeviceIntPtr pDevice, - DeviceIntPtr pModDevice, - WindowPtr pWindow, - WindowPtr pConfineTo, - int button, - int modifiers, - CursorPtr pCursor) -{ - int i, j; - - for (i = 0; i < dmxInput->numDevs; i++) - { - DeviceIntPtr pExtDevice = dmxInput->devs[i]; - - if (pExtDevice->u.master != pDevice) - continue; - - if (!pExtDevice->button) - continue; - - if (modifiers & AnyModifier) - { - dmxDeviceGrabButton (pExtDevice, - NULL, - pWindow, - pConfineTo, - button, - modifiers, - pCursor); - } - else - { - for (j = 0; j < dmxInput->numDevs; j++) - { - DeviceIntPtr pExtModDevice = dmxInput->devs[j]; - - if (!pExtModDevice->key) - continue; - - if (pExtModDevice->u.master == pModDevice) - dmxDeviceGrabButton (pExtDevice, - pExtModDevice, - pWindow, - pConfineTo, - button, - modifiers, - pCursor); - } - } - } -} - -void -dmxInputUngrabButton (DMXInputInfo *dmxInput, - DeviceIntPtr pDevice, - DeviceIntPtr pModDevice, - WindowPtr pWindow, - int button, - int modifiers) -{ - int i, j; - - for (i = 0; i < dmxInput->numDevs; i++) - { - DeviceIntPtr pExtDevice = dmxInput->devs[i]; - - if (pExtDevice->u.master != pDevice) - continue; - - if (!pExtDevice->button) - continue; - - if (modifiers == AnyModifier) - { - dmxDeviceUngrabButton (pExtDevice, - NULL, - pWindow, - button, - modifiers); - } - else - { - for (j = 0; j < dmxInput->numDevs; j++) - { - DeviceIntPtr pExtModDevice = dmxInput->devs[j]; - - if (!pExtModDevice->key) - continue; - - if (pExtModDevice->u.master == pModDevice) - dmxDeviceUngrabButton (pExtDevice, - pExtModDevice, - pWindow, - button, - modifiers); - } - } - } -} - void dmxInputGrabPointer (DMXInputInfo *dmxInput, DeviceIntPtr pDevice, diff --git a/hw/dmx/dmxinput.h b/hw/dmx/dmxinput.h index 9dd1385c0..47e3004df 100644 --- a/hw/dmx/dmxinput.h +++ b/hw/dmx/dmxinput.h @@ -62,24 +62,6 @@ Bool dmxInputEventCheck (DMXInputInfo *dmxInput, xcb_generic_event_t *event); -void -dmxInputGrabButton (DMXInputInfo *dmxInput, - DeviceIntPtr pDevice, - DeviceIntPtr pModDevice, - WindowPtr pWindow, - WindowPtr pConfineTo, - int button, - int modifiers, - CursorPtr pCursor); - -void -dmxInputUngrabButton (DMXInputInfo *dmxInput, - DeviceIntPtr pDevice, - DeviceIntPtr pModDevice, - WindowPtr pWindow, - int button, - int modifiers); - void dmxInputGrabPointer (DMXInputInfo *dmxInput, DeviceIntPtr pDevice,