jdk/src/solaris/classes/sun/awt/X11/XWINProtocol.java
author mchung
Tue, 29 Sep 2009 16:03:03 -0700
changeset 3938 ef327bd847c0
parent 439 3488710b02f8
child 5506 202f599c92aa
permissions -rw-r--r--
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes Summary: Replace calls to Logger with sun.util.logging.PlatformLogger Reviewed-by: prr, art, alexp, dcherepanov, igor, dav, anthony
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
439
3488710b02f8 6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents: 2
diff changeset
     2
 * Copyright 2003-2008 Sun Microsystems, Inc.  All Rights Reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
package sun.awt.X11;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.awt.*;
3938
ef327bd847c0 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents: 439
diff changeset
    30
import sun.util.logging.PlatformLogger;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol {
3938
ef327bd847c0 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents: 439
diff changeset
    33
    final static PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XWINProtocol");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
/* Gnome WM spec  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
    XAtom XA_WIN_SUPPORTING_WM_CHECK = XAtom.get("_WIN_SUPPORTING_WM_CHECK");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
    XAtom XA_WIN_PROTOCOLS = XAtom.get("_WIN_PROTOCOLS");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
    XAtom XA_WIN_STATE = XAtom.get("_WIN_STATE");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
    public boolean supportsState(int state) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
        return doStateProtocol();   // TODO - check for Frame constants
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    public void setState(XWindowPeer window, int state) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
        if (window.isShowing()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
            /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
             * Request state transition from a Gnome WM (_WIN protocol) by sending
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
             * _WIN_STATE ClientMessage to root window.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
             */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
            long win_state = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
            if ( (state & Frame.MAXIMIZED_VERT) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
                win_state |= WIN_STATE_MAXIMIZED_VERT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
            if ( (state & Frame.MAXIMIZED_HORIZ) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
                win_state |= WIN_STATE_MAXIMIZED_HORIZ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
            XClientMessageEvent req = new XClientMessageEvent();
439
3488710b02f8 6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents: 2
diff changeset
    60
            req.set_type(XConstants.ClientMessage);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
            req.set_window(window.getWindow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
            req.set_message_type(XA_WIN_STATE.getAtom());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
            req.set_format(32);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
            req.set_data(0, (WIN_STATE_MAXIMIZED_HORIZ | WIN_STATE_MAXIMIZED_VERT));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
            req.set_data(1, win_state);
3938
ef327bd847c0 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents: 439
diff changeset
    66
            if (log.isLoggable(PlatformLogger.FINE)) log.fine("Sending WIN_STATE to root to change the state to " + win_state);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
                XToolkit.awtLock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
                XlibWrapper.XSendEvent(XToolkit.getDisplay(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
                        XlibWrapper.RootWindow(XToolkit.getDisplay(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
                            window.getScreenNumber()),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
                        false,
439
3488710b02f8 6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents: 2
diff changeset
    73
                        XConstants.SubstructureRedirectMask | XConstants.SubstructureNotifyMask,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
                        req.pData);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
            finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
                XToolkit.awtUnlock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
            req.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
            /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
             * Specify initial state for a Gnome WM (_WIN protocol) by setting
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
             * WIN_STATE property on the window to the desired state before
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
             * mapping it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
             */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
            /* Be careful to not wipe out state bits we don't understand */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
            long win_state = XA_WIN_STATE.getCard32Property(window);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
            long old_win_state = win_state;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
            /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
             * In their stupid quest of reinventing every wheel, Gnome WM spec
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
             * have its own "minimized" hint (instead of using initial state
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
             * and WM_STATE hints).  This is bogus, but, apparently, some WMs
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
             * pay attention.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
             */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
            if ((state & Frame.ICONIFIED) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
                win_state |= WIN_STATE_MINIMIZED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
                win_state &= ~WIN_STATE_MINIMIZED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
            if ((state & Frame.MAXIMIZED_VERT) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
                win_state |= WIN_STATE_MAXIMIZED_VERT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
                win_state &= ~WIN_STATE_MAXIMIZED_VERT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
            if ((state & Frame.MAXIMIZED_HORIZ) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
                win_state |= WIN_STATE_MAXIMIZED_HORIZ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
                win_state &= ~WIN_STATE_MAXIMIZED_HORIZ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
            if ((old_win_state ^ win_state) != 0) {
3938
ef327bd847c0 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents: 439
diff changeset
   114
                if (log.isLoggable(PlatformLogger.FINE)) log.fine("Setting WIN_STATE on " + window + " to change the state to " + win_state);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
                XA_WIN_STATE.setCard32Property(window, win_state);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    public int getState(XWindowPeer window) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        long win_state = XA_WIN_STATE.getCard32Property(window);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        int java_state = Frame.NORMAL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        if ((win_state & WIN_STATE_MAXIMIZED_VERT) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
            java_state |= Frame.MAXIMIZED_VERT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        if ((win_state & WIN_STATE_MAXIMIZED_HORIZ) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
            java_state |= Frame.MAXIMIZED_HORIZ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        return java_state;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    public boolean isStateChange(XPropertyEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        return doStateProtocol() && e.get_atom() == XA_WIN_STATE.getAtom();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    public void unshadeKludge(XWindowPeer window) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        long win_state = XA_WIN_STATE.getCard32Property(window);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        if ((win_state & WIN_STATE_SHADED) == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        win_state &= ~WIN_STATE_SHADED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        XA_WIN_STATE.setCard32Property(window, win_state);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    public boolean supportsLayer(int layer) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        return ((layer == LAYER_ALWAYS_ON_TOP) || (layer == LAYER_NORMAL)) && doLayerProtocol();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    public void setLayer(XWindowPeer window, int layer) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        if (window.isShowing()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
            XClientMessageEvent req = new XClientMessageEvent();
439
3488710b02f8 6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents: 2
diff changeset
   152
            req.set_type(XConstants.ClientMessage);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            req.set_window(window.getWindow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            req.set_message_type(XA_WIN_LAYER.getAtom());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
            req.set_format(32);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
            req.set_data(0, layer == LAYER_NORMAL ? WIN_LAYER_NORMAL : WIN_LAYER_ONTOP);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
            req.set_data(1, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
            req.set_data(2, 0);
3938
ef327bd847c0 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents: 439
diff changeset
   159
            if (log.isLoggable(PlatformLogger.FINE)) log.fine("Setting layer " + layer + " by root message : " + req);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
            XToolkit.awtLock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
                XlibWrapper.XSendEvent(XToolkit.getDisplay(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
                        XlibWrapper.RootWindow(XToolkit.getDisplay(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
                            window.getScreenNumber()),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
                        false,
439
3488710b02f8 6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents: 2
diff changeset
   166
                        /*XConstants.SubstructureRedirectMask | */XConstants.SubstructureNotifyMask,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
                        req.pData);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
            finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
                XToolkit.awtUnlock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
            req.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        } else {
3938
ef327bd847c0 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents: 439
diff changeset
   174
            if (log.isLoggable(PlatformLogger.FINE)) log.fine("Setting layer property to " + layer);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
            XA_WIN_LAYER.setCard32Property(window, layer == LAYER_NORMAL ? WIN_LAYER_NORMAL : WIN_LAYER_ONTOP);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    XAtom XA_WIN_LAYER = XAtom.get("_WIN_LAYER");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
/* _WIN_STATE bits */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    final static int WIN_STATE_STICKY          =(1<<0); /* everyone knows sticky            */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    final static int WIN_STATE_MINIMIZED       =(1<<1); /* Reserved - definition is unclear */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    final static int WIN_STATE_MAXIMIZED_VERT  =(1<<2); /* window in maximized V state      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    final static int WIN_STATE_MAXIMIZED_HORIZ =(1<<3); /* window in maximized H state      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    final static int WIN_STATE_HIDDEN          =(1<<4); /* not on taskbar but window visible*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    final static int WIN_STATE_SHADED          =(1<<5); /* shaded (MacOS / Afterstep style) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
/* _WIN_LAYER values */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    final static int WIN_LAYER_ONTOP = 6;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    final static int WIN_LAYER_NORMAL = 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    long WinWindow = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    boolean supportChecked = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    void detect() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        if (supportChecked) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        WinWindow = checkAnchor(XA_WIN_SUPPORTING_WM_CHECK, XAtom.XA_CARDINAL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        supportChecked = true;
3938
ef327bd847c0 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents: 439
diff changeset
   200
        if (log.isLoggable(PlatformLogger.FINE)) log.fine("### " + this + " is active: " + (WinWindow != 0));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    boolean active() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        detect();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        return WinWindow != 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    boolean doStateProtocol() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        boolean res = active() && checkProtocol(XA_WIN_PROTOCOLS, XA_WIN_STATE);
3938
ef327bd847c0 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents: 439
diff changeset
   209
        if (log.isLoggable(PlatformLogger.FINE)) log.fine("### " + this + " supports state: " + res);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        return res;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    boolean doLayerProtocol() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        boolean res = active() && checkProtocol(XA_WIN_PROTOCOLS, XA_WIN_LAYER);
3938
ef327bd847c0 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents: 439
diff changeset
   215
        if (log.isLoggable(PlatformLogger.FINE)) log.fine("### " + this + " supports layer: " + res);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        return res;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
}