jed-users mailing list

[2006 Date Index] [2006 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Patch: Multi_key/Compose in Xjed


Hi,

Xjed did not support the Multi_key (aka Compose), which lets you "press"
keys they are not on your keyboard. For example <Multi_key> <+> <->
inserts the character ± or <Multi_key> <space> <space> inserts the
non-breakable space 0xA0 or <Multi_key> <O> <r> inserts ® or <Multi_key>
<A> <E> inserts Æ.

I think this is a very useful feature. I did not really find the reason
why Xjed did not handle the Multi_key correctly. I assume the problem was
that X_input_pending() called XNextEvent() on the filtered key, although
man XFilterEvent() says: "If XFilterEvent returns True, then some input
method has filtered the event, and the client should discard the event."

But I saw is X_input_pending() the todo /* I need some way of getting
only kbd events. */ and solved this. And now the Multi_key works.

The new code has a drawback, it does not do the work in
x_handle_harmless_events(). John, is this work done anywhere else? I did
recognize a problem with copying. If I select text in Xjed and past it
anywhere else, the text is not inserted until I switch back to Xjed. It
seems SelectionNotify is not handled anywhere else.

#v+
Index: xterm.c
===================================================================
--- xterm.c	(Revision 35)
+++ xterm.c	(Arbeitskopie)
@@ -1490,21 +1490,15 @@
 static int X_input_pending (void) /*{{{*/
 {
    XEvent ev;
-   int n;
-
    if (No_XEvents) return 0;
 
-   n = XPending (This_XDisplay);
-   if (!n) return (0);
-
-   /* I need some way of getting only kbd events. */
-   while (n--)
-     {
-	XPeekEvent(This_XDisplay, &ev);
-	if (0 == x_handle_harmless_events (&ev)) return 1;
-	XNextEvent(This_XDisplay, &ev);
-     }
-   return 0;
+    if ( XCheckMaskEvent(This_XDisplay, KeyPressMask, &ev) )
+    {
+        XPutBackEvent(This_XDisplay, &ev);
+        return 1;
+    }
+    else
+      return 0;
 }
 
 /*}}}*/
#v-

Bye, Jörg.
-- 
Nutze die Talente, die du hast. Die Wälder wären sehr still,
wenn nur die begabtesten Vögel sängen.                (Henry van Dyke)

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2006 date index] [2006 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]