< prev index next >

src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java

Print this page


   1 /*
   2  * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 540     // NOTE: This method may be called by privileged threads.
 541     //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
 542     public void handleIconify() {
 543         postEvent(new WindowEvent((Window)target, WindowEvent.WINDOW_ICONIFIED));
 544     }
 545 
 546     // NOTE: This method may be called by privileged threads.
 547     //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
 548     public void handleDeiconify() {
 549         postEvent(new WindowEvent((Window)target, WindowEvent.WINDOW_DEICONIFIED));
 550     }
 551 
 552     // NOTE: This method may be called by privileged threads.
 553     //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
 554     public void handleStateChange(int oldState, int newState) {
 555         postEvent(new WindowEvent((Window)target,
 556                                   WindowEvent.WINDOW_STATE_CHANGED,
 557                                   oldState, newState));
 558     }
 559 
 560     /**
 561      * DEPRECATED:  Replaced by getInsets().
 562      */
 563     public Insets insets() {
 564         return getInsets();
 565     }
 566 
 567     boolean isAutoRequestFocus() {
 568         if (XToolkit.isToolkitThread()) {
 569             return AWTAccessor.getWindowAccessor().isAutoRequestFocus((Window)target);
 570         } else {
 571             return ((Window)target).isAutoRequestFocus();
 572         }
 573     }
 574 
 575     /*
 576      * Retrives real native focused window and converts it into Java peer.
 577      */
 578     static XWindowPeer getNativeFocusedWindowPeer() {
 579         XBaseWindow baseWindow = XToolkit.windowToXWindow(xGetInputFocus());
 580         return (baseWindow instanceof XWindowPeer) ? (XWindowPeer)baseWindow :
 581                (baseWindow instanceof XFocusProxyWindow) ?
 582                ((XFocusProxyWindow)baseWindow).getOwner() : null;
 583     }
 584 
 585     /*
 586      * Retrives real native focused window and converts it into Java window.


   1 /*
   2  * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 540     // NOTE: This method may be called by privileged threads.
 541     //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
 542     public void handleIconify() {
 543         postEvent(new WindowEvent((Window)target, WindowEvent.WINDOW_ICONIFIED));
 544     }
 545 
 546     // NOTE: This method may be called by privileged threads.
 547     //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
 548     public void handleDeiconify() {
 549         postEvent(new WindowEvent((Window)target, WindowEvent.WINDOW_DEICONIFIED));
 550     }
 551 
 552     // NOTE: This method may be called by privileged threads.
 553     //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
 554     public void handleStateChange(int oldState, int newState) {
 555         postEvent(new WindowEvent((Window)target,
 556                                   WindowEvent.WINDOW_STATE_CHANGED,
 557                                   oldState, newState));
 558     }
 559 







 560     boolean isAutoRequestFocus() {
 561         if (XToolkit.isToolkitThread()) {
 562             return AWTAccessor.getWindowAccessor().isAutoRequestFocus((Window)target);
 563         } else {
 564             return ((Window)target).isAutoRequestFocus();
 565         }
 566     }
 567 
 568     /*
 569      * Retrives real native focused window and converts it into Java peer.
 570      */
 571     static XWindowPeer getNativeFocusedWindowPeer() {
 572         XBaseWindow baseWindow = XToolkit.windowToXWindow(xGetInputFocus());
 573         return (baseWindow instanceof XWindowPeer) ? (XWindowPeer)baseWindow :
 574                (baseWindow instanceof XFocusProxyWindow) ?
 575                ((XFocusProxyWindow)baseWindow).getOwner() : null;
 576     }
 577 
 578     /*
 579      * Retrives real native focused window and converts it into Java window.


< prev index next >