diff --git a/jdk/make/sun/awt/FILES_c_unix.gmk b/jdk/make/sun/awt/FILES_c_unix.gmk index 2d4f1fc7624bfd64b9abc2542e09f2d827e38916..66f66ae27c08cfced38fb9f84cda96a5ada5bcd5 100644 --- a/jdk/make/sun/awt/FILES_c_unix.gmk +++ b/jdk/make/sun/awt/FILES_c_unix.gmk @@ -140,71 +140,12 @@ FILES_2D_c = \ debug_trace.c \ debug_util.c -# These files rely on motif to be built, and should not be included -# in a headless build. - -#FILES_MOTIF_c = \ -#keep awt_AWTEvent.c \ -# awt_Button.c \ -# awt_Canvas.c \ -# awt_Checkbox.c \ -#keep .h awt_Component.c \ -#keep .h awt_Cursor.c \ -# awt_DataTransferer.c \ -# awt_DrawingSurface.c \ -# awt_Event.c \ -# awt_FileDialog.c \ -# awt_GlobalCursorManager.c \ -# awt_GraphicsEnv.c \ -# awt_InputMethod.c \ -#keep awt_Insets.c \ -# awt_KeyboardFocusManager.c \ -# awt_Label.c \ -# awt_List.c \ -# awt_Menu.c \ -# awt_MenuBar.c \ -# awt_MenuComponent.c \ -# awt_MenuItem.c \ -# awt_motif.c \ -# awt_Plugin.c \ -# awt_PopupMenu.c \ -# awt_Robot.c \ -# awt_Scrollbar.c \ -# awt_ScrollPane.c \ -# awt_Selection.c \ -# awt_UNIXToolkit.c \ -# awt_TextArea.c \ -# awt_TextField.c \ -# awt_TopLevel.c \ -# awt_mgrsel.c \ -# awt_util.c \ -# awt_wm.c \ -# awt_XmDnD.c \ -# awt_dnd.c \ -# awt_dnd_ds.c \ -# awt_dnd_dt.c \ -# canvas.c \ -# cursor.c \ -# multi_font.c \ -# robot_common.c \ -# list.c \ -# multiVis.c \ -# XDrawingArea.c \ -# MouseInfo.c \ -# awt_xembed.c \ -# awt_xembed_server.c \ -# gtk2_interface.c \ -# swing_GTKEngine.c \ -# swing_GTKStyle.c - - # These files are required to be built, with or without motif. Some of # these are only dependent on X11, and some contain native source that # is required, even in a headless build. FILES_NO_MOTIF_c = \ awt_Font.c \ - awt_MToolkit.c \ fontpath.c \ VDrawingArea.c \ X11Color.c \ diff --git a/jdk/make/sun/awt/FILES_export_unix.gmk b/jdk/make/sun/awt/FILES_export_unix.gmk index 8fef6ced151032ec1dd317fa3716909191045f77..5cd8a010007d233916ef5c4961fa39921a7fc784 100644 --- a/jdk/make/sun/awt/FILES_export_unix.gmk +++ b/jdk/make/sun/awt/FILES_export_unix.gmk @@ -61,11 +61,8 @@ FILES_export = \ sun/awt/image/BufImgSurfaceData.java \ sun/awt/image/DataBufferNative.java \ \ - sun/awt/motif/X11FontMetrics.java \ sun/awt/X11InputMethod.java \ sun/awt/motif/MFontConfiguration.java \ - sun/awt/motif/MFontPeer.java \ - sun/awt/motif/MToolkit.java \ sun/awt/DebugSettings.java \ sun/awt/EmbeddedFrame.java \ sun/awt/PlatformFont.java \ @@ -93,7 +90,6 @@ FILES_export = \ sun/java2d/cmm/ColorTransform.java \ sun/awt/datatransfer/DataTransferer.java \ sun/awt/dnd/SunDragSourceContextPeer.java \ - sun/awt/motif/MToolkitThreadBlockedHandler.java \ sun/java2d/opengl/OGLBlitLoops.java \ sun/java2d/opengl/OGLContext.java \ sun/java2d/opengl/OGLMaskFill.java \ diff --git a/jdk/make/sun/awt/mapfile-mawt-vers b/jdk/make/sun/awt/mapfile-mawt-vers index d9315e0f35d23e547df3c7304f7526dcf1c56410..6cc59bd34318b1a6e7c940013ef2e3264b6b4095 100644 --- a/jdk/make/sun/awt/mapfile-mawt-vers +++ b/jdk/make/sun/awt/mapfile-mawt-vers @@ -31,7 +31,6 @@ SUNWprivate_1.1 { global: JNI_OnLoad; - #Java_sun_awt_motif_MComponentPeer_restoreFocus; Java_sun_awt_DefaultMouseInfoPeer_fillPointWithCoords; Java_sun_awt_DefaultMouseInfoPeer_isWindowUnderMouse; Java_java_awt_AWTEvent_nativeSetSource; @@ -56,230 +55,11 @@ SUNWprivate_1.1 { Java_sun_awt_UNIXToolkit_load_1stock_1icon; Java_sun_awt_UNIXToolkit_load_1gtk_1icon; Java_sun_awt_UNIXToolkit_nativeSync; - #Java_sun_awt_motif_MButtonPeer_create; - #Java_sun_awt_motif_MButtonPeer_setLabel; - #Java_sun_awt_motif_MPanelPeer_pEnsureIndex; - #Java_sun_awt_motif_MPanelPeer_pRestack; - #Java_sun_awt_motif_MCanvasPeer_create; - #Java_sun_awt_motif_MCanvasPeer_initIDs; - #Java_sun_awt_motif_MCanvasPeer_resetTargetGC; - #Java_sun_awt_motif_MCheckboxMenuItemPeer_pSetState; - #Java_sun_awt_motif_MCheckboxPeer_create; - #Java_sun_awt_motif_MCheckboxPeer_setCheckboxGroup; - #Java_sun_awt_motif_MCheckboxPeer_setLabel; - #Java_sun_awt_motif_MCheckboxPeer_pSetState; - #Java_sun_awt_motif_MCheckboxPeer_pGetState; - #Java_sun_awt_motif_MChoicePeer_addItem; - #Java_sun_awt_motif_MChoicePeer_appendItems; - #Java_sun_awt_motif_MChoicePeer_create; - #Java_sun_awt_motif_MChoicePeer_pReshape; - #Java_sun_awt_motif_MChoicePeer_remove; - #Java_sun_awt_motif_MChoicePeer_removeAll; - #Java_sun_awt_motif_MChoicePeer_setBackground; - #Java_sun_awt_motif_MChoicePeer_pSelect; - #Java_sun_awt_motif_MChoicePeer_setFont; - #Java_sun_awt_motif_MChoicePeer_setForeground; - #Java_sun_awt_motif_MComponentPeer_addNativeDropTarget; - #Java_sun_awt_motif_MComponentPeer_getNativeColor; - #Java_sun_awt_motif_MComponentPeer_getWindow; - #Java_sun_awt_motif_MComponentPeer_pDisable; - #Java_sun_awt_motif_MComponentPeer_pDispose; - #Java_sun_awt_motif_MComponentPeer_pEnable; - #Java_sun_awt_motif_MComponentPeer_pGetLocationOnScreen; - #Java_sun_awt_motif_MComponentPeer_pGetLocationOnScreen2; - #Java_sun_awt_motif_MComponentPeer_pHide; - #Java_sun_awt_motif_MComponentPeer_pInitialize; - #Java_sun_awt_motif_MComponentPeer_pMakeCursorVisible; - #Java_sun_awt_motif_MComponentPeer_pReshape; - #Java_sun_awt_motif_MComponentPeer_pShow; - #Java_sun_awt_motif_MComponentPeer_removeNativeDropTarget; - #Java_sun_awt_motif_MComponentPeer_pSetBackground; - #Java_sun_awt_motif_MComponentPeer_pSetFont; - #Java_sun_awt_motif_MComponentPeer_processSynchronousLightweightTransfer; - #Java_sun_awt_motif_MComponentPeer__1requestFocus; - #Java_sun_awt_motif_MComponentPeer_getNativeFocusedWindow; - #Java_sun_awt_motif_MCheckboxMenuItemPeer_getState; - #Java_sun_awt_motif_MComponentPeer_pSetForeground; - #Java_sun_awt_motif_MDragSourceContextPeer_startDrag; - #Java_sun_awt_motif_MDragSourceContextPeer_setNativeCursor; - #Java_sun_awt_motif_MDropTargetContextPeer_addTransfer; - #Java_sun_awt_motif_MDropTargetContextPeer_dropDone; - #Java_sun_awt_motif_MDropTargetContextPeer_startTransfer; - #Java_sun_awt_motif_X11DragSourceContextPeer_startDrag; - #Java_sun_awt_motif_X11DragSourceContextPeer_setNativeCursor; - #Java_sun_awt_motif_X11DropTargetContextPeer_sendResponse; - #Java_sun_awt_motif_X11DropTargetContextPeer_dropDone; - #Java_sun_awt_motif_X11DropTargetContextPeer_getData; - #Java_sun_awt_motif_MEmbeddedFramePeer_NEFcreate; - #Java_sun_awt_motif_MEmbeddedFramePeer_pShowImpl; - #Java_sun_awt_motif_MEmbeddedFramePeer_requestXEmbedFocus; - #Java_sun_awt_motif_MEmbeddedFramePeer_isXEmbedApplicationActive; - #Java_sun_awt_motif_MEmbeddedFramePeer_isXEmbedActive; - #Java_sun_awt_motif_MEmbeddedFramePeer_synthesizeFocusInOut; - #Java_sun_awt_motif_MEmbeddedFramePeer_pReshapePrivate; - #Java_sun_awt_motif_MEmbeddedFramePeer_getBoundsPrivate; - #Java_sun_awt_motif_MEmbeddedFrame_getWidget; - #Java_sun_awt_motif_MEmbeddedFrame_mapWidget; - #Java_sun_awt_motif_MEmbedCanvasPeer_forwardEventToEmbedded; - #Java_sun_awt_motif_MFramePeer_pSetIconImage___3B_3I_3SII; - #Java_sun_awt_motif_MFileDialogPeer_create; - #Java_sun_awt_motif_MFileDialogPeer_pDispose; - #Java_sun_awt_motif_MFileDialogPeer_pHide; - #Java_sun_awt_motif_MFileDialogPeer_pReshape; - #Java_sun_awt_motif_MFileDialogPeer_pShow; - #Java_sun_awt_motif_MFileDialogPeer_setFileEntry; - #Java_sun_awt_motif_MFileDialogPeer_setFont; - #Java_sun_awt_motif_MFramePeer_pGetIconSize; - #Java_sun_awt_motif_MGlobalCursorManager_cacheInit; - #Java_sun_awt_motif_MGlobalCursorManager_findComponentAt; - #Java_sun_awt_motif_MGlobalCursorManager_findHeavyweightUnderCursor; - #Java_sun_awt_motif_MGlobalCursorManager_getCursorPos; - #Java_sun_awt_motif_MGlobalCursorManager_getLocationOnScreen; - #Java_sun_awt_motif_MLabelPeer_create; - #Java_sun_awt_motif_MLabelPeer_setAlignment; - #Java_sun_awt_motif_MLabelPeer_setText; - #Java_sun_awt_motif_MListPeer_addItem; - #Java_sun_awt_motif_MListPeer_create; - #Java_sun_awt_motif_MListPeer_delItems; - #Java_sun_awt_motif_MListPeer_deselect; - #Java_sun_awt_motif_MListPeer_isSelected; - #Java_sun_awt_motif_MListPeer_makeVisible; - #Java_sun_awt_motif_MListPeer_nativeHandleMouseWheel; - #Java_sun_awt_motif_MListPeer_select; - #Java_sun_awt_motif_MListPeer_setMultipleSelections; - #Java_sun_awt_motif_MMenuBarPeer_create; - #Java_sun_awt_motif_MMenuItemPeer_createMenuItem; - #Java_sun_awt_motif_MMenuItemPeer_pDisable; - #Java_sun_awt_motif_MMenuItemPeer_pDispose; - #Java_sun_awt_motif_MMenuItemPeer_pEnable; - #Java_sun_awt_motif_MMenuItemPeer_pSetLabel; - #Java_sun_awt_motif_MMenuPeer_createMenu; - #Java_sun_awt_motif_MMenuPeer_createSubMenu; - #Java_sun_awt_motif_MMenuPeer_pDispose; - #Java_sun_awt_motif_MPopupMenuPeer_createMenu; - #Java_sun_awt_motif_MPopupMenuPeer_pDispose; - #Java_sun_awt_motif_MPopupMenuPeer_pShow; - #Java_sun_awt_motif_MRobotPeer_getRGBPixelsImpl; - #Java_sun_awt_motif_MRobotPeer_keyPressImpl; - #Java_sun_awt_motif_MRobotPeer_keyReleaseImpl; - #Java_sun_awt_motif_MRobotPeer_mouseMoveImpl; - #Java_sun_awt_motif_MRobotPeer_mousePressImpl; - #Java_sun_awt_motif_MRobotPeer_mouseReleaseImpl; - #Java_sun_awt_motif_MRobotPeer_mouseWheelImpl; - #Java_sun_awt_motif_MRobotPeer_setup; - #Java_sun_awt_motif_MScrollbarPeer_create; - #Java_sun_awt_motif_MScrollbarPeer_setLineIncrement; - #Java_sun_awt_motif_MScrollbarPeer_setPageIncrement; - #Java_sun_awt_motif_MScrollbarPeer_pSetValues; - #Java_sun_awt_motif_MScrollPanePeer_create; - #Java_sun_awt_motif_MScrollPanePeer_pGetBlockIncrement; - #Java_sun_awt_motif_MScrollPanePeer_pGetScrollbarSpace; - #Java_sun_awt_motif_MScrollPanePeer_pGetShadow; - #Java_sun_awt_motif_MScrollPanePeer_pInsets; - #Java_sun_awt_motif_MScrollPanePeer_pSetIncrement; - #Java_sun_awt_motif_MScrollPanePeer_pSetScrollChild; - #Java_sun_awt_motif_MScrollPanePeer_setScrollPosition; - #Java_sun_awt_motif_MScrollPanePeer_setTypedValue; - #Java_sun_awt_motif_MTextAreaPeer_initIDs; - #Java_sun_awt_motif_MTextAreaPeer_pCreate; - #Java_sun_awt_motif_MTextAreaPeer_getCaretPosition; - #Java_sun_awt_motif_MTextAreaPeer_getExtraHeight; - #Java_sun_awt_motif_MTextAreaPeer_getExtraWidth; - #Java_sun_awt_motif_MTextAreaPeer_getSelectionEnd; - #Java_sun_awt_motif_MTextAreaPeer_getSelectionStart; - #Java_sun_awt_motif_MTextAreaPeer_getText; - #Java_sun_awt_motif_MTextAreaPeer_insert; - #Java_sun_awt_motif_MTextAreaPeer_nativeHandleMouseWheel; - #Java_sun_awt_motif_MTextAreaPeer_pMakeCursorVisible; - #Java_sun_awt_motif_MTextAreaPeer_pSetEditable; - #Java_sun_awt_motif_MTextAreaPeer_pShow2; - #Java_sun_awt_motif_MTextAreaPeer_replaceRange; - #Java_sun_awt_motif_MTextAreaPeer_select; - #Java_sun_awt_motif_MTextAreaPeer_setCaretPosition; - #Java_sun_awt_motif_MTextAreaPeer_setFont; - #Java_sun_awt_motif_MTextAreaPeer_setText; - #Java_sun_awt_motif_MTextAreaPeer_setTextBackground; - #Java_sun_awt_motif_MTextFieldPeer_initIDs; - #Java_sun_awt_motif_MTextFieldPeer_pCreate; - #Java_sun_awt_motif_MTextFieldPeer_getCaretPosition; - #Java_sun_awt_motif_MTextFieldPeer_getSelectionEnd; - #Java_sun_awt_motif_MTextFieldPeer_getSelectionStart; - #Java_sun_awt_motif_MTextFieldPeer_getText; - #Java_sun_awt_motif_MTextFieldPeer_insertReplaceText; - #Java_sun_awt_motif_MTextFieldPeer_preDispose; - #Java_sun_awt_motif_MTextFieldPeer_pSetEditable; - #Java_sun_awt_motif_MTextFieldPeer_select; - #Java_sun_awt_motif_MTextFieldPeer_setCaretPosition; - #Java_sun_awt_motif_MTextFieldPeer_setEchoChar; - #Java_sun_awt_motif_MTextFieldPeer_setFont; - #Java_sun_awt_motif_MTextFieldPeer_setText; - Java_sun_awt_motif_MToolkit_beep; - Java_sun_awt_motif_MToolkit_getLockingKeyStateNative; - Java_sun_awt_motif_MToolkit_getMulticlickTime; - Java_sun_awt_motif_MToolkit_getNumMouseButtons; - Java_sun_awt_motif_MToolkit_loadXSettings; - Java_sun_awt_motif_MToolkit_getScreenHeight; - Java_sun_awt_motif_MToolkit_getScreenResolution; - Java_sun_awt_motif_MToolkit_getScreenWidth; - Java_sun_awt_motif_MToolkit_init; - Java_sun_awt_motif_MToolkit_isDynamicLayoutSupportedNative; - Java_sun_awt_motif_MToolkit_isFrameStateSupported; - Java_sun_awt_motif_MToolkit_loadSystemColors; - Java_sun_awt_motif_MToolkit_makeColorModel; - Java_sun_awt_motif_MToolkit_run; - Java_sun_awt_motif_MToolkit_isAlwaysOnTopSupported; - Java_sun_awt_motif_MToolkit_getEventNumber; - Java_sun_awt_motif_MToolkit_updateSyncSelection; - Java_sun_awt_motif_MToolkit_isSyncUpdated; - Java_sun_awt_motif_MToolkit_isSyncFailed; - Java_sun_awt_motif_MToolkit_nativeUnGrab; - Java_sun_awt_motif_MToolkit_nativeGrab; - Java_sun_awt_motif_MToolkit_getWMName; - Java_sun_awt_motif_MWindowAttributes_initIDs; - #Java_sun_awt_motif_MWindowPeer_pDispose; - #Java_sun_awt_motif_MWindowPeer_pHide; - #Java_sun_awt_motif_MWindowPeer_pReshape; - #Java_sun_awt_motif_MWindowPeer_pSetTitle; - #Java_sun_awt_motif_MWindowPeer_pShow; - #Java_sun_awt_motif_MWindowPeer_setResizable; - #Java_sun_awt_motif_MWindowPeer_toBack; - #Java_sun_awt_motif_MWindowPeer_addTextComponentNative; - #Java_sun_awt_motif_MWindowPeer_getState; - #Java_sun_awt_motif_MWindowPeer_pSetIMMOption; - #Java_sun_awt_motif_MWindowPeer_pSetMenuBar; - #Java_sun_awt_motif_MWindowPeer_pShowModal; - #Java_sun_awt_motif_MWindowPeer_removeTextComponentNative; - #Java_sun_awt_motif_MWindowPeer_setSaveUnder; - #Java_sun_awt_motif_MWindowPeer_setState; - #Java_sun_awt_motif_MWindowPeer_resetTargetGC; - #Java_sun_awt_motif_MWindowPeer_registerX11DropTarget; - #Java_sun_awt_motif_MWindowPeer_unregisterX11DropTarget; - #Java_sun_awt_motif_MWindowPeer_updateAlwaysOnTop; - #Java_sun_awt_motif_MWindowPeer_setFocusableWindow; - #Java_sun_awt_motif_MWindowPeer_pToFront; - #Java_sun_awt_motif_MCustomCursor_cacheInit; - #Java_sun_awt_motif_MCustomCursor_createCursor; - #Java_sun_awt_motif_MCustomCursor_queryBestCursor; - Java_sun_awt_motif_X11FontMetrics_bytesWidth; - Java_sun_awt_motif_X11FontMetrics_getMFCharsWidth; - Java_sun_awt_motif_X11FontMetrics_init; Java_sun_awt_X11InputMethod_disposeXIC; Java_sun_awt_X11InputMethod_isCompositionEnabledNative; Java_sun_awt_X11InputMethod_resetXIC; Java_sun_awt_X11InputMethod_setCompositionEnabledNative; Java_sun_awt_X11InputMethod_turnoffStatusWindow; - #Java_sun_awt_motif_MInputMethod_openXIMNative; - #Java_sun_awt_motif_MInputMethod_configureStatusAreaNative; - #Java_sun_awt_motif_MInputMethod_createXICNative; - #Java_sun_awt_motif_MInputMethod_reconfigureXICNative; - #Java_sun_awt_motif_MInputMethod_setXICFocusNative; - #Java_sun_awt_motif_X11Clipboard_getClipboardData; - #Java_sun_awt_motif_X11Clipboard_getClipboardFormats; - #Java_sun_awt_motif_X11Clipboard_registerClipboardViewer; - #Java_sun_awt_motif_X11Clipboard_unregisterClipboardViewer; - #Java_sun_awt_motif_X11Selection_init; - #Java_sun_awt_motif_X11Selection_pGetSelectionOwnership; - #Java_sun_awt_motif_X11Selection_clearNativeContext; Java_sun_awt_SunToolkit_closeSplashScreen; Java_sun_awt_PlatformFont_initIDs; Java_sun_awt_X11GraphicsConfig_init; @@ -313,25 +93,6 @@ SUNWprivate_1.1 { Java_sun_awt_X11GraphicsEnvironment_pRunningXinerama; Java_sun_awt_X11GraphicsEnvironment_getXineramaCenterPoint; Java_sun_awt_X11GraphicsEnvironment_initXRender; - #Java_sun_awt_motif_MEmbedCanvasPeer_initXEmbedServer; - #Java_sun_awt_motif_MEmbedCanvasPeer_destroyXEmbedServer; - #Java_sun_awt_motif_MEmbedCanvasPeer_isXEmbedActive; - #Java_sun_awt_motif_MEmbedCanvasPeer_initDispatching; - #Java_sun_awt_motif_MEmbedCanvasPeer_endDispatching; - #Java_sun_awt_motif_MEmbedCanvasPeer_embedChild; - #Java_sun_awt_motif_MEmbedCanvasPeer_childDestroyed; - #Java_sun_awt_motif_MEmbedCanvasPeer_getEmbedPreferredSize; - #Java_sun_awt_motif_MEmbedCanvasPeer_getEmbedMinimumSize; - #Java_sun_awt_motif_MEmbedCanvasPeer_getClientBounds; - #Java_sun_awt_motif_MEmbedCanvasPeer_notifyChildEmbedded; - #Java_sun_awt_motif_MEmbedCanvasPeer_detachChild; - #Java_sun_awt_motif_MEmbedCanvasPeer_forwardKeyEvent; - #Java_sun_awt_motif_MEmbedCanvasPeer_getAWTKeyCodeForKeySym; - #Java_sun_awt_motif_MEmbedCanvasPeer_sendMessage__I; - #Java_sun_awt_motif_MEmbedCanvasPeer_sendMessage__IJJJ; - #Java_sun_awt_motif_MEmbedCanvasPeer_getWindow; - #Java_sun_awt_motif_GrabbedKey_initKeySymAndModifiers; - #Java_sun_awt_motif_MEmbeddedFramePeer_traverseOut; Java_java_awt_AWTEvent_initIDs; Java_java_awt_Button_initIDs; Java_java_awt_Container_initIDs; @@ -345,41 +106,6 @@ SUNWprivate_1.1 { Java_java_awt_Insets_initIDs; Java_java_awt_TextField_initIDs; Java_java_awt_Window_initIDs; - #Java_sun_awt_motif_MCheckboxPeer_getIndicatorSize; - #Java_sun_awt_motif_MCheckboxPeer_getSpacing; - #Java_sun_awt_motif_MChoicePeer_freeNativeData; - #Java_sun_awt_motif_MComponentPeer_getComponents_1NoClientCode; - #Java_sun_awt_motif_MComponentPeer_getParent_1NoClientCode; - #Java_sun_awt_motif_MComponentPeer_initIDs; - #Java_sun_awt_motif_MComponentPeer_nativeHandleEvent; - #Java_sun_awt_motif_MComponentPeer_pSetCursor; - #Java_sun_awt_motif_MComponentPeer_pSetInnerForeground; - #Java_sun_awt_motif_MComponentPeer_pSetScrollbarBackground; - #Java_sun_awt_motif_MComponentPeer_setTargetBackground; - #Java_sun_awt_motif_MDataTransferer_dragQueryFile; - #Java_sun_awt_motif_MDataTransferer_getAtomForTarget; - #Java_sun_awt_motif_MDataTransferer_getTargetNameForAtom; - #Java_sun_awt_motif_MFileDialogPeer_insertReplaceFileDialogText; - Java_sun_awt_motif_MFontPeer_initIDs; - #Java_sun_awt_motif_MListPeer_setBackground; - #Java_sun_awt_motif_MMenuBarPeer_initIDs; - #Java_sun_awt_motif_MMenuBarPeer_pDispose; - #Java_sun_awt_motif_MMenuItemPeer_getParent_1NoClientCode; - #Java_sun_awt_motif_MMenuItemPeer_initIDs; - #Java_sun_awt_motif_MMenuItemPeer_pSetShortcut; - #Java_sun_awt_motif_MPopupMenuPeer_initIDs; - #Java_sun_awt_motif_MScrollbarPeer_initIDs; - #Java_sun_awt_motif_MScrollPanePeer_initIDs; - #Java_sun_awt_motif_MTextAreaPeer_pSetCursor; - Java_sun_awt_motif_MToolkit_shutdown; - #Java_sun_awt_motif_MWindowPeer_initIDs; - #Java_sun_awt_motif_MWindowPeer_pCreate; - #Java_sun_awt_motif_MWindowPeer_wrapInSequenced; - Java_sun_awt_motif_X11FontMetrics_initIDs; - #Java_sun_awt_X11InputMethod_initIDs; - #Java_sun_awt_motif_X11Selection_initIDs; - Java_sun_awt_motif_MToolkitThreadBlockedHandler_enter; - Java_sun_awt_motif_MToolkitThreadBlockedHandler_exit; Java_sun_awt_X11GraphicsConfig_init; Java_sun_awt_X11GraphicsConfig_initIDs; Java_sun_awt_X11GraphicsConfig_makeColorModel; diff --git a/jdk/make/sun/awt/mapfile-vers-linux b/jdk/make/sun/awt/mapfile-vers-linux index df80f4e341edcd2bbee99b0df1df16e10eb7f76f..b7033b89fa89e789196a29550d9e9b7859954f2d 100644 --- a/jdk/make/sun/awt/mapfile-vers-linux +++ b/jdk/make/sun/awt/mapfile-vers-linux @@ -170,7 +170,6 @@ SUNWprivate_1.1 { GrPrim_Sg2dGetPixel; GrPrim_Sg2dGetLCDTextContrast; - #Java_sun_awt_motif_MComponentPeer_restoreFocus; Java_sun_awt_DefaultMouseInfoPeer_fillPointWithCoords; Java_sun_awt_DefaultMouseInfoPeer_isWindowUnderMouse; Java_java_awt_AWTEvent_nativeSetSource; @@ -189,216 +188,11 @@ SUNWprivate_1.1 { Java_java_awt_ScrollPane_initIDs; Java_java_awt_TextArea_initIDs; Java_sun_awt_FontDescriptor_initIDs; - #Java_sun_awt_motif_MButtonPeer_create; - #Java_sun_awt_motif_MButtonPeer_setLabel; - #Java_sun_awt_motif_MCanvasPeer_create; - #Java_sun_awt_motif_MCanvasPeer_initIDs; - #Java_sun_awt_motif_MCanvasPeer_resetTargetGC; - #Java_sun_awt_motif_MCheckboxMenuItemPeer_pSetState; - #Java_sun_awt_motif_MCheckboxPeer_create; - #Java_sun_awt_motif_MCheckboxPeer_setCheckboxGroup; - #Java_sun_awt_motif_MCheckboxPeer_setLabel; - #Java_sun_awt_motif_MCheckboxPeer_pSetState; - #Java_sun_awt_motif_MCheckboxPeer_pGetState; - #Java_sun_awt_motif_MChoicePeer_addItem; - #Java_sun_awt_motif_MChoicePeer_appendItems; - #Java_sun_awt_motif_MChoicePeer_create; - #Java_sun_awt_motif_MChoicePeer_pReshape; - #Java_sun_awt_motif_MChoicePeer_remove; - #Java_sun_awt_motif_MChoicePeer_removeAll; - #Java_sun_awt_motif_MChoicePeer_setBackground; - #Java_sun_awt_motif_MChoicePeer_pSelect; - #Java_sun_awt_motif_MChoicePeer_setFont; - #Java_sun_awt_motif_MChoicePeer_setForeground; - #Java_sun_awt_motif_MComponentPeer_addNativeDropTarget; - #Java_sun_awt_motif_MComponentPeer_createBackBuffer; - #Java_sun_awt_motif_MComponentPeer_destroyBackBuffer; - #Java_sun_awt_motif_MComponentPeer_getNativeColor; - #Java_sun_awt_motif_MComponentPeer_getWindow; - #Java_sun_awt_motif_MComponentPeer_pDisable; - #Java_sun_awt_motif_MComponentPeer_pDispose; - #Java_sun_awt_motif_MComponentPeer_pEnable; - #Java_sun_awt_motif_MComponentPeer_pGetLocationOnScreen; - #Java_sun_awt_motif_MComponentPeer_pGetLocationOnScreen2; - #Java_sun_awt_motif_MComponentPeer_pHide; - #Java_sun_awt_motif_MComponentPeer_pInitialize; - #Java_sun_awt_motif_MComponentPeer_pMakeCursorVisible; - #Java_sun_awt_motif_MComponentPeer_pReshape; - #Java_sun_awt_motif_MComponentPeer_pShow; - #Java_sun_awt_motif_MComponentPeer_removeNativeDropTarget; - #Java_sun_awt_motif_MComponentPeer_swapBuffers; - #Java_sun_awt_motif_MComponentPeer_pSetBackground; - #Java_sun_awt_motif_MComponentPeer_pSetFont; - #Java_sun_awt_motif_MComponentPeer_processSynchronousLightweightTransfer; - #Java_sun_awt_motif_MComponentPeer__1requestFocus; - #Java_sun_awt_motif_MCheckboxMenuItemPeer_getState; - #Java_sun_awt_motif_MComponentPeer_pSetForeground; - #Java_sun_awt_motif_MDragSourceContextPeer_startDrag; - #Java_sun_awt_motif_MDragSourceContextPeer_setNativeCursor; - #Java_sun_awt_motif_MDropTargetContextPeer_addTransfer; - #Java_sun_awt_motif_MDropTargetContextPeer_dropDone; - #Java_sun_awt_motif_MDropTargetContextPeer_startTransfer; - #Java_sun_awt_motif_X11DragSourceContextPeer_startDrag; - #Java_sun_awt_motif_X11DragSourceContextPeer_setNativeCursor; - #Java_sun_awt_motif_X11DropTargetContextPeer_sendResponse; - #Java_sun_awt_motif_X11DropTargetContextPeer_dropDone; - #Java_sun_awt_motif_X11DropTargetContextPeer_getData; - #Java_sun_awt_motif_MEmbeddedFramePeer_NEFcreate; - #Java_sun_awt_motif_MEmbeddedFramePeer_pShowImpl; - #Java_sun_awt_motif_MEmbeddedFramePeer_pReshapePrivate; - #Java_sun_awt_motif_MEmbeddedFramePeer_getBoundsPrivate; - #Java_sun_awt_motif_MFramePeer_pSetIconImage___3B_3I_3SII; - #Java_sun_awt_motif_MEmbeddedFramePeer_requestXEmbedFocus; - #Java_sun_awt_motif_MEmbeddedFramePeer_isXEmbedApplicationActive; - #Java_sun_awt_motif_MEmbeddedFramePeer_isXEmbedActive; - #Java_sun_awt_motif_MEmbeddedFrame_getWidget; - #Java_sun_awt_motif_MEmbeddedFrame_mapWidget; - #Java_sun_awt_motif_MFileDialogPeer_create; - #Java_sun_awt_motif_MFileDialogPeer_pDispose; - #Java_sun_awt_motif_MFileDialogPeer_pHide; - #Java_sun_awt_motif_MFileDialogPeer_pReshape; - #Java_sun_awt_motif_MFileDialogPeer_pShow; - #Java_sun_awt_motif_MFileDialogPeer_setFileEntry; - #Java_sun_awt_motif_MFileDialogPeer_setFont; - #Java_sun_awt_motif_MFramePeer_pGetIconSize; - #Java_sun_awt_motif_MGlobalCursorManager_cacheInit; - #Java_sun_awt_motif_MGlobalCursorManager_findComponentAt; - #Java_sun_awt_motif_MGlobalCursorManager_findHeavyweightUnderCursor; - #Java_sun_awt_motif_MGlobalCursorManager_getCursorPos; - #Java_sun_awt_motif_MGlobalCursorManager_getLocationOnScreen; - #Java_sun_awt_motif_MLabelPeer_create; - #Java_sun_awt_motif_MLabelPeer_setAlignment; - #Java_sun_awt_motif_MLabelPeer_setText; - #Java_sun_awt_motif_MListPeer_addItem; - #Java_sun_awt_motif_MListPeer_create; - #Java_sun_awt_motif_MListPeer_delItems; - #Java_sun_awt_motif_MListPeer_deselect; - #Java_sun_awt_motif_MListPeer_isSelected; - #Java_sun_awt_motif_MListPeer_makeVisible; - #Java_sun_awt_motif_MListPeer_select; - #Java_sun_awt_motif_MListPeer_setMultipleSelections; - #Java_sun_awt_motif_MMenuBarPeer_create; - #Java_sun_awt_motif_MMenuItemPeer_createMenuItem; - #Java_sun_awt_motif_MMenuItemPeer_pDisable; - #Java_sun_awt_motif_MMenuItemPeer_pDispose; - #Java_sun_awt_motif_MMenuItemPeer_pEnable; - #Java_sun_awt_motif_MMenuItemPeer_pSetLabel; - #Java_sun_awt_motif_MMenuPeer_createMenu; - #Java_sun_awt_motif_MMenuPeer_createSubMenu; - #Java_sun_awt_motif_MMenuPeer_pDispose; - #Java_sun_awt_motif_MPopupMenuPeer_createMenu; - #Java_sun_awt_motif_MPopupMenuPeer_pDispose; - #Java_sun_awt_motif_MPopupMenuPeer_pShow; - #Java_sun_awt_motif_MRobotPeer_getRGBPixelsImpl; - #Java_sun_awt_motif_MRobotPeer_keyPressImpl; - #Java_sun_awt_motif_MRobotPeer_keyReleaseImpl; - #Java_sun_awt_motif_MRobotPeer_mouseMoveImpl; - #Java_sun_awt_motif_MRobotPeer_mousePressImpl; - #Java_sun_awt_motif_MRobotPeer_mouseReleaseImpl; - #Java_sun_awt_motif_MRobotPeer_mouseWheelImpl; - #Java_sun_awt_motif_MRobotPeer_setup; - #Java_sun_awt_motif_MScrollbarPeer_create; - #Java_sun_awt_motif_MScrollbarPeer_setLineIncrement; - #Java_sun_awt_motif_MScrollbarPeer_setPageIncrement; - #Java_sun_awt_motif_MScrollbarPeer_pSetValues; - #Java_sun_awt_motif_MScrollPanePeer_create; - #Java_sun_awt_motif_MScrollPanePeer_pGetBlockIncrement; - #Java_sun_awt_motif_MScrollPanePeer_pGetScrollbarSpace; - #Java_sun_awt_motif_MScrollPanePeer_pGetShadow; - #Java_sun_awt_motif_MScrollPanePeer_pInsets; - #Java_sun_awt_motif_MScrollPanePeer_pSetIncrement; - #Java_sun_awt_motif_MScrollPanePeer_pSetScrollChild; - #Java_sun_awt_motif_MScrollPanePeer_setScrollPosition; - #Java_sun_awt_motif_MTextAreaPeer_initIDs; - #Java_sun_awt_motif_MTextAreaPeer_pCreate; - #Java_sun_awt_motif_MTextAreaPeer_getCaretPosition; - #Java_sun_awt_motif_MTextAreaPeer_getExtraHeight; - #Java_sun_awt_motif_MTextAreaPeer_getExtraWidth; - #Java_sun_awt_motif_MTextAreaPeer_getSelectionEnd; - #Java_sun_awt_motif_MTextAreaPeer_getSelectionStart; - #Java_sun_awt_motif_MTextAreaPeer_getText; - #Java_sun_awt_motif_MTextAreaPeer_insert; - #Java_sun_awt_motif_MTextAreaPeer_pMakeCursorVisible; - #Java_sun_awt_motif_MTextAreaPeer_pSetEditable; - #Java_sun_awt_motif_MTextAreaPeer_pShow2; - #Java_sun_awt_motif_MTextAreaPeer_replaceRange; - #Java_sun_awt_motif_MTextAreaPeer_select; - #Java_sun_awt_motif_MTextAreaPeer_setCaretPosition; - #Java_sun_awt_motif_MTextAreaPeer_setFont; - #Java_sun_awt_motif_MTextAreaPeer_setText; - #Java_sun_awt_motif_MTextAreaPeer_setTextBackground; - #Java_sun_awt_motif_MTextFieldPeer_initIDs; - #Java_sun_awt_motif_MTextFieldPeer_pCreate; - #Java_sun_awt_motif_MTextFieldPeer_getCaretPosition; - #Java_sun_awt_motif_MTextFieldPeer_getSelectionEnd; - #Java_sun_awt_motif_MTextFieldPeer_getSelectionStart; - #Java_sun_awt_motif_MTextFieldPeer_getText; - #Java_sun_awt_motif_MTextFieldPeer_insertReplaceText; - #Java_sun_awt_motif_MTextFieldPeer_preDispose; - #Java_sun_awt_motif_MTextFieldPeer_pSetEditable; - #Java_sun_awt_motif_MTextFieldPeer_select; - #Java_sun_awt_motif_MTextFieldPeer_setCaretPosition; - #Java_sun_awt_motif_MTextFieldPeer_setEchoChar; - #Java_sun_awt_motif_MTextFieldPeer_setFont; - #Java_sun_awt_motif_MTextFieldPeer_setText; - Java_sun_awt_motif_MToolkit_beep; - Java_sun_awt_motif_MToolkit_getLockingKeyStateNative; - Java_sun_awt_motif_MToolkit_getMulticlickTime; - Java_sun_awt_motif_MToolkit_getNumMouseButtons; - Java_sun_awt_motif_MToolkit_getScreenHeight; - Java_sun_awt_motif_MToolkit_getScreenResolution; - Java_sun_awt_motif_MToolkit_getScreenWidth; - Java_sun_awt_motif_MToolkit_init; - Java_sun_awt_motif_MToolkit_isDynamicLayoutSupportedNative; - Java_sun_awt_motif_MToolkit_isFrameStateSupported; - Java_sun_awt_motif_MToolkit_loadSystemColors; - Java_sun_awt_motif_MToolkit_makeColorModel; - Java_sun_awt_motif_MToolkit_run; - Java_sun_awt_motif_MToolkit_sync; - Java_sun_awt_motif_MToolkit_isAlwaysOnTopSupported; - Java_sun_awt_motif_MWindowAttributes_initIDs; - #Java_sun_awt_motif_MWindowPeer_pDispose; - #Java_sun_awt_motif_MWindowPeer_pHide; - #Java_sun_awt_motif_MWindowPeer_pReshape; - #Java_sun_awt_motif_MWindowPeer_pSetTitle; - #Java_sun_awt_motif_MWindowPeer_pShow; - #Java_sun_awt_motif_MWindowPeer_setResizable; - #Java_sun_awt_motif_MWindowPeer_toBack; - #Java_sun_awt_motif_MWindowPeer_addTextComponentNative; - #Java_sun_awt_motif_MWindowPeer_getState; - #Java_sun_awt_motif_MWindowPeer_pSetIMMOption; - #Java_sun_awt_motif_MWindowPeer_pSetMenuBar; - #Java_sun_awt_motif_MWindowPeer_pShowModal; - #Java_sun_awt_motif_MWindowPeer_removeTextComponentNative; - #Java_sun_awt_motif_MWindowPeer_setSaveUnder; - #Java_sun_awt_motif_MWindowPeer_setState; - #Java_sun_awt_motif_MWindowPeer_resetTargetGC; - #Java_sun_awt_motif_MWindowPeer_registerX11DropTarget; - #Java_sun_awt_motif_MWindowPeer_unregisterX11DropTarget; - #Java_sun_awt_motif_MWindowPeer_updateAlwaysOnTop; - #Java_sun_awt_motif_X11CustomCursor_cacheInit; - #Java_sun_awt_motif_X11CustomCursor_createCursor; - #Java_sun_awt_motif_X11CustomCursor_queryBestCursor; - Java_sun_awt_motif_X11FontMetrics_bytesWidth; - Java_sun_awt_motif_X11FontMetrics_getMFCharsWidth; - Java_sun_awt_motif_X11FontMetrics_init; Java_sun_awt_X11InputMethod_disposeXIC; Java_sun_awt_X11InputMethod_isCompositionEnabledNative; Java_sun_awt_X11InputMethod_resetXIC; Java_sun_awt_X11InputMethod_setCompositionEnabledNative; Java_sun_awt_X11InputMethod_turnoffStatusWindow; - #Java_sun_awt_motif_MInputMethod_openXIMNative; - #Java_sun_awt_motif_MInputMethod_configureStatusAreaNative; - #Java_sun_awt_motif_MInputMethod_createXICNative; - #Java_sun_awt_motif_MInputMethod_reconfigureXICNative; - #Java_sun_awt_motif_MInputMethod_setXICFocusNative; - #Java_sun_awt_motif_X11Clipboard_getClipboardData; - #Java_sun_awt_motif_X11Clipboard_getClipboardFormats; - #Java_sun_awt_motif_X11Clipboard_registerClipboardViewer; - #Java_sun_awt_motif_X11Clipboard_unregisterClipboardViewer; - #Java_sun_awt_motif_X11Selection_init; - #Java_sun_awt_motif_X11Selection_pGetSelectionOwnership; - #Java_sun_awt_motif_X11Selection_clearNativeContext; Java_sun_awt_SunToolkit_closeSplashScreen; Java_sun_awt_PlatformFont_initIDs; Java_sun_awt_X11GraphicsConfig_init; @@ -444,42 +238,7 @@ SUNWprivate_1.1 { Java_java_awt_Insets_initIDs; Java_java_awt_TextField_initIDs; Java_java_awt_Window_initIDs; - #Java_sun_awt_motif_MCheckboxPeer_getIndicatorSize; - #Java_sun_awt_motif_MCheckboxPeer_getSpacing; - #Java_sun_awt_motif_MChoicePeer_freeNativeData; - #Java_sun_awt_motif_MComponentPeer_getComponents_1NoClientCode; - #Java_sun_awt_motif_MComponentPeer_getParent_1NoClientCode; - #Java_sun_awt_motif_MComponentPeer_initIDs; - #Java_sun_awt_motif_MComponentPeer_nativeHandleEvent; - #Java_sun_awt_motif_MComponentPeer_pSetCursor; - #Java_sun_awt_motif_MComponentPeer_pSetInnerForeground; - #Java_sun_awt_motif_MComponentPeer_pSetScrollbarBackground; - #Java_sun_awt_motif_MComponentPeer_setTargetBackground; - #Java_sun_awt_motif_MDataTransferer_dragQueryFile; - #Java_sun_awt_motif_MDataTransferer_getAtomForTarget; - #Java_sun_awt_motif_MDataTransferer_getTargetNameForAtom; - #Java_sun_awt_motif_MFileDialogPeer_insertReplaceFileDialogText; - Java_sun_awt_motif_MFontPeer_initIDs; - #Java_sun_awt_motif_MListPeer_setBackground; - #Java_sun_awt_motif_MMenuBarPeer_initIDs; - #Java_sun_awt_motif_MMenuBarPeer_pDispose; - #Java_sun_awt_motif_MMenuItemPeer_getParent_1NoClientCode; - #Java_sun_awt_motif_MMenuItemPeer_initIDs; - #Java_sun_awt_motif_MMenuItemPeer_pSetShortcut; - #Java_sun_awt_motif_MPopupMenuPeer_initIDs; - #Java_sun_awt_motif_MScrollbarPeer_initIDs; - #Java_sun_awt_motif_MScrollPanePeer_initIDs; - #Java_sun_awt_motif_MTextAreaPeer_pSetCursor; - Java_sun_awt_motif_MToolkit_shutdown; - #Java_sun_awt_motif_MWindowPeer_initIDs; - #Java_sun_awt_motif_MWindowPeer_pCreate; - #Java_sun_awt_motif_MWindowPeer_wrapInSequenced; - Java_sun_awt_motif_X11FontMetrics_initIDs; - #Java_sun_awt_X11InputMethod_initIDs; Java_sun_awt_motif_X11OffScreenImage_updateBitmask; - #Java_sun_awt_motif_X11Selection_initIDs; - Java_sun_awt_motif_MToolkitThreadBlockedHandler_enter; - Java_sun_awt_motif_MToolkitThreadBlockedHandler_exit; Java_sun_awt_X11GraphicsConfig_init; Java_sun_awt_X11GraphicsConfig_initIDs; Java_sun_awt_X11GraphicsConfig_makeColorModel; @@ -505,26 +264,6 @@ SUNWprivate_1.1 { Java_sun_awt_X11SurfaceData_isDgaAvailable; Java_sun_awt_X11SurfaceData_setInvalid; Java_sun_awt_X11SurfaceData_flushNativeSurface; - #Java_sun_awt_motif_MEmbedCanvasPeer_initXEmbedServer; - #Java_sun_awt_motif_MEmbedCanvasPeer_destroyXEmbedServer; - #Java_sun_awt_motif_MEmbedCanvasPeer_isXEmbedActive; - #Java_sun_awt_motif_MEmbedCanvasPeer_initDispatching; - #Java_sun_awt_motif_MEmbedCanvasPeer_endDispatching; - #Java_sun_awt_motif_MEmbedCanvasPeer_embedChild; - #Java_sun_awt_motif_MEmbedCanvasPeer_childDestroyed; - #Java_sun_awt_motif_MEmbedCanvasPeer_getEmbedPreferredSize; - #Java_sun_awt_motif_MEmbedCanvasPeer_getEmbedMinimumSize; - #Java_sun_awt_motif_MEmbedCanvasPeer_getClientBounds; - #Java_sun_awt_motif_MEmbedCanvasPeer_notifyChildEmbedded; - #Java_sun_awt_motif_MEmbedCanvasPeer_detachChild; - #Java_sun_awt_motif_MEmbedCanvasPeer_forwardKeyEvent; - #Java_sun_awt_motif_MEmbedCanvasPeer_getAWTKeyCodeForKeySym; - #Java_sun_awt_motif_MEmbedCanvasPeer_sendMessage__I; - #Java_sun_awt_motif_MEmbedCanvasPeer_sendMessage__IJJJ; - #Java_sun_awt_motif_MEmbedCanvasPeer_getWindow; - #Java_sun_awt_motif_MEmbedCanvasPeer_forwardEventToEmbedded; - #Java_sun_awt_motif_GrabbedKey_initKeySymAndModifiers; - #Java_sun_awt_motif_MEmbeddedFramePeer_traverseOut; awt_display; awt_lock; awt_Lock; diff --git a/jdk/make/sun/awt/mawt.gmk b/jdk/make/sun/awt/mawt.gmk index f8160ee7d7dce8e24d64de2e2ce027d55c8aef21..cdb740b4ded67b1f03df48f25fc5212e5b4632e1 100644 --- a/jdk/make/sun/awt/mawt.gmk +++ b/jdk/make/sun/awt/mawt.gmk @@ -41,13 +41,7 @@ include $(BUILDDIR)/sun/awt/FILES_export_unix.gmk # Check which C files should be built. Headless uses only # non-motif files. Also, a version-specific motif file is # compiled based on the motif version. -ifdef HEADLESS - FILES_c = $(FILES_NO_MOTIF_c) -else -# FILES_c = $(FILES_MOTIF_c) $(FILES_NO_MOTIF_c) -# XXX if in FILES_MOTIF_c there are unrelated to motif stuff, create a separate list! - FILES_c = $(FILES_NO_MOTIF_c) -endif +FILES_c = $(FILES_NO_MOTIF_c) ifeq ($(PLATFORM), solaris) ifneq ($(ARCH), amd64) @@ -116,32 +110,6 @@ CFLAGS += -DHEADLESS=$(HEADLESS) CPPFLAGS += -DHEADLESS=$(HEADLESS) OTHER_LDLIBS = else -#CFLAGS += -DMOTIF_VERSION=$(MOTIF_VERSION) - -#ifeq ($(STATIC_MOTIF),true) -# LIBXM = $(MOTIF_LIB)/libXm.a -lXp -lXmu -# ifeq ($(PLATFORM), linux) -# ifeq ($(ARCH_DATA_MODEL), 64) -# LIBXT = -lXt -# else -# # Allows for builds on Debian GNU Linux, X11 is in a different place -# LIBXT = $(firstword $(wildcard /usr/X11R6/lib/libXt.a) \ -# $(wildcard /usr/lib/libXt.a)) -# LIBSM = $(firstword $(wildcard /usr/X11R6/lib/libSM.a) \ -# $(wildcard /usr/lib/libSM.a)) -# LIBICE = $(firstword $(wildcard /usr/X11R6/lib/libICE.a) \ -# $(wildcard /usr/lib/libICE.a)) -# endif -# endif -#else -# LIBXM = -L$(MOTIF_LIB) -lXm -lXp -# ifeq ($(PLATFORM), linux) -# LIBXT = -lXt -# LIBSM = -# LIBICE = -# endif -#endif - LIBXTST = -lXtst ifeq ($(PLATFORM), linux) ifeq ($(ARCH_DATA_MODEL), 64) diff --git a/jdk/make/sun/motif12/reorder-i586 b/jdk/make/sun/motif12/reorder-i586 deleted file mode 100644 index 9cbfe971f5ac685efc6da3087fa26a5e398b6468..0000000000000000000000000000000000000000 --- a/jdk/make/sun/motif12/reorder-i586 +++ /dev/null @@ -1,216 +0,0 @@ -data = R0x2000; -text = LOAD ?RXO; -# Test Null -# Test Exit -# Test Hello -# Test Sleep -# Test IntToString -# Test LoadToolkit -text: .text%JNI_OnLoad; -text: .text%awt_util_debug_init; -text: .text%Java_sun_awt_X11GraphicsEnvironment_initDisplay; -text: .text%awt_init_Display; -text: .text%makeDefaultConfig: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_GraphicsEnv.o; -text: .text%awt_allocate_colors; -text: .text%alloc_col: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11Color.o; -text: .text%getVirtCubeSize; -text: .text%uname: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11Color.o; -text: .text%Java_sun_awt_font_NativeFontWrapper_getFontPath; -text: .text%getPlatformFontPathChars: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o; -text: .text%getSolarisFontLocations: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o; -text: .text%fstat: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o; -text: .text%AppendFont: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o; -text: .text%freePlatformFontPathChars: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o; -text: .text%checkFont: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_Font.o; -text: .text%Java_sun_awt_X11GraphicsEnvironment_getNativeFonts; -text: .text%Java_sun_awt_font_NativeFontWrapper_setNativeFontPath; -text: .text%isDisplayLocal; -text: .text%Java_sun_awt_X11GraphicsEnvironment_checkShmExt; -text: .text%TryInitMITShm: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_GraphicsEnv.o; -text: .text%awt_output_flush; -text: .text%awtJNI_TimeMillis: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o; -text: .text%AddFontsToX11FontPath: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o; -text: .text%Java_sun_awt_X11GraphicsEnvironment_getNumScreens; -text: .text%Java_sun_awt_X11GraphicsEnvironment_getDefaultScreenNum; -text: .text%Java_sun_awt_X11GraphicsDevice_getConfigVisualId; -text: .text%Java_sun_awt_X11GraphicsDevice_isDBESupported; -text: .text%Java_sun_awt_X11GraphicsDevice_getDoubleBufferVisuals; -text: .text%Java_sun_awt_X11GraphicsConfig_initIDs; -text: .text%Java_sun_awt_X11GraphicsConfig_init; -text: .text%getAllConfigs: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_GraphicsEnv.o; -text: .text%Java_sun_awt_motif_MToolkit_init; -text: .text%getDefaultConfig; -text: .text%getScreenData; -text: .text%Java_sun_awt_PlatformFont_initIDs; -text: .text%Java_sun_awt_motif_MFontPeer_initIDs; -text: .text%awt_wm_init; -text: .text%awt_wm_initAtoms: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_getRunningWM; -text: .text%xerror_detect_wm: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_prepareIsIceWM: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_isNetSupporting: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_checkAnchor: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_getProperty32: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_isWinSupporting: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_isIceWM: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_isEnlightenment: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_getECommsWindowIDProperty: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_isSawfish: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_isNetWMName: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_isKDE2: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_isCDE: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_color_match; -text: .text%setup_modifier_map: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o; -text: .text%set_mod_mask: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o; -text: .text%awt_initialize_DataTransferer; -text: .text%awt_initialize_Xm_DnD; -text: .text%cacheDropDone: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_XmDnD.o; -text: .text%awt_motif_enableSingleDragInitiator; -text: .text%Java_java_awt_Cursor_initIDs; -text: .text%Java_sun_awt_motif_X11CustomCursor_cacheInit; -text: .text%Java_sun_awt_motif_MToolkit_run; -text: .text%awtJNI_GetCurrentThread; -text: .text%awt_MToolkit_loop: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o; -text: .text%awt_pipe_init: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o; -text: .text%awt_set_poll_timeout: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o; -text: .text%awt_events_pending: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o; -text: .text%processOneEvent: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o; -text: .text%set_toolkit_busy; -text: .text%waitForEvents; -text: .text%performPoll: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o; -text: .text%awt_get_poll_timeout: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o; -text: .text%awtJNI_CleanupGlobalRefs; -text: .text%Java_java_awt_AWTEvent_initIDs; -text: .text%Java_sun_awt_SunToolkit_wakeupEventQueue; -text: .text%Java_sun_awt_motif_MToolkit_shutdown; -text: .text%X11SD_LibDispose; -text: .text%LibDisposeStub: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o; -# Test LoadFrame -text: .text%Java_java_awt_Component_initIDs; -text: .text%Java_java_awt_Container_initIDs; -text: .text%Java_java_awt_Window_initIDs; -text: .text%Java_java_awt_Frame_initIDs; -text: .text%Java_sun_awt_SunToolkit_getPrivateKey; -text: .text%Java_java_awt_MenuComponent_initIDs; -text: .text%Java_sun_awt_X11GraphicsConfig_pGetBounds; -text: .text%Java_java_awt_Insets_initIDs; -text: .text%Java_sun_awt_motif_MComponentPeer_initIDs; -text: .text%Java_sun_awt_motif_MWindowPeer_initIDs; -text: .text%Java_sun_awt_motif_MWindowAttributes_initIDs; -text: .text%Java_sun_awt_motif_MWindowPeer_pCreate; -text: .text%awtJNI_CreateAndSetGlobalRef; -text: .text%copyGraphicsConfigToPeer; -text: .text%awt_Frame_guessInsets; -text: .text%awtJNI_ChangeInsets: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o; -text: .text%getMotifFontList; -text: .text%getMotifFontStruct; -text: .text%setDeleteCallback: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o; -text: .text%awt_canvas_create; -text: .text%awt_util_show; -text: .text%addTopLevel; -text: .text%Java_sun_awt_motif_MWindowPeer_pHide; -text: .text%Java_sun_awt_motif_MComponentPeer_pInitialize; -text: .text%awt_addWidget; -text: .text%Java_sun_awt_motif_MComponentPeer_pSetCursor; -text: .text%getCursor; -text: .text%awt_util_setCursor; -text: .text%Java_sun_awt_motif_MComponentPeer_getParent_1NoClientCode; -text: .text%Java_sun_awt_motif_MWindowPeer_pReshape; -text: .text%reshape: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o; -text: .text%awtJNI_setMbAndWwHeightAndOffsets: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o; -text: .text%awt_wm_configureGravityBuggy; -text: .text%Java_sun_awt_X11SurfaceData_initIDs; -text: .text%Java_sun_awt_motif_MToolkit_loadSystemColors; -text: .text%colorToRGB: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o; -text: .text%awt_allocate_systemcolors; -text: .text%Java_sun_awt_X11GraphicsConfig_makeColorModel; -text: .text%awtJNI_GetColorModel; -text: .text%Java_sun_awt_X11SurfaceData_initOps; -text: .text%Java_sun_awt_motif_MWindowPeer_pSetTitle; -text: .text%Java_sun_awt_motif_MWindowPeer_setResizable; -text: .text%Java_java_awt_Font_initIDs; -text: .text%Java_sun_awt_motif_MComponentPeer_pSetFont; -text: .text%awt_util_mapChildren; -text: .text%changeFont: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_Component.o; -text: .text%Java_sun_awt_motif_MComponentPeer_pSetBackground; -text: .text%getGraphicsConfigFromComponentPeer; -text: .text%awtJNI_GetColorForVis; -text: .text%ColorProc; -text: .text%Java_sun_awt_motif_MComponentPeer_pSetForeground; -text: .text%Java_sun_awt_motif_MWindowPeer_pShow; -text: .text%Java_sun_awt_motif_MWindowPeer_pShowModal; -text: .text%awt_wm_setExtendedState; -text: .text%awt_wm_doStateProtocolNet: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_doStateProtocolWin: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_setShellDecor; -text: .text%awt_wm_setMotifDecor: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_setOLDecor: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_normalizeMotifDecor: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_removeSizeHints; -text: .text%shellEH: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o; -text: .text%awt_wm_isStateChange; -text: .text%awt_wm_getWMState; -text: .text%Java_sun_awt_motif_MGlobalCursorManager_cacheInit; -text: .text%innerCanvasEH: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o; -text: .text%reconfigureOuterCanvas: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o; -text: .text%outerCanvasResizeCB: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o; -text: .text%Java_sun_awt_motif_MGlobalCursorManager_findHeavyweightUnderCursor; -text: .text%awt_wm_getInsetsFromProp; -text: .text%syncTopLevelPos; -text: .text%raiseInputMethodWindow; -text: .text%awt_wm_getExtendedState: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_canvas_event_handler; -text: .text%awt_canvas_handleEvent; -text: .text%HandleExposeEvent: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/canvas.o; -text: .text%checkForExpose: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/canvas.o; -text: .text%expandDamageRect: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/canvas.o; -text: .text%getCurComponent; -text: .text%Java_java_awt_KeyboardFocusManager_initIDs; -text: .text%Java_java_awt_event_InputEvent_initIDs; -text: .text%Java_java_awt_event_KeyEvent_initIDs; -text: .text%Java_java_awt_AWTKeyStroke_allocateNewInstance; -text: .text%Java_sun_awt_motif_MComponentPeer_nativeHandleEvent; -text: .text%Java_java_awt_Event_initIDs; -# Test LoadJFrame -text: .text%Java_sun_awt_motif_MToolkit_getScreenWidth; -text: .text%Java_sun_awt_motif_MToolkit_getScreenHeight; -text: .text%X11SD_Lock: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o; -text: .text%X11SD_InitWindow: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o; -text: .text%GetLockStub: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o; -text: .text%X11SD_GetRasInfo: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o; -text: .text%X11SD_Unlock: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o; -text: .text%X11SD_InitClip: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o; -text: .text%XRequestSentStub: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o; -# Test JHello -text: .text%AWTLoadFont; -text: .text%AWTFontMaxByte1; -text: .text%AWTFontMaxCharOrByte2; -text: .text%AWTFontMaxBounds; -text: .text%AWTCharAscent; -text: .text%AWTCharDescent; -text: .text%AWTCharWidth; -text: .text%AWTFontMinByte1; -text: .text%AWTFontMinCharOrByte2; -text: .text%AWTFontPerChar; -text: .text%AWTCharRBearing; -text: .text%AWTCharLBearing; -text: .text%Java_sun_awt_X11SurfaceData_setInvalid; -text: .text%Java_sun_awt_X11SurfaceData_nativeDispose; -text: .text%X11SurfaceData_GetOps; -# SwingSet -text: .text%Java_sun_awt_motif_MWindowPeer_setSaveUnder; -text: .text%Java_sun_awt_motif_MCanvasPeer_create; -text: .text%awt_util_insertCallback; -text: .text%Java_sun_awt_motif_MComponentPeer_getComponents_1NoClientCode; -text: .text%Java_sun_awt_motif_MComponentPeer_pReshape; -text: .text%awt_util_reshape; -text: .text%Java_sun_awt_motif_MComponentPeer_pShow; -text: .text%Java_sun_awt_motif_MDataTransferer_getAtomForTarget; -text: .text%Java_sun_awt_motif_MComponentPeer_addNativeDropTarget; -text: .text%register_drop_site; -text: .text%update_drop_site_hierarchy: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_XmDnD.o; -text: .text%AWTFontDefaultChar; -text: .text%AWTFontGenerateImage; -text: .text%CreatePixmapAndGC; -text: .text%isAncestor; -text: .text%xerror_handler; diff --git a/jdk/make/sun/motif12/reorder-sparc b/jdk/make/sun/motif12/reorder-sparc deleted file mode 100644 index 8ac5471aba64f243ec788b53a2e0b340d8882383..0000000000000000000000000000000000000000 --- a/jdk/make/sun/motif12/reorder-sparc +++ /dev/null @@ -1,212 +0,0 @@ -data = R0x2000; -text = LOAD ?RXO; -# Test Null -# Test Exit -# Test Hello -# Test Sleep -# Test IntToString -# Test LoadToolkit -text: .text%JNI_OnLoad; -text: .text%awt_util_debug_init; -text: .text%Java_sun_awt_X11GraphicsEnvironment_initDisplay; -text: .text%awt_init_Display; -text: .text%makeDefaultConfig: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_GraphicsEnv.o; -text: .text%awt_allocate_colors; -text: .text%Java_sun_awt_font_NativeFontWrapper_getFontPath; -text: .text%getPlatformFontPathChars: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o; -text: .text%getSolarisFontLocations: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o; -text: .text%AppendFont: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o; -text: .text%freePlatformFontPathChars: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o; -text: .text%checkFont: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_Font.o; -text: .text%Java_sun_awt_X11GraphicsEnvironment_getNativeFonts; -text: .text%Java_sun_awt_font_NativeFontWrapper_setNativeFontPath; -text: .text%isDisplayLocal; -text: .text%Java_sun_awt_X11GraphicsEnvironment_checkShmExt; -text: .text%TryInitMITShm: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_GraphicsEnv.o; -text: .text%awt_output_flush; -text: .text%awtJNI_TimeMillis: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o; -text: .text%AddFontsToX11FontPath: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o; -text: .text%Java_sun_awt_X11GraphicsEnvironment_getNumScreens; -text: .text%Java_sun_awt_X11GraphicsEnvironment_getDefaultScreenNum; -text: .text%Java_sun_awt_X11GraphicsDevice_getConfigVisualId; -text: .text%Java_sun_awt_X11GraphicsDevice_isDBESupported; -text: .text%Java_sun_awt_X11GraphicsDevice_getDoubleBufferVisuals; -text: .text%Java_sun_awt_X11GraphicsConfig_initIDs; -text: .text%Java_sun_awt_X11GraphicsConfig_init; -text: .text%getAllConfigs: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_GraphicsEnv.o; -text: .text%Java_sun_awt_motif_MToolkit_init; -text: .text%getDefaultConfig; -text: .text%getScreenData; -text: .text%Java_sun_awt_PlatformFont_initIDs; -text: .text%Java_sun_awt_motif_MFontPeer_initIDs; -text: .text%awt_wm_init; -text: .text%awt_wm_initAtoms: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_getRunningWM; -text: .text%xerror_detect_wm: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_prepareIsIceWM: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_isNetSupporting: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_checkAnchor: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_getProperty32: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_isWinSupporting: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_isIceWM: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_isEnlightenment: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_getECommsWindowIDProperty: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_isSawfish: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_isNetWMName: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_isKDE2: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_isCDE: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_color_matchTC; -text: .text%setup_modifier_map: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o; -text: .text%set_mod_mask: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o; -text: .text%awt_initialize_DataTransferer; -text: .text%awt_initialize_Xm_DnD; -text: .text%cacheDropDone: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_XmDnD.o; -text: .text%awt_motif_enableSingleDragInitiator; -text: .text%Java_java_awt_Cursor_initIDs; -text: .text%Java_sun_awt_motif_X11CustomCursor_cacheInit; -text: .text%Java_sun_awt_motif_MToolkit_run; -text: .text%awtJNI_GetCurrentThread; -text: .text%awt_MToolkit_loop: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o; -text: .text%awt_pipe_init: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o; -text: .text%awt_set_poll_timeout: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o; -text: .text%awt_events_pending: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o; -text: .text%processOneEvent: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o; -text: .text%set_toolkit_busy; -text: .text%waitForEvents; -text: .text%performPoll: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o; -text: .text%awt_get_poll_timeout: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o; -text: .text%awtJNI_CleanupGlobalRefs; -text: .text%Java_java_awt_AWTEvent_initIDs; -text: .text%Java_sun_awt_SunToolkit_wakeupEventQueue; -text: .text%Java_sun_awt_motif_MToolkit_shutdown; -text: .text%X11SD_LibDispose; -text: .text%LibDisposeStub: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o; -# Test LoadFrame -text: .text%Java_java_awt_Component_initIDs; -text: .text%Java_java_awt_Container_initIDs; -text: .text%Java_java_awt_Window_initIDs; -text: .text%Java_java_awt_Frame_initIDs; -text: .text%Java_sun_awt_SunToolkit_getPrivateKey; -text: .text%Java_java_awt_MenuComponent_initIDs; -text: .text%Java_sun_awt_X11GraphicsConfig_pGetBounds; -text: .text%Java_java_awt_Insets_initIDs; -text: .text%Java_sun_awt_motif_MComponentPeer_initIDs; -text: .text%Java_sun_awt_motif_MWindowPeer_initIDs; -text: .text%Java_sun_awt_motif_MWindowAttributes_initIDs; -text: .text%Java_sun_awt_motif_MWindowPeer_pCreate; -text: .text%awtJNI_CreateAndSetGlobalRef; -text: .text%copyGraphicsConfigToPeer; -text: .text%awt_Frame_guessInsets; -text: .text%awtJNI_ChangeInsets: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o; -text: .text%getMotifFontList; -text: .text%getMotifFontStruct; -text: .text%setDeleteCallback: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o; -text: .text%ColorProc; -text: .text%awt_canvas_create; -text: .text%awt_util_show; -text: .text%addTopLevel; -text: .text%Java_sun_awt_motif_MWindowPeer_pHide; -text: .text%Java_sun_awt_motif_MComponentPeer_pInitialize; -text: .text%awt_addWidget; -text: .text%Java_sun_awt_motif_MComponentPeer_pSetCursor; -text: .text%getCursor; -text: .text%awt_util_setCursor; -text: .text%Java_sun_awt_motif_MComponentPeer_getParent_1NoClientCode; -text: .text%Java_sun_awt_motif_MWindowPeer_pReshape; -text: .text%reshape: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o; -text: .text%awtJNI_setMbAndWwHeightAndOffsets: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o; -text: .text%awt_wm_configureGravityBuggy; -text: .text%Java_sun_awt_X11SurfaceData_initIDs; -text: .text%Java_sun_awt_motif_MToolkit_loadSystemColors; -text: .text%colorToRGB: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o; -text: .text%Java_sun_awt_X11GraphicsConfig_makeColorModel; -text: .text%awtJNI_GetColorModel; -text: .text%Java_sun_awt_X11SurfaceData_initOps; -text: .text%Java_sun_awt_motif_MWindowPeer_pSetTitle; -text: .text%Java_sun_awt_motif_MWindowPeer_setResizable; -text: .text%Java_java_awt_Font_initIDs; -text: .text%Java_sun_awt_motif_MComponentPeer_pSetFont; -text: .text%awt_util_mapChildren; -text: .text%changeFont: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_Component.o; -text: .text%Java_sun_awt_motif_MComponentPeer_pSetBackground; -text: .text%getGraphicsConfigFromComponentPeer; -text: .text%awtJNI_GetColorForVis; -text: .text%Java_sun_awt_motif_MComponentPeer_pSetForeground; -text: .text%Java_sun_awt_motif_MWindowPeer_pShow; -text: .text%Java_sun_awt_motif_MWindowPeer_pShowModal; -text: .text%awt_wm_setExtendedState; -text: .text%awt_wm_doStateProtocolNet: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_doStateProtocolWin: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_setShellDecor; -text: .text%awt_wm_setMotifDecor: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_setOLDecor: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_normalizeMotifDecor: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%awt_wm_removeSizeHints; -text: .text%Java_sun_awt_motif_MGlobalCursorManager_cacheInit; -text: .text%Java_sun_awt_motif_MGlobalCursorManager_findHeavyweightUnderCursor; -text: .text%getCurComponent; -text: .text%shellEH: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o; -text: .text%awt_wm_isStateChange; -text: .text%awt_wm_getWMState; -text: .text%innerCanvasEH: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o; -text: .text%reconfigureOuterCanvas: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o; -text: .text%outerCanvasResizeCB: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o; -text: .text%awt_wm_getInsetsFromProp; -text: .text%syncTopLevelPos; -text: .text%raiseInputMethodWindow; -text: .text%awt_canvas_event_handler; -text: .text%awt_canvas_handleEvent; -text: .text%HandleExposeEvent: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/canvas.o; -text: .text%checkForExpose: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/canvas.o; -text: .text%awt_wm_getExtendedState: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o; -text: .text%expandDamageRect: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/canvas.o; -text: .text%Java_java_awt_KeyboardFocusManager_initIDs; -text: .text%Java_java_awt_event_InputEvent_initIDs; -text: .text%Java_java_awt_event_KeyEvent_initIDs; -text: .text%Java_java_awt_AWTKeyStroke_allocateNewInstance; -text: .text%Java_sun_awt_motif_MComponentPeer_nativeHandleEvent; -text: .text%Java_java_awt_Event_initIDs; -# Test LoadJFrame -text: .text%awtJNI_ThreadYield; -text: .text%Java_sun_awt_motif_MToolkit_getScreenWidth; -text: .text%Java_sun_awt_motif_MToolkit_getScreenHeight; -text: .text%X11SD_Lock: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o; -text: .text%X11SD_InitWindow: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o; -text: .text%GetLockStub: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o; -text: .text%X11SD_GetRasInfo: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o; -text: .text%X11SD_Unlock: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o; -text: .text%X11SD_InitClip: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o; -text: .text%XRequestSentStub: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o; -# Test JHello -text: .text%AWTLoadFont; -text: .text%AWTFontMaxByte1; -text: .text%AWTFontMaxCharOrByte2; -text: .text%AWTFontMaxBounds; -text: .text%AWTCharAscent; -text: .text%AWTCharDescent; -text: .text%AWTCharWidth; -text: .text%AWTFontMinByte1; -text: .text%AWTFontMinCharOrByte2; -text: .text%AWTFontPerChar; -text: .text%AWTCharRBearing; -text: .text%AWTCharLBearing; -text: .text%Java_sun_awt_X11SurfaceData_setInvalid; -# SwingSet -text: .text%Java_sun_awt_motif_MWindowPeer_setSaveUnder; -text: .text%Java_sun_awt_X11SurfaceData_nativeDispose; -text: .text%X11SurfaceData_GetOps; -text: .text%Java_sun_awt_motif_MCanvasPeer_create; -text: .text%awt_util_insertCallback; -text: .text%Java_sun_awt_motif_MComponentPeer_getComponents_1NoClientCode; -text: .text%Java_sun_awt_motif_MComponentPeer_pReshape; -text: .text%awt_util_reshape; -text: .text%Java_sun_awt_motif_MComponentPeer_pShow; -text: .text%Java_sun_awt_motif_MDataTransferer_getAtomForTarget; -text: .text%Java_sun_awt_motif_MComponentPeer_addNativeDropTarget; -text: .text%register_drop_site; -text: .text%update_drop_site_hierarchy: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_XmDnD.o; -text: .text%AWTFontDefaultChar; -text: .text%isAncestor; -text: .text%xerror_handler; -text: .text%AWTFontGenerateImage; -text: .text%CreatePixmapAndGC; diff --git a/jdk/make/sun/motif12/reorder-sparcv9 b/jdk/make/sun/motif12/reorder-sparcv9 deleted file mode 100644 index 8542b6c608c68017ebd69d79ea5c008e5f0f6896..0000000000000000000000000000000000000000 --- a/jdk/make/sun/motif12/reorder-sparcv9 +++ /dev/null @@ -1,233 +0,0 @@ -data = R0x2000; -text = LOAD ?RXO; -# Test Null -# Test Exit -# Test Hello -# Test Sleep -# Test IntToString -# Test LoadToolkit -text: .text%JNI_OnLoad; -text: .text%awt_util_debug_init; -text: .text%Java_java_awt_Toolkit_initIDs; -text: .text%Java_sun_awt_X11GraphicsEnvironment_initDisplay; -text: .text%awt_init_Display; -text: .text%makeDefaultConfig: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_GraphicsEnv.o; -text: .text%awt_allocate_colors; -text: .text%make_uns_ordered_dither_array; -text: .text%checkFont: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_Font.o; -text: .text%Java_sun_awt_X11GraphicsEnvironment_getNativeFonts; -text: .text%Java_sun_awt_X11GraphicsEnvironment_getNumScreens; -text: .text%Java_sun_awt_X11GraphicsEnvironment_getDefaultScreenNum; -text: .text%Java_sun_awt_X11GraphicsDevice_getConfigVisualId; -text: .text%Java_sun_awt_X11GraphicsConfig_initIDs; -text: .text%Java_sun_awt_X11GraphicsConfig_init; -text: .text%getAllConfigs: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_GraphicsEnv.o; -text: .text%awt_output_flush; -text: .text%awtJNI_TimeMillis: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o; -text: .text%Java_sun_awt_motif_MToolkit_init; -text: .text%getDefaultConfig; -text: .text%getScreenData; -text: .text%Java_sun_awt_PlatformFont_initIDs; -text: .text%Java_sun_awt_motif_MFontPeer_initIDs; -text: .text%awt_color_matchTC; -text: .text%setup_modifier_map: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o; -text: .text%set_mod_mask: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o; -text: .text%awt_initialize_Xm_DnD; -text: .text%Java_java_awt_Cursor_initIDs; -text: .text%Java_sun_awt_motif_X11CustomCursor_cacheInit; -text: .text%Java_java_awt_Dimension_initIDs; -text: .text%Java_sun_awt_motif_MToolkit_run; -text: .text%awtJNI_GetCurrentThread; -text: .text%awt_MToolkit_loop: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o; -text: .text%awt_pipe_init: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o; -text: .text%awt_set_poll_timeout: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o; -text: .text%awt_events_pending: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o; -text: .text%processOneEvent: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o; -text: .text%waitForEvents: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o; -text: .text%performPoll: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o; -text: .text%awt_get_poll_timeout: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o; -text: .text%awtJNI_CleanupGlobalRefs; -# Test LoadFrame -text: .text%Java_java_awt_Component_initIDs; -text: .text%Java_java_awt_Container_initIDs; -text: .text%Java_java_awt_Window_initIDs; -text: .text%Java_java_awt_Frame_initIDs; -text: .text%Java_sun_awt_SunToolkit_getPrivateKey; -text: .text%Java_java_awt_MenuComponent_initIDs; -text: .text%Java_sun_awt_X11GraphicsConfig_pGetBounds; -text: .text%Java_java_awt_Rectangle_initIDs; -text: .text%Java_sun_awt_motif_MComponentPeer_initIDs; -text: .text%Java_sun_awt_motif_MWindowPeer_initIDs; -text: .text%Java_java_awt_Insets_initIDs; -text: .text%Java_sun_awt_motif_MWindowAttributes_initIDs; -text: .text%Java_sun_awt_motif_MWindowPeer_create; -text: .text%awtJNI_CreateAndSetGlobalRef; -text: .text%copyGraphicsConfigToPeer; -text: .text%awt_Frame_guessInsets; -text: .text%awt_util_runningWindowManager; -text: .text%awt_winmgrerr: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_util.o; -text: .text%awtJNI_ChangeInsets: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o; -text: .text%getMotifFontList; -text: .text%getMotifFontStruct; -text: .text%setDeleteCallback: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o; -text: .text%ColorProc; -text: .text%awt_canvas_create; -text: .text%awt_util_show; -text: .text%addTopLevel; -text: .text%Java_sun_awt_motif_MWindowPeer_pHide; -text: .text%Java_sun_awt_motif_MComponentPeer_pInitialize; -text: .text%awt_addWidget; -text: .text%Java_sun_awt_motif_MComponentPeer_setCursor; -text: .text%getCursor; -text: .text%awt_util_setCursor; -text: .text%Java_sun_awt_motif_MComponentPeer_getParent_1NoClientCode; -text: .text%Java_sun_awt_motif_MWindowPeer_pReshape; -text: .text%reshape: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o; -text: .text%awtJNI_setMbAndWwHeightAndOffsets: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o; -text: .text%awt_util_wmPositionsShellXY; -text: .text%Java_sun_awt_motif_MWindowPeer_pSetTitle; -text: .text%Java_sun_awt_motif_MWindowPeer_setResizable; -text: .text%Java_java_awt_Font_initIDs; -text: .text%Java_sun_awt_motif_MComponentPeer_pSetFont; -text: .text%awt_util_mapChildren; -text: .text%changeFont: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_Component.o; -text: .text%Java_java_awt_Color_initIDs; -text: .text%Java_sun_awt_motif_MToolkit_loadSystemColors; -text: .text%colorToRGB: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o; -text: .text%Java_sun_awt_motif_MComponentPeer_pSetBackground; -text: .text%getGraphicsConfigFromComponentPeer; -text: .text%awtJNI_GetColorForVis; -text: .text%Java_sun_awt_motif_MComponentPeer_pSetForeground; -text: .text%Java_sun_awt_motif_MWindowPeer_pShow; -text: .text%Java_sun_awt_motif_MWindowPeer_pShowModal; -text: .text%setStateHints: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o; -text: .text%awt_util_setMinMaxSizeProps; -text: .text%innerCanvasEH: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o; -text: .text%reconfigureOuterCanvas: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o; -text: .text%Java_java_awt_AWTEvent_initIDs; -text: .text%outerCanvasResizeCB: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o; -text: .text%Java_sun_awt_motif_MGlobalCursorManager_cacheInit; -text: .text%shellEH: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o; -text: .text%Java_sun_awt_motif_MGlobalCursorManager_findHeavyweightUnderCursor; -text: .text%getCurComponent; -text: .text%get_awt_TopLevelInsetsProp; -text: .text%syncTopLevelPos; -text: .text%Java_sun_awt_motif_MComponentPeer_nativeHandleEvent; -text: .text%raiseInputMethodWindow; -text: .text%getWindowState: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o; -text: .text%awt_canvas_event_handler; -text: .text%awt_canvas_handleEvent; -text: .text%HandleExposeEvent: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/canvas.o; -text: .text%checkForExpose: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/canvas.o; -text: .text%Java_java_awt_Event_initIDs; -text: .text%Java_java_awt_image_ColorModel_initIDs; -text: .text%Java_sun_awt_motif_X11Graphics_cacheInit; -text: .text%InitMITShm: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_Graphics.o; -text: .text%Java_sun_java2d_loops_RasterOutputManager_getPlatformFontVar; -text: .text%Java_sun_awt_motif_X11Graphics_createFromComponent; -text: .text%Java_sun_awt_motif_X11Graphics_pSetForeground; -text: .text%awt_init_gc; -text: .text%Java_sun_awt_motif_X11Graphics_pSetFont; -text: .text%awtJNI_GetFontData; -text: .text%awtJNI_IsMultiFont; -text: .text%Java_sun_awt_FontDescriptor_initIDs; -text: .text%loadFont; -text: .text%Java_sun_awt_motif_X11Graphics_setOrigin; -text: .text%Java_sun_awt_motif_X11Graphics_setLineAttrs; -text: .text%Java_sun_awt_motif_X11Graphics_changeClip; -text: .text%Java_sun_awt_motif_X11Graphics_devClearRect; -text: .text%Java_sun_awt_motif_X11Graphics_disposeImpl; -# Test LoadJFrame -text: .text%Java_java_awt_event_InputEvent_initIDs; -text: .text%Java_java_awt_event_KeyEvent_initIDs; -text: .text%expandDamageRect: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/canvas.o; -text: .text%awtJNI_ThreadYield; -text: .text%Java_sun_awt_motif_X11Graphics_createFromGraphics; -text: .text%Java_sun_awt_motif_MToolkit_getScreenWidth; -text: .text%Java_sun_awt_motif_MToolkit_getScreenHeight; -text: .text%Java_sun_awt_X11GraphicsConfig_makeColorModel; -text: .text%awtJNI_GetColorModel; -text: .text%Java_java_awt_image_BufferedImage_initIDs; -text: .text%Java_java_awt_image_Raster_initIDs; -text: .text%Java_java_awt_image_SampleModel_initIDs; -text: .text%Java_java_awt_image_SinglePixelPackedSampleModel_initIDs; -text: .text%Java_sun_awt_image_IntegerComponentRaster_initIDs; -text: .text%Java_sun_java2d_loops_ImageData_initIDs; -text: .text%Java_sun_java2d_loops_IntDiscreteRenderer_devSetRect; -text: .text%Java_sun_awt_motif_X11Graphics_X11LockViewResources; -text: .text%X11DeferredLockViewResources: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_Graphics.o; -text: .text%getLockMethod: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_Graphics.o; -text: .text%DGA_DeferredLockViewResources; -text: .text%setLockMethod: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_Graphics.o; -text: .text%getPrimitiveType: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_Graphics.o; -text: .text%Java_sun_awt_motif_X11Graphics_X11UnLockViewResources; -text: .text%DGA_UnlockViewResources; -text: .text%Java_sun_java2d_loops_DefaultComponent_IntIsomorphicCopy; -text: .text%minImageWidths; -text: .text%minImageRows; -text: .text%getIntImageLockInfo; -text: .text%lockIntImageData; -text: .text%unlockIntImageData; -# Test JHello -text: .text%Java_java_awt_FontMetrics_initIDs; -# SwingSet -text: .text%Java_sun_awt_image_Image_initIDs; -text: .text%Java_sun_awt_image_ImageRepresentation_initIDs; -text: .text%Java_java_awt_image_IndexColorModel_initIDs; -text: .text%Java_sun_awt_motif_MWindowPeer_setSaveUnder; -text: .text%Java_java_awt_AWTEvent_freeNativeData; -text: .text%Java_sun_java2d_loops_DefaultComponent_IntRgbToXbgr; -text: .text%Java_sun_awt_motif_MCanvasPeer_create; -text: .text%awt_util_insertCallback; -text: .text%Java_sun_awt_motif_MComponentPeer_getComponents_1NoClientCode; -text: .text%Java_sun_awt_motif_MComponentPeer_pReshape; -text: .text%awt_util_reshape; -text: .text%Java_sun_awt_motif_MComponentPeer_pShow; -text: .text%Java_sun_java2d_loops_IntDiscreteRenderer_devDrawLine; -text: .text%doDrawLine: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/IntDiscreteRenderer.o; -text: .text%adjustLine: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/IntDiscreteRenderer.o; -text: .text%Java_sun_awt_image_GifImageDecoder_initIDs; -text: .text%Java_java_awt_image_ComponentSampleModel_initIDs; -text: .text%Java_sun_awt_image_ByteComponentRaster_initIDs; -text: .text%Java_sun_awt_image_GifImageDecoder_parseImage; -text: .text%Java_sun_awt_image_ImageRepresentation_setBytePixels; -text: .text%Java_sun_java2d_loops_IntDiscreteRenderer_devDrawRect; -text: .text%outcode: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/IntDiscreteRenderer.o; -text: .text%Java_sun_java2d_loops_ImageData_isAllOpaqueGrayICM; -text: .text%Java_sun_java2d_loops_GIFAcceleratorLoops_LUTcopyTo32BitXBgr; -text: .text%getByteIndexedImageLockInfo; -text: .text%lockByteIndexedImageData; -text: .text%unlockByteIndexedImageData; -text: .text%Java_sun_java2d_loops_GIFAcceleratorLoops_LUTxparTo32BitXBgr; -text: .text%shouldDispatchToWidget: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o; -text: .text%awtMenuIsActive; -text: .text%awt_util_focusIsOnMenu; -text: .text%awt_isModal; -text: .text%findWidgetInfo: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o; -text: .text%awt_copyXEvent; -text: .text%awt_post_java_mouse_event; -text: .text%Java_java_awt_event_MouseEvent_initIDs; -text: .text%sysTimeMillis; -text: .text%updateCursor; -text: .text%awt_setActivatedShell; -text: .text%handleFocusEvent; -text: .text%awt_post_java_focus_event; -text: .text%getModifiers; -text: .text%Java_java_awt_AWTEvent_copyDataFieldInto; -text: .text%Java_sun_awt_motif_X11InputMethod_initIDs; -text: .text%Java_sun_awt_motif_X11InputMethod_openXIM; -text: .text%awt_put_back_event; -text: .text%awt_get_next_put_back_event: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o; -text: .text%null_event_handler: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o; -text: .text%Java_sun_awt_motif_MGlobalCursorManager_getCursorPos; -text: .text%Java_sun_awt_motif_MGlobalCursorManager_findComponentAt; -text: .text%Java_sun_awt_motif_MWindowPeer_hasTextComponents; -text: .text%Java_sun_awt_motif_X11InputMethod_createXICNative; -text: .text%findClass: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_InputMethod.o; -text: .text%createXIC: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_InputMethod.o; -text: .text%Java_sun_awt_motif_X11InputMethod_setXICFocus; -text: .text%setXICWindowFocus: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_InputMethod.o; -text: .text%setXICFocus: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_InputMethod.o; -text: .text%getAncestorShell; -text: .text%Java_sun_awt_motif_X11InputMethod_turnoffStatusWindow; -text: .text%Frame_quit: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o; diff --git a/jdk/make/sun/xawt/mapfile-vers b/jdk/make/sun/xawt/mapfile-vers index abf2cc32361f8890f661887081c92794d744ab05..5455530cbed29a56df7e02df212c16b6aea39c8d 100644 --- a/jdk/make/sun/xawt/mapfile-vers +++ b/jdk/make/sun/xawt/mapfile-vers @@ -256,8 +256,6 @@ SUNWprivate_1.1 { Java_sun_awt_X11_XToolkit_waitForEvents; Java_java_awt_Event_initIDs; - Java_sun_awt_motif_X11FontMetrics_initIDs; - Java_sun_awt_motif_X11FontMetrics_init; Java_sun_awt_X11_XWindow_x11inputMethodLookupString; Java_sun_awt_X11_XWindow_haveCurrentX11InputMethodInstance; Java_java_awt_AWTEvent_nativeSetSource; @@ -265,7 +263,6 @@ SUNWprivate_1.1 { Java_sun_awt_PlatformFont_initIDs; Java_sun_awt_FontDescriptor_initIDs; Java_sun_awt_X11_XFontPeer_initIDs; - Java_sun_awt_motif_X11FontMetrics_getMFCharsWidth; Java_sun_awt_X11InputMethod_initIDs; Java_sun_awt_X11InputMethod_resetXIC; Java_sun_awt_X11InputMethod_disposeXIC; diff --git a/jdk/src/solaris/classes/sun/awt/X11/ListHelper.java b/jdk/src/solaris/classes/sun/awt/X11/ListHelper.java index f95913791de0caf11e09b1e351549bc7ea757aa3..9301eaf6edc7ebffda7a8dd834f997c3cff798fe 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/ListHelper.java +++ b/jdk/src/solaris/classes/sun/awt/X11/ListHelper.java @@ -29,10 +29,8 @@ import java.awt.*; import java.awt.event.MouseEvent; import java.awt.event.MouseWheelEvent; import java.awt.event.AdjustmentEvent; -import java.util.List; import java.util.ArrayList; import java.util.Iterator; -import sun.awt.motif.X11FontMetrics; import sun.util.logging.PlatformLogger; // FIXME: implement multi-select diff --git a/jdk/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java index 9e7ac7c9456c7d4b75d1fe53a955e9f85934503a..2d8a5285fcb568c0eb408fe029bacc762663bf31 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java @@ -35,7 +35,6 @@ import java.awt.image.ImageProducer; import java.awt.image.VolatileImage; import java.awt.peer.*; import sun.awt.*; -import sun.awt.motif.X11FontMetrics; import java.lang.reflect.*; import sun.util.logging.PlatformLogger; import java.util.*; diff --git a/jdk/src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java index 1ab53e63e0a7dd27cf1ac11eb755409089ebb213..4d75d2110402948fbd921eba1d8e04de8ef7453d 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java @@ -34,8 +34,6 @@ import java.awt.image.VolatileImage; import java.awt.peer.*; import sun.java2d.pipe.Region; import sun.awt.*; -import sun.awt.motif.MToolkit; -import sun.awt.motif.X11FontMetrics; public class XEmbedChildProxyPeer implements ComponentPeer, XEventDispatcher{ XEmbeddingContainer container; diff --git a/jdk/src/solaris/classes/sun/awt/motif/AWTLockAccess.java b/jdk/src/solaris/classes/sun/awt/motif/AWTLockAccess.java deleted file mode 100644 index b05828f9fd6bc8a6284bb78dde45fecd3b2c8108..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/classes/sun/awt/motif/AWTLockAccess.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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. - */ - -package sun.awt.motif; - -final class AWTLockAccess { - static native void awtLock(); - static native void awtUnlock(); - static void awtWait() { awtWait(0); } - static native void awtWait(long timeout); - static native void awtNotifyAll(); -} diff --git a/jdk/src/solaris/classes/sun/awt/motif/MFontConfiguration.java b/jdk/src/solaris/classes/sun/awt/motif/MFontConfiguration.java index 25e676eda53e83385f67ee915b228d0c6169e026..6c28d201779c2410af21c3295f75f946ac7146c9 100644 --- a/jdk/src/solaris/classes/sun/awt/motif/MFontConfiguration.java +++ b/jdk/src/solaris/classes/sun/awt/motif/MFontConfiguration.java @@ -25,26 +25,19 @@ package sun.awt.motif; -import java.awt.Font; -import java.io.BufferedReader; +import sun.awt.FontConfiguration; +import sun.awt.X11FontManager; +import sun.font.FontUtilities; +import sun.font.SunFontManager; +import sun.util.logging.PlatformLogger; + import java.io.File; import java.io.FileInputStream; -import java.io.InputStreamReader; import java.nio.charset.Charset; import java.util.HashMap; import java.util.HashSet; -import java.util.Locale; import java.util.Properties; import java.util.Scanner; -import sun.awt.FontConfiguration; -import sun.awt.X11FontManager; -import sun.awt.X11GraphicsEnvironment; -import sun.font.FontManager; -import sun.font.SunFontManager; -import sun.font.FontManagerFactory; -import sun.font.FontUtilities; -import sun.java2d.SunGraphicsEnvironment; -import sun.util.logging.PlatformLogger; public class MFontConfiguration extends FontConfiguration { @@ -258,47 +251,6 @@ public class MFontConfiguration extends FontConfiguration { return Charset.forName("ISO8859_1"); } - /* methods for Motif support *********************************************/ - - private String[][] motifFontSets = new String[NUM_FONTS][NUM_STYLES]; - - public String getMotifFontSet(String fontName, int style) { - assert isLogicalFontFamilyName(fontName); - fontName = fontName.toLowerCase(Locale.ENGLISH); - int fontIndex = getFontIndex(fontName); - int styleIndex = getStyleIndex(style); - return getMotifFontSet(fontIndex, styleIndex); - } - - private String getMotifFontSet(int fontIndex, int styleIndex) { - String fontSet = motifFontSets[fontIndex][styleIndex]; - if (fontSet == null) { - fontSet = buildMotifFontSet(fontIndex, styleIndex); - motifFontSets[fontIndex][styleIndex] = fontSet; - } - return fontSet; - } - - private String buildMotifFontSet(int fontIndex, int styleIndex) { - StringBuilder buffer = new StringBuilder(); - short[] scripts = getCoreScripts(fontIndex); - for (int i = 0; i < scripts.length; i++) { - short nameID = getComponentFontIDMotif(scripts[i], fontIndex, styleIndex); - if (nameID == 0) { - nameID = getComponentFontID(scripts[i], fontIndex, styleIndex); - } - String name = getComponentFontName(nameID); - if (name == null || name.endsWith("fontspecific")) { - continue; - } - if (buffer.length() > 0) { - buffer.append(','); - } - buffer.append(name); - } - return buffer.toString(); - } - protected String getFaceNameFromComponentFontName(String componentFontName) { return null; } @@ -315,36 +267,6 @@ public class MFontConfiguration extends FontConfiguration { return ((X11FontManager) fontManager).getFileNameFromXLFD(componentFontName); } - /** - * Get default font for Motif widgets to use, preventing them from - * wasting time accessing inappropriate X resources. This is called - * only from native code. - * - * This is part of a Motif specific performance enhancement. By - * default, when Motif widgets are created and initialized, Motif will - * set up default fonts for the widgets, which we ALWAYS override. - * This set up includes finding the default font in the widget's X - * resources and fairly expensive requests of the X server to identify - * the specific font or fontset. We avoid all of this overhead by - * providing a well known font to use at the creation of widgets, where - * possible. - * - * The X11 fonts are specified by XLFD strings which have %d as a - * marker to indicate where the fontsize should be substituted. [The - * libc function sprintf() is used to replace it.] The value 140 - * specifies a font size of 14 points. - */ - private static String getDefaultMotifFontSet() { - String font = ((MFontConfiguration) getFontConfiguration()).getMotifFontSet("sansserif", Font.PLAIN); - if (font != null) { - int i; - while ((i = font.indexOf("%d")) >= 0) { - font = font.substring(0, i) + "140" + font.substring(i+2); - } - } - return font; - } - public HashSet getAWTFontPathSet() { HashSet fontDirs = new HashSet(); short[] scripts = getCoreScripts(0); diff --git a/jdk/src/solaris/classes/sun/awt/motif/MFontPeer.java b/jdk/src/solaris/classes/sun/awt/motif/MFontPeer.java deleted file mode 100644 index c544c02776a3a24b1ada20a3f29fb3572fe87f7b..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/classes/sun/awt/motif/MFontPeer.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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. - */ -package sun.awt.motif; - -import java.awt.GraphicsEnvironment; -import sun.awt.PlatformFont; - -public class MFontPeer extends PlatformFont { - - /* - * XLFD name for XFontSet. - */ - private String xfsname; - - /* - * converter name for this XFontSet encoding. - */ - private String converter; - - static { - if (!GraphicsEnvironment.isHeadless()) { - initIDs(); - } - } - - /** - * Initialize JNI field and method IDs for fields that may be - accessed from C. - */ - private static native void initIDs(); - - public MFontPeer(String name, int style){ - super(name, style); - - if (fontConfig != null) { - xfsname = ((MFontConfiguration) fontConfig).getMotifFontSet(familyName, style); - } - } - - protected char getMissingGlyphCharacter() { - return '\u274F'; - } -} diff --git a/jdk/src/solaris/classes/sun/awt/motif/MToolkit.java b/jdk/src/solaris/classes/sun/awt/motif/MToolkit.java deleted file mode 100644 index 44108be3cf18696bd507f031000466291b3e300e..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/classes/sun/awt/motif/MToolkit.java +++ /dev/null @@ -1,849 +0,0 @@ -/* - * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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. - */ - -package sun.awt.motif; - -import java.awt.*; -import java.awt.im.InputMethodHighlight; -import java.awt.im.spi.InputMethodDescriptor; -import java.awt.image.*; -import java.awt.peer.*; -import java.awt.datatransfer.Clipboard; -import java.awt.event.*; -import java.lang.reflect.*; -import java.lang.Math; -import java.io.*; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; - -import java.util.Properties; -import java.util.Map; -import java.util.Iterator; - -import sun.awt.AppContext; -import sun.awt.AWTAutoShutdown; -import sun.awt.SunToolkit; -import sun.awt.UNIXToolkit; -import sun.awt.GlobalCursorManager; -import sun.awt.datatransfer.DataTransferer; - -import java.awt.dnd.DragSource; -import java.awt.dnd.DragGestureListener; -import java.awt.dnd.DragGestureEvent; -import java.awt.dnd.DragGestureRecognizer; -import java.awt.dnd.MouseDragGestureRecognizer; -import java.awt.dnd.InvalidDnDOperationException; -import java.awt.dnd.peer.DragSourceContextPeer; - -//import sun.awt.motif.MInputMethod; -import sun.awt.X11FontManager; -import sun.awt.X11GraphicsConfig; -import sun.awt.X11GraphicsEnvironment; -import sun.awt.XSettings; - -//import sun.awt.motif.MDragSourceContextPeer; - -import sun.print.PrintJob2D; - -import sun.misc.PerformanceLogger; -import sun.misc.Unsafe; - -import sun.security.action.GetBooleanAction; -import sun.util.logging.PlatformLogger; - -public class MToolkit extends UNIXToolkit implements Runnable { - - private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.motif.MToolkit"); - - // the system clipboard - CLIPBOARD selection - //X11Clipboard clipboard; - // the system selection - PRIMARY selection - //X11Clipboard selection; - - // Dynamic Layout Resize client code setting - protected static boolean dynamicLayoutSetting = false; - - /** - * True when the x settings have been loaded. - */ - private boolean loadedXSettings; - - /** - * XSETTINGS for the default screen. - *

- * XXX: see MToolkit.parseXSettings - * and awt_xsettings_update in - * awt_MToolkit.c - */ - private XSettings xs; - - /* - * Note: The MToolkit object depends on the static initializer - * of X11GraphicsEnvironment to initialize the connection to - * the X11 server. - */ - static final X11GraphicsConfig config; - - private static final boolean motifdnd; - - static { - if (GraphicsEnvironment.isHeadless()) { - config = null; - } else { - config = (X11GraphicsConfig) (GraphicsEnvironment. - getLocalGraphicsEnvironment(). - getDefaultScreenDevice(). - getDefaultConfiguration()); - } - - motifdnd = ((Boolean)java.security.AccessController.doPrivileged( - new GetBooleanAction("awt.dnd.motifdnd"))).booleanValue(); - } - - //public static final String DATA_TRANSFERER_CLASS_NAME = "sun.awt.motif.MDataTransferer"; - - public MToolkit() { - super(); - if (PerformanceLogger.loggingEnabled()) { - PerformanceLogger.setTime("MToolkit construction"); - } - if (!GraphicsEnvironment.isHeadless()) { - String mainClassName = null; - - StackTraceElement trace[] = (new Throwable()).getStackTrace(); - int bottom = trace.length - 1; - if (bottom >= 0) { - mainClassName = trace[bottom].getClassName(); - } - if (mainClassName == null || mainClassName.equals("")) { - mainClassName = "AWT"; - } - - init(mainClassName); - //SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME); - - Thread toolkitThread = new Thread(this, "AWT-Motif"); - toolkitThread.setPriority(Thread.NORM_PRIORITY + 1); - toolkitThread.setDaemon(true); - - PrivilegedAction a = new PrivilegedAction() { - public Void run() { - ThreadGroup mainTG = Thread.currentThread().getThreadGroup(); - ThreadGroup parentTG = mainTG.getParent(); - - while (parentTG != null) { - mainTG = parentTG; - parentTG = mainTG.getParent(); - } - Thread shutdownThread = new Thread(mainTG, new Runnable() { - public void run() { - shutdown(); - } - }, "Shutdown-Thread"); - shutdownThread.setContextClassLoader(null); - Runtime.getRuntime().addShutdownHook(shutdownThread); - return null; - } - }; - AccessController.doPrivileged(a); - - /* - * Fix for 4701990. - * AWTAutoShutdown state must be changed before the toolkit thread - * starts to avoid race condition. - */ - AWTAutoShutdown.notifyToolkitThreadBusy(); - - toolkitThread.start(); - } - } - - public native void init(String mainClassName); - public native void run(); - private native void shutdown(); - - /* - * Create peer objects. - */ - - public ButtonPeer createButton(Button target) { - //ButtonPeer peer = new MButtonPeer(target); - //targetCreatedPeer(target, peer); - //return peer; - return null; - } - - public TextFieldPeer createTextField(TextField target) { - //TextFieldPeer peer = new MTextFieldPeer(target); - //targetCreatedPeer(target, peer); - //return peer; - return null; - } - - public LabelPeer createLabel(Label target) { - //LabelPeer peer = new MLabelPeer(target); - //targetCreatedPeer(target, peer); - //return peer; - return null; - } - - public ListPeer createList(List target) { - //ListPeer peer = new MListPeer(target); - //targetCreatedPeer(target, peer); - //return peer; - return null; - } - - public CheckboxPeer createCheckbox(Checkbox target) { - //CheckboxPeer peer = new MCheckboxPeer(target); - //targetCreatedPeer(target, peer); - //return peer; - return null; - } - - public ScrollbarPeer createScrollbar(Scrollbar target) { - //ScrollbarPeer peer = new MScrollbarPeer(target); - //targetCreatedPeer(target, peer); - //return peer; - return null; - } - - public ScrollPanePeer createScrollPane(ScrollPane target) { - //ScrollPanePeer peer = new MScrollPanePeer(target); - //targetCreatedPeer(target, peer); - //return peer; - return null; - } - - public TextAreaPeer createTextArea(TextArea target) { - //TextAreaPeer peer = new MTextAreaPeer(target); - //targetCreatedPeer(target, peer); - //return peer; - return null; - } - - public ChoicePeer createChoice(Choice target) { - //ChoicePeer peer = new MChoicePeer(target); - //targetCreatedPeer(target, peer); - //return peer; - return null; - } - - public FramePeer createFrame(Frame target) { - //FramePeer peer = new MFramePeer(target); - //targetCreatedPeer(target, peer); - //return peer; - return null; - } - - public CanvasPeer createCanvas(Canvas target) { - //CanvasPeer peer = (isXEmbedServerRequested() ? new MEmbedCanvasPeer(target) : new MCanvasPeer(target)); - //targetCreatedPeer(target, peer); - //return peer; - return null; - } - - public PanelPeer createPanel(Panel target) { - //PanelPeer peer = new MPanelPeer(target); - //targetCreatedPeer(target, peer); - //return peer; - return null; - } - - public WindowPeer createWindow(Window target) { - //WindowPeer peer = new MWindowPeer(target); - //targetCreatedPeer(target, peer); - //return peer; - return null; - } - - public DialogPeer createDialog(Dialog target) { - //DialogPeer peer = new MDialogPeer(target); - //targetCreatedPeer(target, peer); - //return peer; - return null; - } - - public FileDialogPeer createFileDialog(FileDialog target) { - //FileDialogPeer peer = new MFileDialogPeer(target); - //targetCreatedPeer(target, peer); - //return peer; - return null; - } - - public MenuBarPeer createMenuBar(MenuBar target) { - //MenuBarPeer peer = new MMenuBarPeer(target); - //targetCreatedPeer(target, peer); - //return peer; - return null; - } - - public MenuPeer createMenu(Menu target) { - //MenuPeer peer = new MMenuPeer(target); - //targetCreatedPeer(target, peer); - //return peer; - return null; - } - - public PopupMenuPeer createPopupMenu(PopupMenu target) { - //PopupMenuPeer peer = new MPopupMenuPeer(target); - //targetCreatedPeer(target, peer); - //return peer; - return null; - } - - public MenuItemPeer createMenuItem(MenuItem target) { - //MenuItemPeer peer = new MMenuItemPeer(target); - //targetCreatedPeer(target, peer); - //return peer; - return null; - } - - public CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target) { - //CheckboxMenuItemPeer peer = new MCheckboxMenuItemPeer(target); - //targetCreatedPeer(target, peer); - //return peer; - return null; - } - - public KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager manager) { - return null; - } - - //public MEmbeddedFramePeer createEmbeddedFrame(MEmbeddedFrame target) - //{ - //MEmbeddedFramePeer peer = new MEmbeddedFramePeer(target); - //targetCreatedPeer(target, peer); - //return peer; - // return null; - //} - - - public FontPeer getFontPeer(String name, int style){ - return new MFontPeer(name, style); - } - - /* - * On X, support for dynamic layout on resizing is governed by the - * window manager. If the window manager supports it, it happens - * automatically. The setter method for this property is - * irrelevant on X. - */ - public void setDynamicLayout(boolean b) { - dynamicLayoutSetting = b; - } - - protected boolean isDynamicLayoutSet() { - return dynamicLayoutSetting; - } - - /* Called from isDynamicLayoutActive() and from - * lazilyLoadDynamicLayoutSupportedProperty() - */ - protected native boolean isDynamicLayoutSupportedNative(); - - public boolean isDynamicLayoutActive() { - return isDynamicLayoutSupportedNative(); - } - - public native boolean isFrameStateSupported(int state); - - public TrayIconPeer createTrayIcon(TrayIcon target) throws HeadlessException { - return null; - } - - public SystemTrayPeer createSystemTray(SystemTray target) throws HeadlessException { - return null; - } - - public boolean isTraySupported() { - return false; - } - - static native ColorModel makeColorModel(); - static ColorModel screenmodel; - - static ColorModel getStaticColorModel() { - if (screenmodel == null) { - screenmodel = config.getColorModel (); - } - return screenmodel; - } - - public ColorModel getColorModel() { - return getStaticColorModel(); - } - - public native int getScreenResolution(); - - public Insets getScreenInsets(GraphicsConfiguration gc) { - return new Insets(0,0,0,0); - } - - protected native int getScreenWidth(); - protected native int getScreenHeight(); - - public FontMetrics getFontMetrics(Font font) { - /* - // REMIND: platform font flag should be obsolete soon - if (!RasterOutputManager.usesPlatformFont()) { - return super.getFontMetrics(font); - } else { - return X11FontMetrics.getFontMetrics(font); - } - */ - return super.getFontMetrics(font); - } - - public PrintJob getPrintJob(final Frame frame, final String doctitle, - final Properties props) { - - if (GraphicsEnvironment.isHeadless()) { - throw new IllegalArgumentException(); - } - - PrintJob2D printJob = new PrintJob2D(frame, doctitle, props); - - if (printJob.printDialog() == false) { - printJob = null; - } - - return printJob; - } - - public PrintJob getPrintJob(final Frame frame, final String doctitle, - final JobAttributes jobAttributes, - final PageAttributes pageAttributes) { - - - if (GraphicsEnvironment.isHeadless()) { - throw new IllegalArgumentException(); - } - - PrintJob2D printJob = new PrintJob2D(frame, doctitle, - jobAttributes, pageAttributes); - - if (printJob.printDialog() == false) { - printJob = null; - } - - return printJob; - } - - public native void beep(); - - public Clipboard getSystemClipboard() { - //SecurityManager security = System.getSecurityManager(); - //if (security != null) { - // security.checkSystemClipboardAccess(); - //} - //synchronized (this) { - // if (clipboard == null) { - // clipboard = new X11Clipboard("System", "CLIPBOARD"); - // } - //} - //return clipboard; - return null; - } - - public Clipboard getSystemSelection() { - //SecurityManager security = System.getSecurityManager(); - //if (security != null) { - // security.checkSystemClipboardAccess(); - //} - //synchronized (this) { - // if (selection == null) { - // selection = new X11Clipboard("Selection", "PRIMARY"); - // } - //} - //return selection; - return null; - } - - public boolean getLockingKeyState(int key) { - if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK || - key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) { - throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState"); - } - return getLockingKeyStateNative(key); - } - - public native boolean getLockingKeyStateNative(int key); - - public native void loadSystemColors(int[] systemColors); - - /** - * Give native peers the ability to query the native container - * given a native component (e.g. the direct parent may be lightweight). - */ - public static Container getNativeContainer(Component c) { - return Toolkit.getNativeContainer(c); - } - - protected static final Object targetToPeer(Object target) { - return SunToolkit.targetToPeer(target); - } - - protected static final void targetDisposedPeer(Object target, Object peer) { - SunToolkit.targetDisposedPeer(target, peer); - } - - public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException { - //if (MToolkit.useMotifDnD()) { - // return MDragSourceContextPeer.createDragSourceContextPeer(dge); - //} else { - // return X11DragSourceContextPeer.createDragSourceContextPeer(dge); - //} - return null; - } - - public T - createDragGestureRecognizer(Class abstractRecognizerClass, - DragSource ds, Component c, int srcActions, - DragGestureListener dgl) - { - //if (MouseDragGestureRecognizer.class.equals(abstractRecognizerClass)) - // return (T)new MMouseDragGestureRecognizer(ds, c, srcActions, dgl); - //else - return null; - } - - /** - * Returns a new input method adapter descriptor for native input methods. - */ - public InputMethodDescriptor getInputMethodAdapterDescriptor() throws AWTException { - return null; // return new MInputMethodDescriptor(); - } - - /** - * Returns a style map for the input method highlight. - */ - public Map mapInputMethodHighlight(InputMethodHighlight highlight) { - return null; //return MInputMethod.mapInputMethodHighlight(highlight); - } - - /** - * Returns a new custom cursor. - */ - public Cursor createCustomCursor(Image cursor, Point hotSpot, String name) - throws IndexOutOfBoundsException { - return null; //return new MCustomCursor(cursor, hotSpot, name); - } - - /** - * Returns the supported cursor size - */ - public Dimension getBestCursorSize(int preferredWidth, int preferredHeight) { - return null; //MCustomCursor.getBestCursorSize( - //java.lang.Math.max(1,preferredWidth), java.lang.Math.max(1,preferredHeight)); - } - - public int getMaximumCursorColors() { - return 2; // Black and white. - } - - private final static String prefix = "DnD.Cursor."; - private final static String postfix = ".32x32"; - private static final String dndPrefix = "DnD."; - - protected Object lazilyLoadDesktopProperty(String name) { - if (name.startsWith(prefix)) { - String cursorName = name.substring(prefix.length(), name.length()) + postfix; - - try { - return Cursor.getSystemCustomCursor(cursorName); - } catch (AWTException awte) { - System.err.println("cannot load system cursor: " + cursorName); - - return null; - } - } - - if (name.equals("awt.dynamicLayoutSupported")) { - return lazilyLoadDynamicLayoutSupportedProperty(name); - } - - if (!loadedXSettings && - (name.startsWith("gnome.") || - name.equals(SunToolkit.DESKTOPFONTHINTS) || - name.startsWith(dndPrefix))) { - loadedXSettings = true; - if (!GraphicsEnvironment.isHeadless()) { - loadXSettings(); - desktopProperties.put(SunToolkit.DESKTOPFONTHINTS, - SunToolkit.getDesktopFontHints()); - return desktopProperties.get(name); - } - } - - return super.lazilyLoadDesktopProperty(name); - } - - /* - * Called from lazilyLoadDesktopProperty because we may not know if - * the user has quit the previous window manager and started another. - */ - protected Boolean lazilyLoadDynamicLayoutSupportedProperty(String name) { - boolean nativeDynamic = isDynamicLayoutSupportedNative(); - - if (log.isLoggable(PlatformLogger.FINER)) { - log.finer("nativeDynamic == " + nativeDynamic); - } - - return Boolean.valueOf(nativeDynamic); - } - - private native int getMulticlickTime(); - - protected void initializeDesktopProperties() { - desktopProperties.put("DnD.Autoscroll.initialDelay", Integer.valueOf(50)); - desktopProperties.put("DnD.Autoscroll.interval", Integer.valueOf(50)); - desktopProperties.put("DnD.Autoscroll.cursorHysteresis", Integer.valueOf(5)); - - /* As of 1.4, no wheel mice are supported on Solaris - * however, they are on Linux, and there isn't a way to detect them, - * so we leave this property unset to indicate we're not sure if there's - * a wheel mouse or not. - */ - //desktopProperties.put("awt.wheelMousePresent", Boolean.valueOf(false)); - - // We don't want to call getMultilclickTime() if we're headless - if (!GraphicsEnvironment.isHeadless()) { - desktopProperties.put("awt.multiClickInterval", - Integer.valueOf(getMulticlickTime())); - desktopProperties.put("awt.mouse.numButtons", - Integer.valueOf(getNumberOfButtons())); - } - } - - public RobotPeer createRobot(Robot target, GraphicsDevice screen) { - /* 'target' is unused for now... */ - //return new MRobotPeer(screen.getDefaultConfiguration()); - return null; - } - - static boolean useMotifDnD() { - return motifdnd; - } - - // - // The following support Gnome's equivalent of desktop properties. - // A writeup of this can be found at: - // http://www.freedesktop.org/standards/xsettings/xsettings.html - // - - /** - * Triggers a callback to parseXSettings with the x settings values - * from the window server. Note that this will NOT call - * parseXSettings if we are not running on a GNOME desktop. - */ - private native void loadXSettings(); - - /** - * Callback from the native side indicating some, or all, of the - * desktop properties have changed and need to be reloaded. - * data is the byte array directly from the x server and - * may be in little endian format. - *

- * NB: This could be called from any thread if triggered by - * loadXSettings. It is called from the toolkit - * thread if triggered by an XSETTINGS change. - */ - private void parseXSettings(int screen_XXX_ignored, byte[] data) { - // XXX: notyet: map screen -> per screen XSettings object - // for now native code only calls us for default screen - // see awt_MToolkit.c awt_xsettings_update(). - if (xs == null) { - xs = new XSettings(); - } - - Map updatedSettings = xs.update(data); - if (updatedSettings == null || updatedSettings.isEmpty()) { - return; - } - - Iterator i = updatedSettings.entrySet().iterator(); - while (i.hasNext()) { - Map.Entry e = (Map.Entry)i.next(); - String name = (String)e.getKey(); - - name = "gnome." + name; - setDesktopProperty(name, e.getValue()); - - // XXX: we probably want to do something smarter. In - // particular, "Net" properties are of interest to the - // "core" AWT itself. E.g. - // - // Net/DndDragThreshold -> ??? - // Net/DoubleClickTime -> awt.multiClickInterval - } - - setDesktopProperty(SunToolkit.DESKTOPFONTHINTS, - SunToolkit.getDesktopFontHints()); - - Integer dragThreshold = null; - synchronized (this) { - dragThreshold = (Integer)desktopProperties.get("gnome.Net/DndDragThreshold"); - } - if (dragThreshold != null) { - setDesktopProperty("DnD.gestureMotionThreshold", dragThreshold); - } - } - - protected boolean needsXEmbedImpl() { - return true; - } - - public boolean isModalityTypeSupported(Dialog.ModalityType modalityType) { - return (modalityType == Dialog.ModalityType.MODELESS) || - (modalityType == Dialog.ModalityType.APPLICATION_MODAL); - } - - public boolean isModalExclusionTypeSupported(Dialog.ModalExclusionType exclusionType) { - return (exclusionType == Dialog.ModalExclusionType.NO_EXCLUDE); - } - - private native boolean isSyncUpdated(); - private native boolean isSyncFailed(); - private native int getEventNumber(); - private native void updateSyncSelection(); - private static final long WORKAROUND_SLEEP = 100; - - /** - * @inheritDoc - */ - protected boolean syncNativeQueue(final long timeout) { - awtLock(); - try { - long event_number = getEventNumber(); - updateSyncSelection(); - - // Wait for selection notify for oops on win - long start = System.currentTimeMillis(); - while (!isSyncUpdated() && !isSyncFailed()) { - try { - awtLockWait(timeout); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - // This "while" is a protection from spurious - // wake-ups. However, we shouldn't wait for too long - if (((System.currentTimeMillis() - start) > timeout) && (timeout >= 0)) { - throw new OperationTimedOut(); - } - } - if (isSyncFailed() && getEventNumber() - event_number == 1) { - awtUnlock(); - try { - Thread.sleep(WORKAROUND_SLEEP); - } catch (InterruptedException ie) { - throw new RuntimeException(ie); - } finally { - awtLock(); - } - } - return getEventNumber() - event_number > 2; - } finally { - awtUnlock(); - } - } - - public void grab(Window w) { - WindowPeer peer = (WindowPeer)w.getPeer(); - if (peer != null) { - nativeGrab(peer); - } - } - - public void ungrab(Window w) { - WindowPeer peer = (WindowPeer)w.getPeer(); - if (peer != null) { - nativeUnGrab(peer); - } - } - private native void nativeGrab(WindowPeer peer); - private native void nativeUnGrab(WindowPeer peer); - - - public boolean isDesktopSupported(){ - return false; - } - - public DesktopPeer createDesktopPeer(Desktop target) - throws HeadlessException{ - throw new UnsupportedOperationException(); - } - - public final static int - UNDETERMINED_WM = 1, - NO_WM = 2, - OTHER_WM = 3, - OPENLOOK_WM = 4, - MOTIF_WM = 5, - CDE_WM = 6, - ENLIGHTEN_WM = 7, - KDE2_WM = 8, - SAWFISH_WM = 9, - ICE_WM = 10, - METACITY_WM = 11, - COMPIZ_WM = 12, - LG3D_WM = 13; - - public static int getWMID() { - String wmName = getWMName(); - - if ("NO_WM".equals(wmName)) { - return NO_WM; - } else if ("OTHER_WM".equals(wmName)) { - return OTHER_WM; - } else if ("ENLIGHTEN_WM".equals(wmName)) { - return ENLIGHTEN_WM; - } else if ("KDE2_WM".equals(wmName)) { - return KDE2_WM; - } else if ("SAWFISH_WM".equals(wmName)) { - return SAWFISH_WM; - } else if ("ICE_WM".equals(wmName)) { - return ICE_WM; - } else if ("METACITY_WM".equals(wmName)) { - return METACITY_WM; - } else if ("OPENLOOK_WM".equals(wmName)) { - return OPENLOOK_WM; - } else if ("MOTIF_WM".equals(wmName)) { - return MOTIF_WM; - } else if ("CDE_WM".equals(wmName)) { - return CDE_WM; - } else if ("COMPIZ_WM".equals(wmName)) { - return COMPIZ_WM; - } else if ("LG3D_WM".equals(wmName)) { - return LG3D_WM; - } - return UNDETERMINED_WM; - } - - private static native String getWMName(); - -} // class MToolkit diff --git a/jdk/src/solaris/classes/sun/awt/motif/MToolkitThreadBlockedHandler.java b/jdk/src/solaris/classes/sun/awt/motif/MToolkitThreadBlockedHandler.java deleted file mode 100644 index ab3a05533ee46421569b629a22f58a15cf75b3ff..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/classes/sun/awt/motif/MToolkitThreadBlockedHandler.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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. - */ - -package sun.awt.motif; - -import sun.awt.datatransfer.ToolkitThreadBlockedHandler; -import sun.awt.SunToolkit; - -final class MToolkitThreadBlockedHandler implements - ToolkitThreadBlockedHandler { - private static ToolkitThreadBlockedHandler priveleged_lock = null; - static { - priveleged_lock = new MToolkitThreadBlockedHandler(); - } - private MToolkitThreadBlockedHandler() {} - static ToolkitThreadBlockedHandler getToolkitThreadBlockedHandler() { - return priveleged_lock; - } - public void lock() { - SunToolkit.awtLock(); - } - public void unlock() { - SunToolkit.awtUnlock(); - } - public native void enter(); - public native void exit(); -} diff --git a/jdk/src/solaris/classes/sun/awt/motif/MWindowAttributes.java b/jdk/src/solaris/classes/sun/awt/motif/MWindowAttributes.java deleted file mode 100644 index a920ccac8a48d1e94b969cdcb1c620b71e21cc09..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/classes/sun/awt/motif/MWindowAttributes.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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. - */ -package sun.awt.motif; -import java.awt.Image; - -class MWindowAttributes { - static int NORMAL = 0; - static int ICONIC = 1; - static int MAXIMIZED = 2; - - static int AWT_DECOR_NONE = 0; - static int AWT_DECOR_ALL = 1; - static int AWT_DECOR_BORDER = 2; - static int AWT_DECOR_RESIZEH = 4; - static int AWT_DECOR_TITLE = 8; - static int AWT_DECOR_MENU = 0x10; - static int AWT_DECOR_MINIMIZE = 0x20; - static int AWT_DECOR_MAXIMIZE = 0x40; - static int AWT_UNOBSCURED = 0; // X11 VisibilityUnobscured - static int AWT_PARTIALLY_OBSCURED = 1; // X11 VisibilityPartiallyObscured - static int AWT_FULLY_OBSCURED = 2; // X11 VisibilityFullyObscured - static int AWT_UNKNOWN_OBSCURITY = 3; - - boolean nativeDecor; - boolean initialFocus; - boolean isResizable; - int initialState; - int visibilityState; // updated by native X11 event handling code. - String title; - java.awt.Image icon; - int decorations; // for future expansion to be able to - // specify native decorations - - private static native void initIDs(); - - static { - initIDs(); - } - - MWindowAttributes() { - nativeDecor = false; - initialFocus = false; - isResizable = false; - initialState = NORMAL; - visibilityState = AWT_UNKNOWN_OBSCURITY; - title = null; - icon = null; - decorations = 0; - } -} diff --git a/jdk/src/solaris/classes/sun/awt/motif/X11FontMetrics.java b/jdk/src/solaris/classes/sun/awt/motif/X11FontMetrics.java deleted file mode 100644 index f158eae271ff24e809472884c2d8a831fdd82db5..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/classes/sun/awt/motif/X11FontMetrics.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright (c) 1995, 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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. - */ - -package sun.awt.motif; - -import java.awt.*; -import java.util.Hashtable; -import sun.awt.PlatformFont; - -/** - * A font metrics object for a WServer font. - * - * @author Jim Graham - */ -public class X11FontMetrics extends FontMetrics { - /** - * The widths of the first 256 characters. - */ - int widths[]; - - /** - * The standard ascent of the font. This is the logical height - * above the baseline for the Alphanumeric characters and should - * be used for determining line spacing. Note, however, that some - * characters in the font may extend above this height. - */ - int ascent; - - /** - * The standard descent of the font. This is the logical height - * below the baseline for the Alphanumeric characters and should - * be used for determining line spacing. Note, however, that some - * characters in the font may extend below this height. - */ - int descent; - - /** - * The standard leading for the font. This is the logical amount - * of space to be reserved between the descent of one line of text - * and the ascent of the next line. The height metric is calculated - * to include this extra space. - */ - int leading; - - /** - * The standard height of a line of text in this font. This is - * the distance between the baseline of adjacent lines of text. - * It is the sum of the ascent+descent+leading. There is no - * guarantee that lines of text spaced at this distance will be - * disjoint; such lines may overlap if some characters overshoot - * the standard ascent and descent metrics. - */ - int height; - - /** - * The maximum ascent for all characters in this font. No character - * will extend further above the baseline than this metric. - */ - int maxAscent; - - /** - * The maximum descent for all characters in this font. No character - * will descend further below the baseline than this metric. - */ - int maxDescent; - - /** - * The maximum possible height of a line of text in this font. - * Adjacent lines of text spaced this distance apart will be - * guaranteed not to overlap. Note, however, that many paragraphs - * that contain ordinary alphanumeric text may look too widely - * spaced if this metric is used to determine line spacing. The - * height field should be preferred unless the text in a given - * line contains particularly tall characters. - */ - int maxHeight; - - /** - * The maximum advance width of any character in this font. - */ - int maxAdvance; - - static { - initIDs(); - } - - /** - * Initialize JNI field and method IDs for fields that may be - accessed from C. - */ - private static native void initIDs(); - - /** - * Calculate the metrics from the given WServer and font. - */ - public X11FontMetrics(Font font) { - super(font); - init(); - } - - /** - * Get leading - */ - public int getLeading() { - return leading; - } - - /** - * Get ascent. - */ - public int getAscent() { - return ascent; - } - - /** - * Get descent - */ - public int getDescent() { - return descent; - } - - /** - * Get height - */ - public int getHeight() { - return height; - } - - /** - * Get maxAscent - */ - public int getMaxAscent() { - return maxAscent; - } - - /** - * Get maxDescent - */ - public int getMaxDescent() { - return maxDescent; - } - - /** - * Get maxAdvance - */ - public int getMaxAdvance() { - return maxAdvance; - } - - /** - * Return the width of the specified string in this Font. - */ - public int stringWidth(String string) { - return charsWidth(string.toCharArray(), 0, string.length()); - } - - /** - * Return the width of the specified char[] in this Font. - */ - public int charsWidth(char chars[], int offset, int length) { - Font font = getFont(); - PlatformFont pf = ((PlatformFont) font.getPeer()); - if (pf.mightHaveMultiFontMetrics()) { - return getMFCharsWidth(chars, offset, length, font); - } else { - if (widths != null) { - int w = 0; - for (int i = offset; i < offset + length; i++) { - int ch = chars[i]; - if (ch < 0 || ch >= widths.length) { - w += maxAdvance; - } else { - w += widths[ch]; - } - } - return w; - } else { - return maxAdvance * length; - } - } - } - - private native int getMFCharsWidth(char chars[], int offset, int length, Font font); - - /** - * Return the width of the specified byte[] in this Font. - */ - public native int bytesWidth(byte data[], int off, int len); - - /** - * Get the widths of the first 256 characters in the font. - */ - public int[] getWidths() { - return widths; - } - - native void init(); - - static Hashtable table = new Hashtable(); - - static synchronized FontMetrics getFontMetrics(Font font) { - FontMetrics fm = (FontMetrics)table.get(font); - if (fm == null) { - table.put(font, fm = new X11FontMetrics(font)); - } - return fm; - } -} diff --git a/jdk/src/solaris/native/sun/awt/MouseInfo.c b/jdk/src/solaris/native/sun/awt/MouseInfo.c deleted file mode 100644 index 07262cf443a42115a751f335b506f3ce87720cd9..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/native/sun/awt/MouseInfo.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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 - #error This file should not be included in headless library -#endif - -#include "awt_p.h" -#include "awt_Component.h" - -#include -#include - -extern int awt_numScreens; -extern AwtScreenDataPtr x11Screens; -extern struct ComponentIDs componentIDs; -extern struct MComponentPeerIDs mComponentPeerIDs; - -/* - * Class: sun_awt_DefaultMouseInfoPeer - * Method: fillPointWithCoords - * Signature: (Ljava/awt/Point)I - */ -JNIEXPORT jint JNICALL -Java_sun_awt_DefaultMouseInfoPeer_fillPointWithCoords(JNIEnv *env, jclass cls, - jobject point) -{ - static jclass pointClass = NULL; - jclass pointClassLocal; - static jfieldID xID, yID; - Window rootWindow, childWindow; - int i; - int32_t xr, yr, xw, yw; - uint32_t keys; - Bool pointerFound; - - AWT_LOCK(); - if (pointClass == NULL) { - pointClassLocal = (*env)->FindClass(env, "java/awt/Point"); - DASSERT(pointClassLocal != NULL); - if (pointClassLocal == NULL) { - AWT_UNLOCK(); - return (jint)0; - } - pointClass = (jclass)(*env)->NewGlobalRef(env, pointClassLocal); - (*env)->DeleteLocalRef(env, pointClassLocal); - xID = (*env)->GetFieldID(env, pointClass, "x", "I"); - yID = (*env)->GetFieldID(env, pointClass, "y", "I"); - } - - for (i = 0; i < awt_numScreens; i++) { - pointerFound = XQueryPointer(awt_display, x11Screens[i].root, - &rootWindow, &childWindow, - &xr, &yr, &xw, &yw, &keys); - if (pointerFound) { - (*env)->SetIntField(env, point, xID, xr); - (*env)->SetIntField(env, point, yID, yr); - AWT_UNLOCK(); - return (jint)i; - } - } - /* This should never happen */ - DASSERT(FALSE); - AWT_UNLOCK(); - return (jint)0; -} - -/* - * Class: sun_awt_DefaultMouseInfoPeer - * Method: isWindowUnderMouse - * Signature: (Ljava/awt/Window)Z - */ -JNIEXPORT jboolean JNICALL Java_sun_awt_DefaultMouseInfoPeer_isWindowUnderMouse - (JNIEnv * env, jclass cls, jobject window) -{ - Window rootWindow = None, parentWindow = None, siblingWindow = None; - Window * children = NULL; - int i = 0; - int is_the_same_screen = 0; - int32_t xr = 0, yr = 0, xw = 0, yw = 0; - uint32_t keys = 0; - uint32_t nchildren = 0; - Bool pointerFound = 0; - struct FrameData *wdata = NULL; - jobject winPeer = NULL; - - if ((*env)->EnsureLocalCapacity(env, 1) < 0) { - return JNI_FALSE; - } - winPeer = (*env)->GetObjectField(env, window, componentIDs.peer); - if (JNU_IsNull(env, winPeer)) { - return JNI_FALSE; - } - - wdata = (struct FrameData *) - JNU_GetLongFieldAsPtr(env, winPeer, mComponentPeerIDs.pData); - (*env)->DeleteLocalRef(env, winPeer); - - if (wdata == NULL) { - return JNI_FALSE; - } - - AWT_LOCK(); - - XQueryTree(awt_display, XtWindow(wdata->winData.comp.widget), - &rootWindow, &parentWindow, &children, &nchildren); - - is_the_same_screen = XQueryPointer(awt_display, parentWindow, - &rootWindow, &siblingWindow, &xr, &yr, &xw, &yw, &keys); - - if (siblingWindow == XtWindow(wdata->winData.comp.widget) && is_the_same_screen) { - AWT_UNLOCK(); - return JNI_TRUE; - } - - AWT_UNLOCK(); - return JNI_FALSE ; - -} diff --git a/jdk/src/solaris/native/sun/awt/XDrawingArea.c b/jdk/src/solaris/native/sun/awt/XDrawingArea.c deleted file mode 100644 index bd147689d1ddb3907f2ff3eef21158b22df2647f..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/native/sun/awt/XDrawingArea.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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 -#include "XDrawingAreaP.h" -#include - -#include -#include - -#ifdef DEBUG -#include /* To get jio_fprintf() */ -#endif - -/****************************************************************** - * - * Provides Canvas widget which allows the X11 visual to be - * changed (the Motif DrawingArea restricts the visual to that - * of the parent widget). - * - ******************************************************************/ - - -static XmNavigability WidgetNavigable(); -static void ClassInitialize(); - -static XmBaseClassExtRec baseClassExtRec = { - NULL, - NULLQUARK, - XmBaseClassExtVersion, - sizeof(XmBaseClassExtRec), - NULL, /* InitializePrehook */ - NULL, /* SetValuesPrehook */ - NULL, /* InitializePosthook */ - NULL, /* SetValuesPosthook */ - NULL, /* secondaryObjectClass */ - NULL, /* secondaryCreate */ - NULL, /* getSecRes data */ - { 0 }, /* fastSubclass flags */ - NULL, /* getValuesPrehook */ - NULL, /* getValuesPosthook */ - NULL, /* classPartInitPrehook */ - NULL, /* classPartInitPosthook*/ - NULL, /* ext_resources */ - NULL, /* compiled_ext_resources*/ - 0, /* num_ext_resources */ - FALSE, /* use_sub_resources */ - WidgetNavigable, /* widgetNavigable */ - NULL /* focusChange */ -}; - -XDrawingAreaClassRec xDrawingAreaClassRec = { -{ - /* Core class part */ - - /* superclass */ (WidgetClass)&xmDrawingAreaClassRec, - /* class_name */ "XDrawingArea", - /* widget_size */ sizeof(XDrawingAreaRec), - /* class_initialize */ ClassInitialize, - /* class_part_initialize*/ NULL, - /* class_inited */ FALSE, - /* initialize */ NULL, - /* initialize_hook */ NULL, - /* realize */ XtInheritRealize, - /* actions */ NULL, - /* num_actions */ 0, - /* resources */ NULL, - /* num_resources */ 0, - /* xrm_class */ NULLQUARK, - /* compress_motion */ FALSE, - /* compress_exposure */ FALSE, - /* compress_enterleave*/ FALSE, - /* visible_interest */ FALSE, - /* destroy */ NULL, - /* resize */ XtInheritResize, - /* expose */ XtInheritExpose, - /* set_values */ NULL, - /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, - /* accept_focus */ NULL, - /* version */ XtVersion, - /* callback_offsets */ NULL, - /* tm_table */ NULL, - /* query_geometry */ NULL, - /* display_accelerator */ NULL, - /* extension */ (XtPointer)&baseClassExtRec - }, - - { /* composite_class fields */ - XtInheritGeometryManager, /* geometry_manager */ - XtInheritChangeManaged, /* change_managed */ - XtInheritInsertChild, /* insert_child */ - XtInheritDeleteChild, /* delete_child */ - NULL, /* extension */ - }, - - { /* constraint_class fields */ - NULL, /* resource list */ - 0, /* num resources */ - 0, /* constraint size */ - NULL, /* init proc */ - NULL, /* destroy proc */ - NULL, /* set values proc */ - NULL, /* extension */ - }, - - { /* manager_class fields */ - XtInheritTranslations, /* translations */ - NULL, /* syn_resources */ - 0, /* num_get_resources */ - NULL, /* syn_cont_resources */ - 0, /* num_get_cont_resources */ - XmInheritParentProcess, /* parent_process */ - NULL, /* extension */ - }, - - { /* drawingArea class */ - /* extension */ NULL - }, - - /* XDrawingArea class part */ - { - /* extension */ NULL - } -}; - -WidgetClass xDrawingAreaClass = (WidgetClass)&xDrawingAreaClassRec; - -static void ClassInitialize( void ) -{ - baseClassExtRec.record_type = XmQmotif ; -} - -static XmNavigability WidgetNavigable(Widget wid) -{ - return XmCONTROL_NAVIGABLE; -} diff --git a/jdk/src/solaris/native/sun/awt/XDrawingArea.h b/jdk/src/solaris/native/sun/awt/XDrawingArea.h deleted file mode 100644 index 4cc1cbf5d2e4e04d1f88904a6325e41571e9eb66..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/native/sun/awt/XDrawingArea.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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. - */ - -/* - */ - -#ifndef _XDrawingArea_h_ -#define _XDrawingArea_h_ - -extern WidgetClass xDrawingAreaClass; - -typedef struct _XDrawingAreaClassRec *XDrawingAreaWidgetClass; -typedef struct _XDrawingAreaRec *XDrawingAreaWidget; - -#endif /* !_VDrawingArea_h_ */ diff --git a/jdk/src/solaris/native/sun/awt/XDrawingAreaP.h b/jdk/src/solaris/native/sun/awt/XDrawingAreaP.h deleted file mode 100644 index d98f7dafdc318aba1d5f4d9909e95615a3ba678e..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/native/sun/awt/XDrawingAreaP.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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. - */ - -/* - */ - -#ifndef _XDrawingAreaP_h_ -#define _XDrawingAreaP_h_ - -#include -#include "XDrawingArea.h" - - -/*************************************************************** - * VDrawingArea Widget Data Structures - * - * - **************************************************************/ - -/* Define part class structure */ -typedef struct _XDrawingAreaClass { - XtPointer extension; -} XDrawingAreaClassPart; - -/* Define the full class record */ -typedef struct _XDrawingAreaClassRec { - CoreClassPart core_class; - CompositeClassPart composite_class; - ConstraintClassPart constraint_class; - XmManagerClassPart manager_class; - XmDrawingAreaClassPart drawing_area_class; - XDrawingAreaClassPart xdrawingarea_class; -} XDrawingAreaClassRec; - -/* External definition for class record */ -extern XDrawingAreaClassRec xDrawingAreaClassRec; - -/**************************************************************** - * -* Full instance record declaration - * - ****************************************************************/ - -typedef struct _XDrawingAreaRec -{ - CorePart core; - CompositePart composite; - ConstraintPart constraint; - XmManagerPart manager; - XmDrawingAreaPart drawing_area; -} XDrawingAreaRec; - - - -#endif /* !_VDrawingAreaP_h_ */ diff --git a/jdk/src/solaris/native/sun/awt/awt.h b/jdk/src/solaris/native/sun/awt/awt.h index d83d645fcfee79821e1fc52a15925b1453ba9e4c..c5913007305c7c35afbe6c882a35cffc91051935 100644 --- a/jdk/src/solaris/native/sun/awt/awt.h +++ b/jdk/src/solaris/native/sun/awt/awt.h @@ -90,74 +90,12 @@ extern void awt_output_flush(); * Unfortunately AWT_LOCK debugging does not work with XAWT due to mixed * Java/C use of AWT lock. */ -#if defined(DEBUG_AWT_LOCK) && !defined(XAWT) -extern int awt_locked; -extern char *lastF; -extern int lastL; - -#define AWT_LOCK() do { \ - if (!awtLockInited) { \ - jio_fprintf(stderr, "AWT lock error, awt_lock is null\n"); \ - } \ - if (awt_locked < 0) { \ - jio_fprintf(stderr, \ - "AWT lock error (%s,%d) (last held by %s,%d) %d\n", \ - __FILE__, __LINE__, lastF, lastL, awt_locked); \ - } \ - lastF = __FILE__; \ - lastL = __LINE__; \ - AWT_LOCK_IMPL(); \ - ++awt_locked; \ -} while (0) - -#define AWT_NOFLUSH_UNLOCK() do { \ - lastF = ""; \ - lastL = -1; \ - if (awt_locked < 1) { \ - jio_fprintf(stderr, "AWT unlock error (%s,%d,%d)\n", \ - __FILE__, __LINE__, awt_locked); \ - } \ - --awt_locked; \ - AWT_NOFLUSH_UNLOCK_IMPL(); \ -} while (0) - -#define AWT_WAIT(tm) do { \ - int old_lockcount = awt_locked; \ - if (awt_locked < 1) { \ - jio_fprintf(stderr, "AWT wait error (%s,%d,%d)\n", \ - __FILE__, __LINE__, awt_locked); \ - } \ - awt_locked = 0; \ - AWT_WAIT_IMPL(tm); \ - awt_locked = old_lockcount; \ -} while (0) - -#define AWT_NOTIFY() do { \ - if (awt_locked < 1) { \ - jio_fprintf(stderr, "AWT notify error (%s,%d,%d)\n", \ - __FILE__, __LINE__, awt_locked); \ - } \ - AWT_NOTIFY_IMPL(); \ -} while(0) - -#define AWT_NOTIFY_ALL() do { \ - if (awt_locked < 1) { \ - jio_fprintf(stderr, "AWT notify all error (%s,%d,%d)\n", \ - __FILE__, __LINE__, awt_locked); \ - } \ - AWT_NOTIFY_ALL_IMPL(); \ -} while (0) - -#else - #define AWT_LOCK() AWT_LOCK_IMPL() #define AWT_NOFLUSH_UNLOCK() AWT_NOFLUSH_UNLOCK_IMPL() #define AWT_WAIT(tm) AWT_WAIT_IMPL(tm) #define AWT_NOTIFY() AWT_NOTIFY_IMPL() #define AWT_NOTIFY_ALL() AWT_NOTIFY_ALL_IMPL() -#endif /* DEBUG_AWT_LOCK && !XAWT */ - #ifndef HEADLESS extern Display *awt_display; /* awt_GraphicsEnv.c */ extern Boolean awt_ModLockIsShiftLock; /* XToolkit.c */ diff --git a/jdk/src/solaris/native/sun/awt/awt_AWTEvent.c b/jdk/src/solaris/native/sun/awt/awt_AWTEvent.c index aee39e7e8e41dbfdf2efc5cc1933b4df8aa1c006..72c0b565b3bbe06f3134b73878c40aebd52af727 100644 --- a/jdk/src/solaris/native/sun/awt/awt_AWTEvent.c +++ b/jdk/src/solaris/native/sun/awt/awt_AWTEvent.c @@ -40,14 +40,11 @@ #include "java_awt_event_KeyEvent.h" #include "jni_util.h" -#include "canvas.h" #include "awt_AWTEvent.h" -#include "awt_Component.h" struct AWTEventIDs awtEventIDs; struct InputEventIDs inputEventIDs; struct KeyEventIDs keyEventIDs; -struct MComponentPeerIDs mComponentPeerIDs; JNIEXPORT void JNICALL Java_java_awt_AWTEvent_initIDs(JNIEnv *env, jclass cls) @@ -69,61 +66,10 @@ Java_java_awt_event_KeyEvent_initIDs(JNIEnv *env, jclass cls) keyEventIDs.keyCode = (*env)->GetFieldID(env, cls, "keyCode", "I"); keyEventIDs.keyChar = (*env)->GetFieldID(env, cls, "keyChar", "C"); } -#ifndef XAWT -JNIEXPORT void JNICALL -Java_java_awt_AWTEvent_nativeSetSource(JNIEnv *env, jobject self, - jobject newSource) -{ - jbyteArray bdata; - - AWT_LOCK(); - - bdata = (jbyteArray)(*env)->GetObjectField(env, self, awtEventIDs.bdata); - - if (bdata != NULL) { - XEvent *xev; - Window w; - jboolean dummy; - /* get the widget out of the peer newSource */ - struct ComponentData *cdata = (struct ComponentData *) - JNU_GetLongFieldAsPtr(env, newSource, mComponentPeerIDs.pData); - if (JNU_IsNull(env, cdata) || (cdata == NULL) || - ((cdata->widget != NULL) && (XtIsObject(cdata->widget)) && - (cdata->widget->core.being_destroyed))) { - JNU_ThrowNullPointerException(env, "null widget"); - AWT_UNLOCK(); - return; - } - - /* get the Window out of the widget */ - w = XtWindow(cdata->widget); - - if (w == None) { - JNU_ThrowNullPointerException(env, "null window"); - AWT_UNLOCK(); - return; - } - - /* reset the filed in the event */ - xev = (XEvent *)(*env)->GetPrimitiveArrayCritical(env, bdata, &dummy); - if (xev == NULL) { - JNU_ThrowNullPointerException(env, "null data"); - AWT_UNLOCK(); - return; - } - xev->xany.window = w; - (*env)->ReleasePrimitiveArrayCritical(env, bdata, (void *)xev, 0); - } - - AWT_UNLOCK(); -} -#else JNIEXPORT void JNICALL Java_java_awt_AWTEvent_nativeSetSource(JNIEnv *env, jobject self, jobject newSource) { } - -#endif diff --git a/jdk/src/solaris/native/sun/awt/awt_Component.h b/jdk/src/solaris/native/sun/awt/awt_Component.h index 560b63ef31f29958c4dd07ac5a84f21613a09db1..7a43ab88cca57c556364415eef9c4c28e2416ae9 100644 --- a/jdk/src/solaris/native/sun/awt/awt_Component.h +++ b/jdk/src/solaris/native/sun/awt/awt_Component.h @@ -42,25 +42,3 @@ struct ComponentIDs { jmethodID getParent; jmethodID getLocationOnScreen; }; - -/* field and method IDs for Container */ -struct ContainerIDs { - jfieldID layoutMgr; - jmethodID getComponents; - jmethodID findComponentAt; -}; - -/* fieldIDs for MComponentPeer fields that may be accessed from C */ -struct MComponentPeerIDs { - jfieldID pData; - jfieldID target; - jfieldID jniGlobalRef; - jfieldID graphicsConfig; - jfieldID drawState; - jmethodID isFocusableMID; -}; - -#ifndef HEADLESS -extern void processTree(Widget from, Widget to, Boolean action); -#endif // HEADLESS - diff --git a/jdk/src/solaris/native/sun/awt/awt_Cursor.h b/jdk/src/solaris/native/sun/awt/awt_Cursor.h deleted file mode 100644 index b71f2ecfa3b3e5c0c23aeeb410ec2d6f4be19ca5..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/native/sun/awt/awt_Cursor.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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 "jni_util.h" -#include "awt_p.h" - -#define CACHE_UPDATE 0 /* cache the component and update cursor */ -#define UPDATE_ONLY 1 /* update cursor, but not cache component */ -#define CACHE_ONLY 2 /* cache the component, no cursor update */ - -/* fieldIDs for Cursor fields that may be accessed from C */ -struct CursorIDs { - jfieldID type; - jmethodID mSetPData; - jfieldID pData; -}; - -#ifndef HEADLESS -Cursor getCursor(JNIEnv *env, jobject jCur); -void updateCursor(XPointer client_data, int32_t replace); -#endif /* !HEADLESS */ diff --git a/jdk/src/solaris/native/sun/awt/awt_DrawingSurface.c b/jdk/src/solaris/native/sun/awt/awt_DrawingSurface.c index 21cc862dcae616e4b2ecaf0f830736a82c861803..fe19f990aaa51ce2880edf3fac791e35c78499f1 100644 --- a/jdk/src/solaris/native/sun/awt/awt_DrawingSurface.c +++ b/jdk/src/solaris/native/sun/awt/awt_DrawingSurface.c @@ -29,30 +29,21 @@ #include "awt_p.h" #include "java_awt_Component.h" -//#include "sun_awt_motif_MComponentPeer.h" #include "awt_Component.h" - #include #include #include -extern struct MComponentPeerIDs mComponentPeerIDs; extern struct ComponentIDs componentIDs; -#ifndef XAWT -extern AwtGraphicsConfigDataPtr -getGraphicsConfigFromComponentPeer(JNIEnv *env, jobject this); -#endif -#ifdef XAWT #include "awt_GraphicsEnv.h" extern jfieldID windowID; extern jfieldID targetID; extern jfieldID graphicsConfigID; extern jfieldID drawStateID; extern struct X11GraphicsConfigIDs x11GraphicsConfigIDs; -#endif /* * Lock the surface of the target component for native rendering. @@ -109,13 +100,8 @@ JNIEXPORT jint JNICALL awt_DrawingSurface_Lock(JAWT_DrawingSurface* ds) return (jint)JAWT_LOCK_ERROR; } -#ifndef XAWT - drawState = (*env)->GetIntField(env, peer, mComponentPeerIDs.drawState); - (*env)->SetIntField(env, peer, mComponentPeerIDs.drawState, 0); -#else drawState = (*env)->GetIntField(env, peer, drawStateID); (*env)->SetIntField(env, peer, drawStateID, 0); -#endif return drawState; } @@ -127,9 +113,7 @@ JNIEXPORT int32_t JNICALL jclass componentClass; AwtGraphicsConfigDataPtr adata; int32_t result; -#ifdef XAWT jobject gc_object; -#endif if (ds == NULL) { #ifdef DEBUG fprintf(stderr, "Drawing Surface is NULL\n"); @@ -164,9 +148,6 @@ JNIEXPORT int32_t JNICALL AWT_UNLOCK(); return (int32_t) 0; } -#ifndef XAWT - adata = getGraphicsConfigFromComponentPeer(env, peer); -#else /* GraphicsConfiguration object of MComponentPeer */ gc_object = (*env)->GetObjectField(env, peer, graphicsConfigID); @@ -177,7 +158,6 @@ JNIEXPORT int32_t JNICALL } else { adata = getDefaultConfig(DefaultScreen(awt_display)); } -#endif result = adata->AwtColorMatch(r, g, b, adata); AWT_UNLOCK(); @@ -201,9 +181,6 @@ awt_DrawingSurface_GetDrawingSurfaceInfo(JAWT_DrawingSurface* ds) jclass componentClass; JAWT_X11DrawingSurfaceInfo* px; JAWT_DrawingSurfaceInfo* p; -#ifndef XAWT - struct ComponentData *cdata; -#endif XWindowAttributes attrs; if (ds == NULL) { @@ -241,31 +218,14 @@ awt_DrawingSurface_GetDrawingSurfaceInfo(JAWT_DrawingSurface* ds) return NULL; } -#ifndef XAWT - /* Get the component data from the peer */ - cdata = (struct ComponentData *) - JNU_GetLongFieldAsPtr(env, peer, mComponentPeerIDs.pData); - if (cdata == NULL) { -#ifdef DEBUG - fprintf(stderr, "Component data is NULL\n"); -#endif - AWT_UNLOCK(); - return NULL; - } -#endif - - AWT_UNLOCK(); + AWT_UNLOCK(); /* Allocate platform-specific data */ px = (JAWT_X11DrawingSurfaceInfo*) malloc(sizeof(JAWT_X11DrawingSurfaceInfo)); /* Set drawable and display */ -#ifndef XAWT - px->drawable = XtWindow(cdata->widget); -#else px->drawable = (*env)->GetLongField(env, peer, windowID); -#endif px->display = awt_display; /* Get window attributes to set other values */ @@ -392,21 +352,7 @@ JNIEXPORT jobject JNICALL AWT_LOCK(); -#ifndef XAWT - if (window != None) { - widget = XtWindowToWidget(awt_display, window); - } - - if (widget != NULL) { - XtVaGetValues (widget, XmNuserData, &peer, NULL); - } - - if (peer != NULL) { - target = (*env)->GetObjectField(env, peer, mComponentPeerIDs.target); - } -#else target = (*env)->GetObjectField(env, peer, targetID); -#endif if (target == NULL) { JNU_ThrowNullPointerException(env, "NullPointerException"); diff --git a/jdk/src/solaris/native/sun/awt/awt_Font.c b/jdk/src/solaris/native/sun/awt/awt_Font.c index 871a19ca2ed365b9d533a036b4b79a2757475708..239ea32f863c39f3787a781c5aaa79450611f255 100644 --- a/jdk/src/solaris/native/sun/awt/awt_Font.c +++ b/jdk/src/solaris/native/sun/awt/awt_Font.c @@ -30,8 +30,6 @@ #include "java_awt_Component.h" #include "java_awt_Font.h" #include "java_awt_FontMetrics.h" -#include "sun_awt_motif_MToolkit.h" -#include "sun_awt_motif_X11FontMetrics.h" #include "sun_awt_X11GraphicsEnvironment.h" #include "awt_Font.h" @@ -100,57 +98,6 @@ Java_java_awt_Font_initIDs } #ifndef HEADLESS - -/* fieldIDs for X11FontMetrics fields that may be accessed from C */ -static struct X11FontMetricsIDs { - jfieldID widths; - jfieldID font; - jfieldID ascent; - jfieldID descent; - jfieldID leading; - jfieldID height; - jfieldID maxAscent; - jfieldID maxDescent; - jfieldID maxHeight; - jfieldID maxAdvance; -} x11FontMetricsIDs; - -/* - * Class: sun_awt_motif_X11FontMetrics - * Method: initIDs - * Signature: ()V - */ - -/* This function gets called from the static initializer for - X11FontMetrics.java to initialize the fieldIDs for fields - that may be accessed from C */ - -JNIEXPORT void JNICALL -Java_sun_awt_motif_X11FontMetrics_initIDs - (JNIEnv *env, jclass cls) -{ - x11FontMetricsIDs.widths = (*env)->GetFieldID(env, cls, "widths", "[I"); - x11FontMetricsIDs.font = - (*env)->GetFieldID(env, cls, "font", "Ljava/awt/Font;"); - x11FontMetricsIDs.ascent = - (*env)->GetFieldID(env, cls, "ascent", "I"); - x11FontMetricsIDs.descent = - (*env)->GetFieldID(env, cls, "descent", "I"); - x11FontMetricsIDs.leading = - (*env)->GetFieldID(env, cls, "leading", "I"); - x11FontMetricsIDs.height = - (*env)->GetFieldID(env, cls, "height", "I"); - x11FontMetricsIDs.maxAscent = - (*env)->GetFieldID(env, cls, "maxAscent", "I"); - x11FontMetricsIDs.maxDescent = - (*env)->GetFieldID(env, cls, "maxDescent", "I"); - x11FontMetricsIDs.maxHeight = - (*env)->GetFieldID(env, cls, "maxHeight", "I"); - x11FontMetricsIDs.maxAdvance = - (*env)->GetFieldID(env, cls, "maxAdvance", "I"); -} - - /* fieldIDs for FontDescriptor fields that may be accessed from C */ static struct FontDescriptorIDs { jfieldID nativeName; @@ -182,27 +129,6 @@ Java_sun_awt_FontDescriptor_initIDs #endif /* !HEADLESS */ } -#ifndef HEADLESS -struct MFontPeerIDs mFontPeerIDs; -/* - * Class: sun_awt_motif_MFontPeer - * Method: initIDs - * Signature: ()V - */ - -/* This function gets called from the static initializer for - MFontPeer.java to initialize the fieldIDs for fields - that may be accessed from C */ - -JNIEXPORT void JNICALL -Java_sun_awt_motif_MFontPeer_initIDs - (JNIEnv *env, jclass cls) -{ - mFontPeerIDs.xfsname = - (*env)->GetFieldID(env, cls, "xfsname", "Ljava/lang/String;"); -} -#endif /* !HEADLESS */ - /* * Class: sun_awt_PlatformFont * Method: initIDs @@ -746,193 +672,6 @@ awtJNI_GetFontData(JNIEnv * env, jobject font, char **errmsg) } } -/* - * Class: sun_awt_motif_X11FontMetrics - * Method: getMFCharsWidth - * Signature: ([CIILjava/awt/Font;)I - */ -JNIEXPORT jint JNICALL Java_sun_awt_motif_X11FontMetrics_getMFCharsWidth - (JNIEnv *env, jobject this, jcharArray data, jint offset, jint length, jobject font) -{ - jint retVal = 0; - - AWT_LOCK(); - - retVal = awtJNI_GetMFStringWidth(env, data, offset, length, font); - - AWT_UNLOCK(); - return retVal; -} - -/* - * Class: sun_awt_motif_X11FontMetrics - * Method: bytesWidth - * Signature: ([BII)I - */ -JNIEXPORT jint JNICALL Java_sun_awt_motif_X11FontMetrics_bytesWidth - (JNIEnv *env, jobject this, jbyteArray str, jint off, jint len) -{ - jint w = 0; - unsigned char *s = NULL, *tmpPointer = NULL; - int32_t ch = 0; - int32_t cnt = 0; - jobject widths = NULL; - jint tempWidths[256]; - jint maxAdvance = 0; - int32_t widlen = 0; - - if (JNU_IsNull(env, str)) { - JNU_ThrowNullPointerException(env, "NullPointerException"); - return 0; - } - - cnt = (*env)->GetArrayLength(env, str); - if (cnt == 0) { - return 0; - } - - widths = (*env)->GetObjectField(env, this, x11FontMetricsIDs.widths); - maxAdvance = (*env)->GetIntField(env, this, x11FontMetricsIDs.maxAdvance); - if (!JNU_IsNull(env, widths)) { - w = 0; - widlen = (*env)->GetArrayLength(env, widths); - (*env)->GetIntArrayRegion(env, widths, 0, widlen, (jint *) tempWidths); - - s = tmpPointer = (unsigned char *) (*env)->GetPrimitiveArrayCritical(env, str, NULL); - if (s == NULL) { - return 0; - } - - while (--cnt >= 0) { - ch = *tmpPointer++; - if (ch < widlen) { - w += tempWidths[ch]; - } else { - w += maxAdvance; - } - } - - (*env)->ReleasePrimitiveArrayCritical(env, str, (jchar *) s, JNI_ABORT); - } else { - w = maxAdvance * cnt; - } - return w; -} - -/* - * Class: sun_awt_motif_X11FontMetrics - * Method: init - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_sun_awt_motif_X11FontMetrics_init - (JNIEnv *env, jobject this) -{ - jobject font = NULL; - struct FontData *fdata = NULL; - jint tempWidths[256]; - jintArray widths = NULL; - int32_t ccount = 0; - int32_t i = 0; - int32_t tempWidthsIndex = 0; - char *err = NULL; - - if (JNU_IsNull(env, this)) { - JNU_ThrowNullPointerException(env, "NullPointerException"); - return; - } - AWT_LOCK(); - - font = (*env)->GetObjectField(env, this, x11FontMetricsIDs.font); - if (JNU_IsNull(env, this)) { - JNU_ThrowNullPointerException(env, "NullPointerException"); - AWT_UNLOCK(); - return; - } - fdata = awtJNI_GetFontData(env, font, &err); - if (fdata == NULL) { - JNU_ThrowInternalError(env, err); - AWT_UNLOCK(); - return; - } - - /* - * Bug 4103248, 4120310. We must take all of the fonts into - * consideration in providing the metrics, not just the 8859-1 font, - * because the underlying Motif widgets are. - */ - if (awtJNI_IsMultiFont(env, font) && fdata->xfs == NULL) { - fdata->xfs = awtJNI_MakeFontSet(env, font); - } - if (fdata->xfs != NULL) { - XFontSetExtents *fs_extents = NULL; - fs_extents = XExtentsOfFontSet(fdata->xfs); - - (*env)->SetIntField(env, this, x11FontMetricsIDs.maxAscent, - (jint)(-fs_extents->max_logical_extent.y)); - (*env)->SetIntField(env, this, x11FontMetricsIDs.maxDescent, - (jint)(fs_extents->max_logical_extent.height + - fs_extents->max_logical_extent.y)); - (*env)->SetIntField(env, this, x11FontMetricsIDs.maxAdvance, - (jint)(fs_extents->max_logical_extent.width)); - (*env)->SetIntField(env, this, x11FontMetricsIDs.ascent, - (jint)(-fs_extents->max_ink_extent.y)); - (*env)->SetIntField(env, this, x11FontMetricsIDs.descent, - (jint)(fs_extents->max_ink_extent.height + - fs_extents->max_ink_extent.y)); - } else { - (*env)->SetIntField(env, this, x11FontMetricsIDs.maxAscent, - (jint) fdata->xfont->max_bounds.ascent); - (*env)->SetIntField(env, this, x11FontMetricsIDs.maxDescent, - (jint) fdata->xfont->max_bounds.descent); - (*env)->SetIntField(env, this, x11FontMetricsIDs.maxAdvance, - (jint) fdata->xfont->max_bounds.width); - (*env)->SetIntField(env, this, x11FontMetricsIDs.ascent, - (jint) fdata->xfont->ascent); - (*env)->SetIntField(env, this, x11FontMetricsIDs.descent, - (jint) fdata->xfont->descent); - } - - (*env)->SetIntField(env, this, x11FontMetricsIDs.leading, (jint) 1); - (*env)->SetIntField(env, this, x11FontMetricsIDs.height, - (jint) fdata->xfont->ascent + fdata->xfont->descent + 1); - (*env)->SetIntField(env, this, x11FontMetricsIDs.maxHeight, - (jint) fdata->xfont->max_bounds.ascent - + fdata->xfont->max_bounds.descent + 1); - - - widths = (*env)->NewIntArray(env, 256); - (*env)->SetObjectField(env, this, x11FontMetricsIDs.widths, widths); - if (JNU_IsNull(env, widths)) { - JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError"); - AWT_UNLOCK(); - return; - } - /* - * We could pin the array and then release it, but I believe this method - * is faster and perturbs the VM less - * - */ - memset(tempWidths, 0, 256 * sizeof(jint)); - - tempWidthsIndex = fdata->xfont->min_char_or_byte2; - - ccount = fdata->xfont->max_char_or_byte2 - fdata->xfont->min_char_or_byte2; - - if (fdata->xfont->per_char) { - for (i = 0; i <= ccount; i++) { - tempWidths[tempWidthsIndex++] = (jint) fdata->xfont->per_char[i].width; - } - } else { - for (i = 0; i <= ccount; i++) { - tempWidths[tempWidthsIndex++] = (jint) fdata->xfont->max_bounds.width; - } - } - - (*env)->SetIntArrayRegion(env, widths, 0, 256, (jint *) tempWidths); - - AWT_UNLOCK(); -} - /* * Registered with the 2D disposer to be called after the Font is GC'd. */ diff --git a/jdk/src/solaris/native/sun/awt/awt_Font.h b/jdk/src/solaris/native/sun/awt/awt_Font.h index 62317999ac2f9416f4a07c5f4b504c69470cb1e9..ca0028841028b918f7e2add2a1882afb28294970 100644 --- a/jdk/src/solaris/native/sun/awt/awt_Font.h +++ b/jdk/src/solaris/native/sun/awt/awt_Font.h @@ -34,8 +34,8 @@ struct FontIDs { jmethodID getFamily; }; -/* fieldIDs for MFontPeer fields that may be accessed from C */ -struct MFontPeerIDs { +/* fieldIDs for XFontPeer fields that may be accessed from C */ +struct XFontPeerIDs { jfieldID xfsname; }; diff --git a/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c b/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c index 65b0690b56f8692d168500b3987dc75e5b3f4060..f6e4b0660ffb32d685722938f4b7f5e70625fe1a 100644 --- a/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c +++ b/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c @@ -45,7 +45,6 @@ #include #include "awt_GraphicsEnv.h" -#include "awt_Window.h" #include "awt_util.h" #include "gdefs.h" #include @@ -94,8 +93,6 @@ jboolean awtLockInited = JNI_FALSE; struct X11GraphicsConfigIDs x11GraphicsConfigIDs; struct X11GraphicsDeviceIDs x11GraphicsDeviceIDs; -extern struct WindowIDs mWindowIDs; -extern struct MWindowPeerIDs mWindowPeerIDs; #ifndef HEADLESS int awtCreateX11Colormap(AwtGraphicsConfigDataPtr adata); @@ -570,75 +567,6 @@ getAllConfigs (JNIEnv *env, int screen, AwtScreenDataPtr screenDataPtr) { AWT_UNLOCK (); } -/* - * Determing if this top-level has been moved onto another Xinerama screen. - * Called from awt_TopLevel.c - * - * ASSUME: wdata != null - */ -#ifndef HEADLESS -void checkNewXineramaScreen(JNIEnv* env, jobject peer, struct FrameData* wdata, - int32_t newX, int32_t newY, - int32_t newWidth, int32_t newHeight) { - int i; - int amt; - int totAmt = 0; - int largestAmt = 0; - int largestAmtScr = 0; - - int horiz; - int vert; - - if (!usingXinerama) { return; } - - totAmt = newWidth * newHeight; - - /* assert that peer implements WindowPeer */ - DASSERT(JNU_IsInstanceOfByName(env, peer, "java/awt/peer/WindowPeer")); - - DTRACE_PRINTLN4("checkNewXineramaScreen() x=%i y=%i w=%i h=%i\n",newX, newY, newWidth, newHeight); - - /* decide which screen we're on - * if we're spanning, figure out which screen we're most on - */ - for (i = 0; i < awt_numScreens; i++) { - if (INTERSECTS(newX, newX + newWidth, newY, newY + newHeight, - fbrects[i].x, fbrects[i].x + fbrects[i].width, - fbrects[i].y, fbrects[i].y + fbrects[i].height)) { - - /* calc how much of window is on this screen */ - horiz = MIN(newX + newWidth, fbrects[i].x + fbrects[i].width) - - MAX(newX, fbrects[i].x); - vert = MIN(newY + newHeight, fbrects[i].y + fbrects[i].height) - - MAX(newY, fbrects[i].y); - DASSERT(horiz > 0); - DASSERT(vert > 0); - - amt = horiz * vert; - if (amt == totAmt) { - /* completely on this screen - done! */ - largestAmtScr = i; - break; - } - if (amt > largestAmt) { - largestAmt = amt; - largestAmtScr = i; - } - } - } - -#ifndef XAWT - /* check if we're on a new screen */ - if (largestAmtScr != wdata->screenNum) { - wdata->screenNum = largestAmtScr; - /* update peer, target Comp */ - (*env)->CallVoidMethod(env, peer, - mWindowPeerIDs.draggedToScreenMID, largestAmtScr); - } -#endif /* XAWT */ -} -#endif /* HEADLESS */ - #ifndef HEADLESS #ifdef __linux__ static void xinerama_init_linux() diff --git a/jdk/src/solaris/native/sun/awt/awt_InputMethod.c b/jdk/src/solaris/native/sun/awt/awt_InputMethod.c index 116a5310eb7f289a47c980f687e5881c12043d5e..af85e4871db5ef65dc37bba5dc1cccfac3d58119 100644 --- a/jdk/src/solaris/native/sun/awt/awt_InputMethod.c +++ b/jdk/src/solaris/native/sun/awt/awt_InputMethod.c @@ -30,28 +30,14 @@ #include #include #include -#ifdef XAWT #include -#else /* !XAWT */ -#include -#include -#include -#include -#endif /* XAWT */ #include "awt.h" #include "awt_p.h" #include -#ifdef XAWT #include #include -#else /* !XAWT */ -#include -#include - -#define MCOMPONENTPEER_CLASS_NAME "sun/awt/motif/MComponentPeer" -#endif /* XAWT */ #define THROW_OUT_OF_MEMORY_ERROR() \ JNU_ThrowOutOfMemoryError((JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2), NULL) @@ -111,11 +97,7 @@ static XIMProc callback_funcs[NCALLBACKS] = { typedef struct { Window w; /*status window id */ Window root; /*the root window id */ -#ifdef XAWT Window parent; /*parent shell window */ -#else - Widget parent; /*parent shell window */ -#endif int x, y; /*parent's upperleft position */ int width, height; /*parent's width, height */ GC lightGC; /*gc for light border */ @@ -141,17 +123,10 @@ typedef struct _X11InputMethodData { XIC ic_active; /* X Input Context for active clients */ XIC ic_passive; /* X Input Context for passive clients */ XIMCallback *callbacks; /* callback parameters */ -#ifndef XAWT - jobject peer; /* MComponentPeer of client Window */ -#endif /* XAWT */ jobject x11inputmethod; /* global ref to X11InputMethod instance */ /* associated with the XIC */ #ifdef __linux__ StatusWindow *statusWindow; /* our own status window */ -#else -#ifndef XAWT - Widget statusWidget; /* IM status window widget */ -#endif /* XAWT */ #endif char *lookup_buf; /* buffer used for XmbLookupString */ int lookup_buf_len; /* lookup buffer size in bytes */ @@ -191,12 +166,6 @@ Display * dpy = NULL; #define GetJNIEnv() (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2) -#ifndef XAWT -static jobject mcompClass = NULL; -static jobject awteventClass = NULL; -static jfieldID mcompPDataID = NULL; -#endif /* XAWT */ - static void DestroyXIMCallback(XIM, XPointer, XPointer); static void OpenXIMCallback(Display *, XPointer, XPointer); /* Solaris XIM Extention */ @@ -261,28 +230,6 @@ wcstombsdmp(wchar_t *wcs, int len) return mbs; } -#ifndef XAWT -/* - * Find a class for the given class name and return a global reference to the - * class. - */ -static jobject -findClass(const char *className) -{ - JNIEnv *env = GetJNIEnv(); - jclass classClass; - jobject objectClass; - - classClass = (*env)->FindClass(env, className); - objectClass = (*env)->NewGlobalRef(env,classClass); - - if (JNU_IsNull(env, objectClass)) { - JNU_ThrowClassNotFoundException(env, className); - } - return objectClass; -} -#endif /* XAWT */ - /* * Returns True if the global reference is still in the list, * otherwise False. @@ -444,9 +391,6 @@ freeX11InputMethodData(JNIEnv *env, X11InputMethodData *pX11IMData) free((void *)pX11IMData->callbacks); if (env) { -#ifndef XAWT - (*env)->DeleteGlobalRef(env, pX11IMData->peer); -#endif /* XAWT */ /* Remove the global reference from the list, so that the callback function or whoever refers to it could know. */ @@ -580,23 +524,10 @@ awt_x11inputmethod_lookupString(XKeyPressedEvent *event, KeySym *keysymp) /* Get keysym without taking modifiers into account first to map * to AWT keyCode table. */ -#ifndef XAWT - if (((event->state & ShiftMask) || - (event->state & LockMask)) && - keysym >= 'A' && keysym <= 'Z') - { - keysym = XLookupKeysym(event, 0); - } -#endif - switch (status) { case XLookupBoth: if (!composing) { -#ifdef XAWT if (event->keycode != 0) { -#else - if (keysym < 128 || ((keysym & 0xff00) == 0xff00)) { -#endif *keysymp = keysym; result = False; break; @@ -650,11 +581,7 @@ awt_x11inputmethod_lookupString(XKeyPressedEvent *event, KeySym *keysymp) #ifdef __linux__ static StatusWindow *createStatusWindow( -#ifdef XAWT Window parent) { -#else - Widget parent) { -#endif StatusWindow *statusWindow; XSetWindowAttributes attrib; unsigned long attribmask; @@ -682,22 +609,12 @@ static StatusWindow *createStatusWindow( Window *ignoreWindowPtr; unsigned int ignoreUnit; -#ifdef XAWT XGetGeometry(dpy, parent, &rootWindow, &x, &y, &w, &h, &bw, &depth); -#else - while (!XtIsShell(parent)){ - parent = XtParent(parent); - } -#endif attrib.override_redirect = True; attribmask = CWOverrideRedirect; for (i = 0; i < awt_numScreens; i++) { -#ifdef XAWT if (RootWindow(dpy, i) == rootWindow) { -#else - if (ScreenOfDisplay(dpy, i) == XtScreen(parent)) { -#endif screen = i; break; } @@ -798,11 +715,7 @@ static StatusWindow *createStatusWindow( /* This method is to turn off or turn on the status window. */ static void onoffStatusWindow(X11InputMethodData* pX11IMData, -#ifdef XAWT Window parent, -#else - Widget parent, -#endif Bool ON){ XWindowAttributes xwa; Window child; @@ -820,15 +733,9 @@ static void onoffStatusWindow(X11InputMethodData* pX11IMData, statusWindow->on = False; return; } -#ifdef XAWT parent = JNU_CallMethodByName(GetJNIEnv(), NULL, pX11IMData->x11inputmethod, "getCurrentParentWindow", "()J").j; -#else - while (!XtIsShell(parent)){ - parent = XtParent(parent); - } -#endif if (statusWindow->parent != parent){ statusWindow->parent = parent; } @@ -941,11 +848,7 @@ void statusWindowEventHandler(XEvent event){ } } -#ifdef XAWT static void adjustStatusWindow(Window shell){ -#else -void adjustStatusWindow(Widget shell){ -#endif JNIEnv *env = GetJNIEnv(); X11InputMethodData *pX11IMData = NULL; StatusWindow *statusWindow; @@ -957,11 +860,7 @@ void adjustStatusWindow(Widget shell){ || !statusWindow->on) { return; } -#ifdef XAWT { -#else - if (statusWindow->parent == shell) { -#endif XWindowAttributes xwa; int x, y; Window child; @@ -1009,12 +908,7 @@ void adjustStatusWindow(Widget shell){ * fallback to None styles. */ static Bool -#ifdef XAWT createXIC(JNIEnv * env, X11InputMethodData *pX11IMData, Window w) -#else /* !XAWT */ -createXIC(Widget w, X11InputMethodData *pX11IMData, - jobject tc, jobject peer) -#endif /* XAWT */ { XIC active_ic, passive_ic; XVaNestedList preedit = NULL; @@ -1031,17 +925,9 @@ createXIC(Widget w, X11InputMethodData *pX11IMData, if (X11im == NULL) { return False; } -#ifdef XAWT if (!w) { return False; } -#else /* !XAWT */ - /* - * If the parent window has one or more TextComponents, the status - * area of Motif will be shared with the created XIC. Otherwise, - * root-window style status is used. - */ -#endif /* XAWT */ ret = XGetIMValues(X11im, XNQueryInputStyle, &im_styles, NULL); @@ -1064,28 +950,7 @@ createXIC(Widget w, X11InputMethodData *pX11IMData, } } #else /*! __linux__ */ -#ifdef XAWT on_the_spot_styles |= XIMStatusNothing; -#else /* !XAWT */ - /* - * If the parent window has one or more TextComponents, the status - * area of Motif will be shared with the created XIC. Otherwise, - * root-window style status is used. - */ - if (tc != NULL){ - XVaNestedList status = NULL; - status = awt_motif_getXICStatusAreaList(w, tc); - if (status != NULL){ - on_the_spot_styles |= XIMStatusArea; - XFree(status); - } - else - on_the_spot_styles |= XIMStatusNothing; - } - else - on_the_spot_styles |= XIMStatusNothing; - -#endif /* XAWT */ #endif /* __linux__ */ for (i = 0; i < im_styles->count_styles; i++) { @@ -1157,32 +1022,12 @@ createXIC(Widget w, X11InputMethodData *pX11IMData, XFree((void *)preedit); } #else /* !__linux__ */ -#ifndef XAWT - if (on_the_spot_styles & XIMStatusArea) { - Widget parent; - status = awt_motif_getXICStatusAreaList(w, tc); - if (status == NULL) - goto err; - pX11IMData->statusWidget = awt_util_getXICStatusAreaWindow(w); - pX11IMData->ic_active = XCreateIC(X11im, - XNClientWindow, pX11IMData->statusWidget, - XNFocusWindow, w, - XNInputStyle, active_styles, - XNPreeditAttributes, preedit, - XNStatusAttributes, status, - NULL); - XFree((void *)status); - } else { -#endif /* XAWT */ pX11IMData->ic_active = XCreateIC(X11im, XNClientWindow, w, XNFocusWindow, w, XNInputStyle, active_styles, XNPreeditAttributes, preedit, NULL); -#ifndef XAWT - } -#endif /* XAWT */ XFree((void *)preedit); #endif /* __linux__ */ pX11IMData->ic_passive = XCreateIC(X11im, @@ -1479,7 +1324,7 @@ static void DestroyXIMCallback(XIM im, XPointer client_data, XPointer call_data) } /* - * Class: java_sun_awt_motif_X11InputMethod + * Class: sun_awt_X11InputMethod * Method: initIDs * Signature: ()V */ @@ -1495,24 +1340,15 @@ Java_sun_awt_X11InputMethod_initIDs(JNIEnv *env, jclass cls) JNIEXPORT jboolean JNICALL -#ifdef XAWT Java_sun_awt_X11_XInputMethod_openXIMNative(JNIEnv *env, jobject this, jlong display) -#else -Java_sun_awt_motif_MInputMethod_openXIMNative(JNIEnv *env, - jobject this) -#endif { Bool registered; AWT_LOCK(); -#ifdef XAWT dpy = (Display *)jlong_to_ptr(display); -#else - dpy = awt_display; -#endif /* Use IMInstantiate call back only on Linux, as there is a bug in Solaris (4768335) @@ -1534,30 +1370,17 @@ Java_sun_awt_motif_MInputMethod_openXIMNative(JNIEnv *env, } JNIEXPORT jboolean JNICALL -#ifdef XAWT Java_sun_awt_X11_XInputMethod_createXICNative(JNIEnv *env, jobject this, jlong window) { -#else /* !XAWT */ -Java_sun_awt_motif_MInputMethod_createXICNative(JNIEnv *env, - jobject this, - jobject comp, - jobject tc) -{ - struct ComponentData *cdata; -#endif /* XAWT */ X11InputMethodData *pX11IMData; jobject globalRef; XIC ic; AWT_LOCK(); -#ifdef XAWT if (!window) { -#else /* !XAWT */ - if (JNU_IsNull(env, comp)) { -#endif /* XAWT */ JNU_ThrowNullPointerException(env, "NullPointerException"); AWT_UNLOCK(); return JNI_FALSE; @@ -1570,40 +1393,16 @@ Java_sun_awt_motif_MInputMethod_createXICNative(JNIEnv *env, return JNI_FALSE; } -#ifndef XAWT - if (mcompClass == NULL) { - mcompClass = findClass(MCOMPONENTPEER_CLASS_NAME); - mcompPDataID = (*env)->GetFieldID(env, mcompClass, "pData", "J"); - } - cdata = (struct ComponentData *) JNU_GetLongFieldAsPtr(env,comp,mcompPDataID); - - if (cdata == 0) { - free((void *)pX11IMData); - JNU_ThrowNullPointerException(env, "createXIC"); - AWT_UNLOCK(); - return JNI_FALSE; - } - - pX11IMData->peer = (*env)->NewGlobalRef(env, comp); -#endif /* XAWT */ globalRef = (*env)->NewGlobalRef(env, this); pX11IMData->x11inputmethod = globalRef; #ifdef __linux__ pX11IMData->statusWindow = NULL; -#else /* __linux__ */ -#ifndef XAWT - pX11IMData->statusWidget = (Widget) NULL; -#endif /* XAWT */ #endif /* __linux__ */ pX11IMData->lookup_buf = 0; pX11IMData->lookup_buf_len = 0; -#ifdef XAWT if (createXIC(env, pX11IMData, (Window)window) -#else /* !XAWT */ - if (createXIC(cdata->widget, pX11IMData, tc, comp) -#endif /* XAWT */ == False) { destroyX11InputMethodData((JNIEnv *) NULL, pX11IMData); pX11IMData = (X11InputMethodData *) NULL; @@ -1615,77 +1414,6 @@ Java_sun_awt_motif_MInputMethod_createXICNative(JNIEnv *env, return (pX11IMData != NULL); } -#ifndef XAWT -JNIEXPORT void JNICALL -Java_sun_awt_motif_MInputMethod_reconfigureXICNative(JNIEnv *env, - jobject this, - jobject comp, - jobject tc) -{ - X11InputMethodData *pX11IMData; - - AWT_LOCK(); - - pX11IMData = getX11InputMethodData(env, this); - if (pX11IMData == NULL) { - AWT_UNLOCK(); - return; - } - - if (pX11IMData->current_ic == (XIC)0) { - destroyX11InputMethodData(env, pX11IMData); - pX11IMData = (X11InputMethodData *)NULL; - } else { - Bool active; - struct ComponentData *cdata; - - active = pX11IMData->current_ic == pX11IMData->ic_active; - if (mcompClass == NULL) { - mcompClass = findClass(MCOMPONENTPEER_CLASS_NAME); - mcompPDataID = (*env)->GetFieldID(env, mcompClass, "pData", "J"); - } - cdata = (struct ComponentData *) JNU_GetLongFieldAsPtr(env,comp,mcompPDataID); - if (cdata == 0) { - JNU_ThrowNullPointerException(env, "reconfigureXICNative"); - destroyX11InputMethodData(env, pX11IMData); - pX11IMData = (X11InputMethodData *)NULL; - } - XDestroyIC(pX11IMData->ic_active); - if (pX11IMData->ic_active != pX11IMData->ic_passive) - XDestroyIC(pX11IMData->ic_passive); - pX11IMData->current_ic = (XIC)0; - pX11IMData->ic_active = (XIC)0; - pX11IMData->ic_passive = (XIC)0; - if (createXIC(cdata->widget, pX11IMData, tc, comp)) { - pX11IMData->current_ic = active ? - pX11IMData->ic_active : pX11IMData->ic_passive; - /* - * On Solaris2.6, setXICWindowFocus() has to be invoked - * before setting focus. - */ - setXICWindowFocus(pX11IMData->current_ic, cdata->widget); - setXICFocus(pX11IMData->current_ic, True); - } else { - destroyX11InputMethodData((JNIEnv *) NULL, pX11IMData); - pX11IMData = (X11InputMethodData *)NULL; - } - } - - setX11InputMethodData(env, this, pX11IMData); - - AWT_UNLOCK(); -} - -JNIEXPORT void JNICALL -Java_sun_awt_motif_MInputMethod_setXICFocusNative(JNIEnv *env, - jobject this, - jobject comp, - jboolean req, - jboolean active) -{ - struct ComponentData *cdata; - Widget w; -#else /* !XAWT */ JNIEXPORT void JNICALL Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env, jobject this, @@ -1693,7 +1421,6 @@ Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env, jboolean req, jboolean active) { -#endif /* XAWT */ X11InputMethodData *pX11IMData; AWT_LOCK(); pX11IMData = getX11InputMethodData(env, this); @@ -1703,40 +1430,16 @@ Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env, } if (req) { -#ifdef XAWT if (!w) { AWT_UNLOCK(); return; } -#else /* !XAWT */ - struct ComponentData *cdata; - - if (JNU_IsNull(env, comp)) { - AWT_UNLOCK(); - return; - } - if (mcompClass == NULL) { - mcompClass = findClass(MCOMPONENTPEER_CLASS_NAME); - mcompPDataID = (*env)->GetFieldID(env, mcompClass, "pData", "J"); - } - cdata = (struct ComponentData *)JNU_GetLongFieldAsPtr(env, comp, - mcompPDataID); - if (cdata == 0) { - JNU_ThrowNullPointerException(env, "setXICFocus pData"); - AWT_UNLOCK(); - return; - } -#endif /* XAWT */ - pX11IMData->current_ic = active ? pX11IMData->ic_active : pX11IMData->ic_passive; /* * On Solaris2.6, setXICWindowFocus() has to be invoked * before setting focus. */ -#ifndef XAWT - w = cdata->widget; -#endif /* XAWT */ setXICWindowFocus(pX11IMData->current_ic, w); setXICFocus(pX11IMData->current_ic, req); currentX11InputMethodInstance = pX11IMData->x11inputmethod; @@ -1853,40 +1556,6 @@ Java_sun_awt_X11InputMethod_resetXIC(JNIEnv *env, return jText; } -#ifndef XAWT -JNIEXPORT void JNICALL -Java_sun_awt_motif_MInputMethod_configureStatusAreaNative(JNIEnv *env, - jobject this, - jobject tc) -{ - X11InputMethodData *pX11IMData; - XVaNestedList status; - -#ifdef __linux__ - /*do nothing for linux? */ -#else - AWT_LOCK(); - pX11IMData = getX11InputMethodData(env, this); - - if ((pX11IMData == NULL) || (pX11IMData->ic_active == (XIC)0)) { - AWT_UNLOCK(); - return; - } - - if (pX11IMData->statusWidget) { - status = awt_motif_getXICStatusAreaList(pX11IMData->statusWidget, tc); - if (status != (XVaNestedList)NULL) { - XSetICValues(pX11IMData->ic_active, - XNStatusAttributes, status, - NULL); - XFree((void *)status); - } - } - AWT_UNLOCK(); -#endif -} -#endif /* XAWT */ - /* * Class: sun_awt_X11InputMethod * Method: setCompositionEnabledNative @@ -1964,7 +1633,6 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11InputMethod_isCompositionEnabledNativ return (jboolean)(state == XIMPreeditEnable); } -#ifdef XAWT JNIEXPORT void JNICALL Java_sun_awt_X11_XInputMethod_adjustStatusWindow (JNIEnv *env, jobject this, jlong window) { @@ -1974,4 +1642,3 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XInputMethod_adjustStatusWindow AWT_UNLOCK(); #endif } -#endif diff --git a/jdk/src/solaris/native/sun/awt/awt_KeyboardFocusManager.h b/jdk/src/solaris/native/sun/awt/awt_KeyboardFocusManager.h deleted file mode 100644 index fc2827581f30f927854b30194ccd9247245a59a2..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/native/sun/awt/awt_KeyboardFocusManager.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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 "jni.h" - -struct KeyboardFocusManagerIDs { - jclass keyboardFocusManagerCls; - jmethodID shouldNativelyFocusHeavyweightMID; - jmethodID heavyweightButtonDownMID; - jmethodID heavyweightButtonDownZMID; - jmethodID markClearGlobalFocusOwnerMID; - jmethodID processSynchronousTransferMID; - jfieldID isProxyActive; -}; diff --git a/jdk/src/solaris/native/sun/awt/awt_MToolkit.c b/jdk/src/solaris/native/sun/awt/awt_MToolkit.c deleted file mode 100644 index 3a7c117b23bd1ff9acd6b789221f357b5a4a25c6..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/native/sun/awt/awt_MToolkit.c +++ /dev/null @@ -1,3430 +0,0 @@ -/* - * Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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 -#include -#include - -#ifndef HEADLESS -#include -#include -#include -#endif /* !HEADLESS */ - -#include -#include -#include -#include - -/* 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" - -extern JavaVM *jvm; - -#ifndef HEADLESS -#ifdef __linux__ -extern void statusWindowEventHandler(XEvent event); -#endif -#endif /* !HEADLESS */ - -JNIEXPORT jint JNICALL -JNI_OnLoad(JavaVM *vm, void *reserved) -{ -#ifndef HEADLESS - awt_util_debug_init(); -#endif /* !HEADLESS */ - jvm = vm; - return JNI_VERSION_1_2; -} - -JNIEXPORT jboolean JNICALL AWTIsHeadless() { -#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 Display *awt_init_Display(JNIEnv *env); - -extern void X11SD_LibDispose(JNIEnv *env); - -extern Widget drag_source = NULL; - -extern struct ComponentIDs componentIDs; -extern struct MenuComponentIDs menuComponentIDs; -extern struct MComponentPeerIDs mComponentPeerIDs; -extern struct WindowIDs windowIDs; - -static Atom _XA_XSETTINGS_SETTINGS = None; -struct xsettings_callback_cookie { - jobject mtoolkit; - jmethodID upcallMID; -}; - -static struct xsettings_callback_cookie xsettings_callback_cookie; - - -static XEvent focusOutEvent; - -static void awt_pipe_init(void); -static void processOneEvent(XtInputMask iMask); -extern void waitForEvents(JNIEnv *env, int32_t fdXPipe, int32_t fdAWTPipe); -#ifdef USE_SELECT -static void performSelect(JNIEnv *env, int32_t fdXPipe, int32_t fdAWTPipe); -#else -static void performPoll(JNIEnv *env,int32_t fdXPipe, int32_t fdAWTPipe); -#endif - - -#include -#include -#include - -#ifdef USE_SELECT -#if defined(AIX) -#include -#endif -#else -#include -#ifndef POLLRDNORM -#define POLLRDNORM POLLIN -#endif -#endif - -#ifdef NDEBUG -#undef DEBUG /* NDEBUG overrides DEBUG */ -#endif - -static struct WidgetInfo *awt_winfo = (struct WidgetInfo *) NULL; -static struct MenuList* menu_list = (struct MenuList*) NULL; - -#ifndef bzero -#define bzero(a,b) memset(a, 0, b) -#endif - -static jboolean syncUpdated = JNI_FALSE; -static jboolean syncFailed = JNI_FALSE; -static jint eventNumber = 0; -static void syncWait_eventHandler(XEvent *); -static Atom oops_atom = None; -static Atom wm_selection = None; -static Atom version_atom = None; - -static Boolean inSyncWait = False; - -Widget grabbed_widget = NULL; - -XtAppContext awt_appContext; -Widget awt_root_shell; -Pixel awt_defaultBg; -Pixel awt_defaultFg; -int32_t awt_multiclick_time; /* milliseconds */ -uint32_t awt_MetaMask = 0; -uint32_t awt_AltMask = 0; -uint32_t awt_NumLockMask = 0; -uint32_t awt_ModeSwitchMask = 0; -Cursor awt_scrollCursor; -Boolean awt_ModLockIsShiftLock = False; -extern Boolean awt_UseType4Patch; -extern Boolean awt_UseXKB; - -#define SPECIAL_KEY_EVENT 2 - -/* implement a "putback queue" -- see comments on awt_put_back_event() */ -#define PUTBACK_QUEUE_MIN_INCREMENT 5 /* min size increase */ -static XEvent *putbackQueue = NULL; /* the queue -- next event is 0 */ -static int32_t putbackQueueCount = 0; /* # of events available on queue */ -static int32_t putbackQueueCapacity = 0; /* total capacity of queue */ -static XtInputMask awt_events_pending(XtAppContext appContext); -static int32_t awt_get_next_put_back_event(XEvent *xev_out); - -#define AWT_FLUSH_TIMEOUT ((uint32_t)100) /* milliseconds */ -#define AWT_MIN_POLL_TIMEOUT ((uint32_t)0) /* milliseconds */ -#define AWT_MAX_POLL_TIMEOUT ((uint32_t)250) /* milliseconds */ - -#define AWT_POLL_BUFSIZE 100 -#define AWT_READPIPE (awt_pipe_fds[0]) -#define AWT_WRITEPIPE (awt_pipe_fds[1]) -#define AWT_FLUSHOUTPUT_NOW() \ -{ \ - XFlush(awt_display); \ - awt_next_flush_time = 0LL; \ -} - -typedef XtIntervalId (*XTFUNC)(); - -static jobject awt_MainThread = NULL; -static char read_buf[AWT_POLL_BUFSIZE + 1]; /* dummy buf to empty pipe */ -static int32_t awt_pipe_fds[2]; /* fds for wkaeup pipe */ -static Boolean awt_pipe_inited = False; /* make sure pipe is initialized before write */ -static int32_t def_poll_timeout = AWT_MAX_POLL_TIMEOUT; /* default value for timeout */ -static jlong awt_next_flush_time = 0LL; /* 0 == no scheduled flush */ -static void *xt_lib = NULL; -static XTFUNC xt_timeout = NULL; - -#ifdef DEBUG_AWT_LOCK - -int32_t awt_locked = 0; -char *lastF = ""; -int32_t lastL = -1; - -#endif - -#ifndef NOMODALFIX -extern Boolean awt_isModal(); -extern Boolean awt_isWidgetModal(Widget w); -#endif - -Boolean keyboardGrabbed = False; - -static uint32_t curPollTimeout = AWT_MAX_POLL_TIMEOUT; - -/* Font information to feed Motif widgets. */ -static const char *motifFontList; -static XFontSet defaultMotifFontSet; -static XFontStruct *defaultMotifFontStruct; -static const char *defaultMotifFont = /* a.k.a "fixed", known everywhere */ - "-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1"; - -XFontSet getMotifFontSet() { - char **missingList; - int32_t missingCount; - char *defChar; - - return XCreateFontSet(awt_display, motifFontList, - &missingList, &missingCount, &defChar); -} - -XFontStruct *getMotifFontStruct() { - return XLoadQueryFont(awt_display, defaultMotifFont); -} - -XmFontList getMotifFontList() { - XmFontListEntry motifFontListEntry; - XmFontList fontlist; - - if (strchr(motifFontList, ',') == NULL) { - /* If the default font is a single font. */ - if (defaultMotifFontStruct == NULL) - defaultMotifFontStruct = getMotifFontStruct(); - motifFontListEntry = XmFontListEntryCreate(XmFONTLIST_DEFAULT_TAG, - XmFONT_IS_FONT, - (XtPointer)defaultMotifFontStruct); - } - else { - /* If the default font is multiple fonts. */ - if (defaultMotifFontSet == NULL) - defaultMotifFontSet = getMotifFontSet(); - motifFontListEntry = XmFontListEntryCreate(XmFONTLIST_DEFAULT_TAG, - XmFONT_IS_FONTSET, - (XtPointer)defaultMotifFontSet); - } - fontlist = XmFontListAppendEntry(NULL, motifFontListEntry); - XmFontListEntryFree(&motifFontListEntry); - return fontlist; -} - -static void -awt_set_poll_timeout (uint32_t newTimeout) -{ - DTRACE_PRINTLN1("awt_set_poll_timeout(%lu)", newTimeout); - - newTimeout = max(AWT_MIN_POLL_TIMEOUT, newTimeout); - newTimeout = min(AWT_MAX_POLL_TIMEOUT, newTimeout); - newTimeout = min(newTimeout, curPollTimeout); - curPollTimeout = newTimeout; - -} /* 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 - * with no events/timers arriving. Therefore, we can increase the - * next timeout slightly. - */ -static uint32_t -awt_get_poll_timeout( Boolean timedOut ) -{ - uint32_t timeout = AWT_MAX_POLL_TIMEOUT; - - DTRACE_PRINTLN2("awt_get_poll_timeout(%s), awt_next_flush_time:%ld", - (remove?"true":"false"), - awt_next_flush_time); - - if (timedOut) { - /* add 1/16 (plus 1, in case the division truncates to 0) */ - curPollTimeout += ((curPollTimeout>>4) + 1); - curPollTimeout = min(AWT_MAX_POLL_TIMEOUT, curPollTimeout); - } - if (awt_next_flush_time > 0) { - int32_t flushDiff = (int32_t)(awt_next_flush_time - awtJNI_TimeMillis()); - timeout = min(curPollTimeout, flushDiff); - } else { - timeout = curPollTimeout; - } - - return timeout; -} /* awt_get_poll_timeout() */ - -static jlong -awtJNI_TimeMillis(void) -{ - struct timeval t; - - gettimeofday(&t, 0); - - return jlong_add(jlong_mul(jint_to_jlong(t.tv_sec), jint_to_jlong(1000)), - jint_to_jlong(t.tv_usec / 1000)); -} - -static int32_t -xtError() -{ -#ifdef DEBUG - JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - - jio_fprintf(stderr, "Xt error\n"); - JNU_ThrowNullPointerException(env, "NullPointerException"); -#endif - return 0; -} - -static int32_t -xIOError(Display *dpy) -{ - JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - jclass cl = (*env)->FindClass(env, "java/lang/Thread"); - - if (errno == EPIPE) { - jio_fprintf(stderr, "X connection to %s host broken (explicit kill or server shutdown)\n", XDisplayName(NULL)); - } - AWT_NOFLUSH_UNLOCK(); - JVM_RaiseSignal(JVM_SIGTERM); /* Shut down cleanly */ - if (cl != NULL) { - JVM_Sleep(env, cl, 20000); - } - - 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 -keysym_to_keycode_if_primary(Display *dpy, KeySym sym) -{ - KeyCode code; - KeySym primary; - - code = XKeysymToKeycode(dpy, sym); - if (code == 0) { - return 0; - } - - primary = XKeycodeToKeysym(dpy, code, 0); - if (sym == primary) { - return code; - } else { - return 0; - } -} -/* - * +kb or -kb ? - */ -static Boolean -isXKBenabled(Display *display) { - int mop, beve, berr; - /* - * NB: TODO: hope it will return False if XkbIgnoreExtension was called! - */ - return XQueryExtension(display, "XKEYBOARD", &mop, &beve, &berr); -} - - -/* Assign meaning - alt, meta, etc. - to X modifiers mod1 ... mod5. - * Only consider primary symbols on keycodes attached to modifiers. - */ -static void -setup_modifier_map(Display *disp) -{ - KeyCode metaL = keysym_to_keycode_if_primary(disp, XK_Meta_L); - KeyCode metaR = keysym_to_keycode_if_primary(disp, XK_Meta_R); - KeyCode altL = keysym_to_keycode_if_primary(disp, XK_Alt_L); - KeyCode altR = keysym_to_keycode_if_primary(disp, XK_Alt_R); - KeyCode numLock = keysym_to_keycode_if_primary(disp, XK_Num_Lock); - KeyCode modeSwitch = keysym_to_keycode_if_primary(disp, XK_Mode_switch); - KeyCode shiftLock = keysym_to_keycode_if_primary(disp, XK_Shift_Lock); - KeyCode capsLock = keysym_to_keycode_if_primary(disp, XK_Caps_Lock); - - XModifierKeymap *modmap = NULL; - int32_t nkeys, modn, i; - char *ptr = NULL; - - DTRACE_PRINTLN("In setup_modifier_map"); - - modmap = XGetModifierMapping(disp); - nkeys = modmap->max_keypermod; - - for (modn = Mod1MapIndex; - (modn <= Mod5MapIndex) && - (awt_MetaMask == 0 || awt_AltMask == 0 || - awt_NumLockMask == 0 || awt_ModeSwitchMask == 0); - ++modn) - { - static const uint32_t modmask[8] = { - ShiftMask, LockMask, ControlMask, - Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask - }; - - - for (i = 0; i < nkeys; ++i) { - /* for each keycode attached to this modifier */ - KeyCode keycode = modmap->modifiermap[modn * nkeys + i]; - if (keycode == 0) { - continue; - } - - if (awt_MetaMask == 0 && (keycode == metaL || keycode == metaR)) { - awt_MetaMask = modmask[modn]; - DTRACE_PRINTLN2(" awt_MetaMask = %d, modn = %d", awt_MetaMask, modn); - break; - } else if (awt_AltMask == 0 && (keycode == altL || keycode == altR)) { - awt_AltMask = modmask[modn]; - DTRACE_PRINTLN2(" awt_AltMask = %d, modn = %d", awt_AltMask, modn); - break; - } else if (awt_NumLockMask == 0 && keycode == numLock) { - awt_NumLockMask = modmask[modn]; - DTRACE_PRINTLN2(" awt_NumLockMask = %d, modn = %d", awt_NumLockMask, modn); - break; - } else if (awt_ModeSwitchMask == 0 && keycode == modeSwitch) { - awt_ModeSwitchMask = modmask[modn]; - DTRACE_PRINTLN2(" awt_ModeSwitchMask = %d, modn = %d", awt_ModeSwitchMask, modn); - break; - } - } - } - for(i = 0; i < nkeys; i++) { - KeyCode keycode = modmap->modifiermap[LockMapIndex * nkeys + i]; - if (keycode == 0) { - break; - } - if (keycode == shiftLock) { - awt_ModLockIsShiftLock = True; - break; - } - if (keycode == capsLock) { - break; - } - } - - DTRACE_PRINTLN1(" ShiftMask = %d", ShiftMask); - DTRACE_PRINTLN1(" ControlMask = %d", ControlMask); - - XFreeModifiermap(modmap); - ptr = getenv("_AWT_USE_TYPE4_PATCH"); - if( ptr != NULL && ptr[0] != 0 ) { - if( strncmp("true", ptr, 4) == 0 ) { - awt_UseType4Patch = True; - }else if( strncmp("false", ptr, 5) == 0 ) { - awt_UseType4Patch = False; - } - } - awt_UseXKB = isXKBenabled(disp); - -} - - -Boolean scrollBugWorkAround; - - -void -awt_output_flush() -{ - char c = 'p'; - - if (awt_next_flush_time == 0) - { - Boolean needsWakeup = False; - JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - if (awt_pipe_inited && (awt_get_poll_timeout(False) > (2*AWT_FLUSH_TIMEOUT))){ - needsWakeup = True; - } - /* awt_next_flush_time affects awt_get_poll_timeout(), so set - * the variable *after* calling the function. - */ - awt_next_flush_time = awtJNI_TimeMillis() + AWT_FLUSH_TIMEOUT; - if (needsWakeup) - { - /* write to the utility pipe to wake up the event - * loop, if it's sleeping - */ - write ( AWT_WRITEPIPE, &c, 1 ); - } - } -#ifdef FLUSHDEBUG -else -jio_fprintf(stderr, "!"); -#endif -} /* awt_output_flush() */ - -void -null_event_handler(Widget w, XtPointer client_data, - XEvent * event, Boolean * cont) -{ - /* do nothing */ -} - -struct WidgetInfo * -findWidgetInfo(Widget widget) -{ - struct WidgetInfo *cw; - - for (cw = awt_winfo; cw != NULL; cw = cw->next) { - if (cw->widget == widget || cw->origin == widget) { - return cw; - } - } - return NULL; -} - -void -awt_addWidget(Widget w, Widget origin, void *peer, jlong event_flags) -{ - if (findWidgetInfo(w) != NULL) return; - - if (!XtIsSubclass(w, xmFileSelectionBoxWidgetClass)) { - struct WidgetInfo *nw = (struct WidgetInfo *) malloc(sizeof(struct WidgetInfo)); - - if (nw) { - nw->widget = w; - nw->origin = origin; - nw->peer = peer; - nw->event_mask = event_flags; - nw->next = awt_winfo; - awt_winfo = nw; - - if (event_flags & java_awt_AWTEvent_MOUSE_EVENT_MASK) { - XtAddEventHandler(w, - ButtonPressMask | ButtonReleaseMask | - EnterWindowMask | LeaveWindowMask, - False, null_event_handler, NULL); - if (w != origin) { - XtAddEventHandler(origin, - ButtonPressMask | ButtonReleaseMask | - EnterWindowMask | LeaveWindowMask, - False, null_event_handler, NULL); - } - } - if (event_flags & java_awt_AWTEvent_MOUSE_MOTION_EVENT_MASK) { - XtAddEventHandler(w, - PointerMotionMask, - False, null_event_handler, NULL); - if (w != origin) { - XtAddEventHandler(origin, - PointerMotionMask, - False, null_event_handler, NULL); - } - } - if (event_flags & java_awt_AWTEvent_KEY_EVENT_MASK) { - XtAddEventHandler(w, - KeyPressMask | KeyReleaseMask, - False, null_event_handler, NULL); - if (w != origin) { - XtAddEventHandler(origin, - KeyPressMask | KeyReleaseMask, - False, null_event_handler, NULL); - } - } - } else { - JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError"); - } - - } -} - -void -awt_delWidget(Widget w) -{ - struct WidgetInfo *cw; - - if (awt_winfo != NULL) { - if ((awt_winfo->widget == w) || - (awt_winfo->origin == w)) { - cw = awt_winfo; - awt_winfo = awt_winfo->next; - free((void *) cw); - } else { - struct WidgetInfo *pw; - - for (pw = awt_winfo, cw = awt_winfo->next; - cw != NULL; - pw = cw, cw = cw->next) { - if ((cw->widget == w) || - (cw->origin == w)) { - pw->next = cw->next; - free((void *) cw); - break; - } - } - } - } -} - - -void * -findPeer(Widget * pwidget) -{ - struct WidgetInfo *cw; - Widget widgetParent; - void * peer; - - if ((cw = findWidgetInfo(*pwidget)) != NULL) { - return cw->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 */ - widgetParent = XtParent(*pwidget); - if (widgetParent != NULL ) { - peer = findPeer(&widgetParent); - if( peer != NULL ) { - /* found peer attached to ancestor of given - widget, so set widget return value as well */ - *pwidget = widgetParent; - return peer; - } - } - - return NULL; -} - -Boolean -awt_isAwtWidget(Widget widget) -{ - return (findWidgetInfo(widget) != NULL); -} - - -static Boolean -awt_isAwtMenuWidget(Widget wdgt) { - struct MenuList* cur; - - if (!XtIsSubclass(wdgt, xmRowColumnWidgetClass)) { - return False; - } - for (cur = menu_list; cur != NULL; cur = cur->next) { - if (cur->menu == wdgt) { - return True; - } - } - return False; -} - -void -awt_addMenuWidget(Widget wdgt) { - DASSERT(XtIsSubclass(wdgt, xmRowColumnWidgetClass)); - - if (!awt_isAwtMenuWidget(wdgt)) { - struct MenuList* ml = (struct MenuList*) malloc(sizeof(struct MenuList)); - if (ml != NULL) { - ml->menu = wdgt; - ml->next = menu_list; - menu_list = ml; - } else { - JNIEnv* env = (JNIEnv*)JNU_GetEnv(jvm, JNI_VERSION_1_2); - JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError"); - } - } -} - -void -awt_delMenuWidget(Widget wdgt) { - struct MenuList** pp; - struct MenuList* p; - - DASSERT(XtIsSubclass(wdgt, xmRowColumnWidgetClass)); - - for (pp = &menu_list; *pp != NULL; pp = &((*pp)->next)) { - if ((*pp)->menu == wdgt) { - p = *pp; - *pp = (*pp)->next; - free((void*)p); - break; - } - } -} - - -static Widget -getShellWidgetByPart(Widget part) { - int i; - for (i = 0; i < 3; i++) { - if (part == NULL) return NULL; - if (XtIsShell(part)) return part; - part = XtParent(part); - } - return NULL; -} - -static Boolean -isTheSameShellWidget(Widget shell, Widget w) { - Widget s1, s2; - if (shell == NULL || w == NULL) return False; - s1 = getShellWidgetByPart(shell); - s2 = getShellWidgetByPart(w); - if (s1 == s2 && s1 != NULL) { - return True; - } else { - return False; - } -} - -static Boolean -shouldDispatchToWidget(XEvent * xev) -{ - /* 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 */ - - Window win; - Widget widget = NULL; - struct WidgetInfo *winfo; - void *peer = NULL; - Boolean cont = FALSE; - - switch (xev->type) { - case KeyPress: - case KeyRelease: - win = xev->xkey.window; - break; - case FocusIn: - case FocusOut: - win = xev->xfocus.window; - break; - case ButtonPress: - case ButtonRelease: - win = xev->xbutton.window; - break; - case MotionNotify: - win = xev->xmotion.window; - break; - case EnterNotify: - case LeaveNotify: - win = xev->xcrossing.window; - break; - default: - return False; - } - - if ((widget = XtWindowToWidget(awt_display, win)) == NULL) { - return False; - } - - if (xev->type == KeyPress || xev->type == KeyRelease) { - Widget focusWidget = XmGetFocusWidget(widget); - - /* 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 */ - - if ((focusWidget == NULL) && XmIsMenuShell(widget)) { - if ((widget = XtParent(widget)) != NULL) { - focusWidget = XmGetFocusWidget(widget); - } else { - return False; - } - - /* In this case, focus widget should be CascadeButtonGadget type, - but we should send the events to its parent */ - if (focusWidget != NULL && XmIsCascadeButtonGadget(focusWidget)) { - widget = XtParent(focusWidget); - } else { - /* If something went wrong, restore the original status */ - widget = XtWindowToWidget(awt_display, win); - } - } - - /* if focus owner is null, redirect key events to focused window */ - if (focusWidget == NULL && findWidgetInfo(widget) == NULL) { - focusWidget = findTopLevelByShell(widget); - } - - /* If we are on a non-choice widget, process events in a normal way */ - if ((focusWidget != NULL) && (focusWidget != widget)) { - if (isTheSameShellWidget(focusWidget, widget)) { - focusWidget = findTopLevelByShell(widget); - } - if (focusWidget != NULL) { - peer = findPeer(&focusWidget); - } - if (peer != NULL) { - widget = focusWidget; - win = xev->xkey.window = XtWindow(focusWidget); - } - } - } - - if ((winfo = findWidgetInfo(widget)) == 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. - * Before this fix, the fact that mouse/button events were - * 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()) { - Widget focusWidget = XmGetFocusWidget(widget); - - 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. - */ - if (!XmIsRowColumn(widget) || !XmIsCascadeButtonGadget(focusWidget)) { - /* 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. - */ - - if ((drag_source != NULL) && (widget != drag_source) && - (peer = findPeer(&drag_source))) { - awt_canvas_handleEvent(drag_source, peer, xev, winfo, &cont, TRUE); - } - 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. */ - - switch (xev->type) { - case KeyPress: - case KeyRelease: - if (!(winfo->event_mask & java_awt_AWTEvent_KEY_EVENT_MASK)) - return False; - break; - case FocusIn: - case FocusOut: - if (!(winfo->event_mask & java_awt_AWTEvent_FOCUS_EVENT_MASK)) - return False; - break; - case ButtonPress: - case ButtonRelease: - if (!(winfo->event_mask & java_awt_AWTEvent_MOUSE_EVENT_MASK)) { - return False; - } - break; - case EnterNotify: - case LeaveNotify: - /* - * Do not post the enter/leave event if it's on a subwidget - * within the component. - */ - if (!(winfo->event_mask & java_awt_AWTEvent_MOUSE_EVENT_MASK) || - widget != winfo->origin) - return False; - break; - case MotionNotify: - if (!(winfo->event_mask & java_awt_AWTEvent_MOUSE_MOTION_EVENT_MASK)) - return False; - break; - default: - return False; - } - - peer = winfo->peer; - - /* 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. */ - if (peer == NULL) { - return False; - } - - /* - * Fix for bug 4173714 - java.awt.button behaves differently under - * Win32/Solaris. - * Component should not get any events when it's disabled. - */ - if (!XtIsSensitive(widget)) { - if (xev->type == EnterNotify) { - updateCursor(peer, CACHE_UPDATE); - } - return False; - } - - awt_canvas_handleEvent(widget, peer, xev, winfo, &cont, TRUE); - return (!cont); -} /* shouldDispatchToWidget() */ - - -void set_toolkit_busy(Boolean busy) { - - JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - - static jclass awtAutoShutdownClass = NULL; - static jmethodID notifyBusyMethodID = NULL; - static jmethodID notifyFreeMethodID = NULL; - - if (awtAutoShutdownClass == NULL) { - jclass awtAutoShutdownClassLocal = (*env)->FindClass(env, "sun/awt/AWTAutoShutdown"); - if ((*env)->ExceptionOccurred(env)) { - (*env)->ExceptionDescribe(env); - (*env)->ExceptionClear(env); - } - DASSERT(awtAutoShutdownClassLocal != NULL); - if (awtAutoShutdownClassLocal == NULL) { - return; - } - - awtAutoShutdownClass = (jclass)(*env)->NewGlobalRef(env, awtAutoShutdownClassLocal); - (*env)->DeleteLocalRef(env, awtAutoShutdownClassLocal); - - notifyBusyMethodID = (*env)->GetStaticMethodID(env, awtAutoShutdownClass, - "notifyToolkitThreadBusy", "()V"); - if ((*env)->ExceptionOccurred(env)) { - (*env)->ExceptionDescribe(env); - (*env)->ExceptionClear(env); - } - notifyFreeMethodID = (*env)->GetStaticMethodID(env, awtAutoShutdownClass, - "notifyToolkitThreadFree", "()V"); - if ((*env)->ExceptionOccurred(env)) { - (*env)->ExceptionDescribe(env); - (*env)->ExceptionClear(env); - } - DASSERT(notifyBusyMethodID != NULL); - DASSERT(notifyFreeMethodID != NULL); - if (notifyBusyMethodID == NULL || notifyFreeMethodID == NULL) { - return; - } - } /* awtAutoShutdownClass == NULL*/ - - if (busy) { - (*env)->CallStaticVoidMethod(env, awtAutoShutdownClass, - notifyBusyMethodID); - } else { - (*env)->CallStaticVoidMethod(env, awtAutoShutdownClass, - notifyFreeMethodID); - } - - if ((*env)->ExceptionOccurred(env)) { - (*env)->ExceptionDescribe(env); - (*env)->ExceptionClear(env); - } -} - -#ifdef DEBUG -static int32_t debugPrintLineCount = 0; /* limit debug output per line */ -#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 - * make ensure that the X/Xt libraries are not entered by - * 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 */ - int32_t numEventsHandled = 0; -/* #endif */ -static void -awt_MToolkit_loop(JNIEnv *env) -{ - XtInputMask iMask; - int32_t fdXPipe = -1; /* pipe where X events arrive */ - - /* only privileged thread should be running here */ - DASSERT(awt_currentThreadIsPrivileged(env)); - - /* The pipe where X events arrive */ - fdXPipe = ConnectionNumber(awt_display) ; - - /* 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() */ - 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 - */ - AWT_FLUSHOUTPUT_NOW(); - - /* - * ACTUALLY PROCESS EVENTS - */ - while(True) { - - /* process all events in the queue */ -/* #ifdef DEBUG */ -/* numEventsHandled = 0; */ -/* #endif */ - while (((iMask = awt_events_pending(awt_appContext)) & XtIMAll) > 0) { - -/* #ifdef DEBUG */ - ++numEventsHandled; -/* #endif */ - processOneEvent(iMask); - - } /* end while awt_events_pending() */ - /* At this point, we have exhausted the event queue */ - - /* print the number of events handled in parens */ - DTRACE_PRINT1("(%d events)",(int32_t)numEventsHandled); -#ifdef DEBUG - if (++debugPrintLineCount > 8) { - DTRACE_PRINTLN(""); - debugPrintLineCount = 0; - } -#endif - - AWT_NOTIFY_ALL(); /* wake up modalWait() */ - - set_toolkit_busy(False); - - /* Here, we wait for X events, outside of the X libs. When - * it's likely that an event is waiting, we process the queue - */ - waitForEvents(env, fdXPipe, AWT_READPIPE); - - set_toolkit_busy(True); - - } /* 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. - */ - int32_t flags = 0; - awt_set_poll_timeout (def_poll_timeout); - /* set the pipe to be non-blocking */ - flags = fcntl ( AWT_READPIPE, F_GETFL, 0 ); - fcntl( AWT_READPIPE, F_SETFL, flags | O_NDELAY | O_NONBLOCK ); - flags = fcntl ( AWT_WRITEPIPE, F_GETFL, 0 ); - fcntl( AWT_WRITEPIPE, F_SETFL, flags | O_NDELAY | O_NONBLOCK ); - awt_pipe_inited = True; - } - else - { - AWT_READPIPE = -1; - AWT_WRITEPIPE = -1; - awt_pipe_inited = False; - } -} /* awt_pipe_init() */ - -static Window -proxyTopLevel(Window proxyWindow) { - Window parent = None, root = None, *children = NULL, retvalue = None; - uint32_t nchildren = 0; - Status res = XQueryTree(awt_display, proxyWindow, &root, &parent, - &children, &nchildren); - if (res != 0) { - if (nchildren > 0) { - retvalue = children[0]; - } - else retvalue = None; - if (children != NULL) { - XFree(children); - } - return retvalue; - } else { - return None; - } -} - -static jclass clazzF, clazzD = NULL; - -static Boolean -initClazzD(JNIEnv *env) { - jclass t_clazzD = (*env)->FindClass(env, "java/awt/Dialog"); - if ((*env)->ExceptionOccurred(env)) { - (*env)->ExceptionDescribe(env); - (*env)->ExceptionClear(env); - } - DASSERT(t_clazzD != NULL); - if (t_clazzD == NULL) { - return False; - } - clazzD = (*env)->NewGlobalRef(env, t_clazzD); - DASSERT(clazzD != NULL); - (*env)->DeleteLocalRef(env, t_clazzD); - return True; -} - -Boolean -isFrameOrDialog(jobject target, JNIEnv *env) { - if ((*env)->EnsureLocalCapacity(env, 1) < 0) { - return False; - } - - if (clazzF == NULL) { - jclass t_clazzF = (*env)->FindClass(env, "java/awt/Frame"); - if ((*env)->ExceptionOccurred(env)) { - (*env)->ExceptionDescribe(env); - (*env)->ExceptionClear(env); - } - DASSERT(t_clazzF != NULL); - if (t_clazzF == NULL) { - return False; - } - clazzF = (*env)->NewGlobalRef(env, t_clazzF); - DASSERT(clazzF != NULL); - (*env)->DeleteLocalRef(env, t_clazzF); - } - - if (clazzD == NULL && !initClazzD(env)) { - return False; - } - - return (*env)->IsInstanceOf(env, target, clazzF) || - (*env)->IsInstanceOf(env, target, clazzD); -} - -Boolean -isDialog(jobject target, JNIEnv *env) { - if (clazzD == NULL && !initClazzD(env)) { - return False; - } - return (*env)->IsInstanceOf(env, target, clazzD); -} - -// 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. -jobject -getOwningFrameOrDialog(jobject target, JNIEnv *env) { - jobject _target = (*env)->NewLocalRef(env, target); - jobject parent = _target; - Boolean isSelfFrameOrDialog = True; - - while (!isFrameOrDialog(parent, env)) { - isSelfFrameOrDialog = False; - parent = (*env)->CallObjectMethod(env, _target, componentIDs.getParent); - (*env)->DeleteLocalRef(env, _target); - _target = parent; - } - - if (isSelfFrameOrDialog) { - (*env)->DeleteLocalRef(env, parent); - return NULL; - } - return parent; -} - -Widget -findWindowsProxy(jobject window, JNIEnv *env) { - struct ComponentData *cdata; - jobject tlPeer; - jobject owner_prev = NULL, owner_new = NULL; - /* 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 */ - if ((*env)->EnsureLocalCapacity(env, 4) < 0) { - return NULL; - } - - if (window == NULL) return NULL; - - owner_prev = (*env)->NewLocalRef(env, window); - while (!JNU_IsNull(env, owner_prev) && !(isFrameOrDialog(owner_prev, env))) { - owner_new = (*env)->CallObjectMethod(env, owner_prev, componentIDs.getParent); - (*env)->DeleteLocalRef(env, owner_prev); - owner_prev = owner_new; - } - - if (owner_prev == NULL) return NULL; - - tlPeer = (*env)->GetObjectField(env, owner_prev, componentIDs.peer); - (*env)->DeleteLocalRef(env, owner_prev); - if (tlPeer == NULL) return NULL; - - cdata = (struct ComponentData *) - JNU_GetLongFieldAsPtr(env, tlPeer, mComponentPeerIDs.pData); - (*env)->DeleteLocalRef(env, tlPeer); - - if (cdata == NULL) return NULL; - return(findFocusProxy(cdata->widget)); -} - -jobject -findTopLevel(jobject peer, JNIEnv *env) { - jobject target_prev = NULL; - static jclass clazzW = NULL; - - if ((*env)->EnsureLocalCapacity(env, 3) < 0) { - return NULL; - } - - if (clazzW == NULL) { - jclass t_clazzW = (*env)->FindClass(env, "java/awt/Window"); - if ((*env)->ExceptionOccurred(env)) { - (*env)->ExceptionDescribe(env); - (*env)->ExceptionClear(env); - } - DASSERT(t_clazzW != NULL); - if (t_clazzW == NULL) { - return NULL; - } - clazzW = (*env)->NewGlobalRef(env, t_clazzW); - DASSERT(clazzW != NULL); - (*env)->DeleteLocalRef(env, t_clazzW); - } - target_prev = (*env)->GetObjectField(env, peer, mComponentPeerIDs.target); - if (target_prev == NULL) { - return NULL; - } - - while ((target_prev != NULL) - && !(*env)->IsInstanceOf(env, target_prev, clazzW) ) - { - /* go up the hierarchy until we find a window */ - jobject target_new = (*env)->CallObjectMethod(env, target_prev, componentIDs.getParent); - (*env)->DeleteLocalRef(env, target_prev); - target_prev = target_new; - } - return target_prev; -} - -static Window -rootWindow(Window w) { - Window root = None; - Window parent = None; - Window *children = NULL; - uint32_t nchildren = 0; - - if (w != None) { - Status res = XQueryTree(awt_display, w, &root, &parent, &children, &nchildren); - if (res == 0) { - return None; - } - if (children != NULL) { - XFree(children); - } - return root; - } else { - return None; - } -} - -Boolean IsRootOf(Window root, Window child) { - Window w_root = None, w_parent = None, * children = NULL; - uint32_t c_count = 0; - if (root == None || child == None) { - return False; - } - do { - w_root = None; - w_parent = None; - children = NULL; - c_count = 0; - if (XQueryTree(awt_display, child, &w_root, &w_parent, - &children, &c_count)) { - if (children != NULL) { - XFree(children); - } - if (w_parent == None) { - return False; - } - if (w_parent == root) { - return True; - } - } else { - return False; - } - child = w_parent; - } while (True); -} - -Window findShellByProxy(Window proxy) { - Widget proxy_wid = XtWindowToWidget(awt_display, proxy); - while (proxy_wid != NULL && !XtIsShell(proxy_wid)) { - proxy_wid = XtParent(proxy_wid); - } - if (proxy_wid == NULL) { - return None; - } - return XtWindow(proxy_wid); -} - -// Window which contains focus owner when focus proxy is enabled -Window trueFocusWindow = None; -// Window which works as proxy for input events for real focus owner. -Window focusProxyWindow = None; - -void clearFocusPathOnWindow(Window win) { - if (focusProxyWindow != None && IsRootOf(win, trueFocusWindow)) { - XEvent ev; - memset(&ev, 0, sizeof(ev)); - ev.type = FocusOut; - ev.xany.send_event = True; - ev.xany.display = awt_display; - ev.xfocus.mode = NotifyNormal; - ev.xfocus.detail = NotifyNonlinear; - { - Window root = rootWindow(trueFocusWindow); - JNIEnv *env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2); - ev.xfocus.window = trueFocusWindow; - while (ev.xfocus.window != root && - ev.xfocus.window != None) { - Widget w = XtWindowToWidget(awt_display, - ev.xfocus.window); - awt_put_back_event(env, &ev); - if (w == NULL) { - break; - } - if (XtParent(w) != NULL) { - ev.xfocus.window = XtWindow(XtParent(w)); - } else { - ev.xfocus.window = None; - } - } - } - XSetInputFocus(awt_display, findShellByProxy(focusProxyWindow), RevertToPointerRoot, CurrentTime); - trueFocusWindow = None; - focusProxyWindow = None; - } -} -void clearFocusPath(Widget shell) { - Window w = None; - if (shell == NULL) { - return; - } - w = XtWindow(shell); - clearFocusPathOnWindow(w); -} - -void globalClearFocusPath(Widget focusOwnerShell ) { - if (focusProxyWindow != None) { - Window shellWindow = findShellByProxy(trueFocusWindow); - if (shellWindow != None) { - Widget shell = XtWindowToWidget(awt_display, shellWindow); - if (shell != NULL && shell != focusOwnerShell) { - clearFocusPath(shell); - } - } - } -} - -static void -focusEventForProxy(XEvent xev, - JNIEnv *env, - Window *trueFocusWindow, - Window *focusProxyWindow) { - - DASSERT (trueFocusWindow != NULL && focusProxyWindow != NULL); - if (xev.type == FocusOut) { - if (xev.xfocus.window == *focusProxyWindow) { - if (*trueFocusWindow != None) { - Window root = rootWindow(*trueFocusWindow); - focusOutEvent.xfocus.window = *trueFocusWindow; -#ifdef DEBUG_FOCUS - printf(" nulling out proxy; putting back event" - "\n"); -#endif - - while (focusOutEvent.xfocus.window != root && - focusOutEvent.xfocus.window != None) { - Widget w = XtWindowToWidget(awt_display, - focusOutEvent.xfocus.window); - awt_put_back_event(env, &focusOutEvent); - if (w != NULL && XtParent(w) != NULL) { - focusOutEvent.xfocus.window = XtWindow(XtParent(w)); - } else { - focusOutEvent.xfocus.window = None; - } - } - *trueFocusWindow = None; - *focusProxyWindow = None; - return; - } else { -#ifdef DEBUG_FOCUS - printf("\n"); -#endif - return; - } - } else { -#ifdef DEBUG_FOCUS - printf("\n"); -#endif - return; - } - } -} - -static void -focusEventForFrame(XEvent xev, Window focusProxyWindow) { - if (xev.type == FocusIn) { - if (focusProxyWindow != None) { - /* eat it */ - return; - } else /* FocusIn on Frame or Dialog */ { - XtDispatchEvent(&xev); - } - } else /* FocusOut on Frame or Dialog */{ - XtDispatchEvent(&xev); - } -} - -static void -focusEventForWindow(XEvent xev, JNIEnv *env, Window *trueFocusWindow, - Window *focusProxyWindow, jobject target) { - XEvent pev; - if (xev.type == FocusIn && xev.xfocus.mode == NotifyNormal) { - /* If it's a FocusIn, allow it to process, then set - focus to focus proxy */ - Widget focusProxy; - focusProxy = findWindowsProxy(target, env); - if (focusProxy != NULL) { - XtDispatchEvent(&xev); - *focusProxyWindow = XtWindow(focusProxy); - - XSetInputFocus(awt_display, *focusProxyWindow, - RevertToParent, - CurrentTime); - - XPeekEvent(awt_display, &pev); - while (pev.type == FocusIn) { - XNextEvent(awt_display, &xev); - XPeekEvent(awt_display, &pev); - } - *trueFocusWindow = xev.xany.window; - - } /* otherwise error */ - } else /* FocusOut */ { - /* If it's a FocusOut on a Window, discard it unless - it's an event generated by us. */ - if (xev.xany.send_event) { - XtDispatchEvent(&xev); - } - } -} - -Boolean -isAncestor(Window ancestor, Window child) { - Window *children; - uint32_t nchildren; - Boolean retvalue = False; - - while (child != ancestor) { - Window parent, root; - Status status; - - status = XQueryTree(awt_display, child, &root, &parent, - &children, &nchildren); - if (status == 0) return False; /* should be an error of some sort? */ - - if (parent == root) { - if (child != ancestor) { - retvalue = False; - break; - } else { - retvalue = True; - break; - } - } - if (parent == ancestor) { retvalue = True; break; } - if (nchildren > 0) XFree(children); - child = parent; - } - if (nchildren > 0) XFree(children); - return retvalue; -} - -/** - * Returns focusability of the corresponding Java Window object - */ -Boolean -isFocusableWindow(Window w) { - Widget wid = NULL; - JNIEnv *env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2); - - wid = XtWindowToWidget(awt_display, w); - while (wid != NULL && !XtIsShell(wid)) { - wid = XtParent(wid); - } - - // If the window doesn't have shell consider it focusable as all windows - // are focusable by default - if (wid == NULL) return True; - - return isFocusableWindowByShell(env, wid); -} - -void postUngrabEvent(Widget shell) { - JNIEnv *env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2); - Widget canvas = findTopLevelByShell(shell); - if (canvas != NULL) { - jobject peer = findPeer(&canvas); - if (peer != NULL) { - JNU_CallMethodByName(env, NULL, peer, "postUngrabEvent", "()V", NULL); - } - } -} - -Boolean eventInsideGrabbed(XEvent * ev) { - if (grabbed_widget == NULL) { - return False; - } - - switch (ev->xany.type) { - case LeaveNotify: - case ButtonPress: - case ButtonRelease: - case MotionNotify: - case EnterNotify: - { - JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - Widget grab = findTopLevelByShell(grabbed_widget); - if (grab != NULL) { - jobject peer = findPeer(&grab); - Widget target = XtWindowToWidget(awt_display, ev->xbutton.window); - jobject targetPeer = findPeer(&target); - if (peer != NULL) { - return JNU_CallMethodByName(env, NULL, peer, "processUngrabMouseEvent", "(Lsun/awt/motif/MComponentPeer;III)Z", - targetPeer, ev->xbutton.x_root, ev->xbutton.y_root, - ev->xany.type, NULL).z; - } - } - return False; - } - case FocusOut: - if (ev->xfocus.window == XtWindow(grabbed_widget) || - isAncestor(XtWindow(grabbed_widget), ev->xfocus.window)) - { - postUngrabEvent(grabbed_widget); - return True; - } - default: - return True; - } -} - -/** - * Processes and removes one X/Xt event from the Xt event queue. - * Handles events pushed back via awt_put_back_event() FIRST, - * then new events on the X queue - */ -static void -processOneEvent(XtInputMask iMask) { - XEvent xev; - Boolean haveEvent = False; - if (putbackQueueCount > 0) { - // There is a pushed-back event - handle it first - if (awt_get_next_put_back_event(&xev) == 0) { - if (xev.xany.send_event != SPECIAL_KEY_EVENT) { -#ifdef DEBUG_FOCUS - if (xev.type == FocusOut) { - printf("putback FocusOut on window %d, mode %d, " - "detail %d, send_event %d\n", - xev.xfocus.window, xev.xfocus.mode, - xev.xfocus.detail, xev.xfocus.send_event); - } -#endif - eventNumber++; - XtDispatchEvent(&xev); - return; - } else { - haveEvent = True; - } - } - } - - if (haveEvent || XtAppPeekEvent(awt_appContext, &xev)) { - /* - * 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. - */ - Widget widget=XtWindowToWidget(awt_display, xev.xany.window); - eventNumber++; -#ifdef __linux__ - statusWindowEventHandler(xev); -#endif - xembed_eventHandler(&xev); - xembed_serverEventHandler(&xev); - syncWait_eventHandler(&xev); - - if (!haveEvent && awt_dnd_process_event(&xev)) { - return; - } - - if ((widget == NULL) || (!XtIsObject(widget)) || - (widget->core.being_destroyed)) { - /* - * 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 - */ - XNextEvent(awt_display, &xev); - - if (widget == NULL) { - /* 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. - */ - (void) XFilterEvent(&xev, NULL); - return; - } - - /* There is an X event on the queue. */ - switch (xev.type) { - 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. - */ - if ((xev.type == ButtonPress || - xev.type == ButtonRelease || - (xev.type == MotionNotify && - (xev.xmotion.state == Button1Mask || - xev.xmotion.state == Button2Mask || - xev.xmotion.state == Button3Mask))) && - (XtIsSubclass(widget, xmScrollBarWidgetClass))) { - /* 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. - */ - XNextEvent(awt_display, &xev); - - XtDispatchEvent(&xev); - XSync(awt_display, False); - - // This is the event on scrollbar. Key, Motion, - // Enter/Leave dispatch as usual, Button should - // generate Ungrab after Java mouse event - if (xev.type == ButtonPress && grabbed_widget != NULL) { - eventInsideGrabbed(&xev); - } - } - else { - if (!haveEvent) XtAppNextEvent(awt_appContext, &xev); - - // This is an event on one of our widgets. Key, - // Motion, Enter/Leave dispatch as usual, Button - // should generate Ungrab after Java mouse event -/* if (grabbed_widget != NULL && !eventInsideGrabbed(&xev)) { */ -/* return; */ -/* } */ - - if (xev.type == ButtonPress) { - Window window = findShellByProxy(xev.xbutton.window); - if (window != None) { - XWindowAttributes winAttr; - memset(&winAttr, 0, sizeof(XWindowAttributes)); - XGetWindowAttributes(awt_display, window, &winAttr); - if (winAttr.override_redirect == TRUE && isFocusableWindow(window)) { - XSetInputFocus(awt_display, window, RevertToPointerRoot, CurrentTime); - } - } - } - if(xev.type == KeyPress) { -#ifdef DEBUG_FOCUS - printf("KeyPress on window %d\n", xev.xany.window); -#endif - } - - /* this could be moved to shouldDispatchToWidget */ - /* if there is a proxy in effect, dispatch key events - through the proxy */ - if ((xev.type == KeyPress || xev.type == KeyRelease) && - !keyboardGrabbed && !haveEvent) { - if (focusProxyWindow != None) { - Widget widget; - struct WidgetInfo *winfo; - Boolean cont; - /* Key event should be posted to the top-level - widget of the proxy */ - xev.xany.window = proxyTopLevel(focusProxyWindow); - widget = XtWindowToWidget(awt_display, - xev.xany.window); - if (widget == NULL) return; - if ((winfo = findWidgetInfo(widget)) == NULL) { - return; - } - awt_canvas_handleEvent(widget, winfo->peer, &xev, - winfo, &cont, TRUE); - return; - } - } - if (!shouldDispatchToWidget(&xev)) { - XtDispatchEvent(&xev); - } - - // See comment above - "after time" is here. - if (grabbed_widget != NULL && xev.type == ButtonPress) { - eventInsideGrabbed(&xev); - } - } - - - break; - - case FocusIn: - case FocusOut: { - void *peer; - jobject target; - - JNIEnv *env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2); - -#ifdef DEBUG_FOCUS - if (xev.type == FocusIn) { - - fprintf(stderr, "FocusIn on window %x, mode %d, detail %d, " - "send_event %d\n", xev.xfocus.window, - xev.xfocus.mode, xev.xfocus.detail, - xev.xfocus.send_event); - } else { - fprintf(stderr, "FocusOut on window %x, mode %d, detail %d, " - "send_event %d\n", xev.xfocus.window, - xev.xfocus.mode, xev.xfocus.detail, - xev.xfocus.send_event); - } -#endif - XtAppNextEvent(awt_appContext, &xev); - - if (xev.xfocus.detail == NotifyVirtual || - xev.xfocus.detail == NotifyNonlinearVirtual) { -#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 - if (isXEmbedActiveByWindow(xev.xfocus.window) && !xev.xfocus.send_event) { - 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)) { - if (xev.type == FocusIn && - xev.xfocus.mode == NotifyGrab) { - extern Boolean poppingDown; - if (!poppingDown) { - keyboardGrabbed = True; - } - } else /* FocusOut */ { - if (xev.type == FocusOut && - xev.xfocus.mode == NotifyUngrab) { - keyboardGrabbed = False; - } - } - } - - if (focusProxyWindow != None) { -#ifdef DEBUG_FOCUS - printf("non-null proxy; proxy = %d ", focusProxyWindow); -#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 */ - focusEventForProxy(xev, env, &trueFocusWindow, - &focusProxyWindow); - return; - } else { - /* beartrap -- remove before shipping */ - /* printf("trueFocusWindow None in processOneEvent;\n"); */ - /* printf("Please file a bug\n"); */ - } - } - - peer = findPeer(&widget); - if (peer == NULL) { -#ifdef DEBUG_FOCUS - printf("null peer -- shouldn't see in java handler\n"); -#endif - XtDispatchEvent(&xev); - return; - } - - /* Find the top-level component */ - - if ((*env)->EnsureLocalCapacity(env, 1) < 0) { - return; - } - target = findTopLevel(peer, env); - if (target == NULL) { - JNU_ThrowNullPointerException(env, "component without a " - "window"); - return; - } - - if (isFrameOrDialog(target, env)) { -#ifdef DEBUG_FOCUS - printf("Focus event directed at a frame; frame = %d\n", - xev.xany.window); -#endif - focusEventForFrame(xev, focusProxyWindow); - (*env)->DeleteLocalRef(env, target); - return; - } else { -#ifdef DEBUG_FOCUS - printf("Focus event directed at a window; window = %d\n", - xev.xany.window); -#endif - focusEventForWindow(xev, env, &trueFocusWindow, - &focusProxyWindow, target); - (*env)->DeleteLocalRef(env, target); - return; - } - } - - case UnmapNotify: -#ifdef DEBUG_FOCUS - printf("Unmap on window %d\n", xev.xany.window); - printf("True focus window is %d\n", trueFocusWindow); -#endif - clearFocusPathOnWindow(xev.xunmap.window); - - default: - XtAppProcessEvent(awt_appContext, iMask); - break; - } - } - else { - /* There must be a timer, alternate input, or signal event. */ - XtAppProcessEvent(awt_appContext, iMask & ~XtIMXEvent); - } - -} /* processOneEvent() */ - -/* - * Waits for X/Xt events to appear on the pipe. Returns only when - * 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 -waitForEvents(JNIEnv *env, int32_t fdXPipe, int32_t fdAWTPipe) { - - while ((fdAWTPipe >= 0 && awt_events_pending(awt_appContext) == 0) || - (fdAWTPipe < 0 && XtAppPending(awt_appContext) == 0)) { -#ifdef USE_SELECT - performSelect(env,fdXPipe,fdAWTPipe); -#else - performPoll(env,fdXPipe,fdAWTPipe); -#endif - if ((awt_next_flush_time > 0) && - (awtJNI_TimeMillis() > awt_next_flush_time)) { - AWT_FLUSHOUTPUT_NOW(); - } - } /* end while awt_events_pending() == 0 */ -} /* waitForEvents() */ - -/************************************************************************* - ** ** - ** WE USE EITHER select() OR poll(), DEPENDING ON THE USE_SELECT ** - ** COMPILE-TIME CONSTANT. ** - ** ** - *************************************************************************/ - -#ifdef USE_SELECT - -static struct fd_set rdset; -struct timeval sel_time; - -/* - * 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 -performSelect(JNIEnv *env, int32_t fdXPipe, int32_t fdAWTPipe) { - - int32_t result; - int32_t count; - int32_t nfds = 1; - uint32_t timeout = awt_get_poll_timeout(False); - - /* Fixed 4250354 7/28/99 ssi@sparc.spb.su - * Cleaning up Global Refs in case of No Events - */ - awtJNI_CleanupGlobalRefs(); - - FD_ZERO( &rdset ); - FD_SET(fdXPipe, &rdset); - if (fdAWTPipe >= 0) { - nfds++; - FD_SET(fdAWTPipe, &rdset); - } - if (timeout == 0) { - // be sure other threads get a chance - awtJNI_ThreadYield(env); - } - // set the appropriate time values. The DASSERT() in - // MToolkit_run() makes sure that this will not overflow - sel_time.tv_sec = (timeout * 1000) / (1000 * 1000); - sel_time.tv_usec = (timeout * 1000) % (1000 * 1000); - AWT_NOFLUSH_UNLOCK(); - result = select(nfds, &rdset, 0, 0, &sel_time); - AWT_LOCK(); - - /* reset tick if this was not a time out */ - if (result == 0) { - /* select() timed out -- update timeout value */ - awt_get_poll_timeout(True); - } - if (fdAWTPipe >= 0 && FD_ISSET ( fdAWTPipe, &rdset ) ) - { - /* There is data on the AWT pipe - empty it */ - do { - count = read(fdAWTPipe, read_buf, AWT_POLL_BUFSIZE ); - } 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 -performPoll(JNIEnv *env, int32_t fdXPipe, int32_t fdAWTPipe) { - - static struct pollfd pollFds[2]; - uint32_t timeout = awt_get_poll_timeout(False); - int32_t result; - int32_t count; - - /* Fixed 4250354 7/28/99 ssi@sparc.spb.su - * Cleaning up Global Refs in case of No Events - */ - awtJNI_CleanupGlobalRefs(); - - pollFds[0].fd = fdXPipe; - pollFds[0].events = POLLRDNORM; - pollFds[0].revents = 0; - - pollFds[1].fd = fdAWTPipe; - pollFds[1].events = POLLRDNORM; - pollFds[1].revents = 0; - - AWT_NOFLUSH_UNLOCK(); - - /* print the poll timeout time in brackets */ - DTRACE_PRINT1("[%dms]",(int32_t)timeout); -#ifdef DEBUG - if (++debugPrintLineCount > 8) { - DTRACE_PRINTLN(""); - debugPrintLineCount = 0; - } -#endif - /* ACTUALLY DO THE POLL() */ - if (timeout == 0) { - // be sure other threads get a chance - awtJNI_ThreadYield(env); - } - result = poll( pollFds, 2, (int32_t) timeout ); - -#ifdef DEBUG - DTRACE_PRINT1("[poll()->%d]", result); - if (++debugPrintLineCount > 8) { - DTRACE_PRINTLN(""); - debugPrintLineCount = 0; - } -#endif - AWT_LOCK(); - if (result == 0) { - /* poll() timed out -- update timeout value */ - awt_get_poll_timeout(True); - } - if ( pollFds[1].revents ) - { - /* There is data on the AWT pipe - empty it */ - do { - count = read(AWT_READPIPE, read_buf, AWT_POLL_BUFSIZE ); - } while (count == AWT_POLL_BUFSIZE ); - DTRACE_PRINTLN1("wokeup on AWTPIPE, timeout:%d", timeout); - } - 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 -awt_put_back_event(JNIEnv *env, XEvent *event) { - - Boolean addIt = True; - if (putbackQueueCount >= putbackQueueCapacity) { - /* not enough room - alloc 50% more space */ - int32_t newCapacity; - XEvent *newQueue; - newCapacity = putbackQueueCapacity * 3 / 2; - if ((newCapacity - putbackQueueCapacity) - < PUTBACK_QUEUE_MIN_INCREMENT) { - /* always increase by at least min increment */ - newCapacity = putbackQueueCapacity + PUTBACK_QUEUE_MIN_INCREMENT; - } - newQueue = (XEvent*)realloc( - putbackQueue, newCapacity*(sizeof(XEvent))); - if (newQueue == NULL) { - JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError"); - addIt = False; - } else { - putbackQueue = newQueue; - putbackQueueCapacity = newCapacity; - } - } - if (addIt) { - char oneChar = 'p'; - memcpy(&(putbackQueue[putbackQueueCount]), event, sizeof(XEvent)); - putbackQueueCount++; - - // wake up the event loop, if it's sleeping - write (AWT_WRITEPIPE, &oneChar, 1); - } - - 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 -awt_get_next_put_back_event(XEvent *xev_out) { - - Boolean err = False; - if (putbackQueueCount < 1) { - err = True; - } else { - memcpy(xev_out, &(putbackQueue[0]), sizeof(XEvent)); - } - if (!err) { - /* remove it from the queue */ - if (putbackQueueCount == 1) { - - // queue is now empty - if (putbackQueueCapacity > PUTBACK_QUEUE_MIN_INCREMENT) { - - /* Too much space -- delete it and rebuild later */ - free(putbackQueue); - 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 */ - memmove(&(putbackQueue[0]), &(putbackQueue[1]), - (putbackQueueCount-1)*sizeof(XEvent)); - } - --putbackQueueCount; - } - 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 -awt_events_pending(XtAppContext appContext) { - XtInputMask imask = 0L; - imask = XtAppPending(appContext); - if (putbackQueueCount > 0) { - imask |= XtIMXEvent; - } - return imask; -} - - -#ifndef NOMODALFIX -#define WIDGET_ARRAY_SIZE 5; -static int32_t arraySize = 0; -static int32_t arrayIndx = 0; -static Widget *dShells = NULL; - -void -awt_shellPoppedUp(Widget shell, - XtPointer modal, - XtPointer call_data) -{ - if (arrayIndx == arraySize ) { - /* if we have not allocate an array, do it first */ - if (arraySize == 0) { - arraySize += WIDGET_ARRAY_SIZE; - dShells = (Widget *) malloc(sizeof(Widget) * arraySize); - } else { - arraySize += WIDGET_ARRAY_SIZE; - dShells = (Widget *) realloc((void *)dShells, sizeof(Widget) * arraySize); - } - } - - dShells[arrayIndx] = shell; - arrayIndx++; -} - -void -awt_shellPoppedDown(Widget shell, - XtPointer modal, - XtPointer call_data) -{ - arrayIndx--; - - if (dShells[arrayIndx] == shell) { - dShells[arrayIndx] = NULL; - return; - } else { - int32_t i; - - /* find the position of the shell in the array */ - for (i = arrayIndx; i >= 0; i--) { - if (dShells[i] == shell) { - break; - } - } - - /* remove the found element */ - while (i <= arrayIndx-1) { - dShells[i] = dShells[i+1]; - i++; - } - } -} - -Boolean -awt_isWidgetModal(Widget widget) -{ - Widget w; - - for (w = widget; !XtIsShell(w); w = XtParent(w)) { } - - while (w != NULL) { - if (w == dShells[arrayIndx-1]) { - return True; - } - w = XtParent(w); - } - return False; -} - -Boolean -awt_isModal() -{ - 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_MToolkit_modalWait(int32_t (*terminateFn) (void *data), void *data ) -{ - JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - - AWT_LOCK(); - AWT_FLUSHOUTPUT_NOW(); - while ((*terminateFn) (data) == 0) { - AWT_WAIT(AWT_MAX_POLL_TIMEOUT); - if ((*env)->ExceptionCheck(env)) { - (*env)->ExceptionClear(env); - break; - } - } - AWT_NOTIFY_ALL(); - AWT_UNLOCK(); -} - -static uint32_t -colorToRGB(XColor * color) -{ - int32_t rgb = 0; - - rgb |= ((color->red >> 8) << 16); - rgb |= ((color->green >> 8) << 8); - rgb |= ((color->blue >> 8) << 0); - - return rgb; -} - -/* - * fix for bug #4088106 - ugly text boxes and grayed out looking text - */ - -XmColorProc oldColorProc; - -void -ColorProc(XColor* bg_color, - XColor* fg_color, - XColor* sel_color, - XColor* ts_color, - XColor* bs_color) -{ - unsigned long plane_masks[1]; - unsigned long colors[5]; - - AwtGraphicsConfigDataPtr defaultConfig = - getDefaultConfig(DefaultScreen(awt_display)); - - /* use the default procedure to calculate colors */ - oldColorProc(bg_color, fg_color, sel_color, ts_color, bs_color); - - /* check if there is enought free color cells */ - if (XAllocColorCells(awt_display, defaultConfig->awt_cmap, False, - plane_masks, 0, colors, 5)) { - XFreeColors(awt_display, defaultConfig->awt_cmap, colors, 5, 0); - return; - } - - /* find the closest matches currently available */ - fg_color->pixel = defaultConfig->AwtColorMatch(fg_color->red >> 8, - fg_color->green >> 8, - fg_color->blue >> 8, - defaultConfig); - fg_color->flags = DoRed | DoGreen | DoBlue; - XQueryColor(awt_display, defaultConfig->awt_cmap, fg_color); - sel_color->pixel = defaultConfig->AwtColorMatch(sel_color->red >> 8, - sel_color->green >> 8, - sel_color->blue >> 8, - defaultConfig); - sel_color->flags = DoRed | DoGreen | DoBlue; - XQueryColor(awt_display, defaultConfig->awt_cmap, sel_color); - ts_color->pixel = defaultConfig->AwtColorMatch(ts_color->red >> 8, - ts_color->green >> 8, - ts_color->blue >> 8, - defaultConfig); - ts_color->flags = DoRed | DoGreen | DoBlue; - XQueryColor(awt_display, defaultConfig->awt_cmap, ts_color); - bs_color->pixel = defaultConfig->AwtColorMatch(bs_color->red >> 8, - bs_color->green >> 8, - bs_color->blue >> 8, - defaultConfig); - bs_color->flags = DoRed | DoGreen | DoBlue; - XQueryColor(awt_display, defaultConfig->awt_cmap, bs_color); -} - - -/* - * Read _XSETTINGS_SETTINGS property from _XSETTINGS selection owner - * and pass its value to the java world for processing. - */ -/*static*/ void -awt_xsettings_update(int scr, Window owner, void *cookie) -{ - Display *dpy = awt_display; - int status; - - JNIEnv *env; - jobject mtoolkit; - jmethodID upcall; - jbyteArray array; - - struct xsettings_callback_cookie *upcall_cookie = cookie; - - /* Returns of XGetWindowProperty */ - Atom actual_type; - int actual_format; - unsigned long nitems; - unsigned long bytes_after; - unsigned char *xsettings; - - DTRACE_PRINTLN2("XS: update screen %d, owner 0x%08lx", - scr, owner); - -#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. - */ - if (scr != DefaultScreen(dpy)) { - DTRACE_PRINTLN2("XS: XXX: default screen is %d, update is for %d, ignoring", DefaultScreen(dpy), scr); - return; - } -#endif /* kludge */ - - env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - DASSERT(env != NULL); - - DASSERT(upcall_cookie != NULL); - mtoolkit = upcall_cookie->mtoolkit; - upcall = upcall_cookie->upcallMID; - - DASSERT(!JNU_IsNull(env, mtoolkit)); - DASSERT(upcall != NULL); - - /* - * XXX: move awt_getPropertyFOO from awt_wm.c to awt_util.c and - * use the appropriate one. - */ - status = XGetWindowProperty(dpy, owner, - _XA_XSETTINGS_SETTINGS, 0, 0xFFFF, False, - _XA_XSETTINGS_SETTINGS, - &actual_type, &actual_format, &nitems, &bytes_after, - &xsettings); - - if (status != Success) { - DTRACE_PRINTLN("XS: unable to read _XSETTINGS"); - return; - } - - if (xsettings == NULL) { - DTRACE_PRINTLN("XS: reading _XSETTINGS, got NULL"); - return; - } - - if (actual_type != _XA_XSETTINGS_SETTINGS) { - XFree(xsettings); /* NULL data already catched above */ - 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 */ - if ((*env)->EnsureLocalCapacity(env, 1) < 0) { - DTRACE_PRINTLN("XS: EnsureLocalCapacity failed"); - XFree(xsettings); - return; - } - - array = (*env)->NewByteArray(env, (jint)nitems); - if (JNU_IsNull(env, array)) { - DTRACE_PRINTLN("awt_xsettings_update: NewByteArray failed"); - XFree(xsettings); - return; - } - - (*env)->SetByteArrayRegion(env, array, 0, (jint)nitems, - (jbyte *)xsettings); - XFree(xsettings); - - (*env)->CallVoidMethod(env, mtoolkit, upcall, (jint)scr, array); - (*env)->DeleteLocalRef(env, array); -} - - -/* - * Event handler for events on XSETTINGS selection owner. - * We are interested in PropertyNotify only. - */ -static void -awt_xsettings_callback(int scr, XEvent *xev, void *cookie) -{ - Display *dpy = awt_display; /* xev->xany.display */ - XPropertyEvent *ev; - - if (xev->type != PropertyNotify) { - DTRACE_PRINTLN2("XS: awt_xsettings_callback(%d) event %d ignored", - scr, xev->type); - return; - } - - ev = &xev->xproperty; - - if (ev->atom == None) { - DTRACE_PRINTLN("XS: awt_xsettings_callback(%d) atom == None"); - return; - } - -#ifdef DEBUG - { - char *name; - - DTRACE_PRINT2("XS: awt_xsettings_callback(%d) 0x%08lx ", - scr, ev->window); - name = XGetAtomName(dpy, ev->atom); - if (name == NULL) { - DTRACE_PRINT1("atom #%d", ev->atom); - } else { - DTRACE_PRINT1("%s", name); - XFree(name); - } - DTRACE_PRINTLN1(" %s", ev->state == PropertyNewValue ? - "changed" : "deleted"); - } -#endif - - if (ev->atom != _XA_XSETTINGS_SETTINGS) { - DTRACE_PRINTLN("XS: property != _XSETTINGS_SETTINGS ... ignoring"); - return; - } - - - if (ev->state == PropertyDelete) { - /* XXX: notify toolkit to reset to "defaults"? */ - return; - } - - awt_xsettings_update(scr, ev->window, cookie); -} - - -/* - * Owner of XSETTINGS selection changed on the given screen. - */ -static void -awt_xsettings_owner_callback(int scr, Window owner, long *data_unused, - void *cookie) -{ - if (owner == None) { - 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); - - awt_xsettings_update(scr, owner, cookie); -} - -/* - * Returns a reference to the class java.awt.Component. - */ -jclass -getComponentClass(JNIEnv *env) -{ - static jclass componentCls = NULL; - - // get global reference of java/awt/Component class (run only once) - if (componentCls == NULL) { - jclass componentClsLocal = (*env)->FindClass(env, "java/awt/Component"); - DASSERT(componentClsLocal != NULL); - if (componentClsLocal == NULL) { - /* exception already thrown */ - return NULL; - } - componentCls = (jclass)(*env)->NewGlobalRef(env, componentClsLocal); - (*env)->DeleteLocalRef(env, componentClsLocal); - } - return componentCls; -} - - -/* - * Returns a reference to the class java.awt.MenuComponent. - */ -jclass -getMenuComponentClass(JNIEnv *env) -{ - static jclass menuComponentCls = NULL; - - // get global reference of java/awt/MenuComponent class (run only once) - if (menuComponentCls == NULL) { - jclass menuComponentClsLocal = (*env)->FindClass(env, "java/awt/MenuComponent"); - DASSERT(menuComponentClsLocal != NULL); - if (menuComponentClsLocal == NULL) { - /* exception already thrown */ - return NULL; - } - menuComponentCls = (jclass)(*env)->NewGlobalRef(env, menuComponentClsLocal); - (*env)->DeleteLocalRef(env, menuComponentClsLocal); - } - return menuComponentCls; -} - -/* - * Class: sun_awt_motif_MToolkit - * Method: init - * Signature: (Ljava/lang/String;)V - */ -JNIEXPORT void JNICALL -Java_sun_awt_motif_MToolkit_init(JNIEnv *env, jobject this, - jstring mainClassName) -{ - char *appName = NULL; - char *mainChars = NULL; - - int32_t argc = 0; - char *argv[10] = { NULL }; - - /* - * Note: The MToolkit object depends on the static initializer - * of X11GraphicsEnvironment to initialize the connection to - * the X11 server. - */ - XFontStruct *xfont; - XmFontListEntry tmpFontListEntry; - char *multiclick_time_query; - AwtGraphicsConfigDataPtr defaultConfig = - getDefaultConfig(DefaultScreen(awt_display)); - AwtScreenDataPtr defaultScreen = - getScreenData(DefaultScreen(awt_display)); - - static String fallback_resources[] = - { - "*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 */ - }; - - focusOutEvent.type = FocusOut; - focusOutEvent.xfocus.send_event = True; - focusOutEvent.xfocus.display = awt_display; - focusOutEvent.xfocus.mode = NotifyNormal; - focusOutEvent.xfocus.detail = NotifyNonlinear; - - /* Need to make sure this is deleted someplace! */ - AWT_LOCK(); - - XSetIOErrorHandler(xIOError); - - if (!XSupportsLocale()) { - jio_fprintf(stderr, - "current locale is not supported in X11, locale is set to C"); - setlocale(LC_ALL, "C"); - } - if (!XSetLocaleModifiers("")) { - jio_fprintf(stderr, "X locale modifiers are not supported, using default"); - } -#ifdef NETSCAPE - if (awt_init_xt) { - XtToolkitInitialize(); - } -#else - XtToolkitInitialize(); -#endif - - { - jclass fontConfigClass; - jmethodID methID; - jstring jFontList; - char *cFontRsrc; - char *cFontRsrc2; - - fontConfigClass = (*env)->FindClass(env, "sun/awt/motif/MFontConfiguration"); - methID = (*env)->GetStaticMethodID(env, fontConfigClass, - "getDefaultMotifFontSet", - "()Ljava/lang/String;"); - jFontList = (*env)->CallStaticObjectMethod(env, fontConfigClass, methID); - if (jFontList == NULL) { - motifFontList = - "-monotype-arial-regular-r-normal--*-140-*-*-p-*-iso8859-1"; - } else { - motifFontList = JNU_GetStringPlatformChars(env, jFontList, NULL); - } - - /* fprintf(stderr, "motifFontList: %s\n", motifFontList); */ - - cFontRsrc = malloc(strlen(motifFontList) + 20); - strcpy(cFontRsrc, "*fontList: "); - strcat(cFontRsrc, motifFontList); - cFontRsrc2 = malloc(strlen(motifFontList) + 20); - strcpy(cFontRsrc2, "*labelFontList: "); - strcat(cFontRsrc2, motifFontList); - - argc = 1; - argv[argc++] = "-xrm"; - argv[argc++] = cFontRsrc; - argv[argc++] = "-xrm"; - argv[argc++] = cFontRsrc2; - argv[argc++] = "-font"; - argv[argc++] = (char *)defaultMotifFont; - } - - awt_appContext = XtCreateApplicationContext(); - XtAppSetErrorHandler(awt_appContext, (XtErrorHandler) xtError); - XtAppSetFallbackResources(awt_appContext, fallback_resources); - - appName = NULL; - mainChars = NULL; - if (!JNU_IsNull(env, mainClassName)) { - mainChars = (char *)JNU_GetStringPlatformChars(env, mainClassName, NULL); - appName = mainChars; - } - if (appName == NULL || appName[0] == '\0') { - appName = "AWT"; - } - - XtDisplayInitialize(awt_appContext, awt_display, - appName, /* application name */ - appName, /* application class */ - NULL, 0, &argc, argv); - - /* Root shell widget that serves as a parent for all AWT top-levels. */ - awt_root_shell = XtVaAppCreateShell(appName, /* application name */ - appName, /* application class */ - applicationShellWidgetClass, - awt_display, - /* va_list */ - XmNmappedWhenManaged, False, - NULL); - XtRealizeWidget(awt_root_shell); - - if (mainChars != NULL) { - JNU_ReleaseStringPlatformChars(env, mainClassName, mainChars); - } - - awt_mgrsel_init(); - 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 :-) - * - */ - multiclick_time_query = XGetDefault(awt_display, "*", "multiClickTime"); - if (multiclick_time_query) { - awt_multiclick_time = XtGetMultiClickTime(awt_display); - } else { - multiclick_time_query = XGetDefault(awt_display, - "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 */ - awt_multiclick_time = atoi(multiclick_time_query) * 100; - } else { - awt_multiclick_time = XtGetMultiClickTime(awt_display); - } - } - - scrollBugWorkAround = TRUE; - - /* - * Create the cursor for TextArea scrollbars... - */ - awt_scrollCursor = XCreateFontCursor(awt_display, XC_left_ptr); - - awt_defaultBg = defaultConfig->AwtColorMatch(200, 200, 200, defaultConfig); - awt_defaultFg = defaultScreen->blackpixel; - setup_modifier_map(awt_display); - - awt_initialize_DataTransferer(); - awt_initialize_Xm_DnD(awt_display); - - /* - * fix for bug #4088106 - ugly text boxes and grayed out looking text - */ - oldColorProc = XmGetColorCalculation(); - XmSetColorCalculation(ColorProc); - - AWT_UNLOCK(); -} - -/* - * Class: sun_awt_motif_MToolkit - * Method: run - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_sun_awt_motif_MToolkit_run - (JNIEnv *env, jobject this) -{ - /* - * in performSelect(), we multiply the timeout by 1000. Make sure - * that the maximum value will not cause an overflow. - */ - DASSERT(AWT_MAX_POLL_TIMEOUT <= (ULONG_MAX/1000)); - - awt_MainThread = (*env)->NewGlobalRef(env, awtJNI_GetCurrentThread(env)); - awt_MToolkit_loop(env); /* never returns */ -} - -/* - * Class: sun_awt_motif_MToolkit - * Method: makeColorModel - * Signature: ()Ljava/awt/image/ColorModel; - */ -JNIEXPORT jobject JNICALL Java_sun_awt_motif_MToolkit_makeColorModel - (JNIEnv *env, jclass this) -{ - AwtGraphicsConfigDataPtr defaultConfig = - getDefaultConfig(DefaultScreen(awt_display)); - - return awtJNI_GetColorModel(env, defaultConfig); -} - -/* - * Class: sun_awt_motif_MToolkit - * Method: getScreenResolution - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_sun_awt_motif_MToolkit_getScreenResolution - (JNIEnv *env, jobject this) -{ - return (jint) ((DisplayWidth(awt_display, DefaultScreen(awt_display)) - * 25.4) / - DisplayWidthMM(awt_display, DefaultScreen(awt_display))); -} - -/* - * Class: sun_awt_motif_MToolkit - * Method: getScreenWidth - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_sun_awt_motif_MToolkit_getScreenWidth - (JNIEnv *env, jobject this) -{ - return DisplayWidth(awt_display, DefaultScreen(awt_display)); -} -/* - * Class: sun_awt_motif_MToolkit - * Method: getScreenHeight - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_sun_awt_motif_MToolkit_getScreenHeight - (JNIEnv *env, jobject this) -{ - return DisplayHeight(awt_display, DefaultScreen(awt_display)); -} - -/* - * Class: sun_awt_motif_MToolkit - * Method: beep - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_sun_awt_motif_MToolkit_beep - (JNIEnv *env, jobject this) -{ - AWT_LOCK(); - XBell(awt_display, 0); - AWT_FLUSH_UNLOCK(); -} - -/* - * Class: sun_awt_motif_MToolkit - * Method: shutdown - * Signature: ()V - */ - -JNIEXPORT void JNICALL Java_sun_awt_motif_MToolkit_shutdown - (JNIEnv *env, jobject this) -{ - X11SD_LibDispose(env); -} - -/* - * Class: sun_awt_motif_MToolkit - * Method: getLockingKeyStateNative - * Signature: (I)B - */ -JNIEXPORT jboolean JNICALL Java_sun_awt_motif_MToolkit_getLockingKeyStateNative - (JNIEnv *env, jobject this, jint awtKey) -{ - KeySym sym; - KeyCode keyCode; - uint32_t byteIndex; - uint32_t bitIndex; - char keyVector[32]; - - AWT_LOCK(); - - sym = awt_getX11KeySym(awtKey); - keyCode = XKeysymToKeycode(awt_display, sym); - if (sym == NoSymbol || keyCode == 0) { - JNU_ThrowByName(env, "java/lang/UnsupportedOperationException", "Keyboard doesn't have requested key"); - AWT_UNLOCK(); - return False; - } - - byteIndex = (keyCode/8); - bitIndex = keyCode & 7; - XQueryKeymap(awt_display, keyVector); - - AWT_UNLOCK(); - - return (1 & (keyVector[byteIndex] >> bitIndex)); -} - -/* - * Class: sun_awt_motif_MToolkit - * Method: loadSystemColors - * Signature: ([I)V - */ -JNIEXPORT void JNICALL Java_sun_awt_motif_MToolkit_loadSystemColors - (JNIEnv *env, jobject this, jintArray systemColors) -{ - Widget frame, panel, control, menu, text, scrollbar; - Colormap cmap; - Pixel bg, fg, highlight, shadow; - Pixel pixels[java_awt_SystemColor_NUM_COLORS]; - XColor *colorsPtr; - jint rgbColors[java_awt_SystemColor_NUM_COLORS]; - int32_t count = 0; - int32_t i, j; - Arg args[10]; - int32_t argc; - AwtGraphicsConfigDataPtr defaultConfig = - getDefaultConfig(DefaultScreen(awt_display)); - - 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; - XtSetArg(args[argc], XmNbuttonFontList, getMotifFontList()); argc++; - XtSetArg(args[argc], XmNlabelFontList, getMotifFontList()); argc++; - XtSetArg(args[argc], XmNtextFontList, getMotifFontList()); argc++; - frame = XtAppCreateShell("AWTColors", "XApplication", - vendorShellWidgetClass, - awt_display, - args, argc); - /* - XtSetMappedWhenManaged(frame, False); - XtRealizeWidget(frame); - */ - panel = XmCreateDrawingArea(frame, "awtPanelColor", NULL, 0); - argc = 0; - XtSetArg(args[argc], XmNfontList, getMotifFontList()); argc++; - control = XmCreatePushButton(panel, "awtControlColor", args, argc); - argc = 0; - XtSetArg(args[argc], XmNlabelFontList, getMotifFontList()); argc++; - XtSetArg(args[argc], XmNbuttonFontList, getMotifFontList()); argc++; - menu = XmCreatePulldownMenu(control, "awtColorMenu", args, argc); - argc = 0; - XtSetArg(args[argc], XmNfontList, getMotifFontList()); argc++; - text = XmCreateText(panel, "awtTextColor", args, argc); - scrollbar = XmCreateScrollBar(panel, "awtScrollbarColor", NULL, 0); - - XtVaGetValues(panel, - XmNbackground, &bg, - XmNforeground, &fg, - XmNcolormap, &cmap, - NULL); - - pixels[java_awt_SystemColor_WINDOW] = bg; - count++; - pixels[java_awt_SystemColor_INFO] = bg; - count++; - pixels[java_awt_SystemColor_WINDOW_TEXT] = fg; - count++; - pixels[java_awt_SystemColor_INFO_TEXT] = fg; - count++; - - XtVaGetValues(menu, - XmNbackground, &bg, - XmNforeground, &fg, - NULL); - - pixels[java_awt_SystemColor_MENU] = bg; - count++; - pixels[java_awt_SystemColor_MENU_TEXT] = fg; - count++; - - XtVaGetValues(text, - XmNbackground, &bg, - XmNforeground, &fg, - NULL); - - pixels[java_awt_SystemColor_TEXT] = bg; - count++; - pixels[java_awt_SystemColor_TEXT_TEXT] = fg; - count++; - pixels[java_awt_SystemColor_TEXT_HIGHLIGHT] = fg; - count++; - pixels[java_awt_SystemColor_TEXT_HIGHLIGHT_TEXT] = bg; - count++; - - XtVaGetValues(control, - XmNbackground, &bg, - XmNforeground, &fg, - XmNtopShadowColor, &highlight, - XmNbottomShadowColor, &shadow, - NULL); - - pixels[java_awt_SystemColor_CONTROL] = bg; - count++; - pixels[java_awt_SystemColor_CONTROL_TEXT] = fg; - count++; - pixels[java_awt_SystemColor_CONTROL_HIGHLIGHT] = highlight; - count++; - pixels[java_awt_SystemColor_CONTROL_LT_HIGHLIGHT] = highlight; - count++; - pixels[java_awt_SystemColor_CONTROL_SHADOW] = shadow; - count++; - pixels[java_awt_SystemColor_CONTROL_DK_SHADOW] = shadow; - count++; - - XtVaGetValues(scrollbar, - XmNbackground, &bg, - NULL); - pixels[java_awt_SystemColor_SCROLLBAR] = bg; - count++; - - /* - * Convert pixel values to RGB - */ - colorsPtr = (XColor *) malloc(count * sizeof(XColor)); - j = 0; - for (i = 0; i < java_awt_SystemColor_NUM_COLORS; i++) { - if (pixels[i] != -1) { - colorsPtr[j++].pixel = pixels[i]; - } - } - XQueryColors(awt_display, cmap, colorsPtr, count); - - /* Get current System Colors */ - - (*env)->GetIntArrayRegion (env, systemColors, 0, - java_awt_SystemColor_NUM_COLORS, - rgbColors); - - /* - * Fill systemColor array with new rgb values - */ - - j = 0; - for (i = 0; i < java_awt_SystemColor_NUM_COLORS; i++) { - if (pixels[i] != -1) { - uint32_t rgb = colorToRGB(&colorsPtr[j++]); - - /* - printf("SystemColor[%d] = %x\n", i, rgb); - */ - rgbColors[i] = (rgb | 0xFF000000); - } - } - - (*env)->SetIntArrayRegion(env, - systemColors, - 0, - java_awt_SystemColor_NUM_COLORS, - rgbColors); - - /* Duplicate system colors. If color allocation is unsuccessful, - system colors will be approximated with matched colors */ - if (defaultConfig->awt_depth == 8) - awt_allocate_systemcolors(colorsPtr, count, defaultConfig); - - /* - * Cleanup - */ - XtDestroyWidget(frame); - free(colorsPtr); - - 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. - */ -JNIEXPORT jboolean JNICALL -Java_sun_awt_motif_MToolkit_isDynamicLayoutSupportedNative(JNIEnv *env, jobject this) -{ - enum wmgr_t 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 - */ -JNIEXPORT jboolean JNICALL -Java_sun_awt_motif_MToolkit_isFrameStateSupported(JNIEnv *env, jobject this, - jint state) -{ - if (state == java_awt_Frame_NORMAL || state == java_awt_Frame_ICONIFIED) { - return JNI_TRUE; - } else { - return awt_wm_supportsExtendedState(state) ? JNI_TRUE : JNI_FALSE; - } -} - -/* - * Class: sun_awt_motif_MToolkit - * Method: getMulticlickTime - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_sun_awt_motif_MToolkit_getMulticlickTime - (JNIEnv *env, jobject this) -{ - return awt_multiclick_time; -} - -/* - * Class: sun_awt_motif_MToolkit - * Method: loadXSettings - * Signature: ()V - */ -JNIEXPORT void JNICALL -Java_sun_awt_motif_MToolkit_loadXSettings(JNIEnv *env, jobject this) -{ - static Boolean registered = False; - - jclass mtoolkitCLS; - Display *dpy = awt_display; - const Window *owners; - int scr; - - AWT_LOCK(); - - if (registered) { - AWT_UNLOCK(); - return; - } - - if (_XA_XSETTINGS_SETTINGS == None) { - _XA_XSETTINGS_SETTINGS = XInternAtom(dpy, "_XSETTINGS_SETTINGS", False); - if (_XA_XSETTINGS_SETTINGS == None) { - JNU_ThrowNullPointerException(env, - "unable to intern _XSETTINGS_SETTINGS"); - AWT_UNLOCK(); - return; - } - } - - mtoolkitCLS = (*env)->GetObjectClass(env, this); - - xsettings_callback_cookie.mtoolkit = - (*env)->NewGlobalRef(env, this); - xsettings_callback_cookie.upcallMID = - (*env)->GetMethodID(env, mtoolkitCLS, - "parseXSettings", "(I[B)V"); - - if (JNU_IsNull(env, xsettings_callback_cookie.upcallMID)) { - JNU_ThrowNoSuchMethodException(env, - "sun.awt.motif.MToolkit.parseXSettings"); - AWT_UNLOCK(); - return; - } - - owners = awt_mgrsel_select("_XSETTINGS", PropertyChangeMask, - &xsettings_callback_cookie, - awt_xsettings_callback, - awt_xsettings_owner_callback); - if (owners == NULL) { - JNU_ThrowNullPointerException(env, - "unable to regiser _XSETTINGS with mgrsel"); - AWT_UNLOCK(); - return; - } - - registered = True; - - for (scr = 0; scr < ScreenCount(dpy); ++scr) { - if (owners[scr] == None) { - DTRACE_PRINTLN1("XS: MToolkit.loadXSettings: none on screen %d", - scr); - continue; - } - - awt_xsettings_update(scr, owners[scr], &xsettings_callback_cookie); - } - - AWT_UNLOCK(); -} - -JNIEXPORT jboolean JNICALL -Java_sun_awt_motif_MToolkit_isAlwaysOnTopSupported(JNIEnv *env, jobject toolkit) { - Boolean res; - AWT_LOCK(); - res = awt_wm_supportsAlwaysOnTop(); - AWT_UNLOCK(); - return res; -} - -/* - * Returns true if the current thread is privileged. Currently, - * only the main event loop thread is considered to be privileged. - */ -Boolean -awt_currentThreadIsPrivileged(JNIEnv *env) { - return (*env)->IsSameObject(env, - awt_MainThread, awtJNI_GetCurrentThread(env)); -} - -JNIEXPORT jboolean JNICALL -Java_sun_awt_motif_MToolkit_isSyncUpdated(JNIEnv *env, jobject toolkit) { - return syncUpdated; -} - -JNIEXPORT jboolean JNICALL -Java_sun_awt_motif_MToolkit_isSyncFailed(JNIEnv *env, jobject toolkit) { - return syncFailed; -} - -JNIEXPORT void JNICALL -Java_sun_awt_motif_MToolkit_updateSyncSelection(JNIEnv *env, jobject toolkit) { - - // AWT_LOCK is held by calling function - if (wm_selection == None) { - wm_selection = XInternAtom(awt_display, "WM_S0", False); - } - if (version_atom == None) { - version_atom = XInternAtom(awt_display, "VERSION", False); - } - if (oops_atom == None) { - oops_atom = XInternAtom(awt_display, "OOPS", False); - } - syncUpdated = False; - syncFailed = False; - XConvertSelection(awt_display, wm_selection, version_atom, oops_atom, XtWindow(awt_root_shell), CurrentTime); - XSync(awt_display, False); - inSyncWait = True; // Protect from spurious events - // Calling function will call AWT_LOCK_WAIT instead of AWT_UNLOCK -} - -JNIEXPORT jint JNICALL -Java_sun_awt_motif_MToolkit_getEventNumber(JNIEnv *env, jobject toolkit) { - // AWT_LOCK must be held by the calling method - return eventNumber; -} - -static void -syncWait_eventHandler(XEvent * event) { - static jmethodID syncNotifyMID = NULL; - if (event != NULL && event->xany.type == SelectionNotify && - event->xselection.requestor == XtWindow(awt_root_shell) && - event->xselection.property == oops_atom && - inSyncWait) - { - JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - syncUpdated = True; - inSyncWait = False; - AWT_NOTIFY_ALL(); - } else if (event != NULL && event->xany.type == SelectionNotify && - event->xselection.requestor == XtWindow(awt_root_shell) && - event->xselection.target == version_atom && - event->xselection.property == None && - XGetSelectionOwner(awt_display, wm_selection) == None && - event->xselection.selection == wm_selection) - { - JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - syncFailed = True; - inSyncWait = False; - AWT_NOTIFY_ALL(); - } -} - -JNIEXPORT void JNICALL -Java_sun_awt_motif_MToolkit_nativeGrab(JNIEnv *env, jobject toolkit, jobject window) { - struct FrameData *wdata; - static Cursor cursor = None; - int grab_result; - - AWT_LOCK(); - - wdata = (struct FrameData *) - JNU_GetLongFieldAsPtr(env, window, mComponentPeerIDs.pData); - - if (wdata == NULL || - wdata->winData.comp.widget == NULL || - wdata->winData.shell == NULL) - { - AWT_UNLOCK(); - return; - } - if (None == cursor) { - cursor = XCreateFontCursor(awt_display, XC_hand2); - } - grabbed_widget = wdata->winData.shell; - grab_result = XGrabPointer(awt_display, XtWindow(wdata->winData.shell), - True, (ButtonPressMask | ButtonReleaseMask - | EnterWindowMask | LeaveWindowMask | PointerMotionMask - | ButtonMotionMask), - GrabModeAsync, GrabModeAsync, None, - cursor, CurrentTime); - if (GrabSuccess != grab_result) { - XUngrabPointer(awt_display, CurrentTime); - AWT_UNLOCK(); - DTRACE_PRINTLN1("XGrabPointer() failed, result %d", grab_result); - return; - } - grab_result = XGrabKeyboard(awt_display, XtWindow(wdata->winData.shell), - True, - GrabModeAsync, GrabModeAsync, CurrentTime); - if (GrabSuccess != grab_result) { - XUngrabKeyboard(awt_display, CurrentTime); - XUngrabPointer(awt_display, CurrentTime); - DTRACE_PRINTLN1("XGrabKeyboard() failed, result %d", grab_result); - } - AWT_UNLOCK(); -} - -JNIEXPORT void JNICALL -Java_sun_awt_motif_MToolkit_nativeUnGrab(JNIEnv *env, jobject toolkit, jobject window) { - struct FrameData *wdata; - - AWT_LOCK(); - - wdata = (struct FrameData *) - JNU_GetLongFieldAsPtr(env, window, mComponentPeerIDs.pData); - - if (wdata == NULL || - wdata->winData.comp.widget == NULL || - wdata->winData.shell == NULL) - { - AWT_UNLOCK(); - return; - } - - XUngrabPointer(awt_display, CurrentTime); - XUngrabKeyboard(awt_display, CurrentTime); - grabbed_widget = NULL; - AWT_FLUSHOUTPUT_NOW(); - - AWT_UNLOCK(); - -} - -/* - * Class: sun_awt_motif_MToolkit - * Method: getWMName - * Signature: ()Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL -Java_sun_awt_motif_MToolkit_getWMName(JNIEnv *env, jclass this) -{ - enum wmgr_t wm; - - AWT_LOCK(); - wm = awt_wm_getRunningWM(); - AWT_UNLOCK(); - - switch (wm) { - case NO_WM: - return (*env)->NewStringUTF(env, "NO_WM"); - case OTHER_WM: - return (*env)->NewStringUTF(env, "OTHER_WM"); - case ENLIGHTEN_WM: - return (*env)->NewStringUTF(env, "ENLIGHTEN_WM"); - case KDE2_WM: - return (*env)->NewStringUTF(env, "KDE2_WM"); - case SAWFISH_WM: - return (*env)->NewStringUTF(env, "SAWFISH_WM"); - case ICE_WM: - return (*env)->NewStringUTF(env, "ICE_WM"); - case METACITY_WM: - return (*env)->NewStringUTF(env, "METACITY_WM"); - case OPENLOOK_WM: - return (*env)->NewStringUTF(env, "OPENLOOK_WM"); - case MOTIF_WM: - return (*env)->NewStringUTF(env, "MOTIF_WM"); - case CDE_WM: - return (*env)->NewStringUTF(env, "CDE_WM"); - } - return (*env)->NewStringUTF(env, "UNDETERMINED_WM"); -} - - -#endif /* !HEADLESS */ diff --git a/jdk/src/solaris/native/sun/awt/awt_MToolkit.h b/jdk/src/solaris/native/sun/awt/awt_MToolkit.h deleted file mode 100644 index 4288e0baf91a8a7be912b7c298eb276ee28cb368..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/native/sun/awt/awt_MToolkit.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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. - */ -#ifndef _MTOOLKIT_H_ -#define _MTOOLKIT_H_ -#ifndef HEADLESS -extern void *findPeer(Widget * pwidget); -extern Widget findWindowsProxy(jobject window, JNIEnv *env); -extern struct WidgetInfo *findWidgetInfo(Widget widget); -extern Boolean isAncestor(Window ancestor, Window child); -extern void clearFocusPath(Widget shell); -extern void globalClearFocusPath(Widget focusOwnerShell); -extern Boolean isFrameOrDialog(jobject target, JNIEnv * env); -extern jobject getOwningFrameOrDialog(jobject target, JNIEnv *env); - -#define SPECIAL_KEY_EVENT 2 - -#endif /* !HEADLESS */ -#endif /* _MTOOLKIT_H_ */ diff --git a/jdk/src/solaris/native/sun/awt/awt_MenuItem.h b/jdk/src/solaris/native/sun/awt/awt_MenuItem.h deleted file mode 100644 index ed7f90968fa51d39c0350f9948c9895cad0cc302..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/native/sun/awt/awt_MenuItem.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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 - -/* fieldIDs for MenuItem fields that may be accessed from C */ -struct MenuItemIDs { - jfieldID label; - jfieldID enabled; - jfieldID shortcut; -}; - -/* fieldIDs for MMenuItemPeer fields that may be accessed from C */ -struct MMenuItemPeerIDs { - jfieldID target; - jfieldID pData; - jfieldID isCheckbox; - jfieldID jniGlobalRef; -}; diff --git a/jdk/src/solaris/native/sun/awt/awt_PopupMenu.h b/jdk/src/solaris/native/sun/awt/awt_PopupMenu.h deleted file mode 100644 index 3a6d0b756f3962e2966df77730be1c3136d5f3c3..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/native/sun/awt/awt_PopupMenu.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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. - */ - -/* methodsIDs for MPopupMenuPeer methods that may be accessed from C */ -struct MPopupMenuPeerIDs { - jmethodID destroyNativeWidgetAfterGettingTreeLock; -}; diff --git a/jdk/src/solaris/native/sun/awt/awt_Robot.c b/jdk/src/solaris/native/sun/awt/awt_Robot.c index c3384b2eb1a3a5461bac73c2cebd1f84c3105e39..a830756a827e7edcae7305af193a9e2026ff264a 100644 --- a/jdk/src/solaris/native/sun/awt/awt_Robot.c +++ b/jdk/src/solaris/native/sun/awt/awt_Robot.c @@ -28,7 +28,6 @@ #endif #include "awt_p.h" -#include "awt_Component.h" #include "awt_GraphicsEnv.h" #define XK_MISCELLANY #include diff --git a/jdk/src/solaris/native/sun/awt/awt_TopLevel.h b/jdk/src/solaris/native/sun/awt/awt_TopLevel.h deleted file mode 100644 index 1d8107f2e77b0b43acf49d6d7e3d88339b972e1a..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/native/sun/awt/awt_TopLevel.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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. - */ - -/* - */ -#ifndef _TOPLEVEL_H_ -#define _TOPLEVEL_H_ -#ifndef HEADLESS - -extern Widget findFocusProxy(Widget widget); -extern Widget findTopLevelByShell(Widget widget); -extern jobject findTopLevel(jobject peer, JNIEnv *env); -extern void shellEH(Widget w, XtPointer data, XEvent *event, Boolean *continueToDispatch); -extern Boolean isFocusableWindowByShell(JNIEnv * env, Widget shell); -extern Boolean isFocusableWindowByPeer(JNIEnv * env, jobject peer); -extern Widget getShellWidget(Widget child); -extern Boolean isFocusableComponentTopLevelByWidget(JNIEnv * env, Widget child); -#endif /* !HEADLESS */ -#endif /* _TOPLEVEL_H_ */ diff --git a/jdk/src/solaris/native/sun/awt/awt_Window.h b/jdk/src/solaris/native/sun/awt/awt_Window.h deleted file mode 100644 index b816d415025ecece24e79c39ca2dbbc4d1002142..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/native/sun/awt/awt_Window.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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 - -/* fieldIDs for Window fields that may be accessed from C */ -struct WindowIDs { - jfieldID warningString; - jfieldID locationByPlatform; - jfieldID isAutoRequestFocus; -}; - -/* fieldIDs for MWindowPeer fields that may be accessed from C */ -struct MWindowPeerIDs { - jfieldID insets; - jfieldID iconWidth; - jfieldID iconHeight; - jfieldID winAttr; - jmethodID handleWindowFocusIn; - jmethodID handleWindowFocusOut; - jmethodID handleIconify; - jmethodID handleDeiconify; - jmethodID handleStateChange; - jmethodID draggedToScreenMID; -}; diff --git a/jdk/src/solaris/native/sun/awt/awt_mgrsel.c b/jdk/src/solaris/native/sun/awt/awt_mgrsel.c deleted file mode 100644 index b033227898018d5c525b06caedccb37a4d7de092..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/native/sun/awt/awt_mgrsel.c +++ /dev/null @@ -1,449 +0,0 @@ -/* - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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 - #error This file should not be included in headless library -#endif - -#include "awt_mgrsel.h" - -static Atom XA_MANAGER = None; - -/* - * Structures that describes the manager selection AWT listens to with - * callabacks to the subsytems interested in the selection. (We only - * listen to a couple of selections, so linear search is enough). - */ -struct AwtMgrsel { - char *selname; /* base name of selection atoms */ - Atom *per_scr_atoms; /* per-screen selection atoms (ICCCM 1.2.6) */ - Atom *per_scr_owners; /* windows currently owning the selection */ - long extra_mask; /* extra events to listen to on owners */ - void *cookie; - void (*callback_event)(int, XEvent *, void *); /* extra_mask events */ - void (*callback_owner)(int, Window, long *, void *); /* owner changes */ - struct AwtMgrsel *next; -}; - -static struct AwtMgrsel *mgrsel_list = NULL; - - -static int awt_mgrsel_screen(Window w); -static Window awt_mgrsel_select_per_screen(Atom, long); -static int awt_mgrsel_managed(XClientMessageEvent *mgrown); -static int awt_mgrsel_unmanaged(XDestroyWindowEvent *ev); - -#ifdef DEBUG -static void awt_mgrsel_dtraceManaged(XClientMessageEvent *mgrown); -#endif - - - -/* - * Find which screen the window W is the root of. - * Returns the screen number, or -1 if W is not a root. - */ -static int -awt_mgrsel_screen(Window w) -{ - Display *dpy = awt_display; - int scr; - - for (scr = 0; scr < ScreenCount(dpy); ++scr) { - if (w == RootWindow(dpy, scr)) { - return (scr); - } - } - - return (-1); -} - - -/************************************************************************ - * For every one that asketh receiveth; and he that seeketh findeth; - * and to him that knocketh it shall be opened. (Luke 11:10). - */ - - -/* - * A method for a subsytem to express its interest in a certain - * manager selection. - * - * If owner changes, the callback_owner will be called with the screen - * number and the new owning window when onwership is established, or - * None if the owner is gone. - * - * Events in extra_mask are selected for on owning windows (exsiting - * ones and on new owners when established) and callback_event will be - * called with the screen number and an event. - * - * The function returns an array of current owners. The size of the - * array is ScreenCount(awt_display). The array is "owned" by this - * module and should be considered by the caller as read-only. - */ -const Window * -awt_mgrsel_select(const char *selname, long extra_mask, - void *cookie, - void (*callback_event)(int, XEvent *, void *), - void (*callback_owner)(int, Window, long *, void *)) -{ - Display *dpy = awt_display; - struct AwtMgrsel *mgrsel; - Atom *per_scr_atoms; - Window *per_scr_owners; - char *namesbuf; - char **names; - int per_scr_sz; - int nscreens = ScreenCount(dpy); - int scr; - Status status; - - DASSERT(selname != NULL); - DTRACE_PRINTLN1("MG: select: %s", selname); - - /* buffer size for one per-screen atom name */ - per_scr_sz = strlen(selname) + /* "_S" */ 2 + /* %2d */ + 2 /* '\0' */+ 1; - - namesbuf = malloc(per_scr_sz * nscreens); /* actual storage for names */ - names = malloc(sizeof(char *) * nscreens); /* pointers to names */ - per_scr_atoms = malloc(sizeof(Atom) * nscreens); - per_scr_owners = malloc(sizeof(Window) * nscreens); - mgrsel = malloc(sizeof(struct AwtMgrsel)); - - if (namesbuf == NULL || names == NULL || per_scr_atoms == NULL - || per_scr_owners == NULL || mgrsel == NULL) - { - DTRACE_PRINTLN("MG: select: unable to allocate memory"); - if (namesbuf != NULL) free(namesbuf); - if (names != NULL) free(names); - if (per_scr_atoms != NULL) free(per_scr_atoms); - if (per_scr_owners != NULL) free(per_scr_owners); - if (mgrsel != NULL) free(mgrsel); - return (NULL); - } - - - for (scr = 0; scr < nscreens; ++scr) { - size_t sz; - - names[scr] = &namesbuf[per_scr_sz * scr]; - sz = snprintf(names[scr], per_scr_sz, "%s_S%-d", selname, scr); - DASSERT(sz < per_scr_sz); - } - - status = XInternAtoms(dpy, names, nscreens, False, per_scr_atoms); - - free(names); - free(namesbuf); - - if (status == 0) { - DTRACE_PRINTLN("MG: select: XInternAtoms failed"); - free(per_scr_atoms); - free(per_scr_owners); - return (NULL); - } - - mgrsel->selname = strdup(selname); - mgrsel->per_scr_atoms = per_scr_atoms; - mgrsel->per_scr_owners = per_scr_owners; - mgrsel->extra_mask = extra_mask; - mgrsel->cookie = cookie; - mgrsel->callback_event = callback_event; - mgrsel->callback_owner = callback_owner; - - for (scr = 0; scr < nscreens; ++scr) { - Window owner; - - owner = awt_mgrsel_select_per_screen(per_scr_atoms[scr], extra_mask); - mgrsel->per_scr_owners[scr] = owner; -#ifdef DEBUG - if (owner == None) { - DTRACE_PRINTLN1("MG: screen %d - None", scr); - } else { - DTRACE_PRINTLN2("MG: screen %d - 0x%08lx", scr, owner); - } -#endif - } - - mgrsel->next = mgrsel_list; - mgrsel_list = mgrsel; - - return (per_scr_owners); -} - - -static Window -awt_mgrsel_select_per_screen(Atom selection, long extra_mask) -{ - Display *dpy = awt_display; - Window owner; - - XGrabServer(dpy); - - owner = XGetSelectionOwner(dpy, selection); - if (owner == None) { - /* we'll get notified later if one arrives */ - XUngrabServer(dpy); - /* Workaround for bug 5039226 */ - XSync(dpy, False); - return (None); - } - - /* - * Select for StructureNotifyMask to get DestroyNotify when owner - * is gone. Also select for any additional events caller is - * interested in (e.g. PropertyChangeMask). Caller will be - * notifed of these events via ... XXX ... - */ - XSelectInput(dpy, owner, StructureNotifyMask | extra_mask); - - XUngrabServer(dpy); - /* Workaround for bug 5039226 */ - XSync(dpy, False); - return (owner); -} - - -/************************************************************************ - * And so I saw the wicked buried, who had come and gone from the - * place of the holy, and they were forgotten in the city where they - * had so done: this is also vanity. (Eccl 8:10) - */ - -#ifdef DEBUG -/* - * Print the message from the new manager that announces it acquired - * ownership. - */ -static void -awt_mgrsel_dtraceManaged(XClientMessageEvent *mgrown) -{ - Display *dpy = awt_display; - Atom selection; - char *selname, *print_selname; - int scr; - - scr = awt_mgrsel_screen(mgrown->window); - - selection = mgrown->data.l[1]; - print_selname = selname = XGetAtomName(dpy, selection); - if (selname == NULL) { - if (selection == None) { - print_selname = ""; - } else { - print_selname = ""; - } - } - - DTRACE_PRINTLN4("MG: new MANAGER for %s: screen %d, owner 0x%08lx (@%lu)", - print_selname, scr, - mgrown->data.l[2], /* the window owning the selection */ - mgrown->data.l[0]); /* timestamp */ - DTRACE_PRINTLN4("MG: %ld %ld / 0x%lx 0x%lx", /* extra data */ - mgrown->data.l[3], mgrown->data.l[4], - mgrown->data.l[3], mgrown->data.l[4]); - - if (selname != NULL) { - XFree(selname); - } -} -#endif /* DEBUG */ - - -static int -awt_mgrsel_managed(XClientMessageEvent *mgrown) -{ - Display *dpy = awt_display; - struct AwtMgrsel *mgrsel; - int scr; - - long timestamp; - Atom selection; - Window owner; - long *data; - - if (mgrown->message_type != XA_MANAGER) { - DTRACE_PRINTLN("MG: ClientMessage type != MANAGER, ignoring"); - return (0); - } - - scr = awt_mgrsel_screen(mgrown->window); - -#ifdef DEBUG - awt_mgrsel_dtraceManaged(mgrown); -#endif - - if (scr < 0) { - DTRACE_PRINTLN("MG: MANAGER ClientMessage with a non-root window!"); - return (0); - } - - timestamp = mgrown->data.l[0]; - selection = mgrown->data.l[1]; - owner = mgrown->data.l[2]; - data = &mgrown->data.l[3]; /* long[2], selection specific */ - - /* is this a selection we are intrested in? */ - for (mgrsel = mgrsel_list; mgrsel != NULL; mgrsel = mgrsel->next) { - if (selection == mgrsel->per_scr_atoms[scr]) - break; - } - - if (mgrsel == NULL) { - DTRACE_PRINTLN("MG: not interested in this selection, ignoring"); - return (0); - } - - - mgrsel->per_scr_owners[scr] = owner; - - XSelectInput(dpy, owner, StructureNotifyMask | mgrsel->extra_mask); - - /* notify the listener */ - if (mgrsel->callback_owner != NULL) { - (*mgrsel->callback_owner)(scr, owner, data, mgrsel->cookie); - } - - return (1); -} - - -static int -awt_mgrsel_unmanaged(XDestroyWindowEvent *ev) -{ - Display *dpy = awt_display; - struct AwtMgrsel *mgrsel; - Window exowner; - int scr; - - exowner = ev->window; /* selection owner that's gone */ - - /* is this a selection we are intrested in? */ - for (mgrsel = mgrsel_list; mgrsel != NULL; mgrsel = mgrsel->next) { - for (scr = 0; scr < ScreenCount(dpy); ++scr) { - if (exowner == mgrsel->per_scr_owners[scr]) { - /* can one window own selections for more than one screen? */ - goto out; /* XXX??? */ - } - } - } - out: - if (mgrsel == NULL) { - DTRACE_PRINTLN1("MG: DestroyNotify for 0x%08lx ignored", exowner); - return (0); - } - - DTRACE_PRINTLN3("MG: DestroyNotify for 0x%08lx, owner of %s at screen %d", - exowner, mgrsel->selname, scr); - - /* notify the listener (pass exowner as data???) */ - if (mgrsel->callback_owner != NULL) { - (*mgrsel->callback_owner)(scr, None, NULL, mgrsel->cookie); - } - - return (1); -} - - -/* - * Hook to be called from toolkit event loop. - */ -int -awt_mgrsel_processEvent(XEvent *ev) -{ - Display *dpy = awt_display; - struct AwtMgrsel *mgrsel; - int scr; - - if (ev->type == ClientMessage) { /* new manager announces ownership? */ - if (awt_mgrsel_managed(&ev->xclient)) - return (1); - } - - if (ev->type == DestroyNotify) { /* manager gives up selection? */ - if (awt_mgrsel_unmanaged(&ev->xdestroywindow)) - return (1); - } - - /* is this an event selected on one of selection owners? */ - for (mgrsel = mgrsel_list; mgrsel != NULL; mgrsel = mgrsel->next) { - for (scr = 0; scr < ScreenCount(dpy); ++scr) { - if (ev->xany.window == mgrsel->per_scr_owners[scr]) { - /* can one window own selections for more than one screen? */ - goto out; /* XXX??? */ - } - } - } - out: - DTRACE_PRINT2("MG: screen %d, event %d ... ", - scr, ev->xany.type); - if (mgrsel == NULL) { - DTRACE_PRINTLN("ignored"); - return (0); /* not interested */ - } - - DTRACE_PRINT1("%s ... ", mgrsel->selname); - if (mgrsel->callback_event != NULL) { - DTRACE_PRINTLN("dispatching"); - (*mgrsel->callback_event)(scr, ev, mgrsel->cookie); - } -#ifdef DEBUG - else { - DTRACE_PRINTLN("no callback"); - } -#endif - - return (1); -} - - -void -awt_mgrsel_init(void) -{ - static Boolean inited = False; - - Display *dpy = awt_display; - int scr; - - if (inited) { - return; - } - - XA_MANAGER = XInternAtom(dpy, "MANAGER", False); - DASSERT(XA_MANAGER != None); - - - /* - * Listen for ClientMessage's on each screen's root. We hook into - * the message loop in the toolkit (with awt_mgrsel_processEvent) - * to get the events processed. We need this for notifications of - * new manager acquiring ownership of the manager selection. - */ - for (scr = 0; scr < ScreenCount(dpy); ++scr) { - XSelectInput(dpy, RootWindow(dpy, scr), StructureNotifyMask); - } - - inited = True; -} diff --git a/jdk/src/solaris/native/sun/awt/awt_mgrsel.h b/jdk/src/solaris/native/sun/awt/awt_mgrsel.h deleted file mode 100644 index fdb9bfa512f7a8c064c1e6f232fd7f010aaf9fa0..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/native/sun/awt/awt_mgrsel.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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. - */ - -#ifndef _AWT_MGRSEL_H_ -#define _AWT_MGRSEL_H_ - -#ifndef HEADLESS - -#include "awt_p.h" - -extern void awt_mgrsel_init(void); -extern int awt_mgrsel_processEvent(XEvent *); - -extern const Window * awt_mgrsel_select(const char *, long, - void *, - void (*)(int, XEvent *, void *), - void (*)(int, Window, long *, void *)); - -#endif /* !HEADLESS */ -#endif /* _AWT_MGRSEL_H_ */ diff --git a/jdk/src/solaris/native/sun/awt/awt_motif.h b/jdk/src/solaris/native/sun/awt/awt_motif.h deleted file mode 100644 index 011a8dcee4d4e7890b705a680c4f67770f861167..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/native/sun/awt/awt_motif.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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. - */ - -#ifndef _SWITCHXM_P_H_ -#define _SWITCHXM_P_H_ - -#include - -#include "gdefs.h" -#include -#include - -#define MOTIF_NA sun_awt_motif_MComponentPeer_MOTIF_NA -#define MOTIF_V1 sun_awt_motif_MComponentPeer_MOTIF_V1 -#define MOTIF_V2 sun_awt_motif_MComponentPeer_MOTIF_V2 - - -extern int32_t awt_motif_getIMStatusHeight(Widget w, jobject tc); -extern XVaNestedList awt_motif_getXICStatusAreaList(Widget w, jobject tc); -extern void awt_motif_Scrollbar_ButtonReleaseHandler (Widget, - XtPointer, - XEvent *, - Boolean *) ; - - /* This function causes an UnsatisfiedLinkError on Linux. - * It's a no-op for Motif 2.1. - * Since Linux only links against Motif 2.1, we can safely remove - * this function altogether from the Linux build. - * bchristi 1/22/2001 - */ -#ifdef __solaris__ -extern void awt_motif_adjustDragTriggerEvent(XEvent* xevent); -#endif - -void awt_motif_enableSingleDragInitiator(Widget w); - -#endif /* _SWITCHXM_P_H_ */ diff --git a/jdk/src/solaris/native/sun/awt/awt_p.h b/jdk/src/solaris/native/sun/awt/awt_p.h index 70f1ccfc177f51b4aed57f6a60eb9bb5ccf476ce..97d96b36f17accd1e52a29ed1c35135df97ddd5b 100644 --- a/jdk/src/solaris/native/sun/awt/awt_p.h +++ b/jdk/src/solaris/native/sun/awt/awt_p.h @@ -49,28 +49,6 @@ #include #include #include -#ifndef XAWT -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif #endif /* !HEADLESS */ #include "awt.h" #include "awt_util.h" @@ -78,33 +56,13 @@ #include "colordata.h" #include "gdefs.h" -#ifndef XAWT -#include "GLXGraphicsConfig.h" -//#include -#endif - #ifndef HEADLESS -#ifndef XAWT -#include "awt_motif.h" -#endif #ifndef min #define min(a,b) ((a) <= (b)? (a):(b)) #endif #ifndef max #define max(a,b) ((a) >= (b)? (a):(b)) #endif - -extern Pixel awt_pixel_by_name(Display *dpy, char *color, char *defaultColor); - -typedef struct DropSiteInfo* DropSitePtr; - -struct WidgetInfo { - Widget widget; - Widget origin; - void* peer; - jlong event_mask; - struct WidgetInfo* next; -}; #endif /* !HEADLESS */ #define RepaintPending_NONE 0 @@ -112,13 +70,6 @@ struct WidgetInfo { #define RepaintPending_EXPOSE (1 << 1) #define LOOKUPSIZE 32 -typedef struct _DamageRect { - int x1; - int y1; - int x2; - int y2; -} DamageRect; - #ifndef HEADLESS typedef XRenderPictFormat * @@ -157,110 +108,9 @@ typedef struct _AwtScreenData { typedef AwtScreenData* AwtScreenDataPtr; -struct ComponentData { - Widget widget; - int repaintPending; - DamageRect repaintRect; - DamageRect exposeRect; - DropSitePtr dsi; -}; - -struct MessageDialogData { - struct ComponentData comp; - int isModal; -}; - -struct CanvasData { - struct ComponentData comp; - Widget shell; - int flags; -}; - -struct MenuItemData { - struct ComponentData comp; - int index; -}; - -struct MenuData { - struct ComponentData comp; - struct MenuItemData itemData; -}; - - #define W_GRAVITY_INITIALIZED 1 #define W_IS_EMBEDDED 2 -struct FrameData { - struct CanvasData winData; - int isModal; - Widget mainWindow; - Widget focusProxy; /* for all key events */ - Widget menuBar; - Widget warningWindow; - int top; /* these four are the insets... */ - int bottom; - int left; - int right; - int topGuess; /* these four are the guessed insets */ - int bottomGuess; - int leftGuess; - int rightGuess; - int mbHeight; /* height of the menubar window */ - int wwHeight; /* height of the warning window */ - jint state; /* java.awt.Frame.state bits */ - Boolean reparented; - Boolean configure_seen; - Boolean shellResized; /* frame shell has been resized */ - Boolean canvasResized; /* frame inner canvas resized */ - Boolean menuBarReset; /* frame menu bar added/removed */ - Boolean isResizable; /* is this window resizable ? */ - Boolean isFixedSizeSet; /* is fixed size already set ? */ - Boolean isShowing; /* is this window now showing ? */ - Boolean hasTextComponentNative; - Boolean need_reshape; - Boolean callbacksAdded; /* needed for fix for 4078176 */ - Pixmap iconPixmap; /* Pixmap to hold icon image */ - int iconWidth; - int iconHeight; - int imHeight; /* imStatusBar's height */ - Boolean imRemove; /* ImStatusBar is being removed */ - Boolean fixInsets; /* [jk] REMINDER: remove if possible */ - int decor; /* type of native decorations */ - Boolean initialFocus; /* does Window take focus initially */ - Boolean isInputMethodWindow; - - /* - * Fix for BugTraq ID 4060975. - * firstShellEH() stores to this field handle of the widget that had - * focus before the shell was resized so that we can later restore it. - */ - Widget focusWidget; - int screenNum; /* Which screen this Window is on. Xinerama-aware. */ - Boolean isDisposeScheduled; - Boolean isFocusableWindow; /* a cache of Window.isFocusableWindow() return value */ -}; - -struct ListData { - struct ComponentData comp; - Widget list; -}; - -struct TextAreaData { - struct ComponentData comp; - Widget txt; -}; - -struct TextFieldData { - struct ComponentData comp; - int echoContextID; - Boolean echoContextIDInit; -}; - -struct FileDialogData { - struct ComponentData comp; - char *file; -}; - typedef struct awtFontList { char *xlfd; int index_length; @@ -276,33 +126,6 @@ struct FontData { XFontStruct *xfont; /* Latin1 font */ }; -#ifndef XAWT -extern XmFontList getMotifFontList(void); -extern XFontSet getMotifFontSet(void); -extern XFontStruct *getMotifFontStruct(void); -extern Boolean awt_isAwtWidget(Widget widget); -#endif - -struct ChoiceData { - struct ComponentData comp; - Widget menu; - Widget *items; - int maxitems; - int n_items; - short n_columns; -/* Bug 4255631 Solaris: Size returned by Choice.getSize() does not match - * actual size - * y and height which Choice takes in pReshape -*/ - jint bounds_y; - jint bounds_height; -}; - -struct MenuList { - Widget menu; - struct MenuList* next; -}; - extern struct FontData *awtJNI_GetFontData(JNIEnv *env,jobject font, char **errmsg); extern AwtGraphicsConfigDataPtr getDefaultConfig(int screen); @@ -315,20 +138,6 @@ extern AwtScreenDataPtr getScreenData(int screen); #ifndef HEADLESS #define XDISPLAY awt_display; -extern Boolean awt_currentThreadIsPrivileged(JNIEnv *env); -extern void null_event_handler(Widget w, XtPointer client_data, - XEvent * event, Boolean * cont); - -extern void awt_put_back_event(JNIEnv *env, XEvent *event); -extern void awt_MToolkit_modalWait(int (*terminateFn)(void *data), void *data); -extern void awt_Frame_guessInsets(struct FrameData *fdata); - -extern void awt_addWidget(Widget w, Widget origin, void *peer, jlong event_mask); -extern void awt_delWidget(Widget w); - -extern void awt_addMenuWidget(Widget w); -extern void awt_delMenuWidget(Widget w); - extern int awt_allocate_colors(AwtGraphicsConfigDataPtr); extern void awt_allocate_systemcolors(XColor *, int, AwtGraphicsConfigDataPtr); extern void awt_allocate_systemrgbcolors(jint *, int, AwtGraphicsConfigDataPtr); @@ -338,24 +147,5 @@ extern int awtJNI_GetColorForVis (JNIEnv *, jobject, AwtGraphicsConfigDataPtr); extern jobject awtJNI_GetColorModel(JNIEnv *, AwtGraphicsConfigDataPtr); extern void awtJNI_CreateColorData (JNIEnv *, AwtGraphicsConfigDataPtr, int lock); -extern Boolean awtJNI_isSelectionOwner(JNIEnv *env, char *sel_str); -extern void awtJNI_notifySelectionLost(JNIEnv *env, char *sel_str); -extern void removePopupMenus(); -extern Boolean awtMenuIsActive(); #endif /* !HEADLESS */ - -extern void awtJNI_DeleteGlobalRef(JNIEnv *env,jobject thiscomp); -extern void awtJNI_DeleteGlobalMenuRef(JNIEnv *env,jobject thismenu); -extern jobject awtJNI_CreateAndSetGlobalRef(JNIEnv *env,jobject thiscomp); -extern void awtJNI_CleanupGlobalRefs(void); - -#ifndef HEADLESS -/* XXX: Motif internals. Need to fix 4090493. */ -#define MOTIF_XmINVALID_DIMENSION ((Dimension) 0xFFFF) -#define MOTIF_XmDEFAULT_INDICATOR_DIM ((Dimension) 9) - -extern Dimension awt_computeIndicatorSize(struct FontData *fdata); -extern Dimension awt_adjustIndicatorSizeForMenu(Dimension indSize); -#endif /* !HEADLESS */ - #endif /* _AWT_P_H_ */ diff --git a/jdk/src/solaris/native/sun/awt/awt_util.c b/jdk/src/solaris/native/sun/awt/awt_util.c index bf48c091e4b3650369c7316edfd0adf9720132c2..f1f897c156478d13a0373027f124ca0b1b92fe16 100644 --- a/jdk/src/solaris/native/sun/awt/awt_util.c +++ b/jdk/src/solaris/native/sun/awt/awt_util.c @@ -29,31 +29,15 @@ #include "awt_p.h" #include "color.h" -#include "awt_TopLevel.h" #include #include #include #include #include -#ifndef XAWT -#include -#include -#include -#include -#include -#endif /* XAWT */ #include #include #include -#include "awt_xembed.h" - - -#ifndef XAWT -#if MOTIF_VERSION!=1 - #include -#endif -#endif #include "java_awt_event_MouseWheelEvent.h" @@ -72,7 +56,6 @@ unsigned char xerror_code; extern jint getModifiers(uint32_t state, jint button, jint keyCode); extern jint getButton(uint32_t button); -static int32_t winmgr_running = 0; static Atom OLDecorDelAtom = 0; static Atom MWMHints = 0; static Atom DTWMHints = 0; @@ -86,840 +69,6 @@ static Atom decor_list[9]; #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 - */ -Boolean -awt_util_focusIsOnMenu(Display *display) -{ - Window window; - Widget widget; - int32_t rtr; - - XGetInputFocus(display, &window, &rtr); - if (window == None) { - return False; - } - - widget = XtWindowToWidget(display, window); - if (widget == NULL) { - return False; - } - - if (XtIsSubclass(widget, xmMenuShellWidgetClass)) { - return True; - } - - #if MOTIF_VERSION!=1 - /* Motif 2.1 uses XmGrabShell on XmComboBox instead - of XmMenuShell - */ - if (XtIsSubclass(widget, xmGrabShellWidgetClass)) { - return True; - } - /* Fix 4800638 check the ancestor of focus widget is - GrabSell - */ - if (XtIsSubclass(widget, xmListWidgetClass)) - { - Widget shell = getShellWidget(widget); - if (shell && XtIsSubclass(shell, - xmGrabShellWidgetClass)) - { - return True; - } - } - #endif - - if (XtIsSubclass(widget, xmRowColumnWidgetClass)) { - unsigned char type; - XtVaGetValues(widget, XmNrowColumnType, &type, NULL); - if (type == XmMENU_BAR) { - return True; - } - } - return False; -} - -static -void fillButtonEvent(XButtonEvent *ev, int32_t type, Display *display, Window window) { - ev->type = type; - ev->display = display; - ev->window = window; - ev->send_event = True; - - /* REMIND: multi-screen */ - ev->root = RootWindow(display, DefaultScreen(display)); - ev->subwindow = (Window)None; - ev->time = CurrentTime; - ev->x = 0; - ev->y = 0; - ev->x_root = 0; - ev->y_root = 0; - ev->same_screen = True; - ev->button = Button1; - ev->state = Button1Mask; -} - -/* - * generates a mouse press event and a release event - * called from awt_Dialog.c - */ -int32_t -awt_util_sendButtonClick(Display *display, Window window) -{ - XButtonEvent ev; - int32_t status; - - fillButtonEvent(&ev, ButtonPress, display, window); - status = XSendEvent(display, window, True, ButtonPressMask, (XEvent *)&ev); - - if (status != 0) { - fillButtonEvent(&ev, ButtonRelease, display, window); - status = XSendEvent(display, window, False, ButtonReleaseMask, - (XEvent *)&ev); - } - return status; -} - -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; -} - -void -awt_setWidgetGravity(Widget w, int32_t gravity) -{ - XSetWindowAttributes xattr; - Window win = XtWindow(w); - - if (win != None) { - xattr.bit_gravity = StaticGravity; - xattr.win_gravity = StaticGravity; - XChangeWindowAttributes(XtDisplay(w), win, - CWBitGravity|CWWinGravity, - &xattr); - } -} - -Widget get_shell_focused_widget(Widget w) { - while (w != NULL && !XtIsShell(w)) { - w = XtParent(w); - } - if (w != NULL) { - return XmGetFocusWidget(w); - } else { - return NULL; - } -} - -void -awt_util_reshape(Widget w, jint x, jint y, jint wd, jint ht) -{ - Widget parent; - Dimension ww, wh; - Position wx, wy; - Boolean move = False; - Boolean resize = False; - Boolean mapped_when_managed = False; - Boolean need_to_unmanage = True; - Widget saved_focus_widget = NULL; - - if (w == NULL) { - JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - JNU_ThrowNullPointerException(env,"NullPointerException"); - return; - } - parent = XtParent(w); - - /* Aim: hack to prevent direct children of scrollpane from - * being unmanaged during a reshape operation (which results - * in too many expose events). - */ - if (parent != NULL && XtParent(parent) != NULL && - XtIsSubclass(XtParent(parent), xmScrolledWindowWidgetClass)) { - need_to_unmanage = False; - } - - XtVaGetValues(w, - XmNwidth, &ww, - XmNheight, &wh, - XmNx, &wx, - XmNy, &wy, - NULL); - - if (x != wx || y != wy) { - move = True; - } - if (wd != ww || ht != wh) { - resize = True; - } - if (!move && !resize) { - return; - } - - if (need_to_unmanage) { - if (!resize) { - mapped_when_managed = w->core.mapped_when_managed; - w->core.mapped_when_managed = False; - } - saved_focus_widget = get_shell_focused_widget(w); - 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))) { - XtVaSetValues(w, XmNx, 1, XmNy, 1, NULL); - } - - if (move && !resize) { - XtVaSetValues(w, XmNx, x, XmNy, y, NULL); - - } else if (resize && !move) { - XtVaSetValues(w, - XmNwidth, (wd > 0) ? wd : 1, - XmNheight, (ht > 0) ? ht : 1, - NULL); - - } else { - XtVaSetValues(w, - XmNx, x, - XmNy, y, - XmNwidth, (wd > 0) ? wd : 1, - XmNheight, (ht > 0) ? ht : 1, - NULL); - } - - if (need_to_unmanage) { - XtManageChild(w); - if (!resize) { - w->core.mapped_when_managed = mapped_when_managed; - } - if (saved_focus_widget != NULL) { - Boolean result = XmProcessTraversal(saved_focus_widget, XmTRAVERSE_CURRENT); - if (!result) - { - Widget shell = saved_focus_widget; - while(shell != NULL && !XtIsShell(shell)) { - shell = XtParent(shell); - } - XtSetKeyboardFocus(shell, saved_focus_widget); - } - } - } -} - -void -awt_util_hide(Widget w) -{ - if (w == NULL) { - JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - JNU_ThrowNullPointerException(env,"NullPointerException"); - return; - } - XtSetMappedWhenManaged(w, False); -} - -void -awt_util_show(Widget w) -{ -/* - extern Boolean scrollBugWorkAround; -*/ - if (w == NULL) { - JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - JNU_ThrowNullPointerException(env,"NullPointerException"); - return; - } - XtSetMappedWhenManaged(w, True); -/* - XXX: causes problems on 2.5 - if (!scrollBugWorkAround) { - awt_setWidgetGravity(w, StaticGravity); - } -*/ -} - -void -awt_util_enable(Widget w) -{ - XtSetSensitive(w, True); -} - -void -awt_util_disable(Widget w) -{ - XtSetSensitive(w, False); -} - -void -awt_util_mapChildren(Widget w, void (*func)(Widget,void *), - int32_t applyToCurrent, void *data) { - WidgetList wlist; - Cardinal wlen = 0; - Cardinal i; - - /* The widget may have been destroyed by another thread. */ - if ((w == NULL) || (!XtIsObject(w)) || (w->core.being_destroyed)) - return; - - if (applyToCurrent != 0) { - (*func)(w, data); - } - if (!XtIsComposite(w)) { - return; - } - - XtVaGetValues(w, - XmNchildren, &wlist, - XmNnumChildren, &wlen, - NULL); - if (wlen > 0) { - for (i=0; i < wlen; i++) { - awt_util_mapChildren(wlist[i], func, 1, data); - } - } -} - -void -awt_changeAttributes(Display *dpy, Widget w, unsigned long mask, - XSetWindowAttributes *xattr) -{ - WidgetList wlist; - Cardinal wlen = 0; - Cardinal i; - - if (XtWindow(w) && XtIsRealized(w)) { - XChangeWindowAttributes(dpy, - XtWindow(w), - mask, - xattr); - } else { - return; - } - XtVaGetValues(w, - XmNchildren, &wlist, - XmNnumChildren, &wlen, - NULL); - for (i = 0; i < wlen; i++) { - if (XtWindow(wlist[i]) && XtIsRealized(wlist[i])) { - XChangeWindowAttributes(dpy, - XtWindow(wlist[i]), - mask, - xattr); - } - } -} - -static Widget prevWgt = NULL; - -static void -DestroyCB(Widget w, XtPointer client_data, XtPointer call_data) { - if (prevWgt == w) { - prevWgt = NULL; - } -} - -int32_t -awt_util_setCursor(Widget w, Cursor c) { - static Cursor prevCur = None; - - if (XtIsRealized(w)) { - unsigned long valuemask = 0; - XSetWindowAttributes attributes; - - valuemask = CWCursor; - if (prevWgt != NULL) { - attributes.cursor = None; - XChangeWindowAttributes(awt_display, - XtWindow(prevWgt), - valuemask, - &attributes); - } - - if (c == None) { - c = prevCur; - if (w != NULL) { - XtAddCallback(w, XmNdestroyCallback, DestroyCB, NULL); - } - prevWgt = w; - } else { - prevCur = c; - prevWgt = NULL; - } - attributes.cursor = c; - XChangeWindowAttributes(awt_display, - XtWindow(w), - valuemask, - &attributes); - XFlush(awt_display); - return 1; - } else - return 0; -} - -void -awt_util_convertEventTimeAndModifiers(XEvent *event, - ConvertEventTimeAndModifiers *output) { - switch (event->type) { - case KeyPress: - case KeyRelease: - output->when = awt_util_nowMillisUTC_offset(event->xkey.time); - output->modifiers = getModifiers(event->xkey.state, 0, 0); - break; - case ButtonPress: - case ButtonRelease: - output->when = awt_util_nowMillisUTC_offset(event->xbutton.time); - output->modifiers = getModifiers(event->xbutton.state, - getButton(event->xbutton.button), 0); - break; - default: - output->when = awt_util_nowMillisUTC(); - output->modifiers =0; - 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. -*/ -Widget -awt_WidgetAtXY(Widget root, Position pointerx, Position pointery) { - Widget answer = NULL; - - if(!root) return NULL; - - if(XtIsComposite(root)) { - int32_t i=0; - WidgetList wl=NULL; - Cardinal wlen=0; - - XtVaGetValues(root, XmNchildren, &wl, XmNnumChildren, &wlen, NULL); - - if(wlen>0) { - for(i=0; i=wx && pointerx<=lastx && pointery>=wy && pointery<=lasty && - widgetUserData) - answer = root; - } - - return answer; -} -#ifdef __linux__ - - -#define MAXARGS 10 -static Arg xic_vlist[MAXARGS]; -static Arg status_vlist[MAXARGS]; -static Arg preedit_vlist[MAXARGS]; - -#define NO_ARG_VAL -1 -#define SEPARATOR_HEIGHT 2 - -static XFontSet extract_fontset(XmFontList); - -/* 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* -get_im_info_ptr(Widget w, - Boolean create) -{ - Widget p; - XmVendorShellExtObject ve; - XmWidgetExtData extData; - XmImShellInfo im_info; - XmImDisplayInfo xim_info; - - 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. - */ - if ((extData = _XmGetWidgetExtData((Widget)p, XmSHELL_EXTENSION)) == NULL) - return NULL; - - ve = (XmVendorShellExtObject) extData->widget; - - return &ve->vendor.im_info; -} - -static XmImShellInfo -get_im_info(Widget w, - Boolean create) -{ - XmImShellInfo* ptr = (XmImShellInfo *) get_im_info_ptr(w, create); - if (ptr != NULL) - return *ptr; - else - return NULL; -} - -#endif /* !linux */ - -Widget -awt_util_getXICStatusAreaWindow(Widget w) -{ - while (!XtIsShell(w)){ - w = XtParent(w); - } - return w; -} - -#ifdef __linux__ -static XRectangle geometryRect; -XVaNestedList awt_util_getXICStatusAreaList(Widget w) -{ - XIC xic; - XmImXICInfo icp; - XmVendorShellExtObject ve; - XmWidgetExtData extData; - XmImShellInfo im_info; - XmFontList fl=NULL; - - XRectangle *ssgeometry = &geometryRect; - XRectangle geomRect ; - XRectangle *im_rect; - XFontSet *im_font; - - Pixel bg ; - Pixel fg ; - Dimension height, width ; - Position x,y ; - Pixmap bpm, *bpmout ; - - XVaNestedList list = NULL; - - char *ret; - Widget p=w; - - while (!XtIsShell(p)) { - p = XtParent(p); - } - - XtVaGetValues(p, - XmNx, &x, - XmNy, &y, - XmNwidth, &width, - XmNheight, &height, - XmNbackgroundPixmap, &bpm, - NULL); - - extData = _XmGetWidgetExtData((Widget) p, XmSHELL_EXTENSION); - if (extData == NULL) { - return NULL; - } - ve = (XmVendorShellExtObject) extData->widget; - im_info = get_im_info(w, False); - - if (im_info == NULL) { - return NULL; - } else { - icp = im_info->iclist; - } - - if (icp) { - /* - * We have at least a textfield/textarea in the frame, use the - * first one. - */ - ssgeometry->x = 0; - ssgeometry->y = height - icp->sp_height; - ssgeometry->width = icp->status_width; - ssgeometry->height = icp->sp_height; - XtVaGetValues(w, XmNbackground, &bg, NULL); - XtVaGetValues(w, XmNforeground, &fg, NULL); - XtVaGetValues(w, XmNfontList, &fl, NULL); - /* - * use motif TextComponent's resource - */ - - list = XVaCreateNestedList(0, - XNFontSet, extract_fontset(fl), - XNArea, ssgeometry, - XNBackground, bg, - XNForeground, fg, - NULL); - } - return list ; -} - -static XFontSet -extract_fontset(XmFontList fl) -{ - XmFontContext context; - XmFontListEntry next_entry; - XmFontType type_return; - XtPointer tmp_font; - XFontSet first_fs = NULL; - char *font_tag; - - if (!XmFontListInitFontContext(&context, fl)) - return NULL; - - do { - next_entry = XmFontListNextEntry(context); - if (next_entry) { - tmp_font = XmFontListEntryGetFont(next_entry, &type_return); - if (type_return == XmFONT_IS_FONTSET) { - font_tag = XmFontListEntryGetTag(next_entry); - if (!strcmp(font_tag, XmFONTLIST_DEFAULT_TAG)) { - XmFontListFreeFontContext(context); - XtFree(font_tag); - return (XFontSet) tmp_font; - } - XtFree(font_tag); - if (first_fs == NULL) - first_fs = (XFontSet) tmp_font; - } - } - } while (next_entry); - - XmFontListFreeFontContext(context); - return first_fs; -} -#endif - -/*the caller does have the responsibility to free the memory return - from this function...*/ -char* awt_util_makeWMMenuItem(char *target, Atom protocol){ - char *buf = NULL; - int32_t buflen = 0; - - /*a label in a menuitem is not supposed to be a FullOfSpaceString... */ - buflen = strlen(target) * 3; - buf = (char*)malloc(buflen + 20); - if (buf == NULL){ - JNU_ThrowOutOfMemoryError((JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2), NULL); - } - else{ - int32_t off = 0; - char *ptr = target; - while ((off < (buflen - 20)) && (*ptr != '\0')){ - if (*ptr == ' '){ - *(buf + off++) = 0x5c; - } - *(buf + off++) = *ptr++; - } - sprintf(buf + off, " f.send_msg %ld", protocol); - } - 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 - */ -Cardinal -awt_util_insertCallback(Widget w) -{ - jobject peer; - WidgetList children; - Cardinal num_children; - Widget parent; - XtPointer userdata; - Cardinal index; - int32_t pos; - JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - - parent = XtParent(w); - XtVaGetValues(parent, - XmNnumChildren, &num_children, - XmNchildren, &children, - NULL); - XtVaGetValues(w, XmNuserData, &userdata, NULL); - - index = num_children; /* default is to add to end */ - - if (userdata != NULL) { - peer = (jobject) userdata; - - // SECURITY: We are running on the privileged toolkit thread. - // The peer must *NOT* call into user code - pos = (int32_t) JNU_CallMethodByName(env - ,NULL - ,(jobject) peer - ,"getZOrderPosition_NoClientCode" - ,"()I").i; - if ((*env)->ExceptionOccurred(env)) { - (*env)->ExceptionDescribe(env); - (*env)->ExceptionClear(env); - } - index = (Cardinal) (pos != -1 ? pos : num_children); - } - return index; -} - -void -awt_util_consumeAllXEvents(Widget widget) -{ - /* Remove all queued X Events for the window of the widget. */ - -#define ALL_EVENTS_MASK 0xFFFF - - XEvent xev; - - XFlush(awt_display); - while (XCheckWindowEvent(awt_display, XtWindow(widget), - ALL_EVENTS_MASK, &xev)) ; -} - -#endif /* XAWT */ -/** - * Gets the thread we are currently executing on - */ -jobject -awtJNI_GetCurrentThread(JNIEnv *env) { - static jclass threadClass = NULL; - static jmethodID currentThreadMethodID = NULL; - - jobject currentThread = NULL; - - /* Initialize our java identifiers once. Checking before locking - * is a huge performance win. - */ - if (threadClass == NULL) { - // should enter a monitor here... - Boolean err = FALSE; - if (threadClass == NULL) { - jclass tc = (*env)->FindClass(env, "java/lang/Thread"); - threadClass = (*env)->NewGlobalRef(env, tc); - if (threadClass != NULL) { - currentThreadMethodID = (*env)->GetStaticMethodID(env, - threadClass, - "currentThread", - "()Ljava/lang/Thread;" - ); - } - } - if (currentThreadMethodID == NULL) { - threadClass = NULL; - err = TRUE; - } - if (err) { - return NULL; - } - } /* threadClass == NULL*/ - - currentThread = (*env)->CallStaticObjectMethod( - env, threadClass, currentThreadMethodID); - DASSERT(!((*env)->ExceptionOccurred(env))); - /*JNU_PrintString(env, "getCurrentThread() -> ", JNU_ToString(env,currentThread));*/ - return currentThread; -} /* awtJNI_GetCurrentThread() */ - void awtJNI_ThreadYield(JNIEnv *env) { @@ -956,426 +105,3 @@ awtJNI_ThreadYield(JNIEnv *env) { (*env)->CallStaticVoidMethod(env, threadClass, yieldMethodID); DASSERT(!((*env)->ExceptionOccurred(env))); } /* awtJNI_ThreadYield() */ - -#ifndef XAWT - -void -awt_util_cleanupBeforeDestroyWidget(Widget widget) -{ - /* Bug 4017222: Drag processing uses global prevWidget. */ - if (widget == prevWidget) { - prevWidget = NULL; - } -} - -static Boolean timeStampUpdated = False; - -static int32_t -isTimeStampUpdated(void* p) { - return timeStampUpdated; -} - -static void -propertyChangeEventHandler(Widget w, XtPointer client_data, - XEvent* event, Boolean* continue_to_dispatch) { - timeStampUpdated = True; -} - -/* - * 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(). - */ -Time -awt_util_getCurrentServerTime() { - - JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - static Atom _XA_JAVA_TIME_PROPERTY_ATOM = 0; - Time server_time = 0; - - AWT_LOCK(); - - if (_XA_JAVA_TIME_PROPERTY_ATOM == 0) { - XtAddEventHandler(awt_root_shell, PropertyChangeMask, False, - propertyChangeEventHandler, NULL); - _XA_JAVA_TIME_PROPERTY_ATOM = XInternAtom(awt_display, "_SUNW_JAVA_AWT_TIME", False); - } - - timeStampUpdated = False; - XChangeProperty(awt_display, XtWindow(awt_root_shell), - _XA_JAVA_TIME_PROPERTY_ATOM, XA_ATOM, 32, PropModeAppend, - (unsigned char *)"", 0); - XFlush(awt_display); - - if (awt_currentThreadIsPrivileged(env)) { - XEvent event; - XMaskEvent(awt_display, PropertyChangeMask, &event); - XtDispatchEvent(&event); - } else { - awt_MToolkit_modalWait(isTimeStampUpdated, NULL); - } - server_time = XtLastTimestampProcessed(awt_display); - - 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 - */ -jlong -awt_util_nowMillisUTC() -{ - struct timeval t; - gettimeofday(&t, NULL); - return ((jlong)t.tv_sec) * 1000 + (jlong)(t.tv_usec/1000); -} - -/* - * 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). - */ -jlong -awt_util_nowMillisUTC_offset(Time server_offset) -{ - /* - * 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. - */ - static const jlong WRAP_TIME_MILLIS = (jlong)((uint32_t)-1); - static jlong reset_time_utc; - - jlong current_time_utc = awt_util_nowMillisUTC(); - - if ((current_time_utc - reset_time_utc) > WRAP_TIME_MILLIS) { - reset_time_utc = awt_util_nowMillisUTC() - - awt_util_getCurrentServerTime(); - } - - return reset_time_utc + server_offset; -} - -void awt_util_do_wheel_scroll(Widget scrolled_window, jint scrollType, - jint scrollAmt, jint wheelAmt) { - Widget scrollbar = NULL; - 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. - */ - - scrollbar = awt_util_get_scrollbar_to_scroll(scrolled_window); - if (scrollbar == NULL) { /* no suitable scrollbar for scrolling */ - return; - } - - XtVaGetValues(scrollbar, XmNvalue, &value, - XmNsliderSize, &slider_size, - XmNminimum, &min, - XmNmaximum, &max, - XmNincrement, &increment, - XmNpageIncrement, &page_increment, NULL); - - if (scrollType == java_awt_event_MouseWheelEvent_WHEEL_BLOCK_SCROLL) { - scrollAdjustment = page_increment; - } - else { // WHEEL_UNIT_SCROLL - scrollAdjustment = increment * scrollAmt; - } - - 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. - newValue = MAX(min, value+ (scrollAdjustment * wheelAmt)); - } - else { - newValue = MIN(max - slider_size, - value + (scrollAdjustment * wheelAmt)); - } - - XtVaSetValues(scrollbar, XmNvalue, newValue, NULL); - XtCallCallbacks(scrollbar, XmNvalueChangedCallback, NULL); -} - - -/* 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. - */ -Widget awt_util_get_scrollbar_to_scroll(Widget scrolled_window) { - Widget scrollbar = NULL; - int value; - int slider_size; - int min; - int max; - - /* first, try the vertical scrollbar */ - XtVaGetValues(scrolled_window, XmNverticalScrollBar, &scrollbar, NULL); - if (scrollbar != NULL) { - XtVaGetValues(scrollbar, XmNvalue, &value, - XmNsliderSize, &slider_size, - XmNminimum, &min, - XmNmaximum, &max, NULL); - if (slider_size < max - min) { - return scrollbar; - } - } - - /* then, try the horiz */ - XtVaGetValues(scrolled_window, XmNhorizontalScrollBar, &scrollbar, NULL); - if (scrollbar != NULL) { - XtVaGetValues(scrollbar, XmNvalue, &value, - XmNsliderSize, &slider_size, - XmNminimum, &min, - XmNmaximum, &max, NULL); - if (slider_size < max - min) { - return scrollbar; - } - } - /* neither is suitable for scrolling */ - return NULL; -} - -EmbeddedFrame *theEmbeddedFrameList = NULL; - -static void awt_util_updateXtCoordinatesForEmbeddedFrame(Widget ef) -{ - Window ef_window; - Window win; - int32_t x, y; - ef_window = XtWindow(ef); - if (ef_window != None) { - if (XTranslateCoordinates(awt_display, ef_window, - RootWindowOfScreen(XtScreen(ef)), - 0, 0, &x, &y, &win)) { - DTRACE_PRINTLN("correcting coordinates"); - ef->core.x = x; - ef->core.y = y; - } - } -} - -Boolean awt_util_processEventForEmbeddedFrame(XEvent *ev) -{ - EmbeddedFrame *ef; - Boolean dummy; - Boolean eventProcessed = False; - switch (ev->type) { - case FocusIn: - case FocusOut: - ef = theEmbeddedFrameList; - while (ef != NULL) { - if (ef->frameContainer == ev->xfocus.window) { - eventProcessed = True; - if (isXEmbedActiveByWindow(XtWindow(ef->embeddedFrame))) { - 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. - shellEH(ef->embeddedFrame, ef->javaRef, ev, &dummy); - } - ef = ef->next; - } - return eventProcessed; - case ConfigureNotify: - for (ef = theEmbeddedFrameList; ef != NULL; ef = ef->next) { - awt_util_updateXtCoordinatesForEmbeddedFrame(ef->embeddedFrame); - } - return True; - } - return False; -} - -void awt_util_addEmbeddedFrame(Widget embeddedFrame, jobject javaRef) -{ - EmbeddedFrame *ef, *eflist; - Atom WM_STATE; - Window win; - Window parent, root; - Window *children; - uint32_t nchildren; - Atom type = None; - int32_t format; - unsigned long nitems, after; - unsigned char * data; - XWindowAttributes win_attributes; - - WM_STATE = XInternAtom(awt_display, "WM_STATE", True); - if (WM_STATE == None) { - return; - } - win = XtWindow(embeddedFrame); - if (win == None) - return; - /* - * according to XICCM, we search our toplevel window - * by looking for WM_STATE property - */ - while (True) { - if (!XQueryTree(awt_display, win, &root, &parent, - &children, &nchildren)) { - return; - } - if (children) { - XFree(children); - } - if (parent == NULL || parent == root) { - return; - } - win = parent; - /* - * Add StructureNotifyMask through hierarchy upto toplevel - */ - XGetWindowAttributes(awt_display, win, &win_attributes); - XSelectInput(awt_display, win, win_attributes.your_event_mask | - StructureNotifyMask); - - if (XGetWindowProperty(awt_display, win, WM_STATE, - 0, 0, False, AnyPropertyType, - &type, &format, &nitems, &after, &data) == Success) { - XFree(data); - if (type) { - break; - } - } - } - ef = (EmbeddedFrame *) malloc(sizeof(EmbeddedFrame)); - if (ef == NULL) { - JNU_ThrowOutOfMemoryError((JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2), - "OutOfMemory in awt_util_addEmbeddedFrame"); - return; - } - ef->embeddedFrame = embeddedFrame; - ef->frameContainer = win; - ef->javaRef = javaRef; - ef->eventSelectedPreviously = False; - /* initialize the xt coordinates */ - awt_util_updateXtCoordinatesForEmbeddedFrame(embeddedFrame); - - /* - * go through the exisiting embedded frames see if we have - * already selected the event on the same frameContainer - */ - eflist = theEmbeddedFrameList; - while (eflist != NULL) { - if (eflist->frameContainer == win) { - break; - } - eflist = eflist->next; - } - if (eflist != NULL) { - /* - * 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 - */ - ef->eventSelectedPreviously = eflist->eventSelectedPreviously; - } else { - XGetWindowAttributes(awt_display, ef->frameContainer, - &win_attributes); - XSelectInput(awt_display, ef->frameContainer, - win_attributes.your_event_mask | FocusChangeMask); - } - - /* ef will become the head of the embedded frame list */ - ef->next = theEmbeddedFrameList; - if (theEmbeddedFrameList != NULL) { - theEmbeddedFrameList->prev = ef; - } - ef->prev = NULL; - theEmbeddedFrameList = ef; -} - -void awt_util_delEmbeddedFrame(Widget embeddedFrame) -{ - EmbeddedFrame *ef = theEmbeddedFrameList; - Window frameContainer; - XWindowAttributes win_attributes; - Boolean needToDeselect; - - while (ef != NULL) { - if (ef->embeddedFrame == embeddedFrame) { - break; - } - ef = ef->next; - } - if (ef == NULL) { /* cannot find specified embedded frame */ - return; - } - /* remove ef from link list EmbeddedFrameList */ - if (ef->prev) { - ef->prev->next = ef->next; - } - if (ef->next) { - ef->next->prev = ef->prev; - } - if (theEmbeddedFrameList == ef) { - theEmbeddedFrameList = ef->next; - } - - frameContainer = ef->frameContainer; - needToDeselect = ef->eventSelectedPreviously ? False : True; - free(ef); - if (!needToDeselect) { - return; - } - /* - * now decide whether we need to stop listenning event for - * frameContainer - */ - ef = theEmbeddedFrameList; - while (ef != NULL) { - if (ef->frameContainer == frameContainer) { - break; - } - ef = ef->next; - } - if (ef == NULL) { - /* - * 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"); - XGetWindowAttributes(awt_display, frameContainer, &win_attributes); - XSelectInput(awt_display, frameContainer, - win_attributes.your_event_mask & - (~FocusChangeMask)); - } -} - -#endif /* XAWT */ - -void awt_util_debug_init() { -#if defined(DEBUG) - DTrace_Initialize(); -#endif -} - -static void awt_util_debug_fini() { -#if defined(DEBUG) - DTrace_Shutdown(); -#endif -} diff --git a/jdk/src/solaris/native/sun/awt/awt_util.h b/jdk/src/solaris/native/sun/awt/awt_util.h index 38e2fbcb6e70032614f0412516adcde49ce9c82e..5fb113fc405c596ed1937708c5d1aa8764f835d3 100644 --- a/jdk/src/solaris/native/sun/awt/awt_util.h +++ b/jdk/src/solaris/native/sun/awt/awt_util.h @@ -27,58 +27,8 @@ #define _AWT_UTIL_H_ #ifndef HEADLESS -#ifndef XAWT -#include -#include -#endif #include "gdefs.h" -typedef struct ConvertEventTimeAndModifiers { - jlong when; - jint modifiers; -} ConvertEventTimeAndModifiers; - -Boolean awt_util_focusIsOnMenu(Display *display); -int32_t awt_util_sendButtonClick(Display *display, Window window); - -Widget awt_util_createWarningWindow(Widget parent, char *warning); -void awt_util_show(Widget w); -void awt_util_hide(Widget w); -void awt_util_enable(Widget w); -void awt_util_disable(Widget w); -void awt_util_reshape(Widget w, jint x, jint y, jint wd, jint ht); -void awt_util_mapChildren(Widget w, void (*func)(Widget,void *), - int32_t applyToSelf, void *data); -int32_t awt_util_setCursor(Widget w, Cursor c); -void awt_util_convertEventTimeAndModifiers - (XEvent *event, ConvertEventTimeAndModifiers *output); -Widget awt_WidgetAtXY(Widget root, Position x, Position y); -char *awt_util_makeWMMenuItem(char *target, Atom protocol); -Cardinal awt_util_insertCallback(Widget w); -void awt_util_consumeAllXEvents(Widget widget); -void awt_util_cleanupBeforeDestroyWidget(Widget widget); -void awt_util_debug_init(); -Time awt_util_getCurrentServerTime(); -jlong awt_util_nowMillisUTC(); -jlong awt_util_nowMillisUTC_offset(Time server_offset); -void awt_util_do_wheel_scroll(Widget scrolled_window, jint scrollType, - jint scrollAmt, jint wheelAmt); -Widget awt_util_get_scrollbar_to_scroll(Widget window); - - -typedef struct _EmbeddedFrame { - Widget embeddedFrame; - Window frameContainer; - jobject javaRef; - Boolean eventSelectedPreviously; - struct _EmbeddedFrame * next; - struct _EmbeddedFrame * prev; -} EmbeddedFrame; - -void awt_util_addEmbeddedFrame(Widget embeddedFrame, jobject javaRef); -void awt_util_delEmbeddedFrame(Widget embeddedFrame); -Boolean awt_util_processEventForEmbeddedFrame(XEvent *ev); - #define WITH_XERROR_HANDLER(f) do { \ XSync(awt_display, False); \ xerror_code = Success; \ @@ -115,8 +65,6 @@ extern XErrorHandler xerror_saved_handler; */ extern unsigned char xerror_code; -extern int xerror_ignore_bad_window(Display *dpy, XErrorEvent *err); - #endif /* !HEADLESS */ #ifndef INTERSECTS @@ -143,13 +91,8 @@ struct DPos { int32_t echoC; }; -extern jobject awtJNI_GetCurrentThread(JNIEnv *env); extern void awtJNI_ThreadYield(JNIEnv *env); -#ifndef HEADLESS -extern Widget prevWidget; -#endif /* !HEADLESS */ - /* * Functions for accessing fields by name and signature */ @@ -183,69 +126,4 @@ JNU_SetBooleanField(JNIEnv *env, jobject self, const char *name, jboolean val); JNIEXPORT jint JNICALL JNU_GetCharField(JNIEnv *env, jobject self, const char *name); -#ifndef HEADLESS -#ifdef __solaris__ -extern Widget awt_util_getXICStatusAreaWindow(Widget w); -#else -int32_t awt_util_getIMStatusHeight(Widget vw); -XVaNestedList awt_util_getXICStatusAreaList(Widget w); -Widget awt_util_getXICStatusAreaWindow(Widget w); -#endif - - - - -#ifdef __linux__ -typedef struct _XmImRefRec { - Cardinal num_refs; /* Number of referencing widgets. */ - Cardinal max_refs; /* Maximum length of refs array. */ - Widget* refs; /* Array of referencing widgets. */ - XtPointer **callbacks; -} XmImRefRec, *XmImRefInfo; - -typedef struct _PreeditBufferRec { - unsigned short length; - wchar_t *text; - XIMFeedback *feedback; - int32_t caret; - XIMCaretStyle style; -} PreeditBufferRec, *PreeditBuffer; - -typedef struct _XmImXICRec { - struct _XmImXICRec *next; /* Links all have the same XIM. */ - XIC xic; /* The XIC. */ - Window focus_window; /* Cached information about the XIC. */ - XIMStyle input_style; /* ...ditto... */ - int32_t status_width; /* ...ditto... */ - int32_t preedit_width; /* ...ditto... */ - int32_t sp_height; /* ...ditto... */ - Boolean has_focus; /* Does this XIC have keyboard focus. */ - Boolean anonymous; /* Do we have exclusive rights to this XIC. */ - XmImRefRec widget_refs; /* Widgets referencing this XIC. */ - struct _XmImXICRec **source; /* Original source of shared XICs. */ - PreeditBuffer preedit_buffer; -} XmImXICRec, *XmImXICInfo; - -typedef struct _XmImShellRec { - /* per-Shell fields. */ - Widget im_widget; /* Dummy widget to make intrinsics behave. */ - Widget current_widget; /* Widget whose visual we're matching. */ - - /* per fields. */ - XmImXICInfo shell_xic; /* For PER_SHELL sharing policy. */ - XmImXICInfo iclist; /* All known XICs for this . */ -} XmImShellRec, *XmImShellInfo; - -typedef struct { - /* per-Display fields. */ - XContext current_xics; /* Map widget -> current XmImXICInfo. */ - - /* per-XIM fields. */ - XIM xim; /* The XIM. */ - XIMStyles *styles; /* XNQueryInputStyle result. */ - XmImRefRec shell_refs; /* Shells referencing this XIM. */ -} XmImDisplayRec, *XmImDisplayInfo; - -#endif -#endif /* !HEADLESS */ #endif /* _AWT_UTIL_H_ */ diff --git a/jdk/src/solaris/native/sun/awt/awt_wm.c b/jdk/src/solaris/native/sun/awt/awt_wm.c deleted file mode 100644 index d1da64f4051ecdcdca2f66b5c31d29039ea4a8c0..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/native/sun/awt/awt_wm.c +++ /dev/null @@ -1,2869 +0,0 @@ -/* - * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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 - #error This file should not be included in headless library -#endif - -/* - * Some SCIENCE stuff happens, and it is CONFUSING - */ - -#include "awt_p.h" - -#include -#include -#include -#include - -/* JNI headers */ -#include "java_awt_Frame.h" /* for frame state constants */ - -#include "awt_wm.h" -#include "awt_util.h" /* for X11 error handling macros */ - -/* - * NB: 64 bit awareness. - * - * Since this code reads/writes window properties heavily, one thing - * should be noted well. Xlib uses C type 'long' for properties of - * format 32. Fortunately, typedef for Atom is 'long' as well, so - * passing property data as or casting returned property data to - * arrays of atoms is safe. - */ - - -/* - * Atoms used to communicate with window manager(s). - * Naming convention: - * o for atom "FOO" the variable is "XA_FOO" - * o for atom "_BAR" the variable is "_XA_BAR" - * Don't forget to add initialization to awt_wm_initAtoms below. - */ - -/* - * Before WM rototill JDK used to check for running WM by just testing - * if certain atom is interned or not. We'd better not confuse older - * JDK by interning these atoms. Use awt_wm_atomInterned() to intern - * them lazily. - * - * ENLIGHTENMENT_COMMS - * _ICEWM_WINOPTHINT - * _SAWMILL_TIMESTAMP - * _DT_SM_WINDOW_INFO - * _MOTIF_WM_INFO - * _SUN_WM_PROTOCOLS - */ - -/* Good old ICCCM */ -static Atom XA_WM_STATE; - -/* New "netwm" spec from www.freedesktop.org */ -static Atom XA_UTF8_STRING; /* like STRING but encoding is UTF-8 */ -static Atom _XA_NET_SUPPORTING_WM_CHECK; -static Atom _XA_NET_SUPPORTED; /* list of protocols (property of root) */ -static Atom _XA_NET_WM_NAME; /* window property */ -static Atom _XA_NET_WM_STATE; /* both window property and request */ - -/* - * _NET_WM_STATE is a list of atoms. - * NB: Standard spelling is "HORZ" (yes, without an 'I'), but KDE2 - * uses misspelled "HORIZ" (see KDE bug #20229). This was fixed in - * KDE 2.2. Under earlier versions of KDE2 horizontal and full - * maximization doesn't work . - */ -static Atom _XA_NET_WM_STATE_MAXIMIZED_HORZ; -static Atom _XA_NET_WM_STATE_MAXIMIZED_VERT; -static Atom _XA_NET_WM_STATE_SHADED; -static Atom _XA_NET_WM_STATE_ABOVE; -static Atom _XA_NET_WM_STATE_BELOW; -static Atom _XA_NET_WM_STATE_HIDDEN; - -/* Currently we only care about max_v and max_h in _NET_WM_STATE */ -#define AWT_NET_N_KNOWN_STATES 2 - -/* Gnome WM spec (superseded by "netwm" above, but still in use) */ -static Atom _XA_WIN_SUPPORTING_WM_CHECK; -static Atom _XA_WIN_PROTOCOLS; -static Atom _XA_WIN_STATE; -static Atom _XA_WIN_LAYER; - -/* Enlightenment */ -static Atom _XA_E_FRAME_SIZE; - -/* KWin (KDE2) */ -static Atom _XA_KDE_NET_WM_FRAME_STRUT; - -/* KWM (KDE 1.x) OBSOLETE??? */ -static Atom XA_KWM_WIN_ICONIFIED; -static Atom XA_KWM_WIN_MAXIMIZED; - -/* OpenLook */ -static Atom _XA_OL_DECOR_DEL; -static Atom _XA_OL_DECOR_HEADER; -static Atom _XA_OL_DECOR_RESIZE; -static Atom _XA_OL_DECOR_PIN; -static Atom _XA_OL_DECOR_CLOSE; - -/* For _NET_WM_STATE ClientMessage requests */ -#define _NET_WM_STATE_REMOVE 0 /* remove/unset property */ -#define _NET_WM_STATE_ADD 1 /* add/set property */ -#define _NET_WM_STATE_TOGGLE 2 /* toggle property */ - -/* _WIN_STATE bits */ -#define WIN_STATE_STICKY (1<<0) /* everyone knows sticky */ -#define WIN_STATE_MINIMIZED (1<<1) /* Reserved - definition is unclear */ -#define WIN_STATE_MAXIMIZED_VERT (1<<2) /* window in maximized V state */ -#define WIN_STATE_MAXIMIZED_HORIZ (1<<3) /* window in maximized H state */ -#define WIN_STATE_HIDDEN (1<<4) /* not on taskbar but window visible*/ -#define WIN_STATE_SHADED (1<<5) /* shaded (MacOS / Afterstep style) */ -#define WIN_LAYER_ONTOP 6 -#define WIN_LAYER_NORMAL 4 - -#define URGENCY_HINT (1<<8) -#define LAYER_ALWAYS_ON_TOP 1 -#define LAYER_NORMAL 0 - - -/* - * Intern a bunch of atoms we are going use. - */ -static void -awt_wm_initAtoms(void) -{ - /* Minimize X traffic by creating atoms en mass... This requires - slightly more code but reduces number of server requests. */ - struct atominit { - Atom *atomptr; - const char *name; - }; - - /* Just add new atoms to this list */ - static struct atominit atom_list[] = { - { &XA_WM_STATE, "WM_STATE" }, - - { &XA_UTF8_STRING, "UTF8_STRING" }, - - { &_XA_NET_SUPPORTING_WM_CHECK, "_NET_SUPPORTING_WM_CHECK" }, - { &_XA_NET_SUPPORTED, "_NET_SUPPORTED" }, - { &_XA_NET_WM_STATE, "_NET_WM_STATE" }, - { &_XA_NET_WM_STATE_MAXIMIZED_VERT, "_NET_WM_STATE_MAXIMIZED_VERT" }, - { &_XA_NET_WM_STATE_MAXIMIZED_HORZ, "_NET_WM_STATE_MAXIMIZED_HORZ" }, - { &_XA_NET_WM_STATE_SHADED, "_NET_WM_STATE_SHADED" }, - { &_XA_NET_WM_STATE_ABOVE, "_NET_WM_STATE_ABOVE" }, - { &_XA_NET_WM_STATE_BELOW, "_NET_WM_STATE_BELOW" }, - { &_XA_NET_WM_STATE_HIDDEN, "_NET_WM_STATE_HIDDEN" }, - { &_XA_NET_WM_NAME, "_NET_WM_NAME" }, - - { &_XA_WIN_SUPPORTING_WM_CHECK, "_WIN_SUPPORTING_WM_CHECK" }, - { &_XA_WIN_PROTOCOLS, "_WIN_PROTOCOLS" }, - { &_XA_WIN_STATE, "_WIN_STATE" }, - { &_XA_WIN_LAYER, "_WIN_LAYER" }, - - { &_XA_KDE_NET_WM_FRAME_STRUT, "_KDE_NET_WM_FRAME_STRUT" }, - - { &_XA_E_FRAME_SIZE, "_E_FRAME_SIZE" }, - - { &XA_KWM_WIN_ICONIFIED, "KWM_WIN_ICONIFIED" }, - { &XA_KWM_WIN_MAXIMIZED, "KWM_WIN_MAXIMIZED" }, - - { &_XA_OL_DECOR_DEL, "_OL_DECOR_DEL" }, - { &_XA_OL_DECOR_HEADER, "_OL_DECOR_HEADER" }, - { &_XA_OL_DECOR_RESIZE, "_OL_DECOR_RESIZE" }, - { &_XA_OL_DECOR_PIN, "_OL_DECOR_PIN" }, - { &_XA_OL_DECOR_CLOSE, "_OL_DECOR_CLOSE" } - }; -#define ATOM_LIST_LENGTH (sizeof(atom_list)/sizeof(atom_list[0])) - - const char *names[ATOM_LIST_LENGTH]; - Atom atoms[ATOM_LIST_LENGTH]; - Status status; - size_t i; - - /* Fill the array of atom names */ - for (i = 0; i < ATOM_LIST_LENGTH; ++i) { - names[i] = atom_list[i].name; - } - - DTRACE_PRINT("WM: initializing atoms ... "); - status = XInternAtoms(awt_display, (char**)names, ATOM_LIST_LENGTH, - False, atoms); - if (status == 0) { - DTRACE_PRINTLN("failed"); - return; - } - - /* Store returned atoms into corresponding global variables */ - DTRACE_PRINTLN("ok"); - for (i = 0; i < ATOM_LIST_LENGTH; ++i) { - *atom_list[i].atomptr = atoms[i]; - } -#undef ATOM_LIST_LENGTH -} - - -/* - * When checking for various WMs don't intern certain atoms we use to - * distinguish those WMs. Rather check if the atom is interned first. - * If it's not, further tests are not necessary anyway. - * This also saves older JDK a great deal of confusion (4487993). - */ -static Boolean -awt_wm_atomInterned(Atom *pa, const char *name) -{ - DASSERT(pa != NULL); - if (*pa == None) { - DASSERT(name != NULL); - *pa = XInternAtom(awt_display, name, True); - if (*pa == None) { - DTRACE_PRINTLN1("\"%s\" is not interned", name); - return False; - } else { - return True; - } - } else { - return True; - } -} - - - -/*****************************************************************************\ - * - * DTRACE utils for various states ... - * -\*****************************************************************************/ - - -static void -awt_wm_dtraceWMState(uint32_t wm_state) -{ -#ifdef DEBUG - DTRACE_PRINT("WM_STATE = "); - switch (wm_state) { - case WithdrawnState: - DTRACE_PRINTLN("Withdrawn"); - break; - case NormalState: - DTRACE_PRINTLN("Normal"); - break; - case IconicState: - DTRACE_PRINTLN("Iconic"); - break; - default: - DTRACE_PRINTLN1("unknown state %d", wm_state); - break; - } -#endif /* DEBUG */ -} - -static void -awt_wm_dtraceStateNet(Atom *net_wm_state, unsigned long nitems) -{ -#ifdef DEBUG - unsigned long i; - - DTRACE_PRINT("_NET_WM_STATE = {"); - for (i = 0; i < nitems; ++i) { - char *name, *print_name; - name = XGetAtomName(awt_display, net_wm_state[i]); - if (name == NULL) { - print_name = "???"; - } else if (strncmp(name, "_NET_WM_STATE", 13) == 0) { - print_name = name + 13; /* skip common prefix to reduce noice */ - } else { - print_name = name; - } - DTRACE_PRINT1(" %s", print_name); - if (name) { - XFree(name); - } - } - DTRACE_PRINTLN(" }"); -#endif -} - - -static void -awt_wm_dtraceStateWin(uint32_t win_state) -{ -#ifdef DEBUG - DTRACE_PRINT("_WIN_STATE = {"); - if (win_state & WIN_STATE_STICKY) { - DTRACE_PRINT(" STICKY"); - } - if (win_state & WIN_STATE_MINIMIZED) { - DTRACE_PRINT(" MINIMIZED"); - } - if (win_state & WIN_STATE_MAXIMIZED_VERT) { - DTRACE_PRINT(" MAXIMIZED_VERT"); - } - if (win_state & WIN_STATE_MAXIMIZED_HORIZ) { - DTRACE_PRINT(" MAXIMIZED_HORIZ"); - } - if (win_state & WIN_STATE_HIDDEN) { - DTRACE_PRINT(" HIDDEN"); - } - if (win_state & WIN_STATE_SHADED) { - DTRACE_PRINT(" SHADED"); - } - DTRACE_PRINTLN(" }"); -#endif -} - - -static void -awt_wm_dtraceStateJava(jint java_state) -{ -#ifdef DEBUG - DTRACE_PRINT("java state = "); - if (java_state == java_awt_Frame_NORMAL) { - DTRACE_PRINTLN("NORMAL"); - } - else { - DTRACE_PRINT("{"); - if (java_state & java_awt_Frame_ICONIFIED) { - DTRACE_PRINT(" ICONIFIED"); - } - if ((java_state & java_awt_Frame_MAXIMIZED_BOTH) - == java_awt_Frame_MAXIMIZED_BOTH) - { - DTRACE_PRINT(" MAXIMIZED_BOTH"); - } - else if (java_state & java_awt_Frame_MAXIMIZED_HORIZ) { - DTRACE_PRINT(" MAXIMIZED_HORIZ"); - } - else if (java_state & java_awt_Frame_MAXIMIZED_VERT) { - DTRACE_PRINT(" MAXIMIZED_VERT"); - } - DTRACE_PRINTLN(" }"); - } -#endif /* DEBUG */ -} - - - -/*****************************************************************************\ - * - * Utility functions ... - * -\*****************************************************************************/ - -/* - * Instead of validating window id, we simply call XGetWindowProperty, - * but temporary install this function as the error handler to ignore - * BadWindow error. - */ -int /* but ingored */ -xerror_ignore_bad_window(Display *dpy, XErrorEvent *err) -{ - XERROR_SAVE(err); - if (err->error_code == BadWindow) { - DTRACE_PRINTLN("IGNORING BadWindow"); - return 0; /* ok to fail */ - } - else { - return (*xerror_saved_handler)(dpy, err); - } -} - - -/* - * Convenience wrapper for XGetWindowProperty for XA_ATOM properties. - * E.g. WM_PROTOCOLS, _NET_WM_STATE, _OL_DECOR_DEL. - * It's up to caller to XFree returned value. - * Number of items returned is stored to nitems_ptr (if non-null). - */ -static Atom * -awt_getAtomListProperty(Window w, Atom property, unsigned long *nitems_ptr) -{ - /* Request status */ - int status; - - /* Returns of XGetWindowProperty */ - Atom actual_type; - int actual_format; - unsigned long nitems_stub; - unsigned long bytes_after; - Atom *list; - - if (nitems_ptr == NULL) { - /* Caller is not interested in the number of items, - provide a stub for XGetWindowProperty */ - nitems_ptr = &nitems_stub; - } - - status = XGetWindowProperty(awt_display, w, - property, 0, 0xFFFF, False, XA_ATOM, - &actual_type, &actual_format, nitems_ptr, &bytes_after, - (unsigned char **)&list); - - if (status != Success || list == NULL) { - *nitems_ptr = 0; - return NULL; - } - - if (actual_type != XA_ATOM || actual_format != 32) { - XFree(list); - *nitems_ptr = 0; - return NULL; - } - - if (*nitems_ptr == 0) { - XFree(list); - return NULL; - } - - return list; -} - - -/* - * Auxiliary function that returns the value of 'property' of type - * 'property_type' on window 'w'. Format of the property must be 8. - * Terminating zero added by XGetWindowProperty is preserved. - * It's up to caller to XFree the result. - */ -static unsigned char * -awt_getProperty8(Window w, Atom property, Atom property_type) -{ - /* Request status */ - int status; - - /* Returns of XGetWindowProperty */ - Atom actual_type; - int actual_format; - unsigned long nitems; - unsigned long bytes_after; - unsigned char *string; - - /* BadWindow is ok and will be blocked by our special handler */ - WITH_XERROR_HANDLER(xerror_ignore_bad_window); - { - status = XGetWindowProperty(awt_display, w, - property, 0, 0xFFFF, False, property_type, - &actual_type, &actual_format, &nitems, &bytes_after, - &string); - } - RESTORE_XERROR_HANDLER; - - if (status != Success || string == NULL) { - return NULL; - } - - if (actual_type != property_type || actual_format != 8) { - XFree(string); - return NULL; - } - - /* XGetWindowProperty kindly supplies terminating zero */ - return string; -} - - -/* - * Auxiliary function that returns the value of 'property' of type - * 'property_type' on window 'w'. Format of the property must be 32. - */ -static int32_t -awt_getProperty32(Window w, Atom property, Atom property_type) -{ - /* Property value*/ - int32_t value; - - /* Request status */ - int status; - - /* Returns of XGetWindowProperty */ - Atom actual_type; - int actual_format; - unsigned long nitems; - unsigned long bytes_after; - long *data; /* NB: 64 bit: Format 32 props are 'long' */ - - /* BadWindow is ok and will be blocked by our special handler */ - WITH_XERROR_HANDLER(xerror_ignore_bad_window); - { - status = XGetWindowProperty(awt_display, w, - property, 0, 1, False, property_type, - &actual_type, &actual_format, &nitems, &bytes_after, - (unsigned char **)&data); - } - RESTORE_XERROR_HANDLER; - - if (status != Success || data == NULL) { - return 0; - } - - if (actual_type != property_type || actual_format != 32) { - XFree(data); /* NULL data already catched above */ - return 0; - } - - value = (int32_t)*data; - XFree(data); - - return value; -} - - - -/*****************************************************************************\ - * - * Detecting WM ... - * -\*****************************************************************************/ - - - -/* - * Check for anchor_prop(anchor_type) on root, take the value as the - * window id and check if that window exists and has anchor_prop(anchor_type) - * with the same value (i.e. pointing back to self). - * - * Returns the anchor window, as some WM may put interesting stuff in - * its properties (e.g. sawfish). - */ -static Window -awt_wm_checkAnchor(Atom anchor_prop, Atom anchor_type) -{ - Window root_xref; - Window self_xref; - - root_xref = (Window)awt_getProperty32(DefaultRootWindow(awt_display), - anchor_prop, anchor_type); - if (root_xref == None) { - DTRACE_PRINTLN("no"); - return None; - } - - DTRACE_PRINT1("0x%x ... ", (unsigned int)root_xref); - self_xref = (Window)awt_getProperty32(root_xref, - anchor_prop, anchor_type); - if (self_xref != root_xref) { - DTRACE_PRINTLN("stale"); - return None; - } - - DTRACE_PRINTLN("ok"); - return self_xref; -} - - -/* - * New WM spec: KDE 2.0.1, sawfish 0.3x, ... - * - */ -static Window -awt_wm_isNetSupporting(void) -{ - static Boolean checked = False; - static Window isNetSupporting = None; - - if (checked) { - return isNetSupporting; - } - - DTRACE_PRINT("WM: checking for _NET_SUPPORTING ... "); - isNetSupporting = awt_wm_checkAnchor(_XA_NET_SUPPORTING_WM_CHECK, - XA_WINDOW); - checked = True; - return isNetSupporting; -} - - -/* - * Old Gnome WM spec: WindowMaker, Enlightenment, IceWM ... - * - */ -static Window -awt_wm_isWinSupporting(void) -{ - static Boolean checked = False; - static Window isWinSupporting = None; - - if (checked) { - return isWinSupporting; - } - - DTRACE_PRINT("WM: checking for _WIN_SUPPORTING ... "); - isWinSupporting = awt_wm_checkAnchor(_XA_WIN_SUPPORTING_WM_CHECK, - XA_CARDINAL); - checked = True; - return isWinSupporting; -} - - -/* - * Check that that the list of protocols specified by WM in property - * named LIST_NAME on the root window contains protocol PROTO. - */ -static Boolean -awt_wm_checkProtocol(Atom list_name, Atom proto) -{ - Atom *protocols; - unsigned long nproto; - Boolean found; - unsigned long i; - - protocols = awt_getAtomListProperty(DefaultRootWindow(awt_display), - list_name, &nproto); - if (protocols == NULL) { - return False; - } - - found = False; - for (i = 0; i < nproto; ++i) { - if (protocols[i] == proto) { - found = True; - break; - } - } - - if (protocols != NULL) { - XFree(protocols); - } - return found; -} - -static Boolean -awt_wm_doStateProtocolNet(void) -{ - static Boolean checked = False; - static Boolean supported = False; - - if (checked) { - return supported; - } - - if (awt_wm_isNetSupporting()) { - DTRACE_PRINT("WM: checking for _NET_WM_STATE in _NET_SUPPORTED ... "); - supported = awt_wm_checkProtocol(_XA_NET_SUPPORTED, _XA_NET_WM_STATE); - DTRACE_PRINTLN1("%s", supported ? "yes" : "no"); - } - - checked = True; - return supported; -} - -static Boolean -awt_wm_doStateProtocolWin(void) -{ - static Boolean checked = False; - static Boolean supported = False; - - if (checked) { - return supported; - } - - if (awt_wm_isWinSupporting()) { - DTRACE_PRINT("WM: checking for _WIN_STATE in _WIN_PROTOCOLS ... "); - supported = awt_wm_checkProtocol(_XA_WIN_PROTOCOLS, _XA_WIN_STATE); - DTRACE_PRINTLN1("%s", supported ? "yes" : "no"); - } - checked = True; - return supported; -} - - - -/* - * Helper function for awt_wm_isEnlightenment. - * Enlightenment uses STRING property for its comms window id. Gaaa! - * The property is ENLIGHTENMENT_COMMS, STRING/8 and the string format - * is "WINID %8x". Gee, I haven't been using scanf for *ages*... :-) - */ -static Window -awt_getECommsWindowIDProperty(Window w) -{ - static Atom XA_ENLIGHTENMENT_COMMS = None; - - /* Property value*/ - Window value; - - /* Request status */ - int status; - - /* Returns of XGetWindowProperty */ - Atom actual_type; - int actual_format; - unsigned long nitems; - unsigned long bytes_after; - unsigned char *data; - - if (!awt_wm_atomInterned(&XA_ENLIGHTENMENT_COMMS, "ENLIGHTENMENT_COMMS")) { - return False; - } - - /* BadWindow is ok and will be blocked by our special handler */ - WITH_XERROR_HANDLER(xerror_ignore_bad_window); - { - status = XGetWindowProperty(awt_display, w, - XA_ENLIGHTENMENT_COMMS, 0, 14, False, XA_STRING, - &actual_type, &actual_format, &nitems, &bytes_after, - &data); - } - RESTORE_XERROR_HANDLER; - - if (status != Success || data == NULL) { - DTRACE_PRINTLN("no ENLIGHTENMENT_COMMS"); - return None; - } - - if (actual_type != XA_STRING || actual_format != 8 - || nitems != 14 || bytes_after != 0) - { - DTRACE_PRINTLN("malformed ENLIGHTENMENT_COMMS"); - XFree(data); /* NULL data already catched above */ - return None; - } - - value = None; - sscanf((char *)data, "WINID %8lx", &value); /* NB: 64 bit: XID is long */ - XFree(data); - - return value; -} - - -/* - * Is Enlightenment WM running? Congruent to awt_wm_checkAnchor, but - * uses STRING property peculiar to Enlightenment. - */ -static Boolean -awt_wm_isEnlightenment(void) -{ - Window root_xref; - Window self_xref; - - DTRACE_PRINT("WM: checking for Enlightenment ... "); - root_xref = awt_getECommsWindowIDProperty(DefaultRootWindow(awt_display)); - if (root_xref == None) { - return False; - } - - DTRACE_PRINT1("0x%x ... ", root_xref); - self_xref = awt_getECommsWindowIDProperty(root_xref); - if (self_xref != root_xref) { - return False; - } - - DTRACE_PRINTLN("ok"); - return True; -} - - -/* - * Is CDE running? - * - * XXX: This is hairy... CDE is MWM as well. It seems we simply test - * for default setup and will be bitten if user changes things... - * - * Check for _DT_SM_WINDOW_INFO(_DT_SM_WINDOW_INFO) on root. Take the - * second element of the property and check for presence of - * _DT_SM_STATE_INFO(_DT_SM_STATE_INFO) on that window. - * - * XXX: Any header that defines this structures??? - */ -static Boolean -awt_wm_isCDE(void) -{ - static Atom _XA_DT_SM_WINDOW_INFO = None; - static Atom _XA_DT_SM_STATE_INFO = None; - - /* Property value*/ - Window wmwin; - - /* Request status */ - int status; - - /* Returns of XGetWindowProperty */ - Atom actual_type; - int actual_format; - unsigned long nitems; - unsigned long bytes_after; - long *data; /* NB: 64 bit: Format 32 props are 'long' */ - - DTRACE_PRINT("WM: checking for CDE ... "); - - if (!awt_wm_atomInterned(&_XA_DT_SM_WINDOW_INFO, "_DT_SM_WINDOW_INFO")) { - return False; - } - - status = XGetWindowProperty(awt_display, DefaultRootWindow(awt_display), - _XA_DT_SM_WINDOW_INFO, 0, 2, False, _XA_DT_SM_WINDOW_INFO, - &actual_type, &actual_format, &nitems, &bytes_after, - (unsigned char **)&data); - - if (status != Success || data == NULL) { - DTRACE_PRINTLN("no _DT_SM_WINDOW_INFO on root"); - return False; - } - - if (actual_type != _XA_DT_SM_WINDOW_INFO || actual_format != 32 - || nitems != 2 || bytes_after != 0) - { - DTRACE_PRINTLN("malformed _DT_SM_WINDOW_INFO on root"); - XFree(data); /* NULL data already catched above */ - return False; - } - - wmwin = (Window)data[1]; - XFree(data); - - /* Now check that this window has _DT_SM_STATE_INFO (ignore contents) */ - - if (!awt_wm_atomInterned(&_XA_DT_SM_STATE_INFO, "_DT_SM_STATE_INFO")) { - return False; - } - - /* BadWindow is ok and will be blocked by our special handler */ - WITH_XERROR_HANDLER(xerror_ignore_bad_window); - { - status = XGetWindowProperty(awt_display, wmwin, - _XA_DT_SM_STATE_INFO, 0, 1, False, _XA_DT_SM_STATE_INFO, - &actual_type, &actual_format, &nitems, &bytes_after, - (unsigned char **)&data); - } - RESTORE_XERROR_HANDLER; - - if (status != Success || data == NULL) { - DTRACE_PRINTLN("no _DT_SM_STATE_INFO"); - return False; - } - - if (actual_type != _XA_DT_SM_STATE_INFO || actual_format != 32) { - DTRACE_PRINTLN("malformed _DT_SM_STATE_INFO"); - XFree(data); /* NULL data already catched above */ - return False; - } - - DTRACE_PRINTLN("yes"); - XFree(data); - return True; -} - -/* - * Is MWM running? (Note that CDE will test positive as well). - * - * Check for _MOTIF_WM_INFO(_MOTIF_WM_INFO) on root. Take the - * second element of the property and check for presence of - * _DT_SM_STATE_INFO(_DT_SM_STATE_INFO) on that window. - */ -static Boolean -awt_wm_isMotif(void) -{ - /* - * Grr. Motif just had to be different, ain't it!? Everyone use - * "XA" for things of type Atom, but motif folks chose to define - * _XA_MOTIF_* to be atom *names*. How pathetic... - */ -#undef _XA_MOTIF_WM_INFO - static Atom _XA_MOTIF_WM_INFO = None; - static Atom _XA_DT_WORKSPACE_CURRENT = None; - - /* Property value */ - Window wmwin; - Atom *curws; - - /* Request status */ - int status; - - /* Returns of XGetWindowProperty */ - Atom actual_type; - int actual_format; - unsigned long nitems; - unsigned long bytes_after; - long *data; /* NB: 64 bit: Format 32 props are 'long' */ - - DTRACE_PRINT("WM: checking for MWM ... "); - - if (!awt_wm_atomInterned(&_XA_MOTIF_WM_INFO, "_MOTIF_WM_INFO") - || !awt_wm_atomInterned(&_XA_DT_WORKSPACE_CURRENT, "_DT_WORKSPACE_CURRENT")) - { - return False; - } - - - status = XGetWindowProperty(awt_display, DefaultRootWindow(awt_display), - _XA_MOTIF_WM_INFO, 0, PROP_MOTIF_WM_INFO_ELEMENTS, False, - _XA_MOTIF_WM_INFO, &actual_type, - &actual_format, &nitems, &bytes_after, - (unsigned char **)&data); - - if (status != Success || data == NULL) { - DTRACE_PRINTLN("no _MOTIF_WM_INFO on root"); - return False; - } - - if (actual_type != _XA_MOTIF_WM_INFO || actual_format != 32 - || nitems != PROP_MOTIF_WM_INFO_ELEMENTS || bytes_after != 0) - { - DTRACE_PRINTLN("malformed _MOTIF_WM_INFO on root"); - XFree(data); /* NULL data already catched above */ - return False; - } - - /* NB: 64 bit: Cannot cast data to MotifWmInfo */ - wmwin = (Window)data[1]; - XFree(data); - - /* Now check that this window has _DT_WORKSPACE_CURRENT */ - curws = awt_getAtomListProperty(wmwin, _XA_DT_WORKSPACE_CURRENT, NULL); - if (curws == NULL) { - DTRACE_PRINTLN("no _DT_WORKSPACE_CURRENT"); - return False; - } - - DTRACE_PRINTLN("yes"); - XFree(curws); - return True; -} - - -static Boolean -awt_wm_isNetWMName(char *name) -{ - Window anchor; - unsigned char *net_wm_name; - Boolean matched; - - anchor = awt_wm_isNetSupporting(); - if (anchor == None) { - return False; - } - - DTRACE_PRINT1("WM: checking for %s by _NET_WM_NAME ... ", name); - - /* - * Check both UTF8_STRING and STRING. We only call this function - * with ASCII names and UTF8 preserves ASCII bit-wise. wm-spec - * mandates UTF8_STRING for _NET_WM_NAME but at least sawfish-1.0 - * still uses STRING. (mmm, moving targets...). - */ - net_wm_name = awt_getProperty8(anchor, _XA_NET_WM_NAME, XA_UTF8_STRING); - if (net_wm_name == NULL) { - net_wm_name = awt_getProperty8(anchor, _XA_NET_WM_NAME, XA_STRING); - } - - if (net_wm_name == NULL) { - DTRACE_PRINTLN("no (missing _NET_WM_NAME)"); - return False; - } - - matched = (strcmp((char *)net_wm_name, name) == 0); - if (matched) { - DTRACE_PRINTLN("yes"); - } else { - DTRACE_PRINTLN1("no (_NET_WM_NAME = \"%s\")", net_wm_name); - } - XFree(net_wm_name); - return matched; -} - -/* - * Is Sawfish running? - */ -static Boolean -awt_wm_isSawfish(void) -{ - return awt_wm_isNetWMName("Sawfish"); -} - -/* - * Is KDE2 (KWin) running? - */ -static Boolean -awt_wm_isKDE2(void) -{ - return awt_wm_isNetWMName("KWin"); -} - - -/* - * Is Metacity running? - */ -static Boolean -awt_wm_isMetacity(void) -{ - return awt_wm_isNetWMName("Metacity"); -} - - -/* - * Temporary error handler that ensures that we know if - * XChangeProperty succeeded or not. - */ -static int /* but ignored */ -xerror_verify_change_property(Display *dpy, XErrorEvent *err) -{ - XERROR_SAVE(err); - if (err->request_code == X_ChangeProperty) { - return 0; - } - else { - return (*xerror_saved_handler)(dpy, err); - } -} - - -/* - * Prepare IceWM check. - * - * The only way to detect IceWM, seems to be by setting - * _ICEWM_WINOPTHINT(_ICEWM_WINOPTHINT/8) on root and checking if it - * was immediately deleted by IceWM. - * - * But messing with PropertyNotify here is way too much trouble, so - * approximate the check by setting the property in this function and - * checking if it still exists later on. - * - * Gaa, dirty dances... - */ -static Boolean -awt_wm_prepareIsIceWM(void) -{ - static Atom _XA_ICEWM_WINOPTHINT = None; - - /* - * Choose something innocuous: "AWT_ICEWM_TEST allWorkspaces 0". - * IceWM expects "class\0option\0arg\0" with zero bytes as delimiters. - */ - static unsigned char opt[] = { - 'A','W','T','_','I','C','E','W','M','_','T','E','S','T','\0', - 'a','l','l','W','o','r','k','s','p','a','c','e','s','\0', - '0','\0' - }; - - DTRACE_PRINT("WM: scheduling check for IceWM ... "); - - if (!awt_wm_atomInterned(&_XA_ICEWM_WINOPTHINT, "_ICEWM_WINOPTHINT")) { - return False; - } - - WITH_XERROR_HANDLER(xerror_verify_change_property); - { - XChangeProperty(awt_display, DefaultRootWindow(awt_display), - _XA_ICEWM_WINOPTHINT, _XA_ICEWM_WINOPTHINT, 8, - PropModeReplace, opt, sizeof(opt)); - } - RESTORE_XERROR_HANDLER; - - if (xerror_code != Success) { - DTRACE_PRINTLN1("can't set _ICEWM_WINOPTHINT, error = %d", - xerror_code); - return False; - } - else { - DTRACE_PRINTLN("scheduled"); - return True; - } -} - -/* - * Is IceWM running? - * - * Note well: Only call this if awt_wm_prepareIsIceWM succeeded, or a - * false positive will be reported. - */ -static Boolean -awt_wm_isIceWM(void) -{ - static Atom _XA_ICEWM_WINOPTHINT = None; - - /* Request status */ - int status; - - /* Returns of XGetWindowProperty */ - Atom actual_type; - int actual_format; - unsigned long nitems; - unsigned long bytes_after; - unsigned char *data; - - DTRACE_PRINT("WM: checking for IceWM ... "); - - if (!awt_wm_atomInterned(&_XA_ICEWM_WINOPTHINT, "_ICEWM_WINOPTHINT")) { - return False; - } - - XGetWindowProperty(awt_display, DefaultRootWindow(awt_display), - _XA_ICEWM_WINOPTHINT, 0, 0xFFFF, True, /* NB: deleting! */ - _XA_ICEWM_WINOPTHINT, &actual_type, - &actual_format, &nitems, &bytes_after, - &data); - - if (data != NULL) { - XFree(data); - } - - if (actual_type == None) { - DTRACE_PRINTLN("yes"); - return True; - } - else { - DTRACE_PRINTLN("no"); - return False; - } -} - -/* - * Is OpenLook WM running? - * - * This one is pretty lame, but the only property peculiar to OLWM is - * _SUN_WM_PROTOCOLS(ATOM[]). Fortunately, olwm deletes it on exit. - */ -static Boolean -awt_wm_isOpenLook(void) -{ - static Atom _XA_SUN_WM_PROTOCOLS = None; - Atom *list; - - DTRACE_PRINT("WM: checking for OpenLook WM ... "); - - if (!awt_wm_atomInterned(&_XA_SUN_WM_PROTOCOLS, "_SUN_WM_PROTOCOLS")) { - return False; - } - - list = awt_getAtomListProperty(DefaultRootWindow(awt_display), - _XA_SUN_WM_PROTOCOLS, NULL); - if (list == NULL) { - DTRACE_PRINTLN("no _SUN_WM_PROTOCOLS on root"); - return False; - } - - DTRACE_PRINTLN("yes"); - XFree(list); - return True; -} - - - -static Boolean winmgr_running = False; - -/* - * Temporary error handler that checks if selecting for - * SubstructureRedirect failed. - */ -static int /* but ignored */ -xerror_detect_wm(Display *dpy, XErrorEvent *err) -{ - XERROR_SAVE(err); - if (err->request_code == X_ChangeWindowAttributes - && err->error_code == BadAccess) - { - DTRACE_PRINTLN("some WM is running (hmm, we'll see)"); - winmgr_running = True; - return 0; - } - else { - return (*xerror_saved_handler)(dpy, err); - } -} - - -/* - * Make an educated guess about running window manager. - * XXX: ideally, we should detect wm restart. - */ -enum wmgr_t -awt_wm_getRunningWM(void) -{ - /* - * Ideally, we should support cases when a different WM is started - * during a Java app lifetime. - */ - static enum wmgr_t awt_wmgr = UNDETERMINED_WM; - - XSetWindowAttributes substruct; - const char *vendor_string; - Boolean doIsIceWM; - - if (awt_wmgr != UNDETERMINED_WM) { - return awt_wmgr; - } - - /* - * Quick checks for specific servers. - */ - vendor_string = ServerVendor(awt_display); - if (strstr(vendor_string, "eXcursion") != NULL) { - /* - * Use NO_WM since in all other aspects eXcursion is like not - * having a window manager running. I.e. it does not reparent - * top level shells. - */ - DTRACE_PRINTLN("WM: eXcursion detected - treating as NO_WM"); - awt_wmgr = NO_WM; - return awt_wmgr; - } - - /* - * If *any* window manager is running? - * - * Try selecting for SubstructureRedirect, that only one client - * can select for, and if the request fails, than some other WM is - * already running. - */ - winmgr_running = 0; - substruct.event_mask = SubstructureRedirectMask; - - DTRACE_PRINT("WM: trying SubstructureRedirect ... "); - WITH_XERROR_HANDLER(xerror_detect_wm); - { - XChangeWindowAttributes(awt_display, DefaultRootWindow(awt_display), - CWEventMask, &substruct); - } - RESTORE_XERROR_HANDLER; - - /* - * If no WM is running than our selection for SubstructureRedirect - * succeeded and needs to be undone (hey we are *not* a WM ;-). - */ - if (!winmgr_running) { - DTRACE_PRINTLN("no WM is running"); - awt_wmgr = NO_WM; - substruct.event_mask = 0; - XChangeWindowAttributes(awt_display, DefaultRootWindow(awt_display), - CWEventMask, &substruct); - return NO_WM; - } - - /* actual check for IceWM to follow below */ - doIsIceWM = awt_wm_prepareIsIceWM(); /* and let IceWM to act */ - - if (awt_wm_isNetSupporting()) { - awt_wm_doStateProtocolNet(); - } - if (awt_wm_isWinSupporting()) { - awt_wm_doStateProtocolWin(); - } - - /* - * Ok, some WM is out there. Check which one by testing for - * "distinguishing" atoms. - */ - if (doIsIceWM && awt_wm_isIceWM()) { - awt_wmgr = ICE_WM; - } - else if (awt_wm_isEnlightenment()) { - awt_wmgr = ENLIGHTEN_WM; - } - else if (awt_wm_isMetacity()) { - awt_wmgr = METACITY_WM; - } - else if (awt_wm_isSawfish()) { - awt_wmgr = SAWFISH_WM; - } - else if (awt_wm_isKDE2()) { - awt_wmgr = KDE2_WM; - } - /* - * We don't check for legacy WM when we already know that WM - * supports WIN or _NET wm spec. - */ - else if (awt_wm_isNetSupporting()) { - DTRACE_PRINTLN("WM: other WM (supports _NET)"); - awt_wmgr = OTHER_WM; - } - else if (awt_wm_isWinSupporting()) { - DTRACE_PRINTLN("WM: other WM (supports _WIN)"); - awt_wmgr = OTHER_WM; - } - /* - * Check for legacy WMs. - */ - else if (awt_wm_isCDE()) { /* XXX: must come before isMotif */ - awt_wmgr = CDE_WM; - } - else if (awt_wm_isMotif()) { - awt_wmgr = MOTIF_WM; - } - else if (awt_wm_isOpenLook()) { - awt_wmgr = OPENLOOK_WM; - } - else { - DTRACE_PRINTLN("WM: some other legacy WM"); - awt_wmgr = OTHER_WM; - } - - return awt_wmgr; -} - - -/* - * Some buggy WMs ignore window gravity when processing - * ConfigureRequest and position window as if the gravity is Static. - * We work around this in MWindowPeer.pReshape(). - */ -Boolean -awt_wm_configureGravityBuggy(void) -{ - static int env_not_checked = 1; - static int env_buggy = 0; - - if (env_not_checked) { - DTRACE_PRINT("WM: checking for _JAVA_AWT_WM_STATIC_GRAVITY in environment ... "); - if (getenv("_JAVA_AWT_WM_STATIC_GRAVITY") != NULL) { - DTRACE_PRINTLN("set"); - env_buggy = 1; - } else { - DTRACE_PRINTLN("no"); - } - env_not_checked = 0; - } - - if (env_buggy) { - return True; - } - - switch (awt_wm_getRunningWM()) { - case ICE_WM: - /* - * See bug #228981 at IceWM's SourceForge pages. - * Latest stable version 1.0.8-6 still has this problem. - */ - return True; - - case ENLIGHTEN_WM: - /* At least E16 is buggy. */ - return True; - - default: - return False; - } -} - -/** - * Check if state is supported. - * Note that a compound state is always reported as not supported. - * Note also that MAXIMIZED_BOTH is considered not a compound state. - * Therefore, a compound state is just ICONIFIED | anything else. - * - */ -Boolean -awt_wm_supportsExtendedState(jint state) -{ - switch (state) { - case java_awt_Frame_MAXIMIZED_VERT: - case java_awt_Frame_MAXIMIZED_HORIZ: - /* - * WMs that talk NET/WIN protocol, but do not support - * unidirectional maximization. - */ - if (awt_wm_getRunningWM() == METACITY_WM) { - /* "This is a deliberate policy decision." -hp */ - return JNI_FALSE; - } - /* FALLTROUGH */ - case java_awt_Frame_MAXIMIZED_BOTH: - return (awt_wm_doStateProtocolNet() || awt_wm_doStateProtocolWin()); - default: - return JNI_FALSE; - } -} - - - - -/*****************************************************************************\ - * - * Size and decoration hints ... - * -\*****************************************************************************/ - - -/* - * Remove size hints specified by the mask. - * XXX: Why do we need this in the first place??? - */ -void -awt_wm_removeSizeHints(Widget shell, long mask) -{ - Display *dpy = XtDisplay(shell); - Window shell_win = XtWindow(shell); - XSizeHints *hints = XAllocSizeHints(); - long ignore = 0; - - if (hints == NULL) { - DTRACE_PRINTLN("WM: removeSizeHints FAILED to allocate XSizeHints"); - return; - } - - /* sanitize the mask, only do these hints */ - mask &= (PMaxSize|PMinSize|USPosition|PPosition); - - XGetWMNormalHints(dpy, shell_win, hints, &ignore); - if ((hints->flags & mask) == 0) { - XFree(hints); - return; - } - -#ifdef DEBUG - DTRACE_PRINT("WM: removing hints"); - - if (mask & PMaxSize) { - DTRACE_PRINT(" Max = "); - if (hints->flags & PMaxSize) { - DTRACE_PRINT2("%d x %d;", hints->max_width, hints->max_height); - } else { - DTRACE_PRINT("none;"); - } - } - - if (mask & PMinSize) { - DTRACE_PRINT(" Min = "); - if (hints->flags & PMinSize) { - DTRACE_PRINT2("%d x %d;", hints->min_width, hints->min_height); - } else { - DTRACE_PRINT("none;"); - } - } - - DTRACE_PRINTLN(""); -#endif - - hints->flags &= ~mask; - XSetWMNormalHints(dpy, shell_win, hints); - XFree(hints); -} - -/* - * - * - */ -static void -awt_wm_proclaimUrgency(struct FrameData *wdata) -{ - Display *dpy = XtDisplay(wdata->winData.shell); - Window shell_win = XtWindow(wdata->winData.shell); - - XWMHints *hints = XGetWMHints(dpy, shell_win); - if( hints == NULL ) { - /* For now just */ return; - } - if ((hints->flags & URGENCY_HINT) != 0) { - /* it's here already */ - XFree(hints); - return; - } - hints->flags |= URGENCY_HINT; - XSetWMHints(dpy, shell_win, hints); - XFree(hints); -} - -/* - * If MWM_DECOR_ALL bit is set, then the rest of the bit-mask is taken - * to be subtracted from the decorations. Normalize decoration spec - * so that we can map motif decor to something else bit-by-bit in the - * rest of the code. - */ -static int -awt_wm_normalizeMotifDecor(int decorations) -{ - int d; - - if (!(decorations & MWM_DECOR_ALL)) - return decorations; /* already normalized */ - - d = MWM_DECOR_BORDER |MWM_DECOR_RESIZEH | MWM_DECOR_TITLE - | MWM_DECOR_MENU | MWM_DECOR_MINIMIZE | MWM_DECOR_MAXIMIZE; - d &= ~decorations; - return d; -} - - -/* - * Infer OL properties from MWM decorations. - * Use _OL_DECOR_DEL(ATOM[]) to remove unwanted ones. - */ -static void -awt_wm_setOLDecor(struct FrameData *wdata, Boolean resizable, int decorations) -{ - Window shell_win = XtWindow(wdata->winData.shell); - Atom decorDel[3]; - int nitems; - - if (shell_win == None) { - DTRACE_PRINTLN("WM: setOLDecor - no window, returning"); - return; - } - - decorations = awt_wm_normalizeMotifDecor(decorations); - DTRACE_PRINT("WM: _OL_DECOR_DEL = {"); - - nitems = 0; - if (!(decorations & MWM_DECOR_TITLE)) { - DTRACE_PRINT(" _OL_DECOR_HEADER"); - decorDel[nitems++] = _XA_OL_DECOR_HEADER; - } - if (!(decorations & (MWM_DECOR_RESIZEH | MWM_DECOR_MAXIMIZE))) { - DTRACE_PRINT(" _OL_DECOR_RESIZE"); - decorDel[nitems++] = _XA_OL_DECOR_RESIZE; - } - if (!(decorations & (MWM_DECOR_MENU | MWM_DECOR_MAXIMIZE - | MWM_DECOR_MINIMIZE))) - { - DTRACE_PRINT(" _OL_DECOR_CLOSE"); - decorDel[nitems++] = _XA_OL_DECOR_CLOSE; - } - DTRACE_PRINT(" }"); - - if (nitems == 0) { - DTRACE_PRINTLN(" ... removing"); - XDeleteProperty(awt_display, shell_win, _XA_OL_DECOR_DEL); - } - else { - DTRACE_PRINTLN(" ... setting"); - XChangeProperty(awt_display, shell_win, - _XA_OL_DECOR_DEL, XA_ATOM, 32, - PropModeReplace, (unsigned char *)decorDel, nitems); - } -} - -/* - * Set MWM decorations. Infer MWM functions from decorations. - */ -static void -awt_wm_setMotifDecor(struct FrameData *wdata, Boolean resizable, int decorations) -{ - int functions; - - /* Apparently some WMs don't implement MWM_*_ALL semantic correctly */ - if ((decorations & MWM_DECOR_ALL) && (decorations != MWM_DECOR_ALL)) { - decorations = awt_wm_normalizeMotifDecor(decorations); - DTRACE_PRINTLN1("WM: setMotifDecor normalize exclusions, decor = 0x%X", - decorations); - } - - DTRACE_PRINT("WM: setMotifDecor functions = {"); - functions = 0; - - if (decorations & MWM_DECOR_ALL) { - DTRACE_PRINT(" ALL"); - functions |= MWM_FUNC_ALL; - } - else { - /* - * Functions we always want to be enabled as mwm(1) and - * descendants not only hide disabled functions away from - * user, but also ignore corresponding requests from the - * program itself (e.g. 4442047). - */ - DTRACE_PRINT(" CLOSE MOVE MINIMIZE"); - functions |= (MWM_FUNC_CLOSE | MWM_FUNC_MOVE | MWM_FUNC_MINIMIZE); - - if (resizable) { - DTRACE_PRINT(" RESIZE MAXIMIZE"); - functions |= MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE; - } - } - - DTRACE_PRINTLN(" }"); - - XtVaSetValues(wdata->winData.shell, - XmNmwmDecorations, decorations, - XmNmwmFunctions, functions, - NULL); -} - - -/* - * Under some window managers if shell is already mapped, we MUST - * unmap and later remap in order to effect the changes we make in the - * window manager decorations. - * - * N.B. This unmapping / remapping of the shell exposes a bug in - * X/Motif or the Motif Window Manager. When you attempt to map a - * widget which is positioned (partially) off-screen, the window is - * relocated to be entirely on screen. Good idea. But if both the x - * and the y coordinates are less than the origin (0,0), the first - * (re)map will move the window to the origin, and any subsequent - * (re)map will relocate the window at some other point on the screen. - * I have written a short Motif test program to discover this bug. - * This should occur infrequently and it does not cause any real - * problem. So for now we'll let it be. - */ -static Boolean -awt_wm_needRemap() -{ - switch (awt_wm_getRunningWM()) { -#if 0 /* XXX */ - case OPENLOOK_WM: - case MOTIF_WM: - case CDE_WM: - case ICE_WM: - case ENLIGHTEN_WM: - return True; -#endif - default: - return True; - } -} - -/* - * Set decoration hints on the shell to wdata->decor adjusted - * appropriately if not resizable. - */ -void -awt_wm_setShellDecor(struct FrameData *wdata, Boolean resizable) -{ - int decorations = wdata->decor; - - DTRACE_PRINTLN3("WM: setShellDecor(0x%x/0x%x, %s)", - wdata->winData.shell, XtWindow(wdata->winData.shell), - resizable ? "resizable" : "not resizable"); - - if (!resizable) { - if (decorations & MWM_DECOR_ALL) { - decorations |= (MWM_DECOR_RESIZEH | MWM_DECOR_MAXIMIZE); - } - else { - decorations &= ~(MWM_DECOR_RESIZEH | MWM_DECOR_MAXIMIZE); - } - } - - DTRACE_PRINTLN1("WM: decorations = 0x%X", decorations); - awt_wm_setMotifDecor(wdata, resizable, decorations); - awt_wm_setOLDecor(wdata, resizable, decorations); - - /* Some WMs need remap to redecorate the window */ - if (wdata->isShowing && awt_wm_needRemap()) { - /* - * Do the re/mapping at the Xlib level. Since we essentially - * work around a WM bug we don't want this hack to be exposed - * to Intrinsics (i.e. don't mess with grabs, callbacks etc). - */ - Display *dpy = XtDisplay(wdata->winData.shell); - Window shell_win = XtWindow(wdata->winData.shell); - - DTRACE_PRINT("WM: setShellDecor REMAPPING ... "); - XUnmapWindow(dpy, shell_win); - XSync(dpy, False); /* give WM a chance to catch up */ - XMapWindow(dpy, shell_win); - DTRACE_PRINTLN("done"); - } -} - - -/* - * Make specified shell resizable. - */ -void -awt_wm_setShellResizable(struct FrameData *wdata) -{ - DTRACE_PRINTLN2("WM: setShellResizable(0x%x/0x%x)", - wdata->winData.shell, XtWindow(wdata->winData.shell)); - - XtVaSetValues(wdata->winData.shell, - XmNallowShellResize, True, - XmNminWidth, XtUnspecifiedShellInt, - XmNminHeight, XtUnspecifiedShellInt, - XmNmaxWidth, XtUnspecifiedShellInt, - XmNmaxHeight, XtUnspecifiedShellInt, - NULL); - - /* REMINDER: will need to revisit when setExtendedStateBounds is added */ - awt_wm_removeSizeHints(wdata->winData.shell, PMinSize|PMaxSize); - - /* Restore decorations */ - awt_wm_setShellDecor(wdata, True); -} - - -/* - * Make specified shell non-resizable. - * If justChangeSize is false, update decorations as well. - */ -void -awt_wm_setShellNotResizable(struct FrameData *wdata, - int32_t width, int32_t height, - Boolean justChangeSize) -{ - DTRACE_PRINTLN5("WM: setShellNotResizable(0x%x/0x%x, %d, %d, %s)", - wdata->winData.shell, XtWindow(wdata->winData.shell), - width, height, - justChangeSize ? "size only" : "redecorate"); - - /* Fix min/max size hints at the specified values */ - if ((width > 0) && (height > 0)) { - XtVaSetValues(wdata->winData.shell, - XmNwidth, (XtArgVal)width, - XmNheight, (XtArgVal)height, - XmNminWidth, (XtArgVal)width, - XmNminHeight, (XtArgVal)height, - XmNmaxWidth, (XtArgVal)width, - XmNmaxHeight, (XtArgVal)height, - NULL); - } - - if (!justChangeSize) { /* update decorations */ - awt_wm_setShellDecor(wdata, False); - } -} - - -/* - * Helper function for awt_wm_getInsetsFromProp. - * Read property of type CARDINAL[4] = { left, right, top, bottom } - */ -static Boolean -awt_wm_readInsetsArray(Window shell_win, Atom insets_property, - int32_t *top, int32_t *left, int32_t *bottom, int32_t *right) -{ - /* Request status */ - int status; - - /* Returns of XGetWindowProperty */ - Atom actual_type; - int actual_format; - unsigned long nitems; - unsigned long bytes_after; - long *insets = NULL; /* NB: 64 bit: Format 32 props are 'long' */ - - status = XGetWindowProperty (awt_display, shell_win, - insets_property, 0, 4, False, XA_CARDINAL, - &actual_type, &actual_format, &nitems, &bytes_after, - (unsigned char **)&insets); - - if (status != Success || insets == NULL) { - DTRACE_PRINTLN("failed"); - return False; - } - - if (actual_type != XA_CARDINAL || actual_format != 32) { - DTRACE_PRINTLN("type/format mismatch"); - XFree(insets); - return False; - } - - *left = (int32_t)insets[0]; - *right = (int32_t)insets[1]; - *top = (int32_t)insets[2]; - *bottom = (int32_t)insets[3]; - XFree(insets); - - /* Order is that of java.awt.Insets.toString */ - DTRACE_PRINTLN4("[top=%d,left=%d,bottom=%d,right=%d]", - *top, *left, *bottom, *right); - return True; -} - -/* - * If WM implements the insets property - fill insets with values - * specified in that property. - */ -Boolean -awt_wm_getInsetsFromProp(Window shell_win, - int32_t *top, int32_t *left, int32_t *bottom, int32_t *right) -{ - switch (awt_wm_getRunningWM()) { - - case ENLIGHTEN_WM: - DTRACE_PRINT("WM: reading _E_FRAME_SIZE ... "); - return awt_wm_readInsetsArray(shell_win, _XA_E_FRAME_SIZE, - top, left, bottom, right); - -#if 0 - /* - * uwe: disabled for now, as KDE seems to supply bogus values - * when we maximize iconified frame. Need to verify with KDE2.1. - * NB: Also note, that "external" handles (e.g. in laptop decor) - * are also included in the frame strut, which is probably not - * what we want. - */ - case KDE2_WM: - DTRACE_PRINT("WM: reading _KDE_NET_WM_FRAME_STRUT ... "); - return awt_wm_readInsetsArray(shell_win, _XA_KDE_NET_WM_FRAME_STRUT, - top, left, bottom, right); -#endif - - default: - return False; - } -} - -/* - * XmNiconic and Map/UnmapNotify (that XmNiconic relies on) are - * unreliable, since mapping changes can happen for a virtual desktop - * switch or MacOS style shading that became quite popular under X as - * well. Yes, it probably should not be this way, as it violates - * ICCCM, but reality is that quite a lot of window managers abuse - * mapping state. - */ -int -awt_wm_getWMState(Window shell_win) -{ - /* Request status */ - int status; - - /* Returns of XGetWindowProperty */ - Atom actual_type; - int actual_format; - unsigned long nitems; - unsigned long bytes_after; - long *data; /* NB: 64 bit: Format 32 props are 'long' */ - - int wm_state; - - status = XGetWindowProperty(awt_display, shell_win, - XA_WM_STATE, 0, 1, False, XA_WM_STATE, - &actual_type, &actual_format, &nitems, &bytes_after, - (unsigned char **)&data); - - if (status != Success || data == NULL) { - return WithdrawnState; - } - - if (actual_type != XA_WM_STATE) { - DTRACE_PRINTLN1("WM: WM_STATE(0x%x) - wrong type", shell_win); - XFree(data); - return WithdrawnState; - } - - wm_state = (int)*data; - XFree(data); - return wm_state; -} - - - -/*****************************************************************************\ - * - * Reading state from properties WM puts on our window ... - * -\*****************************************************************************/ - -/* - * New "NET" WM spec: _NET_WM_STATE/Atom[] - */ -static jint -awt_wm_getStateNet(Window shell_win) -{ - Atom *net_wm_state; - jint java_state; - unsigned long nitems; - unsigned long i; - - net_wm_state = awt_getAtomListProperty(shell_win, _XA_NET_WM_STATE, &nitems); - if (nitems == 0) { - DTRACE_PRINTLN("WM: _NET_WM_STATE = { }"); - if (net_wm_state) { - XFree(net_wm_state); - } - return java_awt_Frame_NORMAL; - } -#ifdef DEBUG - DTRACE_PRINT("WM: "); - awt_wm_dtraceStateNet(net_wm_state, nitems); -#endif - - java_state = java_awt_Frame_NORMAL; - for (i = 0; i < nitems; ++i) { - if (net_wm_state[i] == _XA_NET_WM_STATE_MAXIMIZED_VERT) { - java_state |= java_awt_Frame_MAXIMIZED_VERT; - } - else if (net_wm_state[i] == _XA_NET_WM_STATE_MAXIMIZED_HORZ) { - java_state |= java_awt_Frame_MAXIMIZED_HORIZ; - } - } - XFree(net_wm_state); - return java_state; -} - -Boolean -awt_wm_isStateNetHidden(Window shell_win) -{ - Atom *net_wm_state; - Boolean result = False; - unsigned long nitems; - unsigned long i; - - net_wm_state = awt_getAtomListProperty(shell_win, _XA_NET_WM_STATE, &nitems); - if (nitems == 0) { - DTRACE_PRINTLN("WM: _NET_WM_STATE = { }"); - if (net_wm_state) { - XFree(net_wm_state); - } - return False; - } -#ifdef DEBUG - DTRACE_PRINT("WM: "); - awt_wm_dtraceStateNet(net_wm_state, nitems); -#endif - - for (i = 0; i < nitems; ++i) { - if (net_wm_state[i] == _XA_NET_WM_STATE_HIDDEN) { - result = True; - } - } - XFree(net_wm_state); - return result; -} - -/* - * Similar code to getStateNet, to get layer state. - */ -static int -awt_wm_getLayerNet(Window shell_win) -{ - Atom *net_wm_state; - int java_state; - unsigned long nitems; - unsigned long i; - - net_wm_state = awt_getAtomListProperty(shell_win, _XA_NET_WM_STATE, &nitems); - if (nitems == 0) { - DTRACE_PRINTLN("WM: _NET_WM_STATE = { }"); - if (net_wm_state) { - XFree(net_wm_state); - } - return LAYER_NORMAL; - } -#ifdef DEBUG - DTRACE_PRINT("WM: "); - awt_wm_dtraceStateNet(net_wm_state, nitems); -#endif - - java_state = LAYER_NORMAL; - for (i = 0; i < nitems; ++i) { - if (net_wm_state[i] == _XA_NET_WM_STATE_ABOVE) { - java_state = LAYER_ALWAYS_ON_TOP; - } - } - XFree(net_wm_state); - return java_state; -} - -/* - * Old Gnome spec: _WIN_STATE/CARDINAL - */ -static jint -awt_wm_getStateWin(Window shell_win) -{ - long win_state; - jint java_state; - - win_state = awt_getProperty32(shell_win, _XA_WIN_STATE, XA_CARDINAL); -#ifdef DEBUG - DTRACE_PRINT("WM: "); - awt_wm_dtraceStateWin(win_state); -#endif - - java_state = java_awt_Frame_NORMAL; - if (win_state & WIN_STATE_MAXIMIZED_VERT) { - java_state |= java_awt_Frame_MAXIMIZED_VERT; - } - if (win_state & WIN_STATE_MAXIMIZED_HORIZ) { - java_state |= java_awt_Frame_MAXIMIZED_HORIZ; - } - return java_state; -} - -/* - * Code similar to getStateWin, to get layer state. - */ -static int -awt_wm_getLayerWin(Window shell_win) -{ - long win_state; - jint java_state; - - win_state = awt_getProperty32(shell_win, _XA_WIN_LAYER, XA_CARDINAL); -#ifdef DEBUG - DTRACE_PRINT("WM: "); - awt_wm_dtraceStateWin(win_state); -#endif - - java_state = LAYER_NORMAL; - if (win_state == WIN_LAYER_ONTOP) { - java_state = LAYER_ALWAYS_ON_TOP; - } - return java_state; -} - - -static jint -awt_wm_getExtendedState(Window shell_win) -{ - if (awt_wm_doStateProtocolNet()) { - return awt_wm_getStateNet(shell_win); - } - else if (awt_wm_doStateProtocolWin()) { - return awt_wm_getStateWin(shell_win); - } - else { - return java_awt_Frame_NORMAL; - } -} - -jint -awt_wm_getState(struct FrameData *wdata) -{ - Window shell_win = XtWindow(wdata->winData.shell); - jint java_state; - - DTRACE_PRINTLN2("WM: getState(0x%x/0x%x)", - wdata->winData.shell, shell_win); - - if (shell_win == None) { - DTRACE_PRINTLN("WM: no window, use wdata"); - java_state = wdata->state; - } - else { - int wm_state = awt_wm_getWMState(shell_win); - if (wm_state == WithdrawnState) { - DTRACE_PRINTLN("WM: window withdrawn, use wdata"); - java_state = wdata->state; - } - else { -#ifdef DEBUG - DTRACE_PRINT("WM: "); - awt_wm_dtraceWMState(wm_state); -#endif - if (wm_state == IconicState) { - java_state = java_awt_Frame_ICONIFIED; - } else { - java_state = java_awt_Frame_NORMAL; - } - java_state |= awt_wm_getExtendedState(shell_win); - } - } - -#ifdef DEBUG - DTRACE_PRINT("WM: "); - awt_wm_dtraceStateJava(java_state); -#endif - - return java_state; -} - - - -/*****************************************************************************\ - * - * Notice window state change when WM changes a property on the window ... - * -\*****************************************************************************/ - - -/* - * Check if property change is a window state protocol message. - * If it is - return True and return the new state in *pstate. - */ -Boolean -awt_wm_isStateChange(struct FrameData *wdata, XPropertyEvent *e, jint *pstate) -{ - Window shell_win = XtWindow(wdata->winData.shell); - Boolean is_state_change = False; - int wm_state; - - if (!wdata->isShowing) { - return False; - } - - wm_state = awt_wm_getWMState(shell_win); - if (wm_state == WithdrawnState) { - return False; - } - - if (e->atom == XA_WM_STATE) { - is_state_change = True; - } - else if (e->atom == _XA_NET_WM_STATE) { - is_state_change = awt_wm_doStateProtocolNet(); - } - else if (e->atom == _XA_WIN_STATE) { - is_state_change = awt_wm_doStateProtocolWin(); - } - - if (is_state_change) { -#ifdef DEBUG - Widget shell = wdata->winData.shell; - char *name = XGetAtomName(XtDisplay(shell), e->atom); - DTRACE_PRINTLN4("WM: PropertyNotify(0x%x/0x%x) %s %s", - shell, XtWindow(shell), - name != NULL ? name : "???", - e->state == PropertyNewValue ? "changed" : "deleted"); - if (name != NULL) { - XFree(name); - } - DTRACE_PRINT("WM: "); - awt_wm_dtraceWMState(wm_state); -#endif - if (wm_state == IconicState) { - *pstate = java_awt_Frame_ICONIFIED; - } else { - *pstate = java_awt_Frame_NORMAL; - } - *pstate |= awt_wm_getExtendedState(shell_win); - -#ifdef DEBUG - DTRACE_PRINT("WM: "); - awt_wm_dtraceStateJava(*pstate); -#endif - } - - return is_state_change; -} - - - - -/*****************************************************************************\ - * - * Setting/changing window state ... - * -\*****************************************************************************/ - -/* - * Request a state transition from a _NET supporting WM by sending - * _NET_WM_STATE ClientMessage to root window. - */ -static void -awt_wm_requestStateNet(struct FrameData *wdata, jint state) -{ - Widget shell = wdata->winData.shell; - Window shell_win = XtWindow(shell); - XClientMessageEvent req; - jint old_net_state; - jint max_changed; - - /* must use awt_wm_setInitialStateNet for withdrawn windows */ - DASSERT(wdata->isShowing); - - /* - * We have to use toggle for maximization because of transitions - * from maximization in one direction only to maximization in the - * other direction only. - */ - old_net_state = awt_wm_getStateNet(shell_win); - max_changed = (state ^ old_net_state) & java_awt_Frame_MAXIMIZED_BOTH; - - switch (max_changed) { - case 0: - DTRACE_PRINTLN("WM: requestStateNet - maximization unchanged"); - return; - - case java_awt_Frame_MAXIMIZED_HORIZ: - DTRACE_PRINTLN("WM: requestStateNet - toggling MAX_HORZ"); - req.data.l[1] = _XA_NET_WM_STATE_MAXIMIZED_HORZ; - req.data.l[2] = 0; - break; - - case java_awt_Frame_MAXIMIZED_VERT: - DTRACE_PRINTLN("WM: requestStateNet - toggling MAX_VERT"); - req.data.l[1] = _XA_NET_WM_STATE_MAXIMIZED_VERT; - req.data.l[2] = 0; - break; - - default: /* both */ - DTRACE_PRINTLN("WM: requestStateNet - toggling HORZ + VERT"); - req.data.l[1] = _XA_NET_WM_STATE_MAXIMIZED_HORZ; - req.data.l[2] = _XA_NET_WM_STATE_MAXIMIZED_VERT; - break; - } - - req.type = ClientMessage; - req.window = XtWindow(shell); - req.message_type = _XA_NET_WM_STATE; - req.format = 32; - req.data.l[0] = _NET_WM_STATE_TOGGLE; - - XSendEvent(XtDisplay(shell), RootWindowOfScreen(XtScreen(shell)), False, - (SubstructureRedirectMask | SubstructureNotifyMask), - (XEvent *)&req); -} - - -/* - * Request state transition from a Gnome WM (_WIN protocol) by sending - * _WIN_STATE ClientMessage to root window. - */ -static void -awt_wm_requestStateWin(struct FrameData *wdata, jint state) -{ - Widget shell = wdata->winData.shell; - XClientMessageEvent req; - long win_state; /* typeof(XClientMessageEvent.data.l) */ - - /* must use awt_wm_setInitialStateWin for withdrawn windows */ - DASSERT(wdata->isShowing); - - win_state = 0; - if (state & java_awt_Frame_MAXIMIZED_VERT) { - win_state |= WIN_STATE_MAXIMIZED_VERT; - } - if (state & java_awt_Frame_MAXIMIZED_HORIZ) { - win_state |= WIN_STATE_MAXIMIZED_HORIZ; - } - - req.type = ClientMessage; - req.window = XtWindow(shell); - req.message_type = _XA_WIN_STATE; - req.format = 32; - req.data.l[0] = (WIN_STATE_MAXIMIZED_HORIZ | WIN_STATE_MAXIMIZED_VERT); - req.data.l[1] = win_state; - - XSendEvent(XtDisplay(shell), RootWindowOfScreen(XtScreen(shell)), False, - (SubstructureRedirectMask | SubstructureNotifyMask), - (XEvent *)&req); -} - - -/* - * Specify initial state for _NET supporting WM by setting - * _NET_WM_STATE property on the window to the desired state before - * mapping it. - */ -static void -awt_wm_setInitialStateNet(struct FrameData *wdata, jint state) -{ - Widget shell = wdata->winData.shell; - Window shell_win = XtWindow(shell); - Display *dpy = XtDisplay(shell); - - Atom *old_state; - unsigned long nitems; - - /* must use awt_wm_requestStateNet for managed windows */ - DASSERT(!wdata->isShowing); - - /* Be careful to not wipe out state bits we don't understand */ - old_state = awt_getAtomListProperty(shell_win, _XA_NET_WM_STATE, &nitems); - - if (nitems == 0) { - /* - * Empty or absent _NET_WM_STATE - set a new one if necessary. - */ - Atom net_wm_state[AWT_NET_N_KNOWN_STATES]; - - if (old_state != NULL) { - XFree(old_state); - } - - if (state & java_awt_Frame_MAXIMIZED_VERT) { - net_wm_state[nitems++] = _XA_NET_WM_STATE_MAXIMIZED_VERT; - } - if (state & java_awt_Frame_MAXIMIZED_HORIZ) { - net_wm_state[nitems++] = _XA_NET_WM_STATE_MAXIMIZED_HORZ; - } - DASSERT(nitems <= AWT_NET_N_KNOWN_STATES); - - if (nitems == 0) { - DTRACE_PRINTLN("WM: initial _NET_WM_STATE not necessary"); - return; - } - -#ifdef DEBUG - DTRACE_PRINT("WM: setting initial "); - awt_wm_dtraceStateNet(net_wm_state, nitems); -#endif - XChangeProperty(dpy, shell_win, - _XA_NET_WM_STATE, XA_ATOM, 32, PropModeReplace, - (unsigned char *)net_wm_state, nitems); - } - else { - /* - * Tweak existing _NET_WM_STATE, preserving bits we don't use. - */ - jint want= state /* which flags we want */ - & (java_awt_Frame_MAXIMIZED_HORIZ | java_awt_Frame_MAXIMIZED_VERT); - - jint has = 0; /* which flags the window already has */ - int mode; /* property mode: replace/append */ - - Atom *new_state; /* new _net_wm_state value */ - int new_nitems; - unsigned long i; - -#ifdef DEBUG - DTRACE_PRINT("WM: already has "); - awt_wm_dtraceStateNet(old_state, nitems); -#endif - - for (i = 0; i < nitems; ++i) { - if (old_state[i] == _XA_NET_WM_STATE_MAXIMIZED_HORZ) { - has |= java_awt_Frame_MAXIMIZED_HORIZ; - } - else if (old_state[i] == _XA_NET_WM_STATE_MAXIMIZED_VERT) { - has |= java_awt_Frame_MAXIMIZED_VERT; - } - } - - if ((has ^ want) == 0) { - DTRACE_PRINTLN("WM: no changes to _NET_WM_STATE necessary"); - XFree(old_state); - return; - } - - new_nitems = 0; - if (has == 0) { /* only adding flags */ - new_state = calloc(AWT_NET_N_KNOWN_STATES, sizeof(Atom)); - mode = PropModeAppend; - } - else { - new_state = calloc(nitems + AWT_NET_N_KNOWN_STATES, sizeof(Atom)); - mode = PropModeReplace; - } - - if (has != 0) { /* copy existing flags */ - DTRACE_PRINT("WM: "); - for (i = 0; i < nitems; ++i) { - if (old_state[i] == _XA_NET_WM_STATE_MAXIMIZED_HORZ) { - if (want & java_awt_Frame_MAXIMIZED_HORIZ) { - DTRACE_PRINT(" keep _HORZ"); - } else { - DTRACE_PRINT(" drop _HORZ"); - continue; - } - } - else if (old_state[i] == _XA_NET_WM_STATE_MAXIMIZED_VERT) { - if (want & java_awt_Frame_MAXIMIZED_VERT) { - DTRACE_PRINT(" keep _VERT"); - } else { - DTRACE_PRINT(" drop _VERT"); - continue; - } - } - new_state[new_nitems++] = old_state[i]; - } - } - - /* Add missing flags */ - if ((want & java_awt_Frame_MAXIMIZED_HORIZ) - && !(has & java_awt_Frame_MAXIMIZED_HORIZ)) - { - DTRACE_PRINT(" add _HORZ"); - new_state[new_nitems] = _XA_NET_WM_STATE_MAXIMIZED_HORZ; - ++new_nitems; - } - if ((want & java_awt_Frame_MAXIMIZED_VERT) - && !(has & java_awt_Frame_MAXIMIZED_VERT)) - { - DTRACE_PRINT(" add _VERT"); - new_state[new_nitems] = _XA_NET_WM_STATE_MAXIMIZED_VERT; - ++new_nitems; - } - - DTRACE_PRINTLN(mode == PropModeReplace ? - " ... replacing" : " ... appending"); - XChangeProperty(dpy, shell_win, - _XA_NET_WM_STATE, XA_ATOM, 32, mode, - (unsigned char *)new_state, new_nitems); - XFree(old_state); - XFree(new_state); - } -} - - -/* - * Specify initial state for a Gnome WM (_WIN protocol) by setting - * WIN_STATE property on the window to the desired state before - * mapping it. - */ -static void -awt_wm_setInitialStateWin(struct FrameData *wdata, jint state) -{ - Display *dpy = XtDisplay(wdata->winData.shell); - Window shell_win = XtWindow(wdata->winData.shell); - long win_state, old_win_state; - - /* must use awt_wm_requestStateWin for managed windows */ - DASSERT(!wdata->isShowing); - - /* Be careful to not wipe out state bits we don't understand */ - win_state = awt_getProperty32(shell_win, _XA_WIN_STATE, XA_CARDINAL); - old_win_state = win_state; -#ifdef DEBUG - if (win_state != 0) { - DTRACE_PRINT("WM: already has "); - awt_wm_dtraceStateWin(win_state); - } -#endif - - /* - * In their stupid quest of reinventing every wheel, Gnome WM spec - * have its own "minimized" hint (instead of using initial state - * and WM_STATE hints). This is bogus, but, apparently, some WMs - * pay attention. - */ - if (state & java_awt_Frame_ICONIFIED) { - win_state |= WIN_STATE_MINIMIZED; - } else { - win_state &= ~WIN_STATE_MINIMIZED; - } - - if (state & java_awt_Frame_MAXIMIZED_VERT) { - win_state |= WIN_STATE_MAXIMIZED_VERT; - } else { - win_state &= ~WIN_STATE_MAXIMIZED_VERT; - } - - if (state & java_awt_Frame_MAXIMIZED_HORIZ) { - win_state |= WIN_STATE_MAXIMIZED_HORIZ; - } else { - win_state &= ~WIN_STATE_MAXIMIZED_HORIZ; - } - - if (old_win_state ^ win_state) { -#ifdef DEBUG - DTRACE_PRINT("WM: setting initial "); - awt_wm_dtraceStateWin(win_state); -#endif - XChangeProperty(dpy, shell_win, - _XA_WIN_STATE, XA_CARDINAL, 32, PropModeReplace, - (unsigned char *)&win_state, 1); - } -#ifdef DEBUG - else { - DTRACE_PRINTLN("WM: no changes to _WIN_STATE necessary"); - } -#endif -} - -/* - * Request a layer change from a _NET supporting WM by sending - * _NET_WM_STATE ClientMessage to root window. - */ -static void -awt_wm_requestLayerNet(struct FrameData *wdata, int state) -{ - Widget shell = wdata->winData.shell; - Window shell_win = XtWindow(shell); - XClientMessageEvent req; - int currentLayer; - long cmd; - - /* must use awt_wm_setInitialLayerNet for withdrawn windows */ - DASSERT(wdata->isShowing); - - currentLayer = awt_wm_getLayerNet(shell_win); - if(state == currentLayer) { - return; - } - cmd = currentLayer == LAYER_ALWAYS_ON_TOP && state == LAYER_NORMAL ? - _NET_WM_STATE_REMOVE : - currentLayer == LAYER_NORMAL && state == LAYER_ALWAYS_ON_TOP ? - _NET_WM_STATE_ADD : - _NET_WM_STATE_ADD; - req.type = ClientMessage; - req.window = XtWindow(shell); - req.message_type = _XA_NET_WM_STATE; - req.format = 32; - req.data.l[0] = cmd; - req.data.l[1] = _XA_NET_WM_STATE_ABOVE; - req.data.l[2] = 0L; - - XSendEvent(XtDisplay(shell), RootWindowOfScreen(XtScreen(shell)), False, - (SubstructureRedirectMask | SubstructureNotifyMask), - (XEvent *)&req); -} - -/* - * Request a layer change from a Gnome WM (_WIN protocol) by sending - * _WIN_LAYER ClientMessage to root window. - */ -static void -awt_wm_requestLayerWin(struct FrameData *wdata, int state) -{ - Widget shell = wdata->winData.shell; - XClientMessageEvent req; - Display *dpy = XtDisplay(shell); - - /* must use awt_wm_setInitialLayerWin for withdrawn windows */ - DASSERT(wdata->isShowing); - - req.type = ClientMessage; - req.window = XtWindow(shell); - req.message_type = _XA_WIN_LAYER; - req.format = 32; - req.data.l[0] = state == LAYER_NORMAL ? WIN_LAYER_NORMAL : WIN_LAYER_ONTOP; - req.data.l[1] = 0L; - req.data.l[2] = 0L; - - XSendEvent(XtDisplay(shell), RootWindowOfScreen(XtScreen(shell)), False, - /*(SubstructureRedirectMask |*/ - SubstructureNotifyMask, - (XEvent *)&req); -} -/* - * Specify initial layer for _NET supporting WM by setting - * _NET_WM_STATE property on the window to the desired state before - * mapping it. - * NB: looks like it doesn't have any effect. - */ -static void -awt_wm_setInitialLayerNet(struct FrameData *wdata, int state) -{ - Widget shell = wdata->winData.shell; - Window shell_win = XtWindow(shell); - Display *dpy = XtDisplay(shell); - - Atom *old_state; - unsigned long nitems; - Atom new_state = _XA_NET_WM_STATE_ABOVE; - - /* must use awt_wm_requestLayerNet for managed windows */ - DASSERT(!wdata->isShowing); - - /* Be careful to not wipe out state bits we don't understand */ - old_state = awt_getAtomListProperty(shell_win, _XA_NET_WM_STATE, &nitems); - - if (nitems == 0 && state != LAYER_ALWAYS_ON_TOP) { - if (old_state != NULL) { - XFree(old_state); - } - return; - }else if( nitems == 0 && state == LAYER_ALWAYS_ON_TOP) { - unsigned long data[2]; - /* create new state */ - if (old_state != NULL) { - XFree(old_state); - } - nitems = 1; - data[0] = new_state; - data[1] = 0; - XChangeProperty(dpy, shell_win, - _XA_NET_WM_STATE, XA_ATOM, 32, PropModeReplace, - (unsigned char *)data, nitems); - XSync(dpy, False); - }else { /* nitems > 0 */ - unsigned long i; - Boolean bShift = False; - int mode; - for(i = 0; i < nitems; i++) { - if( bShift ) { - old_state[i-1] = old_state[i]; - }else if( old_state[i] == _XA_NET_WM_STATE_ABOVE ) { - if(state == LAYER_ALWAYS_ON_TOP) { - /* no change necessary */ - XFree(old_state); - return; - }else{ - /* wipe off this atom */ - bShift = True; - } - } - } - - if( bShift ) { - /* atom was found and removed: change property */ - mode = PropModeReplace; - nitems--; - }else if( state != LAYER_ALWAYS_ON_TOP ) { - /* atom was not found and not needed */ - XFree( old_state); - return; - }else { - /* must add new atom */ - mode = PropModeAppend; - nitems = 1; - } - - XChangeProperty(dpy, shell_win, - _XA_NET_WM_STATE, XA_ATOM, 32, mode, - mode == PropModeAppend ? - (unsigned char *)(&new_state) : - (unsigned char *)old_state, nitems); - XFree(old_state); - XSync(dpy, False); - } -} - -/* - * Specify initial layer for a Gnome WM (_WIN protocol) by setting - * WIN_LAYER property on the window to the desired state before - * mapping it. - */ -static void -awt_wm_setInitialLayerWin(struct FrameData *wdata, int state) -{ - Display *dpy = XtDisplay(wdata->winData.shell); - Window shell_win = XtWindow(wdata->winData.shell); - long win_state, old_win_state; - int currentLayer; - - /* must use awt_wm_requestLayerWin for managed windows */ - DASSERT(!wdata->isShowing); - - currentLayer = awt_wm_getLayerWin(shell_win); - if( currentLayer == state ) { - /* no change necessary */ - return; - } - if( state == LAYER_ALWAYS_ON_TOP ) { - win_state = WIN_LAYER_ONTOP; - }else { - win_state = WIN_LAYER_NORMAL; - } - - XChangeProperty(dpy, shell_win, - _XA_WIN_LAYER, XA_CARDINAL, 32, PropModeReplace, - (unsigned char *)&win_state, 1); -} - -void -awt_wm_setExtendedState(struct FrameData *wdata, jint state) -{ - Display *dpy = XtDisplay(wdata->winData.shell); - Window shell_win = XtWindow(wdata->winData.shell); - -#ifdef DEBUG - DTRACE_PRINT2("WM: setExtendedState(0x%x/0x%x) ", - wdata->winData.shell, shell_win); - awt_wm_dtraceStateJava(state); -#endif - - if (wdata->isShowing) { - /* - * If the window is managed by WM, we should send - * ClientMessage requests. - */ - if (awt_wm_doStateProtocolNet()) { - awt_wm_requestStateNet(wdata, state); - } - else if (awt_wm_doStateProtocolWin()) { - awt_wm_requestStateWin(wdata, state); - } - XSync(dpy, False); - } - else { - /* - * If the window is withdrawn we should set necessary - * properties directly to the window before mapping it. - */ - if (awt_wm_doStateProtocolNet()) { - awt_wm_setInitialStateNet(wdata, state); - } - else if (awt_wm_doStateProtocolWin()) { - awt_wm_setInitialStateWin(wdata, state); - } -#if 1 - /* - * Purge KWM bits. - * Not really tested with KWM, only with WindowMaker. - */ - XDeleteProperty(dpy, shell_win, XA_KWM_WIN_ICONIFIED); - XDeleteProperty(dpy, shell_win, XA_KWM_WIN_MAXIMIZED); -#endif /* 1 */ - } -} - -static Boolean -awt_wm_supportsLayersNet() { - Boolean supported = awt_wm_doStateProtocolNet(); - - /* - In fact, WM may report this not supported but do support. - */ - supported &= awt_wm_checkProtocol(_XA_NET_SUPPORTED, _XA_NET_WM_STATE_ABOVE); - return supported; -} - -static Boolean -awt_wm_supportsLayersWin() { - Boolean supported = awt_wm_doStateProtocolWin(); - /* - * In fact, WM may report this supported but do not support. - */ - supported &= awt_wm_checkProtocol(_XA_WIN_PROTOCOLS, _XA_WIN_LAYER); - return supported; -} - -void -awt_wm_updateAlwaysOnTop(struct FrameData *wdata, jboolean bLayerState) { - Display *dpy = XtDisplay(wdata->winData.shell); - Window shell_win = XtWindow(wdata->winData.shell); - int layerState = bLayerState ? LAYER_ALWAYS_ON_TOP : LAYER_NORMAL; - - if (wdata->isShowing) { - /** - We don't believe anyone, and now send both ClientMessage requests. - And eg Metacity under RH 6.1 required both to work. - **/ - awt_wm_requestLayerNet(wdata, layerState); - awt_wm_requestLayerWin(wdata, layerState); - } else { - /** - We don't believe anyone, and now set both atoms. - And eg Metacity under RH 6.1 required both to work. - **/ - awt_wm_setInitialLayerNet(wdata, layerState); - awt_wm_setInitialLayerWin(wdata, layerState); - } - XSync(dpy, False); -} - -/* - * Work around for 4775545. _NET version. - */ -static void -awt_wm_unshadeKludgeNet(struct FrameData *wdata) -{ - Display *dpy = XtDisplay(wdata->winData.shell); - Window shell_win = XtWindow(wdata->winData.shell); - Atom *net_wm_state; - Boolean shaded; - unsigned long nitems; - unsigned long i; - - net_wm_state = awt_getAtomListProperty(shell_win, - _XA_NET_WM_STATE, &nitems); - if (nitems == 0) { - DTRACE_PRINTLN("WM: _NET_WM_STATE = { }"); - if (net_wm_state) { - XFree(net_wm_state); - } - return; - } -#ifdef DEBUG - DTRACE_PRINT("WM: "); - awt_wm_dtraceStateNet(net_wm_state, nitems); -#endif - - shaded = False; - for (i = 0; i < nitems; ++i) { - if (net_wm_state[i] == _XA_NET_WM_STATE_SHADED) { - shaded = True; - break; - } - } - - if (!shaded) { - DTRACE_PRINTLN("WM: not _SHADED, no workaround necessary"); - return; - } - - DTRACE_PRINTLN("WM: removing _SHADED"); - ++i; /* skip _SHADED */ - while (i < nitems) { /* copy the rest */ - net_wm_state[i-1] = net_wm_state[i]; - ++i; - } - --nitems; /* _SHADED has been removed */ - -#ifdef DEBUG - DTRACE_PRINT("WM: "); - awt_wm_dtraceStateNet(net_wm_state, nitems); -#endif - - WITH_XERROR_HANDLER(xerror_verify_change_property); - { - XChangeProperty(dpy, shell_win, - _XA_NET_WM_STATE, XA_ATOM, 32, PropModeReplace, - (unsigned char *)net_wm_state, nitems); - } - RESTORE_XERROR_HANDLER; - - if (xerror_code != Success) { - DTRACE_PRINTLN1("WM: XChangeProperty failed, error = %d", - xerror_code); - } - - XFree(net_wm_state); -} - - -/* - * Work around for 4775545. _WIN version. - */ -static void -awt_wm_unshadeKludgeWin(struct FrameData *wdata) -{ - Display *dpy = XtDisplay(wdata->winData.shell); - Window shell_win = XtWindow(wdata->winData.shell); - long win_state; - - win_state = awt_getProperty32(shell_win, _XA_WIN_STATE, XA_CARDINAL); -#ifdef DEBUG - DTRACE_PRINT("WM: "); - awt_wm_dtraceStateWin(win_state); -#endif - - if ((win_state & WIN_STATE_SHADED) == 0) { - DTRACE_PRINTLN("WM: not _SHADED, no workaround necessary"); - return; - } - - win_state &= ~WIN_STATE_SHADED; - XChangeProperty(dpy, shell_win, - _XA_WIN_STATE, XA_CARDINAL, 32, PropModeReplace, - (unsigned char *)&win_state, 1); -} - - -/* - * Work around for 4775545. - * - * If WM exits while the top-level is shaded, the shaded hint remains - * on the top-level properties. When WM restarts and sees the shaded - * window it can reparent it into a "pre-shaded" decoration frame - * (Metacity does), and our insets logic will go crazy, b/c it will - * see a huge nagative bottom inset. There's no clean solution for - * this, so let's just be weasels and drop the shaded hint if we - * detect that WM exited. NB: we are in for a race condition with WM - * restart here. NB2: e.g. WindowMaker saves the state in a private - * property that this code knows nothing about, so this workaround is - * not effective; other WMs might play similar tricks. - */ -void -awt_wm_unshadeKludge(struct FrameData *wdata) -{ - DTRACE_PRINTLN("WM: unshade kludge"); - DASSERT(wdata->isShowing); - - if (awt_wm_doStateProtocolNet()) { - awt_wm_unshadeKludgeNet(wdata); - } - else if (awt_wm_doStateProtocolWin()) { - awt_wm_unshadeKludgeWin(wdata); - } -#ifdef DEBUG - else { - DTRACE_PRINTLN("WM: not a _NET or _WIN supporting WM"); - } -#endif - - XSync(XtDisplay(wdata->winData.shell), False); -} - - -void -awt_wm_init(void) -{ - static Boolean inited = False; - if (inited) { - return; - } - - awt_wm_initAtoms(); - awt_wm_getRunningWM(); - inited = True; -} - -Boolean awt_wm_supportsAlwaysOnTop() { - return awt_wm_supportsLayersNet() || awt_wm_supportsLayersWin(); -} diff --git a/jdk/src/solaris/native/sun/awt/awt_wm.h b/jdk/src/solaris/native/sun/awt/awt_wm.h deleted file mode 100644 index 6656e2bb9a29aaab4dd7e7d01a1b7c1100bab8b1..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/native/sun/awt/awt_wm.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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. - */ - -#ifndef _AWT_WM_H_ -#define _AWT_WM_H_ - -#ifndef HEADLESS - -#include "awt_p.h" - -/* - * Window Managers we care to distinguish. - * See awt_wm_getRunningWM() - */ -enum wmgr_t { - UNDETERMINED_WM, - NO_WM, - OTHER_WM, - OPENLOOK_WM, - MOTIF_WM, - CDE_WM, - ENLIGHTEN_WM, - KDE2_WM, - SAWFISH_WM, - ICE_WM, - METACITY_WM -}; - -extern void awt_wm_init(void); - -extern enum wmgr_t awt_wm_getRunningWM(void); -extern Boolean awt_wm_configureGravityBuggy(void); -extern Boolean awt_wm_supportsExtendedState(jint state); - -/* XWMHints.flags is declared long, so 'mask' argument is declared long too */ -extern void awt_wm_removeSizeHints(Widget shell, long mask); - -extern void awt_wm_setShellDecor(struct FrameData *wdata, Boolean resizable); -extern void awt_wm_setShellResizable(struct FrameData *wdata); -extern void awt_wm_setShellNotResizable(struct FrameData *wdata, - int32_t width, int32_t height, - Boolean justChangeSize); - -extern Boolean awt_wm_getInsetsFromProp(Window w, - int32_t *top, int32_t *left, int32_t *bottom, int32_t *right); - -/* - * WM_STATE: WithdrawnState, NormalState, IconicState. - * Absence of WM_STATE is treated as WithdrawnState. - */ -extern int awt_wm_getWMState(Window w); - -extern void awt_wm_setExtendedState(struct FrameData *wdata, jint state); -extern Boolean awt_wm_isStateChange(struct FrameData *wdata, XPropertyEvent *e, - jint *pstate); - -extern void awt_wm_unshadeKludge(struct FrameData *wdata); -extern void awt_wm_updateAlwaysOnTop(struct FrameData *wdata, jboolean bLayerState); -extern Boolean awt_wm_supportsAlwaysOnTop(); - -#endif /* !HEADLESS */ -#endif /* _AWT_WM_H_ */ diff --git a/jdk/src/solaris/native/sun/awt/awt_xembed.h b/jdk/src/solaris/native/sun/awt/awt_xembed.h deleted file mode 100644 index 42b9955b4c415ab4e820ba420684e1b52f531d15..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/native/sun/awt/awt_xembed.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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. - */ - -#ifndef _AWT_XEMBED_H_ -#define _AWT_XEMBED_H_ - -#ifndef HEADLESS - -#include "awt_p.h" - -#define XEMBED_VERSION 0 -#define XEMBED_MAPPED (1 << 0) -/* XEMBED messages */ -#define XEMBED_EMBEDDED_NOTIFY 0 -#define XEMBED_WINDOW_ACTIVATE 1 -#define XEMBED_WINDOW_DEACTIVATE 2 -#define XEMBED_REQUEST_FOCUS 3 -#define XEMBED_FOCUS_IN 4 -#define XEMBED_FOCUS_OUT 5 -#define XEMBED_FOCUS_NEXT 6 -#define XEMBED_FOCUS_PREV 7 -/* 8-9 were used for XEMBED_GRAB_KEY/XEMBED_UNGRAB_KEY */ -#define XEMBED_MODALITY_ON 10 -#define XEMBED_MODALITY_OFF 11 -#define XEMBED_REGISTER_ACCELERATOR 12 -#define XEMBED_UNREGISTER_ACCELERATOR 13 -#define XEMBED_ACTIVATE_ACCELERATOR 14 - -#define XEMBED_LAST_MSG XEMBED_ACTIVATE_ACCELERATOR - -#define NON_STANDARD_XEMBED_GTK_GRAB_KEY 108 -#define NON_STANDARD_XEMBED_GTK_UNGRAB_KEY 109 - -// Sun internal special message, to resolve start race condition -#define _SUN_XEMBED_START 1119 - - -// A detail code is required for XEMBED_FOCUS_IN. The following values are valid: -/* Details for XEMBED_FOCUS_IN: */ -#define XEMBED_FOCUS_CURRENT 0 -#define XEMBED_FOCUS_FIRST 1 -#define XEMBED_FOCUS_LAST 2 - - -extern void init_xembed(); -extern void xembed_eventHandler(XEvent *event); -extern void requestXEmbedFocus(struct FrameData * wdata); -extern void install_xembed(Widget client, struct FrameData* wdata); -extern void deinstall_xembed(struct FrameData* wdata); -extern Boolean isXEmbedActive(struct FrameData * wdata); -extern Boolean isXEmbedActiveByWindow(Window client); -extern Boolean isXEmbedApplicationActive(struct FrameData * wdata); -extern void sendMessageHelper(Window window, int message, long detail, - long data1, long data2); -extern void sendMessage(Window window, int message); -extern void xembed_traverse_out(struct FrameData * wdata, jboolean); -#endif -#endif diff --git a/jdk/src/solaris/native/sun/awt/awt_xembed_server.c b/jdk/src/solaris/native/sun/awt/awt_xembed_server.c deleted file mode 100644 index d4eb5ea10224857b289f5180569cbf050281e941..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/native/sun/awt/awt_xembed_server.c +++ /dev/null @@ -1,969 +0,0 @@ -/* - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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. - */ - -// TODO: Propogate applicationActive from Java - -#ifdef HEADLESS - #error This file should not be included in headless library -#endif - -#include "awt_p.h" - -#include -#include -#include -#include -#ifdef __linux__ -#include -#endif -#include -#include - -/* JNI headers */ -#include "java_awt_Frame.h" /* for frame state constants */ -#include "java_awt_event_KeyEvent.h" -#include "awt_wm.h" -#include "awt_util.h" /* for X11 error handling macros */ -#include "awt_xembed.h" -#include "awt_Component.h" -#include "awt_AWTEvent.h" -#include "canvas.h" -#include "sun_awt_motif_MEmbedCanvasPeer.h" - -#ifdef DOTRACE -#define MTRACE(param) fprintf(stderr, param) -#define MTRACEP1(format, p1) fprintf(stderr, format, p1) -#define MTRACEP2(format, p1, p2) fprintf(stderr, format, p1, p2) -#define MTRACEP3(format, p1, p2, p3) fprintf(stderr, format, p1, p2, p3) -#define MTRACEP4(format, p1, p2, p3, p4) fprintf(stderr, format, p1, p2, p3, p4) -#define MTRACEP5(format, p1, p2, p3, p4, p5) fprintf(stderr, format, p1, p2, p3, p4, p5) -#define MTRACEP6(format, p1, p2, p3, p4, p5, p6) fprintf(stderr, format, p1, p2, p3, p4, p5, p6) -#define MTRACEP7(format, p1, p2, p3, p4, p5, p6, p7) fprintf(stderr, format, p1, p2, p3, p4, p5, p6, p7) -#else -#define MTRACE(param) -#define MTRACEP1(format, p1) -#define MTRACEP2(format, p1, p2) -#define MTRACEP3(format, p1, p2, p3) -#define MTRACEP4(format, p1, p2, p3, p4) -#define MTRACEP5(format, p1, p2, p3, p4, p5) -#define MTRACEP6(format, p1, p2, p3, p4, p5, p6) -#define MTRACEP7(format, p1, p2, p3, p4, p5, p6, p7) -#endif - -/**************************** XEmbed server DnD support ***********************/ -extern Atom XA_XdndAware; -extern Boolean -register_xembed_drop_site(JNIEnv* env, Display* dpy, jobject server, - Window serverHandle, Window clientHandle); -extern Boolean -unregister_xembed_drop_site(JNIEnv* env, Display* dpy, jobject server, - Window serverHandle, Window clientHandle); -extern void -forward_event_to_embedded(Window embedded, jlong ctxt, jint eventID); - -extern const char * msg_to_str(int msg); - -void -set_xembed_drop_target(JNIEnv* env, jobject server); -void -remove_xembed_drop_target(JNIEnv* env, jobject server); -Boolean -is_xembed_client(Window window); -/******************************************************************************/ -extern struct MComponentPeerIDs mComponentPeerIDs; -static jobject createRectangle(JNIEnv* env, int x, int y, int width, int height); -static jobject createDimension(JNIEnv* env, int width, int height); -static void processXEmbedInfo(JNIEnv* env, jobject this); -static Atom XA_XEmbedInfo; -static Atom XA_XEmbed; -static jmethodID requestXEmbedFocusMID, focusNextMID, focusPrevMID, - registerAcceleratorMID, unregisterAcceleratorMID, - grabKeyMID, ungrabKeyMID, childResizedMID, - setXEmbedDropTargetMID, removeXEmbedDropTargetMID; -static jfieldID keysymFID, modifiersFID, applicationActiveFID; - -typedef struct _xembed_server_data { - Window handle; // pointer to plugin intermediate widget, XEmbed client - Window serverHandle; - Widget serverWidget; - Boolean dispatching; // whether we dispatch messages for handle - int version; - jobject server; - struct _xembed_server_data * next; -} xembed_server_data, * pxembed_server_data; - -static pxembed_server_data xembed_list = NULL; - -static pxembed_server_data -getData(Window handle) { - pxembed_server_data temp = xembed_list; - while (temp != NULL) { - if (temp->handle == handle) { - return temp; - } - temp = temp->next; - } - return NULL; -} - -static pxembed_server_data -getDataByEmbedder(jobject server) { - JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - pxembed_server_data temp = xembed_list; - DASSERT(server != NULL); - while (temp != NULL) { - if ((*env)->IsSameObject(env, temp->server, server)) { - return temp; - } - temp = temp->next; - } - return NULL; -} - -static pxembed_server_data -getDataByServerHandle(Window serverHandle) { - JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - pxembed_server_data temp = xembed_list; - Widget serverWidget = NULL; - if (serverHandle == None) { - return NULL; - } - serverWidget = XtWindowToWidget(awt_display, serverHandle); - while (temp != NULL) { - if (temp->serverHandle == serverHandle || temp->serverWidget == serverWidget) { - temp->serverHandle = serverWidget; - return temp; - } - temp = temp->next; - } - return NULL; -} - -static pxembed_server_data -addData(jobject server) { - JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - struct ComponentData *cdata; - xembed_server_data * data = malloc(sizeof(xembed_server_data)); - DASSERT(server != NULL); - memset(data, 0, sizeof(xembed_server_data)); - data->server = server; - cdata = (struct ComponentData *) - JNU_GetLongFieldAsPtr(env, server, mComponentPeerIDs.pData); - DASSERT(cdata != NULL); - data->serverHandle = XtWindow(cdata->widget); - data->serverWidget = cdata->widget; - data->next = xembed_list; - xembed_list = data; - return data; -} - -static void -removeData(jobject server) { - JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - pxembed_server_data * temp = &xembed_list; - DASSERT(server != NULL); - while (*temp != NULL) { - if ((*env)->IsSameObject(env, (*temp)->server, server)) { - xembed_server_data * data = *temp; - *temp = (*temp)->next; - DASSERT(data->server != NULL); - (*env)->DeleteGlobalRef(env, data->server); - free(data); - return; - } - temp = &(*temp)->next; - } -} - -void -initXEmbedServerData() { - JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - jclass clazz; - MTRACE("initXEmbedServerData\n"); - XA_XEmbedInfo = XInternAtom(awt_display, "_XEMBED_INFO", False); - XA_XEmbed = XInternAtom(awt_display, "_XEMBED", False); - - clazz = (*env)->FindClass(env, "sun/awt/motif/MEmbedCanvasPeer"); - DASSERT(clazz != NULL); - requestXEmbedFocusMID = (*env)->GetMethodID(env, clazz, "requestXEmbedFocus", "()V"); - DASSERT(requestXEmbedFocusMID != NULL); - focusNextMID = (*env)->GetMethodID(env, clazz, "focusNext", "()V"); - DASSERT(focusNextMID != NULL); - focusPrevMID = (*env)->GetMethodID(env, clazz, "focusPrev", "()V"); - DASSERT(focusPrevMID != NULL); - registerAcceleratorMID = (*env)->GetMethodID(env, clazz, "registerAccelerator", "(JJJ)V"); - DASSERT(registerAcceleratorMID != NULL); - unregisterAcceleratorMID = (*env)->GetMethodID(env, clazz, "unregisterAccelerator", "(J)V"); - DASSERT(unregisterAcceleratorMID != NULL); - grabKeyMID = (*env)->GetMethodID(env, clazz, "grabKey", "(JJ)V"); - DASSERT(grabKeyMID != NULL); - ungrabKeyMID = (*env)->GetMethodID(env, clazz, "ungrabKey", "(JJ)V"); - DASSERT(ungrabKeyMID != NULL); - childResizedMID = (*env)->GetMethodID(env, clazz, "childResized", "()V"); - DASSERT(childResizedMID != NULL); - setXEmbedDropTargetMID = - (*env)->GetMethodID(env, clazz, "setXEmbedDropTarget", "()V"); - DASSERT(setXEmbedDropTargetMID != NULL); - removeXEmbedDropTargetMID = - (*env)->GetMethodID(env, clazz, "removeXEmbedDropTarget", "()V"); - DASSERT(removeXEmbedDropTargetMID != NULL); - - applicationActiveFID = (*env)->GetFieldID(env, clazz, "applicationActive", "Z"); - DASSERT(applicationActiveFID != NULL); - (*env)->DeleteLocalRef(env, clazz); - - clazz = (*env)->FindClass(env, "sun/awt/motif/GrabbedKey"); - DASSERT(clazz != NULL); - keysymFID = (*env)->GetFieldID(env, clazz, "keysym", "J"); - DASSERT(keysymFID != NULL); - modifiersFID = (*env)->GetFieldID(env, clazz, "modifiers", "J"); - DASSERT(modifiersFID != NULL); - (*env)->DeleteLocalRef(env, clazz); -} - -/* - * Class: sun_awt_motif_MEmbedCanvasPeer - * Method: initXEmbedServer - * Signature: ()V - */ -JNIEXPORT void JNICALL -Java_sun_awt_motif_MEmbedCanvasPeer_initXEmbedServer(JNIEnv *env, jobject this) { - struct ComponentData *cdata; - AWT_LOCK(); - MTRACE("initXEmbedServer\n"); - addData((*env)->NewGlobalRef(env, this)); - if (XA_XEmbedInfo == None) { - initXEmbedServerData(); - } - cdata = (struct ComponentData *) - JNU_GetLongFieldAsPtr(env, this, mComponentPeerIDs.pData); -/* XSelectInput(awt_display, XtWindow(cdata->widget), SubstructureNotifyMask); */ - XtAddEventHandler(cdata->widget, - SubstructureNotifyMask, - False, null_event_handler, NULL); - AWT_UNLOCK(); -} - -/* - * Class: sun_awt_motif_MEmbedCanvasPeer - * Method: destroyXEmbedServer - * Signature: ()V - */ -JNIEXPORT void JNICALL -Java_sun_awt_motif_MEmbedCanvasPeer_destroyXEmbedServer(JNIEnv *env, jobject this) { - AWT_LOCK(); - MTRACE("destroyXEmbedServer\n"); - removeData(this); - AWT_UNLOCK(); -} - -/* - * Class: sun_awt_motif_MEmbedCanvasPeer - * Method: isXEmbedActive - * Signature: ()Z - */ -JNIEXPORT jboolean JNICALL -Java_sun_awt_motif_MEmbedCanvasPeer_isXEmbedActive(JNIEnv *env, jobject this) { - pxembed_server_data sdata; - jboolean res = JNI_FALSE; - AWT_LOCK(); - sdata = getDataByEmbedder(this); - if (sdata != NULL) { - res = (sdata->handle != None)?JNI_TRUE:JNI_FALSE; - } - AWT_UNLOCK(); - return res; -} - -/* - * Class: sun_awt_motif_MEmbedCanvasPeer - * Method: initDispatching - * Signature: ()V - */ -JNIEXPORT void JNICALL -Java_sun_awt_motif_MEmbedCanvasPeer_initDispatching (JNIEnv *env, jobject this) { - pxembed_server_data sdata; - AWT_LOCK(); - MTRACE("initDispatching\n"); - sdata = getDataByEmbedder(this); - if (sdata != NULL) { - XSelectInput(awt_display, sdata->handle, StructureNotifyMask | PropertyChangeMask); - sdata->dispatching = True; - register_xembed_drop_site(env, awt_display, sdata->server, - sdata->serverHandle, sdata->handle); - } - processXEmbedInfo(env, this); - Java_sun_awt_motif_MEmbedCanvasPeer_notifyChildEmbedded(env, this); - AWT_UNLOCK(); -} - -/* - * Class: sun_awt_motif_MEmbedCanvasPeer - * Method: endDispatching - * Signature: ()V - */ -JNIEXPORT void JNICALL -Java_sun_awt_motif_MEmbedCanvasPeer_endDispatching (JNIEnv *env, jobject this) { - pxembed_server_data sdata; - AWT_LOCK(); - MTRACE("endDispatching\n"); - sdata = getDataByEmbedder(this); - if (sdata != NULL) { - unregister_xembed_drop_site(env, awt_display, sdata->server, - sdata->serverHandle, sdata->handle); - sdata->dispatching = False; - } - AWT_UNLOCK(); -} - -/* - * Class: sun_awt_motif_MEmbedCanvasPeer - * Method: embedChild - * Signature: (J)V - */ -JNIEXPORT void JNICALL -Java_sun_awt_motif_MEmbedCanvasPeer_embedChild (JNIEnv * env, jobject this, jlong handle) { - pxembed_server_data sdata; - AWT_LOCK(); - MTRACE("embedChild\n"); - sdata = getDataByEmbedder(this); - if (sdata != NULL) { - if (sdata->handle != None) { - Java_sun_awt_motif_MEmbedCanvasPeer_detachChild(env, this); - } - sdata->handle = (Window)handle; - Java_sun_awt_motif_MEmbedCanvasPeer_initDispatching(env, this); - } - AWT_UNLOCK(); -} - -/* - * Class: sun_awt_motif_MEmbedCanvasPeer - * Method: childDestroyed - * Signature: ()V - */ -JNIEXPORT void JNICALL -Java_sun_awt_motif_MEmbedCanvasPeer_childDestroyed (JNIEnv *env, jobject this) { - pxembed_server_data sdata; - AWT_LOCK(); - MTRACE("childDestroyed\n"); - Java_sun_awt_motif_MEmbedCanvasPeer_endDispatching(env, this); - sdata = getDataByEmbedder(this); - if (sdata != NULL) { - sdata->handle = None; - } - AWT_UNLOCK(); -} - -/* - * Class: sun_awt_motif_MEmbedCanvasPeer - * Method: getEmbedPreferredSize - * Signature: ()Ljava/awt/Dimension; - */ -JNIEXPORT jobject JNICALL -Java_sun_awt_motif_MEmbedCanvasPeer_getEmbedPreferredSize (JNIEnv *env, jobject this) { - pxembed_server_data sdata; - jobject res = NULL; - XSizeHints * hints; - long dummy; - AWT_LOCK(); - MTRACE("getPreferredSize\n"); - sdata = getDataByEmbedder(this); - if (sdata != NULL) { - hints = XAllocSizeHints(); - DASSERT(hints != NULL); - DASSERT(sdata->handle != None); - if (XGetWMNormalHints(awt_display, sdata->handle, hints, &dummy) == Success) { - res = createDimension(env, hints->width, hints->height); - } - XFree(hints); - } - AWT_UNLOCK(); - return res; -} - -/* - * Class: sun_awt_motif_MEmbedCanvasPeer - * Method: getEmbedMinimumSize - * Signature: ()Ljava/awt/Dimension; - */ -JNIEXPORT jobject JNICALL -Java_sun_awt_motif_MEmbedCanvasPeer_getEmbedMinimumSize (JNIEnv *env, jobject this) { - pxembed_server_data sdata; - jobject res = NULL; - XSizeHints * hints; - long dummy; - AWT_LOCK(); - MTRACE("getMinimumSize\n"); - sdata = getDataByEmbedder(this); - if (sdata != NULL) { - hints = XAllocSizeHints(); - DASSERT(hints != NULL); - DASSERT(sdata->handle != None); - if (XGetWMNormalHints(awt_display, sdata->handle, hints, &dummy) == Success) { - res = createDimension(env, hints->min_width, hints->min_height); - } - XFree(hints); - } - AWT_UNLOCK(); - return res; -} - -/* - * Class: sun_awt_motif_MEmbedCanvasPeer - * Method: getClientBounds - * Signature: ()Ljava/awt/Rectangle; - */ -JNIEXPORT jobject JNICALL -Java_sun_awt_motif_MEmbedCanvasPeer_getClientBounds (JNIEnv *env, jobject this) { - pxembed_server_data sdata; - jobject res = NULL; - AWT_LOCK(); - MTRACE("getClientBounds\n"); - sdata = getDataByEmbedder(this); - if (sdata != NULL) { - XWindowAttributes attrs; - DASSERT(sdata->handle != None); - if (XGetWindowAttributes(awt_display, sdata->handle, &attrs) == Success) { - res = createRectangle(env, attrs.x, attrs.y, attrs.width, attrs.height); - } - } - AWT_UNLOCK(); - return res; -} - -Boolean -isApplicationActive(JNIEnv * env, jobject this) { - return (*env)->GetBooleanField(env, this, applicationActiveFID); -} - -/* - * Class: sun_awt_motif_MEmbedCanvasPeer - * Method: notifyChildEmbedded - * Signature: ()V - */ -JNIEXPORT void JNICALL -Java_sun_awt_motif_MEmbedCanvasPeer_notifyChildEmbedded (JNIEnv *env, jobject this) { - struct ComponentData *cdata; - pxembed_server_data sdata; - AWT_LOCK(); - MTRACE("notifyChildEmbedded\n"); - cdata = (struct ComponentData *) - JNU_GetLongFieldAsPtr(env, this, mComponentPeerIDs.pData); - sdata = getDataByEmbedder(this); - if (sdata != NULL) { - DASSERT(sdata->handle != None); - DASSERT(cdata != NULL); - DASSERT(XtWindow(cdata->widget) != None); - sendMessageHelper(sdata->handle, XEMBED_EMBEDDED_NOTIFY, XtWindow(cdata->widget), min(sdata->version, XEMBED_VERSION), 0); - if (isApplicationActive(env, this)) { - sendMessage(sdata->handle, XEMBED_WINDOW_ACTIVATE); - } - } - AWT_UNLOCK(); -} - -/* - * Class: sun_awt_motif_MEmbedCanvasPeer - * Method: detachChild - * Signature: ()V - */ -JNIEXPORT void JNICALL -Java_sun_awt_motif_MEmbedCanvasPeer_detachChild (JNIEnv *env, jobject this) { - pxembed_server_data sdata; - AWT_LOCK(); - MTRACE("detachChild\n"); - sdata = getDataByEmbedder(this); - if (sdata != NULL) { - /** - * XEmbed specification: - * "The embedder can unmap the client and reparent the client window to the root window. If the - * client receives an ReparentNotify event, it should check the parent field of the XReparentEvent - * structure. If this is the root window of the window's screen, then the protocol is finished and - * there is no further interaction. If it is a window other than the root window, then the protocol - * continues with the new parent acting as the embedder window." - */ - DASSERT(sdata->handle != None); - XUnmapWindow(awt_display, sdata->handle); - XReparentWindow(awt_display, sdata->handle, DefaultRootWindow(awt_display), 0, 0); - Java_sun_awt_motif_MEmbedCanvasPeer_endDispatching(env, this); - sdata->handle = None; - } - AWT_UNLOCK(); -} - -/* - * Class: sun_awt_motif_MEmbedCanvasPeer - * Method: forwardKeyEvent - * Signature: (Ljava/awt/event/KeyEvent;)V - */ -JNIEXPORT void JNICALL -Java_sun_awt_motif_MEmbedCanvasPeer_forwardKeyEvent (JNIEnv *env, jobject this, jobject event) { - pxembed_server_data sdata; - jbyteArray array; - XEvent *xevent; - AWT_LOCK(); - MTRACE("forwardKeyEvent\n"); - sdata = getDataByEmbedder(this); - if (sdata != NULL) { - DASSERT(sdata->handle != None); - array = (jbyteArray)(*env)->GetObjectField(env, event, awtEventIDs.bdata); - if (array == NULL) { - MTRACE("array is null\n"); - AWT_UNLOCK(); - return; - } - - xevent = (XEvent *)(*env)->GetByteArrayElements(env, array, NULL); - if (xevent == NULL) { - (*env)->DeleteLocalRef(env, array); - MTRACE("xevent is null\n"); - AWT_UNLOCK(); - return; - } - xevent->xany.window = sdata->handle; - XSendEvent(awt_display, sdata->handle, False, NoEventMask, xevent); - (*env)->DeleteLocalRef(env, array); - } - AWT_UNLOCK(); -} - -/* - * Class: sun_awt_motif_MEmbedCanvasPeer - * Method: getAWTKeyCodeForKeySym - * Signature: (I)I - */ -JNIEXPORT jint JNICALL -Java_sun_awt_motif_MEmbedCanvasPeer_getAWTKeyCodeForKeySym (JNIEnv *env, jobject this, jint keysym) { - jint keycode = java_awt_event_KeyEvent_VK_UNDEFINED; - Boolean mapsToUnicodeChar; - jint keyLocation; - keysymToAWTKeyCode(keysym, &keycode, &mapsToUnicodeChar, &keyLocation); - return keycode; -} - -/* - * Class: sun_awt_motif_MEmbedCanvasPeer - * Method: sendMessage - * Signature: (I)V - */ -JNIEXPORT void JNICALL -Java_sun_awt_motif_MEmbedCanvasPeer_sendMessage__I (JNIEnv *env, jobject this, jint msg) { - pxembed_server_data sdata; - AWT_LOCK(); - MTRACEP2("sendMessage %d(%s)\n", msg, msg_to_str(msg)); - sdata = getDataByEmbedder(this); - if (sdata != NULL) { - DASSERT(sdata->handle != None); - sendMessage(sdata->handle, msg); - } - AWT_UNLOCK(); -} - -/* - * Class: sun_awt_motif_MEmbedCanvasPeer - * Method: sendMessage - * Signature: (IJJJ)V - */ -JNIEXPORT void JNICALL -Java_sun_awt_motif_MEmbedCanvasPeer_sendMessage__IJJJ (JNIEnv *env, jobject this, jint msg, jlong detail, jlong data1, jlong data2) { - pxembed_server_data sdata; - AWT_LOCK(); - MTRACEP5("sendMessage2 msg %d(%s) detail %d data: %d %d\n", msg, msg_to_str(msg), detail, data1, data2); - sdata = getDataByEmbedder(this); - if (sdata != NULL) { - DASSERT(sdata->handle != None); - sendMessageHelper(sdata->handle, msg, detail, data1, data2); - } - AWT_UNLOCK(); -} - -static jobject -createRectangle(JNIEnv* env, int x, int y, int width, int height) { - static jclass clazz; - static jmethodID mid; - jobject rect = NULL; - if (mid == 0) { - jclass l_clazz = (*env)->FindClass(env, "java/awt/Rectangle"); - DASSERT(l_clazz != NULL); - mid = (*env)->GetMethodID(env, clazz, "", "(IIII)V"); - DASSERT(mid != NULL); - clazz = (*env)->NewGlobalRef(env, l_clazz); - (*env)->DeleteLocalRef(env, l_clazz); - } - if (mid != NULL) { - rect = (*env)->NewObject(env, clazz, mid, x, y, width, height); - if ((*env)->ExceptionOccurred(env)) { - return NULL; - } - } - return rect; -} - -static jobject -createDimension(JNIEnv* env, int width, int height) { - static jclass clazz; - static jmethodID mid; - jobject dim = NULL; - if (mid == 0) { - jclass l_clazz = (*env)->FindClass(env, "java/awt/Dimension"); - DASSERT(l_clazz != NULL); - mid = (*env)->GetMethodID(env, clazz, "", "(II)V"); - DASSERT(mid != NULL); - clazz = (*env)->NewGlobalRef(env, l_clazz); - (*env)->DeleteLocalRef(env, l_clazz); - } - if (mid != NULL) { - dim = (*env)->NewObject(env, clazz, mid, width, height); - if ((*env)->ExceptionOccurred(env)) { - return NULL; - } - } - return dim; -} - -Boolean isMapped(Window w) { - XWindowAttributes attr; - Status status = 0; - WITH_XERROR_HANDLER(xerror_ignore_bad_window); - status = XGetWindowAttributes(awt_display, w, &attr); - RESTORE_XERROR_HANDLER; - if (status == 0 || xerror_code != Success) { - return False; - } - return !(attr.map_state == IsUnmapped); -} - -static void -processXEmbedInfo(JNIEnv * env, jobject this) { - pxembed_server_data sdata; - AWT_LOCK(); - MTRACE("processXEmbedInfo\n"); - sdata = getDataByEmbedder(this); - if (Java_sun_awt_motif_MEmbedCanvasPeer_isXEmbedActive(env, this)) { - Atom actual_type; - int actual_format; - unsigned long nitems; - unsigned long bytes_after; - CARD32 * data = NULL; - DASSERT(sdata->handle != None); - if (XGetWindowProperty(awt_display, sdata->handle, XA_XEmbedInfo, - 0, 2, False, XA_XEmbedInfo, &actual_type, - &actual_format, &nitems, &bytes_after, - (unsigned char**)&data) != Success) - { - AWT_UNLOCK(); - return; - } - if (actual_type == XA_XEmbedInfo && actual_format == 32 - && nitems == 2) - { - CARD32 flags; - Boolean new_mapped, currently_mapped; - sdata->version = *data; - flags = *(data+1); - new_mapped = (flags & XEMBED_MAPPED) != 0; - currently_mapped = isMapped(sdata->handle); - if (new_mapped != currently_mapped) { - if (new_mapped) { - XMapWindow(awt_display, sdata->handle); - } else { - XUnmapWindow(awt_display, sdata->handle); - } - } - } - if (data != NULL) { - XFree(data); - } - } - AWT_UNLOCK(); -} - -/** - * Handles client message on embedder - */ -static void -handleClientMessage(JNIEnv* env, jobject this, XClientMessageEvent * ev) { - pxembed_server_data sdata; - AWT_LOCK(); - MTRACEP5("handleClientMessage: 0=%ld 1=%ld 2=%ld 3=%ld 4=%ld\n", - ev->data.l[0], ev->data.l[1], ev->data.l[2], ev->data.l[3], ev->data.l[4]); - sdata = getDataByEmbedder(this); - if (sdata != NULL && sdata->handle != None) { - switch ((int)ev->data.l[1]) { - case XEMBED_REQUEST_FOCUS: - MTRACE("REQUEST_FOCUS\n"); - (*env)->CallVoidMethod(env, this, requestXEmbedFocusMID); - break; - case XEMBED_FOCUS_NEXT: - MTRACE("FOCUS_NEXT\n"); - (*env)->CallVoidMethod(env, this, focusNextMID); - break; - case XEMBED_FOCUS_PREV: - MTRACE("FOCUS_PREV\n"); - (*env)->CallVoidMethod(env, this, focusPrevMID); - break; - case XEMBED_REGISTER_ACCELERATOR: - MTRACE("REGISTER_ACCEL\n"); - (*env)->CallVoidMethod(env, this, registerAcceleratorMID, - (jlong)ev->data.l[2], - (jlong)ev->data.l[3], - (jlong)ev->data.l[4]); - break; - case XEMBED_UNREGISTER_ACCELERATOR: - MTRACE("UNREGISTER_ACCEL\n"); - (*env)->CallVoidMethod(env, this, unregisterAcceleratorMID, - (jlong)ev->data.l[2]); - break; - case NON_STANDARD_XEMBED_GTK_GRAB_KEY: - MTRACE("GRAB_KEY\n"); - (*env)->CallVoidMethod(env, this, grabKeyMID, - (jlong)ev->data.l[3], - (jlong)ev->data.l[4]); - break; - case NON_STANDARD_XEMBED_GTK_UNGRAB_KEY: - MTRACE("UNGRAB_KEY\n"); - (*env)->CallVoidMethod(env, this, ungrabKeyMID, - (jlong)ev->data.l[3], - (jlong)ev->data.l[4]); - case _SUN_XEMBED_START: - MTRACE("XEMBED_START\n"); - processXEmbedInfo(env, this); - Java_sun_awt_motif_MEmbedCanvasPeer_notifyChildEmbedded(env, this); - break; - } - } - AWT_UNLOCK(); -} - -/** - * Handles property changes on xembed client - */ -static void -handlePropertyNotify(XPropertyEvent * ev) { - JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - pxembed_server_data sdata; - AWT_LOCK(); - MTRACE("handlePropertyNotify\n"); - sdata = getData(ev->window); - if (sdata != NULL) { - if (ev->atom == XA_WM_NORMAL_HINTS) { - DASSERT(sdata->server != NULL); - (*env)->CallVoidMethod(env, sdata->server, childResizedMID); - MTRACE("NORMAL_HINTS have changed\n"); - } else if (ev->atom == XA_XdndAware) { - unregister_xembed_drop_site(env, awt_display, sdata->server, - sdata->serverHandle, sdata->handle); - if (ev->state == PropertyNewValue) { - register_xembed_drop_site(env, awt_display, sdata->server, - sdata->serverHandle, sdata->handle); - } - } else if (ev->atom == XA_XEmbedInfo) { - DASSERT(sdata->server != NULL); - MTRACE("XEMBED_INFO has changed\n"); - processXEmbedInfo(env, sdata->server); - } - } - AWT_UNLOCK(); -} - -static void -handleConfigureNotify(XConfigureEvent * ev) { - JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - pxembed_server_data sdata; - AWT_LOCK(); - MTRACE("handleConfigureNotify\n"); - sdata = getData(ev->window); - if (sdata != NULL) { - DASSERT(sdata->server != NULL); - (*env)->CallVoidMethod(env, sdata->server, childResizedMID); - } - AWT_UNLOCK(); -} - -/* - * Class: sun_awt_motif_MEmbedCanvasPeer - * Method: sendMessage - * Signature: (IJJJ)V - */ -JNIEXPORT void JNICALL -Java_sun_awt_motif_GrabbedKey_initKeySymAndModifiers (JNIEnv *env, jobject this, jobject keyevent) { - jbyteArray array; - XEvent *xevent; - int keysym, modifiers; - int keycode; - AWT_LOCK(); - array = (jbyteArray)(*env)->GetObjectField(env, keyevent, awtEventIDs.bdata); - if (array == NULL) { - AWT_UNLOCK(); - return; - } - xevent = (XEvent *)(*env)->GetByteArrayElements(env, array, NULL); - if (xevent == NULL) { - (*env)->DeleteLocalRef(env, array); - AWT_UNLOCK(); - return; - } - keycode = (*env)->GetIntField(env, keyevent, keyEventIDs.keyCode); - keysym = awt_getX11KeySym(keycode); - modifiers = xevent->xkey.state; - (*env)->SetLongField(env, this, keysymFID, (jlong)keysym); - (*env)->SetLongField(env, this, modifiersFID, (jlong)modifiers); - (*env)->DeleteLocalRef(env, array); - AWT_UNLOCK(); -} - -#ifdef __linux__ -void -print_stack (void) -{ - void *array[10]; - size_t size; - char **strings; - size_t i; - - size = backtrace (array, 10); - strings = backtrace_symbols (array, size); - - fprintf (stderr, "Obtained %zd stack frames.\n", size); - - for (i = 0; i < size; i++) - fprintf (stderr, "%s\n", strings[i]); - - free (strings); -} -#endif - -extern int32_t numEventsHandled; - -XCreateWindowEvent cr; - -void -dispatchEmbedderEvent(jobject server, XEvent * ev) { - JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - DASSERT(server != NULL); - DASSERT(ev != NULL); - AWT_LOCK(); -/* MTRACE("dispatchEmebddedEvent\n"); */ - switch (ev->type) { - case CreateNotify: - - MTRACEP3("CreateNotify for %x, serial %d, num events %d\n", (ev->xcreatewindow.window), (ev->xany.serial), (numEventsHandled)); - Java_sun_awt_motif_MEmbedCanvasPeer_embedChild(env, server, ev->xcreatewindow.window); - break; - case DestroyNotify: - MTRACE("DestroyNotify\n"); - Java_sun_awt_motif_MEmbedCanvasPeer_childDestroyed(env, server); - break; - case ReparentNotify: - MTRACEP2("ReparentNotify for %x, parent %x\n", (ev->xreparent.window), (ev->xreparent.parent)); - Java_sun_awt_motif_MEmbedCanvasPeer_embedChild(env, server, ev->xreparent.window); - break; - case ClientMessage: - MTRACE("ClientMessage\n"); - handleClientMessage(env, server, &ev->xclient); - break; - } - AWT_UNLOCK(); -} - -void -dispatchEmbeddingClientEvent(XEvent * ev) { - DASSERT(ev != NULL); - MTRACE("dispatchEmbeddingClientEvent\n"); - switch (ev->type) { - case PropertyNotify: - handlePropertyNotify(&ev->xproperty); - break; - case ConfigureNotify: - handleConfigureNotify(&ev->xconfigure); - break; - } -} - -void -xembed_serverEventHandler(XEvent * ev) { - pxembed_server_data sdata; - sdata = getData(ev->xany.window); - if (sdata != NULL) { // Event on client - dispatchEmbeddingClientEvent(ev); - } else { - sdata = getDataByServerHandle(ev->xany.window); - if (sdata != NULL) { - DASSERT(sdata->server != NULL); - dispatchEmbedderEvent(sdata->server, ev); - } - } -} - -/**************************** XEmbed server DnD support ***********************/ -void -set_xembed_drop_target(JNIEnv* env, jobject server) { - - (*env)->CallVoidMethod(env, server, setXEmbedDropTargetMID); -} - -void -remove_xembed_drop_target(JNIEnv* env, jobject server) { - (*env)->CallVoidMethod(env, server, removeXEmbedDropTargetMID); -} - -Boolean -is_xembed_client(Window window) { - return getData(window) != NULL; -} -/******************************************************************************/ - -/* - * Class: sun_awt_motif_MEmbedCanvasPeer - * Method: getWindow - * Signature: ()V - */ -JNIEXPORT jlong JNICALL -Java_sun_awt_motif_MEmbedCanvasPeer_getWindow(JNIEnv *env, jobject this) { - struct ComponentData *cdata; - Window res = None; - AWT_LOCK(); - cdata = (struct ComponentData *) - JNU_GetLongFieldAsPtr(env, this, mComponentPeerIDs.pData); - DASSERT(cdata != NULL); - res = XtWindow(cdata->widget); - AWT_UNLOCK(); - return (jlong)res; -} - -JNIEXPORT void JNICALL -Java_sun_awt_motif_MEmbedCanvasPeer_forwardEventToEmbedded(JNIEnv *env, - jobject this, - jlong ctxt, - jint eventID){ - pxembed_server_data sdata; - AWT_LOCK(); - sdata = getDataByEmbedder(this); - if (sdata != NULL) { - forward_event_to_embedded(sdata->handle, ctxt, eventID); - } - AWT_UNLOCK(); -} diff --git a/jdk/src/solaris/native/sun/awt/awt_xembed_server.h b/jdk/src/solaris/native/sun/awt/awt_xembed_server.h deleted file mode 100644 index b74b9990c091e6f4944e7fc019dd57968f08a83b..0000000000000000000000000000000000000000 --- a/jdk/src/solaris/native/sun/awt/awt_xembed_server.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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. - */ - -#ifndef _AWT_XEMBED_SERVER_H_ -#define _AWT_XEMBED_SERVER_H_ - -#ifndef HEADLESS - -#include "awt_p.h" - -extern void xembed_serverEventHandler(XEvent *); - -#endif -#endif diff --git a/jdk/src/solaris/native/sun/awt/canvas.h b/jdk/src/solaris/native/sun/awt/canvas.h index 45cc7da3ec8acc1bf7c609fd3fc503045df5b732..eafc118c7164d63c171f448d166902f32790a4b3 100644 --- a/jdk/src/solaris/native/sun/awt/canvas.h +++ b/jdk/src/solaris/native/sun/awt/canvas.h @@ -26,44 +26,7 @@ #define _CANVAS_H_ #ifndef HEADLESS -void awt_canvas_reconfigure(struct FrameData *wdata); -Widget awt_canvas_create(XtPointer this, - Widget parent, - char *base, - int32_t width, - int32_t height, - Boolean parentIsFrame, - struct FrameData *wdata, - AwtGraphicsConfigDataPtr awtData); -void awt_canvas_scroll(XtPointer this, struct CanvasData *wdata, long dx, long dy); -void awt_canvas_event_handler(Widget w, XtPointer client_data, - XEvent *event, Boolean *cont); -void awt_canvas_handleEvent(Widget w, XtPointer client_data, - XEvent *event, struct WidgetInfo *winfo, - Boolean *cont, Boolean passEvent); - -void awt_copyXEventToAWTEvent(JNIEnv* env, XEvent * xevent, jobject jevent); KeySym awt_getX11KeySym(jint awtKey); -jobject awt_canvas_getFocusOwnerPeer(); -jobject awt_canvas_getFocusedWindowPeer(); -void awt_canvas_setFocusOwnerPeer(jobject peer); -void awt_canvas_setFocusedWindowPeer(jobject peer); -jobject awt_canvas_wrapInSequenced(jobject awtevent); -extern void keysymToAWTKeyCode(KeySym x11Key, jint *keycode, Boolean *mapsToUnicodeChar, - jint *keyLocation); -#define awt_canvas_addToFocusList awt_canvas_addToFocusListDefault -void awt_canvas_addToFocusListDefault(jobject target); -void awt_canvas_addToFocusListWithDuplicates(jobject target, jboolean acceptDuplicate); -extern void callFocusCallback(jobject focusPeer, int focus_type, jobject cause); -extern void callFocusHandler(Widget w, int eventType, jobject cause); - -typedef struct FocusListElt{ - jweak requestor; - struct FocusListElt * next; -} FocusListElt; -extern FocusListElt *focusList; -extern FocusListElt *focusListEnd; -extern jweak forGained; #endif /* !HEADLESS */ #endif /* _CANVAS_H_ */ diff --git a/jdk/src/solaris/native/sun/awt/multi_font.c b/jdk/src/solaris/native/sun/awt/multi_font.c index 0cb6e5b266adbe2232875eff1811c9800ea98158..e13156470110d676d207769b15a4a32eebb09cd1 100644 --- a/jdk/src/solaris/native/sun/awt/multi_font.c +++ b/jdk/src/solaris/native/sun/awt/multi_font.c @@ -38,24 +38,15 @@ #include #include #include -#ifndef XAWT -#include -#endif #include "awt_Font.h" -#ifndef XAWT -#include "awt_Component.h" -#endif -#include "awt_MenuItem.h" #include "awt_p.h" #include "multi_font.h" extern XFontStruct *loadFont(Display *, char *, int32_t); extern struct FontIDs fontIDs; -//extern struct MComponentPeerIDs mComponentPeerIDs; -//extern struct MMenuItemPeerIDs mMenuItemPeerIDs; extern struct PlatformFontIDs platformFontIDs; -extern struct MFontPeerIDs mFontPeerIDs; +extern struct XFontPeerIDs xFontPeerIDs; /* * make string with str + string representation of num @@ -70,145 +61,7 @@ makeTag(char *str, int32_t num, char *buf) buf[len] = '0' + num % 100; buf[len + 1] = '\0'; } -#ifndef XAWT -jobject -awtJNI_CreateAndSetGlobalRef(JNIEnv * env, jobject this) -{ - jobject gRef; - - gRef = (*env)->NewGlobalRef(env, this); - - JNU_SetLongFieldFromPtr(env, this, mComponentPeerIDs.jniGlobalRef, gRef); - - return gRef; -} - -struct gRefStruct -{ - jobject gRef; - struct gRefStruct *next; -}; - -static struct gRefStruct *gRefHead = NULL; -static struct gRefStruct *gRefTail = NULL; - -/* - * This function is called by components that - * are being disposed. It used to invalidate - * the global ref immediately, but the awt is - * rather full of thread race conditions involving - * component disposal and outstanding events. - * Now we queue up 'to be deleted' global refs - * as they come in, and don't invalidate them - * until the X event queue is empty. Callers of - * either of these functions _must_ have AWT_LOCK'd - * before using them! - */ -void -awtJNI_DeleteGlobalRef(JNIEnv * env, jobject this) -{ - jobject gRef; - struct gRefStruct *newGRef; - struct gRefStruct *temp; - - gRef = (jobject) - JNU_GetLongFieldAsPtr(env, this, mComponentPeerIDs.jniGlobalRef); - JNU_SetLongFieldFromPtr(env, this, mComponentPeerIDs.jniGlobalRef, NULL); - - /* - * Verra handy for tracking down race conditions. If you - * have a peer getting called after its been disposed... - */ - /* jio_fprintf(stderr,"%p\n",(void *)gRef); */ - - newGRef = (struct gRefStruct *)malloc((size_t)sizeof(struct gRefStruct)); - - if(newGRef == NULL) - (*env)->DeleteGlobalRef(env, gRef); - else - { - newGRef->gRef = gRef; - newGRef->next = NULL; - - if(gRefHead == NULL) - { - gRefTail = newGRef; - gRefHead = newGRef; - } - else - { - gRefTail->next = newGRef; - gRefTail = newGRef; - } - } -} -void -awtJNI_DeleteGlobalMenuRef(JNIEnv * env, jobject this) -{ - jobject gRef; - struct gRefStruct *newGRef; - struct gRefStruct *temp; - - gRef = (jobject) - //JNU_GetLongFieldAsPtr(env, this, mMenuItemPeerIDs.jniGlobalRef); - //JNU_SetLongFieldFromPtr(env, this, mMenuItemPeerIDs.jniGlobalRef, NULL); - - /* - * Verra handy for tracking down race conditions. If you - * have a peer getting called after its been disposed... - */ - /* jio_fprintf(stderr,"%p\n",(void *)gRef); */ - - newGRef = (struct gRefStruct *)malloc((size_t)sizeof(struct gRefStruct)); - - if(newGRef == NULL) - (*env)->DeleteGlobalRef(env, gRef); - else - { - newGRef->gRef = gRef; - newGRef->next = NULL; - - if(gRefHead == NULL) - { - gRefTail = newGRef; - gRefHead = newGRef; - } - else - { - gRefTail->next = newGRef; - gRefTail = newGRef; - } - } -} - -void awtJNI_CleanupGlobalRefs() -{ - struct gRefStruct *working,*next; - JNIEnv *env; - int32_t count = 0; - - if(gRefHead == NULL) { - return; - } - - env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - - working = gRefHead; - gRefHead = gRefTail = NULL; - - while(working != NULL) - { - count++; - next = working->next; - (*env)->DeleteGlobalRef(env, working->gRef); - - free((void *)working); - - working = next; - } -} -#endif static int32_t awtJNI_GetFontDescriptorNumber(JNIEnv * env ,jobject font @@ -255,25 +108,7 @@ awtJNI_GetFontDescriptorNumber(JNIEnv * env return 0; } -#ifndef XAWT -jobject -awtJNI_GetFont(JNIEnv * env, jobject this) -{ - jobject target = NULL; - jobject font = NULL; - target = (*env)->GetObjectField(env, this, mComponentPeerIDs.target); - // SECURITY: Must call _NoClientCode() methods to ensure that we - // are not invoking client code on the privileged thread - font = JNU_CallMethodByName(env, - NULL, - target, - "getFont_NoClientCode", - "()Ljava/awt/Font;").l; - (*env)->DeleteLocalRef(env, target); - return font; -} -#endif jobject awtJNI_GetFMFont(JNIEnv * env, jobject this) { @@ -347,258 +182,7 @@ awtJNI_IsMultiFontMetrics(JNIEnv * env, jobject this) return JNI_TRUE; } -#ifndef XAWT -#ifdef __linux__ -XmString -unicodeXmStringCreate(char* text, char* tag, int len) { - XmString ret_val; - XtProcessLock(); - ret_val = _XmStringNCreate (text, tag, len); - XtProcessUnlock(); - return ret_val; -} -#endif - -/* - * Unicode to Motif Multi Font Compound String converter - * - * ASSUMES: We are not running on a privileged thread - */ -XmString -awtJNI_MakeMultiFontString(JNIEnv * env, jstring s, jobject font) -{ - XmString xmstr = NULL, xmtmp1, xmtmp2; - jobjectArray dataArray = NULL; - char *err = NULL; - int32_t stringCount,i; - int32_t fdnumber; - struct FontData *fdata = awtJNI_GetFontData(env, font, &err); - jobject fontDescriptor = NULL; - jbyteArray data = NULL; - char *stringData = NULL; - char tag[BUFSIZ]; - - if ((*env)->PushLocalFrame(env, 16) < 0) - return NULL; - - if (!JNU_IsNull(env, s) && !JNU_IsNull(env, font)) { - jobject peer; - - peer = (*env)->CallObjectMethod(env,font,fontIDs.getPeer); - - DASSERT(!awt_currentThreadIsPrivileged(env)); - dataArray = - (*env)->CallObjectMethod( - env, - peer, - platformFontIDs.makeConvertedMultiFontString, - s); - - if ((*env)->ExceptionOccurred(env)) { - (*env)->ExceptionDescribe(env); - (*env)->ExceptionClear(env); - - (*env)->PopLocalFrame(env, NULL); - return (XmString) NULL; - } - - if(dataArray == NULL) { - (*env)->PopLocalFrame(env, NULL); - return (XmString) NULL; - } - } else { - (*env)->PopLocalFrame(env, NULL); - return (XmString) NULL; - } - - stringCount = (*env)->GetArrayLength(env, dataArray); - - for (i = 0; i < stringCount; i+=2) { - fontDescriptor = (*env)->GetObjectArrayElement(env, dataArray, i); - data = (*env)->GetObjectArrayElement(env, dataArray, i + 1); - - /* Bail if we've finished */ - if(fontDescriptor == NULL || data == NULL) - break; - - fdnumber = awtJNI_GetFontDescriptorNumber(env, font, fontDescriptor); - fdata = awtJNI_GetFontData(env, font, &err); - - makeTag(fdata->flist[fdnumber].charset_name, fdnumber, tag); - - stringData = (char *)(*env)->GetPrimitiveArrayCritical(env, data, NULL); - if(stringData != NULL) { - unsigned char* buf = stringData; - int len; - char *offsetStringData; - - offsetStringData = stringData + (4 * sizeof(char)); -#ifdef __linux__ - len = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3]; - /* Motif XmStringCreate() API requests "text must be a NULL-terminated - string" and its implementation uses "strlen()" to calculate the length - of the text string. Unfortunately when we deal with iso10646 font - on linux, the "text" is requested to be encoded in UTF16, which has the - posibility of including code points like "0xYY00" ("0xYY" + "0x00") that - causes problem when XmStringCreate() calls _XmStringNCreate() without - specifying a specific text lenth (see Motif XmString.c). The workaround is - to call _XmStringNCreate() directly with specific text length at this - cirsumstance. - */ - if (strstr(fdata->flist[fdnumber].charset_name, "UnicodeBigUnmarked")) - xmtmp1 = unicodeXmStringCreate(offsetStringData, tag, len); - else - xmtmp1 = XmStringCreate(offsetStringData, tag); - if (xmstr == NULL) - xmstr = xmtmp1; - else { - xmtmp2 = XmStringConcat(xmstr, xmtmp1); - XmStringFree(xmtmp1); - XmStringFree(xmstr); - xmstr = xmtmp2; - } -#else - if(xmstr == NULL) { - xmstr = XmStringCreate(offsetStringData, tag); - } - else { - xmtmp1 = XmStringCreate(offsetStringData, tag); - xmtmp2 = XmStringConcat(xmstr, xmtmp1); - XmStringFree(xmtmp1); - XmStringFree(xmstr); - xmstr = xmtmp2; - } -#endif - } - - (*env)->ReleasePrimitiveArrayCritical(env, data, stringData, JNI_ABORT); - (*env)->DeleteLocalRef(env, fontDescriptor); - (*env)->DeleteLocalRef(env, data); - } - (*env)->PopLocalFrame(env, NULL); - return xmstr; -} -/* - * Find the character encoding for a given font and register that encoding - * with the given tag. The encoding is the last two fields of the XLFD of - * the font (converted to uppercase). - */ -static void registerEncoding(char *xlfd, char *tag) -{ - char *e = xlfd + strlen(xlfd); - char *ret = NULL; - - do { --e; } while (e != xlfd && *e != '-'); - do { --e; } while (e != xlfd && *e != '-'); - if (e != xlfd) { - char *encoding = strdup(++e); - char *u = NULL; - - for (u = encoding; *u != '\0'; ++u) { - if (islower(*u)) { - *u = toupper(*u); - } - } - - /* - * Motif will core dump on or otherwise mishandle unknown (or - * non-standard) character encodings (in conversion to compound - * text, bug 4122785). Register Sun private encodings for - * Symbol or dingbat fonts as ISO8859-1, which is a lie, - * but produces predictable results. - */ - if (strncmp(encoding, "SUN-", 4) == 0) { - free(encoding); - encoding = strdup("ISO8859-1"); - } - ret = XmRegisterSegmentEncoding(tag, encoding); - if (ret != NULL) - XtFree(ret); - free(encoding); - } -} - - -XmFontList -awtJNI_GetFontList(JNIEnv * env, jobject font) -{ - int32_t i; - XmFontListEntry fle; - XmFontList fontlist; - XFontStruct *xf = NULL; - int32_t size; - struct FontData *fdata = NULL; - char *err = NULL, tag[BUFSIZ]; - - fdata = awtJNI_GetFontData(env, font, &err); - - makeTag(fdata->flist[0].charset_name, 0, tag); - - size = (int32_t) (*env)->GetIntField(env, font, fontIDs.size); - - if (fdata->flist[0].load == 0) { - xf = loadFont(awt_display, fdata->flist[0].xlfd, size * 10); - - if (xf == NULL) { - /* printf("Cannot load font: %s\n", fdata->list[0].xlfd); */ - } else { - fdata->flist[0].xfont = xf; - fdata->flist[0].load = 1; - - if (xf->min_byte1 == 0 && xf->max_byte1 == 0) - fdata->flist[0].index_length = 1; - else - fdata->flist[0].index_length = 2; - } - } - registerEncoding(fdata->flist[0].xlfd, tag); - fle = XmFontListEntryCreate(tag, XmFONT_IS_FONT, - (XtPointer) fdata->flist[0].xfont); - - fontlist = XmFontListAppendEntry(NULL, fle); - /* - * Some versions of motif have a bug in - * XmFontListEntryFree() which causes it to free more than it - * should. Use XtFree() is used instead. See O'Reilly's - * Motif Reference Manual for more information. - */ - XmFontListEntryFree(&fle); - - for (i = 1; i < fdata->charset_num; i++) { - makeTag(fdata->flist[i].charset_name, i, tag); - - if (fdata->flist[i].load == 0) { - xf = loadFont(awt_display, fdata->flist[i].xlfd, size * 10); - - if (xf == NULL) { - /* printf("Cannot load font: %s\n", fdata->flist[0].xlfd); */ - continue; - } - fdata->flist[i].xfont = xf; - fdata->flist[i].load = 1; - if (xf->min_byte1 == 0 && xf->max_byte1 == 0) { - fdata->flist[i].index_length = 1; - } else { - fdata->flist[i].index_length = 2; - } - } - registerEncoding(fdata->flist[i].xlfd, tag); - fle = XmFontListEntryCreate(tag, XmFONT_IS_FONT, - (XtPointer) fdata->flist[i].xfont); - fontlist = XmFontListAppendEntry(fontlist, fle); - /* - * Some versions of motif have a bug in - * XmFontListEntryFree() which causes it to free more than it - * should. Use XtFree() instead. See O'Reilly's - * Motif Reference Manual for more information. - */ - XmFontListEntryFree(&fle); - } - - return fontlist; -} -#endif /* #define FONT_DEBUG 2 */ XFontSet @@ -625,7 +209,7 @@ awtJNI_MakeFontSet(JNIEnv * env, jobject font) size = (*env)->GetIntField(env, font, fontIDs.size) * 10; peer = (*env)->CallObjectMethod(env,font,fontIDs.getPeer); - xfsname = (*env)->GetObjectField(env, peer, mFontPeerIDs.xfsname); + xfsname = (*env)->GetObjectField(env, peer, xFontPeerIDs.xfsname); if (JNU_IsNull(env, xfsname)) xfontset = ""; @@ -703,9 +287,6 @@ awtJNI_GetMFStringWidth(JNIEnv * env, jcharArray s, int offset, int sLength, job int32_t length; XFontStruct *xf = NULL; jobjectArray dataArray = NULL; -#ifndef XAWT - DASSERT(!awt_currentThreadIsPrivileged(env)); -#endif if ((*env)->EnsureLocalCapacity(env, 3) < 0) return 0; diff --git a/jdk/src/solaris/native/sun/awt/multi_font.h b/jdk/src/solaris/native/sun/awt/multi_font.h index ae8d8f9689312997a1bcc48f2459447953e5f5f4..460eab0f5497b54617e184d9fdf5393518ee9acc 100644 --- a/jdk/src/solaris/native/sun/awt/multi_font.h +++ b/jdk/src/solaris/native/sun/awt/multi_font.h @@ -29,13 +29,8 @@ #define _MULTI_FONT_H_ #ifndef HEADLESS -jobject awtJNI_GetFont(JNIEnv *env,jobject this); jboolean awtJNI_IsMultiFont(JNIEnv *env,jobject this); jboolean awtJNI_IsMultiFontMetrics(JNIEnv *env,jobject this); -#ifndef XAWT -XmString awtJNI_MakeMultiFontString(JNIEnv *env,jstring s,jobject font); -XmFontList awtJNI_GetFontList(JNIEnv *env,jobject font); -#endif XFontSet awtJNI_MakeFontSet(JNIEnv *env,jobject font); struct FontData *awtJNI_GetFontData(JNIEnv *env,jobject font, char **errmsg); int32_t awtJNI_GetMFStringWidth(JNIEnv * env, jcharArray s, int32_t offset, diff --git a/jdk/src/solaris/native/sun/java2d/opengl/GLXSurfaceData.c b/jdk/src/solaris/native/sun/java2d/opengl/GLXSurfaceData.c index 76c8c8bc3ed0d15dc3ba5ef03e02a42442d51b30..d389e16a502ebcf46c73924ab0197f4e20373f6f 100644 --- a/jdk/src/solaris/native/sun/java2d/opengl/GLXSurfaceData.c +++ b/jdk/src/solaris/native/sun/java2d/opengl/GLXSurfaceData.c @@ -45,8 +45,6 @@ extern GetRasInfoFunc OGLSD_GetRasInfo; extern UnlockFunc OGLSD_Unlock; extern DisposeFunc OGLSD_Dispose; -extern struct MComponentPeerIDs mComponentPeerIDs; - extern void OGLSD_SetNativeDimensions(JNIEnv *env, OGLSDOps *oglsdo, jint w, jint h); @@ -86,34 +84,12 @@ Java_sun_java2d_opengl_GLXSurfaceData_initOps(JNIEnv *env, jobject glxsd, oglsdo->activeBuffer = GL_FRONT; oglsdo->needsInit = JNI_TRUE; -#ifdef XAWT if (peer != NULL) { glxsdo->window = JNU_CallMethodByName(env, NULL, peer, "getContentWindow", "()J").j; } else { glxsdo->window = 0; } -#else - if (peer != NULL) { - struct ComponentData *cdata; - cdata = (struct ComponentData *) - JNU_GetLongFieldAsPtr(env, peer, mComponentPeerIDs.pData); - if (cdata == NULL) { - free(glxsdo); - JNU_ThrowNullPointerException(env, "Component data missing"); - return; - } - if (cdata->widget == NULL) { - free(glxsdo); - JNU_ThrowInternalError(env, "Widget is NULL in initOps"); - return; - } - glxsdo->widget = cdata->widget; - } else { - glxsdo->widget = NULL; - } -#endif - glxsdo->configData = (AwtGraphicsConfigDataPtr)jlong_to_ptr(aData); if (glxsdo->configData == NULL) { free(glxsdo); @@ -331,11 +307,7 @@ OGLSD_InitOGLWindow(JNIEnv *env, OGLSDOps *oglsdo) { GLXSDOps *glxsdo; Window window; -#ifdef XAWT XWindowAttributes attr; -#else - Widget widget; -#endif J2dTraceLn(J2D_TRACE_INFO, "OGLSD_InitOGLWindow"); @@ -352,7 +324,6 @@ OGLSD_InitOGLWindow(JNIEnv *env, OGLSDOps *oglsdo) return JNI_FALSE; } -#ifdef XAWT window = glxsdo->window; if (window == 0) { J2dRlsTraceLn(J2D_TRACE_ERROR, @@ -363,22 +334,6 @@ OGLSD_InitOGLWindow(JNIEnv *env, OGLSDOps *oglsdo) XGetWindowAttributes(awt_display, window, &attr); oglsdo->width = attr.width; oglsdo->height = attr.height; -#else - widget = glxsdo->widget; - if (widget == NULL) { - J2dTraceLn(J2D_TRACE_WARNING, "OGLSD_InitOGLWindow: widget is null"); - } - - if (!XtIsRealized(widget)) { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "OGLSD_InitOGLWindow: widget is unrealized"); - return JNI_FALSE; - } - - window = XtWindow(widget); - oglsdo->width = widget->core.width; - oglsdo->height = widget->core.height; -#endif oglsdo->drawableType = OGLSD_WINDOW; oglsdo->isOpaque = JNI_TRUE; diff --git a/jdk/src/solaris/native/sun/java2d/opengl/GLXSurfaceData.h b/jdk/src/solaris/native/sun/java2d/opengl/GLXSurfaceData.h index 7019406d7d1653f59c118ab6dd7befacb6e26fb6..9cbec5c167d64d1a46666f0bc86c11dc096930a9 100644 --- a/jdk/src/solaris/native/sun/java2d/opengl/GLXSurfaceData.h +++ b/jdk/src/solaris/native/sun/java2d/opengl/GLXSurfaceData.h @@ -38,16 +38,11 @@ * The GLXSDOps structure contains the GLX-specific information for a given * OGLSurfaceData. It is referenced by the native OGLSDOps structure. * - * Window window; (used in XAWT only) + * Window window; * For onscreen windows, we maintain a reference to that window's associated * XWindow handle here. Offscreen surfaces have no associated Window, so for * those surfaces, this value will simply be zero. * - * Widget widget; (used in MAWT only) - * For onscreen windows, we maintain a reference to that window's associated - * Widget handle here. Offscreen surfaces have no associated Widget, so for - * those surfaces, this value will simply be zero. - * * Drawable xdrawable; * If a GLXDrawable has a corresponding X11 Drawable, it is stored here. For * example, each GLXWindow has an associated Window and each GLXPixmap has an @@ -63,11 +58,7 @@ * created. */ typedef struct _GLXSDOps { -#ifdef XAWT Window window; -#else - Widget widget; -#endif Drawable xdrawable; GLXDrawable drawable; struct _AwtGraphicsConfigData *configData; diff --git a/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c b/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c index 9b3e706143659ae046a2dee26bd9a0843bc5445a..a993217e4318ceaf26b6e5451fea85a566fef08f 100644 --- a/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c +++ b/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c @@ -64,9 +64,6 @@ static UnlockFunc X11SD_Unlock; static DisposeFunc X11SD_Dispose; static GetPixmapBgFunc X11SD_GetPixmapWithBg; static ReleasePixmapBgFunc X11SD_ReleasePixmapWithBg; -#ifndef XAWT -extern struct MComponentPeerIDs mComponentPeerIDs; -#endif extern int J2DXErrHandler(Display *display, XErrorEvent *xerr); extern AwtGraphicsConfigDataPtr getGraphicsConfigFromComponentPeer(JNIEnv *env, jobject this); @@ -263,31 +260,12 @@ Java_sun_java2d_x11_XSurfaceData_initOps(JNIEnv *env, jobject xsd, xsdo->sdOps.Dispose = X11SD_Dispose; xsdo->GetPixmapWithBg = X11SD_GetPixmapWithBg; xsdo->ReleasePixmapWithBg = X11SD_ReleasePixmapWithBg; -#ifndef XAWT - if (peer != NULL) { - struct ComponentData *cdata; - cdata = (struct ComponentData *) - JNU_GetLongFieldAsPtr(env, peer, mComponentPeerIDs.pData); - if (cdata == NULL) { - JNU_ThrowNullPointerException(env, "Component data missing"); - return; - } - if (cdata->widget == NULL) { - JNU_ThrowInternalError(env, "Widget is NULL in initOps"); - return; - } - xsdo->widget = cdata->widget; - } else { - xsdo->widget = NULL; - } -#else xsdo->widget = NULL; if (peer != NULL) { xsdo->drawable = JNU_CallMethodByName(env, NULL, peer, "getWindow", "()J").j; } else { xsdo->drawable = 0; } -#endif xsdo->depth = depth; xsdo->dgaAvailable = dgaAvailable; xsdo->isPixmap = JNI_FALSE; @@ -775,14 +753,6 @@ jint X11SD_InitWindow(JNIEnv *env, X11SDOps *xsdo) if (xsdo->isPixmap == JNI_TRUE) { return SD_FAILURE; } -#ifndef XAWT - if (!XtIsRealized(xsdo->widget)) { - J2dTraceLn(J2D_TRACE_WARNING, "X11SD_InitWindow: widget is unrealized"); - /* AWT_UNLOCK(); unlock it in caller */ - return SD_FAILURE; - } - xsdo->drawable = XtWindow(xsdo->widget); -#endif xsdo->cData = xsdo->configData->color_data; return SD_SUCCESS; @@ -804,9 +774,7 @@ static jint X11SD_Lock(JNIEnv *env, SurfaceData_ThrowInvalidPipeException(env, "bounds changed"); return SD_FAILURE; } -#ifdef XAWT xsdo->cData = xsdo->configData->color_data; -#endif if (xsdo->drawable == 0 && X11SD_InitWindow(env, xsdo) == SD_FAILURE) { AWT_UNLOCK(); return SD_FAILURE; @@ -1081,30 +1049,6 @@ X11SD_ClipToRoot(SurfaceDataBounds *b, SurfaceDataBounds *bounds, int tmpx, tmpy; Window tmpchild; -#ifndef XAWT - Widget w = xsdo->widget; - - x1 = y1 = 0; - for (; w != NULL && ! XtIsShell(w); w = w->core.parent) { - x1 += w->core.x + w->core.border_width; - y1 += w->core.y + w->core.border_width; - } - if (w == NULL) { - return FALSE; - } - - /* - * REMIND: We should not be offsetting here by border_width - * but for some unknown reason if we do not do that the - * results will be off exactly by border_width. We were unable - * to find cause of this. - */ - (void) XTranslateCoordinates(XtDisplay(w), XtWindow(w), - RootWindowOfScreen(XtScreen(w)), - (int) w->core.border_width, - (int) w->core.border_width, - &tmpx, &tmpy, &tmpchild); -#else Window window = (Window)(xsdo->drawable); /* is always a Window */ XWindowAttributes winAttr; @@ -1118,7 +1062,6 @@ X11SD_ClipToRoot(SurfaceDataBounds *b, SurfaceDataBounds *bounds, 0, 0, &tmpx, &tmpy, &tmpchild)) { return FALSE; } -#endif x1 = -(x1 + tmpx); y1 = -(y1 + tmpy); @@ -1150,89 +1093,6 @@ X11SD_ClipToRoot(SurfaceDataBounds *b, SurfaceDataBounds *bounds, static int X11SD_FindClip(SurfaceDataBounds *b, SurfaceDataBounds *bounds, X11SDOps *xsdo) { -#ifndef XAWT - int x1, y1, x2, y2, px1, py1, px2, py2, child_x, child_y; - Widget current_widget, child_widget; - - XWindowAttributes attr; - Window ignore_root, current_window, *ignore_children; - unsigned int pborder, ignore_uint; - - x1 = bounds->x1; - y1 = bounds->y1; - x2 = bounds->x2; - y2 = bounds->y2; - - px1 = py1 = 0; - - child_widget = xsdo->widget; - current_widget = XtParent(xsdo->widget); - while (current_widget != NULL && !XtIsShell(current_widget)) { - px1 = px1 - (child_widget->core.x + child_widget->core.border_width); - py1 = py1 - (child_widget->core.y + child_widget->core.border_width); - px2 = px1 + current_widget->core.width; - py2 = py1 + current_widget->core.height; - x1 = MAX(x1, px1); - y1 = MAX(y1, py1); - x2 = MIN(x2, px2); - y2 = MIN(y2, py2); - if ((x1 >= x2) || (y1 >= y2)) { - return FALSE; - } - - child_widget = current_widget; - current_widget = current_widget->core.parent; - } - - if (current_widget == NULL) { - XQueryTree(awt_display, - XtWindow(child_widget), - &ignore_root, - ¤t_window, - &ignore_children, - &ignore_uint); - XFree(ignore_children); - } else { - current_window = XtWindow(current_widget); - } - - child_x = child_widget->core.x + child_widget->core.border_width; - child_y = child_widget->core.y + child_widget->core.border_width; - while (current_window != 0) { - px1 = px1 - child_x; - py1 = py1 - child_y; - if (!XGetGeometry(awt_display, current_window, &ignore_root, - &child_x, &child_y, - (unsigned int *)&px2, (unsigned int *)&py2, - &pborder, &ignore_uint)) { - return FALSE; - } - child_x += pborder; - child_y += pborder; - px2 += px1; - py2 += py1; - - x1 = MAX(x1, px1); - y1 = MAX(y1, py1); - x2 = MIN(x2, px2); - y2 = MIN(y2, py2); - if ((x1 >= x2) || (y1 >= y2)) { - return FALSE; - } - XQueryTree(awt_display, - current_window, - &ignore_root, - ¤t_window, - &ignore_children, - &ignore_uint); - XFree(ignore_children); - } - - b->x1 = x1; - b->y1 = y1; - b->x2 = x2; - b->y2 = y2; -#endif return TRUE; } diff --git a/jdk/src/solaris/native/sun/xawt/XToolkit.c b/jdk/src/solaris/native/sun/xawt/XToolkit.c index 0e6d021c0bc3eb97d1793c5ec82e496315905bc4..6dfb80d368a825e658532825f3cf9eff6fc5ef10 100644 --- a/jdk/src/solaris/native/sun/xawt/XToolkit.c +++ b/jdk/src/solaris/native/sun/xawt/XToolkit.c @@ -39,7 +39,6 @@ #include "awt_p.h" #include "awt_Component.h" #include "awt_MenuComponent.h" -#include "awt_KeyboardFocusManager.h" #include "awt_Font.h" #include "sun_awt_X11_XToolkit.h" @@ -74,19 +73,17 @@ struct ComponentIDs componentIDs; struct MenuComponentIDs menuComponentIDs; -struct KeyboardFocusManagerIDs keyboardFocusManagerIDs; - #ifndef HEADLESS extern Display* awt_init_Display(JNIEnv *env, jobject this); -extern struct MFontPeerIDs mFontPeerIDs; +struct XFontPeerIDs xFontPeerIDs; JNIEXPORT void JNICALL Java_sun_awt_X11_XFontPeer_initIDs (JNIEnv *env, jclass cls) { - mFontPeerIDs.xfsname = + xFontPeerIDs.xfsname = (*env)->GetFieldID(env, cls, "xfsname", "Ljava/lang/String;"); } #endif /* !HEADLESS */