/*
* 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 "color.h"
#include "awt_TopLevel.h"
#include <X11/IntrinsicP.h>
#ifndef XAWT
#include <Xm/MenuShell.h>
#include <Xm/RowColumn.h>
#endif /* XAWT */
#include <jni.h>
#include <jni_util.h>
#include "awt_xembed.h"
#ifndef XAWT
#if MOTIF_VERSION!=1
#include <Xm/GrabShell.h>
#endif
#endif
#include "java_awt_event_MouseWheelEvent.h"
#ifndef MAX
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#endif
#ifndef MIN
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#endif
#ifndef XAWT
/*
* The following three funtions are to work around menu problems
*/
/*
* test if there is a menu that has the current focus
* called from awt_Dialog.c and awt_Component.c
*/
{
return False;
}
return False;
}
return True;
}
#if MOTIF_VERSION!=1
/* Motif 2.1 uses XmGrabShell on XmComboBox instead
of XmMenuShell
*/
return True;
}
/* Fix 4800638 check the ancestor of focus widget is
GrabSell
*/
{
{
return True;
}
}
#endif
unsigned char type;
if (type == XmMENU_BAR) {
return True;
}
}
return False;
}
static
/* REMIND: multi-screen */
ev->x = 0;
ev->y = 0;
}
/*
* generates a mouse press event and a release event
* called from awt_Dialog.c
*/
{
if (status != 0) {
}
return status;
}
{
#ifdef NETSCAPE
#else
int32_t i;
extern int32_t awt_numScreens;
for (i = 0; i < awt_numScreens; i++) {
screen = i;
break;
}
}
argc = 0;
NULL);
NULL);
#endif
return warningWindow;
}
void
{
&xattr);
}
}
w = XtParent(w);
}
if (w != NULL) {
return XmGetFocusWidget(w);
} else {
return NULL;
}
}
void
{
if (w == NULL) {
return;
}
/* Aim: hack to prevent direct children of scrollpane from
* being unmanaged during a reshape operation (which results
* in too many expose events).
*/
}
NULL);
}
}
return;
}
if (need_to_unmanage) {
if (!resize) {
}
XtUnmanageChild(w);
}
/* GES: AVH's hack:
* Motif ignores attempts to move a toplevel window to 0,0.
* Instead we set the position to 1,1. The expected value is
* returned by Frame.getBounds() since it uses the internally
* held rectangle rather than querying the peer.
* N.B. [pauly, 9/97] This is only required for wm shells
* under the Motif Window Manager (MWM), not for any others.
* Note. Utilizes C short-circuiting if w is not a wm shell.
*/
if ((x == 0) && (y == 0) &&
(XtIsSubclass(w, wmShellWidgetClass)) &&
(XmIsMotifWMRunning(w))) {
}
NULL);
} else {
XmNx, x,
XmNy, y,
NULL);
}
if (need_to_unmanage) {
XtManageChild(w);
if (!resize) {
}
if (saved_focus_widget != NULL) {
if (!result)
{
}
}
}
}
}
void
{
if (w == NULL) {
return;
}
}
void
{
/*
extern Boolean scrollBugWorkAround;
*/
if (w == NULL) {
return;
}
/*
XXX: causes problems on 2.5
if (!scrollBugWorkAround) {
awt_setWidgetGravity(w, StaticGravity);
}
*/
}
void
{
XtSetSensitive(w, True);
}
void
{
XtSetSensitive(w, False);
}
void
Cardinal i;
/* The widget may have been destroyed by another thread. */
return;
if (applyToCurrent != 0) {
}
if (!XtIsComposite(w)) {
return;
}
XmNchildren, &wlist,
NULL);
if (wlen > 0) {
for (i=0; i < wlen; i++) {
}
}
}
void
{
Cardinal i;
if (XtWindow(w) && XtIsRealized(w)) {
XtWindow(w),
mask,
xattr);
} else {
return;
}
XmNchildren, &wlist,
NULL);
for (i = 0; i < wlen; i++) {
mask,
xattr);
}
}
}
static void
if (prevWgt == w) {
}
}
if (XtIsRealized(w)) {
unsigned long valuemask = 0;
&attributes);
}
if (c == None) {
c = prevCur;
if (w != NULL) {
}
prevWgt = w;
} else {
prevCur = c;
}
attributes.cursor = c;
XtWindow(w),
&attributes);
return 1;
} else
return 0;
}
void
case KeyPress:
case KeyRelease:
break;
case ButtonPress:
case ButtonRelease:
break;
default:
break;
}
}
/*
Part fix for bug id 4017222. Return the widget at the given screen coords
by searching the widget tree beginning at root. This function will return
null if the pointer is not over the root widget or child of the root widget.
Additionally, this function will only return a Widget with non-nil XmNuserData.
In 1.2.1, when the mouse was dragged over a Choice component, this function
returned the GadgetButton associated with the Choice. This GadgetButton had
nil as its XmNuserData. This lead to a crash when the nil XmNuserData was
extracted and used as a reference to a peer. Ooops.
Now the GadgetButton is not returned and the function goes on to find a widget
which contains the correct peer reference in XmNuserData.
*/
if(XtIsComposite(root)) {
int32_t i=0;
if(wlen>0) {
}
}
}
if(!answer) {
NULL);
}
return answer;
}
#ifdef __linux__
/* get_im_height: returns height of the input method status area in pixels.
*
* This function assumes that if any XIM related information cannot be
* queried then the app must not have an input method status area in the
* current locale and returns zero as the status area height
*/
static XtPointer*
{
Widget p;
if (w == NULL)
return NULL;
p = w;
while (!XtIsShell(p))
p = XtParent(p);
/* Check extension data since app could be attempting to create
* a text widget as child of menu shell. This is illegal, and will
* be detected later, but check here so we don't core dump.
*/
return NULL;
}
static XmImShellInfo
{
return *ptr;
else
return NULL;
}
#endif /* !linux */
{
while (!XtIsShell(w)){
w = XtParent(w);
}
return w;
}
#ifdef __linux__
{
Position x,y ;
char *ret;
Widget p=w;
while (!XtIsShell(p)) {
p = XtParent(p);
}
XmNx, &x,
XmNy, &y,
NULL);
return NULL;
}
return NULL;
} else {
}
if (icp) {
/*
* first one.
*/
ssgeometry->x = 0;
/*
* use motif TextComponent's resource
*/
list = XVaCreateNestedList(0,
NULL);
}
return list ;
}
static XFontSet
{
char *font_tag;
return NULL;
do {
if (next_entry) {
if (type_return == XmFONT_IS_FONTSET) {
}
}
}
} while (next_entry);
return first_fs;
}
#endif
/*the caller does have the responsibility to free the memory return
from this function...*/
/*a label in a menuitem is not supposed to be a FullOfSpaceString... */
}
else{
if (*ptr == ' '){
}
}
}
return buf;
}
/*
* This callback proc is installed via setting the XmNinsertPosition
* resource on a widget. It ensures that components added
* to a widget are inserted in the correct z-order position
* to match up with their peer/target ordering in Container.java
*/
{
NULL);
// SECURITY: We are running on the privileged toolkit thread.
// The peer must *NOT* call into user code
,NULL
,"getZOrderPosition_NoClientCode"
,"()I").i;
}
}
return index;
}
void
{
/* Remove all queued X Events for the window of the widget. */
ALL_EVENTS_MASK, &xev)) ;
}
#endif /* XAWT */
/**
* Gets the thread we are currently executing on
*/
/* Initialize our java identifiers once. Checking before locking
* is a huge performance win.
*/
if (threadClass == NULL) {
// should enter a monitor here...
if (threadClass == NULL) {
if (threadClass != NULL) {
"currentThread",
);
}
}
if (currentThreadMethodID == NULL) {
threadClass = NULL;
}
if (err) {
return NULL;
}
} /* threadClass == NULL*/
/*JNU_PrintString(env, "getCurrentThread() -> ", JNU_ToString(env,currentThread));*/
return currentThread;
} /* awtJNI_GetCurrentThread() */
void
/* Initialize our java identifiers once. Checking before locking
* is a huge performance win.
*/
if (threadClass == NULL) {
// should enter a monitor here...
if (threadClass == NULL) {
if (threadClass != NULL) {
"yield",
"()V"
);
}
}
if (yieldMethodID == NULL) {
threadClass = NULL;
}
if (err) {
return;
}
} /* threadClass == NULL*/
} /* awtJNI_ThreadYield() */
#ifndef XAWT
void
{
/* Bug 4017222: Drag processing uses global prevWidget. */
if (widget == prevWidget) {
prevWidget = NULL;
}
}
static int32_t
isTimeStampUpdated(void* p) {
return timeStampUpdated;
}
static void
}
/*
* If the application doesn't receive events with timestamp for a long time
* XtLastTimestampProcessed() will return out-of-date value. This may cause
* selection handling routines to fail (see BugTraq ID 4085183).
* This routine is to resolve this problem. It queries the current X server
* time by appending a zero-length data to a property as prescribed by
* X11 Reference Manual.
* Note that this is a round-trip request, so it can be slow. If you know
* that the Xt timestamp is up-to-date use XtLastTimestampProcessed().
*/
AWT_LOCK();
if (_XA_JAVA_TIME_PROPERTY_ATOM == 0) {
}
(unsigned char *)"", 0);
if (awt_currentThreadIsPrivileged(env)) {
} else {
}
AWT_UNLOCK();
return server_time;
}
/*
* This function is stolen from /src/solaris/hpi/src/system_md.c
* It is used in setting the time in Java-level InputEvents
*/
{
struct timeval t;
gettimeofday(&t, NULL);
}
/*
* This function converts between the X server time (number of milliseconds
* since the last server reset) and the UTC time for the 'when' field of an
* InputEvent (or another event type with a timestamp).
*/
{
/*
* Because Time is of type 'unsigned long', it is possible that Time will
* never wrap when using 64-bit Xlib. However, if a 64-bit client
* connects to a 32-bit server, I suspect the values will still wrap. So
* we should not attempt to remove the wrap checking even if _LP64 is
* true.
*/
}
return reset_time_utc + server_offset;
}
int value;
int slider_size;
int min;
int max;
int increment;
int page_increment;
int scrollAdjustment;
int newValue;
/* TODO:
* If a TextArea's scrollbar policy is set to never, it should still
* wheel scroll, but right now it doesn't.
*/
return;
}
XmNminimum, &min,
XmNmaximum, &max,
}
else { // WHEEL_UNIT_SCROLL
}
if (wheelAmt < 0) {
// Don't need to check that newValue < max - slider_size because
// newValue < current value. If scrollAmt is ever user-configurable,
// we'll have to check this.
}
else {
}
}
/* Given a ScrollWindow widget, return the Scrollbar that the wheel should
* scroll. A null return value means that the ScrollWindow has a scrollbar
* display policy of none, or that neither scrollbar can be scrolled.
*/
int value;
int slider_size;
int min;
int max;
/* first, try the vertical scrollbar */
XmNminimum, &min,
return scrollbar;
}
}
/* then, try the horiz */
XmNminimum, &min,
return scrollbar;
}
}
/* neither is suitable for scrolling */
return NULL;
}
{
int32_t x, y;
0, 0, &x, &y, &win)) {
DTRACE_PRINTLN("correcting coordinates");
}
}
}
{
case FocusIn:
case FocusOut:
return True;
}
// pretend that the embedded frame gets a focus event
// the event's window field is not the same as
// the embeddedFrame's widget, but luckily the shellEH
// doesnt seem to care about this.
}
}
return eventProcessed;
case ConfigureNotify:
}
return True;
}
return False;
}
{
unsigned char * data;
return;
}
return;
/*
* according to XICCM, we search our toplevel window
* by looking for WM_STATE property
*/
while (True) {
return;
}
if (children) {
}
return;
}
/*
* Add StructureNotifyMask through hierarchy upto toplevel
*/
0, 0, False, AnyPropertyType,
if (type) {
break;
}
}
}
"OutOfMemory in awt_util_addEmbeddedFrame");
return;
}
/* initialize the xt coordinates */
/*
* go through the exisiting embedded frames see if we have
* already selected the event on the same frameContainer
*/
break;
}
}
/*
* we already have a embedded frame selecting this container's
* event, we remember its eventSelectedPreviously value
* so that we know whether to deselect later when we are removed
*/
} else {
}
/* ef will become the head of the embedded frame list */
if (theEmbeddedFrameList != NULL) {
}
}
{
break;
}
}
return;
}
/* remove ef from link list EmbeddedFrameList */
}
}
if (theEmbeddedFrameList == ef) {
}
if (!needToDeselect) {
return;
}
/*
* now decide whether we need to stop listenning event for
* frameContainer
*/
break;
}
}
/*
* if we get here, no one is interested in this frame
* and StructureNotify was not selected by anyone else
* so we deselect it
*/
DTRACE_PRINTLN("remove event from frame");
(~FocusChangeMask));
}
}
#endif /* XAWT */
void awt_util_debug_init() {
#if defined(DEBUG)
#endif
}
static void awt_util_debug_fini() {
#if defined(DEBUG)
#endif
}