diff options
-rw-r--r-- | .SRCINFO | 14 | ||||
-rw-r--r-- | PKGBUILD | 6 | ||||
-rw-r--r-- | idea.patch | 225 |
3 files changed, 127 insertions, 118 deletions
@@ -1,5 +1,5 @@ pkgbase = java17-jetbrains-imfix - pkgver = 17.0.7.b985.2 + pkgver = 17.0.7.b1000.2 pkgrel = 1 url = https://confluence.jetbrains.com/display/JBR/JetBrains+Runtime arch = x86_64 @@ -32,13 +32,13 @@ pkgbase = java17-jetbrains-imfix makedepends = jcef-jetbrains makedepends = git options = !lto - source = git+https://github.com/JetBrains/JetBrainsRuntime.git#tag=jb17.0.7-b985.2 - source = idea.patch + source = git+https://github.com/JetBrains/JetBrainsRuntime.git#tag=jb17.0.7-b1000.2 + source = https://github.com/tangruize/JetBrainsRuntime-for-Linux-x64/raw/master/idea.patch source = freedesktop-java.desktop source = freedesktop-jconsole.desktop source = freedesktop-jshell.desktop sha256sums = SKIP - sha256sums = 5f984d2e050fb6a9cbc1d48df62cd3ca2ff705a8aaa7286913c337c02da9beda + sha256sums = 6155834cc1a422508462828ad1603df7c946f4ecf073d537a7a7de43ad317458 sha256sums = 3d5ab2d5eaa994377de0554de5e59596f1fc7ab773e02d84aee83a568042b5ec sha256sums = 442d17b0de7ddd4c49a392f4ccc60f3378b9cf54908081b802d98b89597b3ab8 sha256sums = bdc910ffa896f92cca1d28cf9930276cb9bafbd13bfab97286b25fd7f7a6e11e @@ -70,7 +70,7 @@ pkgname = jre17-jetbrains-imfix optdepends = gtk3: for the Gtk+ 3 look and feel - desktop usage provides = java-runtime=17 provides = java-runtime-jetbrains=17 - provides = jre17-jetbrains=17.0.7.b985.2-1 + provides = jre17-jetbrains=17.0.7.b1000.2-1 conflicts = jre17-jetbrains backup = etc/java17-jetbrains/logging.properties backup = etc/java17-jetbrains/management/jmxremote.access @@ -90,7 +90,7 @@ pkgname = jre17-jetbrains-imfix pkgname = jdk17-jetbrains-imfix pkgdesc = JetBrains Java 17 development kit install = install_jdk-jetbrains.sh - depends = jre17-jetbrains=17.0.7.b985.2-1 + depends = jre17-jetbrains=17.0.7.b1000.2-1 depends = java-environment-common=3 depends = hicolor-icon-theme depends = libelf @@ -98,5 +98,5 @@ pkgname = jdk17-jetbrains-imfix depends = gcc-libs provides = java-environment=17 provides = java-environment-jetbrains=17 - provides = jdk17-jetbrains=17.0.7.b985.2-1 + provides = jdk17-jetbrains=17.0.7.b1000.2-1 conflicts = jdk17-jetbrains @@ -23,7 +23,7 @@ pkgname=('jre17-jetbrains-imfix' 'jdk17-jetbrains-imfix') _majorver=17 _ver=17.0.7 _hgver=17.0.7 -_jbver1=985 +_jbver1=1000 _jbver2=2 pkgrel=1 pkgver=${_ver}.b${_jbver1}.${_jbver2} @@ -37,12 +37,12 @@ makedepends=('java-environment=17' 'cpio' 'unzip' 'zip' 'libelf' 'libcups' 'libx 'libnet' 'bash' 'harfbuzz' 'gcc-libs' 'glibc' 'jcef-jetbrains' 'git') options=(!lto) source=(git+https://github.com/JetBrains/JetBrainsRuntime.git#tag=$_hg_tag - idea.patch + https://github.com/tangruize/JetBrainsRuntime-for-Linux-x64/raw/master/idea.patch freedesktop-java.desktop freedesktop-jconsole.desktop freedesktop-jshell.desktop) sha256sums=('SKIP' - '5f984d2e050fb6a9cbc1d48df62cd3ca2ff705a8aaa7286913c337c02da9beda' + '6155834cc1a422508462828ad1603df7c946f4ecf073d537a7a7de43ad317458' '3d5ab2d5eaa994377de0554de5e59596f1fc7ab773e02d84aee83a568042b5ec' '442d17b0de7ddd4c49a392f4ccc60f3378b9cf54908081b802d98b89597b3ab8' 'bdc910ffa896f92cca1d28cf9930276cb9bafbd13bfab97286b25fd7f7a6e11e') diff --git a/idea.patch b/idea.patch index 8590215d6bb5..cc5deee33acf 100644 --- a/idea.patch +++ b/idea.patch @@ -1,5 +1,32 @@ +diff --git a/src/java.desktop/share/classes/java/awt/Container.java b/src/java.desktop/share/classes/java/awt/Container.java +index 1327b2fded9..c2ebc03fcc1 100644 +--- a/src/java.desktop/share/classes/java/awt/Container.java ++++ b/src/java.desktop/share/classes/java/awt/Container.java +@@ -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 { + } + } + ++ /** ++ * 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 ecc9342f05a..c3bee6dd119 100644 +index ecc9342f05a..eea39c9e03a 100644 --- a/src/java.desktop/share/classes/javax/swing/JTextArea.java +++ b/src/java.desktop/share/classes/javax/swing/JTextArea.java @@ -562,6 +562,14 @@ public class JTextArea extends JTextComponent { @@ -7,7 +34,7 @@ index ecc9342f05a..c3bee6dd119 100644 } + /** -+ * Add by the "imfix" patch ++ * fix fcitx position + * @return FontMetrics + */ + public FontMetrics getFontMetrics() { @@ -18,28 +45,26 @@ index ecc9342f05a..c3bee6dd119 100644 * 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 3abe09d0565..d952d9fd678 100644 +index 3abe09d0565..50dc549bdba 100644 --- a/src/java.desktop/share/classes/javax/swing/JTextField.java +++ b/src/java.desktop/share/classes/javax/swing/JTextField.java -@@ -426,7 +426,15 @@ public class JTextField extends JTextComponent implements SwingConstants { - } +@@ -427,6 +427,14 @@ public class JTextField extends JTextComponent implements SwingConstants { return columnWidth; } -- -+ + + /** -+ * Add by the "imfix" patch ++ * fix fcitx position + * @return FontMetrics + */ + public FontMetrics getFontMetrics() { + return getFontMetrics(getFont()); + } -+ ++ /** * Returns the preferred size <code>Dimensions</code> needed for this * <code>TextField</code>. 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 bb955dc5089..29392b3399a 100644 +index bb955dc5089..7c42e2aa685 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; @@ -66,14 +91,13 @@ index bb955dc5089..29392b3399a 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; + } + @@ -85,20 +109,17 @@ index bb955dc5089..29392b3399a 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 + */ @@ -135,37 +156,18 @@ index bb955dc5089..29392b3399a 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 07c1334b83f..269fbdd3d4c 100644 +index 4244812ceb0..e1e8eff44d3 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,12 +28,26 @@ package sun.awt.X11; import java.awt.AWTException; import java.awt.Component; import java.awt.Container; @@ -175,7 +177,9 @@ index 07c1334b83f..269fbdd3d4c 100644 import java.awt.Rectangle; import java.awt.im.spi.InputMethodContext; import java.awt.peer.ComponentPeer; - ++import java.awt.GraphicsDevice; ++import java.awt.GraphicsEnvironment; ++ +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; @@ -183,39 +187,46 @@ index 07c1334b83f..269fbdd3d4c 100644 +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.text.JTextComponent; -+ + import sun.awt.AWTAccessor; import sun.awt.X11InputMethod; ++import sun.awt.X11GraphicsDevice; import sun.util.logging.PlatformLogger; +@@ -45,8 +59,13 @@ import sun.util.logging.PlatformLogger; + public class XInputMethod extends X11InputMethod { + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XInputMethod"); + ++ private int scale = -1; + - /** - * Input Method Adapter for XIM (without Motif) - * -@@ -83,8 +95,20 @@ public class XInputMethod extends X11InputMethod { - return 0; - return releaseXICNative(pData); + public XInputMethod() throws AWTException { + super(); ++ GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); ++ if (device instanceof X11GraphicsDevice) ++ scale = ((X11GraphicsDevice) device).getScaleFactor(); } -- -+ -+ + + public void setInputMethodContext(InputMethodContext context) { +@@ -86,15 +105,29 @@ public class XInputMethod extends X11InputMethod { + private static volatile long xicFocus = 0; -+ + ++ /** ++ * 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(); @@ -228,13 +239,13 @@ index 07c1334b83f..269fbdd3d4c 100644 } public static long getXICFocus() { -@@ -156,6 +182,74 @@ public class XInputMethod extends X11InputMethod { - return peer.getContentWindow(); +@@ -133,6 +166,74 @@ public class XInputMethod extends X11InputMethod { + return null; } + 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; @@ -248,52 +259,52 @@ index 07c1334b83f..269fbdd3d4c 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(); + Method getCaretLocations = editor.getClass().getMethod("getCaretLocations", boolean.class); + Object[] locations = (Object[])getCaretLocations.invoke(editor, false); + Field point = locations[0].getClass().getField("myPoint"); -+ // Point2D.Double pd = (Point2D.Double)point.get(locations[0]); -+ // caret_x = (int)pd.x; -+ // caret_y = (int)pd.y; -+ Point2D pd = (Point2D)point.get(locations[0]); -+ caret_x = (int)pd.getX(); -+ caret_y = (int)pd.getY(); ++ Object myPoint = point.get(locations[0]); ++ 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); -+ Component c = (Component)method_getNativeContainer.invoke(awtFocussedComponent); -+ if(c!=null) -+ result = new int[]{point.x - getPeer(c).getLocationOnScreen().x + caret_x, point.y - getPeer(c).getLocationOnScreen().y + font_height + caret_y}; ++ Container c = (Container)method_getNativeContainer.invoke(awtFocussedComponent); ++ if(c != null) { ++ result = new int[]{point.x - c.getPeerLocationOnScreen().x + caret_x, point.y - c.getPeerLocationOnScreen().y + font_height + caret_y}; ++ if (scale > 1) { ++ result[0] *= scale; ++ result[1] *= scale; ++ } ++ } + + 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(); + } + } @@ -301,9 +312,9 @@ index 07c1334b83f..269fbdd3d4c 100644 + } + /* - * Native methods - */ -@@ -164,6 +258,6 @@ public class XInputMethod extends X11InputMethod { + * Subclasses should override disposeImpl() instead of dispose(). Client + * code should always invoke dispose(), never disposeImpl(). +@@ -253,6 +354,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, @@ -312,7 +323,7 @@ index 07c1334b83f..269fbdd3d4c 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 18e0ba1e7e4..c56805d9b31 100644 +index d9bed439688..623af69478e 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; @@ -323,25 +334,26 @@ index 18e0ba1e7e4..c56805d9b31 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; + } @@ -352,24 +364,21 @@ index 18e0ba1e7e4..c56805d9b31 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 5709fd59797..51fe9bc5cb9 100644 +index e63741f583e..55d847b98ac 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 -@@ -427,13 +427,17 @@ setXICFocus(XIC ic, unsigned short req) +@@ -434,13 +434,17 @@ setXICFocus(XIC ic, unsigned short req) * Sets the focus window to the given XIC. */ static void @@ -389,7 +398,7 @@ index 5709fd59797..51fe9bc5cb9 100644 } /* -@@ -1462,7 +1466,8 @@ Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env, +@@ -1519,7 +1523,8 @@ Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env, jobject this, jlong w, jboolean req, @@ -399,7 +408,7 @@ index 5709fd59797..51fe9bc5cb9 100644 { X11InputMethodData *pX11IMData; AWT_LOCK(); -@@ -1483,7 +1488,17 @@ Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env, +@@ -1540,7 +1545,17 @@ Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env, * On Solaris2.6, setXICWindowFocus() has to be invoked * before setting focus. */ @@ -408,7 +417,7 @@ index 5709fd59797..51fe9bc5cb9 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); + } |