40 * The connection to X11 window server. |
40 * The connection to X11 window server. |
41 */ |
41 */ |
42 private static long display; |
42 private static long display; |
43 |
43 |
44 /** |
44 /** |
45 * Error handler at the moment of <code>XErrorHandlerUtil</code> initialization. |
45 * Error handler at the moment of {@code XErrorHandlerUtil} initialization. |
46 */ |
46 */ |
47 private static long saved_error_handler; |
47 private static long saved_error_handler; |
48 |
48 |
49 /** |
49 /** |
50 * XErrorEvent being handled. |
50 * XErrorEvent being handled. |
61 */ |
61 */ |
62 private static boolean noisyAwtHandler = AccessController.doPrivileged( |
62 private static boolean noisyAwtHandler = AccessController.doPrivileged( |
63 new GetBooleanAction("sun.awt.noisyerrorhandler")); |
63 new GetBooleanAction("sun.awt.noisyerrorhandler")); |
64 |
64 |
65 /** |
65 /** |
66 * The flag indicating that <code>init</code> was called already. |
66 * The flag indicating that {@code init} was called already. |
67 */ |
67 */ |
68 private static boolean initPassed; |
68 private static boolean initPassed; |
69 |
69 |
70 /** |
70 /** |
71 * Guarantees that no instance of this class can be created. |
71 * Guarantees that no instance of this class can be created. |
72 */ |
72 */ |
73 private XErrorHandlerUtil() {} |
73 private XErrorHandlerUtil() {} |
74 |
74 |
75 /** |
75 /** |
76 * Sets the toolkit global error handler, stores the connection to X11 server, which |
76 * Sets the toolkit global error handler, stores the connection to X11 server, |
77 * will be used during an error handling process. This method is called once from |
77 * which will be used during an error handling process. This method is called |
78 * <code>awt_init_Display</code> function defined in <code>awt_GraphicsEnv.c</code> |
78 * once from {@code awt_init_Display} function defined in {@code awt_GraphicsEnv.c} |
79 * file immediately after the connection to X11 window server is opened. |
79 * file immediately after the connection to X11 window server is opened. |
80 * @param display the connection to X11 server which should be stored |
80 * @param display the connection to X11 server which should be stored |
81 */ |
81 */ |
82 private static void init(long display) { |
82 private static void init(long display) { |
83 SunToolkit.awtLock(); |
83 SunToolkit.awtLock(); |
107 public static void RESTORE_XERROR_HANDLER() { |
107 public static void RESTORE_XERROR_HANDLER() { |
108 RESTORE_XERROR_HANDLER(true); |
108 RESTORE_XERROR_HANDLER(true); |
109 } |
109 } |
110 |
110 |
111 private static void RESTORE_XERROR_HANDLER(boolean doXSync) { |
111 private static void RESTORE_XERROR_HANDLER(boolean doXSync) { |
112 // Wait until all requests are processed by the X server |
|
113 // and only then uninstall the error handler. |
|
114 if (doXSync) { |
112 if (doXSync) { |
|
113 // Wait until all requests are processed by the X server |
|
114 // and only then uninstall the error handler. |
115 XSync(); |
115 XSync(); |
116 } |
116 } |
117 current_error_handler = null; |
117 current_error_handler = null; |
118 } |
118 } |
119 |
119 |