diff options
-rw-r--r-- | src/Pointer.c | 87 |
1 files changed, 41 insertions, 46 deletions
diff --git a/src/Pointer.c b/src/Pointer.c index 70b0ea8..910db99 100644 --- a/src/Pointer.c +++ b/src/Pointer.c @@ -54,60 +54,55 @@ in this Software without prior written authorization from The Open Group. #include "IntrinsicI.h" #include "PassivGraI.h" - #define AllButtonsMask (Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask) -Widget _XtProcessPointerEvent( - XButtonEvent *event, - Widget widget, - XtPerDisplayInput pdi) +Widget +_XtProcessPointerEvent(XButtonEvent *event, + Widget widget, + XtPerDisplayInput pdi) { - XtDevice device = &pdi->pointer; - XtServerGrabPtr newGrab = NULL, devGrab = &device->grab; - Widget dspWidget = NULL; - Boolean deactivateGrab = FALSE; - - switch (event->type) - { - case ButtonPress: - { - if (!IsServerGrab(device->grabType)) - { - Cardinal i; - - for (i = (Cardinal) pdi->traceDepth; - i > 0 && !newGrab; - i--) - newGrab = _XtCheckServerGrabsOnWidget((XEvent*)event, - pdi->trace[i-1], - POINTER); - } - if (newGrab) - { - /* Activate the grab */ - device->grab = *newGrab; - device->grabType = XtPassiveServerGrab; - } - } - break; - - case ButtonRelease: - { - if ((device->grabType == XtPassiveServerGrab) && - !(event->state & (unsigned)(~(Button1Mask << (event->button - 1))) & - AllButtonsMask)) - deactivateGrab = TRUE; - } - break; - } + XtDevice device = &pdi->pointer; + XtServerGrabPtr newGrab = NULL, devGrab = &device->grab; + Widget dspWidget = NULL; + Boolean deactivateGrab = FALSE; + + switch (event->type) { + case ButtonPress: + { + if (!IsServerGrab(device->grabType)) { + Cardinal i; + + for (i = (Cardinal) pdi->traceDepth; i > 0 && !newGrab; i--) + newGrab = _XtCheckServerGrabsOnWidget((XEvent *) event, + pdi->trace[i - 1], + POINTER); + } + if (newGrab) { + /* Activate the grab */ + device->grab = *newGrab; + device->grabType = XtPassiveServerGrab; + } + } + break; + + case ButtonRelease: + { + if ((device->grabType == XtPassiveServerGrab) && + !(event-> + state & (unsigned) (~(Button1Mask << (event->button - 1))) & + AllButtonsMask)) + deactivateGrab = TRUE; + } + break; + } if (IsServerGrab(device->grabType) && !(devGrab)->ownerEvents) - dspWidget = (devGrab)->widget; + dspWidget = (devGrab)->widget; else - dspWidget = widget; + dspWidget = widget; if (deactivateGrab) - device->grabType = XtNoServerGrab; + device->grabType = XtNoServerGrab; return dspWidget; } |