src/macosx/classes/sun/lwawt/LWWindowPeer.java
Print this page
@@ -46,16 +46,17 @@
public static enum PeerType {
SIMPLEWINDOW,
FRAME,
DIALOG,
EMBEDDED_FRAME,
- VIEW_EMBEDDED_FRAME
+ VIEW_EMBEDDED_FRAME,
+ LW_FRAME
}
private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.lwawt.focus.LWWindowPeer");
- private PlatformWindow platformWindow;
+ protected PlatformWindow platformWindow;
// Window bounds reported by the native system (as opposed to
// regular bounds inherited from LWComponentPeer which are
// requested by user and may haven't been applied yet because
// of asynchronous requests to the windowing system)
@@ -1092,11 +1093,11 @@
}
return platformWindow.requestWindowFocus();
}
- private boolean focusAllowedFor() {
+ protected boolean focusAllowedFor() {
Window window = getTarget();
// TODO: check if modal blocked
return window.isVisible() && window.isEnabled() && isFocusableWindow();
}
@@ -1115,14 +1116,19 @@
public boolean isSimpleWindow() {
Window window = getTarget();
return !(window instanceof Dialog || window instanceof Frame);
}
+ @Override
+ public void emulateActivation(boolean activate) {
+ changeFocusedWindow(activate, null);
+ }
+
/*
* Changes focused window on java level.
*/
- private void changeFocusedWindow(boolean becomesFocused, Window opposite) {
+ protected void changeFocusedWindow(boolean becomesFocused, Window opposite) {
if (focusLog.isLoggable(PlatformLogger.FINE)) {
focusLog.fine((becomesFocused?"gaining":"loosing") + " focus window: " + this);
}
if (skipNextFocusChange) {
focusLog.fine("skipping focus change");
@@ -1199,10 +1205,20 @@
public long getLayerPtr() {
return getPlatformWindow().getLayerPtr();
}
+ @Override
+ public void grabFocus() {
+ grab();
+ }
+
+ @Override
+ public void ungrabFocus(boolean postEvent) {
+ ungrab(postEvent);
+ }
+
void grab() {
if (grabbingWindow != null && !isGrabbing()) {
grabbingWindow.ungrab();
}
grabbingWindow = this;