src/solaris/classes/sun/awt/X11/XErrorHandlerUtil.java

Print this page




  88                 initPassed = true;
  89             }
  90         } finally {
  91             SunToolkit.awtUnlock();
  92         }
  93     }
  94 
  95     /**
  96      * Sets a synthetic error handler. Must be called with the acquired AWT lock.
  97      * @param handler the synthetic error handler to set
  98      */
  99     public static void WITH_XERROR_HANDLER(XErrorHandler handler) {
 100         saved_error = null;
 101         current_error_handler = handler;
 102     }
 103 
 104     /**
 105      * Unsets a current synthetic error handler. Must be called with the acquired AWT lock.
 106      */
 107     public static void RESTORE_XERROR_HANDLER() {




 108         // Wait until all requests are processed by the X server
 109         // and only then uninstall the error handler.

 110         XSync();

 111         current_error_handler = null;
 112     }
 113 
 114     /**
 115      * Should be called under LOCK.
 116      */
 117     public static int SAVED_XERROR_HANDLER(long display, XErrorEvent error) {
 118         if (saved_error_handler != 0) {
 119             // Default XErrorHandler may just terminate the process. Don't call it.
 120             // return XlibWrapper.CallErrorHandler(saved_error_handler, display, error.pData);
 121         }
 122         if (log.isLoggable(PlatformLogger.FINE)) {
 123             log.fine("Unhandled XErrorEvent: " +
 124                 "id=" + error.get_resourceid() + ", " +
 125                 "serial=" + error.get_serial() + ", " +
 126                 "ec=" + error.get_error_code() + ", " +
 127                 "rc=" + error.get_request_code() + ", " +
 128                 "mc=" + error.get_minor_code());
 129         }
 130         return 0;




  88                 initPassed = true;
  89             }
  90         } finally {
  91             SunToolkit.awtUnlock();
  92         }
  93     }
  94 
  95     /**
  96      * Sets a synthetic error handler. Must be called with the acquired AWT lock.
  97      * @param handler the synthetic error handler to set
  98      */
  99     public static void WITH_XERROR_HANDLER(XErrorHandler handler) {
 100         saved_error = null;
 101         current_error_handler = handler;
 102     }
 103 
 104     /**
 105      * Unsets a current synthetic error handler. Must be called with the acquired AWT lock.
 106      */
 107     public static void RESTORE_XERROR_HANDLER() {
 108         RESTORE_XERROR_HANDLER(true);
 109     }
 110 
 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) {
 115             XSync();
 116         }
 117         current_error_handler = null;
 118     }
 119 
 120     /**
 121      * Should be called under LOCK.
 122      */
 123     public static int SAVED_XERROR_HANDLER(long display, XErrorEvent error) {
 124         if (saved_error_handler != 0) {
 125             // Default XErrorHandler may just terminate the process. Don't call it.
 126             // return XlibWrapper.CallErrorHandler(saved_error_handler, display, error.pData);
 127         }
 128         if (log.isLoggable(PlatformLogger.FINE)) {
 129             log.fine("Unhandled XErrorEvent: " +
 130                 "id=" + error.get_resourceid() + ", " +
 131                 "serial=" + error.get_serial() + ", " +
 132                 "ec=" + error.get_error_code() + ", " +
 133                 "rc=" + error.get_request_code() + ", " +
 134                 "mc=" + error.get_minor_code());
 135         }
 136         return 0;