diff --git a/.github/workflows/jbr-linux-x64.yml b/.github/workflows/jbr-linux-x64.yml
index 9f878c4..a7ab6e0 100644
--- a/.github/workflows/jbr-linux-x64.yml
+++ b/.github/workflows/jbr-linux-x64.yml
@@ -2,117 +2,103 @@ name: jbr-linux-x64
on:
workflow_dispatch:
- push:
- branches:
- - master
- schedule:
- - cron: 0 0 1 * *
+ inputs:
+ release_id:
+ required: true
+ default: 'latest'
+ type: string
+ description: "Release id or tag"
+ jbr_branch:
+ required: false
+ type: string
+ description: "JBR branch"
jobs:
build:
- runs-on: ubuntu-18.04
+ runs-on: ubuntu-20.04
steps:
- name: Clone Repository
- uses: actions/checkout@v1
+ uses: actions/checkout@v3
+
+ - name: Generate Variables
+ id: vars
+ run: |
+ release_id='${{ github.event.inputs.release_id }}'
+ curl -H "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -sfL -m 60 -o /tmp/latest.json "${{ github.api_url }}/repos/JetBrains/JetBrainsRuntime/releases/${release_id:-latest}"
+
+ release_name=$(jq -r .name /tmp/latest.json)
+ echo "Release: $release_name"
+ echo ::set-output name=release_name::"$release_name"
+
+ html_url=$(jq -r .html_url /tmp/latest.json)
+ echo "Release URL: $html_url"
+ echo ::set-output name=release_body::"$html_url"
+
+ tag_name=$(jq -r .tag_name /tmp/latest.json)
+ echo "Tag: $tag_name"
+ echo ::set-output name=tag_name::"$tag_name"
+
+ if [[ "$tag_name" == jbr17* ]]; then
+ JBSDK_VERSION=$(sed -E 's/^jbr([0-9_.]+)b.*$/\1/' <<< "$tag_name")
+ build_number=$(sed -E 's/^jbr[0-9_.]+b([0-9.]+)$/\1/' <<< "$tag_name")
+ elif [[ "$tag_name" == jbr-release-17.* ]]; then
+ JBSDK_VERSION=$(sed -E 's/^jbr-release-([0-9_.]+)b.*$/\1/' <<< "$tag_name")
+ build_number=$(sed -E 's/^jbr-release-[0-9_.]+b([0-9.]+)$/\1/' <<< "$tag_name")
+ else
+ echo unknown tag name: $tag_name
+ exit 1
+ fi
+
+ echo "JBSDK Version: $JBSDK_VERSION"
+ echo ::set-output name=JBSDK_VERSION::"$JBSDK_VERSION"
+ echo "Build Number: $build_number"
+ echo ::set-output name=build_number::"$build_number"
+
+ ref='${{ github.event.inputs.jbr_branch }}'
+ if [[ -z "$ref" ]]; then
+ ref="jb${JBSDK_VERSION}-b${build_number}"
+ fi
+ echo "Ref: $ref"
+ echo ::set-output name=ref::"$ref"
- name: Init Build Dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
- sudo -E apt-get remove -y --purge azure-cli ghc zulu* hhvm llvm* firefox google* dotnet* powershell openjdk* mysql* php*
- sudo -E rm -rf /usr/share/dotnet /etc/mysql /etc/php /usr/lib/jvm/
- sudo -E apt-get update -y
- sudo -E apt-get install -y ant autoconf bison build-essential cmake flex git gperf ksh \
- libasound2-dev libavcodec-dev libavformat-dev libcups2-dev libfontconfig1-dev \
- libgl1-mesa-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
- libgtk2.0-dev libgtk-3-dev libjpeg-dev libpng-dev libudev-dev libx11-dev libxext-dev \
- libxml2-dev libxrandr-dev libxrender-dev libxslt1-dev libxt-dev libxtst-dev libxxf86vm-dev \
- make mercurial openjdk-11-jdk pkg-config ruby tree x11proto-core-dev x11proto-xf86vidmode-dev zip
- sudo -E apt-get autoremove -y --purge
- sudo -E apt-get clean -y
-
- - name: Generate Information
- id: gen_info
- env:
- TZ: Asia/Shanghai
- run: |
- release_tag="$(date +%Y-%m-%d_%H-%M)"
- release_name="jbr-linux-x64-$release_tag"
- release_description="${{ secrets.DESC }}"
- echo "##[set-output name=release_tag;]$release_tag"
- echo "##[set-output name=release_name;]$release_name"
- echo "##[set-output name=release_description;]$release_description"
-
- - name: Compile JCEF
- env:
- JDK_11: /usr/lib/jvm/java-11-openjdk-amd64
- ANT_HOME: /usr/share/ant
- run: |
- git clone https://github.com/JetBrains/jcef.git jcef
- cd jcef
- # reset to commit 4ef9139
- git reset --hard 4ef9139
- cd jb/tools/linux && chmod +x *
- ./build.sh all
-
- - name: List Paths
+ sudo apt-get update -y
+ sudo apt-get install -y libasound2-dev libavcodec-dev libavformat-dev libcups2-dev libgl1-mesa-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgtk2.0-dev libgtk-3-dev libudev-dev libxrandr-dev libxslt1-dev libxtst-dev libxxf86vm-dev x11proto-xf86vidmode-dev
+ sudo apt-get clean -y
+
+ - name: Prepare JCEF
run: |
- cd jcef
- ls -a
- echo
- tree -a
+ aria2c -o jbrsdk_jcef.tgz 'https://cache-redirector.jetbrains.com/intellij-jbr/jbrsdk_jcef-${{ steps.vars.outputs.JBSDK_VERSION }}-linux-x64-b${{ steps.vars.outputs.build_number }}.tar.gz'
+ mkdir jcef_linux_x64
+ tar -zxvf jbrsdk_jcef.tgz --strip-components=1 -C jcef_linux_x64 --wildcards -- 'jbrsdk_jcef-*/jmods/gluegen.rt.jmod' 'jbrsdk_jcef-*/jmods/jogl.all.jmod' 'jbrsdk_jcef-*/jmods/jcef.jmod'
+ rm -f jbrsdk_jcef.tgz
+
+ - name: Clone JBR Repository
+ uses: actions/checkout@v3
+ with:
+ repository: JetBrains/JetBrainsRuntime
+ ref: ${{ steps.vars.outputs.ref }}
+ fetch-depth: 0 # 这里必须拉取全部历史,下面的mkimages_x64.sh里面会通过git log找tag
+ path: JetBrainsRuntime
- name: Patch & Compile JetBrainsRuntime with JCEF
- env:
- JAVA_HOME: /usr/lib/jvm/java-11-openjdk-amd64
- JDK_HOME: /usr/lib/jvm/java-11-openjdk-amd64
+ id: compile
run: |
- git config --global core.autocrlf input
- git clone -b master --single-branch https://github.com/JetBrains/JetBrainsRuntime.git
cd JetBrainsRuntime
- mkdir jcef_linux_x64 && tar zxf ../jcef/jcef_linux_x64.tar.gz -C jcef_linux_x64
- git apply -p0 < jb/project/tools/patches/add_jcef_module.patch
- mv ../idea.patch ./
- patch -p1 < idea.patch
- sh ./configure --disable-warnings-as-errors --with-import-modules=./jcef_linux_x64/modular-sdk
- make images
-
- - name: List Paths
- run: |
- cd JetBrainsRuntime
- ls -a
- echo
- tree -a
+ git log -1
- - name: Reduce Size
- env:
- BASE_DIR: build/linux-x86_64-normal-server-release/images
- JBR_BUNDLE: jbr_jcef
- JCEF_PATH: ../jcef/jcef_build/native/Release
- run: |
- cd JetBrainsRuntime
- cat jb/project/tools/common/modules.list > modules_tmp.list
- rm -rf ${BASE_DIR}/${JBR_BUNDLE}
- ${BASE_DIR}/jdk/bin/jlink \
- --module-path ${BASE_DIR}/jdk/jmods --no-man-pages --compress=2 \
- --add-modules $(xargs < modules_tmp.list | sed s/" "//g) --output $BASE_DIR/$JBR_BUNDLE
- cp -R $BASE_DIR/$JBR_BUNDLE $BASE_DIR/jbr
- rsync -av ${JCEF_PATH}/ $BASE_DIR/$JBR_BUNDLE/lib --exclude="modular-sdk"
- grep -v "^JAVA_VERSION" ${BASE_DIR}/jdk/release | grep -v "^MODULES" >> $BASE_DIR/$JBR_BUNDLE/release
- rm -rf ${BASE_DIR}/jbr
- cp -R ${BASE_DIR}/${JBR_BUNDLE} ${BASE_DIR}/jbr
-
- - name: Package Artifact
- run: |
- cd JetBrainsRuntime/build/linux-x86_64-normal-server-release/images
- zip -r jbr-linux-x64.zip ./jbr/*
- mv jbr-linux-x64.zip ../../../../
+ patch -p1 < ../idea.patch
- - name: Upload Artifact
- uses: actions/upload-artifact@master
- with:
- name: ${{ steps.gen_info.outputs.release_tag }}
- path: jbr-linux-x64.zip
+ mv ../jcef_linux_x64 ./
+
+ export BOOT_JDK="$JAVA_HOME_17_X64"
+
+ jb/project/tools/linux/scripts/mkimages_x64.sh '${{ steps.vars.outputs.build_number }}' jcef
+
+ echo ::set-output name=jbr_image::"$(ls -1 jbr_jcef-*-linux-x64-*.tar.gz)"
- name: Create Release
id: create_release
@@ -120,9 +106,9 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
- tag_name: ${{ steps.gen_info.outputs.release_tag }}
- release_name: ${{ steps.gen_info.outputs.release_name }}
- body: ${{ steps.gen_info.outputs.release_description }}
+ tag_name: ${{ steps.vars.outputs.tag_name }}
+ release_name: ${{ steps.vars.outputs.release_name }}
+ body: ${{ steps.vars.outputs.release_body }}
draft: false
prerelease: true
@@ -133,7 +119,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
- asset_path: ./jbr-linux-x64.zip
- asset_name: ${{ steps.gen_info.outputs.release_name }}.zip
- asset_content_type: application/zip
+ asset_path: JetBrainsRuntime/${{ steps.compile.outputs.jbr_image }}
+ asset_name: ${{ steps.compile.outputs.jbr_image }}
+ asset_content_type: application/gzip
diff --git a/idea.patch b/idea.patch
index 224e924..4ef913b 100644
--- a/idea.patch
+++ b/idea.patch
@@ -1,53 +1,70 @@
diff --git a/src/java.desktop/share/classes/java/awt/Container.java b/src/java.desktop/share/classes/java/awt/Container.java
-index 1a6163eb4..88f3b8d04 100644
+index ec6913057d8..c9ca9cbf11e 100644
--- a/src/java.desktop/share/classes/java/awt/Container.java
+++ b/src/java.desktop/share/classes/java/awt/Container.java
-@@ -678,6 +678,10 @@ public class Container extends Component {
+@@ -25,6 +25,7 @@
+
+ package java.awt;
+
++import java.awt.Point;
+ import java.awt.dnd.DropTarget;
+ import java.awt.event.AWTEventListener;
+ import java.awt.event.ComponentEvent;
+@@ -682,6 +683,14 @@ public class Container extends Component {
}
}
-+ public ComponentPeer getPeer(){
-+ return peer;
++ /**
++ * fix fcitx position
++ * @return Point
++ */
++ public Point getPeerLocationOnScreen(){
++ return peer.getLocationOnScreen();
+ }
+
/**
* Detects whether or not remove from current parent and adding to new parent requires call of
* removeNotify on the component. Since removeNotify destroys native window this might (not)
diff --git a/src/java.desktop/share/classes/javax/swing/JTextArea.java b/src/java.desktop/share/classes/javax/swing/JTextArea.java
-index d64fa0272..ccf7dceca 100644
+index 03b3bc7e9bd..7bd43f5829b 100644
--- a/src/java.desktop/share/classes/javax/swing/JTextArea.java
+++ b/src/java.desktop/share/classes/javax/swing/JTextArea.java
-@@ -547,7 +547,10 @@ public class JTextArea extends JTextComponent {
- }
+@@ -562,6 +562,14 @@ public class JTextArea extends JTextComponent {
return rowHeight;
}
--
-+
+
++ /**
++ * fix fcitx position
++ * @return FontMetrics
++ */
+ public FontMetrics getFontMetrics() {
+ return getFontMetrics(getFont());
+ }
++
/**
* Returns the number of columns in the TextArea.
*
diff --git a/src/java.desktop/share/classes/javax/swing/JTextField.java b/src/java.desktop/share/classes/javax/swing/JTextField.java
-index b8e3ffe06..3bfe3cae1 100644
+index 0d66209d8af..363ac03514b 100644
--- a/src/java.desktop/share/classes/javax/swing/JTextField.java
+++ b/src/java.desktop/share/classes/javax/swing/JTextField.java
-@@ -409,7 +409,11 @@ public class JTextField extends JTextComponent implements SwingConstants {
- }
+@@ -427,6 +427,14 @@ public class JTextField extends JTextComponent implements SwingConstants {
return columnWidth;
}
--
-+
+
++ /**
++ * fix fcitx position
++ * @return FontMetrics
++ */
+ public FontMetrics getFontMetrics() {
+ return getFontMetrics(getFont());
+ }
-+
++
/**
* Returns the preferred size Dimensions
needed for this
* TextField
. If a non-zero number of columns has been
diff --git a/src/java.desktop/share/classes/sun/awt/im/InputContext.java b/src/java.desktop/share/classes/sun/awt/im/InputContext.java
-index ad9d71be7..3d437ae8a 100644
+index 237164a9d42..9a16e75ff46 100644
--- a/src/java.desktop/share/classes/sun/awt/im/InputContext.java
+++ b/src/java.desktop/share/classes/sun/awt/im/InputContext.java
@@ -28,6 +28,7 @@ package sun.awt.im;
@@ -74,14 +91,13 @@ index ad9d71be7..3d437ae8a 100644
/**
* This InputContext class contains parts of the implementation of
-@@ -249,13 +252,26 @@ public class InputContext extends java.awt.im.InputContext
+@@ -249,13 +252,23 @@ public class InputContext extends java.awt.im.InputContext
focusLost((Component) event.getSource(), ((FocusEvent) event).isTemporary());
break;
+ case MouseEvent.MOUSE_RELEASED:
-+ if(checkTextCursor((Component)event.getSource())) {
-+ // focusGained((Component) event.getSource());
-+ transCaretPositionToXIM((Component)event.getSource());
++ if (((Component) event.getSource()).getCursor().getType() == Cursor.TEXT_CURSOR) {
++ transCaretPositionToXIM((Component) event.getSource());
+ break;
+ }
+
@@ -93,20 +109,17 @@ index ad9d71be7..3d437ae8a 100644
break;
}
-+ case KeyEvent.KEY_RELEASED:
-+ if (event instanceof KeyEvent && checkDirectionKey((KeyEvent)event)) {
-+ transCaretPositionToXIM((Component) event.getSource());
-+ break;
-+ }
++ case KeyEvent.KEY_RELEASED:
++ transCaretPositionToXIM((Component) event.getSource());
++ break;
+
// fall through
default:
-@@ -359,7 +375,65 @@ public class InputContext extends java.awt.im.InputContext
- }
+@@ -360,6 +373,46 @@ public class InputContext extends java.awt.im.InputContext
}
}
--
+
+ /**
+ * fix fcitx position
+ */
@@ -143,37 +156,18 @@ index ad9d71be7..3d437ae8a 100644
+ ((InputMethodContext)this).setCompositionAreaVisible(true);
+ compositionAreaHidden = false;
+ }
-+
+ }
+ }
+ }
-+ /**
-+ * fix fcitx position
-+ */
-+ private boolean checkDirectionKey(KeyEvent event) {
-+ // if (event.getKeyCode() >= 37 && event.getKeyCode() <=40) {
-+ // return true;
-+ // } else {
-+ // return false;
-+ // }
-+ return true;
-+ }
-+ /**
-+ * fix fcitx position
-+ */
-+ private boolean checkTextCursor(Component source) {
-+ if(source.getCursor().getType()==Cursor.TEXT_CURSOR)
-+ return true;
-+ return false;
-+ }
++
/**
* Activates the current input method of this input context, and grabs
* the composition area for use by this input context.
diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XInputMethod.java b/src/java.desktop/unix/classes/sun/awt/X11/XInputMethod.java
-index 07c1334b8..01d5910de 100644
+index 2afd7bbefdb..2be981523ed 100644
--- a/src/java.desktop/unix/classes/sun/awt/X11/XInputMethod.java
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XInputMethod.java
-@@ -28,15 +28,27 @@ package sun.awt.X11;
+@@ -28,10 +28,21 @@ package sun.awt.X11;
import java.awt.AWTException;
import java.awt.Component;
import java.awt.Container;
@@ -195,35 +189,25 @@ index 07c1334b8..01d5910de 100644
import sun.awt.AWTAccessor;
import sun.awt.X11InputMethod;
- import sun.util.logging.PlatformLogger;
+@@ -86,15 +97,29 @@ public class XInputMethod extends X11InputMethod {
-+
- /**
- * Input Method Adapter for XIM (without Motif)
- *
-@@ -83,8 +95,20 @@ public class XInputMethod extends X11InputMethod {
- return 0;
- return releaseXICNative(pData);
- }
--
-+
-+
- private static volatile long xicFocus = 0;
-+
+ private static volatile long xicFocus;
+
++ /**
++ * fix fcitx position
++ */
+ public void setXICTextCursorOffXY(ComponentPeer peer) {
-+
+ if (peer == null) {
+ return;
+ }
+ xicFocus = ((XComponentPeer)peer).getContentWindow();
+ int[] result = getOffXYRelateToFrame(peer ,true);
+ setXICFocusNative(((XComponentPeer)peer).getContentWindow(),true,true,result);
-+ // setXICTextCursorOffXYNative(((XComponentPeer)peer).getContentWindow(),result);
+ }
-
++
protected void setXICFocus(ComponentPeer peer,
boolean value, boolean active) {
-@@ -92,9 +116,11 @@ public class XInputMethod extends X11InputMethod {
+ if (peer == null) {
return;
}
xicFocus = ((XComponentPeer)peer).getContentWindow();
@@ -236,13 +220,13 @@ index 07c1334b8..01d5910de 100644
}
public static long getXICFocus() {
-@@ -156,6 +182,80 @@ public class XInputMethod extends X11InputMethod {
+@@ -156,6 +181,69 @@ public class XInputMethod extends X11InputMethod {
return peer.getContentWindow();
}
+ protected int[] getOffXYRelateToFrame(ComponentPeer peer, boolean value) {
+ int[] result = null;
-+ if(value && this.awtFocussedComponent!=null && this.awtFocussedComponent instanceof JTextComponent){
++ if(value && this.awtFocussedComponent !=null && this.awtFocussedComponent instanceof JTextComponent){
+ try {
+ Method method_getFontMetrics = null;
+ Method method_getEditor = null;
@@ -256,15 +240,15 @@ index 07c1334b8..01d5910de 100644
+ font_metrics = (FontMetrics)method_getFontMetrics.invoke(this.awtFocussedComponent);
+ font_height = font_metrics.getHeight();
+ JTextComponent jc = (JTextComponent)this.awtFocussedComponent;
-+ if( jc.getCaret().getMagicCaretPosition() != null) {
++ if(jc.getCaret().getMagicCaretPosition() != null) {
+ caret_x = jc.getCaret().getMagicCaretPosition().x;
+ caret_y = jc.getCaret().getMagicCaretPosition().y;
+ }
-+ }else {
++ } else {
+ method_getEditor = this.awtFocussedComponent.getClass().getMethod("getEditor");
+
+ editor = method_getEditor.invoke(this.awtFocussedComponent);
-+
++
+ method_getFontMetrics = editor.getClass().getMethod("getFontMetrics",int.class);
+ font_metrics = (FontMetrics)method_getFontMetrics.invoke(editor, 0);
+ font_height = font_metrics.getHeight();
@@ -272,42 +256,31 @@ index 07c1334b8..01d5910de 100644
+ Object[] locations = (Object[])getCaretLocations.invoke(editor, false);
+ Field point = locations[0].getClass().getField("myPoint");
+ Object myPoint = point.get(locations[0]);
-+ // shoule be Point or Point2D.Double
-+ // are subclass of Point2D
-+ if (myPoint instanceof Point2D) {
-+ // convert to Point2D
-+ Point2D p = (Point2D) myPoint;
-+ caret_x = (int) p.getX();
-+ caret_y = (int) p.getY();
-+ } else {
-+ // throw exception for unknown type
-+ throw new IllegalArgumentException("unknown type of myPoint: " + myPoint.getClass().getSimpleName());
-+ }
++ if (myPoint instanceof Point) {
++ // convert to Point
++ Point p = (Point) myPoint;
++ caret_x = p.x;
++ caret_y = p.y;
++ } else if (myPoint instanceof Point2D) {
++ // convert to Point2D.Double
++ Point2D.Double pd = (Point2D.Double) myPoint;
++ caret_x = (int) pd.x;
++ caret_y = (int) pd.y;
++ }
+ }
-+
+
+ Method method_getLocationOnScreen = this.awtFocussedComponent.getClass().getMethod("getLocationOnScreen");
-+
++
+ Point point = (Point)method_getLocationOnScreen.invoke(this.awtFocussedComponent);
+
+ Method method_getNativeContainer = Component.class.getDeclaredMethod("getNativeContainer");
+ method_getNativeContainer.setAccessible(true);
+ Container c = (Container)method_getNativeContainer.invoke(awtFocussedComponent);
-+ if(c!=null)
-+ result = new int[]{point.x - c.getPeer().getLocationOnScreen().x + caret_x, point.y - c.getPeer().getLocationOnScreen().y + font_height + caret_y};
++ if(c != null)
++ result = new int[]{point.x - c.getPeerLocationOnScreen().x + caret_x, point.y - c.getPeerLocationOnScreen().y + font_height + caret_y};
+
+ return result;
-+ } catch (IllegalAccessException e) {
-+ e.printStackTrace();
-+ } catch (IllegalArgumentException e) {
-+ e.printStackTrace();
-+ } catch (InvocationTargetException e) {
-+ e.printStackTrace();
-+ } catch (NoSuchMethodException e) {
-+ e.printStackTrace();
-+ } catch (SecurityException e) {
-+ e.printStackTrace();
-+ } catch(NoSuchFieldException e) {
++ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
@@ -317,7 +290,7 @@ index 07c1334b8..01d5910de 100644
/*
* Native methods
*/
-@@ -164,6 +264,6 @@ public class XInputMethod extends X11InputMethod {
+@@ -164,6 +252,6 @@ public class XInputMethod extends X11InputMethod {
private native boolean recreateXICNative(long window, long px11data, int ctxid);
private native int releaseXICNative(long px11data);
private native void setXICFocusNative(long window,
@@ -326,7 +299,7 @@ index 07c1334b8..01d5910de 100644
private native void adjustStatusWindow(long window);
}
diff --git a/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java b/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java
-index d9c45ed97..834164ad8 100644
+index 18e0ba1e7e4..34112b11db5 100644
--- a/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java
+++ b/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java
@@ -33,6 +33,7 @@ import java.awt.AWTException;
@@ -337,25 +310,26 @@ index d9c45ed97..834164ad8 100644
import java.awt.peer.ComponentPeer;
import java.text.AttributedString;
import java.util.Map;
-@@ -56,6 +57,10 @@ public abstract class X11InputMethod extends X11InputMethodBase {
- public X11InputMethod() throws AWTException {
+@@ -57,6 +58,11 @@ public abstract class X11InputMethod extends X11InputMethodBase {
super();
}
+
+ /**
+ * fix fcitx position
+ */
+ public abstract void setXICTextCursorOffXY(ComponentPeer peer);
-
++
/**
* Reset the composition state to the current composition state.
-@@ -380,6 +385,30 @@ public abstract class X11InputMethod extends X11InputMethodBase {
+ */
+@@ -380,6 +386,27 @@ public abstract class X11InputMethod extends X11InputMethodBase {
}
}
+ /**
+ * fix fcitx position
+ */
-+ public synchronized void setXICTextCursorPosition(Component component){
++ public synchronized void setXICTextCursorPosition(Component component) {
+ if (component == null) {
+ return;
+ }
@@ -366,24 +340,21 @@ index d9c45ed97..834164ad8 100644
+ setXICTextCursorOffXY(getPeer(awtFocussedComponent));
+
+ }
-+ awtFocussedComponent = component;
-+ // ComponentPeer lastXICFocussedComponentPeer = null;
-+ // if (lastXICFocussedComponent != null) {
-+ // lastXICFocussedComponentPeer = getPeer(lastXICFocussedComponent);
-+ // }
++ awtFocussedComponent = component;
+ ComponentPeer awtFocussedComponentPeer = getPeer(awtFocussedComponent);
-+ if(awtFocussedComponent !=null )
++ if(awtFocussedComponent != null) {
+ setXICTextCursorOffXY(awtFocussedComponentPeer);
++ }
+ }
+
protected abstract boolean recreateXIC(int ctxid);
protected abstract int releaseXIC();
private static native boolean recreateX11InputMethod();
diff --git a/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c b/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c
-index 847c44b52..c619d3773 100644
+index aafb1af3d81..ff3978dd043 100644
--- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c
-@@ -436,13 +436,17 @@ setXICFocus(XIC ic, unsigned short req)
+@@ -427,13 +427,17 @@ setXICFocus(XIC ic, unsigned short req)
* Sets the focus window to the given XIC.
*/
static void
@@ -403,7 +374,7 @@ index 847c44b52..c619d3773 100644
}
/*
-@@ -1468,7 +1472,8 @@ Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env,
+@@ -1469,7 +1473,8 @@ Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env,
jobject this,
jlong w,
jboolean req,
@@ -413,7 +384,7 @@ index 847c44b52..c619d3773 100644
{
X11InputMethodData *pX11IMData;
AWT_LOCK();
-@@ -1489,7 +1494,17 @@ Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env,
+@@ -1490,7 +1495,17 @@ Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env,
* On Solaris2.6, setXICWindowFocus() has to be invoked
* before setting focus.
*/
@@ -422,7 +393,7 @@ index 847c44b52..c619d3773 100644
+ if (arr)
+ {
+ int length = (*env)->GetArrayLength(env,arr);
-+ int *addArr = (*env)->GetIntArrayElements(env, arr, NULL);
++ int *addArr = (*env)->GetIntArrayElements(env, arr, NULL);
+ for (int i= 0; i < length; ++i) {
+ positions[i] = *(addArr + i);
+ }