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

Print this page

        

*** 597,608 **** } catch (Exception e) { dataModel = 32; } isBuildInternal = getBuildInternal(); - - // System.loadLibrary("mawt"); } static int getDataModel() { return dataModel; } --- 597,606 ----
*** 646,651 **** --- 644,684 ---- String javaVersion = XToolkit.getSystemProperty("java.version"); return javaVersion != null && javaVersion.contains("internal"); } static native void PrintXErrorEvent(long display, long event_ptr); + + /** + * The interface to be implemented by a predicate object used with the + * CheckIfEvent() method. + */ + public static interface CheckEventPredicate { + + /** + * Returns true if the event matches some criteria, false otherwise. + */ + boolean doesMatch(XEvent event); + } + + /** + * Invokes the XCheckIfEvent(). + * The returned event (if any) MUST BE disposed by the caller. + * + * @return the matched event or null if no match found. + */ + public static XEvent CheckIfEvent(long display, CheckEventPredicate predicate) { + XEvent ev = new XEvent(); + + if (CheckIfEvent(display, ev, ev.pData, predicate)) { + return ev; + } else { + ev.dispose(); + return null; + } + } + + /* + * NOTE: The passed event_return MUST be equal to the event.pData. + */ + private static native boolean CheckIfEvent(long display, XEvent event, + long event_return, CheckEventPredicate predicate); }