jdk/src/solaris/classes/sun/awt/X11/XTranslateCoordinates.java
author lana
Thu, 26 Dec 2013 12:04:16 -0800
changeset 23010 6dadb192ad81
parent 17679 a81555868357
permissions -rw-r--r--
8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013 Summary: updated files with 2011, 2012 and 2013 years according to the file's last updated date Reviewed-by: tbell, lancea, chegar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
17679
a81555868357 8005607: Recursion in J2DXErrHandler() Causes a Stack Overflow on Linux
alitvinov
parents: 5506
diff changeset
     2
 * Copyright (c) 2003, 2013, 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
// This file is an automatically generated file, please do not edit this file, modify the WrapperGenerator.java file instead !
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
package sun.awt.X11;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import sun.misc.Unsafe;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
public class XTranslateCoordinates {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
        private static Unsafe unsafe = XlibWrapper.unsafe;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
        private boolean __executed = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
        long _scr_w;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
        long _dest_w;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
        int _src_x;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
        int _src_y;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
        long dest_x_ptr = unsafe.allocateMemory(Native.getIntSize());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
        long dest_y_ptr = unsafe.allocateMemory(Native.getIntSize());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
        long child_ptr = unsafe.allocateMemory(Native.getLongSize());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
        public XTranslateCoordinates(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
                long scr_w,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
                long dest_w,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
                int src_x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
                int src_y       )
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
                set_scr_w(scr_w);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
                set_dest_w(dest_w);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
                set_src_x(src_x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
                set_src_y(src_y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
                sun.java2d.Disposer.addRecord(this, disposer = new UnsafeXDisposerRecord("XTranslateCoordinates",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
                                                                                         dest_x_ptr, dest_y_ptr, child_ptr));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    UnsafeXDisposerRecord disposer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
        public int execute() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
                return execute(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
        }
2802
d05a9dcc8296 6678385: Random java.lang.StackOverflowError from various JDKs
art
parents: 2
diff changeset
    60
        public int execute(XErrorHandler errorHandler) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
                XToolkit.awtLock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
                if (isDisposed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
                    throw new IllegalStateException("Disposed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
                        if (__executed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
                            throw new IllegalStateException("Already executed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
                        __executed = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
                        if (errorHandler != null) {
17679
a81555868357 8005607: Recursion in J2DXErrHandler() Causes a Stack Overflow on Linux
alitvinov
parents: 5506
diff changeset
    71
                            XErrorHandlerUtil.WITH_XERROR_HANDLER(errorHandler);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
                        int status =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
                        XlibWrapper.XTranslateCoordinates(XToolkit.getDisplay(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
                                get_scr_w(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
                                get_dest_w(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
                                get_src_x(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
                                get_src_y(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
                                dest_x_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
                                dest_y_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
                                child_ptr                       );
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
                        if (errorHandler != null) {
17679
a81555868357 8005607: Recursion in J2DXErrHandler() Causes a Stack Overflow on Linux
alitvinov
parents: 5506
diff changeset
    83
                            XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
                        return status;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
                } finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
                    XToolkit.awtUnlock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        public boolean isExecuted() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
            return __executed;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        public boolean isDisposed() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
            return disposer.disposed;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        public void dispose() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
            XToolkit.awtLock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
                if (isDisposed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
                    return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
                disposer.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
            } finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
                XToolkit.awtUnlock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        public long get_scr_w() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
                if (isDisposed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
                    throw new IllegalStateException("Disposed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
                if (!__executed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
                    throw new IllegalStateException("Not executed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
                return _scr_w;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        public void set_scr_w(long data) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
                _scr_w = data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        public long get_dest_w() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
                if (isDisposed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
                    throw new IllegalStateException("Disposed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
                if (!__executed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
                    throw new IllegalStateException("Not executed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
                return _dest_w;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        public void set_dest_w(long data) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                _dest_w = data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        public int get_src_x() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
                if (isDisposed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
                    throw new IllegalStateException("Disposed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
                if (!__executed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
                    throw new IllegalStateException("Not executed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                return _src_x;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        public void set_src_x(int data) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
                _src_x = data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        public int get_src_y() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
                if (isDisposed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                    throw new IllegalStateException("Disposed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
                if (!__executed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
                    throw new IllegalStateException("Not executed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                return _src_y;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        public void set_src_y(int data) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
                _src_y = data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        public int get_dest_x() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
                if (isDisposed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                    throw new IllegalStateException("Disposed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                if (!__executed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                    throw new IllegalStateException("Not executed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
                return Native.getInt(dest_x_ptr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        public void set_dest_x(int data) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
                Native.putInt(dest_x_ptr, data);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        public int get_dest_y() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
                if (isDisposed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
                    throw new IllegalStateException("Disposed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
                if (!__executed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
                    throw new IllegalStateException("Not executed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
                return Native.getInt(dest_y_ptr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        public void set_dest_y(int data) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                Native.putInt(dest_y_ptr, data);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        public long get_child() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                if (isDisposed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                    throw new IllegalStateException("Disposed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
                if (!__executed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
                    throw new IllegalStateException("Not executed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
                return Native.getLong(child_ptr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        public void set_child(long data) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
                Native.putLong(child_ptr, data);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
}