<i18n dev> RFR: 8213232 Unix/X11 setCompositionEnableNative issue

Ichiroh Takiguchi takiguc at linux.vnet.ibm.com
Tue Dec 4 02:22:37 UTC 2018


Hello.

Could you review the fix ?

Bug:    https://bugs.openjdk.java.net/browse/JDK-8213232
Change: https://cr.openjdk.java.net/~itakiguchi/8213232/webrev.00/

This issue is related by wrong usage of XNPreeditState on 
XSetICValues().
Because of wrong usage, UnsupportedOperationException exception happened 
with Xlib bundled input method.
Test instructions is in JDK-8213232.

I'd like to obtain a sponsor for this issue.

Thanks,
Ichiroh Takiguchi
IBM Japan, Ltd.

On 2018-06-19 02:15, Ichiroh Takiguchi wrote:
> Hello,
> IBM would like to contribute Unix/X11 setCompositionEnableNative issue
> patch to OpenJDK project.
> 
> Issue:
> To  turn on or turn off IME via Java, XNPreeditState should be used
> with XSetValues().
> But it should be nested via XVaCreateNestedList() since XNPreeditState
> is a part of XNPreeditAttributes.
> Current code is, like:
> -    ret = XSetICValues(pX11IMData->current_ic, XNPreeditState,
> -                       (enable ? XIMPreeditEnable : 
> XIMPreeditDisable), NULL);
> But it should be, like:
> +    pr_atrb = XVaCreateNestedList(0,
> +                  XNPreeditState, (enable ? XIMPreeditEnable :
> XIMPreeditDisable),
> +                  NULL);
> +    ret = XSetICValues(pX11IMData->current_ic, XNPreeditAttributes,
> pr_atrb, NULL);
> 
> On Linux platform, the issue can check with following test program and
> kinput2 XIM server and
> Wnn8 for Linux/BSD (htt).
> ==================
> import java.awt.*;
> import java.awt.event.*;
> import javax.swing.*;
> 
> public class CompositionEnabledTest extends JFrame {
>   CompositionEnabledTest() {
>     Container c = getContentPane();
>     c.setLayout(new GridLayout(0,2));
>     JButton btn;
>     JTextField tf;
>     btn = new JButton("Undefined");
>     c.add(btn);
>     tf = new JTextField("Undefined");
>     c.add(tf);
>     btn = new JButton("Disabled");
>     btn.addFocusListener(new MyFocusListener(false));
>     c.add(btn);
>     tf = new JTextField("Disabled");
>     tf.addFocusListener(new MyFocusListener(false));
>     c.add(tf);
>     btn = new JButton("Enabled");
>     btn.addFocusListener(new MyFocusListener(true));
>     c.add(btn);
>     tf = new JTextField("Enabled");
>     tf.addFocusListener(new MyFocusListener(true));
>     c.add(tf);
>     setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>     pack();
>     setVisible(true);
>   }
>   class MyFocusListener implements FocusListener {
>     boolean state;
>     MyFocusListener(boolean state) {
>       this.state = state;
>     }
>     public void focusGained(FocusEvent fe) {
>       fe.getComponent().getInputContext().setCompositionEnabled(state);
>     }
>     public void focusLost(FocusEvent fe) { }
>   }
>   public static void main(String[] args) {
>     new CompositionEnabledTest();
>   }
> }
> ==================
> 
> Click JTextField and JButton, then XIM server status may be changed.
> If XIM server does not support XNPreeditState, it does not work.
> 
> I'd like contribute following 3 files:
> M src/java.desktop/share/classes/sun/awt/im/InputContext.java
> M src/java.desktop/unix/classes/sun/awt/X11InputMethod.java
> M src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c
> 
> http://cr.openjdk.java.net/~aleonard/set_composition_enabled/webrev.00/
> 
> I appreciate any feedback please, and how I would go about obtaining a
> sponsor and contributor?
> 
> Thanks,
> Ichiroh Takiguchi
> IBM Japan, Ltd.



More information about the i18n-dev mailing list