8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
Co-authored-by: Ichiroh Takiguchi <takiguc@linux.vnet.ibm.com> Reviewed-by: prr
This commit is contained in:
parent
5c128bbc7d
commit
244e03bf5a
@ -269,6 +269,7 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
|
||||
ifeq ($(ENABLE_HEADLESS_ONLY), false)
|
||||
|
||||
LIBAWT_XAWT_DIRS := \
|
||||
$(wildcard $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/libawt_xawt) \
|
||||
$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt_xawt \
|
||||
$(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
|
||||
$(TOPDIR)/src/java.desktop/share/native/common/awt/utility \
|
||||
@ -329,7 +330,7 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
|
||||
BUILD_LIBAWT_XAWT_awt_Font.c_CFLAGS := -w
|
||||
# initializing a declared 'extern'
|
||||
BUILD_LIBAWT_XAWT_debug_mem.c_CFLAGS := -w
|
||||
endif
|
||||
endif
|
||||
|
||||
$(eval $(call SetupJdkLibrary, BUILD_LIBAWT_XAWT, \
|
||||
NAME := awt_xawt, \
|
||||
|
490
src/java.desktop/aix/classes/sun/awt/X11InputMethod.java
Normal file
490
src/java.desktop/aix/classes/sun/awt/X11InputMethod.java
Normal file
@ -0,0 +1,490 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.awt;
|
||||
|
||||
import java.awt.AWTException;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.event.InputMethodEvent;
|
||||
import java.awt.font.TextAttribute;
|
||||
import java.awt.font.TextHitInfo;
|
||||
import java.awt.peer.ComponentPeer;
|
||||
import java.text.AttributedString;
|
||||
|
||||
import sun.util.logging.PlatformLogger;
|
||||
|
||||
/**
|
||||
* Input Method Adapter for XIM for AIX
|
||||
*
|
||||
* @author JavaSoft International
|
||||
*/
|
||||
public abstract class X11InputMethod extends X11InputMethodBase {
|
||||
|
||||
// to keep the instance of activating if IM resumed
|
||||
static protected X11InputMethod activatedInstance = null;
|
||||
|
||||
/**
|
||||
* Constructs an X11InputMethod instance. It initializes the XIM
|
||||
* environment if it's not done yet.
|
||||
*
|
||||
* @exception AWTException if XOpenIM() failed.
|
||||
*/
|
||||
public X11InputMethod() throws AWTException {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the composition state to the current composition state.
|
||||
*/
|
||||
protected void resetCompositionState() {
|
||||
if (compositionEnableSupported && haveActiveClient()) {
|
||||
try {
|
||||
/* Restore the composition mode to the last saved composition
|
||||
mode. */
|
||||
setCompositionEnabled(savedCompositionState);
|
||||
} catch (UnsupportedOperationException e) {
|
||||
compositionEnableSupported = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate input method.
|
||||
*/
|
||||
public synchronized void activate() {
|
||||
activatedInstance = this;
|
||||
clientComponentWindow = getClientComponentWindow();
|
||||
if (clientComponentWindow == null)
|
||||
return;
|
||||
|
||||
if (lastXICFocussedComponent != null) {
|
||||
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
log.fine("XICFocused {0}, AWTFocused {1}",
|
||||
lastXICFocussedComponent, awtFocussedComponent);
|
||||
}
|
||||
if (lastXICFocussedComponent != awtFocussedComponent) {
|
||||
ComponentPeer lastXICFocussedComponentPeer = getPeer(lastXICFocussedComponent);
|
||||
if (lastXICFocussedComponentPeer != null) {
|
||||
setXICFocus(lastXICFocussedComponentPeer, false, isLastXICActive);
|
||||
}
|
||||
}
|
||||
lastXICFocussedComponent = null;
|
||||
}
|
||||
|
||||
if (pData == 0) {
|
||||
if (!createXIC()) {
|
||||
return;
|
||||
}
|
||||
disposed = false;
|
||||
}
|
||||
|
||||
/* reset input context if necessary and set the XIC focus
|
||||
*/
|
||||
resetXICifneeded();
|
||||
ComponentPeer awtFocussedComponentPeer = getPeer(awtFocussedComponent);
|
||||
setStatusAreaVisible(true, pData);
|
||||
|
||||
if (awtFocussedComponentPeer != null) {
|
||||
setXICFocus(awtFocussedComponentPeer, true, haveActiveClient());
|
||||
}
|
||||
lastXICFocussedComponent = awtFocussedComponent;
|
||||
isLastXICActive = haveActiveClient();
|
||||
isActive = true;
|
||||
if (savedCompositionState) {
|
||||
resetCompositionState();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deactivate input method.
|
||||
*/
|
||||
public synchronized void deactivate(boolean isTemporary) {
|
||||
boolean isAc = haveActiveClient();
|
||||
/* Usually as the client component, let's call it component A,
|
||||
loses the focus, this method is called. Then when another client
|
||||
component, let's call it component B, gets the focus, activate is first called on
|
||||
the previous focused compoent which is A, then endComposition is called on A,
|
||||
deactivate is called on A again. And finally activate is called on the newly
|
||||
focused component B. Here is the call sequence.
|
||||
|
||||
A loses focus B gains focus
|
||||
-------------> deactivate A -------------> activate A -> endComposition A ->
|
||||
deactivate A -> activate B ----....
|
||||
|
||||
So in order to carry the composition mode across the components sharing the same
|
||||
input context, we save it when deactivate is called so that when activate is
|
||||
called, it can be restored correctly till activate is called on the newly focused
|
||||
component. (See also sun/awt/im/InputContext and bug 6184471).
|
||||
Last note, getCompositionState should be called before setXICFocus since
|
||||
setXICFocus here sets the XIC to 0.
|
||||
*/
|
||||
activatedInstance = null;
|
||||
savedCompositionState = getCompositionState();
|
||||
|
||||
if (isTemporary) {
|
||||
//turn the status window off...
|
||||
turnoffStatusWindow();
|
||||
/* Delay resetting the XIC focus until activate is called and the newly
|
||||
* Focused component has a different peer as the last focused component.
|
||||
*/
|
||||
lastXICFocussedComponent = awtFocussedComponent;
|
||||
} else {
|
||||
if (awtFocussedComponent != null ) {
|
||||
ComponentPeer awtFocussedComponentPeer = getPeer(awtFocussedComponent);
|
||||
if (awtFocussedComponentPeer != null) {
|
||||
setXICFocus(awtFocussedComponentPeer, false, isAc);
|
||||
}
|
||||
}
|
||||
lastXICFocussedComponent = null;
|
||||
}
|
||||
|
||||
isLastXICActive = isAc;
|
||||
isLastTemporary = isTemporary;
|
||||
isActive = false;
|
||||
setStatusAreaVisible(false, pData);
|
||||
}
|
||||
|
||||
// implements java.awt.im.spi.InputMethod.hideWindows
|
||||
public void hideWindows() {
|
||||
if (pData != 0) {
|
||||
setStatusAreaVisible(false, pData);
|
||||
turnoffStatusWindow();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates composed text with XIM preedit information and
|
||||
* posts composed text to the awt event queue. The args of
|
||||
* this method correspond to the XIM preedit callback
|
||||
* information. The XIM highlight attributes are translated via
|
||||
* fixed mapping (i.e., independent from any underlying input
|
||||
* method engine). This method is invoked in the AWT Toolkit
|
||||
* (X event loop) thread context and thus inside the AWT Lock.
|
||||
*/
|
||||
// NOTE: This method may be called by privileged threads.
|
||||
// This functionality is implemented in a package-private method
|
||||
// to insure that it cannot be overridden by client subclasses.
|
||||
// DO NOT INVOKE CLIENT CODE ON THIS THREAD!
|
||||
void dispatchComposedText(String chgText,
|
||||
int chgStyles[],
|
||||
int chgOffset,
|
||||
int chgLength,
|
||||
int caretPosition,
|
||||
long when) {
|
||||
if (disposed) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Workaround for deadlock bug on solaris2.6_zh bug#4170760
|
||||
if (chgText == null
|
||||
&& chgStyles == null
|
||||
&& chgOffset == 0
|
||||
&& chgLength == 0
|
||||
&& caretPosition == 0
|
||||
&& composedText == null
|
||||
&& committedText == null)
|
||||
return;
|
||||
|
||||
// Recalculate chgOffset and chgLength for supplementary char
|
||||
if (composedText != null) {
|
||||
int tmpChgOffset=chgOffset;
|
||||
int tmpChgLength=chgLength;
|
||||
int index = 0;
|
||||
for (int i=0;i < tmpChgOffset; i++,index++){
|
||||
if (index < composedText.length()
|
||||
&& Character.charCount(composedText.codePointAt(index))==2){
|
||||
index++;
|
||||
chgOffset++;
|
||||
}
|
||||
}
|
||||
// The index keeps value
|
||||
for (int i=0;i < tmpChgLength; i++,index++){
|
||||
if (index < composedText.length()
|
||||
&& Character.charCount(composedText.codePointAt(index))==2){
|
||||
index++;
|
||||
chgLength++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Replace control character with a square box
|
||||
if (chgText != null) {
|
||||
StringBuffer newChgText = new StringBuffer();
|
||||
for (int i=0; i < chgText.length(); i++){
|
||||
char c = chgText.charAt(i);
|
||||
if (Character.isISOControl(c)){
|
||||
c = '\u25A1';
|
||||
}
|
||||
newChgText.append(c);
|
||||
}
|
||||
chgText = new String(newChgText);
|
||||
}
|
||||
|
||||
if (composedText == null) {
|
||||
// TODO: avoid reallocation of those buffers
|
||||
composedText = new StringBuffer(INITIAL_SIZE);
|
||||
rawFeedbacks = new IntBuffer(INITIAL_SIZE);
|
||||
}
|
||||
if (chgLength > 0) {
|
||||
if (chgText == null && chgStyles != null) {
|
||||
rawFeedbacks.replace(chgOffset, chgStyles);
|
||||
} else {
|
||||
if (chgLength == composedText.length()) {
|
||||
// optimization for the special case to replace the
|
||||
// entire previous text
|
||||
composedText = new StringBuffer(INITIAL_SIZE);
|
||||
rawFeedbacks = new IntBuffer(INITIAL_SIZE);
|
||||
} else {
|
||||
if (composedText.length() > 0) {
|
||||
if (chgOffset+chgLength < composedText.length()) {
|
||||
String text;
|
||||
text = composedText.toString().substring(chgOffset+chgLength,
|
||||
composedText.length());
|
||||
composedText.setLength(chgOffset);
|
||||
composedText.append(text);
|
||||
} else {
|
||||
// in case to remove substring from chgOffset
|
||||
// to the end
|
||||
composedText.setLength(chgOffset);
|
||||
}
|
||||
rawFeedbacks.remove(chgOffset, chgLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (chgText != null) {
|
||||
composedText.insert(chgOffset, chgText);
|
||||
if (chgStyles != null) {
|
||||
// Recalculate chgStyles for supplementary char
|
||||
if (chgText.length() > chgStyles.length){
|
||||
int index=0;
|
||||
int[] newStyles = new int[chgText.length()];
|
||||
for (int i=0; i < chgStyles.length; i++, index++){
|
||||
newStyles[index]=chgStyles[i];
|
||||
if (index < chgText.length()
|
||||
&& Character.charCount(chgText.codePointAt(index))==2){
|
||||
newStyles[++index]=chgStyles[i];
|
||||
}
|
||||
}
|
||||
chgStyles=newStyles;
|
||||
}
|
||||
rawFeedbacks.insert(chgOffset, chgStyles);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (chgStyles != null) {
|
||||
// Recalculate chgStyles to support supplementary char
|
||||
int count=0;
|
||||
for (int i=0; i < chgStyles.length; i++){
|
||||
if (composedText.length() > chgOffset+i+count
|
||||
&& Character.charCount(composedText.codePointAt(chgOffset+i+count))==2){
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count>0){
|
||||
int index=0;
|
||||
int[] newStyles = new int[chgStyles.length+count];
|
||||
for (int i=0; i < chgStyles.length; i++, index++){
|
||||
newStyles[index]=chgStyles[i];
|
||||
if (composedText.length() > chgOffset+index
|
||||
&& Character.charCount(composedText.codePointAt(chgOffset+index))==2){
|
||||
newStyles[++index]=chgStyles[i];
|
||||
}
|
||||
}
|
||||
chgStyles=newStyles;
|
||||
}
|
||||
rawFeedbacks.replace(chgOffset, chgStyles);
|
||||
}
|
||||
|
||||
if (composedText.length() == 0) {
|
||||
composedText = null;
|
||||
rawFeedbacks = null;
|
||||
|
||||
// if there is any outstanding committed text stored by
|
||||
// dispatchCommittedText(), it has to be sent to the
|
||||
// client component.
|
||||
if (committedText != null) {
|
||||
dispatchCommittedText(committedText, when);
|
||||
committedText = null;
|
||||
return;
|
||||
}
|
||||
|
||||
// otherwise, send null text to delete client's composed
|
||||
// text.
|
||||
postInputMethodEvent(InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
|
||||
null,
|
||||
0,
|
||||
null,
|
||||
null,
|
||||
when);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Adjust caretPosition for supplementary char
|
||||
for (int i=0; i< caretPosition; i++){
|
||||
if (i < composedText.length()
|
||||
&& Character.charCount(composedText.codePointAt(i))==2){
|
||||
caretPosition++;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
// Now sending the composed text to the client
|
||||
int composedOffset;
|
||||
AttributedString inputText;
|
||||
|
||||
// if there is any partially committed text, concatenate it to
|
||||
// the composed text.
|
||||
if (committedText != null) {
|
||||
composedOffset = committedText.length();
|
||||
inputText = new AttributedString(committedText + composedText);
|
||||
committedText = null;
|
||||
} else {
|
||||
composedOffset = 0;
|
||||
inputText = new AttributedString(composedText.toString());
|
||||
}
|
||||
|
||||
int currentFeedback;
|
||||
int nextFeedback;
|
||||
int startOffset = 0;
|
||||
int currentOffset;
|
||||
int visiblePosition = 0;
|
||||
TextHitInfo visiblePositionInfo = null;
|
||||
|
||||
rawFeedbacks.rewind();
|
||||
currentFeedback = rawFeedbacks.getNext();
|
||||
rawFeedbacks.unget();
|
||||
while ((nextFeedback = rawFeedbacks.getNext()) != -1) {
|
||||
if (visiblePosition == 0) {
|
||||
visiblePosition = nextFeedback & XIMVisibleMask;
|
||||
if (visiblePosition != 0) {
|
||||
int index = rawFeedbacks.getOffset() - 1;
|
||||
|
||||
if (visiblePosition == XIMVisibleToBackward)
|
||||
visiblePositionInfo = TextHitInfo.leading(index);
|
||||
else
|
||||
visiblePositionInfo = TextHitInfo.trailing(index);
|
||||
}
|
||||
}
|
||||
nextFeedback &= ~XIMVisibleMask;
|
||||
if (currentFeedback != nextFeedback) {
|
||||
rawFeedbacks.unget();
|
||||
currentOffset = rawFeedbacks.getOffset();
|
||||
inputText.addAttribute(TextAttribute.INPUT_METHOD_HIGHLIGHT,
|
||||
convertVisualFeedbackToHighlight(currentFeedback),
|
||||
composedOffset + startOffset,
|
||||
composedOffset + currentOffset);
|
||||
startOffset = currentOffset;
|
||||
currentFeedback = nextFeedback;
|
||||
}
|
||||
}
|
||||
currentOffset = rawFeedbacks.getOffset();
|
||||
if (currentOffset >= 0) {
|
||||
inputText.addAttribute(TextAttribute.INPUT_METHOD_HIGHLIGHT,
|
||||
convertVisualFeedbackToHighlight(currentFeedback),
|
||||
composedOffset + startOffset,
|
||||
composedOffset + currentOffset);
|
||||
}
|
||||
|
||||
postInputMethodEvent(InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
|
||||
inputText.getIterator(),
|
||||
composedOffset,
|
||||
TextHitInfo.leading(caretPosition),
|
||||
visiblePositionInfo,
|
||||
when);
|
||||
}
|
||||
|
||||
/* Some IMs need forced Text clear */
|
||||
void clearComposedText(long when) {
|
||||
composedText = null;
|
||||
postInputMethodEvent(InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
|
||||
null, 0, null, null,
|
||||
when);
|
||||
if (committedText != null && committedText.length() > 0) {
|
||||
dispatchCommittedText(committedText, when);
|
||||
}
|
||||
committedText = null;
|
||||
rawFeedbacks = null;
|
||||
}
|
||||
|
||||
void clearComposedText() {
|
||||
if (EventQueue.isDispatchThread()) {
|
||||
clearComposedText(EventQueue.getMostRecentEventTime());
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Subclasses should override disposeImpl() instead of dispose(). Client
|
||||
* code should always invoke dispose(), never disposeImpl().
|
||||
*/
|
||||
protected synchronized void disposeImpl() {
|
||||
disposeXIC();
|
||||
awtLock();
|
||||
try {
|
||||
clearComposedText();
|
||||
} finally {
|
||||
// Put awtUnlock into finally block in case an exception is thrown in clearComposedText.
|
||||
awtUnlock();
|
||||
}
|
||||
awtFocussedComponent = null;
|
||||
lastXICFocussedComponent = null;
|
||||
needResetXIC = false;
|
||||
savedCompositionState = false;
|
||||
compositionEnableSupported = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.awt.im.spi.InputMethod#setCompositionEnabled(boolean)
|
||||
*/
|
||||
public void setCompositionEnabled(boolean enable) {
|
||||
/* If the composition state is successfully changed, set
|
||||
the savedCompositionState to 'enable'. Otherwise, simply
|
||||
return.
|
||||
setCompositionEnabledNative may throw UnsupportedOperationException.
|
||||
Don't try to catch it since the method may be called by clients.
|
||||
Use package private mthod 'resetCompositionState' if you want the
|
||||
exception to be caught.
|
||||
*/
|
||||
boolean pre, post;
|
||||
pre=getCompositionState();
|
||||
|
||||
if (setCompositionEnabledNative(enable)) {
|
||||
savedCompositionState = enable;
|
||||
}
|
||||
|
||||
post=getCompositionState();
|
||||
if (pre != post && post == enable){
|
||||
if (enable == false) flushText();
|
||||
if (awtFocussedComponent != null && isActive){
|
||||
setXICFocus(getPeer(awtFocussedComponent),
|
||||
true, haveActiveClient());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private native void setStatusAreaVisible(boolean value, long data);
|
||||
}
|
2269
src/java.desktop/aix/native/libawt_xawt/awt/awt_InputMethod.c
Normal file
2269
src/java.desktop/aix/native/libawt_xawt/awt/awt_InputMethod.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,147 +25,21 @@
|
||||
|
||||
package sun.awt;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.awt.AWTEvent;
|
||||
import java.awt.AWTException;
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.Window;
|
||||
import java.awt.im.InputMethodHighlight;
|
||||
import java.awt.im.spi.InputMethodContext;
|
||||
import sun.awt.im.InputMethodAdapter;
|
||||
import java.awt.event.InputMethodEvent;
|
||||
import java.awt.font.TextAttribute;
|
||||
import java.awt.font.TextHitInfo;
|
||||
import java.awt.peer.ComponentPeer;
|
||||
import java.lang.Character.Subset;
|
||||
import java.text.AttributedString;
|
||||
import java.text.AttributedCharacterIterator;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import sun.util.logging.PlatformLogger;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
/**
|
||||
* Input Method Adapter for XIM
|
||||
*
|
||||
* @author JavaSoft International
|
||||
*/
|
||||
public abstract class X11InputMethod extends InputMethodAdapter {
|
||||
private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11InputMethod");
|
||||
/*
|
||||
* The following XIM* values must be the same as those defined in
|
||||
* Xlib.h
|
||||
*/
|
||||
private static final int XIMReverse = (1<<0);
|
||||
private static final int XIMUnderline = (1<<1);
|
||||
private static final int XIMHighlight = (1<<2);
|
||||
private static final int XIMPrimary = (1<<5);
|
||||
private static final int XIMSecondary = (1<<6);
|
||||
private static final int XIMTertiary = (1<<7);
|
||||
|
||||
/*
|
||||
* visible position values
|
||||
*/
|
||||
private static final int XIMVisibleToForward = (1<<8);
|
||||
private static final int XIMVisibleToBackward = (1<<9);
|
||||
private static final int XIMVisibleCenter = (1<<10);
|
||||
private static final int XIMVisibleMask = (XIMVisibleToForward|
|
||||
XIMVisibleToBackward|
|
||||
XIMVisibleCenter);
|
||||
|
||||
private Locale locale;
|
||||
private static boolean isXIMOpened = false;
|
||||
protected Container clientComponentWindow = null;
|
||||
private Component awtFocussedComponent = null;
|
||||
private Component lastXICFocussedComponent = null;
|
||||
private boolean isLastXICActive = false;
|
||||
private boolean isLastTemporary = false;
|
||||
private boolean isActive = false;
|
||||
private boolean isActiveClient = false;
|
||||
private static Map<TextAttribute, ?>[] highlightStyles;
|
||||
private boolean disposed = false;
|
||||
|
||||
//reset the XIC if necessary
|
||||
private boolean needResetXIC = false;
|
||||
private WeakReference<Component> needResetXICClient = new WeakReference<>(null);
|
||||
|
||||
// The use of compositionEnableSupported is to reduce unnecessary
|
||||
// native calls if set/isCompositionEnabled
|
||||
// throws UnsupportedOperationException.
|
||||
// It is set to false if that exception is thrown first time
|
||||
// either of the two methods are called.
|
||||
private boolean compositionEnableSupported = true;
|
||||
// The savedCompositionState indicates the composition mode when
|
||||
// endComposition or setCompositionEnabled is called. It doesn't always
|
||||
// reflect the actual composition state because it doesn't get updated
|
||||
// when the user changes the composition state through direct interaction
|
||||
// with the input method. It is used to save the composition mode when
|
||||
// focus is traversed across different client components sharing the
|
||||
// same java input context. Also if set/isCompositionEnabled are not
|
||||
// supported, it remains false.
|
||||
private boolean savedCompositionState = false;
|
||||
|
||||
// variables to keep track of preedit context.
|
||||
// these variables need to be accessed within AWT_LOCK/UNLOCK
|
||||
private String committedText = null;
|
||||
private StringBuffer composedText = null;
|
||||
private IntBuffer rawFeedbacks;
|
||||
|
||||
// private data (X11InputMethodData structure defined in
|
||||
// awt_InputMethod.c) for native methods
|
||||
// this structure needs to be accessed within AWT_LOCK/UNLOCK
|
||||
private transient long pData = 0; // accessed by native
|
||||
|
||||
// Initialize highlight mapping table
|
||||
static {
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
Map<TextAttribute, ?> styles[] = new Map[4];
|
||||
HashMap<TextAttribute, Object> map;
|
||||
|
||||
// UNSELECTED_RAW_TEXT_HIGHLIGHT
|
||||
map = new HashMap<>(1);
|
||||
map.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
|
||||
styles[0] = Collections.unmodifiableMap(map);
|
||||
|
||||
// SELECTED_RAW_TEXT_HIGHLIGHT
|
||||
map = new HashMap<>(1);
|
||||
map.put(TextAttribute.SWAP_COLORS, TextAttribute.SWAP_COLORS_ON);
|
||||
styles[1] = Collections.unmodifiableMap(map);
|
||||
|
||||
// UNSELECTED_CONVERTED_TEXT_HIGHLIGHT
|
||||
map = new HashMap<>(1);
|
||||
map.put(TextAttribute.INPUT_METHOD_UNDERLINE,
|
||||
TextAttribute.UNDERLINE_LOW_ONE_PIXEL);
|
||||
styles[2] = Collections.unmodifiableMap(map);
|
||||
|
||||
// SELECTED_CONVERTED_TEXT_HIGHLIGHT
|
||||
map = new HashMap<>(1);
|
||||
map.put(TextAttribute.SWAP_COLORS, TextAttribute.SWAP_COLORS_ON);
|
||||
styles[3] = Collections.unmodifiableMap(map);
|
||||
|
||||
highlightStyles = styles;
|
||||
}
|
||||
|
||||
static {
|
||||
initIDs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize JNI field and method IDs for fields that may be
|
||||
accessed from C.
|
||||
*/
|
||||
private static native void initIDs();
|
||||
public abstract class X11InputMethod extends X11InputMethodBase {
|
||||
|
||||
/**
|
||||
* Constructs an X11InputMethod instance. It initializes the XIM
|
||||
@ -174,113 +48,13 @@ public abstract class X11InputMethod extends InputMethodAdapter {
|
||||
* @exception AWTException if XOpenIM() failed.
|
||||
*/
|
||||
public X11InputMethod() throws AWTException {
|
||||
// supports only the locale in which the VM is started
|
||||
locale = X11InputMethodDescriptor.getSupportedLocale();
|
||||
if (initXIM() == false) {
|
||||
throw new AWTException("Cannot open X Input Method");
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() throws Throwable {
|
||||
dispose();
|
||||
super.finalize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes openIM() that invokes XOpenIM() if it's not opened yet.
|
||||
* @return true if openXIM() is successful or it's already been opened.
|
||||
*/
|
||||
private synchronized boolean initXIM() {
|
||||
if (isXIMOpened == false)
|
||||
isXIMOpened = openXIM();
|
||||
return isXIMOpened;
|
||||
}
|
||||
|
||||
protected abstract boolean openXIM();
|
||||
|
||||
protected boolean isDisposed() {
|
||||
return disposed;
|
||||
}
|
||||
|
||||
protected abstract void setXICFocus(ComponentPeer peer,
|
||||
boolean value, boolean active);
|
||||
|
||||
/**
|
||||
* Does nothing - this adapter doesn't use the input method context.
|
||||
*
|
||||
* @see java.awt.im.spi.InputMethod#setInputMethodContext
|
||||
*/
|
||||
public void setInputMethodContext(InputMethodContext context) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set locale to input. If input method doesn't support specified locale,
|
||||
* false will be returned and its behavior is not changed.
|
||||
*
|
||||
* @param lang locale to input
|
||||
* @return the true is returned when specified locale is supported.
|
||||
*/
|
||||
public boolean setLocale(Locale lang) {
|
||||
if (lang.equals(locale)) {
|
||||
return true;
|
||||
}
|
||||
// special compatibility rule for Japanese and Korean
|
||||
if (locale.equals(Locale.JAPAN) && lang.equals(Locale.JAPANESE) ||
|
||||
locale.equals(Locale.KOREA) && lang.equals(Locale.KOREAN)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns current input locale.
|
||||
*/
|
||||
public Locale getLocale() {
|
||||
return locale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does nothing - XIM doesn't let you specify which characters you expect.
|
||||
*
|
||||
* @see java.awt.im.spi.InputMethod#setCharacterSubsets
|
||||
*/
|
||||
public void setCharacterSubsets(Subset[] subsets) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch event to input method. InputContext dispatch event with this
|
||||
* method. Input method set consume flag if event is consumed in
|
||||
* input method.
|
||||
*
|
||||
* @param e event
|
||||
*/
|
||||
public void dispatchEvent(AWTEvent e) {
|
||||
}
|
||||
|
||||
|
||||
protected final void resetXICifneeded(){
|
||||
/* needResetXIC is used to indicate whether to call
|
||||
resetXIC on the active client. resetXIC will always be
|
||||
called on the passive client when endComposition is called.
|
||||
*/
|
||||
if (needResetXIC && haveActiveClient() &&
|
||||
getClientComponent() != needResetXICClient.get()){
|
||||
resetXIC();
|
||||
|
||||
// needs to reset the last xic focussed component.
|
||||
lastXICFocussedComponent = null;
|
||||
isLastXICActive = false;
|
||||
|
||||
needResetXICClient.clear();
|
||||
needResetXIC = false;
|
||||
}
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the composition state to the current composition state.
|
||||
*/
|
||||
private void resetCompositionState() {
|
||||
protected void resetCompositionState() {
|
||||
if (compositionEnableSupported) {
|
||||
try {
|
||||
/* Restore the composition mode to the last saved composition
|
||||
@ -292,23 +66,6 @@ public abstract class X11InputMethod extends InputMethodAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Query and then return the current composition state.
|
||||
* @return the composition state if isCompositionEnabled call
|
||||
* is successful. Otherwise, it returns false.
|
||||
*/
|
||||
private boolean getCompositionState() {
|
||||
boolean compositionState = false;
|
||||
if (compositionEnableSupported) {
|
||||
try {
|
||||
compositionState = isCompositionEnabled();
|
||||
} catch (UnsupportedOperationException e) {
|
||||
compositionEnableSupported = false;
|
||||
}
|
||||
}
|
||||
return compositionState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate input method.
|
||||
*/
|
||||
@ -317,7 +74,7 @@ public abstract class X11InputMethod extends InputMethodAdapter {
|
||||
if (clientComponentWindow == null)
|
||||
return;
|
||||
|
||||
if (lastXICFocussedComponent != null){
|
||||
if (lastXICFocussedComponent != null) {
|
||||
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
log.fine("XICFocused {0}, AWTFocused {1}",
|
||||
lastXICFocussedComponent, awtFocussedComponent);
|
||||
@ -360,8 +117,6 @@ public abstract class X11InputMethod extends InputMethodAdapter {
|
||||
isActive = true;
|
||||
}
|
||||
|
||||
protected abstract boolean createXIC();
|
||||
|
||||
/**
|
||||
* Deactivate input method.
|
||||
*/
|
||||
@ -387,197 +142,25 @@ public abstract class X11InputMethod extends InputMethodAdapter {
|
||||
*/
|
||||
savedCompositionState = getCompositionState();
|
||||
|
||||
if (isTemporary){
|
||||
if (isTemporary) {
|
||||
//turn the status window off...
|
||||
turnoffStatusWindow();
|
||||
}
|
||||
|
||||
/* Delay resetting the XIC focus until activate is called and the newly
|
||||
focussed component has a different peer as the last focussed component.
|
||||
*/
|
||||
* Focused component has a different peer as the last focused component.
|
||||
*/
|
||||
lastXICFocussedComponent = awtFocussedComponent;
|
||||
isLastXICActive = isAc;
|
||||
isLastTemporary = isTemporary;
|
||||
isActive = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Explicitly disable the native IME. Native IME is not disabled when
|
||||
* deactivate is called.
|
||||
*/
|
||||
public void disableInputMethod() {
|
||||
if (lastXICFocussedComponent != null) {
|
||||
setXICFocus(getPeer(lastXICFocussedComponent), false, isLastXICActive);
|
||||
lastXICFocussedComponent = null;
|
||||
isLastXICActive = false;
|
||||
|
||||
resetXIC();
|
||||
needResetXICClient.clear();
|
||||
needResetXIC = false;
|
||||
}
|
||||
}
|
||||
|
||||
// implements java.awt.im.spi.InputMethod.hideWindows
|
||||
public void hideWindows() {
|
||||
// ??? need real implementation
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.awt.Toolkit#mapInputMethodHighlight
|
||||
*/
|
||||
public static Map<TextAttribute, ?> mapInputMethodHighlight(InputMethodHighlight highlight) {
|
||||
int index;
|
||||
int state = highlight.getState();
|
||||
if (state == InputMethodHighlight.RAW_TEXT) {
|
||||
index = 0;
|
||||
} else if (state == InputMethodHighlight.CONVERTED_TEXT) {
|
||||
index = 2;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
if (highlight.isSelected()) {
|
||||
index += 1;
|
||||
}
|
||||
return highlightStyles[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see sun.awt.im.InputMethodAdapter#setAWTFocussedComponent
|
||||
*/
|
||||
protected void setAWTFocussedComponent(Component component) {
|
||||
if (component == null) {
|
||||
return;
|
||||
}
|
||||
if (isActive) {
|
||||
// deactivate/activate are being suppressed during a focus change -
|
||||
// this may happen when an input method window is made visible
|
||||
boolean ac = haveActiveClient();
|
||||
setXICFocus(getPeer(awtFocussedComponent), false, ac);
|
||||
setXICFocus(getPeer(component), true, ac);
|
||||
}
|
||||
awtFocussedComponent = component;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see sun.awt.im.InputMethodAdapter#stopListening
|
||||
*/
|
||||
protected void stopListening() {
|
||||
// It is desirable to disable XIM by calling XSetICValues with
|
||||
// XNPreeditState == XIMPreeditDisable. But Solaris 2.6 and
|
||||
// Solaris 7 do not implement this correctly without a patch,
|
||||
// so just call resetXIC here. Prior endComposition call commits
|
||||
// the existing composed text.
|
||||
endComposition();
|
||||
// disable the native input method so that the other input
|
||||
// method could get the input focus.
|
||||
disableInputMethod();
|
||||
if (needResetXIC) {
|
||||
resetXIC();
|
||||
needResetXICClient.clear();
|
||||
needResetXIC = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Window instance in which the client component is
|
||||
* contained. If not found, null is returned. (IS THIS POSSIBLE?)
|
||||
*/
|
||||
// NOTE: This method may be called by privileged threads.
|
||||
// DO NOT INVOKE CLIENT CODE ON THIS THREAD!
|
||||
private Window getClientComponentWindow() {
|
||||
Component client = getClientComponent();
|
||||
Container container;
|
||||
|
||||
if (client instanceof Container) {
|
||||
container = (Container) client;
|
||||
} else {
|
||||
container = getParent(client);
|
||||
}
|
||||
|
||||
while (container != null && !(container instanceof java.awt.Window)) {
|
||||
container = getParent(container);
|
||||
}
|
||||
return (Window) container;
|
||||
}
|
||||
|
||||
protected abstract Container getParent(Component client);
|
||||
|
||||
/**
|
||||
* Returns peer of the given client component. If the given client component
|
||||
* doesn't have peer, peer of the native container of the client is returned.
|
||||
*/
|
||||
protected abstract ComponentPeer getPeer(Component client);
|
||||
|
||||
/**
|
||||
* Used to protect preedit data
|
||||
*/
|
||||
protected abstract void awtLock();
|
||||
protected abstract void awtUnlock();
|
||||
|
||||
/**
|
||||
* Creates an input method event from the arguments given
|
||||
* and posts it on the AWT event queue. For arguments,
|
||||
* see InputMethodEvent. Called by input method.
|
||||
*
|
||||
* @see java.awt.event.InputMethodEvent#InputMethodEvent
|
||||
*/
|
||||
private void postInputMethodEvent(int id,
|
||||
AttributedCharacterIterator text,
|
||||
int committedCharacterCount,
|
||||
TextHitInfo caret,
|
||||
TextHitInfo visiblePosition,
|
||||
long when) {
|
||||
Component source = getClientComponent();
|
||||
if (source != null) {
|
||||
InputMethodEvent event = new InputMethodEvent(source,
|
||||
id, when, text, committedCharacterCount, caret, visiblePosition);
|
||||
SunToolkit.postEvent(SunToolkit.targetToAppContext(source), (AWTEvent)event);
|
||||
}
|
||||
}
|
||||
|
||||
private void postInputMethodEvent(int id,
|
||||
AttributedCharacterIterator text,
|
||||
int committedCharacterCount,
|
||||
TextHitInfo caret,
|
||||
TextHitInfo visiblePosition) {
|
||||
postInputMethodEvent(id, text, committedCharacterCount,
|
||||
caret, visiblePosition, EventQueue.getMostRecentEventTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatches committed text from XIM to the awt event queue. This
|
||||
* method is invoked from the event handler in canvas.c in the
|
||||
* AWT Toolkit thread context and thus inside the AWT Lock.
|
||||
* @param str committed text
|
||||
* @param when when
|
||||
*/
|
||||
// NOTE: This method may be called by privileged threads.
|
||||
// This functionality is implemented in a package-private method
|
||||
// to insure that it cannot be overridden by client subclasses.
|
||||
// DO NOT INVOKE CLIENT CODE ON THIS THREAD!
|
||||
void dispatchCommittedText(String str, long when) {
|
||||
if (str == null)
|
||||
return;
|
||||
|
||||
if (composedText == null) {
|
||||
AttributedString attrstr = new AttributedString(str);
|
||||
postInputMethodEvent(InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
|
||||
attrstr.getIterator(),
|
||||
str.length(),
|
||||
null,
|
||||
null,
|
||||
when);
|
||||
} else {
|
||||
// if there is composed text, wait until the preedit
|
||||
// callback is invoked.
|
||||
committedText = str;
|
||||
}
|
||||
}
|
||||
|
||||
private void dispatchCommittedText(String str) {
|
||||
dispatchCommittedText(str, EventQueue.getMostRecentEventTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates composed text with XIM preedit information and
|
||||
* posts composed text to the awt event queue. The args of
|
||||
@ -601,7 +184,7 @@ public abstract class X11InputMethod extends InputMethodAdapter {
|
||||
return;
|
||||
}
|
||||
|
||||
//Workaround for deadlock bug on solaris2.6_zh bug#4170760
|
||||
// Workaround for deadlock bug on solaris2.6_zh bug#4170760
|
||||
if (chgText == null
|
||||
&& chgStyles == null
|
||||
&& chgOffset == 0
|
||||
@ -739,34 +322,6 @@ public abstract class X11InputMethod extends InputMethodAdapter {
|
||||
when);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flushes composed and committed text held in this context.
|
||||
* This method is invoked in the AWT Toolkit (X event loop) thread context
|
||||
* and thus inside the AWT Lock.
|
||||
*/
|
||||
// NOTE: This method may be called by privileged threads.
|
||||
// This functionality is implemented in a package-private method
|
||||
// to insure that it cannot be overridden by client subclasses.
|
||||
// DO NOT INVOKE CLIENT CODE ON THIS THREAD!
|
||||
void flushText() {
|
||||
String flush = (committedText != null ? committedText : "");
|
||||
if (composedText != null) {
|
||||
flush += composedText.toString();
|
||||
}
|
||||
|
||||
if (!flush.equals("")) {
|
||||
AttributedString attrstr = new AttributedString(flush);
|
||||
postInputMethodEvent(InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
|
||||
attrstr.getIterator(),
|
||||
flush.length(),
|
||||
null,
|
||||
null,
|
||||
EventQueue.getMostRecentEventTime());
|
||||
composedText = null;
|
||||
committedText = null;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Subclasses should override disposeImpl() instead of dispose(). Client
|
||||
* code should always invoke dispose(), never disposeImpl().
|
||||
@ -782,43 +337,6 @@ public abstract class X11InputMethod extends InputMethodAdapter {
|
||||
lastXICFocussedComponent = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Frees all X Window resources associated with this object.
|
||||
*
|
||||
* @see java.awt.im.spi.InputMethod#dispose
|
||||
*/
|
||||
public final void dispose() {
|
||||
boolean call_disposeImpl = false;
|
||||
|
||||
if (!disposed) {
|
||||
synchronized (this) {
|
||||
if (!disposed) {
|
||||
disposed = call_disposeImpl = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (call_disposeImpl) {
|
||||
disposeImpl();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns null.
|
||||
*
|
||||
* @see java.awt.im.spi.InputMethod#getControlObject
|
||||
*/
|
||||
public Object getControlObject() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.awt.im.spi.InputMethod#removeNotify
|
||||
*/
|
||||
public synchronized void removeNotify() {
|
||||
dispose();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.awt.im.spi.InputMethod#setCompositionEnabled(boolean)
|
||||
*/
|
||||
@ -835,263 +353,4 @@ public abstract class X11InputMethod extends InputMethodAdapter {
|
||||
savedCompositionState = enable;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.awt.im.spi.InputMethod#isCompositionEnabled
|
||||
*/
|
||||
public boolean isCompositionEnabled() {
|
||||
/* isCompositionEnabledNative may throw UnsupportedOperationException.
|
||||
Don't try to catch it since this method may be called by clients.
|
||||
Use package private method 'getCompositionState' if you want the
|
||||
exception to be caught.
|
||||
*/
|
||||
return isCompositionEnabledNative();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ends any input composition that may currently be going on in this
|
||||
* context. Depending on the platform and possibly user preferences,
|
||||
* this may commit or delete uncommitted text. Any changes to the text
|
||||
* are communicated to the active component using an input method event.
|
||||
*
|
||||
* <p>
|
||||
* A text editing component may call this in a variety of situations,
|
||||
* for example, when the user moves the insertion point within the text
|
||||
* (but outside the composed text), or when the component's text is
|
||||
* saved to a file or copied to the clipboard.
|
||||
*
|
||||
*/
|
||||
public void endComposition() {
|
||||
if (disposed) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Before calling resetXIC, record the current composition mode
|
||||
so that it can be restored later. */
|
||||
savedCompositionState = getCompositionState();
|
||||
boolean active = haveActiveClient();
|
||||
if (active && composedText == null && committedText == null){
|
||||
needResetXIC = true;
|
||||
needResetXICClient = new WeakReference<>(getClientComponent());
|
||||
return;
|
||||
}
|
||||
|
||||
String text = resetXIC();
|
||||
/* needResetXIC is only set to true for active client. So passive
|
||||
client should not reset the flag to false. */
|
||||
if (active) {
|
||||
needResetXIC = false;
|
||||
}
|
||||
|
||||
// Remove any existing composed text by posting an InputMethodEvent
|
||||
// with null composed text. It would be desirable to wait for a
|
||||
// dispatchComposedText call from X input method engine, but some
|
||||
// input method does not conform to the XIM specification and does
|
||||
// not call the preedit callback to erase preedit text on calling
|
||||
// XmbResetIC. To work around this problem, do it here by ourselves.
|
||||
awtLock();
|
||||
composedText = null;
|
||||
postInputMethodEvent(InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
|
||||
null,
|
||||
0,
|
||||
null,
|
||||
null);
|
||||
|
||||
if (text != null && text.length() > 0) {
|
||||
dispatchCommittedText(text);
|
||||
}
|
||||
awtUnlock();
|
||||
|
||||
// Restore the preedit state if it was enabled
|
||||
if (savedCompositionState) {
|
||||
resetCompositionState();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string with information about the current input method server, or null.
|
||||
* On both Linux & SunOS, the value of environment variable XMODIFIERS is
|
||||
* returned if set. Otherwise, on SunOS, $HOME/.dtprofile will be parsed
|
||||
* to find out the language service engine (atok or wnn) since there is
|
||||
* no API in Xlib which returns the information of native
|
||||
* IM server or language service and we want to try our best to return as much
|
||||
* information as possible.
|
||||
*
|
||||
* Note: This method could return null on Linux if XMODIFIERS is not set properly or
|
||||
* if any IOException is thrown.
|
||||
* See man page of XSetLocaleModifiers(3X11) for the usgae of XMODIFIERS,
|
||||
* atok12setup(1) and wnn6setup(1) for the information written to
|
||||
* $HOME/.dtprofile when you run these two commands.
|
||||
*
|
||||
*/
|
||||
public String getNativeInputMethodInfo() {
|
||||
String xmodifiers = System.getenv("XMODIFIERS");
|
||||
String imInfo = null;
|
||||
|
||||
// If XMODIFIERS is set, return the value
|
||||
if (xmodifiers != null) {
|
||||
int imIndex = xmodifiers.indexOf("@im=");
|
||||
if (imIndex != -1) {
|
||||
imInfo = xmodifiers.substring(imIndex + 4);
|
||||
}
|
||||
} else if (System.getProperty("os.name").startsWith("SunOS")) {
|
||||
File dtprofile = new File(System.getProperty("user.home") +
|
||||
"/.dtprofile");
|
||||
String languageEngineInfo = null;
|
||||
try {
|
||||
BufferedReader br = new BufferedReader(new FileReader(dtprofile));
|
||||
String line = null;
|
||||
|
||||
while ( languageEngineInfo == null && (line = br.readLine()) != null) {
|
||||
if (line.contains("atok") || line.contains("wnn")) {
|
||||
StringTokenizer tokens = new StringTokenizer(line);
|
||||
while (tokens.hasMoreTokens()) {
|
||||
String token = tokens.nextToken();
|
||||
if (Pattern.matches("atok.*setup", token) ||
|
||||
Pattern.matches("wnn.*setup", token)){
|
||||
languageEngineInfo = token.substring(0, token.indexOf("setup"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
br.close();
|
||||
} catch(IOException ioex) {
|
||||
// Since this method is provided for internal testing only,
|
||||
// we dump the stack trace for the ease of debugging.
|
||||
ioex.printStackTrace();
|
||||
}
|
||||
|
||||
imInfo = "htt " + languageEngineInfo;
|
||||
}
|
||||
|
||||
return imInfo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Performs mapping from an XIM visible feedback value to Java IM highlight.
|
||||
* @return Java input method highlight
|
||||
*/
|
||||
private InputMethodHighlight convertVisualFeedbackToHighlight(int feedback) {
|
||||
InputMethodHighlight highlight;
|
||||
|
||||
switch (feedback) {
|
||||
case XIMUnderline:
|
||||
highlight = InputMethodHighlight.UNSELECTED_CONVERTED_TEXT_HIGHLIGHT;
|
||||
break;
|
||||
case XIMReverse:
|
||||
highlight = InputMethodHighlight.SELECTED_CONVERTED_TEXT_HIGHLIGHT;
|
||||
break;
|
||||
case XIMHighlight:
|
||||
highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
|
||||
break;
|
||||
case XIMPrimary:
|
||||
highlight = InputMethodHighlight.UNSELECTED_CONVERTED_TEXT_HIGHLIGHT;
|
||||
break;
|
||||
case XIMSecondary:
|
||||
highlight = InputMethodHighlight.SELECTED_CONVERTED_TEXT_HIGHLIGHT;
|
||||
break;
|
||||
case XIMTertiary:
|
||||
highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
|
||||
break;
|
||||
default:
|
||||
highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
|
||||
break;
|
||||
}
|
||||
return highlight;
|
||||
}
|
||||
|
||||
// initial capacity size for string buffer, etc.
|
||||
private static final int INITIAL_SIZE = 64;
|
||||
|
||||
/**
|
||||
* IntBuffer is an inner class that manipulates an int array and
|
||||
* provides UNIX file io stream-like programming interfaces to
|
||||
* access it. (An alternative would be to use ArrayList which may
|
||||
* be too expensive for the work.)
|
||||
*/
|
||||
private final class IntBuffer {
|
||||
private int[] intArray;
|
||||
private int size;
|
||||
private int index;
|
||||
|
||||
IntBuffer(int initialCapacity) {
|
||||
intArray = new int[initialCapacity];
|
||||
size = 0;
|
||||
index = 0;
|
||||
}
|
||||
|
||||
void insert(int offset, int[] values) {
|
||||
int newSize = size + values.length;
|
||||
if (intArray.length < newSize) {
|
||||
int[] newIntArray = new int[newSize * 2];
|
||||
System.arraycopy(intArray, 0, newIntArray, 0, size);
|
||||
intArray = newIntArray;
|
||||
}
|
||||
System.arraycopy(intArray, offset, intArray, offset+values.length,
|
||||
size - offset);
|
||||
System.arraycopy(values, 0, intArray, offset, values.length);
|
||||
size += values.length;
|
||||
if (index > offset)
|
||||
index = offset;
|
||||
}
|
||||
|
||||
void remove(int offset, int length) {
|
||||
if (offset + length != size)
|
||||
System.arraycopy(intArray, offset+length, intArray, offset,
|
||||
size - offset - length);
|
||||
size -= length;
|
||||
if (index > offset)
|
||||
index = offset;
|
||||
}
|
||||
|
||||
void replace(int offset, int[] values) {
|
||||
System.arraycopy(values, 0, intArray, offset, values.length);
|
||||
}
|
||||
|
||||
void removeAll() {
|
||||
size = 0;
|
||||
index = 0;
|
||||
}
|
||||
|
||||
void rewind() {
|
||||
index = 0;
|
||||
}
|
||||
|
||||
int getNext() {
|
||||
if (index == size)
|
||||
return -1;
|
||||
return intArray[index++];
|
||||
}
|
||||
|
||||
void unget() {
|
||||
if (index != 0)
|
||||
index--;
|
||||
}
|
||||
|
||||
int getOffset() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer s = new StringBuffer();
|
||||
for (int i = 0; i < size;) {
|
||||
s.append(intArray[i++]);
|
||||
if (i < size)
|
||||
s.append(",");
|
||||
}
|
||||
return s.toString();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Native methods
|
||||
*/
|
||||
private native String resetXIC();
|
||||
private native void disposeXIC();
|
||||
private native boolean setCompositionEnabledNative(boolean enable);
|
||||
private native boolean isCompositionEnabledNative();
|
||||
private native void turnoffStatusWindow();
|
||||
}
|
||||
|
849
src/java.desktop/unix/classes/sun/awt/X11InputMethodBase.java
Normal file
849
src/java.desktop/unix/classes/sun/awt/X11InputMethodBase.java
Normal file
@ -0,0 +1,849 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.awt;
|
||||
|
||||
import java.awt.AWTEvent;
|
||||
import java.awt.AWTException;
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.InputMethodEvent;
|
||||
import java.awt.font.TextAttribute;
|
||||
import java.awt.font.TextHitInfo;
|
||||
import java.awt.im.InputMethodHighlight;
|
||||
import java.awt.im.spi.InputMethodContext;
|
||||
import java.awt.peer.ComponentPeer;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.lang.Character.Subset;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.text.AttributedCharacterIterator;
|
||||
import java.text.AttributedString;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import sun.awt.im.InputMethodAdapter;
|
||||
import sun.util.logging.PlatformLogger;
|
||||
|
||||
/**
|
||||
* Input Method Adapter for XIM
|
||||
*
|
||||
* @author JavaSoft International
|
||||
*/
|
||||
public abstract class X11InputMethodBase extends InputMethodAdapter {
|
||||
protected static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11InputMethod");
|
||||
/*
|
||||
* The following XIM* values must be the same as those defined in
|
||||
* Xlib.h
|
||||
*/
|
||||
private static final int XIMReverse = (1<<0);
|
||||
private static final int XIMUnderline = (1<<1);
|
||||
private static final int XIMHighlight = (1<<2);
|
||||
private static final int XIMPrimary = (1<<5);
|
||||
private static final int XIMSecondary = (1<<6);
|
||||
private static final int XIMTertiary = (1<<7);
|
||||
|
||||
/*
|
||||
* visible position values
|
||||
*/
|
||||
protected static final int XIMVisibleToForward = (1<<8);
|
||||
protected static final int XIMVisibleToBackward = (1<<9);
|
||||
protected static final int XIMVisibleCenter = (1<<10);
|
||||
protected static final int XIMVisibleMask =
|
||||
(XIMVisibleToForward | XIMVisibleToBackward | XIMVisibleCenter);
|
||||
|
||||
private Locale locale;
|
||||
private static boolean isXIMOpened = false;
|
||||
protected Container clientComponentWindow = null;
|
||||
protected Component awtFocussedComponent = null;
|
||||
protected Component lastXICFocussedComponent = null;
|
||||
protected boolean isLastXICActive = false;
|
||||
protected boolean isLastTemporary = false;
|
||||
protected boolean isActive = false;
|
||||
private static Map<TextAttribute, ?>[] highlightStyles;
|
||||
protected boolean disposed = false;
|
||||
|
||||
//reset the XIC if necessary
|
||||
protected boolean needResetXIC = false;
|
||||
private WeakReference<Component> needResetXICClient = new WeakReference<>(null);
|
||||
|
||||
// The use of compositionEnableSupported is to reduce unnecessary
|
||||
// native calls if set/isCompositionEnabled
|
||||
// throws UnsupportedOperationException.
|
||||
// It is set to false if that exception is thrown first time
|
||||
// either of the two methods are called.
|
||||
protected boolean compositionEnableSupported = true;
|
||||
// The savedCompositionState indicates the composition mode when
|
||||
// endComposition or setCompositionEnabled is called. It doesn't always
|
||||
// reflect the actual composition state because it doesn't get updated
|
||||
// when the user changes the composition state through direct interaction
|
||||
// with the input method. It is used to save the composition mode when
|
||||
// focus is traversed across different client components sharing the
|
||||
// same java input context. Also if set/isCompositionEnabled are not
|
||||
// supported, it remains false.
|
||||
protected boolean savedCompositionState = false;
|
||||
|
||||
// variables to keep track of preedit context.
|
||||
// these variables need to be accessed within AWT_LOCK/UNLOCK
|
||||
protected String committedText = null;
|
||||
protected StringBuffer composedText = null;
|
||||
protected IntBuffer rawFeedbacks;
|
||||
|
||||
// private data (X11InputMethodData structure defined in
|
||||
// awt_InputMethod.c) for native methods
|
||||
// this structure needs to be accessed within AWT_LOCK/UNLOCK
|
||||
protected transient long pData = 0; // accessed by native
|
||||
|
||||
// Initialize highlight mapping table
|
||||
static {
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
Map<TextAttribute, ?> styles[] = new Map[4];
|
||||
HashMap<TextAttribute, Object> map;
|
||||
|
||||
// UNSELECTED_RAW_TEXT_HIGHLIGHT
|
||||
map = new HashMap<>(1);
|
||||
map.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
|
||||
styles[0] = Collections.unmodifiableMap(map);
|
||||
|
||||
// SELECTED_RAW_TEXT_HIGHLIGHT
|
||||
map = new HashMap<>(1);
|
||||
map.put(TextAttribute.SWAP_COLORS, TextAttribute.SWAP_COLORS_ON);
|
||||
styles[1] = Collections.unmodifiableMap(map);
|
||||
|
||||
// UNSELECTED_CONVERTED_TEXT_HIGHLIGHT
|
||||
map = new HashMap<>(1);
|
||||
map.put(TextAttribute.INPUT_METHOD_UNDERLINE,
|
||||
TextAttribute.UNDERLINE_LOW_ONE_PIXEL);
|
||||
styles[2] = Collections.unmodifiableMap(map);
|
||||
|
||||
// SELECTED_CONVERTED_TEXT_HIGHLIGHT
|
||||
map = new HashMap<>(1);
|
||||
map.put(TextAttribute.SWAP_COLORS, TextAttribute.SWAP_COLORS_ON);
|
||||
styles[3] = Collections.unmodifiableMap(map);
|
||||
|
||||
highlightStyles = styles;
|
||||
}
|
||||
|
||||
static {
|
||||
initIDs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an X11InputMethod instance. It initializes the XIM
|
||||
* environment if it's not done yet.
|
||||
*
|
||||
* @exception AWTException if XOpenIM() failed.
|
||||
*/
|
||||
public X11InputMethodBase() throws AWTException {
|
||||
// supports only the locale in which the VM is started
|
||||
locale = X11InputMethodDescriptor.getSupportedLocale();
|
||||
if (initXIM() == false) {
|
||||
throw new AWTException("Cannot open X Input Method");
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() throws Throwable {
|
||||
dispose();
|
||||
super.finalize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes openIM() that invokes XOpenIM() if it's not opened yet.
|
||||
* @return true if openXIM() is successful or it's already been opened.
|
||||
*/
|
||||
private synchronized boolean initXIM() {
|
||||
if (isXIMOpened == false)
|
||||
isXIMOpened = openXIM();
|
||||
return isXIMOpened;
|
||||
}
|
||||
|
||||
protected abstract boolean openXIM();
|
||||
|
||||
protected boolean isDisposed() {
|
||||
return disposed;
|
||||
}
|
||||
|
||||
protected abstract void setXICFocus(ComponentPeer peer,
|
||||
boolean value, boolean active);
|
||||
|
||||
/**
|
||||
* Does nothing - this adapter doesn't use the input method context.
|
||||
*
|
||||
* @see java.awt.im.spi.InputMethod#setInputMethodContext
|
||||
*/
|
||||
public void setInputMethodContext(InputMethodContext context) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set locale to input. If input method doesn't support specified locale,
|
||||
* false will be returned and its behavior is not changed.
|
||||
*
|
||||
* @param lang locale to input
|
||||
* @return the true is returned when specified locale is supported.
|
||||
*/
|
||||
public boolean setLocale(Locale lang) {
|
||||
if (lang.equals(locale)) {
|
||||
return true;
|
||||
}
|
||||
// special compatibility rule for Japanese and Korean
|
||||
if (locale.equals(Locale.JAPAN) && lang.equals(Locale.JAPANESE) ||
|
||||
locale.equals(Locale.KOREA) && lang.equals(Locale.KOREAN)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns current input locale.
|
||||
*/
|
||||
public Locale getLocale() {
|
||||
return locale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does nothing - XIM doesn't let you specify which characters you expect.
|
||||
*
|
||||
* @see java.awt.im.spi.InputMethod#setCharacterSubsets
|
||||
*/
|
||||
public void setCharacterSubsets(Subset[] subsets) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch event to input method. InputContext dispatch event with this
|
||||
* method. Input method set consume flag if event is consumed in
|
||||
* input method.
|
||||
*
|
||||
* @param e event
|
||||
*/
|
||||
public void dispatchEvent(AWTEvent e) {
|
||||
}
|
||||
|
||||
protected final void resetXICifneeded(){
|
||||
/* needResetXIC is used to indicate whether to call
|
||||
resetXIC on the active client. resetXIC will always be
|
||||
called on the passive client when endComposition is called.
|
||||
*/
|
||||
if (needResetXIC && haveActiveClient() &&
|
||||
getClientComponent() != needResetXICClient.get()){
|
||||
resetXIC();
|
||||
|
||||
// needs to reset the last xic focussed component.
|
||||
lastXICFocussedComponent = null;
|
||||
isLastXICActive = false;
|
||||
|
||||
needResetXICClient.clear();
|
||||
needResetXIC = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the composition state to the current composition state.
|
||||
*/
|
||||
protected abstract void resetCompositionState();
|
||||
|
||||
/**
|
||||
* Query and then return the current composition state.
|
||||
* @return the composition state if isCompositionEnabled call
|
||||
* is successful. Otherwise, it returns false.
|
||||
*/
|
||||
protected boolean getCompositionState() {
|
||||
boolean compositionState = false;
|
||||
if (compositionEnableSupported) {
|
||||
try {
|
||||
compositionState = isCompositionEnabled();
|
||||
} catch (UnsupportedOperationException e) {
|
||||
compositionEnableSupported = false;
|
||||
}
|
||||
}
|
||||
return compositionState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate input method.
|
||||
*/
|
||||
public abstract void activate();
|
||||
|
||||
protected abstract boolean createXIC();
|
||||
|
||||
/**
|
||||
* Deactivate input method.
|
||||
*/
|
||||
public abstract void deactivate(boolean isTemporary);
|
||||
|
||||
/**
|
||||
* Explicitly disable the native IME. Native IME is not disabled when
|
||||
* deactivate is called.
|
||||
*/
|
||||
public void disableInputMethod() {
|
||||
if (lastXICFocussedComponent != null) {
|
||||
setXICFocus(getPeer(lastXICFocussedComponent), false, isLastXICActive);
|
||||
lastXICFocussedComponent = null;
|
||||
isLastXICActive = false;
|
||||
|
||||
resetXIC();
|
||||
needResetXICClient.clear();
|
||||
needResetXIC = false;
|
||||
}
|
||||
}
|
||||
|
||||
// implements java.awt.im.spi.InputMethod.hideWindows
|
||||
public abstract void hideWindows();
|
||||
|
||||
/**
|
||||
* @see java.awt.Toolkit#mapInputMethodHighlight
|
||||
*/
|
||||
public static Map<TextAttribute, ?> mapInputMethodHighlight(InputMethodHighlight highlight) {
|
||||
int index;
|
||||
int state = highlight.getState();
|
||||
if (state == InputMethodHighlight.RAW_TEXT) {
|
||||
index = 0;
|
||||
} else if (state == InputMethodHighlight.CONVERTED_TEXT) {
|
||||
index = 2;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
if (highlight.isSelected()) {
|
||||
index += 1;
|
||||
}
|
||||
return highlightStyles[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see sun.awt.im.InputMethodAdapter#setAWTFocussedComponent
|
||||
*/
|
||||
protected void setAWTFocussedComponent(Component component) {
|
||||
if (component == null) {
|
||||
return;
|
||||
}
|
||||
if (isActive) {
|
||||
// deactivate/activate are being suppressed during a focus change -
|
||||
// this may happen when an input method window is made visible
|
||||
boolean ac = haveActiveClient();
|
||||
setXICFocus(getPeer(awtFocussedComponent), false, ac);
|
||||
setXICFocus(getPeer(component), true, ac);
|
||||
}
|
||||
awtFocussedComponent = component;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see sun.awt.im.InputMethodAdapter#stopListening
|
||||
*/
|
||||
protected void stopListening() {
|
||||
// It is desirable to disable XIM by calling XSetICValues with
|
||||
// XNPreeditState == XIMPreeditDisable. But Solaris 2.6 and
|
||||
// Solaris 7 do not implement this correctly without a patch,
|
||||
// so just call resetXIC here. Prior endComposition call commits
|
||||
// the existing composed text.
|
||||
endComposition();
|
||||
// disable the native input method so that the other input
|
||||
// method could get the input focus.
|
||||
disableInputMethod();
|
||||
if (needResetXIC) {
|
||||
resetXIC();
|
||||
needResetXICClient.clear();
|
||||
needResetXIC = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Window instance in which the client component is
|
||||
* contained. If not found, null is returned. (IS THIS POSSIBLE?)
|
||||
*/
|
||||
// NOTE: This method may be called by privileged threads.
|
||||
// DO NOT INVOKE CLIENT CODE ON THIS THREAD!
|
||||
protected Window getClientComponentWindow() {
|
||||
Component client = getClientComponent();
|
||||
Container container;
|
||||
|
||||
if (client instanceof Container) {
|
||||
container = (Container) client;
|
||||
} else {
|
||||
container = getParent(client);
|
||||
}
|
||||
|
||||
while (container != null && !(container instanceof java.awt.Window)) {
|
||||
container = getParent(container);
|
||||
}
|
||||
return (Window) container;
|
||||
}
|
||||
|
||||
protected abstract Container getParent(Component client);
|
||||
|
||||
/**
|
||||
* Returns peer of the given client component. If the given client component
|
||||
* doesn't have peer, peer of the native container of the client is returned.
|
||||
*/
|
||||
protected abstract ComponentPeer getPeer(Component client);
|
||||
|
||||
/**
|
||||
* Used to protect preedit data
|
||||
*/
|
||||
protected abstract void awtLock();
|
||||
protected abstract void awtUnlock();
|
||||
|
||||
/**
|
||||
* Creates an input method event from the arguments given
|
||||
* and posts it on the AWT event queue. For arguments,
|
||||
* see InputMethodEvent. Called by input method.
|
||||
*
|
||||
* @see java.awt.event.InputMethodEvent#InputMethodEvent
|
||||
*/
|
||||
protected void postInputMethodEvent(int id,
|
||||
AttributedCharacterIterator text,
|
||||
int committedCharacterCount,
|
||||
TextHitInfo caret,
|
||||
TextHitInfo visiblePosition,
|
||||
long when) {
|
||||
Component source = getClientComponent();
|
||||
if (source != null) {
|
||||
InputMethodEvent event = new InputMethodEvent(source,
|
||||
id, when, text, committedCharacterCount, caret, visiblePosition);
|
||||
SunToolkit.postEvent(SunToolkit.targetToAppContext(source), (AWTEvent)event);
|
||||
}
|
||||
}
|
||||
|
||||
private void postInputMethodEvent(int id,
|
||||
AttributedCharacterIterator text,
|
||||
int committedCharacterCount,
|
||||
TextHitInfo caret,
|
||||
TextHitInfo visiblePosition) {
|
||||
postInputMethodEvent(id, text, committedCharacterCount,
|
||||
caret, visiblePosition, EventQueue.getMostRecentEventTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatches committed text from XIM to the awt event queue. This
|
||||
* method is invoked from the event handler in canvas.c in the
|
||||
* AWT Toolkit thread context and thus inside the AWT Lock.
|
||||
* @param str committed text
|
||||
* @param when when
|
||||
*/
|
||||
// NOTE: This method may be called by privileged threads.
|
||||
// This functionality is implemented in a package-private method
|
||||
// to insure that it cannot be overridden by client subclasses.
|
||||
// DO NOT INVOKE CLIENT CODE ON THIS THREAD!
|
||||
void dispatchCommittedText(String str, long when) {
|
||||
if (str == null)
|
||||
return;
|
||||
|
||||
if (composedText == null) {
|
||||
AttributedString attrstr = new AttributedString(str);
|
||||
postInputMethodEvent(InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
|
||||
attrstr.getIterator(),
|
||||
str.length(),
|
||||
null,
|
||||
null,
|
||||
when);
|
||||
} else {
|
||||
// if there is composed text, wait until the preedit
|
||||
// callback is invoked.
|
||||
committedText = str;
|
||||
}
|
||||
}
|
||||
|
||||
private void dispatchCommittedText(String str) {
|
||||
dispatchCommittedText(str, EventQueue.getMostRecentEventTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates composed text with XIM preedit information and
|
||||
* posts composed text to the awt event queue. The args of
|
||||
* this method correspond to the XIM preedit callback
|
||||
* information. The XIM highlight attributes are translated via
|
||||
* fixed mapping (i.e., independent from any underlying input
|
||||
* method engine). This method is invoked in the AWT Toolkit
|
||||
* (X event loop) thread context and thus inside the AWT Lock.
|
||||
*/
|
||||
// NOTE: This method may be called by privileged threads.
|
||||
// This functionality is implemented in a package-private method
|
||||
// to insure that it cannot be overridden by client subclasses.
|
||||
// DO NOT INVOKE CLIENT CODE ON THIS THREAD!
|
||||
abstract void dispatchComposedText(String chgText,
|
||||
int chgStyles[],
|
||||
int chgOffset,
|
||||
int chgLength,
|
||||
int caretPosition,
|
||||
long when);
|
||||
|
||||
/**
|
||||
* Flushes composed and committed text held in this context.
|
||||
* This method is invoked in the AWT Toolkit (X event loop) thread context
|
||||
* and thus inside the AWT Lock.
|
||||
*/
|
||||
// NOTE: This method may be called by privileged threads.
|
||||
// This functionality is implemented in a package-private method
|
||||
// to insure that it cannot be overridden by client subclasses.
|
||||
// DO NOT INVOKE CLIENT CODE ON THIS THREAD!
|
||||
void flushText() {
|
||||
String flush = (committedText != null ? committedText : "");
|
||||
if (composedText != null) {
|
||||
flush += composedText.toString();
|
||||
}
|
||||
|
||||
if (!flush.equals("")) {
|
||||
AttributedString attrstr = new AttributedString(flush);
|
||||
postInputMethodEvent(InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
|
||||
attrstr.getIterator(),
|
||||
flush.length(),
|
||||
null,
|
||||
null,
|
||||
EventQueue.getMostRecentEventTime());
|
||||
composedText = null;
|
||||
committedText = null;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Subclasses should override disposeImpl() instead of dispose(). Client
|
||||
* code should always invoke dispose(), never disposeImpl().
|
||||
*/
|
||||
protected abstract void disposeImpl();
|
||||
|
||||
/**
|
||||
* Frees all X Window resources associated with this object.
|
||||
*
|
||||
* @see java.awt.im.spi.InputMethod#dispose
|
||||
*/
|
||||
public final void dispose() {
|
||||
boolean call_disposeImpl = false;
|
||||
|
||||
if (!disposed) {
|
||||
synchronized (this) {
|
||||
if (!disposed) {
|
||||
disposed = call_disposeImpl = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (call_disposeImpl) {
|
||||
disposeImpl();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns null.
|
||||
*
|
||||
* @see java.awt.im.spi.InputMethod#getControlObject
|
||||
*/
|
||||
public Object getControlObject() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.awt.im.spi.InputMethod#removeNotify
|
||||
*/
|
||||
public synchronized void removeNotify() {
|
||||
dispose();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.awt.im.spi.InputMethod#setCompositionEnabled(boolean)
|
||||
*/
|
||||
public abstract void setCompositionEnabled(boolean enable);
|
||||
|
||||
/**
|
||||
* @see java.awt.im.spi.InputMethod#isCompositionEnabled
|
||||
*/
|
||||
public boolean isCompositionEnabled() {
|
||||
/* isCompositionEnabledNative may throw UnsupportedOperationException.
|
||||
Don't try to catch it since this method may be called by clients.
|
||||
Use package private method 'getCompositionState' if you want the
|
||||
exception to be caught.
|
||||
*/
|
||||
return isCompositionEnabledNative();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ends any input composition that may currently be going on in this
|
||||
* context. Depending on the platform and possibly user preferences,
|
||||
* this may commit or delete uncommitted text. Any changes to the text
|
||||
* are communicated to the active component using an input method event.
|
||||
*
|
||||
* <p>
|
||||
* A text editing component may call this in a variety of situations,
|
||||
* for example, when the user moves the insertion point within the text
|
||||
* (but outside the composed text), or when the component's text is
|
||||
* saved to a file or copied to the clipboard.
|
||||
*
|
||||
*/
|
||||
public void endComposition() {
|
||||
if (disposed) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Before calling resetXIC, record the current composition mode
|
||||
so that it can be restored later. */
|
||||
savedCompositionState = getCompositionState();
|
||||
boolean active = haveActiveClient();
|
||||
if (active && composedText == null && committedText == null){
|
||||
needResetXIC = true;
|
||||
needResetXICClient = new WeakReference<>(getClientComponent());
|
||||
return;
|
||||
}
|
||||
|
||||
String text = resetXIC();
|
||||
/* needResetXIC is only set to true for active client. So passive
|
||||
client should not reset the flag to false. */
|
||||
if (active) {
|
||||
needResetXIC = false;
|
||||
}
|
||||
|
||||
// Remove any existing composed text by posting an InputMethodEvent
|
||||
// with null composed text. It would be desirable to wait for a
|
||||
// dispatchComposedText call from X input method engine, but some
|
||||
// input method does not conform to the XIM specification and does
|
||||
// not call the preedit callback to erase preedit text on calling
|
||||
// XmbResetIC. To work around this problem, do it here by ourselves.
|
||||
awtLock();
|
||||
try {
|
||||
composedText = null;
|
||||
postInputMethodEvent(InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
|
||||
null,
|
||||
0,
|
||||
null,
|
||||
null);
|
||||
|
||||
if (text != null && text.length() > 0) {
|
||||
dispatchCommittedText(text);
|
||||
}
|
||||
} finally {
|
||||
// Put awtUnlock into finally block in case an exception is thrown.
|
||||
awtUnlock();
|
||||
}
|
||||
|
||||
// Restore the preedit state if it was enabled
|
||||
if (savedCompositionState) {
|
||||
resetCompositionState();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string with information about the current input method server, or null.
|
||||
* On both Linux & SunOS, the value of environment variable XMODIFIERS is
|
||||
* returned if set. Otherwise, on SunOS, $HOME/.dtprofile will be parsed
|
||||
* to find out the language service engine (atok or wnn) since there is
|
||||
* no API in Xlib which returns the information of native
|
||||
* IM server or language service and we want to try our best to return as much
|
||||
* information as possible.
|
||||
*
|
||||
* Note: This method could return null on Linux if XMODIFIERS is not set properly or
|
||||
* if any IOException is thrown.
|
||||
* See man page of XSetLocaleModifiers(3X11) for the usgae of XMODIFIERS,
|
||||
* atok12setup(1) and wnn6setup(1) for the information written to
|
||||
* $HOME/.dtprofile when you run these two commands.
|
||||
*
|
||||
*/
|
||||
public String getNativeInputMethodInfo() {
|
||||
String xmodifiers = System.getenv("XMODIFIERS");
|
||||
String imInfo = null;
|
||||
|
||||
// If XMODIFIERS is set, return the value
|
||||
if (xmodifiers != null) {
|
||||
int imIndex = xmodifiers.indexOf("@im=");
|
||||
if (imIndex != -1) {
|
||||
imInfo = xmodifiers.substring(imIndex + 4);
|
||||
}
|
||||
} else if (System.getProperty("os.name").startsWith("SunOS")) {
|
||||
File dtprofile = new File(System.getProperty("user.home") +
|
||||
"/.dtprofile");
|
||||
String languageEngineInfo = null;
|
||||
try {
|
||||
BufferedReader br = new BufferedReader(new FileReader(dtprofile));
|
||||
String line = null;
|
||||
|
||||
while ( languageEngineInfo == null && (line = br.readLine()) != null) {
|
||||
if (line.contains("atok") || line.contains("wnn")) {
|
||||
StringTokenizer tokens = new StringTokenizer(line);
|
||||
while (tokens.hasMoreTokens()) {
|
||||
String token = tokens.nextToken();
|
||||
if (Pattern.matches("atok.*setup", token) ||
|
||||
Pattern.matches("wnn.*setup", token)){
|
||||
languageEngineInfo = token.substring(0, token.indexOf("setup"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
br.close();
|
||||
} catch(IOException ioex) {
|
||||
// Since this method is provided for internal testing only,
|
||||
// we dump the stack trace for the ease of debugging.
|
||||
ioex.printStackTrace();
|
||||
}
|
||||
|
||||
imInfo = "htt " + languageEngineInfo;
|
||||
}
|
||||
|
||||
return imInfo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Performs mapping from an XIM visible feedback value to Java IM highlight.
|
||||
* @return Java input method highlight
|
||||
*/
|
||||
protected InputMethodHighlight convertVisualFeedbackToHighlight(int feedback) {
|
||||
InputMethodHighlight highlight;
|
||||
|
||||
switch (feedback) {
|
||||
case XIMUnderline:
|
||||
highlight = InputMethodHighlight.UNSELECTED_CONVERTED_TEXT_HIGHLIGHT;
|
||||
break;
|
||||
case XIMReverse:
|
||||
highlight = InputMethodHighlight.SELECTED_CONVERTED_TEXT_HIGHLIGHT;
|
||||
break;
|
||||
case XIMHighlight:
|
||||
highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
|
||||
break;
|
||||
case 0: //None of the values are set by Wnn
|
||||
case XIMPrimary:
|
||||
highlight = InputMethodHighlight.UNSELECTED_CONVERTED_TEXT_HIGHLIGHT;
|
||||
break;
|
||||
case XIMSecondary:
|
||||
highlight = InputMethodHighlight.SELECTED_CONVERTED_TEXT_HIGHLIGHT;
|
||||
break;
|
||||
case XIMTertiary:
|
||||
highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
|
||||
break;
|
||||
default:
|
||||
highlight = InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT;
|
||||
break;
|
||||
}
|
||||
return highlight;
|
||||
}
|
||||
|
||||
// initial capacity size for string buffer, etc.
|
||||
protected static final int INITIAL_SIZE = 64;
|
||||
|
||||
/**
|
||||
* IntBuffer is an inner class that manipulates an int array and
|
||||
* provides UNIX file io stream-like programming interfaces to
|
||||
* access it. (An alternative would be to use ArrayList which may
|
||||
* be too expensive for the work.)
|
||||
*/
|
||||
protected final class IntBuffer {
|
||||
private int[] intArray;
|
||||
private int size;
|
||||
private int index;
|
||||
|
||||
IntBuffer(int initialCapacity) {
|
||||
intArray = new int[initialCapacity];
|
||||
size = 0;
|
||||
index = 0;
|
||||
}
|
||||
|
||||
void insert(int offset, int[] values) {
|
||||
int newSize = size + values.length;
|
||||
if (intArray.length < newSize) {
|
||||
int[] newIntArray = new int[newSize * 2];
|
||||
System.arraycopy(intArray, 0, newIntArray, 0, size);
|
||||
intArray = newIntArray;
|
||||
}
|
||||
System.arraycopy(intArray, offset, intArray, offset+values.length,
|
||||
size - offset);
|
||||
System.arraycopy(values, 0, intArray, offset, values.length);
|
||||
size += values.length;
|
||||
if (index > offset)
|
||||
index = offset;
|
||||
}
|
||||
|
||||
void remove(int offset, int length) {
|
||||
if (offset + length != size)
|
||||
System.arraycopy(intArray, offset+length, intArray, offset,
|
||||
size - offset - length);
|
||||
size -= length;
|
||||
if (index > offset)
|
||||
index = offset;
|
||||
}
|
||||
|
||||
void replace(int offset, int[] values) {
|
||||
System.arraycopy(values, 0, intArray, offset, values.length);
|
||||
}
|
||||
|
||||
void removeAll() {
|
||||
size = 0;
|
||||
index = 0;
|
||||
}
|
||||
|
||||
void rewind() {
|
||||
index = 0;
|
||||
}
|
||||
|
||||
int getNext() {
|
||||
if (index == size)
|
||||
return -1;
|
||||
return intArray[index++];
|
||||
}
|
||||
|
||||
void unget() {
|
||||
if (index != 0)
|
||||
index--;
|
||||
}
|
||||
|
||||
int getOffset() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer s = new StringBuffer();
|
||||
for (int i = 0; i < size;) {
|
||||
s.append(intArray[i++]);
|
||||
if (i < size)
|
||||
s.append(",");
|
||||
}
|
||||
return s.toString();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Native methods
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initialize JNI field and method IDs for fields that may be
|
||||
* accessed from C.
|
||||
*/
|
||||
private static native void initIDs();
|
||||
|
||||
protected native void turnoffStatusWindow();
|
||||
|
||||
protected native void disposeXIC();
|
||||
|
||||
private native String resetXIC();
|
||||
|
||||
protected native boolean setCompositionEnabledNative(boolean enable);
|
||||
|
||||
private native boolean isCompositionEnabledNative();
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,18 +27,18 @@
|
||||
#error This file should not be included in headless library
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "awt.h"
|
||||
#include "awt_p.h"
|
||||
|
||||
#include <sun_awt_X11InputMethod.h>
|
||||
#include <sun_awt_X11InputMethodBase.h>
|
||||
#include <sun_awt_X11_XInputMethod.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/time.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#define THROW_OUT_OF_MEMORY_ERROR() \
|
||||
JNU_ThrowOutOfMemoryError((JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2), NULL)
|
||||
|
||||
@ -536,10 +536,10 @@ awt_x11inputmethod_lookupString(XKeyPressedEvent *event, KeySym *keysymp)
|
||||
composing = False;
|
||||
/*FALLTHRU*/
|
||||
case XLookupChars:
|
||||
/*
|
||||
printf("lookupString: status=XLookupChars, type=%d, state=%x, keycode=%x, keysym=%x\n",
|
||||
event->type, event->state, event->keycode, keysym);
|
||||
*/
|
||||
/*
|
||||
printf("lookupString: status=XLookupChars, type=%d, state=%x, keycode=%x, keysym=%x\n",
|
||||
event->type, event->state, event->keycode, keysym);
|
||||
*/
|
||||
javastr = JNU_NewStringPlatform(env, (const char *)pX11IMData->lookup_buf);
|
||||
if (javastr != NULL) {
|
||||
JNU_CallMethodByName(env, NULL,
|
||||
@ -552,10 +552,10 @@ awt_x11inputmethod_lookupString(XKeyPressedEvent *event, KeySym *keysymp)
|
||||
break;
|
||||
|
||||
case XLookupKeySym:
|
||||
/*
|
||||
printf("lookupString: status=XLookupKeySym, type=%d, state=%x, keycode=%x, keysym=%x\n",
|
||||
event->type, event->state, event->keycode, keysym);
|
||||
*/
|
||||
/*
|
||||
printf("lookupString: status=XLookupKeySym, type=%d, state=%x, keycode=%x, keysym=%x\n",
|
||||
event->type, event->state, event->keycode, keysym);
|
||||
*/
|
||||
if (keysym == XK_Multi_key)
|
||||
composing = True;
|
||||
if (! composing) {
|
||||
@ -565,10 +565,10 @@ awt_x11inputmethod_lookupString(XKeyPressedEvent *event, KeySym *keysymp)
|
||||
break;
|
||||
|
||||
case XLookupNone:
|
||||
/*
|
||||
printf("lookupString: status=XLookupNone, type=%d, state=%x, keycode=%x, keysym=%x\n",
|
||||
event->type, event->state, event->keycode, keysym);
|
||||
*/
|
||||
/*
|
||||
printf("lookupString: status=XLookupNone, type=%d, state=%x, keycode=%x, keysym=%x\n",
|
||||
event->type, event->state, event->keycode, keysym);
|
||||
*/
|
||||
break;
|
||||
}
|
||||
|
||||
@ -576,8 +576,7 @@ awt_x11inputmethod_lookupString(XKeyPressedEvent *event, KeySym *keysymp)
|
||||
}
|
||||
|
||||
#if defined(__linux__) || defined(MACOSX)
|
||||
static StatusWindow *createStatusWindow(
|
||||
Window parent) {
|
||||
static StatusWindow *createStatusWindow(Window parent) {
|
||||
StatusWindow *statusWindow;
|
||||
XSetWindowAttributes attrib;
|
||||
unsigned long attribmask;
|
||||
@ -600,7 +599,7 @@ static StatusWindow *createStatusWindow(
|
||||
AwtGraphicsConfigDataPtr adata;
|
||||
extern int awt_numScreens;
|
||||
/*hardcode the size right now, should get the size base on font*/
|
||||
int width=80, height=22;
|
||||
int width=80, height=22;
|
||||
Window rootWindow;
|
||||
Window *ignoreWindowPtr;
|
||||
unsigned int ignoreUnit;
|
||||
@ -652,10 +651,10 @@ static StatusWindow *createStatusWindow(
|
||||
if (xx < 0 ){
|
||||
xx = 0;
|
||||
}
|
||||
if (xx + width > xxwa.width){
|
||||
if (xx + width > xxwa.width) {
|
||||
xx = xxwa.width - width;
|
||||
}
|
||||
if (yy + height > xxwa.height){
|
||||
if (yy + height > xxwa.height) {
|
||||
yy = xxwa.height - height;
|
||||
}
|
||||
|
||||
@ -724,7 +723,7 @@ static void onoffStatusWindow(X11InputMethodData* pX11IMData,
|
||||
return;
|
||||
}
|
||||
|
||||
if (ON == False){
|
||||
if (ON == False) {
|
||||
XUnmapWindow(dpy, statusWindow->w);
|
||||
statusWindow->on = False;
|
||||
return;
|
||||
@ -732,7 +731,7 @@ static void onoffStatusWindow(X11InputMethodData* pX11IMData,
|
||||
parent = JNU_CallMethodByName(GetJNIEnv(), NULL, pX11IMData->x11inputmethod,
|
||||
"getCurrentParentWindow",
|
||||
"()J").j;
|
||||
if (statusWindow->parent != parent){
|
||||
if (statusWindow->parent != parent) {
|
||||
statusWindow->parent = parent;
|
||||
}
|
||||
XGetWindowAttributes(dpy, parent, &xwa);
|
||||
@ -741,21 +740,22 @@ static void onoffStatusWindow(X11InputMethodData* pX11IMData,
|
||||
xwa.x, xwa.y,
|
||||
&x, &y,
|
||||
&child);
|
||||
if (statusWindow->x != x
|
||||
|| statusWindow->y != y
|
||||
|| statusWindow->height != xwa.height){
|
||||
if (statusWindow->x != x ||
|
||||
statusWindow->y != y ||
|
||||
statusWindow->height != xwa.height)
|
||||
{
|
||||
statusWindow->x = x;
|
||||
statusWindow->y = y;
|
||||
statusWindow->height = xwa.height;
|
||||
x = statusWindow->x - statusWindow->off_x;
|
||||
y = statusWindow->y + statusWindow->height - statusWindow->off_y;
|
||||
if (x < 0 ){
|
||||
if (x < 0 ) {
|
||||
x = 0;
|
||||
}
|
||||
if (x + statusWindow->statusW > statusWindow->rootW){
|
||||
if (x + statusWindow->statusW > statusWindow->rootW) {
|
||||
x = statusWindow->rootW - statusWindow->statusW;
|
||||
}
|
||||
if (y + statusWindow->statusH > statusWindow->rootH){
|
||||
if (y + statusWindow->statusH > statusWindow->rootH) {
|
||||
y = statusWindow->rootH - statusWindow->statusH;
|
||||
}
|
||||
XMoveWindow(dpy, statusWindow->w, x, y);
|
||||
@ -790,61 +790,19 @@ void paintStatusWindow(StatusWindow *statusWindow){
|
||||
XDrawLine(dpy, win, dimgc, 2, height-3, width-bwidth-1, height-3);
|
||||
XDrawLine(dpy, win, dimgc, 2, 2, width-bwidth-2, 2);
|
||||
XDrawLine(dpy, win, dimgc, width-bwidth, 2, width-bwidth, height-3);
|
||||
if (statusWindow->fontset){
|
||||
if (statusWindow->fontset) {
|
||||
XmbDrawString(dpy, win, statusWindow->fontset, fggc,
|
||||
bwidth + 2, height - bwidth - 4,
|
||||
statusWindow->status,
|
||||
strlen(statusWindow->status));
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
/*too bad we failed to create a fontset for this locale*/
|
||||
XDrawString(dpy, win, fggc, bwidth + 2, height - bwidth - 4,
|
||||
"[InputMethod ON]", strlen("[InputMethod ON]"));
|
||||
}
|
||||
}
|
||||
|
||||
void statusWindowEventHandler(XEvent event){
|
||||
JNIEnv *env = GetJNIEnv();
|
||||
X11InputMethodData *pX11IMData = NULL;
|
||||
StatusWindow *statusWindow;
|
||||
|
||||
if (!isX11InputMethodGRefInList(currentX11InputMethodInstance)) {
|
||||
currentX11InputMethodInstance = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (NULL == currentX11InputMethodInstance
|
||||
|| NULL == (pX11IMData = getX11InputMethodData(env, currentX11InputMethodInstance))
|
||||
|| NULL == (statusWindow = pX11IMData->statusWindow)
|
||||
|| statusWindow->w != event.xany.window){
|
||||
return;
|
||||
}
|
||||
|
||||
switch (event.type){
|
||||
case Expose:
|
||||
paintStatusWindow(statusWindow);
|
||||
break;
|
||||
case MapNotify:
|
||||
case ConfigureNotify:
|
||||
{
|
||||
/*need to reset the stackMode...*/
|
||||
XWindowChanges xwc;
|
||||
int value_make = CWStackMode;
|
||||
xwc.stack_mode = TopIf;
|
||||
XConfigureWindow(dpy, statusWindow->w, value_make, &xwc);
|
||||
}
|
||||
break;
|
||||
/*
|
||||
case UnmapNotify:
|
||||
case VisibilityNotify:
|
||||
break;
|
||||
*/
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void adjustStatusWindow(Window shell){
|
||||
static void adjustStatusWindow(Window shell) {
|
||||
JNIEnv *env = GetJNIEnv();
|
||||
X11InputMethodData *pX11IMData = NULL;
|
||||
StatusWindow *statusWindow;
|
||||
@ -853,9 +811,11 @@ static void adjustStatusWindow(Window shell){
|
||||
|| !isX11InputMethodGRefInList(currentX11InputMethodInstance)
|
||||
|| NULL == (pX11IMData = getX11InputMethodData(env,currentX11InputMethodInstance))
|
||||
|| NULL == (statusWindow = pX11IMData->statusWindow)
|
||||
|| !statusWindow->on) {
|
||||
|| !statusWindow->on)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
XWindowAttributes xwa;
|
||||
int x, y;
|
||||
@ -875,7 +835,7 @@ static void adjustStatusWindow(Window shell){
|
||||
|
||||
x = statusWindow->x - statusWindow->off_x;
|
||||
y = statusWindow->y + statusWindow->height - statusWindow->off_y;
|
||||
if (x < 0 ){
|
||||
if (x < 0 ) {
|
||||
x = 0;
|
||||
}
|
||||
if (x + statusWindow->statusW > statusWindow->rootW){
|
||||
@ -889,6 +849,7 @@ static void adjustStatusWindow(Window shell){
|
||||
}
|
||||
}
|
||||
#endif /* __linux__ || MACOSX */
|
||||
|
||||
/*
|
||||
* Creates two XICs, one for active clients and the other for passive
|
||||
* clients. All information on those XICs are stored in the
|
||||
@ -931,9 +892,9 @@ createXIC(JNIEnv * env, X11InputMethodData *pX11IMData, Window w)
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
#if defined(__linux__) || defined(MACOSX)
|
||||
on_the_spot_styles |= XIMStatusNothing;
|
||||
|
||||
#if defined(__linux__) || defined(MACOSX)
|
||||
/*kinput does not support XIMPreeditCallbacks and XIMStatusArea
|
||||
at the same time, so use StatusCallback to draw the status
|
||||
ourself
|
||||
@ -944,8 +905,6 @@ createXIC(JNIEnv * env, X11InputMethodData *pX11IMData, Window w)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else /*! __linux__ && !MACOSX */
|
||||
on_the_spot_styles |= XIMStatusNothing;
|
||||
#endif /* __linux__ || MACOSX */
|
||||
|
||||
for (i = 0; i < im_styles->count_styles; i++) {
|
||||
@ -1023,12 +982,12 @@ createXIC(JNIEnv * env, X11InputMethodData *pX11IMData, Window w)
|
||||
XFree((void *)preedit);
|
||||
}
|
||||
#else /* !__linux__ && !MACOSX */
|
||||
pX11IMData->ic_active = XCreateIC(X11im,
|
||||
XNClientWindow, w,
|
||||
XNFocusWindow, w,
|
||||
XNInputStyle, active_styles,
|
||||
XNPreeditAttributes, preedit,
|
||||
NULL);
|
||||
pX11IMData->ic_active = XCreateIC(X11im,
|
||||
XNClientWindow, w,
|
||||
XNFocusWindow, w,
|
||||
XNInputStyle, active_styles,
|
||||
XNPreeditAttributes, preedit,
|
||||
NULL);
|
||||
XFree((void *)preedit);
|
||||
#endif /* __linux__ || MACOSX */
|
||||
} else {
|
||||
@ -1075,14 +1034,14 @@ static void
|
||||
PreeditStartCallback(XIC ic, XPointer client_data, XPointer call_data)
|
||||
{
|
||||
/*ARGSUSED*/
|
||||
/* printf("Native: PreeditCaretCallback\n"); */
|
||||
/* printf("Native: PreeditStartCallback\n"); */
|
||||
}
|
||||
|
||||
static void
|
||||
PreeditDoneCallback(XIC ic, XPointer client_data, XPointer call_data)
|
||||
{
|
||||
/*ARGSUSED*/
|
||||
/* printf("Native: StatusStartCallback\n"); */
|
||||
/* printf("Native: PreeditDoneCallback\n"); */
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1187,7 +1146,6 @@ PreeditCaretCallback(XIC ic, XPointer client_data,
|
||||
{
|
||||
/*ARGSUSED*/
|
||||
/* printf("Native: PreeditCaretCallback\n"); */
|
||||
|
||||
}
|
||||
|
||||
#if defined(__linux__) || defined(MACOSX)
|
||||
@ -1196,7 +1154,6 @@ StatusStartCallback(XIC ic, XPointer client_data, XPointer call_data)
|
||||
{
|
||||
/*ARGSUSED*/
|
||||
/*printf("StatusStartCallback:\n"); */
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1204,7 +1161,6 @@ StatusDoneCallback(XIC ic, XPointer client_data, XPointer call_data)
|
||||
{
|
||||
/*ARGSUSED*/
|
||||
/*printf("StatusDoneCallback:\n"); */
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1230,25 +1186,23 @@ StatusDrawCallback(XIC ic, XPointer client_data,
|
||||
|| NULL == (statusWindow = pX11IMData->statusWindow)){
|
||||
goto finally;
|
||||
}
|
||||
currentX11InputMethodInstance = (jobject)client_data;
|
||||
currentX11InputMethodInstance = (jobject)client_data;
|
||||
|
||||
if (status_draw->type == XIMTextType){
|
||||
if (status_draw->type == XIMTextType) {
|
||||
XIMText *text = (status_draw->data).text;
|
||||
if (text != NULL){
|
||||
if (text->string.multi_byte != NULL) {
|
||||
strncpy(statusWindow->status, text->string.multi_byte, MAX_STATUS_LEN);
|
||||
statusWindow->status[MAX_STATUS_LEN - 1] = '\0';
|
||||
}
|
||||
else {
|
||||
char *mbstr = wcstombsdmp(text->string.wide_char, text->length);
|
||||
strncpy(statusWindow->status, mbstr, MAX_STATUS_LEN);
|
||||
statusWindow->status[MAX_STATUS_LEN - 1] = '\0';
|
||||
}
|
||||
statusWindow->on = True;
|
||||
onoffStatusWindow(pX11IMData, statusWindow->parent, True);
|
||||
paintStatusWindow(statusWindow);
|
||||
}
|
||||
else {
|
||||
if (text != NULL) {
|
||||
if (text->string.multi_byte != NULL) {
|
||||
strncpy(statusWindow->status, text->string.multi_byte, MAX_STATUS_LEN);
|
||||
statusWindow->status[MAX_STATUS_LEN - 1] = '\0';
|
||||
} else {
|
||||
char *mbstr = wcstombsdmp(text->string.wide_char, text->length);
|
||||
strncpy(statusWindow->status, mbstr, MAX_STATUS_LEN);
|
||||
statusWindow->status[MAX_STATUS_LEN - 1] = '\0';
|
||||
}
|
||||
statusWindow->on = True;
|
||||
onoffStatusWindow(pX11IMData, statusWindow->parent, True);
|
||||
paintStatusWindow(statusWindow);
|
||||
} else {
|
||||
statusWindow->on = False;
|
||||
/*just turnoff the status window
|
||||
paintStatusWindow(statusWindow);
|
||||
@ -1327,26 +1281,10 @@ static void DestroyXIMCallback(XIM im, XPointer client_data, XPointer call_data)
|
||||
X11InputMethodData *pX11IMData = getX11InputMethodData(env, currentX11InputMethodInstance);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11InputMethod
|
||||
* Method: initIDs
|
||||
* Signature: ()V
|
||||
*/
|
||||
|
||||
/* This function gets called from the static initializer for
|
||||
X11InputMethod.java
|
||||
to initialize the fieldIDs for fields that may be accessed from C */
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11InputMethod_initIDs(JNIEnv *env, jclass cls)
|
||||
{
|
||||
x11InputMethodIDs.pData = (*env)->GetFieldID(env, cls, "pData", "J");
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_sun_awt_X11_XInputMethod_openXIMNative(JNIEnv *env,
|
||||
jobject this,
|
||||
jlong display)
|
||||
jobject this,
|
||||
jlong display)
|
||||
{
|
||||
Bool registered;
|
||||
|
||||
@ -1375,8 +1313,8 @@ Java_sun_awt_X11_XInputMethod_openXIMNative(JNIEnv *env,
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_sun_awt_X11_XInputMethod_createXICNative(JNIEnv *env,
|
||||
jobject this,
|
||||
jlong window)
|
||||
jobject this,
|
||||
jlong window)
|
||||
{
|
||||
X11InputMethodData *pX11IMData;
|
||||
jobject globalRef;
|
||||
@ -1423,10 +1361,10 @@ finally:
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env,
|
||||
jobject this,
|
||||
jlong w,
|
||||
jboolean req,
|
||||
jboolean active)
|
||||
jobject this,
|
||||
jlong w,
|
||||
jboolean req,
|
||||
jboolean active)
|
||||
{
|
||||
X11InputMethodData *pX11IMData;
|
||||
AWT_LOCK();
|
||||
@ -1471,9 +1409,27 @@ Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env,
|
||||
AWT_UNLOCK();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11InputMethod_turnoffStatusWindow(JNIEnv *env,
|
||||
jobject this)
|
||||
/*
|
||||
* Class: sun_awt_X11InputMethodBase
|
||||
* Method: initIDs
|
||||
* Signature: ()V
|
||||
* This function gets called from the static initializer for
|
||||
* X11InputMethod.java to initialize the fieldIDs for fields
|
||||
* that may be accessed from C
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11InputMethodBase_initIDs
|
||||
(JNIEnv *env, jclass cls)
|
||||
{
|
||||
x11InputMethodIDs.pData = (*env)->GetFieldID(env, cls, "pData", "J");
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11InputMethodBase
|
||||
* Method: turnoffStatusWindow
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11InputMethodBase_turnoffStatusWindow
|
||||
(JNIEnv *env, jobject this)
|
||||
{
|
||||
#if defined(__linux__) || defined(MACOSX)
|
||||
X11InputMethodData *pX11IMData;
|
||||
@ -1495,9 +1451,13 @@ Java_sun_awt_X11InputMethod_turnoffStatusWindow(JNIEnv *env,
|
||||
#endif
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11InputMethod_disposeXIC(JNIEnv *env,
|
||||
jobject this)
|
||||
/*
|
||||
* Class: sun_awt_X11InputMethodBase
|
||||
* Method: disposeXIC
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11InputMethodBase_disposeXIC
|
||||
(JNIEnv *env, jobject this)
|
||||
{
|
||||
X11InputMethodData *pX11IMData = NULL;
|
||||
|
||||
@ -1518,9 +1478,13 @@ Java_sun_awt_X11InputMethod_disposeXIC(JNIEnv *env,
|
||||
AWT_UNLOCK();
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_sun_awt_X11InputMethod_resetXIC(JNIEnv *env,
|
||||
jobject this)
|
||||
/*
|
||||
* Class: sun_awt_X11InputMethodBase
|
||||
* Method: resetXIC
|
||||
* Signature: ()Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_sun_awt_X11InputMethodBase_resetXIC
|
||||
(JNIEnv *env, jobject this)
|
||||
{
|
||||
X11InputMethodData *pX11IMData;
|
||||
char *xText = NULL;
|
||||
@ -1564,9 +1528,9 @@ Java_sun_awt_X11InputMethod_resetXIC(JNIEnv *env,
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11InputMethod
|
||||
* Class: sun_awt_X11InputMethodBase
|
||||
* Method: setCompositionEnabledNative
|
||||
* Signature: (ZJ)V
|
||||
* Signature: (Z)Z
|
||||
*
|
||||
* This method tries to set the XNPreeditState attribute associated with the current
|
||||
* XIC to the passed in 'enable' state.
|
||||
@ -1575,9 +1539,8 @@ Java_sun_awt_X11InputMethod_resetXIC(JNIEnv *env,
|
||||
* 'enable' state; Otherwise, if XSetICValues fails to set this attribute,
|
||||
* java.lang.UnsupportedOperationException will be thrown. JNI_FALSE is returned if this
|
||||
* method fails due to other reasons.
|
||||
*
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_sun_awt_X11InputMethod_setCompositionEnabledNative
|
||||
JNIEXPORT jboolean JNICALL Java_sun_awt_X11InputMethodBase_setCompositionEnabledNative
|
||||
(JNIEnv *env, jobject this, jboolean enable)
|
||||
{
|
||||
X11InputMethodData *pX11IMData;
|
||||
@ -1603,18 +1566,17 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11InputMethod_setCompositionEnabledNati
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11InputMethod
|
||||
* Class: sun_awt_X11InputMethodBase
|
||||
* Method: isCompositionEnabledNative
|
||||
* Signature: (J)Z
|
||||
* Signature: ()Z
|
||||
*
|
||||
* This method tries to get the XNPreeditState attribute associated with the current XIC.
|
||||
*
|
||||
* Return JNI_TRUE if the XNPreeditState is successfully retrieved. Otherwise, if
|
||||
* XGetICValues fails to get this attribute, java.lang.UnsupportedOperationException
|
||||
* will be thrown. JNI_FALSE is returned if this method fails due to other reasons.
|
||||
*
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_sun_awt_X11InputMethod_isCompositionEnabledNative
|
||||
JNIEXPORT jboolean JNICALL Java_sun_awt_X11InputMethodBase_isCompositionEnabledNative
|
||||
(JNIEnv *env, jobject this)
|
||||
{
|
||||
X11InputMethodData *pX11IMData = NULL;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,31 +23,32 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include "sun_awt_X11_XlibWrapper.h"
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xos.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/extensions/Xdbe.h>
|
||||
#include <X11/extensions/shape.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <X11/Sunkeysym.h>
|
||||
|
||||
#include <jni.h>
|
||||
#include <jni_util.h>
|
||||
#include <jlong.h>
|
||||
#include <sizecalc.h>
|
||||
|
||||
#include <awt.h>
|
||||
#include <awt_util.h>
|
||||
#include <jvm.h>
|
||||
|
||||
#include <Region.h>
|
||||
#include "awt.h"
|
||||
#include "awt_util.h"
|
||||
#include "jni.h"
|
||||
#include "jlong.h"
|
||||
#include "Region.h"
|
||||
#include "sizecalc.h"
|
||||
#include "utility/rect.h"
|
||||
|
||||
#include "sun_awt_X11_XlibWrapper.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <X11/extensions/Xdbe.h>
|
||||
#include <X11/extensions/shape.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/Sunkeysym.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/XKBlib.h>
|
||||
#include <X11/Xos.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
#if defined(AIX)
|
||||
#undef X_HAVE_UTF8_STRING
|
||||
extern Bool statusWindowEventHandler(XEvent event);
|
||||
#endif
|
||||
|
||||
// From XWindow.c
|
||||
extern KeySym keycodeToKeysym(Display *display, KeyCode keycode, int index);
|
||||
@ -288,7 +289,6 @@ JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_ScreenCount
|
||||
return ScreenCount((Display *) jlong_to_ptr(display));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: XlibWrapper
|
||||
* Method: XCreateWindow
|
||||
@ -303,7 +303,6 @@ JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XCreateWindow
|
||||
return XCreateWindow((Display *) jlong_to_ptr(display),(Window) window, x, y, w, h,
|
||||
border_width, depth, wclass, (Visual *) jlong_to_ptr(visual),
|
||||
valuemask, (XSetWindowAttributes *) jlong_to_ptr(attributes));
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -320,7 +319,6 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XConvertCase
|
||||
(jlong_to_ptr(keysym_uppercase)));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: XlibWrapper
|
||||
* Method: XMapWindow
|
||||
@ -331,7 +329,6 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XMapWindow
|
||||
{
|
||||
AWT_CHECK_HAVE_LOCK();
|
||||
XMapWindow( (Display *)jlong_to_ptr(display),(Window) window);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -344,7 +341,6 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XMapRaised
|
||||
{
|
||||
AWT_CHECK_HAVE_LOCK();
|
||||
XMapRaised( (Display *)jlong_to_ptr(display),(Window) window);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -355,10 +351,8 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XMapRaised
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XRaiseWindow
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong window)
|
||||
{
|
||||
|
||||
AWT_CHECK_HAVE_LOCK();
|
||||
XRaiseWindow( (Display *)jlong_to_ptr(display),(Window) window);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -369,10 +363,8 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XRaiseWindow
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XLowerWindow
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong window)
|
||||
{
|
||||
|
||||
AWT_CHECK_HAVE_LOCK();
|
||||
XLowerWindow( (Display *)jlong_to_ptr(display),(Window) window);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -383,10 +375,8 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XLowerWindow
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XRestackWindows
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong windows, jint length)
|
||||
{
|
||||
|
||||
AWT_CHECK_HAVE_LOCK();
|
||||
XRestackWindows( (Display *) jlong_to_ptr(display), (Window *) jlong_to_ptr(windows), length);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -411,11 +401,10 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XConfigureWindow
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XSetInputFocus
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong window)
|
||||
{
|
||||
|
||||
AWT_CHECK_HAVE_LOCK();
|
||||
XSetInputFocus( (Display *)jlong_to_ptr(display),(Window) window, RevertToPointerRoot, CurrentTime);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: XlibWrapper
|
||||
* Method: XSetInputFocus2
|
||||
@ -424,10 +413,8 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XSetInputFocus
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XSetInputFocus2
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong time)
|
||||
{
|
||||
|
||||
AWT_CHECK_HAVE_LOCK();
|
||||
XSetInputFocus( (Display *)jlong_to_ptr(display),(Window) window, RevertToPointerRoot, time);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -438,7 +425,6 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XSetInputFocus2
|
||||
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XGetInputFocus
|
||||
(JNIEnv *env, jclass clazz, jlong display)
|
||||
{
|
||||
|
||||
Window focusOwner;
|
||||
int revert_to;
|
||||
AWT_CHECK_HAVE_LOCK_RETURN(0);
|
||||
@ -446,7 +432,6 @@ JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XGetInputFocus
|
||||
return focusOwner;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: XlibWrapper
|
||||
* Method: XDestroyWindow
|
||||
@ -525,8 +510,6 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XUnmapWindow
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XSelectInput
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong mask)
|
||||
{
|
||||
@ -543,6 +526,7 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XkbSelectEvents
|
||||
(unsigned long)bits_to_change,
|
||||
(unsigned long)values_for_bits);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XkbSelectEventDetails
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong device, jlong event_type,
|
||||
jlong bits_to_change, jlong values_for_bits)
|
||||
@ -553,6 +537,7 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XkbSelectEventDetails
|
||||
(unsigned long)bits_to_change,
|
||||
(unsigned long)values_for_bits);
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XkbQueryExtension
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong opcode_rtrn, jlong event_rtrn,
|
||||
jlong error_rtrn, jlong major_in_out, jlong minor_in_out)
|
||||
@ -567,6 +552,7 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XkbQueryExtension
|
||||
(int *) jlong_to_ptr(minor_in_out));
|
||||
return status ? JNI_TRUE : JNI_FALSE;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XkbLibraryVersion
|
||||
(JNIEnv *env, jclass clazz, jlong lib_major_in_out, jlong lib_minor_in_out)
|
||||
{
|
||||
@ -587,6 +573,7 @@ JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XkbGetMap
|
||||
(unsigned int) which,
|
||||
(unsigned int) device_spec);
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XkbGetUpdatedMap
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong which, jlong xkb)
|
||||
{
|
||||
@ -626,8 +613,6 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XkbSetDetectableAutoRepeat
|
||||
* Method: XNextEvent
|
||||
* Signature: (JJ)V
|
||||
*/
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XNextEvent
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong ptr)
|
||||
{
|
||||
@ -640,7 +625,6 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XNextEvent
|
||||
* Method: XMaskEvent
|
||||
* Signature: (JJJ)V
|
||||
*/
|
||||
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XMaskEvent
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong event_mask, jlong event_return)
|
||||
{
|
||||
@ -653,7 +637,6 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XMaskEvent
|
||||
* Method: XWindowEvent
|
||||
* Signature: (JJJJ)V
|
||||
*/
|
||||
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XWindowEvent
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong event_mask, jlong event_return)
|
||||
{
|
||||
@ -670,6 +653,11 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XFilterEvent
|
||||
(JNIEnv *env, jclass clazz, jlong ptr, jlong window)
|
||||
{
|
||||
AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
|
||||
#if defined(AIX)
|
||||
if (True == statusWindowEventHandler(*((XEvent *)(uintptr_t)ptr))) {
|
||||
return (jboolean)True;
|
||||
}
|
||||
#endif
|
||||
return (jboolean) XFilterEvent((XEvent *) jlong_to_ptr(ptr), (Window) window);
|
||||
}
|
||||
|
||||
@ -727,19 +715,15 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XPeekEvent
|
||||
XPeekEvent((Display *) jlong_to_ptr(display),jlong_to_ptr(ptr));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XlibWrapper
|
||||
* Method: XMoveResizeWindow
|
||||
* Signature: (JJIIII)V
|
||||
*/
|
||||
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XMoveResizeWindow
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong window, jint x , jint y , jint width, jint height) {
|
||||
|
||||
AWT_CHECK_HAVE_LOCK();
|
||||
XMoveResizeWindow( (Display *) jlong_to_ptr(display), (Window) window, x, y, width, height);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -747,10 +731,8 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XMoveResizeWindow
|
||||
* Method: XResizeWindow
|
||||
* Signature: (JJII)V
|
||||
*/
|
||||
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XResizeWindow
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong window, jint width, jint height)
|
||||
{
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong window, jint width, jint height) {
|
||||
AWT_CHECK_HAVE_LOCK();
|
||||
XResizeWindow( (Display *) jlong_to_ptr(display),(Window) window,width,height);
|
||||
}
|
||||
@ -760,10 +742,8 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XResizeWindow
|
||||
* Method: XMoveWindow
|
||||
* Signature: (JJII)V
|
||||
*/
|
||||
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XMoveWindow
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong window, jint width, jint height)
|
||||
{
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong window, jint width, jint height) {
|
||||
AWT_CHECK_HAVE_LOCK();
|
||||
XMoveWindow( (Display *) jlong_to_ptr(display),(Window) window,width,height);
|
||||
}
|
||||
@ -774,13 +754,10 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XMoveWindow
|
||||
* Method: XSetWindowBackground
|
||||
* Signature: (JJJ)V
|
||||
*/
|
||||
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XSetWindowBackground
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong background_pixel) {
|
||||
|
||||
AWT_CHECK_HAVE_LOCK();
|
||||
XSetWindowBackground((Display *) jlong_to_ptr(display),window,background_pixel);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -803,10 +780,8 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XFlush
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XSync
|
||||
(JNIEnv *env, jclass clazz, jlong display, jint discard) {
|
||||
|
||||
AWT_CHECK_HAVE_LOCK();
|
||||
XSync((Display *) jlong_to_ptr(display), discard);
|
||||
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XTranslateCoordinates
|
||||
@ -855,7 +830,6 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_SetProperty
|
||||
cname = "";
|
||||
}
|
||||
|
||||
|
||||
AWT_CHECK_HAVE_LOCK();
|
||||
|
||||
#ifdef X_HAVE_UTF8_STRING
|
||||
@ -866,7 +840,6 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_SetProperty
|
||||
XStdICCTextStyle, &tp);
|
||||
#endif
|
||||
|
||||
|
||||
if (status == Success || status > 0) {
|
||||
XChangeProperty((Display *)jlong_to_ptr(display), window, atom, tp.encoding, tp.format, PropModeReplace, tp.value, tp.nitems);
|
||||
if (tp.value != NULL) {
|
||||
@ -1005,7 +978,6 @@ JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XCreateFontCursor
|
||||
return XCreateFontCursor((Display *) jlong_to_ptr(display), (int) shape);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XlibWrapper
|
||||
* Method: XCreatePixmapCursor
|
||||
@ -1019,7 +991,6 @@ JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XCreatePixmapCursor
|
||||
(XColor *) jlong_to_ptr(fore), (XColor *) jlong_to_ptr(back), x, y);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XlibWrapper
|
||||
* Method: XQueryBestCursor
|
||||
@ -1038,7 +1009,6 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XQueryBestCursor
|
||||
else return JNI_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XlibWrapper
|
||||
* Method: XFreeCursor
|
||||
@ -1084,7 +1054,6 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XChangeWindowAttributes
|
||||
(XSetWindowAttributes *) jlong_to_ptr(attributes));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XlibWrapper
|
||||
* Method: XSetTransientFor
|
||||
@ -1181,7 +1150,6 @@ JNIEXPORT jstring JNICALL Java_sun_awt_X11_XlibWrapper_XGetDefault
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XlibWrapper
|
||||
* Method: getScreenOfWindow
|
||||
@ -1253,7 +1221,6 @@ JNIEXPORT jbyteArray JNICALL Java_sun_awt_X11_XlibWrapper_getStringBytes
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XlibWrapper
|
||||
* Method: ServerVendor
|
||||
@ -1265,6 +1232,7 @@ JNIEXPORT jstring JNICALL Java_sun_awt_X11_XlibWrapper_ServerVendor
|
||||
AWT_CHECK_HAVE_LOCK_RETURN(NULL);
|
||||
return JNU_NewStringPlatform(env, ServerVendor((Display*)jlong_to_ptr(display)));
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XlibWrapper
|
||||
* Method: VendorRelease
|
||||
@ -1276,6 +1244,7 @@ JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_VendorRelease
|
||||
AWT_CHECK_HAVE_LOCK_RETURN(0);
|
||||
return VendorRelease((Display*)jlong_to_ptr(display));
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XlibWrapper
|
||||
* Method: IsXsunKPBehavior
|
||||
@ -1309,7 +1278,6 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_IsXsunKPBehavior
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_IsSunKeyboard
|
||||
(JNIEnv *env, jclass clazz, jlong display)
|
||||
{
|
||||
@ -1407,7 +1375,6 @@ JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_CallErrorHandler
|
||||
return (*(XErrorHandler)jlong_to_ptr(handler))((Display*) jlong_to_ptr(display), (XErrorEvent*) jlong_to_ptr(event_ptr));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XlibWrapper
|
||||
* Method: PrintXErrorEvent
|
||||
@ -1431,7 +1398,6 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_PrintXErrorEvent
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XlibWrapper
|
||||
* Method: XInternAtoms
|
||||
@ -1451,8 +1417,6 @@ JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XInternAtoms
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XlibWrapper
|
||||
* Method: XGetWindowAttributes
|
||||
@ -1468,7 +1432,6 @@ JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XGetWindowAttributes
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XlibWrapper
|
||||
* Method: XGetGeometry
|
||||
@ -1490,7 +1453,6 @@ JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XGetGeometry
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XlibWrapper
|
||||
* Method: XGetWMNormalHints
|
||||
@ -1546,7 +1508,6 @@ JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XSendEvent
|
||||
(XEvent*) jlong_to_ptr(event));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XlibWrapper
|
||||
* Method: XQueryTree
|
||||
@ -1564,7 +1525,6 @@ JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XQueryTree
|
||||
(unsigned int*) jlong_to_ptr(nchildren_return));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XlibWrapper
|
||||
* Method: memcpy
|
||||
@ -1576,7 +1536,6 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_memcpy
|
||||
memcpy(jlong_to_ptr(dest_ptr), jlong_to_ptr(src_ptr), length);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XSetMinMaxHints
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong window, jint x, jint y, jint width, jint height, jlong flags) {
|
||||
XSizeHints * hints;
|
||||
@ -1595,7 +1554,6 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XSetMinMaxHints
|
||||
XFree(hints);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XGetVisualInfo
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong vinfo_mask, jlong vinfo_template,
|
||||
jlong nitems_return)
|
||||
@ -1626,7 +1584,6 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XBell
|
||||
XBell((Display*)jlong_to_ptr(display), percent);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XlibWrapper
|
||||
* Method: XAllocColor
|
||||
@ -1643,7 +1600,6 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XAllocColor
|
||||
else return JNI_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XlibWrapper
|
||||
* Method: XCreateBitmapFromData
|
||||
@ -1657,7 +1613,6 @@ JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XCreateBitmapFromData
|
||||
(char *) jlong_to_ptr(data), width, height);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XlibWrapper
|
||||
* Method: XFreePixmap
|
||||
@ -1772,6 +1727,7 @@ Java_sun_awt_X11_XlibWrapper_XCreatePixmap(JNIEnv *env, jclass clazz, jlong disp
|
||||
AWT_CHECK_HAVE_LOCK_RETURN(0);
|
||||
return XCreatePixmap((Display*)jlong_to_ptr(display), (Drawable)drawable, width, height, depth);
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_sun_awt_X11_XlibWrapper_XCreateImage
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong visual_ptr,
|
||||
@ -1783,6 +1739,7 @@ Java_sun_awt_X11_XlibWrapper_XCreateImage
|
||||
depth, format, offset, (char*) jlong_to_ptr(data),
|
||||
width, height, bitmap_pad, bytes_per_line));
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_sun_awt_X11_XlibWrapper_XCreateGC
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong drawable,
|
||||
@ -1806,6 +1763,7 @@ Java_sun_awt_X11_XlibWrapper_XDestroyImage(JNIEnv *env, jclass clazz, jlong imag
|
||||
img->data = NULL;
|
||||
XDestroyImage(img);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XlibWrapper_XPutImage(JNIEnv *env, jclass clazz, jlong display, jlong drawable, jlong gc, jlong image, jint src_x, jint src_y, jint dest_x, jint dest_y, jint width, jint height)
|
||||
{
|
||||
@ -1813,18 +1771,21 @@ Java_sun_awt_X11_XlibWrapper_XPutImage(JNIEnv *env, jclass clazz, jlong display,
|
||||
XPutImage((Display*)jlong_to_ptr(display), (Drawable)drawable, (GC) jlong_to_ptr(gc), (XImage*) jlong_to_ptr(image), src_x, src_y,
|
||||
dest_x, dest_y, width, height);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XlibWrapper_XFreeGC(JNIEnv *env, jclass clazz, jlong display, jlong gc)
|
||||
{
|
||||
AWT_CHECK_HAVE_LOCK();
|
||||
XFreeGC((Display*) jlong_to_ptr(display), (GC) jlong_to_ptr(gc));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XlibWrapper_XSetWindowBackgroundPixmap(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong pixmap)
|
||||
{
|
||||
AWT_CHECK_HAVE_LOCK();
|
||||
XSetWindowBackgroundPixmap((Display*) jlong_to_ptr(display), (Window)window, (Pixmap)pixmap);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XlibWrapper_XClearWindow(JNIEnv *env, jclass clazz, jlong display, jlong window)
|
||||
{
|
||||
@ -1922,7 +1883,6 @@ JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XdbeSwapBuffers
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XQueryKeymap
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong vector)
|
||||
{
|
||||
|
||||
AWT_CHECK_HAVE_LOCK();
|
||||
XQueryKeymap( (Display *) jlong_to_ptr(display), (char *) jlong_to_ptr(vector));
|
||||
}
|
||||
@ -1961,6 +1921,7 @@ Java_sun_awt_X11_XlibWrapper_XkbGetEffectiveGroup(JNIEnv *env, jclass clazz,
|
||||
// printf("-------------------------------------^^^^\n");
|
||||
return (jint)(sr.group);
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_sun_awt_X11_XlibWrapper_XkbKeycodeToKeysym(JNIEnv *env, jclass clazz,
|
||||
jlong display, jint keycode,
|
||||
@ -1989,6 +1950,7 @@ Java_sun_awt_X11_XlibWrapper_XFreeModifiermap(JNIEnv *env, jclass clazz,
|
||||
AWT_CHECK_HAVE_LOCK();
|
||||
XFreeModifiermap((XModifierKeymap*) jlong_to_ptr(keymap));
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XlibWrapper
|
||||
* Method: XRefreshKeyboardMapping
|
||||
@ -2034,7 +1996,6 @@ secondary_loop_event(Display* dpy, XEvent* event, XPointer xawt_root_window) {
|
||||
) ? True : False;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_sun_awt_X11_XlibWrapper_XNextSecondaryLoopEvent(JNIEnv *env, jclass clazz,
|
||||
jlong display, jlong ptr) {
|
||||
@ -2062,7 +2023,6 @@ Java_sun_awt_X11_XlibWrapper_ExitSecondaryLoop(JNIEnv *env, jclass clazz) {
|
||||
exitSecondaryLoop = True;
|
||||
AWT_NOTIFY_ALL();
|
||||
}
|
||||
/*******************************************************************************/
|
||||
|
||||
JNIEXPORT jobjectArray JNICALL
|
||||
Java_sun_awt_X11_XlibWrapper_XTextPropertyToStringList(JNIEnv *env,
|
||||
@ -2181,7 +2141,6 @@ Java_sun_awt_X11_XlibWrapper_XTextPropertyToStringList(JNIEnv *env,
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XlibWrapper_XPutBackEvent(JNIEnv *env,
|
||||
jclass clazz,
|
||||
|
Loading…
x
Reference in New Issue
Block a user