< prev index next >
src/java.desktop/unix/classes/sun/awt/X11/XlibUtil.java
Print this page
*** 100,110 ****
}
/**
* Returns the bounds of the given window, in absolute coordinates
*/
! static Rectangle getWindowGeometry(long window)
{
XToolkit.awtLock();
try
{
int res = XlibWrapper.XGetGeometry(XToolkit.getDisplay(),
--- 100,110 ----
}
/**
* Returns the bounds of the given window, in absolute coordinates
*/
! static Rectangle getWindowGeometry(long window, int scale)
{
XToolkit.awtLock();
try
{
int res = XlibWrapper.XGetGeometry(XToolkit.getDisplay(),
*** 124,134 ****
int x = Native.getInt(XlibWrapper.larg2);
int y = Native.getInt(XlibWrapper.larg3);
long width = Native.getUInt(XlibWrapper.larg4);
long height = Native.getUInt(XlibWrapper.larg5);
! return new Rectangle(x, y, (int)width, (int)height);
}
finally
{
XToolkit.awtUnlock();
}
--- 124,136 ----
int x = Native.getInt(XlibWrapper.larg2);
int y = Native.getInt(XlibWrapper.larg3);
long width = Native.getUInt(XlibWrapper.larg4);
long height = Native.getUInt(XlibWrapper.larg5);
! return new Rectangle(scaleDown(x, scale), scaleDown(y, scale),
! scaleDown((int) width, scale),
! scaleDown((int) height, scale));
}
finally
{
XToolkit.awtUnlock();
}
*** 136,162 ****
/**
* Translates the given point from one window to another. Returns
* null if the translation is failed
*/
! static Point translateCoordinates(long src, long dst, Point p)
{
Point translated = null;
XToolkit.awtLock();
try
{
XTranslateCoordinates xtc =
! new XTranslateCoordinates(src, dst, p.x, p.y);
try
{
int status = xtc.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if ((status != 0) &&
((XErrorHandlerUtil.saved_error == null) ||
(XErrorHandlerUtil.saved_error.get_error_code() == XConstants.Success)))
{
! translated = new Point(xtc.get_dest_x(), xtc.get_dest_y());
}
}
finally
{
xtc.dispose();
--- 138,165 ----
/**
* Translates the given point from one window to another. Returns
* null if the translation is failed
*/
! static Point translateCoordinates(long src, long dst, Point p, int scale)
{
Point translated = null;
XToolkit.awtLock();
try
{
XTranslateCoordinates xtc =
! new XTranslateCoordinates(src, dst, p.x * scale, p.y * scale);
try
{
int status = xtc.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if ((status != 0) &&
((XErrorHandlerUtil.saved_error == null) ||
(XErrorHandlerUtil.saved_error.get_error_code() == XConstants.Success)))
{
! translated = new Point(scaleDown(xtc.get_dest_x(), scale),
! scaleDown(xtc.get_dest_y(), scale));
}
}
finally
{
xtc.dispose();
*** 172,184 ****
/**
* Translates the given rectangle from one window to another.
* Returns null if the translation is failed
*/
! static Rectangle translateCoordinates(long src, long dst, Rectangle r)
{
! Point translatedLoc = translateCoordinates(src, dst, r.getLocation());
if (translatedLoc == null)
{
return null;
}
else
--- 175,190 ----
/**
* Translates the given rectangle from one window to another.
* Returns null if the translation is failed
*/
! static Rectangle translateCoordinates(long src, long dst, Rectangle r,
! int scale)
{
! Point translatedLoc = translateCoordinates(src, dst, r.getLocation(),
! scale);
!
if (translatedLoc == null)
{
return null;
}
else
*** 404,409 ****
--- 410,419 ----
return 0;
} else {
return 1 << (7 + button);
}
}
+
+ static int scaleDown(int x, int scale) {
+ return x / scale;
+ }
}
< prev index next >