< prev index next >
src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java
Print this page
*** 1095,1104 ****
--- 1095,1105 ----
// The following code is used for support of automatic showing of the touch
// keyboard for text components and is accessed only from EDT.
///////////////////////////////////////////////////////////////////////////
private volatile Component compOnTouchDownEvent;
private volatile Component compOnMousePressedEvent;
+ private volatile Component compTouchKbrdWasShownFor;
@Override
public void showOrHideTouchKeyboard(Component comp, AWTEvent e) {
if ((comp == null) || (e == null) ||
(!(comp instanceof TextComponent) &&
*** 1123,1144 ****
} else if (me.getID() == MouseEvent.MOUSE_RELEASED) {
if (AWTAccessor.getMouseEventAccessor()
.isCausedByTouchEvent(me)) {
if (compOnTouchDownEvent == comp) {
showTouchKeyboard(true);
}
compOnTouchDownEvent = null;
} else {
if (compOnMousePressedEvent == comp) {
showTouchKeyboard(false);
}
compOnMousePressedEvent = null;
}
}
} else if (e instanceof FocusEvent) {
! if (e.getID() == FocusEvent.FOCUS_LOST) {
! hideTouchKeyboard();
}
}
}
private native void showTouchKeyboard(boolean causedByTouchEvent);
--- 1124,1153 ----
} else if (me.getID() == MouseEvent.MOUSE_RELEASED) {
if (AWTAccessor.getMouseEventAccessor()
.isCausedByTouchEvent(me)) {
if (compOnTouchDownEvent == comp) {
showTouchKeyboard(true);
+ compTouchKbrdWasShownFor = comp;
}
compOnTouchDownEvent = null;
} else {
if (compOnMousePressedEvent == comp) {
showTouchKeyboard(false);
+ compTouchKbrdWasShownFor = comp;
}
compOnMousePressedEvent = null;
}
}
} else if (e instanceof FocusEvent) {
! FocusEvent fe = (FocusEvent)e;
! if (fe.getID() == FocusEvent.FOCUS_LOST) {
! // Do not hide the touch keyboard, if it has just been shown for
! // a component which gains focus.
! if (fe.getOppositeComponent() != compTouchKbrdWasShownFor) {
! hideTouchKeyboard();
! }
! compTouchKbrdWasShownFor = null;
}
}
}
private native void showTouchKeyboard(boolean causedByTouchEvent);
< prev index next >