|
1 | 1 | /* |
2 | | - * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 4 | * |
5 | 5 | * This code is free software; you can redistribute it and/or modify it |
@@ -1124,19 +1124,6 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XWindow_x11inputMethodLookupString |
1124 | 1124 |
|
1125 | 1125 | extern struct X11GraphicsConfigIDs x11GraphicsConfigIDs; |
1126 | 1126 |
|
1127 | | -/* |
1128 | | - * Class: Java_sun_awt_X11_XWindow_getNativeColor |
1129 | | - * Method: getNativeColor |
1130 | | - * Signature (Ljava/awt/Color;Ljava/awt/GraphicsConfiguration;)I |
1131 | | - */ |
1132 | | -JNIEXPORT jint JNICALL Java_sun_awt_X11_XWindow_getNativeColor |
1133 | | -(JNIEnv *env, jobject this, jobject color, jobject gc_object) { |
1134 | | - AwtGraphicsConfigDataPtr adata; |
1135 | | - /* fire warning because JNU_GetLongFieldAsPtr casts jlong to (void *) */ |
1136 | | - adata = (AwtGraphicsConfigDataPtr) JNU_GetLongFieldAsPtr(env, gc_object, x11GraphicsConfigIDs.aData); |
1137 | | - return awtJNI_GetColorForVis(env, color, adata); |
1138 | | -} |
1139 | | - |
1140 | 1127 | /* syncTopLevelPos() is necessary to insure that the window manager has in |
1141 | 1128 | * fact moved us to our final position relative to the reParented WM window. |
1142 | 1129 | * We have noted a timing window which our shell has not been moved so we |
@@ -1164,84 +1151,6 @@ void syncTopLevelPos( Display *d, Window w, XWindowAttributes *winAttr ) { |
1164 | 1151 | } while (i++ < 50); |
1165 | 1152 | } |
1166 | 1153 |
|
1167 | | -static Window getTopWindow(Window win, Window *rootWin) |
1168 | | -{ |
1169 | | - Window root=None, current_window=win, parent=None, *ignore_children=NULL; |
1170 | | - Window prev_window=None; |
1171 | | - unsigned int ignore_uint=0; |
1172 | | - Status status = 0; |
1173 | | - |
1174 | | - if (win == None) return None; |
1175 | | - do { |
1176 | | - status = XQueryTree(awt_display, |
1177 | | - current_window, |
1178 | | - &root, |
1179 | | - &parent, |
1180 | | - &ignore_children, |
1181 | | - &ignore_uint); |
1182 | | - XFree(ignore_children); |
1183 | | - if (status == 0) return None; |
1184 | | - prev_window = current_window; |
1185 | | - current_window = parent; |
1186 | | - } while (parent != root); |
1187 | | - *rootWin = root; |
1188 | | - return prev_window; |
1189 | | -} |
1190 | | - |
1191 | | -JNIEXPORT jlong JNICALL Java_sun_awt_X11_XWindow_getTopWindow |
1192 | | -(JNIEnv *env, jclass clazz, jlong win, jlong rootWin) { |
1193 | | - return getTopWindow((Window) win, (Window*) jlong_to_ptr(rootWin)); |
1194 | | -} |
1195 | | - |
1196 | | -static void |
1197 | | -getWMInsets |
1198 | | -(Window window, int *left, int *top, int *right, int *bottom, int *border) { |
1199 | | - // window is event->xreparent.window |
1200 | | - Window topWin = None, rootWin = None, containerWindow = None; |
1201 | | - XWindowAttributes winAttr, topAttr; |
1202 | | - int screenX, screenY; |
1203 | | - topWin = getTopWindow(window, &rootWin); |
1204 | | - syncTopLevelPos(awt_display, topWin, &topAttr); |
1205 | | - // (screenX, screenY) is (0,0) of the reparented window |
1206 | | - // converted to screen coordinates. |
1207 | | - XTranslateCoordinates(awt_display, window, rootWin, |
1208 | | - 0,0, &screenX, &screenY, &containerWindow); |
1209 | | - *left = screenX - topAttr.x - topAttr.border_width; |
1210 | | - *top = screenY - topAttr.y - topAttr.border_width; |
1211 | | - XGetWindowAttributes(awt_display, window, &winAttr); |
1212 | | - *right = topAttr.width - ((winAttr.width) + *left); |
1213 | | - *bottom = topAttr.height - ((winAttr.height) + *top); |
1214 | | - *border = topAttr.border_width; |
1215 | | -} |
1216 | | - |
1217 | | -JNIEXPORT void JNICALL Java_sun_awt_X11_XWindow_getWMInsets |
1218 | | -(JNIEnv *env, jclass clazz, jlong window, jlong left, jlong top, jlong right, jlong bottom, jlong border) { |
1219 | | - getWMInsets((Window) window, |
1220 | | - (int*) jlong_to_ptr(left), |
1221 | | - (int*) jlong_to_ptr(top), |
1222 | | - (int*) jlong_to_ptr(right), |
1223 | | - (int*) jlong_to_ptr(bottom), |
1224 | | - (int*) jlong_to_ptr(border)); |
1225 | | -} |
1226 | | - |
1227 | | -static void |
1228 | | -getWindowBounds |
1229 | | -(Window window, int *x, int *y, int *width, int *height) { |
1230 | | - XWindowAttributes winAttr; |
1231 | | - XSync(awt_display, False); |
1232 | | - XGetWindowAttributes(awt_display, window, &winAttr); |
1233 | | - *x = winAttr.x; |
1234 | | - *y = winAttr.y; |
1235 | | - *width = winAttr.width; |
1236 | | - *height = winAttr.height; |
1237 | | -} |
1238 | | - |
1239 | | -JNIEXPORT void JNICALL Java_sun_awt_X11_XWindow_getWindowBounds |
1240 | | -(JNIEnv *env, jclass clazz, jlong window, jlong x, jlong y, jlong width, jlong height) { |
1241 | | - getWindowBounds((Window) window, (int*) jlong_to_ptr(x), (int*) jlong_to_ptr(y), |
1242 | | - (int*) jlong_to_ptr(width), (int*) jlong_to_ptr(height)); |
1243 | | -} |
1244 | | - |
1245 | 1154 | JNIEXPORT void JNICALL Java_sun_awt_X11_XWindow_setSizeHints |
1246 | 1155 | (JNIEnv *env, jclass clazz, jlong window, jlong x, jlong y, jlong width, jlong height) { |
1247 | 1156 | XSizeHints *size_hints = XAllocSizeHints(); |
|
0 commit comments