From ca474e0920dd29ebe7ccf346cddc526732ad01ba Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Sun, 8 Oct 2006 20:30:49 +0300 Subject: [PATCH] Xi: move SendEventToAllWindows and FindInterestedChildren to exevents Move SendEventToAllWindows and FindInterestedChildren from chgptr to exevents, so the DIX can more easily use it. Clean up two warnings (type mismatch, unused variable) in exevents.c. --- Xi/chgptr.c | 41 --------------------------------------- Xi/exevents.c | 48 ++++++++++++++++++++++++++++++++++++++++++---- include/exevents.h | 13 +++++++++++++ 3 files changed, 57 insertions(+), 45 deletions(-) diff --git a/Xi/chgptr.c b/Xi/chgptr.c index f6f4b8bff..b79909216 100644 --- a/Xi/chgptr.c +++ b/Xi/chgptr.c @@ -178,47 +178,6 @@ DeleteFocusClassDeviceStruct(DeviceIntPtr dev) dev->focus = NULL; } -/*********************************************************************** - * - * Send an event to interested clients in all windows on all screens. - * - */ - -void -SendEventToAllWindows(DeviceIntPtr dev, Mask mask, xEvent * ev, int count) -{ - int i; - WindowPtr pWin, p1; - - for (i = 0; i < screenInfo.numScreens; i++) { - pWin = WindowTable[i]; - (void)DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, dev->id); - p1 = pWin->firstChild; - FindInterestedChildren(dev, p1, mask, ev, count); - } -} - -/*********************************************************************** - * - * Walk through the window tree, finding all clients that want to know - * about the ChangeDeviceNotify Event. - * - */ - -void -FindInterestedChildren(DeviceIntPtr dev, WindowPtr p1, Mask mask, - xEvent * ev, int count) -{ - WindowPtr p2; - - while (p1) { - p2 = p1->firstChild; - (void)DeliverEventsToWindow(p1, ev, count, mask, NullGrab, dev->id); - FindInterestedChildren(dev, p2, mask, ev, count); - p1 = p1->nextSib; - } -} - /*********************************************************************** * * This procedure writes the reply for the XChangePointerDevice diff --git a/Xi/exevents.c b/Xi/exevents.c index 9fdea6d9c..92a5f0599 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -71,8 +71,7 @@ SOFTWARE. #include "exglobals.h" #include "dixevents.h" /* DeliverFocusedEvent */ #include "dixgrabs.h" /* CreateGrab() */ - -#include "chgptr.h" +#include "scrnintstr.h" #define WID(w) ((w) ? ((w)->drawable.id) : 0) #define AllModifiersMask ( \ @@ -305,7 +304,7 @@ InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval, register AxisInfoPtr ax; if (!dev || !dev->valuator) - return NULL; + return; ax = dev->valuator->axes + axnum; @@ -903,7 +902,7 @@ SetModifierMapping(ClientPtr client, DeviceIntPtr dev, int len, int rlen, return MappingBusy; } else { for (i = 0; i < inputMapLen; i++) { - if (inputMap[i] && !LegalModifier(inputMap[i], (DevicePtr) dev)) { + if (inputMap[i] && !LegalModifier(inputMap[i], dev)) { return MappingFailed; } } @@ -1214,3 +1213,44 @@ ShouldFreeInputMasks(WindowPtr pWin, Bool ignoreSelectedEvents) else return FALSE; } + +/*********************************************************************** + * + * Walk through the window tree, finding all clients that want to know + * about the Event. + * + */ + +void +FindInterestedChildren(DeviceIntPtr dev, WindowPtr p1, Mask mask, + xEvent * ev, int count) +{ + WindowPtr p2; + + while (p1) { + p2 = p1->firstChild; + (void)DeliverEventsToWindow(p1, ev, count, mask, NullGrab, dev->id); + FindInterestedChildren(dev, p2, mask, ev, count); + p1 = p1->nextSib; + } +} + +/*********************************************************************** + * + * Send an event to interested clients in all windows on all screens. + * + */ + +void +SendEventToAllWindows(DeviceIntPtr dev, Mask mask, xEvent * ev, int count) +{ + int i; + WindowPtr pWin, p1; + + for (i = 0; i < screenInfo.numScreens; i++) { + pWin = WindowTable[i]; + (void)DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, dev->id); + p1 = pWin->firstChild; + FindInterestedChildren(dev, p1, mask, ev, count); + } +} diff --git a/include/exevents.h b/include/exevents.h index 1169a6c4e..7fbaddbb5 100644 --- a/include/exevents.h +++ b/include/exevents.h @@ -179,4 +179,17 @@ extern int DeviceEventSuppressForWindow( Mask /* mask */, int /* maskndx */); +void FindInterestedChildren( + DeviceIntPtr /* dev */, + WindowPtr /* p1 */, + Mask /* mask */, + xEvent * /* ev */, + int /* count */); + +void SendEventToAllWindows( + DeviceIntPtr /* dev */, + Mask /* mask */, + xEvent * /* ev */, + int /* count */); + #endif /* EXEVENTS_H */