jdk/src/solaris/classes/sun/awt/X11/XDragSourceProtocol.java
author omajid
Mon, 04 Jun 2012 16:39:12 -0400
changeset 12829 506020af237a
parent 5506 202f599c92aa
child 17679 a81555868357
permissions -rw-r--r--
7043963: AWT workaround missing for Mutter. Reviewed-by: art, anthony Contributed-by: Denis Lila <dlila@redhat.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2802
diff changeset
     2
 * Copyright (c) 2003, 2008, Oracle and/or its affiliates. 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
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2802
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2802
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
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
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2802
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2802
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2802
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.awt.X11;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.datatransfer.Transferable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.awt.dnd.DnDConstants;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.awt.dnd.InvalidDnDOperationException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.util.Map;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * An abstract class for drag protocols on X11 systems.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * Contains protocol-independent drag source code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
abstract class XDragSourceProtocol {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
    private final XDragSourceProtocolListener listener;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    private boolean initialized = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    private long targetWindow = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    private long targetProxyWindow = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    private int targetProtocolVersion = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    private long targetWindowMask = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    // Always use the XAWT root window as the drag source window.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    static long getDragSourceWindow() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
        return XWindow.getXAWTRootWindow().getWindow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    protected XDragSourceProtocol(XDragSourceProtocolListener listener) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
        if (listener == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
            throw new NullPointerException("Null XDragSourceProtocolListener");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
        this.listener = listener;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    protected final XDragSourceProtocolListener getProtocolListener() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
        return listener;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * Returns the protocol name. The protocol name cannot be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    public abstract String getProtocolName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * Initalizes a drag operation with the specified supported drop actions,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * contents and data formats.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * @param actions a bitwise mask of <code>DnDConstants</code> that represent
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     *                the supported drop actions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * @param contents the contents for the drag operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * @param formats an array of Atoms that represent the supported data formats.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * @param formats an array of Atoms that represent the supported data formats.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * @throws InvalidDnDOperationException if a drag operation is already
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * initialized.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * @throws IllegalArgumentException if some argument has invalid value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * @throws XException if some X call failed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    public final void initializeDrag(int actions, Transferable contents,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
                                     Map formatMap, long[] formats)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
      throws InvalidDnDOperationException,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
             IllegalArgumentException, XException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        XToolkit.awtLock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
                if (initialized) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
                    throw new InvalidDnDOperationException("Already initialized");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
                initializeDragImpl(actions, contents, formatMap, formats);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
                initialized = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
            } finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
                if (!initialized) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
                    cleanup();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        } finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
            XToolkit.awtUnlock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    /* The caller must hold AWT_LOCK. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    protected abstract void initializeDragImpl(int actions,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
                                               Transferable contents,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
                                               Map formatMap, long[] formats)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
      throws InvalidDnDOperationException, IllegalArgumentException, XException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * Terminates the current drag operation (if any) and resets the internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * state of this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * @throws XException if some X call failed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    public void cleanup() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        initialized = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        cleanupTargetInfo();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * Clears the information on the current drop target.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * @throws XException if some X call failed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    public void cleanupTargetInfo() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        targetWindow = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        targetProxyWindow = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        targetProtocolVersion = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * Processes the specified client message event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * @returns true if the event was successfully processed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    public abstract boolean processClientMessage(XClientMessageEvent xclient)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
      throws XException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    /* The caller must hold AWT_LOCK. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    public final boolean attachTargetWindow(long window, long time) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        assert XToolkit.isAWTLockHeldByCurrentThread();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        TargetWindowInfo info = getTargetWindowInfo(window);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        if (info == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            targetWindow = window;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
            targetProxyWindow = info.getProxyWindow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
            targetProtocolVersion = info.getProtocolVersion();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    /* The caller must hold AWT_LOCK. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    public abstract TargetWindowInfo getTargetWindowInfo(long window);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    /* The caller must hold AWT_LOCK. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    public abstract void sendEnterMessage(long[] formats, int sourceAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
                                          int sourceActions, long time);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    /* The caller must hold AWT_LOCK. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    public abstract void sendMoveMessage(int xRoot, int yRoot,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
                                         int sourceAction, int sourceActions,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
                                         long time);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    /* The caller must hold AWT_LOCK. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    public abstract void sendLeaveMessage(long time);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    /* The caller must hold AWT_LOCK. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    protected abstract void sendDropMessage(int xRoot, int yRoot,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
                                            int sourceAction, int sourceActions,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
                                            long time);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    public final void initiateDrop(int xRoot, int yRoot,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
                                   int sourceAction, int sourceActions,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                                   long time) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        XWindowAttributes wattr = new XWindowAttributes();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        try {
2802
d05a9dcc8296 6678385: Random java.lang.StackOverflowError from various JDKs
art
parents: 439
diff changeset
   184
            XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
            int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
                                                          targetWindow, wattr.pData);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
            XToolkit.RESTORE_XERROR_HANDLER();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
            if (status == 0 ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
                (XToolkit.saved_error != null &&
439
3488710b02f8 6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents: 2
diff changeset
   192
                 XToolkit.saved_error.get_error_code() != XConstants.Success)) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
                throw new XException("XGetWindowAttributes failed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
            targetWindowMask = wattr.get_your_event_mask();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        } finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
            wattr.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
2802
d05a9dcc8296 6678385: Random java.lang.StackOverflowError from various JDKs
art
parents: 439
diff changeset
   201
        XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        XlibWrapper.XSelectInput(XToolkit.getDisplay(), targetWindow,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
                                 targetWindowMask |
439
3488710b02f8 6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents: 2
diff changeset
   204
                                 XConstants.StructureNotifyMask);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        XToolkit.RESTORE_XERROR_HANDLER();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        if (XToolkit.saved_error != null &&
439
3488710b02f8 6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents: 2
diff changeset
   209
            XToolkit.saved_error.get_error_code() != XConstants.Success) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
            throw new XException("XSelectInput failed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        sendDropMessage(xRoot, yRoot, sourceAction, sourceActions, time);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    protected final void finalizeDrop() {
2802
d05a9dcc8296 6678385: Random java.lang.StackOverflowError from various JDKs
art
parents: 439
diff changeset
   217
        XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        XlibWrapper.XSelectInput(XToolkit.getDisplay(), targetWindow,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
                                 targetWindowMask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        XToolkit.RESTORE_XERROR_HANDLER();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    public abstract boolean processProxyModeEvent(XClientMessageEvent xclient,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
                                                  long sourceWindow);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    protected final long getTargetWindow() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        return targetWindow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    protected final long getTargetProxyWindow() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        if (targetProxyWindow != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
            return targetProxyWindow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
            return targetWindow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    protected final int getTargetProtocolVersion() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
        return targetProtocolVersion;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    public static class TargetWindowInfo {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
        private final long proxyWindow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        private final int protocolVersion;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
        public TargetWindowInfo(long proxy, int version) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
            proxyWindow = proxy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
            protocolVersion = version;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        public long getProxyWindow() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
            return proxyWindow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
        public int getProtocolVersion() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
            return protocolVersion;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
}