XtSetLanguageProc and XLookupString (dead keys) - Xwindows

This is a discussion on XtSetLanguageProc and XLookupString (dead keys) - Xwindows ; Hi, I'm working on the internationalization of XPCE, a GUI toolkit for Prolog. Most is working fine, but I can't get dead-keys to work. Appearently I'm missing some step. Here is what I do: As initialization: XtToolkitInitialize() ctx = XtCreateApplicationContext() ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: XtSetLanguageProc and XLookupString (dead keys)

  1. XtSetLanguageProc and XLookupString (dead keys)

    Hi,

    I'm working on the internationalization of XPCE, a GUI toolkit for
    Prolog. Most is working fine, but I can't get dead-keys to work.
    Appearently I'm missing some step. Here is what I do:

    As initialization:

    XtToolkitInitialize()
    ctx = XtCreateApplicationContext()
    XtSetLanguageProc(ctx, NULL, NULL)

    Opening display

    XtOpenDisplay

    Event processing:

    XtAppProcessEvent(ctx, XtIMXEvent|XtIMTimer|XtIMAlternateInput);

    Processing the input

    XLookupString

    Environment is SuSE Linux 9.2, should be a nice X11R6 based environment
    and the other apps get it right.

    I'm simply getting the dead keys as normal keys and nothing happens.
    Locale setting doesn't appear to influence this. My default locale
    is en_GB.UTF-8. Using xvkbd, dead-key handling in xterm and other
    apps works fine in this setting. I also tried pt_PT.UTF-8, but that
    makes no difference.

    I thought the problem could be a lacking call to XFilterEvent(), but
    adding this explicitely in the window event procedure doesn't help and
    using GDB, I found that XtAppProcessEvent is calling XFilterEvent().

    Anyone any suggestions where to look for?

    Thanks --- Jan

  2. Re: XtSetLanguageProc and XLookupString (dead keys)

    Jan Wielemaker writes:

    > Hi,
    >
    > I'm working on the internationalization of XPCE, a GUI toolkit for
    > Prolog. Most is working fine, but I can't get dead-keys to work.
    > Appearently I'm missing some step. Here is what I do:
    >
    > As initialization:
    >
    > XtToolkitInitialize()
    > ctx = XtCreateApplicationContext()
    > XtSetLanguageProc(ctx, NULL, NULL)
    >
    > Opening display
    >
    > XtOpenDisplay
    >
    > Event processing:
    >
    > XtAppProcessEvent(ctx, XtIMXEvent|XtIMTimer|XtIMAlternateInput);
    >
    > Processing the input
    >
    > XLookupString
    >
    > Environment is SuSE Linux 9.2, should be a nice X11R6 based environment
    > and the other apps get it right.
    >
    > I'm simply getting the dead keys as normal keys and nothing happens.
    > Locale setting doesn't appear to influence this. My default locale
    > is en_GB.UTF-8. Using xvkbd, dead-key handling in xterm and other
    > apps works fine in this setting. I also tried pt_PT.UTF-8, but that
    > makes no difference.
    >
    > I thought the problem could be a lacking call to XFilterEvent(), but
    > adding this explicitely in the window event procedure doesn't help and
    > using GDB, I found that XtAppProcessEvent is calling XFilterEvent().
    >
    > Anyone any suggestions where to look for?


    I took a quick look in the "Xlib - C Language X Interface" and found
    this sentence

    "To get composed input from an input method, use XmbLookupString or
    XwcLookupString."

    There is also the XFree86 addition Xutf8LookupString. A man-page for
    these comes with XFree86.

    And yes, dead keys use the compose mechanism so it is applicable. You
    were on the right track setting the locale though, because composing
    is done in the client and which compose rules are used depends on the
    locale.

    --
    - Mårten

    mail: msv@kth.se *** ICQ: 4356928 *** mobile: +46 (0)707390385

  3. Re: XtSetLanguageProc and XLookupString (dead keys)

    On 2005-05-24, M�rten Svantesson wrote:
    > Jan Wielemaker writes:
    >
    >> Hi,
    >>
    >> I'm working on the internationalization of XPCE, a GUI toolkit for
    >> Prolog. Most is working fine, but I can't get dead-keys to work.
    >> Appearently I'm missing some step. Here is what I do:
    >>
    >> As initialization:
    >>
    >> XtToolkitInitialize()
    >> ctx = XtCreateApplicationContext()
    >> XtSetLanguageProc(ctx, NULL, NULL)
    >>
    >> Opening display
    >>
    >> XtOpenDisplay
    >>
    >> Event processing:
    >>
    >> XtAppProcessEvent(ctx, XtIMXEvent|XtIMTimer|XtIMAlternateInput);
    >>
    >> Processing the input
    >>
    >> XLookupString
    >>
    >> Environment is SuSE Linux 9.2, should be a nice X11R6 based environment
    >> and the other apps get it right.
    >>
    >> I'm simply getting the dead keys as normal keys and nothing happens.
    >> Locale setting doesn't appear to influence this. My default locale
    >> is en_GB.UTF-8. Using xvkbd, dead-key handling in xterm and other
    >> apps works fine in this setting. I also tried pt_PT.UTF-8, but that
    >> makes no difference.
    >>
    >> I thought the problem could be a lacking call to XFilterEvent(), but
    >> adding this explicitely in the window event procedure doesn't help and
    >> using GDB, I found that XtAppProcessEvent is calling XFilterEvent().
    >>
    >> Anyone any suggestions where to look for?

    >
    > I took a quick look in the "Xlib - C Language X Interface" and found
    > this sentence
    >
    > "To get composed input from an input method, use XmbLookupString or
    > XwcLookupString."
    >
    > There is also the XFree86 addition Xutf8LookupString. A man-page for
    > these comes with XFree86.
    >
    > And yes, dead keys use the compose mechanism so it is applicable. You
    > were on the right track setting the locale though, because composing
    > is done in the client and which compose rules are used depends on the
    > locale.


    Thanks. I have found many pages on the internet claiming that the use of
    XLookupString() suffices for latin languages and the work is done by
    XFilterEvent(). Looks this is indeed wrong. The above setup does call
    XFilterEvent(), but not XOpenIM and XFilterEvent() is doing nothing
    without input methods if I read the source correctly. So eventually I
    spent an hour getting basic XIM support running and now all appears
    fine. Not wasted time as this is needed for Asian languages anyway :-)

    One related question. What is the supposed lifetime and adviced
    technique for managing XIC objects? I found various documents, but no
    adviced policy for applications (potentially) dealing with many windows.
    At the moment, each toplevel window creates an XIC on the first KeyPress
    received in it and destroys it if the window is destroyed. The window of
    the IC is changed using XSetICValues() to the subwindow which currently
    gets the keyboard input. Does that make sense?

    Thanks --- Jan

+ Reply to Thread