--- ../work/lib/imlib/imattr.c	Tue Dec  9 17:38:08 1997
+++ lib/imlib/imattr.c	Sat Mar 14 00:50:26 1998
@@ -127,6 +127,11 @@
 static int getLineSpace _Pt_((IMIC *, unsigned int, int, int, char *, int));
 static int getCursor _Pt_((IMIC *, unsigned int, int, int, char *, int));
 
+#ifndef	ORIGINAL
+static int setFilterEvents _Pt_((IMIC *, char *, int, int, int, int));
+static int getFilterEvents _Pt_((IMIC *, unsigned int, int, int, char *, int));
+#endif
+
 static ICAttribute icAttributes[] = {
     { XNInputStyle, TYPE_CARD32, OP_C|OP_G,
 	  setInputStyle, getInputStyle },
@@ -134,6 +139,8 @@
 	  setClientWindow, getClientWindow },
     { XNFocusWindow, TYPE_WINDOW, OP_C|OP_S|OP_G,
 	  setFocusWindow, getFocusWindow },
+    { XNFilterEvents, TYPE_CARD32, OP_C|OP_S|OP_G,
+	  setFilterEvents, getFilterEvents },
     { XNPreeditAttributes, TYPE_NESTED_LIST, OP_C|OP_S|OP_G,
 	  setPreeditAttributes, getPreeditAttributes },
     { XNStatusAttributes, TYPE_NESTED_LIST, OP_C|OP_S|OP_G,
@@ -543,6 +550,34 @@
     return 0;
 }
 
+#ifndef	ORIGINAL
+/* ARGSUSED */
+static int
+setFilterEvents(icp, value, len, order, nest, op)
+IMIC *icp;
+char *value;
+int len;
+int order;
+int nest;
+int op;
+{
+    unsigned long filter_events;
+
+    TRACE(("imlib:setFilterEvents()\n"));
+
+    CHECK_ICATTR_SIZE(4, IMBadSomething);
+
+    filter_events = (unsigned long)getC32(value, order);
+    TRACE(("\tfilter events: %08lx\n", filter_events));
+
+    if (!(icp->common_attr.set_mask & ATTR_MASK_FILTER_EVENTS) ||
+	filter_events != icp->common_attr.filter_events) {
+	icp->common_attr.change_mask |= ATTR_MASK_FILTER_EVENTS;
+    }
+    return 0;
+}
+#endif
+
 /* ARGSUSED */
 static int
 setPreeditAttributes(icp, value, len, order, nest, op)
@@ -1261,6 +1296,42 @@
     }
 }
 
+#ifndef	ORIGINAL
+/* ARGSUSED */
+static int
+getFilterEvents(icp, id, nest, offset, data, len)
+IMIC *icp;
+unsigned int id;
+int nest;
+int offset;
+char *data;
+int len;
+{
+    IMConnection *conn = icp->im->connection;
+
+    TRACE(("imlib:getFilterEvents()\n"));
+
+    if (!(icp->common_attr.set_mask & ATTR_MASK_FILTER_EVENTS)) {
+    	/* fill default value */
+    	fillCommonDefault(icp, (unsigned long)ATTR_MASK_FILTER_EVENTS);
+    }
+
+    if (icp->common_attr.set_mask & ATTR_MASK_FILTER_EVENTS) {
+    	IMPutC16(conn, id);		/* attribute ID */
+    	IMPutC16(conn, 4);		/* value length */
+    	IMPutC32(conn, icp->common_attr.filter_events);
+    }
+    else {
+	/* no default is available */
+	DPRINT(("getFilterEvents without setting\n"));
+	IMCancelRequest(conn, offset);
+	IMSendError(conn, IMBadSomething, icp->im->id, icp->id,
+		    "filter events not specified yet");
+	return -1;
+    }
+}
+#endif
+
 /* ARGSUSED */
 static int
 getArea(icp, id, nest, offset, data, len)
@@ -1679,6 +1750,13 @@
 	    TRACE(("\tdefault focus window: %08lx\n", ap->focus));
 	}
     }
+#ifndef	ORIGINAL
+    if (mask & ATTR_MASK_FILTER_EVENTS) {
+    	ap->filter_events = NoEventMask;
+    	ap->set_mask |= ATTR_MASK_FILTER_EVENTS;
+	TRACE(("\tdefault filter events: %08lx\n", ap->filter_events));
+    }
+#endif
 }
 
 static int
@@ -1848,6 +1926,12 @@
 	    SENDERROR(IMBadFocusWindow, "invalid focus window ID");
 	}
     }
+#ifndef	ORIGINAL
+    if (mask & ATTR_MASK_FILTER_EVENTS) {
+	DPRINT(("filter events not support\n"));
+	SENDERROR(IMBadSomething, "filter events not support");
+    }
+#endif
 
     return ret;
 #undef SENDERROR
@@ -2070,7 +2154,6 @@
 	sattr->area = sattr->area_needed;
     }
 }
-
 
 /*
  * Public functions
--- ../work/lib/imlib/im.h	Tue Dec  9 17:38:07 1997
+++ lib/imlib/im.h	Fri Mar 13 21:12:00 1998
@@ -158,6 +158,10 @@
     XIMStyle input_style;
     Window client;			/* client window */
     Window focus;			/* focus window */
+#ifndef	ORIGINAL
+#define ATTR_MASK_FILTER_EVENTS	(1<<3)
+    unsigned long filter_events;	/* Event mask that IM need */
+#endif
 } IMCommonAttributes;
 
 typedef struct {
