src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java

Print this page




   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
  23  * questions.
  24  */
  25 
  26 package sun.lwawt.macosx;
  27 
  28 import sun.lwawt.PlatformWindow;
  29 import sun.lwawt.LWWindowPeer;
  30 
  31 import sun.java2d.opengl.CGLLayer;
  32 import sun.java2d.SurfaceData;
  33 
  34 import sun.awt.CausedFocusEvent;
  35 
  36 import java.awt.*;
  37 





  38 import sun.util.logging.PlatformLogger;
  39 
  40 /*
  41  * Provides a lightweight implementation of the EmbeddedFrame.
  42  */
  43 public class CPlatformEmbeddedFrame implements PlatformWindow {
  44 
  45     private static final PlatformLogger focusLogger = PlatformLogger.getLogger("sun.lwawt.macosx.focus.CPlatformEmbeddedFrame");
  46 
  47     private CGLLayer windowLayer;
  48     private LWWindowPeer peer;
  49     private CEmbeddedFrame target;
  50 
  51     private volatile int screenX = 0;
  52     private volatile int screenY = 0;
  53 
  54     @Override // PlatformWindow
  55     public void initialize(Window target, final LWWindowPeer peer, PlatformWindow owner) {
  56         this.peer = peer;
  57         this.windowLayer = new CGLLayer(peer);


 117 
 118     @Override
 119     public Insets getInsets() {
 120         return new Insets(0, 0, 0, 0);
 121     }
 122 
 123     @Override
 124     public void toFront() {}
 125 
 126     @Override
 127     public void toBack() {}
 128 
 129     @Override
 130     public void setMenuBar(MenuBar mb) {}
 131 
 132     @Override
 133     public void setAlwaysOnTop(boolean value) {}
 134 
 135     // This method should be properly implemented for applets.
 136     // It returns null just as a stub.

 137     public PlatformWindow getTopmostPlatformWindowUnderMouse() { return null; }
 138 
 139     @Override
 140     public void updateFocusableWindowState() {}
 141 
 142     @Override
 143     public boolean rejectFocusRequest(CausedFocusEvent.Cause cause) {
 144         // Cross-app activation requests are not allowed.
 145         if (cause != CausedFocusEvent.Cause.MOUSE_EVENT &&
 146             !target.isParentWindowActive())
 147         {
 148             focusLogger.fine("the embedder is inactive, so the request is rejected");
 149             return true;
 150         }
 151         return false;
 152     }
 153 
 154     @Override
 155     public boolean requestWindowFocus() {
 156         return true;


 175     @Override
 176     public void updateIconImages() {}
 177 
 178     @Override
 179     public void setOpacity(float opacity) {}
 180 
 181     @Override
 182     public void setOpaque(boolean isOpaque) {}
 183 
 184     @Override
 185     public void enterFullScreenMode() {}
 186 
 187     @Override
 188     public void exitFullScreenMode() {}
 189 
 190     @Override
 191     public void setWindowState(int windowState) {}
 192 
 193     @Override
 194     public void setModalBlocked(boolean blocked) {}









 195 }


   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
  23  * questions.
  24  */
  25 
  26 package sun.lwawt.macosx;
  27 








  28 import java.awt.*;
  29 import sun.awt.CausedFocusEvent;
  30 import sun.java2d.SurfaceData;
  31 import sun.java2d.opengl.CGLLayer;
  32 import sun.lwawt.LWWindowPeer;
  33 import sun.lwawt.LWWindowPeer.PeerType;
  34 import sun.lwawt.PlatformWindow;
  35 import sun.util.logging.PlatformLogger;
  36 
  37 /*
  38  * Provides a lightweight implementation of the EmbeddedFrame.
  39  */
  40 public class CPlatformEmbeddedFrame implements PlatformWindow {
  41 
  42     private static final PlatformLogger focusLogger = PlatformLogger.getLogger("sun.lwawt.macosx.focus.CPlatformEmbeddedFrame");
  43 
  44     private CGLLayer windowLayer;
  45     private LWWindowPeer peer;
  46     private CEmbeddedFrame target;
  47 
  48     private volatile int screenX = 0;
  49     private volatile int screenY = 0;
  50 
  51     @Override // PlatformWindow
  52     public void initialize(Window target, final LWWindowPeer peer, PlatformWindow owner) {
  53         this.peer = peer;
  54         this.windowLayer = new CGLLayer(peer);


 114 
 115     @Override
 116     public Insets getInsets() {
 117         return new Insets(0, 0, 0, 0);
 118     }
 119 
 120     @Override
 121     public void toFront() {}
 122 
 123     @Override
 124     public void toBack() {}
 125 
 126     @Override
 127     public void setMenuBar(MenuBar mb) {}
 128 
 129     @Override
 130     public void setAlwaysOnTop(boolean value) {}
 131 
 132     // This method should be properly implemented for applets.
 133     // It returns null just as a stub.
 134     @Override
 135     public PlatformWindow getTopmostPlatformWindowUnderMouse() { return null; }
 136 
 137     @Override
 138     public void updateFocusableWindowState() {}
 139 
 140     @Override
 141     public boolean rejectFocusRequest(CausedFocusEvent.Cause cause) {
 142         // Cross-app activation requests are not allowed.
 143         if (cause != CausedFocusEvent.Cause.MOUSE_EVENT &&
 144             !target.isParentWindowActive())
 145         {
 146             focusLogger.fine("the embedder is inactive, so the request is rejected");
 147             return true;
 148         }
 149         return false;
 150     }
 151 
 152     @Override
 153     public boolean requestWindowFocus() {
 154         return true;


 173     @Override
 174     public void updateIconImages() {}
 175 
 176     @Override
 177     public void setOpacity(float opacity) {}
 178 
 179     @Override
 180     public void setOpaque(boolean isOpaque) {}
 181 
 182     @Override
 183     public void enterFullScreenMode() {}
 184 
 185     @Override
 186     public void exitFullScreenMode() {}
 187 
 188     @Override
 189     public void setWindowState(int windowState) {}
 190 
 191     @Override
 192     public void setModalBlocked(boolean blocked) {}
 193 
 194     /*
 195      * The method could not be implemented due to CALayer restrictions.
 196      * The exeption enforce clients not to use it.
 197      */
 198     @Override
 199     public boolean isUnderMouse() {
 200         throw new RuntimeException("Not implemented");
 201     }
 202 }