1 /*
   2  * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 // This file is an automatically generated file, please do not edit this file, modify the WrapperGenerator.java file instead !
  27 
  28 package sun.awt.X11;
  29 
  30 import sun.misc.Unsafe;
  31 
  32 public class XTranslateCoordinates {
  33         private static Unsafe unsafe = XlibWrapper.unsafe;
  34         private boolean __executed = false;
  35         long _scr_w;
  36         long _dest_w;
  37         int _src_x;
  38         int _src_y;
  39         long dest_x_ptr = unsafe.allocateMemory(Native.getIntSize());
  40         long dest_y_ptr = unsafe.allocateMemory(Native.getIntSize());
  41         long child_ptr = unsafe.allocateMemory(Native.getLongSize());
  42         public XTranslateCoordinates(
  43                 long scr_w,
  44                 long dest_w,
  45                 int src_x,
  46                 int src_y       )
  47         {
  48                 set_scr_w(scr_w);
  49                 set_dest_w(dest_w);
  50                 set_src_x(src_x);
  51                 set_src_y(src_y);
  52 
  53                 sun.java2d.Disposer.addRecord(this, disposer = new UnsafeXDisposerRecord("XTranslateCoordinates",
  54                                                                                          dest_x_ptr, dest_y_ptr, child_ptr));
  55         }
  56     UnsafeXDisposerRecord disposer;
  57         public int execute() {
  58                 return execute(null);
  59         }
  60         public int execute(XErrorHandler errorHandler) {
  61                 XToolkit.awtLock();
  62                 try {
  63                 if (isDisposed()) {
  64                     throw new IllegalStateException("Disposed");
  65                 }
  66                         if (__executed) {
  67                             throw new IllegalStateException("Already executed");
  68                         }
  69                         __executed = true;
  70                         if (errorHandler != null) {
  71                             XErrorHandlerUtil.WITH_XERROR_HANDLER(errorHandler);
  72                         }
  73                         int status =
  74                         XlibWrapper.XTranslateCoordinates(XToolkit.getDisplay(),
  75                                 get_scr_w(),
  76                                 get_dest_w(),
  77                                 get_src_x(),
  78                                 get_src_y(),
  79                                 dest_x_ptr,
  80                                 dest_y_ptr,
  81                                 child_ptr                       );
  82                         if (errorHandler != null) {
  83                             XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
  84                         }
  85                         return status;
  86                 } finally {
  87                     XToolkit.awtUnlock();
  88                 }
  89         }
  90         public boolean isExecuted() {
  91             return __executed;
  92         }
  93 
  94         public boolean isDisposed() {
  95             return disposer.disposed;
  96         }
  97         public void dispose() {
  98             XToolkit.awtLock();
  99             try {
 100                 if (isDisposed()) {
 101                     return;
 102                 }
 103                 disposer.dispose();
 104             } finally {
 105                 XToolkit.awtUnlock();
 106             }
 107         }
 108         public long get_scr_w() {
 109                 if (isDisposed()) {
 110                     throw new IllegalStateException("Disposed");
 111                 }
 112                 if (!__executed) {
 113                     throw new IllegalStateException("Not executed");
 114                 }
 115                 return _scr_w;
 116         }
 117         public void set_scr_w(long data) {
 118                 _scr_w = data;
 119         }
 120         public long get_dest_w() {
 121                 if (isDisposed()) {
 122                     throw new IllegalStateException("Disposed");
 123                 }
 124                 if (!__executed) {
 125                     throw new IllegalStateException("Not executed");
 126                 }
 127                 return _dest_w;
 128         }
 129         public void set_dest_w(long data) {
 130                 _dest_w = data;
 131         }
 132         public int get_src_x() {
 133                 if (isDisposed()) {
 134                     throw new IllegalStateException("Disposed");
 135                 }
 136                 if (!__executed) {
 137                     throw new IllegalStateException("Not executed");
 138                 }
 139                 return _src_x;
 140         }
 141         public void set_src_x(int data) {
 142                 _src_x = data;
 143         }
 144         public int get_src_y() {
 145                 if (isDisposed()) {
 146                     throw new IllegalStateException("Disposed");
 147                 }
 148                 if (!__executed) {
 149                     throw new IllegalStateException("Not executed");
 150                 }
 151                 return _src_y;
 152         }
 153         public void set_src_y(int data) {
 154                 _src_y = data;
 155         }
 156         public int get_dest_x() {
 157                 if (isDisposed()) {
 158                     throw new IllegalStateException("Disposed");
 159                 }
 160                 if (!__executed) {
 161                     throw new IllegalStateException("Not executed");
 162                 }
 163                 return Native.getInt(dest_x_ptr);
 164         }
 165         public void set_dest_x(int data) {
 166                 Native.putInt(dest_x_ptr, data);
 167         }
 168         public int get_dest_y() {
 169                 if (isDisposed()) {
 170                     throw new IllegalStateException("Disposed");
 171                 }
 172                 if (!__executed) {
 173                     throw new IllegalStateException("Not executed");
 174                 }
 175                 return Native.getInt(dest_y_ptr);
 176         }
 177         public void set_dest_y(int data) {
 178                 Native.putInt(dest_y_ptr, data);
 179         }
 180         public long get_child() {
 181                 if (isDisposed()) {
 182                     throw new IllegalStateException("Disposed");
 183                 }
 184                 if (!__executed) {
 185                     throw new IllegalStateException("Not executed");
 186                 }
 187                 return Native.getLong(child_ptr);
 188         }
 189         public void set_child(long data) {
 190                 Native.putLong(child_ptr, data);
 191         }
 192 }