src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformLWWindow.java
author serb
Tue, 01 Oct 2019 10:28:12 -0700
changeset 58597 4ff14948c6a1
parent 47216 71c04702a3d5
permissions -rw-r--r--
7124404: [macosx] no awt.multiClickInterval desktop property Reviewed-by: dmarkov
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
     1
/*
37694
c064aefc5a2f 8080395: consider making sun.awt.CausedFocusEvent functionality public
ssadetsky
parents: 30924
diff changeset
     2
 * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
     4
 *
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    10
 *
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    15
 * accompanied this code).
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    16
 *
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    20
 *
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    23
 * questions.
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    24
 */
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    25
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    26
package sun.lwawt.macosx;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    27
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    28
import java.awt.Font;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    29
import java.awt.FontMetrics;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    30
import java.awt.GraphicsDevice;
25195
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
    31
import java.awt.GraphicsEnvironment;
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    32
import java.awt.Insets;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    33
import java.awt.MenuBar;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    34
import java.awt.Point;
25195
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
    35
import java.awt.Rectangle;
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    36
import java.awt.Window;
25195
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
    37
import sun.awt.CGraphicsDevice;
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
    38
import sun.awt.CGraphicsEnvironment;
37694
c064aefc5a2f 8080395: consider making sun.awt.CausedFocusEvent functionality public
ssadetsky
parents: 30924
diff changeset
    39
import java.awt.event.FocusEvent;
25195
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
    40
import sun.awt.LightweightFrame;
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    41
import sun.java2d.SurfaceData;
25195
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
    42
import sun.lwawt.LWLightweightFramePeer;
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    43
import sun.lwawt.LWWindowPeer;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    44
import sun.lwawt.PlatformWindow;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    45
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    46
public class CPlatformLWWindow extends CPlatformWindow {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    47
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    48
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    49
    public void initialize(Window target, LWWindowPeer peer, PlatformWindow owner) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    50
        initializeBase(target, peer, owner, new CPlatformLWView());
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    51
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    52
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    53
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    54
    public void toggleFullScreen() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    55
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    56
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    57
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    58
    public void setMenuBar(MenuBar mb) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    59
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    60
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    61
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    62
    public void dispose() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    63
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    64
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    65
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    66
    public FontMetrics getFontMetrics(Font f) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    67
        return null;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    68
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    69
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    70
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    71
    public Insets getInsets() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    72
        return new Insets(0, 0, 0, 0);
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    73
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    74
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    75
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    76
    public Point getLocationOnScreen() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    77
        return null;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    78
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    79
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    80
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    81
    public SurfaceData getScreenSurface() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    82
        return null;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    83
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    84
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    85
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    86
    public SurfaceData replaceSurfaceData() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    87
        return null;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    88
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    89
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    90
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    91
    public void setBounds(int x, int y, int w, int h) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    92
        if (getPeer() != null) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    93
            getPeer().notifyReshape(x, y, w, h);
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    94
        }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    95
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    96
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    97
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    98
    public void setVisible(boolean visible) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    99
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   100
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   101
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   102
    public void setTitle(String title) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   103
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   104
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   105
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   106
    public void updateIconImages() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   107
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   108
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   109
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   110
    public SurfaceData getSurfaceData() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   111
        return null;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   112
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   113
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   114
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   115
    public void toBack() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   116
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   117
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   118
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   119
    public void toFront() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   120
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   121
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   122
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   123
    public void setResizable(final boolean resizable) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   124
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   125
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   126
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   127
    public void setSizeConstraints(int minW, int minH, int maxW, int maxH) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   128
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   129
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   130
    @Override
37694
c064aefc5a2f 8080395: consider making sun.awt.CausedFocusEvent functionality public
ssadetsky
parents: 30924
diff changeset
   131
    public boolean rejectFocusRequest(FocusEvent.Cause cause) {
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   132
        return false;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   133
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   134
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   135
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   136
    public boolean requestWindowFocus() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   137
        return true;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   138
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   139
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   140
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   141
    public boolean isActive() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   142
        return true;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   143
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   144
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   145
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   146
    public void updateFocusableWindowState() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   147
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   148
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   149
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   150
    public void setAlwaysOnTop(boolean isAlwaysOnTop) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   151
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   152
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   153
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   154
    public void setOpacity(float opacity) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   155
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   156
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   157
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   158
    public void setOpaque(boolean isOpaque) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   159
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   160
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   161
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   162
    public void enterFullScreenMode() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   163
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   164
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   165
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   166
    public void exitFullScreenMode() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   167
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   168
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   169
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   170
    public void setWindowState(int windowState) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   171
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   172
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   173
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   174
    public LWWindowPeer getPeer() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   175
        return super.getPeer();
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   176
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   177
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   178
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   179
    public CPlatformView getContentView() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   180
        return super.getContentView();
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   181
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   182
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   183
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   184
    public long getLayerPtr() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   185
        return 0;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   186
    }
25195
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
   187
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
   188
    @Override
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
   189
    public GraphicsDevice getGraphicsDevice() {
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
   190
        CGraphicsEnvironment ge = (CGraphicsEnvironment)GraphicsEnvironment.
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
   191
                                  getLocalGraphicsEnvironment();
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
   192
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
   193
        LWLightweightFramePeer peer = (LWLightweightFramePeer)getPeer();
42199
8c0e8e13d4d8 8153522: Update JLightweightFrame to allow non-integer (and X/Y) scales
ssadetsky
parents: 37700
diff changeset
   194
        int scale =(int) Math.round(((LightweightFrame)peer.getTarget())
8c0e8e13d4d8 8153522: Update JLightweightFrame to allow non-integer (and X/Y) scales
ssadetsky
parents: 37700
diff changeset
   195
                                                            .getScaleFactorX());
25195
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
   196
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
   197
        Rectangle bounds = ((LightweightFrame)peer.getTarget()).getHostBounds();
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
   198
        for (GraphicsDevice d : ge.getScreenDevices()) {
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
   199
            if (d.getDefaultConfiguration().getBounds().intersects(bounds) &&
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
   200
                ((CGraphicsDevice)d).getScaleFactor() == scale)
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
   201
            {
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
   202
                return d;
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
   203
            }
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
   204
        }
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
   205
        // We shouldn't be here...
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
   206
        return ge.getDefaultScreenDevice();
9de77f5b0df2 8029455: [JLightweightFrame] support scaled painting
serb
parents: 15983
diff changeset
   207
    }
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   208
}