/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#ifdef HEADLESS
#endif
#include "awt_p.h"
#include "awt_Component.h"
#include "awt_GraphicsEnv.h"
#define XK_MISCELLANY
#include <X11/keysymdef.h>
#include <X11/Intrinsic.h>
#include <jni.h>
#include <sizecalc.h>
#include "robot_common.h"
#include "canvas.h"
#include "wsutils.h"
#include "list.h"
#include "multiVis.h"
#endif
extern struct X11GraphicsConfigIDs x11GraphicsConfigIDs;
/* check if XTest is available */
isXTestAvailable = XQueryExtension(awt_display, XTestExtensionName, &major_opcode, &first_event, &first_error);
DTRACE_PRINTLN3("RobotPeer: XQueryExtension(XTEST) returns major_opcode = %d, first_event = %d, first_error = %d",
if (isXTestAvailable) {
/* check if XTest version is OK */
DTRACE_PRINTLN4("RobotPeer: XTestQueryExtension returns event_basep = %d, error_basep = %d, majorp = %d, minorp = %d",
/* bad version*/
DTRACE_PRINTLN("XRobotPeer: XTEST is 2.1 - no grab is available\n");
} else {
}
} else {
/* allow XTest calls even if someone else has the grab; e.g. during
* a window resize operation. Works only with XTEST2.2*/
}
} else {
DTRACE_PRINTLN("RobotPeer: XTEST extension is unavailable");
}
return isXTestAvailable;
}
/* prevent user from moving stuff around during the capture */
/*
* The following two functions live in multiVis.c-- they are pretty
* much verbatim taken from the source to the xwd utility from the
* X11 source. This version of the xwd source was somewhat better written
* for reuse compared to Sun's version.
*
*
* We use these functions since they do the very tough job of capturing
* the screen correctly when it contains multiple visuals. They take into
* 24-bit RGB image so we don't have to fool around with colormaps etc.
*/
x, y, w, h,
&pVisuals,
&allImage );
x, y, w, h,
allImage );
/* allow user to do stuff again */
return image;
}
/*********************************************************************************************/
// this should be called from XRobotPeer constructor
Java_sun_awt_X11_XRobotPeer_setup (JNIEnv * env, jclass cls, jint numberOfButtons, jintArray buttonDownMasks)
{
int i;
DTRACE_PRINTLN("RobotPeer: setup()");
return;
}
for (i = 0; i < num_buttons; i++) {
}
AWT_LOCK();
if (!xtestAvailable) {
JNU_ThrowByName(env, "java/awt/AWTException", "java.awt.Robot requires your X server support the XTEST extension version 2.2");
}
AWT_UNLOCK();
}
jint x,
jint y,
* to parent process.
*/
DTRACE_PRINTLN6("RobotPeer: getRGBPixelsImpl(%lx, %d, %d, %d, %d, %x)", xgc, x, y, width, height, pixelArray);
AWT_LOCK();
/* avoid a lot of work for empty rectangles */
AWT_UNLOCK();
return;
}
/* Array to use to crunch around the pixel values */
{
AWT_UNLOCK();
return;
}
/* convert to Java ARGB pixels */
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
* 32-bits on 64-bit
* OSes.
*/
}
}
AWT_UNLOCK();
}
AWT_LOCK();
True,
AWT_UNLOCK();
}
AWT_LOCK();
AWT_UNLOCK();
}
AWT_LOCK();
XWarpPointer(awt_display, None, XRootWindow(awt_display, adata->awt_visInfo.screen), 0, 0, 0, 0, root_x, root_y);
AWT_UNLOCK();
}
/*
* Function joining the code of mousePressImpl and mouseReleaseImpl
*/
{
AWT_LOCK();
{
}
(num_buttons >= 2)) {
}
(num_buttons >= 3)) {
}
if (num_buttons > 3){
int32_t i;
for (i = 3; i<num_buttons; i++){
if ((buttonMask & masks[i])) {
// arrays starts from zero index => +1
// users wants to affect 4 or 5 button but they are assigned
// to the wheel so => we have to shift it to the right by 2.
button = i + 3;
}
}
}
AWT_UNLOCK();
}
jint buttonMask) {
}
jint buttonMask) {
}
/* Mouse wheel is implemented as a button press of button 4 and 5, so it */
/* probably could have been hacked into robot_mouseButtonEvent, but it's */
/* cleaner to give it its own command type, in case the implementation */
/* needs to be changed later. -bchristi, 6/20/01 */
/* wheel down: button 5 */
AWT_LOCK();
/* wheelAmt == 0 */
}
AWT_UNLOCK();
}