Widget awt_util_createWarningWindow(Widget parent, char *warning) { Widget warningWindow; #ifdef NETSCAPE extern Widget FE_MakeAppletSecurityChrome(Widget parent, char* message); warningWindow = FE_MakeAppletSecurityChrome(parent, warning); #else Widget label; int32_t argc; #define MAX_ARGC 10 Arg args[MAX_ARGC]; int32_t screen = 0; int32_t i; AwtGraphicsConfigDataPtr adata; extern int32_t awt_numScreens; Pixel gray; Pixel black; for (i = 0; i < awt_numScreens; i++) { if (ScreenOfDisplay(awt_display, i) == XtScreen(parent)) { screen = i; break; } } adata = getDefaultConfig(screen); gray = adata->AwtColorMatch(192, 192, 192, adata); black = adata->AwtColorMatch(0, 0, 0, adata); argc = 0; XtSetArg(args[argc], XmNbackground, gray); argc++; XtSetArg(args[argc], XmNmarginHeight, 0); argc++; XtSetArg(args[argc], XmNmarginWidth, 0); argc++; XtSetArg (args[argc], XmNscreen, XtScreen(parent)); argc++; DASSERT(!(argc > MAX_ARGC)); warningWindow = XmCreateForm(parent, "main", args, argc); XtManageChild(warningWindow); label = XtVaCreateManagedWidget(warning, xmLabelWidgetClass, warningWindow, XmNhighlightThickness, 0, XmNbackground, gray, XmNforeground, black, XmNalignment, XmALIGNMENT_CENTER, XmNrecomputeSize, False, NULL); XtVaSetValues(label, XmNbottomAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, NULL); #endif return warningWindow; }
JNIEXPORT int32_t JNICALL awt_GetColor(JAWT_DrawingSurface* ds, int32_t r, int32_t g, int32_t b) { JNIEnv* env; jobject target, peer; jclass componentClass; AwtGraphicsConfigDataPtr adata; int32_t result; jobject gc_object; if (ds == NULL) { #ifdef DEBUG fprintf(stderr, "Drawing Surface is NULL\n"); #endif return (int32_t) 0; } env = ds->env; target = ds->target; /* Make sure the target is a java.awt.Component */ componentClass = (*env)->FindClass(env, "java/awt/Component"); if (!(*env)->IsInstanceOf(env, target, componentClass)) { #ifdef DEBUG fprintf(stderr, "DrawingSurface target must be a component\n"); #endif return (int32_t) 0; } if (!awtLockInited) { return (int32_t) 0; } AWT_LOCK(); /* Get the peer of the target component */ peer = (*env)->GetObjectField(env, target, componentIDs.peer); if (JNU_IsNull(env, peer)) { #ifdef DEBUG fprintf(stderr, "Component peer is NULL\n"); #endif AWT_UNLOCK(); return (int32_t) 0; } /* GraphicsConfiguration object of MComponentPeer */ gc_object = (*env)->GetObjectField(env, peer, graphicsConfigID); if (gc_object != NULL) { adata = (AwtGraphicsConfigDataPtr) JNU_GetLongFieldAsPtr(env, gc_object, x11GraphicsConfigIDs.aData); } else { adata = getDefaultConfig(DefaultScreen(awt_display)); } result = adata->AwtColorMatch(r, g, b, adata); AWT_UNLOCK(); return result; }