6714678: IDE (Netbeans, Eclipse, JDeveloper) Debugger hangs process on Linux

Added the system property sun.awt.disablegrab

Reviewed-by: art, dcherepanov
This commit is contained in:
Anthony Petrov 2009-03-25 13:37:08 +03:00
parent 1a0a9da570
commit be5021d224
2 changed files with 41 additions and 22 deletions

View File

@ -842,6 +842,13 @@ public class XBaseWindow {
| XConstants.ButtonMotionMask);
final int ownerEvents = 1;
//6714678: IDE (Netbeans, Eclipse, JDeveloper) Debugger hangs
//process on Linux
//The user must pass the sun.awt.disablegrab property to disable
//taking grabs. This prevents hanging of the GUI when a breakpoint
//is hit while a popup window taking the grab is open.
if (!XToolkit.getSunAwtDisableGrab()) {
int ptrGrab = XlibWrapper.XGrabPointer(XToolkit.getDisplay(),
getContentWindow(), ownerEvents, eventMask, XConstants.GrabModeAsync,
XConstants.GrabModeAsync, XConstants.None, (XWM.isMotif() ? XToolkit.arrowCursor : XConstants.None),
@ -864,6 +871,7 @@ public class XBaseWindow {
grabLog.fine(" Grab Failure - keyboard");
return false;
}
}
if (prevGrabWindow != null) {
prevGrabWindow.ungrabInputImpl();
}
@ -882,8 +890,10 @@ public class XBaseWindow {
grabLog.log(Level.FINE, "UnGrab input on {0}", new Object[] {grabWindow});
if (grabWindow != null) {
grabWindow.ungrabInputImpl();
if (!XToolkit.getSunAwtDisableGrab()) {
XlibWrapper.XUngrabPointer(XToolkit.getDisplay(), XConstants.CurrentTime);
XlibWrapper.XUngrabKeyboard(XToolkit.getDisplay(), XConstants.CurrentTime);
}
XAwtState.setGrabWindow(null);
// we need to call XFlush() here to force ungrab
// see 6384219 for details

View File

@ -54,6 +54,7 @@ import sun.awt.*;
import sun.font.FontManager;
import sun.misc.PerformanceLogger;
import sun.print.PrintJob2D;
import sun.security.action.GetBooleanAction;
public final class XToolkit extends UNIXToolkit implements Runnable {
private static Logger log = Logger.getLogger("sun.awt.X11.XToolkit");
@ -2305,4 +2306,12 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
}
return ((X11GraphicsConfig)gc).isTranslucencyCapable();
}
/**
* Returns the value of "sun.awt.disablegrab" property. Default
* value is {@code false}.
*/
public static boolean getSunAwtDisableGrab() {
return AccessController.doPrivileged(new GetBooleanAction("sun.awt.disablegrab"));
}
}