599 XDragSourceContextPeer.processEvent(ev)) { 600 continue; 601 } 602 603 if (eventLog.isLoggable(PlatformLogger.Level.FINER)) { 604 eventLog.finer("{0}", ev); 605 } 606 607 // Check if input method consumes the event 608 long w = 0; 609 if (windowToXWindow(ev.get_xany().get_window()) != null) { 610 Component owner = 611 XKeyboardFocusManagerPeer.getInstance().getCurrentFocusOwner(); 612 if (owner != null) { 613 XWindow ownerWindow = AWTAccessor.getComponentAccessor().getPeer(owner); 614 if (ownerWindow != null) { 615 w = ownerWindow.getContentWindow(); 616 } 617 } 618 } 619 if( keyEventLog.isLoggable(PlatformLogger.Level.FINE) && (ev.get_type() == XConstants.KeyPress || ev.get_type() == XConstants.KeyRelease) ) { 620 keyEventLog.fine("before XFilterEvent:"+ev); 621 } 622 if (XlibWrapper.XFilterEvent(ev.getPData(), w)) { 623 continue; 624 } 625 if( keyEventLog.isLoggable(PlatformLogger.Level.FINE) && (ev.get_type() == XConstants.KeyPress || ev.get_type() == XConstants.KeyRelease) ) { 626 keyEventLog.fine("after XFilterEvent:"+ev); // IS THIS CORRECT? 627 } 628 629 dispatchEvent(ev); 630 } catch (ThreadDeath td) { 631 XBaseWindow.ungrabInput(); 632 return; 633 } catch (Throwable thr) { 634 XBaseWindow.ungrabInput(); 635 processException(thr); 636 } finally { 637 awtUnlock(); 638 } 639 } 640 } 641 642 static { 643 GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); 644 if (ge instanceof SunGraphicsEnvironment) { 645 ((SunGraphicsEnvironment)ge).addDisplayChangedListener( 646 new DisplayChangedListener() { 647 @Override 648 public void displayChanged() { 649 // 7045370: Reset the cached values 650 XToolkit.screenWidth = -1; 651 XToolkit.screenHeight = -1; 652 } 653 654 @Override 655 public void paletteChanged() {} 656 }); 657 } 658 } 659 660 private static void initScreenSize() { 661 if (screenWidth == -1 || screenHeight == -1) { 662 awtLock(); 663 try { 664 XWindowAttributes pattr = new XWindowAttributes(); 665 try { 666 XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(), pattr.pData); 667 screenWidth = pattr.get_width(); 668 screenHeight = pattr.get_height(); 669 } finally { 670 pattr.dispose(); 671 } 672 } finally { 673 awtUnlock(); 674 } 675 } 676 } 677 678 static int getDefaultScreenWidth() { 679 initScreenSize(); 680 return screenWidth; 681 } 682 683 static int getDefaultScreenHeight() { 684 initScreenSize(); 685 return screenHeight; 686 } | 599 XDragSourceContextPeer.processEvent(ev)) { 600 continue; 601 } 602 603 if (eventLog.isLoggable(PlatformLogger.Level.FINER)) { 604 eventLog.finer("{0}", ev); 605 } 606 607 // Check if input method consumes the event 608 long w = 0; 609 if (windowToXWindow(ev.get_xany().get_window()) != null) { 610 Component owner = 611 XKeyboardFocusManagerPeer.getInstance().getCurrentFocusOwner(); 612 if (owner != null) { 613 XWindow ownerWindow = AWTAccessor.getComponentAccessor().getPeer(owner); 614 if (ownerWindow != null) { 615 w = ownerWindow.getContentWindow(); 616 } 617 } 618 } 619 if (keyEventLog.isLoggable(PlatformLogger.Level.FINE) && ( 620 ev.get_type() == XConstants.KeyPress 621 || ev.get_type() == XConstants.KeyRelease)) { 622 keyEventLog.fine("before XFilterEvent:" + ev); 623 } 624 if (XlibWrapper.XFilterEvent(ev.getPData(), w)) { 625 continue; 626 } 627 if (keyEventLog.isLoggable(PlatformLogger.Level.FINE) && ( 628 ev.get_type() == XConstants.KeyPress 629 || ev.get_type() == XConstants.KeyRelease)) { 630 keyEventLog.fine( 631 "after XFilterEvent:" + ev); // IS THIS CORRECT? 632 } 633 634 dispatchEvent(ev); 635 } catch (ThreadDeath td) { 636 XBaseWindow.ungrabInput(); 637 return; 638 } catch (Throwable thr) { 639 XBaseWindow.ungrabInput(); 640 processException(thr); 641 } finally { 642 awtUnlock(); 643 } 644 } 645 } 646 647 /** 648 * Listener installed to detect display changes. 649 */ 650 private static final DisplayChangedListener displayChangedHandler = 651 new DisplayChangedListener() { 652 @Override 653 public void displayChanged() { 654 // 7045370: Reset the cached values 655 XToolkit.screenWidth = -1; 656 XToolkit.screenHeight = -1; 657 } 658 659 @Override 660 public void paletteChanged() { 661 } 662 }; 663 664 static { 665 GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); 666 if (ge instanceof SunGraphicsEnvironment) { 667 ((SunGraphicsEnvironment) ge).addDisplayChangedListener( 668 displayChangedHandler); 669 } 670 } 671 672 private static void initScreenSize() { 673 if (screenWidth == -1 || screenHeight == -1) { 674 awtLock(); 675 try { 676 XWindowAttributes pattr = new XWindowAttributes(); 677 try { 678 XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(), 679 XToolkit.getDefaultRootWindow(), 680 pattr.pData); 681 screenWidth = pattr.get_width(); 682 screenHeight = pattr.get_height(); 683 } finally { 684 pattr.dispose(); 685 } 686 } finally { 687 awtUnlock(); 688 } 689 } 690 } 691 692 static int getDefaultScreenWidth() { 693 initScreenSize(); 694 return screenWidth; 695 } 696 697 static int getDefaultScreenHeight() { 698 initScreenSize(); 699 return screenHeight; 700 } |