/*
* 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.
*/
#include "awt_p.h"
#include <limits.h>
#include <locale.h>
#ifndef HEADLESS
#include <X11/cursorfont.h>
#include <Xm/MenuShell.h>
#include <Xm/RowColumn.h>
#endif /* !HEADLESS */
#include <jvm.h>
#include <jni.h>
#include <jlong.h>
#include <jni_util.h>
/* JNI headers */
#include "java_awt_AWTEvent.h"
#include "java_awt_Frame.h"
#include "java_awt_SystemColor.h"
#include "sun_awt_motif_MToolkit.h"
/* JNI field and method ids */
#include "awt_Component.h"
//#include "awt_Cursor.h"
#include "awt_MenuComponent.h"
#include "awt_TopLevel.h"
#include "canvas.h"
#include "color.h"
#include "awt_mgrsel.h"
#include "awt_wm.h"
#include "awt_DrawingSurface.h"
#include "awt_Window.h"
#include "awt_xembed.h"
#include "awt_xembed_server.h"
#ifndef HEADLESS
#endif
#endif /* !HEADLESS */
{
#ifndef HEADLESS
#endif /* !HEADLESS */
return JNI_VERSION_1_2;
}
#ifdef HEADLESS
return JNI_TRUE;
#else
return JNI_FALSE;
#endif
}
#ifndef HEADLESS
static jlong awtJNI_TimeMillis(void);
extern void awt_initialize_Xm_DnD(Display*);
extern void awt_initialize_DataTransferer();
extern struct ComponentIDs componentIDs;
extern struct MenuComponentIDs menuComponentIDs;
extern struct MComponentPeerIDs mComponentPeerIDs;
struct xsettings_callback_cookie {
};
static void awt_pipe_init(void);
#ifdef USE_SELECT
#else
#endif
#include <X11/Intrinsic.h>
#include <dlfcn.h>
#include <fcntl.h>
#ifdef USE_SELECT
#if defined(AIX)
#endif
#else
#include <poll.h>
#ifndef POLLRDNORM
#endif
#endif
#ifdef NDEBUG
#endif
#ifndef bzero
#endif
static void syncWait_eventHandler(XEvent *);
extern Boolean awt_UseType4Patch;
extern Boolean awt_UseXKB;
/* implement a "putback queue" -- see comments on awt_put_back_event() */
#define AWT_FLUSHOUTPUT_NOW() \
{ \
XFlush(awt_display); \
awt_next_flush_time = 0LL; \
}
#ifdef DEBUG_AWT_LOCK
#endif
#ifndef NOMODALFIX
extern Boolean awt_isModal();
#endif
/* Font information to feed Motif widgets. */
static const char *motifFontList;
"-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1";
char **missingList;
char *defChar;
}
}
/* If the default font is a single font. */
if (defaultMotifFontStruct == NULL)
}
else {
/* If the default font is multiple fonts. */
if (defaultMotifFontSet == NULL)
}
return fontlist;
}
static void
{
} /* awt_set_poll_timeout */
/*
* Gets the best timeout for the next call to poll() or select().
* If timedOut is True, we assume that our previous timeout elapsed
* next timeout slightly.
*/
static uint32_t
{
DTRACE_PRINTLN2("awt_get_poll_timeout(%s), awt_next_flush_time:%ld",
if (timedOut) {
/* add 1/16 (plus 1, in case the division truncates to 0) */
}
if (awt_next_flush_time > 0) {
} else {
}
return timeout;
} /* awt_get_poll_timeout() */
static jlong
awtJNI_TimeMillis(void)
{
struct timeval t;
gettimeofday(&t, 0);
}
static int32_t
xtError()
{
#ifdef DEBUG
#endif
return 0;
}
static int32_t
{
jio_fprintf(stderr, "X connection to %s host broken (explicit kill or server shutdown)\n", XDisplayName(NULL));
}
}
return 0; /* to keep compiler happy */
}
/* Like XKeysymToKeycode, but ensures that keysym is the primary
* symbol on the keycode returned. Returns zero otherwise.
*/
static int32_t
{
if (code == 0) {
return 0;
}
return code;
} else {
return 0;
}
}
/*
* +kb or -kb ?
*/
static Boolean
/*
* NB: TODO: hope it will return False if XkbIgnoreExtension was called!
*/
}
/* Assign meaning - alt, meta, etc. - to X modifiers mod1 ... mod5.
* Only consider primary symbols on keycodes attached to modifiers.
*/
static void
{
DTRACE_PRINTLN("In setup_modifier_map");
for (modn = Mod1MapIndex;
(modn <= Mod5MapIndex) &&
(awt_MetaMask == 0 || awt_AltMask == 0 ||
awt_NumLockMask == 0 || awt_ModeSwitchMask == 0);
++modn)
{
};
for (i = 0; i < nkeys; ++i) {
/* for each keycode attached to this modifier */
if (keycode == 0) {
continue;
}
break;
break;
break;
break;
}
}
}
for(i = 0; i < nkeys; i++) {
if (keycode == 0) {
break;
}
break;
}
break;
}
}
}
}
}
void
{
char c = 'p';
if (awt_next_flush_time == 0)
{
needsWakeup = True;
}
/* awt_next_flush_time affects awt_get_poll_timeout(), so set
* the variable *after* calling the function.
*/
if (needsWakeup)
{
/* write to the utility pipe to wake up the event
* loop, if it's sleeping
*/
}
}
#ifdef FLUSHDEBUG
else
#endif
} /* awt_output_flush() */
void
{
/* do nothing */
}
struct WidgetInfo *
{
return cw;
}
}
return NULL;
}
void
{
if (findWidgetInfo(w) != NULL) return;
if (!XtIsSubclass(w, xmFileSelectionBoxWidgetClass)) {
if (nw) {
if (w != origin) {
}
}
if (w != origin) {
}
}
if (w != origin) {
}
}
} else {
}
}
}
void
{
} else {
break;
}
}
}
}
}
void *
{
void * peer;
}
/* fix for 4053856, robi.khan@eng
couldn't find peer corresponding to widget
but the widget may be child of one with
a peer, so recurse up the hierarchy */
if (widgetParent != NULL ) {
/* found peer attached to ancestor of given
widget, so set widget return value as well */
*pwidget = widgetParent;
return peer;
}
}
return NULL;
}
{
}
static Boolean
return False;
}
return True;
}
}
return False;
}
void
if (!awt_isAwtMenuWidget(wdgt)) {
} else {
}
}
}
void
struct MenuList* p;
p = *pp;
free((void*)p);
break;
}
}
}
static Widget
int i;
for (i = 0; i < 3; i++) {
}
return NULL;
}
static Boolean
s2 = getShellWidgetByPart(w);
return True;
} else {
return False;
}
}
static Boolean
{
/* If this function returns False, that means that it has not pre-posted
this event to Java. The caller will then dispatch the event to Motif,
and our handlers will be called to post it to Java.
If this function returns true, then this function has posted this event
to java before returning. The caller will not dispatch it to Motif;
it will be dispatched to Motif via the putbackQueue after it has been
processed by Java */
case KeyPress:
case KeyRelease:
break;
case FocusIn:
case FocusOut:
break;
case ButtonPress:
case ButtonRelease:
break;
case MotionNotify:
break;
case EnterNotify:
case LeaveNotify:
break;
default:
return False;
}
return False;
}
/* Fix for 4328561 by ibd@sparc.spb.su
If the widget is a Choice, the widget with focus is probably lying
outside the current widget's sub-hierarchy, so we have to go up the
hierarchy to reach it */
} else {
return False;
}
/* In this case, focus widget should be CascadeButtonGadget type,
but we should send the events to its parent */
} else {
/* If something went wrong, restore the original status */
}
}
/* if focus owner is null, redirect key events to focused window */
}
/* If we are on a non-choice widget, process events in a normal way */
}
if (focusWidget != NULL) {
}
}
}
}
return False;
}
/*
* Fix for bug 4145193
*
* If a menu is up (not just a popup menu), prevent awt components from
* getting any events until the menu is popped down.
* preposted to the Java event queue was causing the ButtonRelease
* (needed to pop menu down) to be seen by the menu's parent and
* not the menu.
*/
if (awtMenuIsActive()) {
if (focusWidget == NULL) {
return False;
}
/* If we are on a choice, dispatch the events to widget, but do not
* dispatch the events if we are on popped up menu.
*/
/* Fix for 4328557 by ibd@sparc.spb.su
* If we are dragging mouse from choice and are currently outside
* of it, dispatch events to the choice - the source of dragging.
*/
}
return False;
}
}
/* If the keyboard is grabbed by a popup (such as a choice) during
a time when a focus proxy is in effect, the abovefocusIsOnMenu
test will not detect the sitation because the focus will be on
the proxy. But we need events to go to Motif first, so that the
grab can be undone when appropriate. */
if (keyboardGrabbed) {
return False;
}
/* If it's a keyboard event, we need to find the peer associated */
/* with the widget that has the focus rather than the widget */
/* associated with the window in the X event. */
case KeyPress:
case KeyRelease:
return False;
break;
case FocusIn:
case FocusOut:
return False;
break;
case ButtonPress:
case ButtonRelease:
return False;
}
break;
case EnterNotify:
case LeaveNotify:
/*
* within the component.
*/
return False;
break;
case MotionNotify:
return False;
break;
default:
return False;
}
/* If we found a widget and a suitable peer (either the focus
peer above or the one associated with the widget then we
dispatch to it. */
return False;
}
/*
* Fix for bug 4173714 - java.awt.button behaves differently under
* Component should not get any events when it's disabled.
*/
if (!XtIsSensitive(widget)) {
}
return False;
}
return (!cont);
} /* shouldDispatchToWidget() */
if (awtAutoShutdownClass == NULL) {
}
if (awtAutoShutdownClassLocal == NULL) {
return;
}
"notifyToolkitThreadBusy", "()V");
}
"notifyToolkitThreadFree", "()V");
}
return;
}
} /* awtAutoShutdownClass == NULL*/
if (busy) {
} else {
}
}
}
#ifdef DEBUG
#endif
/*
* This is the main Xt event loop for the AWT.
*
* Because java applications are multithreaded, but X and Xt
* are thread-dumb, we must make special considerations to
* multiple threads simultaneously.
*
* The biggest difference between the standard Xt loop
* and this loop is that we go to great lengths never to block
* in the X libraries. We poll() on the X event pipe, waiting
* for events, rather than simply calling XtAppNextEvent() and
* blocking. If this thread were to block in XtAppNextEvent(),
* no other thread could enter (e.g., to perform a paint or
* retrieve data).
*/
/* #ifdef DEBUG */
/* #endif */
static void
{
/* only privileged thread should be running here */
/* The pipe where X events arrive */
/* We execute events while locked, unlocking only when waiting
* for an event
*/
AWT_LOCK();
/* Create the AWT utility pipe. See the comments on awt_pipe_init() */
/*
* Need to flush here in case data on the connection was read
* before we acquired the monitor.
*
* I don't get this, but I'm too chicken to remove it. -jethro 2Sep98
*/
/*
* ACTUALLY PROCESS EVENTS
*/
while(True) {
/* process all events in the queue */
/* #ifdef DEBUG */
/* numEventsHandled = 0; */
/* #endif */
/* #ifdef DEBUG */
/* #endif */
} /* end while awt_events_pending() */
/* At this point, we have exhausted the event queue */
/* print the number of events handled in parens */
#ifdef DEBUG
if (++debugPrintLineCount > 8) {
DTRACE_PRINTLN("");
debugPrintLineCount = 0;
}
#endif
AWT_NOTIFY_ALL(); /* wake up modalWait() */
/* Here, we wait for X events, outside of the X libs. When
* it's likely that an event is waiting, we process the queue
*/
} /* while(True) */
/* If we ever exit the loop, must unlock the toolkit */
} /* awt_MToolkit_loop() */
/*
* Creates the AWT utility pipe. This pipe exists solely so that
* we can cause the main event thread to wake up from a poll() or
* select() by writing to this pipe.
*/
static void
awt_pipe_init(void) {
if (awt_pipe_inited) {
return;
}
if ( pipe ( awt_pipe_fds ) == 0 )
{
/*
** the write wakes us up from the infinite sleep, which
** then we cause a delay of AWT_FLUSHTIME and then we
** flush.
*/
/* set the pipe to be non-blocking */
}
else
{
AWT_READPIPE = -1;
AWT_WRITEPIPE = -1;
}
} /* awt_pipe_init() */
static Window
if (res != 0) {
if (nchildren > 0) {
}
}
return retvalue;
} else {
return None;
}
}
static Boolean
}
return False;
}
return True;
}
return False;
}
}
return False;
}
}
return False;
}
}
return False;
}
}
// Returns a local ref to a decorated owner of the target,
// or NULL if the target is Frame or Dialog itself.
// The local ref returned should be deleted by the caller.
}
if (isSelfFrameOrDialog) {
return NULL;
}
return parent;
}
/* the owner of a Window is in its parent field */
/* we may have a chain of Windows; go up the chain till we find the
owning Frame or Dialog */
return NULL;
}
}
cdata = (struct ComponentData *)
}
return NULL;
}
}
return NULL;
}
}
if (target_prev == NULL) {
return NULL;
}
while ((target_prev != NULL)
{
/* go up the hierarchy until we find a window */
}
return target_prev;
}
static Window
if (w != None) {
if (res == 0) {
return None;
}
}
return root;
} else {
return None;
}
}
return False;
}
do {
c_count = 0;
}
return False;
}
return True;
}
} else {
return False;
}
} while (True);
}
}
return None;
}
}
// Window which contains focus owner when focus proxy is enabled
// Window which works as proxy for input events for real focus owner.
{
if (w == NULL) {
break;
}
} else {
}
}
}
}
}
return;
}
}
if (focusProxyWindow != None) {
if (shellWindow != None) {
}
}
}
}
static void
if (*trueFocusWindow != None) {
#ifdef DEBUG_FOCUS
printf(" nulling out proxy; putting back event"
"\n");
#endif
} else {
}
}
*trueFocusWindow = None;
*focusProxyWindow = None;
return;
} else {
#ifdef DEBUG_FOCUS
printf("\n");
#endif
return;
}
} else {
#ifdef DEBUG_FOCUS
printf("\n");
#endif
return;
}
}
}
static void
if (focusProxyWindow != None) {
/* eat it */
return;
} else /* FocusIn on Frame or Dialog */ {
}
} else /* FocusOut on Frame or Dialog */{
}
}
static void
/* If it's a FocusIn, allow it to process, then set
focus to focus proxy */
if (focusProxy != NULL) {
}
} /* otherwise error */
} else /* FocusOut */ {
/* If it's a FocusOut on a Window, discard it unless
it's an event generated by us. */
}
}
}
break;
} else {
break;
}
}
}
return retvalue;
}
/**
* Returns focusability of the corresponding Java Window object
*/
}
// If the window doesn't have shell consider it focusable as all windows
// are focusable by default
}
}
}
}
if (grabbed_widget == NULL) {
return False;
}
case LeaveNotify:
case ButtonPress:
case ButtonRelease:
case MotionNotify:
case EnterNotify:
{
return JNU_CallMethodByName(env, NULL, peer, "processUngrabMouseEvent", "(Lsun/awt/motif/MComponentPeer;III)Z",
}
}
return False;
}
case FocusOut:
{
return True;
}
default:
return True;
}
}
/**
* Handles events pushed back via awt_put_back_event() FIRST,
* then new events on the X queue
*/
static void
if (putbackQueueCount > 0) {
// There is a pushed-back event - handle it first
if (awt_get_next_put_back_event(&xev) == 0) {
#ifdef DEBUG_FOCUS
printf("putback FocusOut on window %d, mode %d, "
"detail %d, send_event %d\n",
}
#endif
eventNumber++;
return;
} else {
}
}
}
/*
* Fix for BugTraq ID 4041235, 4100167:
* First check that the event still has a widget, because
* the widget may have been destroyed by another thread.
*/
eventNumber++;
#endif
return;
}
/*
* if we get here, the event could be one of
* the following:
* - notification that a "container" of
* any of our embedded frame has been moved
* - event understandable by XFilterEvent
* - for one of our old widget which has gone away
*/
/* an embedded frame container has been moved? */
if (awt_util_processEventForEmbeddedFrame(&xev)) {
return;
}
/* manager selections related event? */
if (awt_mgrsel_processEvent(&xev)) {
return;
}
}
/*
* Fix for BugTraq ID 4196573:
* Call XFilterEvent() to give a chance to X Input
* Method to process this event before being
* discarded.
*/
return;
}
/* There is an X event on the queue. */
case KeyPress:
case KeyRelease:
case ButtonPress:
case ButtonRelease:
case MotionNotify:
case EnterNotify:
case LeaveNotify:
/* Fix for BugTraq ID 4048060. Dispatch scrolling events
immediately to the ScrollBar widget to prevent spurious
continuous scrolling. Otherwise, if the application is busy,
the ButtonRelease event is not dispatched in time to prevent
a ScrollBar timeout from expiring, and restarting the
continuous scrolling timer.
*/
/* Use XNextEvent instead of XtAppNextEvent, because
XtAppNextEvent processes timers before getting the next X
event, causing a race condition, since the TimerEvent
callback in the ScrollBar widget restarts the continuous
scrolling timer.
*/
// This is the event on scrollbar. Key, Motion,
// generate Ungrab after Java mouse event
}
}
else {
// This is an event on one of our widgets. Key,
// should generate Ungrab after Java mouse event
/* if (grabbed_widget != NULL && !eventInsideGrabbed(&xev)) { */
/* return; */
/* } */
}
}
}
#ifdef DEBUG_FOCUS
#endif
}
/* this could be moved to shouldDispatchToWidget */
/* if there is a proxy in effect, dispatch key events
through the proxy */
!keyboardGrabbed && !haveEvent) {
if (focusProxyWindow != None) {
/* Key event should be posted to the top-level
widget of the proxy */
return;
}
return;
}
}
if (!shouldDispatchToWidget(&xev)) {
}
// See comment above - "after time" is here.
}
}
break;
case FocusIn:
case FocusOut: {
void *peer;
#ifdef DEBUG_FOCUS
} else {
}
#endif
#ifdef DEBUG_FOCUS
printf("discarding\n");
#endif
return;
}
// Check for xembed on this window. If it is active and this is not XEmbed focus
// event(send_event = 0) then we should skip it
return;
}
/* In general, we need to to block out focus events
that are caused by keybaord grabs initiated by
dragging the title bar or the scrollbar. But we
need to let through the ones that are aimed at
choice boxes or menus. So we keep track of when
the keyboard is grabbed by a popup. */
if (awt_isAwtMenuWidget(widget)) {
extern Boolean poppingDown;
if (!poppingDown) {
}
} else /* FocusOut */ {
}
}
}
if (focusProxyWindow != None) {
#ifdef DEBUG_FOCUS
#endif
if (trueFocusWindow != None) {
/* trueFocusWindow should never be None here, but if
things ever get skewed, we want to be able to
recover rather than crash */
return;
} else {
/* beartrap -- remove before shipping */
/* printf("trueFocusWindow None in processOneEvent;\n"); */
/* printf("Please file a bug\n"); */
}
}
#ifdef DEBUG_FOCUS
printf("null peer -- shouldn't see in java handler\n");
#endif
return;
}
/* Find the top-level component */
return;
}
"window");
return;
}
#ifdef DEBUG_FOCUS
printf("Focus event directed at a frame; frame = %d\n",
#endif
return;
} else {
#ifdef DEBUG_FOCUS
printf("Focus event directed at a window; window = %d\n",
#endif
return;
}
}
case UnmapNotify:
#ifdef DEBUG_FOCUS
#endif
default:
break;
}
}
else {
/* There must be a timer, alternate input, or signal event. */
}
} /* processOneEvent() */
/*
* it is likely (but not definite) that there are events waiting to
* be processed.
*
* This routine also flushes the outgoing X queue, when the
* awt_next_flush_time has been reached.
*
* If fdAWTPipe is greater or equal than zero the routine also
* checks if there are events pending on the putback queue.
*/
void
#ifdef USE_SELECT
#else
#endif
if ((awt_next_flush_time > 0) &&
(awtJNI_TimeMillis() > awt_next_flush_time)) {
}
} /* end while awt_events_pending() == 0 */
} /* waitForEvents() */
/*************************************************************************
** **
** WE USE EITHER select() OR poll(), DEPENDING ON THE USE_SELECT **
** COMPILE-TIME CONSTANT. **
** **
*************************************************************************/
#ifdef USE_SELECT
/*
* Performs select() on both the X pipe and our AWT utility pipe.
* Returns when data arrives or the operation times out.
*
* Not all Xt events come across the X pipe (e.g., timers
* and alternate inputs), so we must time out every now and
* then to check the Xt event queue.
*
* The fdAWTPipe will be empty when this returns.
*/
static void
/* Fixed 4250354 7/28/99 ssi@sparc.spb.su
* Cleaning up Global Refs in case of No Events
*/
if (fdAWTPipe >= 0) {
nfds++;
}
if (timeout == 0) {
// be sure other threads get a chance
}
// set the appropriate time values. The DASSERT() in
// MToolkit_run() makes sure that this will not overflow
AWT_LOCK();
/* reset tick if this was not a time out */
if (result == 0) {
/* select() timed out -- update timeout value */
}
{
/* There is data on the AWT pipe - empty it */
do {
} while (count == AWT_POLL_BUFSIZE );
}
} /* performSelect() */
#else /* !USE_SELECT */
/*
* Polls both the X pipe and our AWT utility pipe. Returns
* when there is data on one of the pipes, or the operation times
* out.
*
* Not all Xt events come across the X pipe (e.g., timers
* and alternate inputs), so we must time out every now and
* then to check the Xt event queue.
*
* The fdAWTPipe will be empty when this returns.
*/
static void
/* Fixed 4250354 7/28/99 ssi@sparc.spb.su
* Cleaning up Global Refs in case of No Events
*/
/* print the poll timeout time in brackets */
#ifdef DEBUG
if (++debugPrintLineCount > 8) {
DTRACE_PRINTLN("");
debugPrintLineCount = 0;
}
#endif
/* ACTUALLY DO THE POLL() */
if (timeout == 0) {
// be sure other threads get a chance
}
#ifdef DEBUG
if (++debugPrintLineCount > 8) {
DTRACE_PRINTLN("");
debugPrintLineCount = 0;
}
#endif
AWT_LOCK();
if (result == 0) {
/* poll() timed out -- update timeout value */
}
{
/* There is data on the AWT pipe - empty it */
do {
} while (count == AWT_POLL_BUFSIZE );
}
return;
} /* performPoll() */
#endif /* !USE_SELECT */
/*
* Pushes an X event back on the queue to be handled
* later.
*
* Ignores the request if event is NULL
*/
void
if (putbackQueueCount >= putbackQueueCapacity) {
/* not enough room - alloc 50% more space */
if ((newCapacity - putbackQueueCapacity)
/* always increase by at least min increment */
}
} else {
}
}
if (addIt) {
// wake up the event loop, if it's sleeping
}
return;
} /* awt_put_back_event() */
/*
* Gets the next event that has been pushed back onto the queue.
* Returns 0 and fills in xev_out if successful
*/
static int32_t
if (putbackQueueCount < 1) {
} else {
}
if (!err) {
/* remove it from the queue */
if (putbackQueueCount == 1) {
// queue is now empty
/* Too much space -- delete it and rebuild later */
putbackQueue = NULL;
putbackQueueCapacity = 0;
}
} else {
/* more than 1 event in queue - shift all events to the left */
/* We don't free the allocated memory until the queue
becomes empty, just 'cause it's easier that way. */
/* NOTE: use memmove(), because the memory blocks overlap */
}
}
DASSERT(putbackQueueCount >= 0);
return (err? -1:0);
} /* awt_get_next_put_back_event() */
/**
* Determines whether or not there are X or Xt events pending.
* Looks at the putbackQueue.
*/
static XtInputMask
if (putbackQueueCount > 0) {
imask |= XtIMXEvent;
}
return imask;
}
#ifndef NOMODALFIX
void
{
/* if we have not allocate an array, do it first */
if (arraySize == 0) {
} else {
}
}
arrayIndx++;
}
void
{
arrayIndx--;
return;
} else {
int32_t i;
/* find the position of the shell in the array */
for (i = arrayIndx; i >= 0; i--) {
break;
}
}
/* remove the found element */
while (i <= arrayIndx-1) {
i++;
}
}
}
{
Widget w;
while (w != NULL) {
return True;
}
w = XtParent(w);
}
return False;
}
{
return (arrayIndx > 0);
}
#endif // NOMODALFIX
/*
* Simply waits for terminateFn() to return True. Waits on the
* awt lock and is notified to check its state by the main event
* loop whenever the Xt event queue is empty.
*
* NOTE: when you use this routine check if it can be called on the event
* dispatch thread during drag-n-drop operation and update
* secondary_loop_event() predicate to prevent deadlock.
*/
void
{
AWT_LOCK();
while ((*terminateFn) (data) == 0) {
break;
}
}
AWT_UNLOCK();
}
static uint32_t
{
return rgb;
}
/*
* fix for bug #4088106 - ugly text boxes and grayed out looking text
*/
void
{
/* use the default procedure to calculate colors */
/* check if there is enought free color cells */
return;
}
/* find the closest matches currently available */
}
/*
* Read _XSETTINGS_SETTINGS property from _XSETTINGS selection owner
* and pass its value to the java world for processing.
*/
/*static*/ void
{
int status;
/* Returns of XGetWindowProperty */
int actual_format;
unsigned long nitems;
unsigned long bytes_after;
unsigned char *xsettings;
DTRACE_PRINTLN2("XS: update screen %d, owner 0x%08lx",
#if 1 /* XXX: kludge */
/*
* As toolkit cannot yet cope with per-screen desktop properties,
* only report XSETTINGS changes on the default screen. This
* should be "good enough" for most cases.
*/
DTRACE_PRINTLN2("XS: XXX: default screen is %d, update is for %d, ignoring", DefaultScreen(dpy), scr);
return;
}
#endif /* kludge */
/*
* XXX: move awt_getPropertyFOO from awt_wm.c to awt_util.c and
* use the appropriate one.
*/
&xsettings);
DTRACE_PRINTLN("XS: unable to read _XSETTINGS");
return;
}
DTRACE_PRINTLN("XS: reading _XSETTINGS, got NULL");
return;
}
if (actual_type != _XA_XSETTINGS_SETTINGS) {
DTRACE_PRINTLN("XS: _XSETTINGS_SETTINGS is not of type _XSETTINGS_SETTINGS");
return;
}
DTRACE_PRINTLN1("XS: read %lu bytes of _XSETTINGS_SETTINGS",
nitems);
/* ok, propagate xsettings to the toolkit for processing */
DTRACE_PRINTLN("XS: EnsureLocalCapacity failed");
return;
}
DTRACE_PRINTLN("awt_xsettings_update: NewByteArray failed");
return;
}
}
/*
* Event handler for events on XSETTINGS selection owner.
* We are interested in PropertyNotify only.
*/
static void
{
DTRACE_PRINTLN2("XS: awt_xsettings_callback(%d) event %d ignored",
return;
}
DTRACE_PRINTLN("XS: awt_xsettings_callback(%d) atom == None");
return;
}
#ifdef DEBUG
{
char *name;
DTRACE_PRINT2("XS: awt_xsettings_callback(%d) 0x%08lx ",
} else {
}
"changed" : "deleted");
}
#endif
DTRACE_PRINTLN("XS: property != _XSETTINGS_SETTINGS ... ignoring");
return;
}
/* XXX: notify toolkit to reset to "defaults"? */
return;
}
}
/*
* Owner of XSETTINGS selection changed on the given screen.
*/
static void
void *cookie)
{
DTRACE_PRINTLN("XS: awt_xsettings_owner_callback: owner = None");
/* XXX: reset to defaults??? */
return;
}
DTRACE_PRINTLN1("XS: awt_xsettings_owner_callback: owner = 0x%08lx",
owner);
}
/*
* Returns a reference to the class java.awt.Component.
*/
{
if (componentCls == NULL) {
if (componentClsLocal == NULL) {
/* exception already thrown */
return NULL;
}
}
return componentCls;
}
/*
* Returns a reference to the class java.awt.MenuComponent.
*/
{
// get global reference of java/awt/MenuComponent class (run only once)
if (menuComponentCls == NULL) {
if (menuComponentClsLocal == NULL) {
/* exception already thrown */
return NULL;
}
}
return menuComponentCls;
}
/*
* Class: sun_awt_motif_MToolkit
* Method: init
*/
{
/*
* Note: The MToolkit object depends on the static initializer
* of X11GraphicsEnvironment to initialize the connection to
* the X11 server.
*/
char *multiclick_time_query;
{
"*enableThinThickness: True",
"*XmFileSelectionBox.fileFilterStyle: XmFILTER_HIDDEN_FILES",
"*XmFileSelectionBox.pathMode: XmPATH_MODE_RELATIVE",
"*XmFileSelectionBox.resizePolicy: XmRESIZE_GROW",
"*XmFileSelectionBox*dirTextLabelString: Enter path or folder name:",
"*XmFileSelectionBox*applyLabelString: Update",
"*XmFileSelectionBox*selectionLabelString: Enter file name:",
"*XmFileSelectionBox*dirListLabelString: Folders",
NULL /* Must be NULL terminated */
};
/* Need to make sure this is deleted someplace! */
AWT_LOCK();
if (!XSupportsLocale()) {
"current locale is not supported in X11, locale is set to C");
}
if (!XSetLocaleModifiers("")) {
}
#ifdef NETSCAPE
if (awt_init_xt) {
}
#else
#endif
{
char *cFontRsrc;
char *cFontRsrc2;
"getDefaultMotifFontSet",
"-monotype-arial-regular-r-normal--*-140-*-*-p-*-iso8859-1";
} else {
}
/* fprintf(stderr, "motifFontList: %s\n", motifFontList); */
argc = 1;
}
}
appName = "AWT";
}
appName, /* application name */
appName, /* application class */
/* Root shell widget that serves as a parent for all AWT top-levels. */
appName, /* application class */
/* va_list */
NULL);
}
awt_wm_init();
init_xembed();
/*
* Find the correct awt_multiclick_time to use. We normally
* would call XtMultiClickTime() and wouldn't have to do
* anything special, but because OpenWindows defines its own
* version (OpenWindows.MultiClickTimeout), we need to
* determine out which resource to use.
*
* We do this by searching in order for:
*
* 1) an explicit definition of multiClickTime
* (this is the resource that XtGetMultiClickTime uses)
*
* if that fails, search for:
*
* 2) an explicit definition of Openwindows.MultiClickTimeout
*
* if both searches fail:
*
* 3) use the fallback provided by XtGetMultiClickTime()
* (which is 200 milliseconds... I looked at the source :-)
*
*/
if (multiclick_time_query) {
} else {
"OpenWindows", "MultiClickTimeout");
if (multiclick_time_query) {
/* Note: OpenWindows.MultiClickTimeout is in tenths of
a second, so we need to multiply by 100 to convert to
milliseconds */
} else {
}
}
/*
* Create the cursor for TextArea scrollbars...
*/
/*
* fix for bug #4088106 - ugly text boxes and grayed out looking text
*/
AWT_UNLOCK();
}
/*
* Class: sun_awt_motif_MToolkit
* Method: run
* Signature: ()V
*/
{
/*
* in performSelect(), we multiply the timeout by 1000. Make sure
* that the maximum value will not cause an overflow.
*/
}
/*
* Class: sun_awt_motif_MToolkit
* Method: makeColorModel
* Signature: ()Ljava/awt/image/ColorModel;
*/
{
}
/*
* Class: sun_awt_motif_MToolkit
* Method: getScreenResolution
* Signature: ()I
*/
{
* 25.4) /
}
/*
* Class: sun_awt_motif_MToolkit
* Method: getScreenWidth
* Signature: ()I
*/
{
}
/*
* Class: sun_awt_motif_MToolkit
* Method: getScreenHeight
* Signature: ()I
*/
{
}
/*
* Class: sun_awt_motif_MToolkit
* Method: beep
* Signature: ()V
*/
{
AWT_LOCK();
XBell(awt_display, 0);
}
/*
* Class: sun_awt_motif_MToolkit
* Method: shutdown
* Signature: ()V
*/
{
}
/*
* Class: sun_awt_motif_MToolkit
* Method: getLockingKeyStateNative
* Signature: (I)B
*/
{
AWT_LOCK();
JNU_ThrowByName(env, "java/lang/UnsupportedOperationException", "Keyboard doesn't have requested key");
AWT_UNLOCK();
return False;
}
AWT_UNLOCK();
}
/*
* Class: sun_awt_motif_MToolkit
* Method: loadSystemColors
* Signature: ([I)V
*/
{
int32_t i, j;
AWT_LOCK();
/*
* initialize array of pixels
*/
for (i = 0; i < java_awt_SystemColor_NUM_COLORS; i++) {
pixels[i] = -1;
}
/*
* Create phantom widgets in order to determine the default
* colors; this is somewhat inelegant, however it is the simplest
* and most reliable way to determine the system's default colors
* for objects.
*/
argc = 0;
/*
XtSetMappedWhenManaged(frame, False);
XtRealizeWidget(frame);
*/
argc = 0;
argc = 0;
argc = 0;
XmNbackground, &bg,
XmNforeground, &fg,
XmNcolormap, &cmap,
NULL);
count++;
count++;
count++;
count++;
XmNbackground, &bg,
XmNforeground, &fg,
NULL);
count++;
count++;
XmNbackground, &bg,
XmNforeground, &fg,
NULL);
count++;
count++;
count++;
count++;
XmNbackground, &bg,
XmNforeground, &fg,
NULL);
count++;
count++;
count++;
count++;
count++;
count++;
XmNbackground, &bg,
NULL);
count++;
/*
* Convert pixel values to RGB
*/
j = 0;
for (i = 0; i < java_awt_SystemColor_NUM_COLORS; i++) {
if (pixels[i] != -1) {
}
}
/* Get current System Colors */
/*
* Fill systemColor array with new rgb values
*/
j = 0;
for (i = 0; i < java_awt_SystemColor_NUM_COLORS; i++) {
if (pixels[i] != -1) {
/*
printf("SystemColor[%d] = %x\n", i, rgb);
*/
}
}
0,
/* Duplicate system colors. If color allocation is unsuccessful,
system colors will be approximated with matched colors */
/*
* Cleanup
*/
AWT_UNLOCK();
}
/*
* Class: sun_awt_motif_MToolkit
* Method: isDynamicLayoutSupportedNative
* Signature: ()Z
*
* Note: there doesn't seem to be a protocol for querying the WM
* about its opaque resize settings, so this function just returns
* whether there is a solid resize option available for that WM.
*/
{
AWT_LOCK();
wm = awt_wm_getRunningWM();
AWT_UNLOCK();
switch (wm) {
case ENLIGHTEN_WM:
case KDE2_WM:
case SAWFISH_WM:
case ICE_WM:
case METACITY_WM:
return JNI_TRUE;
case OPENLOOK_WM:
case MOTIF_WM:
case CDE_WM:
return JNI_FALSE;
default:
return JNI_FALSE;
}
}
/*
* Class: sun_awt_motif_MToolkit
* Method: isFrameStateSupported
* Signature: (I)Z
*/
{
return JNI_TRUE;
} else {
}
}
/*
* Class: sun_awt_motif_MToolkit
* Method: getMulticlickTime
* Signature: ()I
*/
{
return awt_multiclick_time;
}
/*
* Class: sun_awt_motif_MToolkit
* Method: loadXSettings
* Signature: ()V
*/
{
int scr;
AWT_LOCK();
if (registered) {
AWT_UNLOCK();
return;
}
if (_XA_XSETTINGS_SETTINGS == None) {
if (_XA_XSETTINGS_SETTINGS == None) {
"unable to intern _XSETTINGS_SETTINGS");
AWT_UNLOCK();
return;
}
}
"parseXSettings", "(I[B)V");
"sun.awt.motif.MToolkit.parseXSettings");
AWT_UNLOCK();
return;
}
"unable to regiser _XSETTINGS with mgrsel");
AWT_UNLOCK();
return;
}
registered = True;
DTRACE_PRINTLN1("XS: MToolkit.loadXSettings: none on screen %d",
scr);
continue;
}
}
AWT_UNLOCK();
}
AWT_LOCK();
AWT_UNLOCK();
return res;
}
/*
* Returns true if the current thread is privileged. Currently,
* only the main event loop thread is considered to be privileged.
*/
}
return syncUpdated;
}
return syncFailed;
}
// AWT_LOCK is held by calling function
if (wm_selection == None) {
}
if (version_atom == None) {
}
}
syncUpdated = False;
syncFailed = False;
XConvertSelection(awt_display, wm_selection, version_atom, oops_atom, XtWindow(awt_root_shell), CurrentTime);
// Calling function will call AWT_LOCK_WAIT instead of AWT_UNLOCK
}
// AWT_LOCK must be held by the calling method
return eventNumber;
}
static void
{
syncUpdated = True;
inSyncWait = False;
{
syncFailed = True;
inSyncWait = False;
}
}
int grab_result;
AWT_LOCK();
{
AWT_UNLOCK();
return;
}
}
| ButtonMotionMask),
if (GrabSuccess != grab_result) {
AWT_UNLOCK();
return;
}
True,
if (GrabSuccess != grab_result) {
}
AWT_UNLOCK();
}
AWT_LOCK();
{
AWT_UNLOCK();
return;
}
AWT_UNLOCK();
}
/*
* Class: sun_awt_motif_MToolkit
* Method: getWMName
*/
{
AWT_LOCK();
wm = awt_wm_getRunningWM();
AWT_UNLOCK();
switch (wm) {
case NO_WM:
case OTHER_WM:
case ENLIGHTEN_WM:
case KDE2_WM:
case SAWFISH_WM:
case ICE_WM:
case METACITY_WM:
case OPENLOOK_WM:
case MOTIF_WM:
case CDE_WM:
}
}
#endif /* !HEADLESS */