| 1 |
|
| 2 |
/* |
| 3 |
* Copyright 1990, 1991 by OMRON Corporation |
| 4 |
* |
| 5 |
* Permission to use, copy, modify, distribute, and sell this software and its |
| 6 |
* documentation for any purpose is hereby granted without fee, provided that |
| 7 |
* the above copyright notice appear in all copies and that both that |
| 8 |
* copyright notice and this permission notice appear in supporting |
| 9 |
* documentation, and that the name OMRON not be used in |
| 10 |
* advertising or publicity pertaining to distribution of the software without |
| 11 |
* specific, written prior permission. OMRON makes no representations |
| 12 |
* about the suitability of this software for any purpose. It is provided |
| 13 |
* "as is" without express or implied warranty. |
| 14 |
* |
| 15 |
* OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
| 16 |
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO |
| 17 |
* EVENT SHALL OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
| 18 |
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, |
| 19 |
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 20 |
* TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 21 |
* PERFORMANCE OF THIS SOFTWARE. |
| 22 |
* |
| 23 |
* Author: Seiji Kuwari OMRON Corporation |
| 24 |
* [email protected] |
| 25 |
* kuwa%[email protected] |
| 26 |
*/ |
| 27 |
|
| 28 |
/* |
| 29 |
|
| 30 |
Copyright 1991, 1998 The Open Group |
| 31 |
|
| 32 |
Permission to use, copy, modify, distribute, and sell this software and its |
| 33 |
documentation for any purpose is hereby granted without fee, provided that |
| 34 |
the above copyright notice appear in all copies and that both that |
| 35 |
copyright notice and this permission notice appear in supporting |
| 36 |
documentation. |
| 37 |
|
| 38 |
The above copyright notice and this permission notice shall be included |
| 39 |
in all copies or substantial portions of the Software. |
| 40 |
|
| 41 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 42 |
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 43 |
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 44 |
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 45 |
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 46 |
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 47 |
OTHER DEALINGS IN THE SOFTWARE. |
| 48 |
|
| 49 |
Except as contained in this notice, the name of The Open Group shall |
| 50 |
not be used in advertising or otherwise to promote the sale, use or |
| 51 |
other dealings in this Software without prior written authorization |
| 52 |
from The Open Group. |
| 53 |
|
| 54 |
*/ |
| 55 |
|
| 56 |
#ifdef HAVE_CONFIG_H |
| 57 |
#include <config.h> |
| 58 |
#else |
| 59 |
#define XLOCALE 1 |
| 60 |
#endif |
| 61 |
#include "Xlibint.h" |
| 62 |
#if XLOCALE |
| 63 |
#include "Xlcint.h" |
| 64 |
#endif |
| 65 |
|
| 66 |
extern long const _Xevent_to_mask[]; |
| 67 |
|
| 68 |
/* |
| 69 |
* Look up if there is a specified filter for the event. |
| 70 |
*/ |
| 71 |
Bool |
| 72 |
XFilterEvent( |
| 73 |
XEvent *ev, |
| 74 |
Window window) |
| 75 |
{ |
| 76 |
#if XLOCALE |
| 77 |
XFilterEventList p; |
| 78 |
Window win; |
| 79 |
long mask; |
| 80 |
Bool ret; |
| 81 |
|
| 82 |
if (window) |
| 83 |
win = window; |
| 84 |
else |
| 85 |
win = ev->xany.window; |
| 86 |
if (ev->type >= LASTEvent) |
| 87 |
mask = 0; |
| 88 |
else |
| 89 |
mask = _Xevent_to_mask[ev->type]; |
| 90 |
|
| 91 |
LockDisplay(ev->xany.display); |
| 92 |
for (p = ev->xany.display->im_filters; p != NULL; p = p->next) { |
| 93 |
if (win == p->window) { |
| 94 |
if ((mask & p->event_mask) || |
| 95 |
(ev->type >= p->start_type && ev->type <= p->end_type)) { |
| 96 |
UnlockDisplay(ev->xany.display); |
| 97 |
ret = (*(p->filter))(ev->xany.display, p->window, ev, |
| 98 |
p->client_data); |
| 99 |
return(ret); |
| 100 |
} |
| 101 |
} |
| 102 |
} |
| 103 |
UnlockDisplay(ev->xany.display); |
| 104 |
#endif |
| 105 |
return(False); |
| 106 |
} |