|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
/*
|
|
Packit |
5bd3a9 |
* Copyright 1990, 1991 by OMRON Corporation
|
|
Packit |
5bd3a9 |
*
|
|
Packit |
5bd3a9 |
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
Packit |
5bd3a9 |
* documentation for any purpose is hereby granted without fee, provided that
|
|
Packit |
5bd3a9 |
* the above copyright notice appear in all copies and that both that
|
|
Packit |
5bd3a9 |
* copyright notice and this permission notice appear in supporting
|
|
Packit |
5bd3a9 |
* documentation, and that the name OMRON not be used in
|
|
Packit |
5bd3a9 |
* advertising or publicity pertaining to distribution of the software without
|
|
Packit |
5bd3a9 |
* specific, written prior permission. OMRON makes no representations
|
|
Packit |
5bd3a9 |
* about the suitability of this software for any purpose. It is provided
|
|
Packit |
5bd3a9 |
* "as is" without express or implied warranty.
|
|
Packit |
5bd3a9 |
*
|
|
Packit |
5bd3a9 |
* OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
Packit |
5bd3a9 |
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
Packit |
5bd3a9 |
* EVENT SHALL OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
Packit |
5bd3a9 |
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
Packit |
5bd3a9 |
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
Packit |
5bd3a9 |
* TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
Packit |
5bd3a9 |
* PERFORMANCE OF THIS SOFTWARE.
|
|
Packit |
5bd3a9 |
*
|
|
Packit |
5bd3a9 |
* Author: Seiji Kuwari OMRON Corporation
|
|
Packit |
5bd3a9 |
* kuwa@omron.co.jp
|
|
Packit |
5bd3a9 |
* kuwa%omron.co.jp@uunet.uu.net
|
|
Packit |
5bd3a9 |
*/
|
|
Packit |
5bd3a9 |
/*
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
Copyright 1990, 1991, 1998 The Open Group
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
Permission to use, copy, modify, distribute, and sell this software and its
|
|
Packit |
5bd3a9 |
documentation for any purpose is hereby granted without fee, provided that
|
|
Packit |
5bd3a9 |
the above copyright notice appear in all copies and that both that
|
|
Packit |
5bd3a9 |
copyright notice and this permission notice appear in supporting
|
|
Packit |
5bd3a9 |
documentation.
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
The above copyright notice and this permission notice shall be included
|
|
Packit |
5bd3a9 |
in all copies or substantial portions of the Software.
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
Packit |
5bd3a9 |
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
Packit |
5bd3a9 |
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
Packit |
5bd3a9 |
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
Packit |
5bd3a9 |
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
Packit |
5bd3a9 |
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
Packit |
5bd3a9 |
OTHER DEALINGS IN THE SOFTWARE.
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
Except as contained in this notice, the name of The Open Group shall
|
|
Packit |
5bd3a9 |
not be used in advertising or otherwise to promote the sale, use or
|
|
Packit |
5bd3a9 |
other dealings in this Software without prior written authorization
|
|
Packit |
5bd3a9 |
from The Open Group.
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
*/
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
#ifdef HAVE_CONFIG_H
|
|
Packit |
5bd3a9 |
#include <config.h>
|
|
Packit |
5bd3a9 |
#endif
|
|
Packit |
5bd3a9 |
#include "Xlibint.h"
|
|
Packit |
5bd3a9 |
#include "Xlcint.h"
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
static void
|
|
Packit |
5bd3a9 |
_XFreeIMFilters(
|
|
Packit |
5bd3a9 |
Display *display)
|
|
Packit |
5bd3a9 |
{
|
|
Packit |
5bd3a9 |
register XFilterEventList fl;
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
while ((fl = display->im_filters)) {
|
|
Packit |
5bd3a9 |
display->im_filters = fl->next;
|
|
Packit |
5bd3a9 |
Xfree(fl);
|
|
Packit |
5bd3a9 |
}
|
|
Packit |
5bd3a9 |
}
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
/*
|
|
Packit |
5bd3a9 |
* Register a filter with the filter machinery by event mask.
|
|
Packit |
5bd3a9 |
*/
|
|
Packit |
5bd3a9 |
void
|
|
Packit |
5bd3a9 |
_XRegisterFilterByMask(
|
|
Packit |
5bd3a9 |
Display *display,
|
|
Packit |
5bd3a9 |
Window window,
|
|
Packit |
5bd3a9 |
unsigned long event_mask,
|
|
Packit |
5bd3a9 |
Bool (*filter)(
|
|
Packit |
5bd3a9 |
Display*, Window, XEvent*, XPointer
|
|
Packit |
5bd3a9 |
),
|
|
Packit |
5bd3a9 |
XPointer client_data)
|
|
Packit |
5bd3a9 |
{
|
|
Packit |
5bd3a9 |
XFilterEventRec *rec;
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
rec = Xmalloc(sizeof(XFilterEventRec));
|
|
Packit |
5bd3a9 |
if (!rec)
|
|
Packit |
5bd3a9 |
return;
|
|
Packit |
5bd3a9 |
rec->window = window;
|
|
Packit |
5bd3a9 |
rec->event_mask = event_mask;
|
|
Packit |
5bd3a9 |
rec->start_type = 0;
|
|
Packit |
5bd3a9 |
rec->end_type = 0;
|
|
Packit |
5bd3a9 |
rec->filter = filter;
|
|
Packit |
5bd3a9 |
rec->client_data = client_data;
|
|
Packit |
5bd3a9 |
LockDisplay(display);
|
|
Packit |
5bd3a9 |
rec->next = display->im_filters;
|
|
Packit |
5bd3a9 |
display->im_filters = rec;
|
|
Packit |
5bd3a9 |
display->free_funcs->im_filters = _XFreeIMFilters;
|
|
Packit |
5bd3a9 |
UnlockDisplay(display);
|
|
Packit |
5bd3a9 |
}
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
/*
|
|
Packit |
5bd3a9 |
* Register a filter with the filter machinery by type code.
|
|
Packit |
5bd3a9 |
*/
|
|
Packit |
5bd3a9 |
void
|
|
Packit |
5bd3a9 |
_XRegisterFilterByType(
|
|
Packit |
5bd3a9 |
Display *display,
|
|
Packit |
5bd3a9 |
Window window,
|
|
Packit |
5bd3a9 |
int start_type,
|
|
Packit |
5bd3a9 |
int end_type,
|
|
Packit |
5bd3a9 |
Bool (*filter)(
|
|
Packit |
5bd3a9 |
Display*, Window, XEvent*, XPointer
|
|
Packit |
5bd3a9 |
),
|
|
Packit |
5bd3a9 |
XPointer client_data)
|
|
Packit |
5bd3a9 |
{
|
|
Packit |
5bd3a9 |
XFilterEventRec *rec;
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
rec = Xmalloc(sizeof(XFilterEventRec));
|
|
Packit |
5bd3a9 |
if (!rec)
|
|
Packit |
5bd3a9 |
return;
|
|
Packit |
5bd3a9 |
rec->window = window;
|
|
Packit |
5bd3a9 |
rec->event_mask = 0;
|
|
Packit |
5bd3a9 |
rec->start_type = start_type;
|
|
Packit |
5bd3a9 |
rec->end_type = end_type;
|
|
Packit |
5bd3a9 |
rec->filter = filter;
|
|
Packit |
5bd3a9 |
rec->client_data = client_data;
|
|
Packit |
5bd3a9 |
LockDisplay(display);
|
|
Packit |
5bd3a9 |
rec->next = display->im_filters;
|
|
Packit |
5bd3a9 |
display->im_filters = rec;
|
|
Packit |
5bd3a9 |
display->free_funcs->im_filters = _XFreeIMFilters;
|
|
Packit |
5bd3a9 |
UnlockDisplay(display);
|
|
Packit |
5bd3a9 |
}
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
void
|
|
Packit |
5bd3a9 |
_XUnregisterFilter(
|
|
Packit |
5bd3a9 |
Display *display,
|
|
Packit |
5bd3a9 |
Window window,
|
|
Packit |
5bd3a9 |
Bool (*filter)(
|
|
Packit |
5bd3a9 |
Display*, Window, XEvent*, XPointer
|
|
Packit |
5bd3a9 |
),
|
|
Packit |
5bd3a9 |
XPointer client_data)
|
|
Packit |
5bd3a9 |
{
|
|
Packit |
5bd3a9 |
register XFilterEventList *prev, fl;
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
for (prev = &display->im_filters; (fl = *prev); ) {
|
|
Packit |
5bd3a9 |
if (fl->window == window &&
|
|
Packit |
5bd3a9 |
fl->filter == filter && fl->client_data == client_data) {
|
|
Packit |
5bd3a9 |
*prev = fl->next;
|
|
Packit |
5bd3a9 |
Xfree(fl);
|
|
Packit |
5bd3a9 |
} else
|
|
Packit |
5bd3a9 |
prev = &fl->next;
|
|
Packit |
5bd3a9 |
}
|
|
Packit |
5bd3a9 |
}
|