582 static final long iarg8 = iarg7+4; 583 584 585 static int dataModel; 586 static final boolean isBuildInternal; 587 588 static { 589 String dataModelProp = (String)AccessController.doPrivileged( 590 new PrivilegedAction() { 591 public Object run() { 592 return System.getProperty("sun.arch.data.model"); 593 } 594 }); 595 try { 596 dataModel = Integer.parseInt(dataModelProp); 597 } catch (Exception e) { 598 dataModel = 32; 599 } 600 601 isBuildInternal = getBuildInternal(); 602 603 // System.loadLibrary("mawt"); 604 } 605 606 static int getDataModel() { 607 return dataModel; 608 } 609 610 static String hintsToString(long flags) { 611 StringBuffer buf = new StringBuffer(); 612 if ((flags & XUtilConstants.PMaxSize) != 0) { 613 buf.append("PMaxSize "); 614 } 615 if ((flags & XUtilConstants.PMinSize) != 0) { 616 buf.append("PMinSize "); 617 } 618 if ((flags & XUtilConstants.USSize) != 0) { 619 buf.append("USSize "); 620 } 621 if ((flags & XUtilConstants.USPosition) != 0) { 622 buf.append("USPosition "); 623 } 631 buf.append("PWinGravity "); 632 } 633 return buf.toString(); 634 } 635 static String getEventToString( int type ) { 636 if( (type >= 0) && (type < eventToString.length)) { 637 return eventToString[type]; 638 }else if( type == XToolkit.getXKBBaseEventCode() ) { 639 //XXX TODO various xkb types 640 return "XkbEvent"; 641 } 642 return eventToString[0]; 643 } 644 645 private static boolean getBuildInternal() { 646 String javaVersion = XToolkit.getSystemProperty("java.version"); 647 return javaVersion != null && javaVersion.contains("internal"); 648 } 649 650 static native void PrintXErrorEvent(long display, long event_ptr); 651 } | 582 static final long iarg8 = iarg7+4; 583 584 585 static int dataModel; 586 static final boolean isBuildInternal; 587 588 static { 589 String dataModelProp = (String)AccessController.doPrivileged( 590 new PrivilegedAction() { 591 public Object run() { 592 return System.getProperty("sun.arch.data.model"); 593 } 594 }); 595 try { 596 dataModel = Integer.parseInt(dataModelProp); 597 } catch (Exception e) { 598 dataModel = 32; 599 } 600 601 isBuildInternal = getBuildInternal(); 602 } 603 604 static int getDataModel() { 605 return dataModel; 606 } 607 608 static String hintsToString(long flags) { 609 StringBuffer buf = new StringBuffer(); 610 if ((flags & XUtilConstants.PMaxSize) != 0) { 611 buf.append("PMaxSize "); 612 } 613 if ((flags & XUtilConstants.PMinSize) != 0) { 614 buf.append("PMinSize "); 615 } 616 if ((flags & XUtilConstants.USSize) != 0) { 617 buf.append("USSize "); 618 } 619 if ((flags & XUtilConstants.USPosition) != 0) { 620 buf.append("USPosition "); 621 } 629 buf.append("PWinGravity "); 630 } 631 return buf.toString(); 632 } 633 static String getEventToString( int type ) { 634 if( (type >= 0) && (type < eventToString.length)) { 635 return eventToString[type]; 636 }else if( type == XToolkit.getXKBBaseEventCode() ) { 637 //XXX TODO various xkb types 638 return "XkbEvent"; 639 } 640 return eventToString[0]; 641 } 642 643 private static boolean getBuildInternal() { 644 String javaVersion = XToolkit.getSystemProperty("java.version"); 645 return javaVersion != null && javaVersion.contains("internal"); 646 } 647 648 static native void PrintXErrorEvent(long display, long event_ptr); 649 650 /** 651 * The interface to be implemented by a predicate object used with the 652 * CheckIfEvent() method. 653 */ 654 public static interface CheckEventPredicate { 655 656 /** 657 * Returns true if the event matches some criteria, false otherwise. 658 */ 659 boolean doesMatch(XEvent event); 660 } 661 662 /** 663 * Invokes the XCheckIfEvent(). 664 * The returned event (if any) MUST BE disposed by the caller. 665 * 666 * @return the matched event or null if no match found. 667 */ 668 public static XEvent CheckIfEvent(long display, CheckEventPredicate predicate) { 669 XEvent ev = new XEvent(); 670 671 if (CheckIfEvent(display, ev, ev.pData, predicate)) { 672 return ev; 673 } else { 674 ev.dispose(); 675 return null; 676 } 677 } 678 679 /* 680 * NOTE: The passed event_return MUST be equal to the event.pData. 681 */ 682 private static native boolean CheckIfEvent(long display, XEvent event, 683 long event_return, CheckEventPredicate predicate); 684 } |