OpenJDK / bsd-port / jdk9 / jdk
changeset 565:134fd1a656ea jdk7-b36
Merge
author | lana |
---|---|
date | Fri, 19 Sep 2008 19:38:12 -0700 |
parents | 16818689f727 9d5e52760d53 |
children | 73b3e1a40bdf b54ba7058851 af375b98f9b3 |
files | src/solaris/classes/sun/awt/motif/MButtonPeer.java src/solaris/classes/sun/awt/motif/MCanvasPeer.java src/solaris/classes/sun/awt/motif/MCheckboxMenuItemPeer.java src/solaris/classes/sun/awt/motif/MCheckboxPeer.java src/solaris/classes/sun/awt/motif/MChoicePeer.java src/solaris/classes/sun/awt/motif/MComponentPeer.java src/solaris/classes/sun/awt/motif/MCustomCursor.java src/solaris/classes/sun/awt/motif/MDataTransferer.java src/solaris/classes/sun/awt/motif/MDialogPeer.java src/solaris/classes/sun/awt/motif/MDragSourceContextPeer.java src/solaris/classes/sun/awt/motif/MDropTargetContextPeer.java src/solaris/classes/sun/awt/motif/MEmbedCanvasPeer.java src/solaris/classes/sun/awt/motif/MEmbeddedFrame.java src/solaris/classes/sun/awt/motif/MEmbeddedFramePeer.java src/solaris/classes/sun/awt/motif/MFileDialogPeer.java src/solaris/classes/sun/awt/motif/MFramePeer.java src/solaris/classes/sun/awt/motif/MGlobalCursorManager.java src/solaris/classes/sun/awt/motif/MInputMethod.java src/solaris/classes/sun/awt/motif/MInputMethodControl.java src/solaris/classes/sun/awt/motif/MInputMethodDescriptor.java src/solaris/classes/sun/awt/motif/MLabelPeer.java src/solaris/classes/sun/awt/motif/MListPeer.java src/solaris/classes/sun/awt/motif/MMenuBarPeer.java src/solaris/classes/sun/awt/motif/MMenuItemPeer.java src/solaris/classes/sun/awt/motif/MMenuPeer.java src/solaris/classes/sun/awt/motif/MMouseDragGestureRecognizer.java src/solaris/classes/sun/awt/motif/MPanelPeer.java src/solaris/classes/sun/awt/motif/MPopupMenuPeer.java src/solaris/classes/sun/awt/motif/MRobotPeer.java src/solaris/classes/sun/awt/motif/MScrollPanePeer.java src/solaris/classes/sun/awt/motif/MScrollbarPeer.java src/solaris/classes/sun/awt/motif/MTextAreaPeer.java src/solaris/classes/sun/awt/motif/MTextFieldPeer.java src/solaris/classes/sun/awt/motif/MWindowPeer.java src/solaris/classes/sun/awt/motif/X11Clipboard.java src/solaris/classes/sun/awt/motif/X11DragSourceContextPeer.java src/solaris/classes/sun/awt/motif/X11DropTargetContextPeer.java src/solaris/classes/sun/awt/motif/X11Selection.java src/solaris/classes/sun/awt/motif/X11SelectionHolder.java src/solaris/native/sun/awt/awt_Button.c src/solaris/native/sun/awt/awt_Canvas.c src/solaris/native/sun/awt/awt_Checkbox.c src/solaris/native/sun/awt/awt_Choice12.c src/solaris/native/sun/awt/awt_Choice21.c src/solaris/native/sun/awt/awt_Component.c src/solaris/native/sun/awt/awt_Cursor.c src/solaris/native/sun/awt/awt_DataTransferer.c src/solaris/native/sun/awt/awt_DataTransferer.h src/solaris/native/sun/awt/awt_FileDialog.c src/solaris/native/sun/awt/awt_GlobalCursorManager.c src/solaris/native/sun/awt/awt_KeyboardFocusManager.c src/solaris/native/sun/awt/awt_Label.c src/solaris/native/sun/awt/awt_List.c src/solaris/native/sun/awt/awt_Menu.c src/solaris/native/sun/awt/awt_Menu.h src/solaris/native/sun/awt/awt_MenuBar.c src/solaris/native/sun/awt/awt_MenuBar.h src/solaris/native/sun/awt/awt_MenuComponent.c src/solaris/native/sun/awt/awt_MenuItem.c src/solaris/native/sun/awt/awt_PopupMenu.c src/solaris/native/sun/awt/awt_ScrollPane.c src/solaris/native/sun/awt/awt_Scrollbar.c src/solaris/native/sun/awt/awt_Selection.c src/solaris/native/sun/awt/awt_TextArea.c src/solaris/native/sun/awt/awt_TextArea.h src/solaris/native/sun/awt/awt_TextField.c src/solaris/native/sun/awt/awt_TextField.h src/solaris/native/sun/awt/awt_TopLevel.c src/solaris/native/sun/awt/awt_XmDnD.c src/solaris/native/sun/awt/awt_XmDnD.h src/solaris/native/sun/awt/awt_dnd.c src/solaris/native/sun/awt/awt_dnd.h src/solaris/native/sun/awt/awt_dnd_ds.c src/solaris/native/sun/awt/awt_dnd_dt.c src/solaris/native/sun/awt/awt_motif.c src/solaris/native/sun/awt/awt_motif12.c src/solaris/native/sun/awt/awt_motif21.c src/solaris/native/sun/awt/awt_xembed.c src/solaris/native/sun/awt/canvas.c src/solaris/native/sun/awt/cursor.c |
diffstat | 132 files changed, 2017 insertions(+), 42559 deletions(-) [+] |
line wrap: on
line diff
--- a/make/sun/awt/FILES_c_unix.gmk Wed Sep 17 13:45:37 2008 -0700 +++ b/make/sun/awt/FILES_c_unix.gmk Fri Sep 19 19:38:12 2008 -0700 @@ -142,59 +142,59 @@ # These files rely on motif to be built, and should not be included # in a headless build. -FILES_MOTIF_c = \ - awt_AWTEvent.c \ - awt_Button.c \ - awt_Canvas.c \ - awt_Checkbox.c \ - awt_Component.c \ - awt_Cursor.c \ - awt_DataTransferer.c \ - awt_DrawingSurface.c \ - awt_Event.c \ - awt_FileDialog.c \ - awt_GlobalCursorManager.c \ - awt_GraphicsEnv.c \ - awt_InputMethod.c \ - 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 +#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
--- a/make/sun/awt/FILES_export_unix.gmk Wed Sep 17 13:45:37 2008 -0700 +++ b/make/sun/awt/FILES_export_unix.gmk Fri Sep 19 19:38:12 2008 -0700 @@ -60,48 +60,15 @@ sun/awt/image/DataBufferNative.java \ \ sun/awt/motif/X11FontMetrics.java \ - sun/awt/motif/X11Clipboard.java \ - sun/awt/motif/X11Selection.java \ - sun/awt/motif/X11SelectionHolder.java \ sun/awt/X11InputMethod.java \ - sun/awt/motif/MInputMethod.java \ - sun/awt/motif/MInputMethodControl.java \ - sun/awt/motif/MCustomCursor.java \ sun/awt/motif/MFontConfiguration.java \ sun/awt/motif/MFontPeer.java \ sun/awt/motif/MToolkit.java \ - sun/awt/motif/MComponentPeer.java \ - sun/awt/motif/MButtonPeer.java \ - sun/awt/motif/MCanvasPeer.java \ - sun/awt/motif/MCheckboxPeer.java \ - sun/awt/motif/MFileDialogPeer.java \ - sun/awt/motif/MGlobalCursorManager.java \ - sun/awt/motif/MTextFieldPeer.java \ - sun/awt/motif/MLabelPeer.java \ - sun/awt/motif/MListPeer.java \ - sun/awt/motif/MWindowPeer.java \ - sun/awt/motif/MMenuBarPeer.java \ - sun/awt/motif/MMenuPeer.java \ - sun/awt/motif/MPopupMenuPeer.java \ - sun/awt/motif/MDialogPeer.java \ - sun/awt/motif/MMenuItemPeer.java \ - sun/awt/motif/MCheckboxMenuItemPeer.java \ - sun/awt/motif/MChoicePeer.java \ - sun/awt/motif/MTextAreaPeer.java \ - sun/awt/motif/MScrollbarPeer.java \ - sun/awt/motif/MScrollPanePeer.java \ - sun/awt/motif/MFramePeer.java \ sun/awt/DebugSettings.java \ sun/awt/EmbeddedFrame.java \ - sun/awt/motif/MEmbeddedFramePeer.java \ sun/awt/PlatformFont.java \ sun/awt/FontDescriptor.java \ sun/awt/NativeLibLoader.java \ - sun/awt/motif/MDropTargetContextPeer.java \ - sun/awt/motif/MDragSourceContextPeer.java \ - sun/awt/motif/MRobotPeer.java \ - sun/awt/motif/X11DragSourceContextPeer.java \ - sun/awt/motif/X11DropTargetContextPeer.java \ sun/awt/X11GraphicsEnvironment.java \ sun/awt/X11GraphicsDevice.java \ sun/awt/X11GraphicsConfig.java \ @@ -124,7 +91,6 @@ sun/java2d/cmm/ColorTransform.java \ sun/awt/datatransfer/DataTransferer.java \ sun/awt/dnd/SunDragSourceContextPeer.java \ - sun/awt/motif/MDataTransferer.java \ sun/awt/motif/MToolkitThreadBlockedHandler.java \ sun/java2d/opengl/OGLBlitLoops.java \ sun/java2d/opengl/OGLContext.java \ @@ -220,6 +186,5 @@ java/awt/event/NativeLibLoader.java \ java/awt/peer/ComponentPeer.java \ java/awt/dnd/DnDConstants.java \ - sun/awt/CausedFocusEvent.java \ - sun/awt/motif/MEmbedCanvasPeer.java + sun/awt/CausedFocusEvent.java
--- a/make/sun/awt/mapfile-mawt-vers Wed Sep 17 13:45:37 2008 -0700 +++ b/make/sun/awt/mapfile-mawt-vers Fri Sep 19 19:38:12 2008 -0700 @@ -31,7 +31,7 @@ global: JNI_OnLoad; - Java_sun_awt_motif_MComponentPeer_restoreFocus; + #Java_sun_awt_motif_MComponentPeer_restoreFocus; Java_sun_awt_DefaultMouseInfoPeer_fillPointWithCoords; Java_sun_awt_DefaultMouseInfoPeer_isWindowUnderMouse; Java_java_awt_AWTEvent_nativeSetSource; @@ -56,163 +56,163 @@ 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_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; @@ -236,30 +236,30 @@ 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_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; @@ -268,18 +268,18 @@ 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_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; @@ -311,25 +311,25 @@ Java_sun_awt_X11GraphicsEnvironment_initGLX; Java_sun_awt_X11GraphicsEnvironment_pRunningXinerama; Java_sun_awt_X11GraphicsEnvironment_getXineramaCenterPoint; - 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_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; @@ -343,39 +343,39 @@ 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_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_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_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_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;
--- a/make/sun/awt/mapfile-vers-linux Wed Sep 17 13:45:37 2008 -0700 +++ b/make/sun/awt/mapfile-vers-linux Fri Sep 19 19:38:12 2008 -0700 @@ -170,7 +170,7 @@ GrPrim_Sg2dGetPixel; GrPrim_Sg2dGetLCDTextContrast; - Java_sun_awt_motif_MComponentPeer_restoreFocus; + #Java_sun_awt_motif_MComponentPeer_restoreFocus; Java_sun_awt_DefaultMouseInfoPeer_fillPointWithCoords; Java_sun_awt_DefaultMouseInfoPeer_isWindowUnderMouse; Java_java_awt_AWTEvent_nativeSetSource; @@ -189,158 +189,158 @@ 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_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; @@ -357,28 +357,28 @@ 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_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; @@ -387,18 +387,18 @@ 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_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; @@ -442,40 +442,40 @@ 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_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_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_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_X11InputMethod_initIDs; Java_sun_awt_motif_X11OffScreenImage_updateBitmask; - Java_sun_awt_motif_X11Selection_initIDs; + #Java_sun_awt_motif_X11Selection_initIDs; Java_sun_awt_motif_MToolkitThreadBlockedHandler_enter; Java_sun_awt_motif_MToolkitThreadBlockedHandler_exit; Java_sun_awt_X11GraphicsConfig_init; @@ -503,26 +503,26 @@ 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; + #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;
--- a/make/sun/awt/mawt.gmk Wed Sep 17 13:45:37 2008 -0700 +++ b/make/sun/awt/mawt.gmk Fri Sep 19 19:38:12 2008 -0700 @@ -28,14 +28,6 @@ # INIT += $(LIB_LOCATION) -ifndef HEADLESS -ifeq ($(PLATFORM), linux) -ifeq ($(STATIC_MOTIF),false) -INIT += $(LIB_LOCATION)/libXm.so -endif -endif -endif - # # Files # @@ -52,13 +44,9 @@ ifdef HEADLESS FILES_c = $(FILES_NO_MOTIF_c) else - FILES_c = $(FILES_MOTIF_c) $(FILES_NO_MOTIF_c) - - ifeq ($(MOTIF_VERSION), 2) - FILES_c += awt_motif21.c - FILES_c += awt_Choice21.c - endif - +# 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 ifeq ($(PLATFORM), solaris) @@ -93,15 +81,6 @@ $(LIB_LOCATION): $(MKDIR) -p $@ -ifeq ($(PLATFORM), linux) -ifeq ($(STATIC_MOTIF),false) -$(LIB_LOCATION)/libXm.so: - $(CP) $(MOTIF_LIB)/libXm.so $(LIB_LOCATION)/libXm.so -# Automounter problem makes the link fail on Redhat 6.1. -# $(LN) -s $(MOTIF_LIB)/libXm.so $(LIB_LOCATION)/libXm.so -endif -endif - clean:: # @@ -135,33 +114,49 @@ CPPFLAGS += -DHEADLESS=$(HEADLESS) OTHER_LDLIBS = else -CFLAGS += -DMOTIF_VERSION=$(MOTIF_VERSION) +#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 +#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) + # XXX what about the rest of them? + 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)) + LIBXTST = $(firstword $(wildcard /usr/X11R6/lib/libXtst.a) \ + $(wildcard /usr/lib/libXtst.a)) + endif +endif # Use -lXmu for EditRes support LIBXMU_DBG = -lXmu @@ -169,14 +164,14 @@ LIBXMU = $(LIBXMU_$(VARIANT)) ifeq ($(PLATFORM), solaris) -OTHER_LDLIBS = $(LIBXM) -lXt -lXext $(LIBXTST) $(LIBXMU) -lX11 -lXi +OTHER_LDLIBS = -lXt -lXext $(LIBXTST) $(LIBXMU) -lX11 -lXi endif ifeq ($(PLATFORM), linux) OTHER_CFLAGS += -DMLIB_NO_LIBSUNMATH -OTHER_CFLAGS += -DMOTIF_VERSION=2 +# XXX what is this define below? Isn't it motif-related? OTHER_CFLAGS += -DXMSTRINGDEFINES=1 -OTHER_LDLIBS = $(LIBXM) $(LIBXMU) $(LIBXTST) -lXext $(LIBXT) $(LIBSM) $(LIBICE) -lX11 -lXi +OTHER_LDLIBS = $(LIBXMU) $(LIBXTST) -lXext $(LIBXT) $(LIBSM) $(LIBICE) -lX11 -lXi endif endif @@ -199,9 +194,8 @@ CPPFLAGS += -I$(CUPS_HEADERS_PATH) ifndef HEADLESS -CPPFLAGS += -I$(MOTIF_DIR)/include \ - -I$(OPENWIN_HOME)/include -LDFLAGS += -L$(MOTIF_LIB) -L$(OPENWIN_LIB) +CPPFLAGS += -I$(OPENWIN_HOME)/include +LDFLAGS += -L$(OPENWIN_LIB) endif # !HEADLESS
--- a/src/share/classes/java/awt/Button.java Wed Sep 17 13:45:37 2008 -0700 +++ b/src/share/classes/java/awt/Button.java Fri Sep 19 19:38:12 2008 -0700 @@ -213,8 +213,8 @@ } // This could change the preferred size of the Component. - if (testvalid && valid) { - invalidate(); + if (testvalid) { + invalidateIfValid(); } }
--- a/src/share/classes/java/awt/Checkbox.java Wed Sep 17 13:45:37 2008 -0700 +++ b/src/share/classes/java/awt/Checkbox.java Fri Sep 19 19:38:12 2008 -0700 @@ -1,5 +1,5 @@ /* - * Copyright 1995-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1995-2008 Sun Microsystems, Inc. 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 @@ -284,8 +284,8 @@ } // This could change the preferred size of the Component. - if (testvalid && valid) { - invalidate(); + if (testvalid) { + invalidateIfValid(); } }
--- a/src/share/classes/java/awt/Choice.java Wed Sep 17 13:45:37 2008 -0700 +++ b/src/share/classes/java/awt/Choice.java Fri Sep 19 19:38:12 2008 -0700 @@ -1,5 +1,5 @@ /* - * Copyright 1995-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1995-2008 Sun Microsystems, Inc. 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 @@ -207,9 +207,7 @@ } // This could change the preferred size of the Component. - if (valid) { - invalidate(); - } + invalidateIfValid(); } /** @@ -269,9 +267,7 @@ } // This could change the preferred size of the Component. - if (valid) { - invalidate(); - } + invalidateIfValid(); } /** @@ -299,9 +295,7 @@ } // This could change the preferred size of the Component. - if (valid) { - invalidate(); - } + invalidateIfValid(); } /** @@ -323,9 +317,7 @@ } // This could change the preferred size of the Component. - if (valid) { - invalidate(); - } + invalidateIfValid(); } /** @@ -367,9 +359,7 @@ } // This could change the preferred size of the Component. - if (valid) { - invalidate(); - } + invalidateIfValid(); } /**
--- a/src/share/classes/java/awt/Component.java Wed Sep 17 13:45:37 2008 -0700 +++ b/src/share/classes/java/awt/Component.java Fri Sep 19 19:38:12 2008 -0700 @@ -350,7 +350,7 @@ * @see #validate * @see #invalidate */ - volatile boolean valid = false; + private volatile boolean valid = false; /** * The <code>DropTarget</code> associated with this component. @@ -639,11 +639,21 @@ */ private PropertyChangeSupport changeSupport; - // Note: this field is considered final, though readObject() prohibits - // initializing final fields. - private transient Object changeSupportLock = new Object(); - private Object getChangeSupportLock() { - return changeSupportLock; + /* + * In some cases using "this" as an object to synchronize by + * can lead to a deadlock if client code also uses synchronization + * by a component object. For every such situation revealed we should + * consider possibility of replacing "this" with the package private + * objectLock object introduced below. So far there're 2 issues known: + * - CR 6708322 (the getName/setName methods); + * - CR 6608764 (the PropertyChangeListener machinery). + * + * Note: this field is considered final, though readObject() prohibits + * initializing final fields. + */ + private transient Object objectLock = new Object(); + Object getObjectLock() { + return objectLock; } boolean isPacked = false; @@ -816,7 +826,7 @@ */ public String getName() { if (name == null && !nameExplicitlySet) { - synchronized(this) { + synchronized(getObjectLock()) { if (name == null && !nameExplicitlySet) name = constructComponentName(); } @@ -833,7 +843,7 @@ */ public void setName(String name) { String oldName; - synchronized(this) { + synchronized(getObjectLock()) { oldName = this.name; this.name = name; nameExplicitlySet = true; @@ -1708,9 +1718,9 @@ // This could change the preferred size of the Component. // Fix for 6213660. Should compare old and new fonts and do not // call invalidate() if they are equal. - if (valid && f != oldFont && (oldFont == null || + if (f != oldFont && (oldFont == null || !oldFont.equals(f))) { - invalidate(); + invalidateIfValid(); } } @@ -1767,9 +1777,7 @@ firePropertyChange("locale", oldValue, l); // This could change the preferred size of the Component. - if (valid) { - invalidate(); - } + invalidateIfValid(); } /** @@ -2078,8 +2086,8 @@ if (resized) { invalidate(); } - if (parent != null && parent.valid) { - parent.invalidate(); + if (parent != null) { + parent.invalidateIfValid(); } } if (needNotify) { @@ -2135,7 +2143,7 @@ Toolkit.getEventQueue().postEvent(e); } } else { - if (this instanceof Container && ((Container)this).ncomponents > 0) { + if (this instanceof Container && ((Container)this).countComponents() > 0) { boolean enabledOnToolkit = Toolkit.enabledOnToolkit(AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK); if (resized) { @@ -2648,7 +2656,8 @@ public void validate() { synchronized (getTreeLock()) { ComponentPeer peer = this.peer; - if (!valid && peer != null) { + boolean wasValid = isValid(); + if (!wasValid && peer != null) { Font newfont = getFont(); Font oldfont = peerFont; if (newfont != oldfont && (oldfont == null @@ -2659,6 +2668,9 @@ peer.layout(); } valid = true; + if (!wasValid) { + mixOnValidating(); + } } } @@ -2687,9 +2699,17 @@ if (!isMaximumSizeSet()) { maxSize = null; } - if (parent != null && parent.valid) { - parent.invalidate(); - } + if (parent != null) { + parent.invalidateIfValid(); + } + } + } + + /** Invalidates the component unless it is already invalid. + */ + final void invalidateIfValid() { + if (isValid()) { + invalidate(); } } @@ -5794,7 +5814,7 @@ } } - transient EventQueueItem[] eventCache; + transient sun.awt.EventQueueItem[] eventCache; /** * @see #isCoalescingEnabled @@ -7545,9 +7565,7 @@ Container rootAncestor = getTraversalRoot(); Component comp = this; while (rootAncestor != null && - !(rootAncestor.isShowing() && - rootAncestor.isFocusable() && - rootAncestor.isEnabled())) + !(rootAncestor.isShowing() && rootAncestor.canBeFocusOwner())) { comp = rootAncestor; rootAncestor = comp.getFocusCycleRootAncestor(); @@ -7596,9 +7614,7 @@ Container rootAncestor = getTraversalRoot(); Component comp = this; while (rootAncestor != null && - !(rootAncestor.isShowing() && - rootAncestor.isFocusable() && - rootAncestor.isEnabled())) + !(rootAncestor.isShowing() && rootAncestor.canBeFocusOwner())) { comp = rootAncestor; rootAncestor = comp.getFocusCycleRootAncestor(); @@ -7777,7 +7793,7 @@ protected String paramString() { String thisName = getName(); String str = (thisName != null? thisName : "") + "," + x + "," + y + "," + width + "x" + height; - if (!valid) { + if (!isValid()) { str += ",invalid"; } if (!visible) { @@ -7905,7 +7921,7 @@ */ public void addPropertyChangeListener( PropertyChangeListener listener) { - synchronized (getChangeSupportLock()) { + synchronized (getObjectLock()) { if (listener == null) { return; } @@ -7931,7 +7947,7 @@ */ public void removePropertyChangeListener( PropertyChangeListener listener) { - synchronized (getChangeSupportLock()) { + synchronized (getObjectLock()) { if (listener == null || changeSupport == null) { return; } @@ -7954,7 +7970,7 @@ * @since 1.4 */ public PropertyChangeListener[] getPropertyChangeListeners() { - synchronized (getChangeSupportLock()) { + synchronized (getObjectLock()) { if (changeSupport == null) { return new PropertyChangeListener[0]; } @@ -7996,7 +8012,7 @@ public void addPropertyChangeListener( String propertyName, PropertyChangeListener listener) { - synchronized (getChangeSupportLock()) { + synchronized (getObjectLock()) { if (listener == null) { return; } @@ -8026,7 +8042,7 @@ public void removePropertyChangeListener( String propertyName, PropertyChangeListener listener) { - synchronized (getChangeSupportLock()) { + synchronized (getObjectLock()) { if (listener == null || changeSupport == null) { return; } @@ -8050,7 +8066,7 @@ */ public PropertyChangeListener[] getPropertyChangeListeners( String propertyName) { - synchronized (getChangeSupportLock()) { + synchronized (getObjectLock()) { if (changeSupport == null) { return new PropertyChangeListener[0]; } @@ -8071,7 +8087,7 @@ protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { PropertyChangeSupport changeSupport; - synchronized (getChangeSupportLock()) { + synchronized (getObjectLock()) { changeSupport = this.changeSupport; } if (changeSupport == null || @@ -8373,7 +8389,7 @@ private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException { - changeSupportLock = new Object(); + objectLock = new Object(); s.defaultReadObject(); @@ -8537,9 +8553,7 @@ firePropertyChange("componentOrientation", oldValue, o); // This could change the preferred size of the Component. - if (valid) { - invalidate(); - } + invalidateIfValid(); } /** @@ -8575,6 +8589,14 @@ setComponentOrientation(orientation); } + final boolean canBeFocusOwner() { + // It is enabled, visible, focusable. + if (isEnabled() && isDisplayable() && isVisible() && isFocusable()) { + return true; + } + return false; + } + /** * Checks that this component meets the prerequesites to be focus owner: * - it is enabled, visible, focusable @@ -8584,9 +8606,9 @@ * this component as focus owner * @since 1.5 */ - final boolean canBeFocusOwner() { + final boolean canBeFocusOwnerRecursively() { // - it is enabled, visible, focusable - if (!(isEnabled() && isDisplayable() && isVisible() && isFocusable())) { + if (!canBeFocusOwner()) { return false; } @@ -9381,7 +9403,8 @@ */ private boolean areBoundsValid() { Container cont = getContainer(); - return cont == null || cont.isValid() || cont.getLayout() == null; + return cont == null || cont.isValid() + || cont.getLayout() == null; } /** @@ -9652,5 +9675,10 @@ } } + void mixOnValidating() { + // This method gets overriden in the Container. Obviously, a plain + // non-container components don't need to handle validation. + } + // ****************** END OF MIXING CODE ******************************** }
--- a/src/share/classes/java/awt/Container.java Wed Sep 17 13:45:37 2008 -0700 +++ b/src/share/classes/java/awt/Container.java Fri Sep 19 19:38:12 2008 -0700 @@ -44,8 +44,6 @@ import java.util.Arrays; import java.util.EventListener; import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; import java.util.Set; import java.util.logging.*; @@ -90,21 +88,14 @@ private static final Logger log = Logger.getLogger("java.awt.Container"); private static final Logger eventLog = Logger.getLogger("java.awt.event.Container"); - /** - * The number of components in this container. - * This value can be null. - * @see #getComponent - * @see #getComponents - * @see #getComponentCount - */ - int ncomponents; + private static final Component[] EMPTY_ARRAY = new Component[0]; /** * The components in this container. * @see #add * @see #getComponents */ - Component component[] = new Component[0]; + private java.util.List<Component> component = new java.util.ArrayList<Component>(); /** * Layout manager for this container. @@ -290,7 +281,9 @@ */ @Deprecated public int countComponents() { - return ncomponents; + synchronized (getTreeLock()) { + return component.size(); + } } /** @@ -302,10 +295,10 @@ */ public Component getComponent(int n) { synchronized (getTreeLock()) { - if ((n < 0) || (n >= ncomponents)) { + if ((n < 0) || (n >= component.size())) { throw new ArrayIndexOutOfBoundsException("No such child: " + n); } - return component[n]; + return component.get(n); } } @@ -322,7 +315,7 @@ // DO NOT INVOKE CLIENT CODE ON THIS THREAD! final Component[] getComponents_NoClientCode() { synchronized (getTreeLock()) { - return Arrays.copyOf(component, ncomponents); + return component.toArray(EMPTY_ARRAY); } } // getComponents_NoClientCode() @@ -422,6 +415,29 @@ } /** + * Checks that the component + * isn't supposed to be added into itself. + */ + private void checkAddToSelf(Component comp){ + if (comp instanceof Container) { + for (Container cn = this; cn != null; cn=cn.parent) { + if (cn == comp) { + throw new IllegalArgumentException("adding container's parent to itself"); + } + } + } + } + + /** + * Checks that the component is not a Window instance. + */ + private void checkNotAWindow(Component comp){ + if (comp instanceof Window) { + throw new IllegalArgumentException("adding a window to a container"); + } + } + + /** * Checks that the component comp can be added to this container * Checks : index in bounds of container's size, * comp is not one of this container's parents, @@ -437,26 +453,18 @@ GraphicsConfiguration thisGC = getGraphicsConfiguration(); - if (index > ncomponents || index < 0) { + if (index > component.size() || index < 0) { throw new IllegalArgumentException("illegal component position"); } if (comp.parent == this) { - if (index == ncomponents) { + if (index == component.size()) { throw new IllegalArgumentException("illegal component position " + - index + " should be less then " + ncomponents); + index + " should be less then " + component.size()); } } - if (comp instanceof Container) { - for (Container cn = this; cn != null; cn=cn.parent) { - if (cn == comp) { - throw new IllegalArgumentException("adding container's parent to itself"); - } - } - - if (comp instanceof Window) { - throw new IllegalArgumentException("adding a window to a container"); - } - } + checkAddToSelf(comp); + checkNotAWindow(comp); + Window thisTopLevel = getContainingWindow(); Window compTopLevel = comp.getContainingWindow(); if (thisTopLevel != compTopLevel) { @@ -495,25 +503,17 @@ adjustDescendants(-(comp.countHierarchyMembers())); comp.parent = null; - System.arraycopy(component, index + 1, - component, index, - ncomponents - index - 1); - component[--ncomponents] = null; - - if (valid) { - invalidate(); - } + component.remove(index); + + invalidateIfValid(); } else { - if (newIndex > index) { // 2->4: 012345 -> 013425, 2->5: 012345 -> 013452 - if (newIndex-index > 0) { - System.arraycopy(component, index+1, component, index, newIndex-index); - } - } else { // 4->2: 012345 -> 014235 - if (index-newIndex > 0) { - System.arraycopy(component, newIndex, component, newIndex+1, index-newIndex); - } - } - component[newIndex] = comp; + // We should remove component and then + // add it by the newIndex without newIndex decrement if even we shift components to the left + // after remove. Consult the rules below: + // 2->4: 012345 -> 013425, 2->5: 012345 -> 013452 + // 4->2: 012345 -> 014235 + component.remove(index); + component.add(newIndex, comp); } if (comp.parent == null) { // was actually removed if (containerListener != null || @@ -779,17 +779,11 @@ // Check if moving between containers if (curParent != this) { - /* Add component to list; allocate new array if necessary. */ - if (ncomponents == component.length) { - component = Arrays.copyOf(component, ncomponents * 2 + 1); - } - if (index == -1 || index == ncomponents) { - component[ncomponents++] = comp; + //index == -1 means add to the end. + if (index == -1) { + component.add(comp); } else { - System.arraycopy(component, index, component, - index + 1, ncomponents - index); - component[index] = comp; - ncomponents++; + component.add(index, comp); } comp.parent = this; @@ -799,14 +793,12 @@ comp.numListening(AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK)); adjustDescendants(comp.countHierarchyMembers()); } else { - if (index < ncomponents) { - component[index] = comp; + if (index < component.size()) { + component.set(index, comp); } } - if (valid) { - invalidate(); - } + invalidateIfValid(); if (peer != null) { if (comp.peer == null) { // Remove notify was called or it didn't have peer - create new one comp.addNotify(); @@ -860,11 +852,11 @@ // If component is focus owner or parent container of focus owner check that after reparenting // focus owner moved out if new container prohibit this kind of focus owner. - if (comp.isFocusOwner() && !comp.canBeFocusOwner()) { + if (comp.isFocusOwner() && !comp.canBeFocusOwnerRecursively()) { comp.transferFocus(); } else if (comp instanceof Container) { Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); - if (focusOwner != null && isParentOf(focusOwner) && !focusOwner.canBeFocusOwner()) { + if (focusOwner != null && isParentOf(focusOwner) && !focusOwner.canBeFocusOwnerRecursively()) { focusOwner.transferFocus(); } } @@ -901,14 +893,8 @@ if (comp.parent != this) { return -1; } - for (int i = 0; i < ncomponents; i++) { - if (component[i] == comp) { - return i; - } - } + return component.indexOf(comp); } - // To please javac - return -1; } /** @@ -1042,22 +1028,12 @@ */ GraphicsConfiguration thisGC = this.getGraphicsConfiguration(); - if (index > ncomponents || (index < 0 && index != -1)) { + if (index > component.size() || (index < 0 && index != -1)) { throw new IllegalArgumentException( "illegal component position"); } - if (comp instanceof Container) { - for (Container cn = this; cn != null; cn=cn.parent) { - if (cn == comp) { - throw new IllegalArgumentException( - "adding container's parent to itself"); - } - } - if (comp instanceof Window) { - throw new IllegalArgumentException( - "adding a window to a container"); - } - } + checkAddToSelf(comp); + checkNotAWindow(comp); if (thisGC != null) { comp.checkGD(thisGC.getDevice().getIDstring()); } @@ -1065,22 +1041,16 @@ /* Reparent the component and tidy up the tree's state. */ if (comp.parent != null) { comp.parent.remove(comp); - if (index > ncomponents) { + if (index > component.size()) { throw new IllegalArgumentException("illegal component position"); } } - /* Add component to list; allocate new array if necessary. */ - if (ncomponents == component.length) { - component = Arrays.copyOf(component, ncomponents * 2 + 1); - } - if (index == -1 || index == ncomponents) { - component[ncomponents++] = comp; + //index == -1 means add to the end. + if (index == -1) { + component.add(comp); } else { - System.arraycopy(component, index, component, - index + 1, ncomponents - index); - component[index] = comp; - ncomponents++; + component.add(index, comp); } comp.parent = this; @@ -1090,9 +1060,7 @@ comp.numListening(AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK)); adjustDescendants(comp.countHierarchyMembers()); - if (valid) { - invalidate(); - } + invalidateIfValid(); if (peer != null) { comp.addNotify(); } @@ -1129,11 +1097,9 @@ * IllegalArgumentException. */ void checkGD(String stringID) { - Component tempComp; - for (int i = 0; i < component.length; i++) { - tempComp= component[i]; - if (tempComp != null) { - tempComp.checkGD(stringID); + for (Component comp : component) { + if (comp != null) { + comp.checkGD(stringID); } } } @@ -1163,10 +1129,10 @@ */ public void remove(int index) { synchronized (getTreeLock()) { - if (index < 0 || index >= ncomponents) { + if (index < 0 || index >= component.size()) { throw new ArrayIndexOutOfBoundsException(index); } - Component comp = component[index]; + Component comp = component.get(index); if (peer != null) { comp.removeNotify(); } @@ -1181,14 +1147,9 @@ adjustDescendants(-(comp.countHierarchyMembers())); comp.parent = null; - System.arraycopy(component, index + 1, - component, index, - ncomponents - index - 1); - component[--ncomponents] = null; - - if (valid) { - invalidate(); - } + component.remove(index); + + invalidateIfValid(); if (containerListener != null || (eventMask & AWTEvent.CONTAINER_EVENT_MASK) != 0 || Toolkit.enabledOnToolkit(AWTEvent.CONTAINER_EVENT_MASK)) { @@ -1229,14 +1190,9 @@ public void remove(Component comp) { synchronized (getTreeLock()) { if (comp.parent == this) { - /* Search backwards, expect that more recent additions - * are more likely to be removed. - */ - Component component[] = this.component; - for (int i = ncomponents; --i >= 0; ) { - if (component[i] == comp) { - remove(i); - } + int index = component.indexOf(comp); + if (index >= 0) { + remove(index); } } } @@ -1258,9 +1214,8 @@ -listeningBoundsChildren); adjustDescendants(-descendantsCount); - while (ncomponents > 0) { - Component comp = component[--ncomponents]; - component[ncomponents] = null; + while (!component.isEmpty()) { + Component comp = component.remove(component.size()-1); if (peer != null) { comp.removeNotify(); @@ -1286,9 +1241,7 @@ if (peer != null && layoutMgr == null && isVisible()) { updateCursorImmediately(); } - if (valid) { - invalidate(); - } + invalidateIfValid(); } } @@ -1300,8 +1253,8 @@ if (eventLog.isLoggable(Level.FINE)) { // Verify listeningChildren is correct int sum = 0; - for (int i = 0; i < ncomponents; i++) { - sum += component[i].numListening(mask); + for (Component comp : component) { + sum += comp.numListening(mask); } if (listeningChildren != sum) { eventLog.log(Level.FINE, "Assertion (listeningChildren == sum) failed"); @@ -1312,8 +1265,8 @@ if (eventLog.isLoggable(Level.FINE)) { // Verify listeningBoundsChildren is correct int sum = 0; - for (int i = 0; i < ncomponents; i++) { - sum += component[i].numListening(mask); + for (Component comp : component) { + sum += comp.numListening(mask); } if (listeningBoundsChildren != sum) { eventLog.log(Level.FINE, "Assertion (listeningBoundsChildren == sum) failed"); @@ -1375,8 +1328,8 @@ if (log.isLoggable(Level.FINE)) { // Verify descendantsCount is correct int sum = 0; - for (int i = 0; i < ncomponents; i++) { - sum += component[i].countHierarchyMembers(); + for (Component comp : component) { + sum += comp.countHierarchyMembers(); } if (descendantsCount != sum) { log.log(Level.FINE, "Assertion (descendantsCount == sum) failed"); @@ -1408,7 +1361,7 @@ int listeners = getListenersCount(id, enabledOnToolkit); for (int count = listeners, i = 0; count > 0; i++) { - count -= component[i].createHierarchyEvents(id, changed, + count -= component.get(i).createHierarchyEvents(id, changed, changedParent, changeFlags, enabledOnToolkit); } return listeners + @@ -1420,13 +1373,13 @@ boolean enabledOnToolkit) { assert Thread.holdsLock(getTreeLock()); - if (ncomponents == 0) { + if (component.isEmpty()) { return; } int listeners = getListenersCount(id, enabledOnToolkit); for (int count = listeners, i = 0; count > 0; i++) { - count -= component[i].createHierarchyEvents(id, this, parent, + count -= component.get(i).createHierarchyEvents(id, this, parent, changeFlags, enabledOnToolkit); } } @@ -1448,9 +1401,7 @@ */ public void setLayout(LayoutManager mgr) { layoutMgr = mgr; - if (valid) { - invalidate(); - } + invalidateIfValid(); } /** @@ -1522,10 +1473,10 @@ */ public void validate() { /* Avoid grabbing lock unless really necessary. */ - if (!valid) { + if (!isValid()) { boolean updateCur = false; synchronized (getTreeLock()) { - if (!valid && peer != null) { + if (!isValid() && peer != null) { ContainerPeer p = null; if (peer instanceof ContainerPeer) { p = (ContainerPeer) peer; @@ -1534,7 +1485,6 @@ p.beginValidate(); } validateTree(); - valid = true; if (p != null) { p.endValidate(); updateCur = isVisible(); @@ -1557,17 +1507,16 @@ * @see #validate */ protected void validateTree() { - if (!valid) { + if (!isValid()) { if (peer instanceof ContainerPeer) { ((ContainerPeer)peer).beginLayout(); } doLayout(); - Component component[] = this.component; - for (int i = 0 ; i < ncomponents ; ++i) { - Component comp = component[i]; + for (int i = 0; i < component.size(); i++) { + Component comp = component.get(i); if ( (comp instanceof Container) - && !(comp instanceof Window) - && !comp.valid) { + && !(comp instanceof Window) + && !comp.isValid()) { ((Container)comp).validateTree(); } else { comp.validate(); @@ -1577,7 +1526,7 @@ ((ContainerPeer)peer).endLayout(); } } - valid = true; + super.validate(); } /** @@ -1586,20 +1535,16 @@ */ void invalidateTree() { synchronized (getTreeLock()) { - for (int i = 0; i < ncomponents; ++i) { - Component comp = component[i]; + for (int i = 0; i < component.size(); i++) { + Component comp = component.get(i); if (comp instanceof Container) { ((Container)comp).invalidateTree(); } else { - if (comp.valid) { - comp.invalidate(); - } + comp.invalidateIfValid(); } } - if (valid) { - invalidate(); - } + invalidateIfValid(); } } @@ -1838,7 +1783,7 @@ // super.paint(); -- Don't bother, since it's a NOP. GraphicsCallback.PaintCallback.getInstance(). - runComponents(component, g, GraphicsCallback.LIGHTWEIGHTS); + runComponents(component.toArray(EMPTY_ARRAY), g, GraphicsCallback.LIGHTWEIGHTS); } } @@ -1893,7 +1838,7 @@ } GraphicsCallback.PrintCallback.getInstance(). - runComponents(component, g, GraphicsCallback.LIGHTWEIGHTS); + runComponents(component.toArray(EMPTY_ARRAY), g, GraphicsCallback.LIGHTWEIGHTS); } } @@ -1906,7 +1851,7 @@ public void paintComponents(Graphics g) { if (isShowing()) { GraphicsCallback.PaintAllCallback.getInstance(). - runComponents(component, g, GraphicsCallback.TWO_PASSES); + runComponents(component.toArray(EMPTY_ARRAY), g, GraphicsCallback.TWO_PASSES); } } @@ -1928,7 +1873,7 @@ void paintHeavyweightComponents(Graphics g) { if (isShowing()) { GraphicsCallback.PaintHeavyweightComponentsCallback.getInstance(). - runComponents(component, g, GraphicsCallback.LIGHTWEIGHTS | + runComponents(component.toArray(EMPTY_ARRAY), g, GraphicsCallback.LIGHTWEIGHTS | GraphicsCallback.HEAVYWEIGHTS); } } @@ -1942,7 +1887,7 @@ public void printComponents(Graphics g) { if (isShowing()) { GraphicsCallback.PrintAllCallback.getInstance(). - runComponents(component, g, GraphicsCallback.TWO_PASSES); + runComponents(component.toArray(EMPTY_ARRAY), g, GraphicsCallback.TWO_PASSES); } } @@ -1964,7 +1909,7 @@ void printHeavyweightComponents(Graphics g) { if (isShowing()) { GraphicsCallback.PrintHeavyweightComponentsCallback.getInstance(). - runComponents(component, g, GraphicsCallback.LIGHTWEIGHTS | + runComponents(component.toArray(EMPTY_ARRAY), g, GraphicsCallback.LIGHTWEIGHTS | GraphicsCallback.HEAVYWEIGHTS); } } @@ -2260,11 +2205,9 @@ boolean searchHeavyweightChildren, boolean searchHeavyweightDescendants) { synchronized (getTreeLock()) { - int ncomponents = this.ncomponents; - Component component[] = this.component; - - for (int i = 0 ; i < ncomponents ; i++) { - Component comp = component[i]; + + for (int i = 0; i < component.size(); i++) { + Component comp = component.get(i); if (comp != null && comp.visible && ((!searchHeavyweightChildren && comp.peer instanceof LightweightPeer) || @@ -2415,8 +2358,8 @@ } synchronized (getTreeLock()) { // Two passes: see comment in sun.awt.SunGraphicsCallback - for (int i = 0 ; i < ncomponents ; i++) { - Component comp = component[i]; + for (int i = 0; i < component.size(); i++) { + Component comp = component.get(i); if (comp != null && !(comp.peer instanceof LightweightPeer)) { if (comp.contains(x - comp.x, y - comp.y)) { @@ -2424,8 +2367,8 @@ } } } - for (int i = 0 ; i < ncomponents ; i++) { - Component comp = component[i]; + for (int i = 0; i < component.size(); i++) { + Component comp = component.get(i); if (comp != null && comp.peer instanceof LightweightPeer) { if (comp.contains(x - comp.x, y - comp.y)) { @@ -2544,43 +2487,43 @@ if (!(contains(x, y) && visible && (ignoreEnabled || enabled))) { return null; } - int ncomponents = this.ncomponents; - Component component[] = this.component; // Two passes: see comment in sun.awt.SunGraphicsCallback - for (int i = 0 ; i < ncomponents ; i++) { - Component comp = component[i]; - if (comp != null && - !(comp.peer instanceof LightweightPeer)) { - if (comp instanceof Container) { - comp = ((Container)comp).findComponentAtImpl(x - comp.x, - y - comp.y, - ignoreEnabled); - } else { - comp = comp.locate(x - comp.x, y - comp.y); - } - if (comp != null && comp.visible && - (ignoreEnabled || comp.enabled)) - { - return comp; + synchronized (getTreeLock()) { + for (int i = 0; i < component.size(); i++) { + Component comp = component.get(i); + if (comp != null && + !(comp.peer instanceof LightweightPeer)) { + if (comp instanceof Container) { + comp = ((Container)comp).findComponentAtImpl(x - comp.x, + y - comp.y, + ignoreEnabled); + } else { + comp = comp.locate(x - comp.x, y - comp.y); + } + if (comp != null && comp.visible && + (ignoreEnabled || comp.enabled)) + { + return comp; + } } } - } - for (int i = 0 ; i < ncomponents ; i++) { - Component comp = component[i]; - if (comp != null && - comp.peer instanceof LightweightPeer) { - if (comp instanceof Container) { - comp = ((Container)comp).findComponentAtImpl(x - comp.x, - y - comp.y, - ignoreEnabled); - } else { - comp = comp.locate(x - comp.x, y - comp.y); - } - if (comp != null && comp.visible && - (ignoreEnabled || comp.enabled)) - { - return comp; + for (int i = 0; i < component.size(); i++) { + Component comp = component.get(i); + if (comp != null && + comp.peer instanceof LightweightPeer) { + if (comp instanceof Container) { + comp = ((Container)comp).findComponentAtImpl(x - comp.x, + y - comp.y, + ignoreEnabled); + } else { + comp = comp.locate(x - comp.x, y - comp.y); + } + if (comp != null && comp.visible && + (ignoreEnabled || comp.enabled)) + { + return comp; + } } } } @@ -2632,10 +2575,14 @@ if (! (peer instanceof LightweightPeer)) { dispatcher = new LightweightDispatcher(this); } - int ncomponents = this.ncomponents; - Component component[] = this.component; - for (int i = 0 ; i < ncomponents ; i++) { - component[i].addNotify(); + + // We shouldn't use iterator because of the Swing menu + // implementation specifics: + // the menu is being assigned as a child to JLayeredPane + // instead of particular component so always affect + // collection of component if menu is becoming shown or hidden. + for (int i = 0; i < component.size(); i++) { + component.get(i).addNotify(); } // Update stacking order if native platform allows ContainerPeer cpeer = (ContainerPeer)peer; @@ -2658,21 +2605,25 @@ */ public void removeNotify() { synchronized (getTreeLock()) { - int ncomponents = this.ncomponents; - Component component[] = this.component; - for (int i = ncomponents - 1; i >= 0; i--) { - if( component[i] != null ) { + // We shouldn't use iterator because of the Swing menu + // implementation specifics: + // the menu is being assigned as a child to JLayeredPane + // instead of particular component so always affect + // collection of component if menu is becoming shown or hidden. + for (int i = component.size()-1 ; i >= 0 ; i--) { + Component comp = component.get(i); + if (comp != null) { // Fix for 6607170. // We want to suppress focus change on disposal // of the focused component. But because of focus // is asynchronous, we should suppress focus change // on every component in case it receives native focus // in the process of disposal. - component[i].setAutoFocusTransferOnDisposal(false); - component[i].removeNotify(); - component[i].setAutoFocusTransferOnDisposal(true); - } - } + comp.setAutoFocusTransferOnDisposal(false); + comp.removeNotify(); + comp.setAutoFocusTransferOnDisposal(true); + } + } // If some of the children had focus before disposal then it still has. // Auto-transfer focus to the next (or previous) component if auto-transfer // is enabled. @@ -2683,7 +2634,7 @@ } if ( dispatcher != null ) { dispatcher.dispose(); - dispatcher = null; + dispatcher = null; } super.removeNotify(); } @@ -2873,12 +2824,12 @@ */ public void list(PrintStream out, int indent) { super.list(out, indent); - int ncomponents = this.ncomponents; - Component component[] = this.component; - for (int i = 0 ; i < ncomponents ; i++) { - Component comp = component[i]; - if (comp != null) { - comp.list(out, indent+1); + synchronized(getTreeLock()) { + for (int i = 0; i < component.size(); i++) { + Component comp = component.get(i); + if (comp != null) { + comp.list(out, indent+1); + } } } } @@ -2899,12 +2850,12 @@ */ public void list(PrintWriter out, int indent) { super.list(out, indent); - int ncomponents = this.ncomponents; - Component component[] = this.component; - for (int i = 0 ; i < ncomponents ; i++) { - Component comp = component[i]; - if (comp != null) { - comp.list(out, indent+1); + synchronized(getTreeLock()) { + for (int i = 0; i < component.size(); i++) { + Component comp = component.get(i); + if (comp != null) { + comp.list(out, indent+1); + } } } } @@ -3414,9 +3365,11 @@ */ public void applyComponentOrientation(ComponentOrientation o) { super.applyComponentOrientation(o); - - for (int i = 0 ; i < ncomponents ; ++i) { - component[i].applyComponentOrientation(o); + synchronized (getTreeLock()) { + for (int i = 0; i < component.size(); i++) { + Component comp = component.get(i); + comp.applyComponentOrientation(o); + } } } @@ -3534,8 +3487,8 @@ */ private void writeObject(ObjectOutputStream s) throws IOException { ObjectOutputStream.PutField f = s.putFields(); - f.put("ncomponents", ncomponents); - f.put("component", component); + f.put("ncomponents", component.size()); + f.put("component", component.toArray(EMPTY_ARRAY)); f.put("layoutMgr", layoutMgr); f.put("dispatcher", dispatcher); f.put("maxSize", maxSize); @@ -3574,8 +3527,12 @@ throws ClassNotFoundException, IOException { ObjectInputStream.GetField f = s.readFields(); - ncomponents = f.get("ncomponents", 0); - component = (Component[])f.get("component", new Component[0]); + Component [] tmpComponent = (Component[])f.get("component", EMPTY_ARRAY); + int ncomponents = (Integer) f.get("ncomponents", 0); + component = new java.util.ArrayList<Component>(ncomponents); + for (int i = 0; i < ncomponents; ++i) { + component.add(tmpComponent[i]); + } layoutMgr = (LayoutManager)f.get("layoutMgr", null); dispatcher = (LightweightDispatcher)f.get("dispatcher", null); // Old stream. Doesn't contain maxSize among Component's fields. @@ -3585,16 +3542,14 @@ focusCycleRoot = f.get("focusCycleRoot", false); containerSerializedDataVersion = f.get("containerSerializedDataVersion", 1); focusTraversalPolicyProvider = f.get("focusTraversalPolicyProvider", false); - - Component component[] = this.component; - for(int i = 0; i < ncomponents; i++) { - component[i].parent = this; + java.util.List<Component> component = this.component; + for(Component comp : component) { + comp.parent = this; adjustListeningChildren(AWTEvent.HIERARCHY_EVENT_MASK, - component[i].numListening(AWTEvent.HIERARCHY_EVENT_MASK)); + comp.numListening(AWTEvent.HIERARCHY_EVENT_MASK)); adjustListeningChildren(AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK, - component[i].numListening( - AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK)); - adjustDescendants(component[i].countHierarchyMembers()); + comp.numListening(AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK)); + adjustDescendants(comp.countHierarchyMembers()); } Object keyOrNull; @@ -4111,6 +4066,21 @@ } } + @Override + void mixOnValidating() { + synchronized (getTreeLock()) { + if (mixingLog.isLoggable(Level.FINE)) { + mixingLog.fine("this = " + this); + } + + if (hasHeavyweightDescendants()) { + recursiveApplyCurrentShape(); + } + + super.mixOnValidating(); + } + } + // ****************** END OF MIXING CODE ******************************** }
--- a/src/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java Wed Sep 17 13:45:37 2008 -0700 +++ b/src/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java Fri Sep 19 19:38:12 2008 -0700 @@ -556,8 +556,7 @@ * enabled, and focusable; <code>false</code> otherwise */ protected boolean accept(Component aComponent) { - if (!(aComponent.isVisible() && aComponent.isDisplayable() && - aComponent.isFocusable() && aComponent.isEnabled())) { + if (!aComponent.canBeFocusOwner()) { return false; }
--- a/src/share/classes/java/awt/DefaultKeyboardFocusManager.java Wed Sep 17 13:45:37 2008 -0700 +++ b/src/share/classes/java/awt/DefaultKeyboardFocusManager.java Fri Sep 19 19:38:12 2008 -0700 @@ -154,7 +154,7 @@ private boolean doRestoreFocus(Component toFocus, Component vetoedComponent, boolean clearOnFailure) { - if (toFocus != vetoedComponent && toFocus.isShowing() && toFocus.isFocusable() && + if (toFocus != vetoedComponent && toFocus.isShowing() && toFocus.canBeFocusOwner() && toFocus.requestFocus(false, CausedFocusEvent.Cause.ROLLBACK)) { return true; @@ -500,8 +500,11 @@ } } - if (!(newFocusOwner.isFocusable() && newFocusOwner.isEnabled() - && newFocusOwner.isShowing())) + if (!(newFocusOwner.isFocusable() && newFocusOwner.isShowing() && + // Refuse focus on a disabled component if the focus event + // isn't of UNKNOWN reason (i.e. not a result of a direct request + // but traversal, activation or system generated). + (newFocusOwner.isEnabled() || cause.equals(CausedFocusEvent.Cause.UNKNOWN)))) { // we should not accept focus on such component, so reject it. dequeueKeyEvents(-1, newFocusOwner); @@ -742,8 +745,7 @@ public boolean dispatchKeyEvent(KeyEvent e) { Component focusOwner = (((AWTEvent)e).isPosted) ? getFocusOwner() : e.getComponent(); - if (focusOwner != null && focusOwner.isShowing() && - focusOwner.isFocusable() && focusOwner.isEnabled()) { + if (focusOwner != null && focusOwner.isShowing() && focusOwner.canBeFocusOwner()) { if (!e.isConsumed()) { Component comp = e.getComponent(); if (comp != null && comp.isEnabled()) {
--- a/src/share/classes/java/awt/Dialog.java Wed Sep 17 13:45:37 2008 -0700 +++ b/src/share/classes/java/awt/Dialog.java Fri Sep 19 19:38:12 2008 -0700 @@ -1,5 +1,5 @@ /* - * Copyright 1995-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1995-2008 Sun Microsystems, Inc. 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 @@ -1327,8 +1327,8 @@ // the insets of the Dialog. If we could, we'd call invalidate() // from the peer, but we need to guarantee that we're not holding // the Dialog lock when we call invalidate(). - if (testvalid && valid) { - invalidate(); + if (testvalid) { + invalidateIfValid(); } }
--- a/src/share/classes/java/awt/EventQueue.java Wed Sep 17 13:45:37 2008 -0700 +++ b/src/share/classes/java/awt/EventQueue.java Fri Sep 19 19:38:12 2008 -0700 @@ -42,6 +42,7 @@ import sun.awt.AWTAutoShutdown; import sun.awt.PeerEvent; import sun.awt.SunToolkit; +import sun.awt.EventQueueItem; /** * <code>EventQueue</code> is a platform-independent class @@ -359,7 +360,7 @@ entry != null; entry = entry.next) { // Give Component.coalesceEvents a chance - if (entry.event.getSource() == source && entry.id == id) { + if (entry.event.getSource() == source && entry.event.getID() == id) { AWTEvent coalescedEvent = source.coalesceEvents( entry.event, e); if (coalescedEvent != null) { @@ -499,7 +500,7 @@ for (EventQueueItem entry = queues[i].head, prev = null; entry != null; prev = entry, entry = entry.next) { - if (entry.id == id) { + if (entry.event.getID() == id) { if (prev == null) { queues[i].head = entry.next; } else { @@ -545,7 +546,7 @@ for (int i = NUM_PRIORITIES - 1; i >= 0; i--) { EventQueueItem q = queues[i].head; for (; q != null; q = q.next) { - if (q.id == id) { + if (q.event.getID() == id) { return q.event; } } @@ -1051,14 +1052,3 @@ EventQueueItem head; EventQueueItem tail; } - -class EventQueueItem { - AWTEvent event; - int id; - EventQueueItem next; - - EventQueueItem(AWTEvent evt) { - event = evt; - id = evt.getID(); - } -}
--- a/src/share/classes/java/awt/Frame.java Wed Sep 17 13:45:37 2008 -0700 +++ b/src/share/classes/java/awt/Frame.java Fri Sep 19 19:38:12 2008 -0700 @@ -1,5 +1,5 @@ /* - * Copyright 1995-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1995-2008 Sun Microsystems, Inc. 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 @@ -590,9 +590,7 @@ if (peer != null) { mbManagement = true; menuBar.addNotify(); - if (valid) { - invalidate(); - } + invalidateIfValid(); peer.setMenuBar(menuBar); } } @@ -633,8 +631,8 @@ // the insets of the Frame. If we could, we'd call invalidate() // from the peer, but we need to guarantee that we're not holding // the Frame lock when we call invalidate(). - if (testvalid && valid) { - invalidate(); + if (testvalid) { + invalidateIfValid(); } firePropertyChange("resizable", oldResizable, resizable); } @@ -907,9 +905,7 @@ FramePeer peer = (FramePeer)this.peer; if (peer != null) { mbManagement = true; - if (valid) { - invalidate(); - } + invalidateIfValid(); peer.setMenuBar(null); m.removeNotify(); }
--- a/src/share/classes/java/awt/Label.java Wed Sep 17 13:45:37 2008 -0700 +++ b/src/share/classes/java/awt/Label.java Fri Sep 19 19:38:12 2008 -0700 @@ -1,5 +1,5 @@ /* - * Copyright 1995-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1995-2008 Sun Microsystems, Inc. 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 @@ -257,8 +257,8 @@ } // This could change the preferred size of the Component. - if (testvalid && valid) { - invalidate(); + if (testvalid) { + invalidateIfValid(); } }
--- a/src/share/classes/java/awt/ScrollPane.java Wed Sep 17 13:45:37 2008 -0700 +++ b/src/share/classes/java/awt/ScrollPane.java Fri Sep 19 19:38:12 2008 -0700 @@ -357,7 +357,7 @@ */ public void setScrollPosition(int x, int y) { synchronized (getTreeLock()) { - if (ncomponents <= 0) { + if (getComponentCount()==0) { throw new NullPointerException("child is null"); } hAdjustable.setValue(x); @@ -393,10 +393,12 @@ */ @Transient public Point getScrollPosition() { - if (ncomponents <= 0) { - throw new NullPointerException("child is null"); + synchronized (getTreeLock()) { + if (getComponentCount()==0) { + throw new NullPointerException("child is null"); + } + return new Point(hAdjustable.getValue(), vAdjustable.getValue()); } - return new Point(hAdjustable.getValue(), vAdjustable.getValue()); } /** @@ -486,26 +488,27 @@ */ @Deprecated public void layout() { - if (ncomponents > 0) { - Component c = getComponent(0); - Point p = getScrollPosition(); - Dimension cs = calculateChildSize(); - Dimension vs = getViewportSize(); - Insets i = getInsets(); + if (getComponentCount()==0) { + return; + } + Component c = getComponent(0); + Point p = getScrollPosition(); + Dimension cs = calculateChildSize(); + Dimension vs = getViewportSize(); + Insets i = getInsets(); - c.reshape(i.left - p.x, i.top - p.y, cs.width, cs.height); - ScrollPanePeer peer = (ScrollPanePeer)this.peer; - if (peer != null) { - peer.childResized(cs.width, cs.height); - } + c.reshape(i.left - p.x, i.top - p.y, cs.width, cs.height); + ScrollPanePeer peer = (ScrollPanePeer)this.peer; + if (peer != null) { + peer.childResized(cs.width, cs.height); + } - // update adjustables... the viewport size may have changed - // with the scrollbars coming or going so the viewport size - // is updated before the adjustables. - vs = getViewportSize(); - hAdjustable.setSpan(0, cs.width, vs.width); - vAdjustable.setSpan(0, cs.height, vs.height); - } + // update adjustables... the viewport size may have changed + // with the scrollbars coming or going so the viewport size + // is updated before the adjustables. + vs = getViewportSize(); + hAdjustable.setSpan(0, cs.width, vs.width); + vAdjustable.setSpan(0, cs.height, vs.height); } /** @@ -515,20 +518,21 @@ * @see Component#printAll */ public void printComponents(Graphics g) { - if (ncomponents > 0) { - Component c = component[0]; - Point p = c.getLocation(); - Dimension vs = getViewportSize(); - Insets i = getInsets(); + if (getComponentCount()==0) { + return; + } + Component c = getComponent(0); + Point p = c.getLocation(); + Dimension vs = getViewportSize(); + Insets i = getInsets(); - Graphics cg = g.create(); - try { - cg.clipRect(i.left, i.top, vs.width, vs.height); - cg.translate(p.x, p.y); - c.printAll(cg); - } finally { - cg.dispose(); - } + Graphics cg = g.create(); + try { + cg.clipRect(i.left, i.top, vs.width, vs.height); + cg.translate(p.x, p.y); + c.printAll(cg); + } finally { + cg.dispose(); } } @@ -589,7 +593,7 @@ default: sdpStr = "invalid display policy"; } - Point p = ncomponents > 0? getScrollPosition() : new Point(0,0); + Point p = (getComponentCount()>0)? getScrollPosition() : new Point(0,0); Insets i = getInsets(); return super.paramString()+",ScrollPosition=("+p.x+","+p.y+")"+ ",Insets=("+i.top+","+i.left+","+i.bottom+","+i.right+")"+
--- a/src/share/classes/java/awt/SystemTray.java Wed Sep 17 13:45:37 2008 -0700 +++ b/src/share/classes/java/awt/SystemTray.java Fri Sep 19 19:38:12 2008 -0700 @@ -1,5 +1,5 @@ /* - * Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2005-2008 Sun Microsystems, Inc. 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 @@ -125,6 +125,8 @@ transient private SystemTrayPeer peer; + private static final TrayIcon[] EMPTY_TRAY_ARRAY = new TrayIcon[0]; + /** * Private <code>SystemTray</code> constructor. * @@ -201,17 +203,18 @@ * functionality is supported for the current platform */ public static boolean isSupported() { - initializeSystemTrayIfNeeded(); - - if (Toolkit.getDefaultToolkit() instanceof SunToolkit) { - - return ((SunToolkit)Toolkit.getDefaultToolkit()).isTraySupported(); - - } else if (Toolkit.getDefaultToolkit() instanceof HeadlessToolkit) { - - return ((HeadlessToolkit)Toolkit.getDefaultToolkit()).isTraySupported(); + Toolkit toolkit = Toolkit.getDefaultToolkit(); + if (toolkit instanceof SunToolkit) { + // connecting tray to native resource + initializeSystemTrayIfNeeded(); + return ((SunToolkit)toolkit).isTraySupported(); + } else if (toolkit instanceof HeadlessToolkit) { + // skip initialization as the init routine + // throws HeadlessException + return ((HeadlessToolkit)toolkit).isTraySupported(); + } else { + return false; } - return false; } /** @@ -323,7 +326,7 @@ if (icons != null) { return (TrayIcon[])icons.toArray(new TrayIcon[icons.size()]); } - return new TrayIcon[0]; + return EMPTY_TRAY_ARRAY; } /** @@ -475,7 +478,12 @@ synchronized void addNotify() { if (peer == null) { - peer = ((SunToolkit)Toolkit.getDefaultToolkit()).createSystemTray(this); + Toolkit toolkit = Toolkit.getDefaultToolkit(); + if (toolkit instanceof SunToolkit) { + peer = ((SunToolkit)Toolkit.getDefaultToolkit()).createSystemTray(this); + } else if (toolkit instanceof HeadlessToolkit) { + peer = ((HeadlessToolkit)Toolkit.getDefaultToolkit()).createSystemTray(this); + } } }
--- a/src/share/classes/java/awt/TextField.java Wed Sep 17 13:45:37 2008 -0700 +++ b/src/share/classes/java/awt/TextField.java Fri Sep 19 19:38:12 2008 -0700 @@ -1,5 +1,5 @@ /* - * Copyright 1995-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1995-2008 Sun Microsystems, Inc. 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 @@ -296,9 +296,7 @@ super.setText(t); // This could change the preferred size of the Component. - if (valid) { - invalidate(); - } + invalidateIfValid(); } /**
--- a/src/share/classes/java/awt/TrayIcon.java Wed Sep 17 13:45:37 2008 -0700 +++ b/src/share/classes/java/awt/TrayIcon.java Fri Sep 19 19:38:12 2008 -0700 @@ -1,5 +1,5 @@ /* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2005-2008 Sun Microsystems, Inc. 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 @@ -38,6 +38,7 @@ import java.awt.peer.TrayIconPeer; import sun.awt.AppContext; import sun.awt.SunToolkit; +import sun.awt.HeadlessToolkit; import java.util.EventObject; /** @@ -142,9 +143,6 @@ */ public TrayIcon(Image image) { this(); - if (image == null) { - throw new IllegalArgumentException("creating TrayIcon with null Image"); - } setImage(image); } @@ -433,7 +431,7 @@ * @see java.awt.event.MouseListener */ public synchronized MouseListener[] getMouseListeners() { - return (MouseListener[])(getListeners(MouseListener.class)); + return AWTEventMulticaster.getListeners(mouseListener, MouseListener.class); } /** @@ -494,7 +492,7 @@ * @see java.awt.event.MouseMotionListener */ public synchronized MouseMotionListener[] getMouseMotionListeners() { - return (MouseMotionListener[]) (getListeners(MouseMotionListener.class)); + return AWTEventMulticaster.getListeners(mouseMotionListener, MouseMotionListener.class); } /** @@ -581,7 +579,7 @@ * @see java.awt.event.ActionListener */ public synchronized ActionListener[] getActionListeners() { - return (ActionListener[])(getListeners(ActionListener.class)); + return AWTEventMulticaster.getListeners(actionListener, ActionListener.class); } /** @@ -635,7 +633,7 @@ TrayIconPeer peer = this.peer; if (peer != null) { - peer.displayMessage(caption, text, messageType.toString()); + peer.displayMessage(caption, text, messageType.name()); } } @@ -657,24 +655,17 @@ // **************************************************************** // **************************************************************** - <T extends EventListener> T[] getListeners(Class<T> listenerType) { - EventListener l = null; - if (listenerType == MouseListener.class) { - l = mouseListener; - } else if (listenerType == MouseMotionListener.class) { - l = mouseMotionListener; - } else if (listenerType == ActionListener.class) { - l = actionListener; - } - return AWTEventMulticaster.getListeners(l, listenerType); - } - void addNotify() throws AWTException { synchronized (this) { if (peer == null) { - peer = ((SunToolkit)Toolkit.getDefaultToolkit()).createTrayIcon(this); + Toolkit toolkit = Toolkit.getDefaultToolkit(); + if (toolkit instanceof SunToolkit) { + peer = ((SunToolkit)Toolkit.getDefaultToolkit()).createTrayIcon(this); + } else if (toolkit instanceof HeadlessToolkit) { + peer = ((HeadlessToolkit)Toolkit.getDefaultToolkit()).createTrayIcon(this); + } } } peer.setToolTip(tooltip);
--- a/src/share/classes/java/awt/Window.java Wed Sep 17 13:45:37 2008 -0700 +++ b/src/share/classes/java/awt/Window.java Fri Sep 19 19:38:12 2008 -0700 @@ -3145,9 +3145,7 @@ Component previousComp = temporaryLostComponent; // Check that "component" is an acceptable focus owner and don't store it otherwise // - or later we will have problems with opposite while handling WINDOW_GAINED_FOCUS - if (component == null - || (component.isDisplayable() && component.isVisible() && component.isEnabled() && component.isFocusable())) - { + if (component == null || component.canBeFocusOwner()) { temporaryLostComponent = component; } else { temporaryLostComponent = null;
--- a/src/share/classes/java/awt/dnd/DragSourceContext.java Wed Sep 17 13:45:37 2008 -0700 +++ b/src/share/classes/java/awt/dnd/DragSourceContext.java Fri Sep 19 19:38:12 2008 -0700 @@ -486,6 +486,8 @@ Cursor c = null; switch (status) { + default: + targetAct = DnDConstants.ACTION_NONE; case ENTER: case OVER: case CHANGED: @@ -506,10 +508,6 @@ else c = DragSource.DefaultCopyDrop; } - break; - default: - targetAct = DnDConstants.ACTION_NONE; - } setCursorImpl(c);
--- a/src/share/classes/javax/swing/Popup.java Wed Sep 17 13:45:37 2008 -0700 +++ b/src/share/classes/javax/swing/Popup.java Fri Sep 19 19:38:12 2008 -0700 @@ -26,7 +26,9 @@ package javax.swing; import java.awt.*; + import sun.awt.ModalExclude; +import sun.awt.SunToolkit; /** * Popups are used to display a <code>Component</code> to the user, typically @@ -225,7 +227,12 @@ HeavyWeightWindow(Window parent) { super(parent); setFocusableWindowState(false); - setName("###overrideRedirect###"); + Toolkit tk = Toolkit.getDefaultToolkit(); + if (tk instanceof SunToolkit) { + // all the short-lived windows like Popups should be + // OverrideRedirect on X11 platforms + ((SunToolkit)tk).setOverrideRedirect(this); + } // Popups are typically transient and most likely won't benefit // from true double buffering. Turn it off here. getRootPane().setUseTrueDoubleBuffering(false);
--- a/src/share/classes/sun/awt/EmbeddedFrame.java Wed Sep 17 13:45:37 2008 -0700 +++ b/src/share/classes/sun/awt/EmbeddedFrame.java Fri Sep 19 19:38:12 2008 -0700 @@ -257,21 +257,27 @@ Set toTest; Component currentFocused = e.getComponent(); - Component last = getFocusTraversalPolicy().getLastComponent(this); toTest = getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS); - if (toTest.contains(stroke) && (currentFocused == last || last == null)) { - if (traverseOut(FORWARD)) { - e.consume(); - return true; + if (toTest.contains(stroke)) { + // 6581899: performance improvement for SortingFocusTraversalPolicy + Component last = getFocusTraversalPolicy().getLastComponent(this); + if (currentFocused == last || last == null) { + if (traverseOut(FORWARD)) { + e.consume(); + return true; + } } } - Component first = getFocusTraversalPolicy().getFirstComponent(this); toTest = getFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS); - if (toTest.contains(stroke) && (currentFocused == first || first == null)) { - if (traverseOut(BACKWARD)) { - e.consume(); - return true; + if (toTest.contains(stroke)) { + // 6581899: performance improvement for SortingFocusTraversalPolicy + Component first = getFocusTraversalPolicy().getFirstComponent(this); + if (currentFocused == first || first == null) { + if (traverseOut(BACKWARD)) { + e.consume(); + return true; + } } } return false;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/classes/sun/awt/EventQueueItem.java Fri Sep 19 19:38:12 2008 -0700 @@ -0,0 +1,37 @@ +/* + * Copyright 2008 Sun Microsystems, Inc. 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. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +package sun.awt; + +import java.awt.AWTEvent; + +public class EventQueueItem { + public AWTEvent event; + public EventQueueItem next; + + public EventQueueItem(AWTEvent evt) { + event = evt; + } +}
--- a/src/share/classes/sun/awt/SunToolkit.java Wed Sep 17 13:45:37 2008 -0700 +++ b/src/share/classes/sun/awt/SunToolkit.java Fri Sep 19 19:38:12 2008 -0700 @@ -1,5 +1,5 @@ /* - * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-2008 Sun Microsystems, Inc. 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 @@ -852,6 +852,15 @@ return AccessController.doPrivileged(new GetBooleanAction("sun.awt.erasebackgroundonresize")); } + + /** + * Makes the window OverrideRedirect, on X11 platforms. See + * ICCCM specification for more details about OverrideRedirect + * windows. Implemented in XToolkit, no-op in WToolkit. + */ + public void setOverrideRedirect(Window target) { + } + static SoftCache imgCache = new SoftCache(); static synchronized Image getImageFromHash(Toolkit tk, URL url) { @@ -2039,12 +2048,3 @@ SunToolkit.wakeupEventQueue(eventQueue, event.getSource() == AWTAutoShutdown.getInstance()); } } // class PostEventQueue - -class EventQueueItem { - AWTEvent event; - EventQueueItem next; - - EventQueueItem(AWTEvent evt) { - event = evt; - } -} // class EventQueueItem
--- a/src/solaris/classes/sun/awt/X11/XKeysym.java Wed Sep 17 13:45:37 2008 -0700 +++ b/src/solaris/classes/sun/awt/X11/XKeysym.java Fri Sep 19 19:38:12 2008 -0700 @@ -101,10 +101,15 @@ // Otherwise, it is [1]. int ndx = XToolkit.isXsunServer() && ! XToolkit.isXKBenabled() ? 2 : 1; + // Even if XKB is enabled, we have another problem: some symbol tables (e.g. cz) force + // a regular comma instead of KP_comma for a decimal separator. Result is, + // bugs like 6454041. So, we will try for keypadness a keysym with ndx==0 as well. XToolkit.awtLock(); try { - return XlibWrapper.IsKeypadKey( - XlibWrapper.XKeycodeToKeysym(ev.get_display(), ev.get_keycode(), ndx ) ); + return (XlibWrapper.IsKeypadKey( + XlibWrapper.XKeycodeToKeysym(ev.get_display(), ev.get_keycode(), ndx ) ) || + XlibWrapper.IsKeypadKey( + XlibWrapper.XKeycodeToKeysym(ev.get_display(), ev.get_keycode(), 0 ) )); } finally { XToolkit.awtUnlock(); }
--- a/src/solaris/classes/sun/awt/X11/XNETProtocol.java Wed Sep 17 13:45:37 2008 -0700 +++ b/src/solaris/classes/sun/awt/X11/XNETProtocol.java Fri Sep 19 19:38:12 2008 -0700 @@ -189,6 +189,8 @@ req.set_format(32); req.set_data(0, (!set) ? _NET_WM_STATE_REMOVE : _NET_WM_STATE_ADD); req.set_data(1, state.getAtom()); + // Fix for 6735584: req.data[2] must be set to 0 when only one property is changed + req.set_data(2, 0); log.log(Level.FINE, "Setting _NET_STATE atom {0} on {1} for {2}", new Object[] {state, window, Boolean.valueOf(set)}); XToolkit.awtLock(); try {
--- a/src/solaris/classes/sun/awt/X11/XToolkit.java Wed Sep 17 13:45:37 2008 -0700 +++ b/src/solaris/classes/sun/awt/X11/XToolkit.java Fri Sep 19 19:38:12 2008 -0700 @@ -97,6 +97,11 @@ static int awt_multiclick_time; static boolean securityWarningEnabled; + // WeakSet should be used here, but there is no such class + // in JDK (at least in JDK6 and earlier versions) + private WeakHashMap<Window, Boolean> overrideRedirectWindows = + new WeakHashMap<Window, Boolean>(); + private static int screenWidth = -1, screenHeight = -1; // Dimensions of default screen static long awt_defaultFg; // Pixel private static XMouseInfoPeer xPeer; @@ -1248,6 +1253,19 @@ } } + @Override + public void setOverrideRedirect(Window target) { + synchronized (overrideRedirectWindows) { + overrideRedirectWindows.put(target, true); + } + } + + public boolean isOverrideRedirect(Window target) { + synchronized (overrideRedirectWindows) { + return overrideRedirectWindows.containsKey(target); + } + } + static void dumpPeers() { if (log.isLoggable(Level.FINE)) { log.fine("Mapped windows:");
--- a/src/solaris/classes/sun/awt/X11/XWindowPeer.java Wed Sep 17 13:45:37 2008 -0700 +++ b/src/solaris/classes/sun/awt/X11/XWindowPeer.java Fri Sep 19 19:38:12 2008 -0700 @@ -129,6 +129,7 @@ private static final int MAXIMUM_BUFFER_LENGTH_NET_WM_ICON = (2<<15) - 1; void preInit(XCreateWindowParams params) { + target = (Component)params.get(TARGET); params.put(REPARENTED, Boolean.valueOf(isOverrideRedirect() || isSimpleWindow())); super.preInit(params); @@ -1117,6 +1118,7 @@ boolean isOverrideRedirect() { return (XWM.getWMID() == XWM.OPENLOOK_WM ? true : false) || + ((XToolkit)Toolkit.getDefaultToolkit()).isOverrideRedirect((Window)target) || XTrayIconPeer.isTrayIconStuffWindow((Window)target); }
--- a/src/solaris/classes/sun/awt/X11/keysym2ucs.h Wed Sep 17 13:45:37 2008 -0700 +++ b/src/solaris/classes/sun/awt/X11/keysym2ucs.h Fri Sep 19 19:38:12 2008 -0700 @@ -139,10 +139,15 @@ tojava // Otherwise, it is [1]. tojava int ndx = XToolkit.isXsunServer() && tojava ! XToolkit.isXKBenabled() ? 2 : 1; +tojava // Even if XKB is enabled, we have another problem: some symbol tables (e.g. cz) force +tojava // a regular comma instead of KP_comma for a decimal separator. Result is, +tojava // bugs like 6454041. So, we will try for keypadness a keysym with ndx==0 as well. tojava XToolkit.awtLock(); tojava try { -tojava return XlibWrapper.IsKeypadKey( -tojava XlibWrapper.XKeycodeToKeysym(ev.get_display(), ev.get_keycode(), ndx ) ); +tojava return (XlibWrapper.IsKeypadKey( +tojava XlibWrapper.XKeycodeToKeysym(ev.get_display(), ev.get_keycode(), ndx ) ) || +tojava XlibWrapper.IsKeypadKey( +tojava XlibWrapper.XKeycodeToKeysym(ev.get_display(), ev.get_keycode(), 0 ) )); tojava } finally { tojava XToolkit.awtUnlock(); tojava }
--- a/src/solaris/classes/sun/awt/motif/MButtonPeer.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -/* - * Copyright 1995-2001 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package sun.awt.motif; - -import java.awt.*; -import java.awt.peer.*; -import java.awt.event.ActionEvent; - -class MButtonPeer extends MComponentPeer implements ButtonPeer { - native void create(MComponentPeer peer); - public native void setLabel(String label); - - MButtonPeer(Button target) { - super(target); - } - - public Dimension getMinimumSize() { - FontMetrics fm = getFontMetrics(target.getFont()); - String label = ((Button)target).getLabel(); - if ( label == null ) { - label = ""; - } - return new Dimension(fm.stringWidth(label) + 14, - fm.getHeight() + 8); - } - - public boolean isFocusable() { - return true; - } - - // NOTE: This method is called by privileged threads. - // DO NOT INVOKE CLIENT CODE ON THIS THREAD! - public void action(final long when, final int modifiers) { - MToolkit.executeOnEventHandlerThread(target, new Runnable() { - public void run() { - postEvent(new ActionEvent(target, ActionEvent.ACTION_PERFORMED, - ((Button)target).getActionCommand(), - when, modifiers)); - } - }); - } - - /* - * Print the native component by rendering the Motif look ourselves. - * ToDo(aim): needs to query native motif for more accurate size and - * color information. - */ - public void print(Graphics g) { - Button b = (Button)target; - Dimension d = b.size(); - Color bg = b.getBackground(); - Color fg = b.getForeground(); - - g.setColor(bg); - g.fillRect(2, 2, d.width - 3, d.height - 3); - draw3DRect(g, bg, 1, 1, d.width - 2, d.height - 2, true); - - g.setColor(fg); - g.setFont(b.getFont()); - FontMetrics fm = g.getFontMetrics(); - String lbl = b.getLabel(); - g.drawString(lbl, (d.width - fm.stringWidth(lbl)) / 2, - (d.height + fm.getMaxAscent() - fm.getMaxDescent()) / 2); - - target.print(g); - } - - /** - * DEPRECATED - */ - public Dimension minimumSize() { - return getMinimumSize(); - } - -}
--- a/src/solaris/classes/sun/awt/motif/MCanvasPeer.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/* - * Copyright 1995-2005 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package sun.awt.motif; - -import java.awt.*; -import java.awt.peer.*; -import sun.awt.DisplayChangedListener; -import sun.awt.X11GraphicsConfig; -import sun.awt.X11GraphicsDevice; -import sun.awt.X11GraphicsEnvironment; - -class MCanvasPeer extends MComponentPeer implements CanvasPeer, - DisplayChangedListener { - - native void create(MComponentPeer parent); - private static native void initIDs(); - static { - initIDs(); - } - - MCanvasPeer() {} - - MCanvasPeer(Component target) { - super(target); - } - - MCanvasPeer(Component target, Object arg) { - super(target, arg); - } - -/* --- DisplayChangedListener Stuff --- */ - public void displayChanged() {} - public void paletteChanged() {} - native void resetTargetGC(Component target); - - /* - * Called when the Window this - * Canvas is on is moved onto another Xinerama screen. - * - * Canvases can be created with a non-defulat GraphicsConfiguration. The - * GraphicsConfiguration needs to be changed to one on the new screen, - * preferably with the same visual ID. - * - * Up-called for other windows peer instances (WPanelPeer, WWindowPeer). - * - * Should only be called from the event thread. - */ - public void displayChanged(int screenNum) { - resetLocalGC(screenNum); - resetTargetGC(target); /* call Canvas.setGCFromPeer() via native */ - } - - /* Set graphicsConfig to a GraphicsConfig with the same visual on the new - * screen, which should be easy in Xinerama mode. - * - * Should only be called from displayChanged(), and therefore only from - * the event thread. - */ - void resetLocalGC(int screenNum) { - // Opt: Only need to do if we're not using the default GC - if (graphicsConfig != null) { - X11GraphicsConfig parentgc; - // save vis id of current gc - int visual = graphicsConfig.getVisual(); - - X11GraphicsDevice newDev = (X11GraphicsDevice) GraphicsEnvironment. - getLocalGraphicsEnvironment(). - getScreenDevices()[screenNum]; - - for (int i = 0; i < newDev.getNumConfigs(screenNum); i++) { - if (visual == newDev.getConfigVisualId(i, screenNum)) { - // use that - graphicsConfig = (X11GraphicsConfig)newDev.getConfigurations()[i]; - break; - } - } - // just in case... - if (graphicsConfig == null) { - graphicsConfig = (X11GraphicsConfig) GraphicsEnvironment. - getLocalGraphicsEnvironment(). - getScreenDevices()[screenNum]. - getDefaultConfiguration(); - } - } - } - - protected boolean shouldFocusOnClick() { - // Canvas should always be able to be focused by mouse clicks. - return true; - } -}
--- a/src/solaris/classes/sun/awt/motif/MCheckboxMenuItemPeer.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* - * Copyright 1995-2005 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package sun.awt.motif; - - -import java.awt.*; -import java.awt.event.*; -import java.awt.peer.*; - -class MCheckboxMenuItemPeer extends MMenuItemPeer - implements CheckboxMenuItemPeer { - private boolean inUpCall=false; - private boolean inInit=false; - - native void pSetState(boolean t); - native boolean getState(); - - void create(MMenuPeer parent) { - super.create(parent); - inInit=true; - setState(((CheckboxMenuItem)target).getState()); - inInit=false; - } - - MCheckboxMenuItemPeer(CheckboxMenuItem target) { - this.target = target; - isCheckbox = true; - MMenuPeer parent = (MMenuPeer) MToolkit.targetToPeer(getParent_NoClientCode(target)); - create(parent); - } - - public void setState(boolean t) { - if (!nativeCreated) { - return; - } - if (!inUpCall && (t != getState())) { - pSetState(t); - if (!inInit) { - // 4135725 : do not notify on programatic changes - // notifyStateChanged(t); - } - } - } - - void notifyStateChanged(boolean state) { - CheckboxMenuItem cb = (CheckboxMenuItem)target; - ItemEvent e = new ItemEvent(cb, - ItemEvent.ITEM_STATE_CHANGED, - cb.getLabel(), - state ? ItemEvent.SELECTED : ItemEvent.DESELECTED); - postEvent(e); - } - - - // NOTE: This method may be called by privileged threads. - // DO NOT INVOKE CLIENT CODE ON THIS THREAD! - public void action(long when, int modifiers, boolean state) { - final CheckboxMenuItem cb = (CheckboxMenuItem)target; - final boolean newState = state; - - MToolkit.executeOnEventHandlerThread(cb, new Runnable() { - public void run() { - cb.setState(newState); - notifyStateChanged(newState); - } - }); - //Fix for 5005195: MAWT: CheckboxMenuItem fires action events - //super.action() is not invoked - } // action() -} // class MCheckboxMenuItemPeer
--- a/src/solaris/classes/sun/awt/motif/MCheckboxPeer.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,187 +0,0 @@ -/* - * Copyright 1995-2000 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package sun.awt.motif; - -import java.awt.*; -import java.awt.peer.*; -import java.awt.event.*; - -public class MCheckboxPeer extends MComponentPeer implements CheckboxPeer { - private boolean inUpCall = false; - private boolean inInit=false; - - native void create(MComponentPeer parent); - native void pSetState(boolean state); - native boolean pGetState(); - - public native void setLabel(String label); - public native void setCheckboxGroup(CheckboxGroup g); - - - void initialize() { - Checkbox t = (Checkbox)target; - inInit=true; - - setState(t.getState()); - setCheckboxGroup(t.getCheckboxGroup()); - super.initialize(); - inInit=false; - } - - public MCheckboxPeer(Checkbox target) { - super(target); - } - - public boolean isFocusable() { - return true; - } - - public void setState(boolean state) { - if (inInit) { - pSetState(state); - } else if (!inUpCall && (state != pGetState())) { - pSetState(state); - // 4135725 : do not notify on programatic changes - // notifyStateChanged(state); - } - } - private native int getIndicatorSize(); - private native int getSpacing(); - - public Dimension getMinimumSize() { - String lbl = ((Checkbox)target).getLabel(); - if (lbl == null) { - lbl = ""; - } - FontMetrics fm = getFontMetrics(target.getFont()); - /* - * Spacing (number of pixels between check mark and label text) is - * currently set to 0, but in case it ever changes we have to add - * it. 8 is a heuristic number. Indicator size depends on font - * height, so we don't need to include it in checkbox's height - * calculation. - */ - int wdth = fm.stringWidth(lbl) + getIndicatorSize() + getSpacing() + 8; - int hght = Math.max(fm.getHeight() + 8, 15); - return new Dimension(wdth, hght); - } - - - void notifyStateChanged(boolean state) { - Checkbox cb = (Checkbox) target; - ItemEvent e = new ItemEvent(cb, - ItemEvent.ITEM_STATE_CHANGED, - cb.getLabel(), - state ? ItemEvent.SELECTED : ItemEvent.DESELECTED); - postEvent(e); - } - - - // NOTE: This method is called by privileged threads. - // DO NOT INVOKE CLIENT CODE ON THIS THREAD! - void action(boolean state) { - final Checkbox cb = (Checkbox)target; - final boolean newState = state; - MToolkit.executeOnEventHandlerThread(cb, new Runnable() { - public void run() { - CheckboxGroup cbg = cb.getCheckboxGroup(); - /* Bugid 4039594. If this is the current Checkbox in - * a CheckboxGroup, then return to prevent deselection. - * Otherwise, it's logical state will be turned off, - * but it will appear on. - */ - if ((cbg != null) && (cbg.getSelectedCheckbox() == cb) && - cb.getState()) { - inUpCall = false; - cb.setState(true); - return; - } - // All clear - set the new state - cb.setState(newState); - notifyStateChanged(newState); - } // run() - }); - } // action() - - - - static final int SIZE = 19; - static final int BORDER = 4; - static final int SIZ = SIZE - BORDER*2 - 1; - - /* - * Print the native component by rendering the Motif look ourselves. - * ToDo(aim): needs to query native motif for more accurate size and - * color information; need to render check mark. - */ - public void print(Graphics g) { - Checkbox cb = (Checkbox)target; - Dimension d = cb.size(); - Color bg = cb.getBackground(); - Color fg = cb.getForeground(); - Color shadow = bg.darker(); - int x = BORDER; - int y = ((d.height - SIZE) / 2) + BORDER; - - g.setColor(cb.getState()? shadow : bg); - - if (cb.getCheckboxGroup() != null) { - g.fillOval(x, y, SIZ, SIZ); - draw3DOval(g, bg, x, y, SIZ, SIZ, !(cb.getState())); - if (cb.getState()) { - g.setColor(fg); - g.fillOval(x + 3, y + 3, SIZ - 6, SIZ - 6); - } - } else { - g.fillRect(x, y, SIZ, SIZ); - draw3DRect(g, bg, x, y, SIZ, SIZ, !(cb.getState())); - if (cb.getState()) { - g.setColor(fg); - g.drawLine(x+1, y+1, x+SIZ-1, y+SIZ-1); - g.drawLine(x+1, y+SIZ-1, x+SIZ-1, y+1); - } - } - g.setColor(fg); - String lbl = cb.getLabel(); - if (lbl != null) { - // REMIND: align - g.setFont(cb.getFont()); - FontMetrics fm = g.getFontMetrics(); - g.drawString(lbl, SIZE, - (d.height + fm.getMaxAscent() - fm.getMaxDescent()) / 2); - } - - target.print(g); - } - - /** - * DEPRECATED - */ - public Dimension minimumSize() { - return getMinimumSize(); - } - -}
--- a/src/solaris/classes/sun/awt/motif/MChoicePeer.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +0,0 @@ -/* - * Copyright 1995-2003 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package sun.awt.motif; - -import java.awt.*; -import java.awt.peer.*; -import java.awt.event.ItemEvent; - -class MChoicePeer extends MComponentPeer implements ChoicePeer { - boolean inUpCall=false; - - native void create(MComponentPeer parent); - native void pReshape(int x, int y, int width, int height); - native void pSelect(int index, boolean init); - native void appendItems(String[] items); - - void initialize() { - Choice opt = (Choice)target; - int itemCount = opt.countItems(); - String[] items = new String[itemCount]; - for (int i=0; i < itemCount; i++) { - items[i] = opt.getItem(i); - } - if (itemCount > 0) { - appendItems(items); - pSelect(opt.getSelectedIndex(), true); - } - super.initialize(); - } - - public MChoicePeer(Choice target) { - super(target); - } - - public boolean isFocusable() { - return true; - } - - public Dimension getMinimumSize() { - FontMetrics fm = getFontMetrics(target.getFont()); - Choice c = (Choice)target; - int w = 0; - for (int i = c.countItems() ; i-- > 0 ;) { - w = Math.max(fm.stringWidth(c.getItem(i)), w); - } - return new Dimension(32 + w, Math.max(fm.getHeight() + 8, 15) + 5); - } - - public native void setFont(Font f); - - public void add(String item, int index) { - addItem(item, index); - // Adding an item can change the size of the Choice, so do - // a reshape, based on the font size. - Rectangle r = target.getBounds(); - reshape(r.x, r.y, 0, 0); - } - - public native void remove(int index); - - public native void removeAll(); - - /** - * DEPRECATED, but for now, called by add(String, int). - */ - public native void addItem(String item, int index); - - // public native void remove(int index); - - public native void setBackground(Color c); - - public native void setForeground(Color c); - - public void select(int index) { - if (!inUpCall) { - pSelect(index, false); - } - } - - void notifySelection(String item) { - Choice c = (Choice)target; - ItemEvent e = new ItemEvent(c, ItemEvent.ITEM_STATE_CHANGED, - item, ItemEvent.SELECTED); - postEvent(e); - } - - - // NOTE: This method is called by privileged threads. - // DO NOT INVOKE CLIENT CODE ON THIS THREAD! - void action(final int index) { - final Choice c = (Choice)target; - inUpCall = false; /* Used to prevent native selection. */ - MToolkit.executeOnEventHandlerThread(c, new Runnable() { - public void run() { - String item; - synchronized(c) { - if (index >= c.getItemCount()) { - /* Nothing to do when the list is too short */ - return; - } - inUpCall = true; /* Prevent native selection. */ - c.select(index); /* set value in target */ - item = c.getItem(index); - inUpCall = false; - } - notifySelection(item); - } - }); - } - - /* - * Print the native component by rendering the Motif look ourselves. - * ToDo(aim): needs to query native motif for more accurate size and - * color information. - */ - public void print(Graphics g) { - Choice ch = (Choice)target; - Dimension d = ch.size(); - Color bg = ch.getBackground(); - Color fg = ch.getForeground(); - - g.setColor(bg); - g.fillRect(2, 2, d.width-1, d.height-1); - draw3DRect(g, bg, 1, 1, d.width-2, d.height-2, true); - draw3DRect(g, bg, d.width - 18, (d.height / 2) - 3, 10, 6, true); - - g.setColor(fg); - g.setFont(ch.getFont()); - FontMetrics fm = g.getFontMetrics(); - String lbl = ch.getSelectedItem(); - if (lbl == null){ - lbl = ""; - } - if (lbl != ""){ - g.drawString(lbl, 5, (d.height + fm.getMaxAscent()-fm.getMaxDescent())/2); - } - - target.print(g); - } - - /** - * DEPRECATED - */ - public Dimension minimumSize() { - return getMinimumSize(); - } - - protected void disposeImpl() { - freeNativeData(); - super.disposeImpl(); - } - - private native void freeNativeData(); -}
--- a/src/solaris/classes/sun/awt/motif/MComponentPeer.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1185 +0,0 @@ -/* - * Copyright 1995-2008 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package sun.awt.motif; - -import java.awt.*; -import java.awt.peer.*; -import java.awt.event.PaintEvent; -import java.awt.event.MouseEvent; -import java.awt.event.InputEvent; - -import sun.awt.*; -import sun.awt.image.ToolkitImage; -import sun.awt.image.SunVolatileImage; -import java.awt.image.ImageProducer; -import java.awt.image.ImageObserver; -import java.awt.image.ColorModel; -import java.awt.image.VolatileImage; - -import java.awt.dnd.DropTarget; -import java.awt.dnd.peer.DropTargetPeer; - -import sun.java2d.SunGraphics2D; -import sun.java2d.SurfaceData; - -import java.lang.reflect.Method; - -import java.util.logging.*; - -import sun.java2d.pipe.Region; - - -public /* REMIND: should not be public */ -abstract class MComponentPeer implements ComponentPeer, DropTargetPeer, X11ComponentPeer { - - private static final Logger log = Logger.getLogger("sun.awt.motif.MComponentPeer"); - private static final Logger focusLog = Logger.getLogger("sun.awt.motif.focus.MComponentPeer"); - - Component target; - long pData; - long jniGlobalRef; - protected X11GraphicsConfig graphicsConfig; - SurfaceData surfaceData; - int oldWidth = -1; - int oldHeight = -1; - - private RepaintArea paintArea; - - boolean isLayouting = false; - boolean paintPending = false; - - protected boolean disposed = false; - private static int JAWT_LOCK_ERROR=0x00000001; - private static int JAWT_LOCK_CLIP_CHANGED=0x00000002; - private static int JAWT_LOCK_BOUNDS_CHANGED=0x00000004; - private static int JAWT_LOCK_SURFACE_CHANGED=0x00000008; - private int drawState = JAWT_LOCK_CLIP_CHANGED | - JAWT_LOCK_BOUNDS_CHANGED | - JAWT_LOCK_SURFACE_CHANGED; - - /* These are the enumerated types in awt_p.h*/ - static final int MOTIF_NA = 0 ; - static final int MOTIF_V1 = 1 ; - static final int MOTIF_V2 = 2 ; - - private Font font; - private long backBuffer = 0; - private VolatileImage xBackBuffer = null; - - static { - initIDs(); - } - - /* initialize the fieldIDs of fields that may be accessed from C */ - private native static void initIDs(); - - - /* This will return the last state of a window. ie the specific - * "gotcha" is that if you iconify a window its obscurity remains - * unchanged. Current use of this is just in user-initiated scrolling. - * If that use expands to more cases you may need to "and" this with - * the value of the iconic state of a Frame. - * Note that de-iconifying an X11 window DOES generate a new event - * correctly notifying you of the new visibility of the window - */ - public boolean isObscured() { - - Container container = (target instanceof Container) ? - (Container)target : target.getParent(); - - if (container == null) { - return true; - } - - Container parent; - while ((parent = container.getParent()) != null) { - container = parent; - } - - if (container instanceof Window) { - MWindowPeer wpeer = (MWindowPeer)(container.getPeer()); - if (wpeer != null) { - return (wpeer.winAttr.visibilityState != - MWindowAttributes.AWT_UNOBSCURED); - } - } - return true; - } - - public boolean canDetermineObscurity() { - return true; - } - - abstract void create(MComponentPeer parent); - void create(MComponentPeer parent, Object arg) { - create(parent); - } - - void EFcreate(MComponentPeer parent, int x){} - - native void pInitialize(); - native void pShow(); - native void pHide(); - native void pEnable(); - native void pDisable(); - native void pReshape(int x, int y, int width, int height); - native void pDispose(); - native void pMakeCursorVisible(); - native Point pGetLocationOnScreen(); - native Point pGetLocationOnScreen2(Window win, MWindowPeer wpeer); - native void pSetForeground(Color c); - native void pSetBackground(Color c); - private native void pSetFont(Font f); - - //Added for bug 4175560 - //Returns the native representation for the Color argument, - //using the given GraphicsConfiguration. - native int getNativeColor(Color clr, GraphicsConfiguration gc); - - // Returns the parent of the component, without invoking client - // code. This must go through native code, because it invokes - // private methods in the java.awt package, which we cannot - // do from this package. - static native Container getParent_NoClientCode(Component component); - - // Returns the parent of the component, without invoking client - // code. This must go through native code, because it invokes - // private methods in the java.awt package, which we cannot - // do from this package. - static native Component[] getComponents_NoClientCode(Container container); - - void initialize() { - if (!target.isVisible()) { - hide(); - } - Color c; - Font f; - Cursor cursor; - - pInitialize(); - - if ((c = target.getForeground()) != null) { - setForeground(c); - } - if ((c = target.getBackground()) != null) { - setBackground(c); - } - if ((f = target.getFont()) != null) { - setFont(f); - } - pSetCursor(target.getCursor()); - if (!target.isEnabled()) { - disable(); - } - Rectangle r = target.getBounds(); - reshape(r.x, r.y, r.width, r.height); - if (target.isVisible()) { - show(); - } - - surfaceData = graphicsConfig.createSurfaceData(this); - } - - public void init(Component target, Object arg) { - this.target = target; - this.paintArea = new RepaintArea(); - - Container parent = MToolkit.getNativeContainer(target); - MComponentPeer parentPeer = (MComponentPeer) MToolkit.targetToPeer(parent); - create(parentPeer, arg); - - initialize(); - } - - MComponentPeer(Component target, Object arg) { - init(target, arg); - } - - MComponentPeer() {} - - public void init(Component target) { - this.target = target; - this.paintArea = new RepaintArea(); - - Container parent = MToolkit.getNativeContainer(target); - MComponentPeer parentPeer = (MComponentPeer) MToolkit.targetToPeer(parent); - create(parentPeer); - - if (parent != null && parent instanceof ScrollPane) { - MScrollPanePeer speer = (MScrollPanePeer) parentPeer; - speer.setScrollChild(this); - } - initialize(); - } - - MComponentPeer(Component target) { - init(target); - } - - protected void finalize() throws Throwable { - dispose(); - super.finalize(); - } - - public void setForeground(Color c) { - pSetForeground(c); - } - - public void setBackground(Color c) { - pSetBackground(c); - } - - public void updateCursorImmediately() { - MGlobalCursorManager.getCursorManager().updateCursorImmediately(); - } - - public void setFont(Font f) { - ComponentPeer peer; - if (f == null) { - f = defaultFont; - } - pSetFont(f); - if ( target instanceof Container ) { - Container container = (Container) target; - int count = container.getComponentCount(); - Component[] children = container.getComponents(); - for (int i=0; i<count; i++) { - if ( children[i] != null ) { -/* -** note: recursion in the widget in pSetFont() has by now broken any -** children with different Fonts - so fix now: -*/ - peer = children[i].getPeer(); - if (peer != null) { - Font rightFont = children[i].getFont(); - if (!f.equals(rightFont)) { - peer.setFont(rightFont); - } else - if (children[i] instanceof Container) { - peer.setFont(f); - } - } - } - } - } - - /* - * Keep a reference to the java.awt.Font object in order to - * preserve the XFontStructs which underlying widgets are using. - * Save this AFTER changing the widgets in order to keep the - * previous reference (if any) alive. - */ - font = f; - } - - - public native void setTargetBackground(Color c); - public native void pSetCursor(Cursor c); - public native void pSetScrollbarBackground(Color c); - public native void pSetInnerForeground(Color c); - - public boolean isFocusable() { - return false; - } - - public SurfaceData getSurfaceData() { - return surfaceData; - } - - public ColorModel getColorModel() { - return graphicsConfig.getColorModel(); - } - - public ColorModel getColorModel(int transparency) { - return graphicsConfig.getColorModel(transparency); - } - - public int updatePriority() { - return Thread.NORM_PRIORITY; - } - - public void repaint(long tm, int x, int y, int width, int height) { - } - - public void paint(Graphics g) { - Dimension d = target.getSize(); - if (g instanceof Graphics2D || - g instanceof sun.awt.Graphics2Delegate) { - // background color is setup correctly, so just use clearRect - g.clearRect(0, 0, d.width, d.height); - } else { - // emulate clearRect - g.setColor(target.getBackground()); - g.fillRect(0, 0, d.width, d.height); - g.setColor(target.getForeground()); - } - - target.paint(g); - } - public void print(Graphics g) { - Dimension d = target.getSize(); - if (g instanceof Graphics2D || - g instanceof sun.awt.Graphics2Delegate) { - // background color is setup correctly, so just use clearRect - g.clearRect(0, 0, d.width, d.height); - } else { - // emulate clearRect - g.setColor(target.getBackground()); - g.fillRect(0, 0, d.width, d.height); - g.setColor(target.getForeground()); - } - - target.print(g); - } - - public void coalescePaintEvent(PaintEvent e) { - Rectangle r = e.getUpdateRect(); - paintArea.add(r, e.getID()); - - if (log.isLoggable(Level.FINEST)) { - switch(e.getID()) { - case PaintEvent.UPDATE: - log.log(Level.FINEST, "coalescePaintEvent: UPDATE: add: x = " + - r.x + ", y = " + r.y + ", width = " + r.width + ", height = " + r.height); - return; - case PaintEvent.PAINT: - log.log(Level.FINEST, "coalescePaintEvent: PAINT: add: x = " + - r.x + ", y = " + r.y + ", width = " + r.width + ", height = " + r.height); - return; - } - } - } - - native void nativeHandleEvent(AWTEvent e); - - /** - * Returns whether or not this component should be given focus on mouse click. - * Default implementation return whether or not this peer is "focusable" - * Descendants might want to override it to extend/restrict conditions at which this - * component should be focused by click (see MCanvasPeer and MPanelPeer) - */ - protected boolean shouldFocusOnClick() { - return isFocusable(); - } - - /** - * Checks whether or not this component would be focused by native system if it would be allowed to do so. - * Currently it checks that it displayable, visible, enabled and focusable. - */ - static boolean canBeFocusedByClick(Component component) { - if (component == null) { - return false; - } else { - return component.isDisplayable() && component.isVisible() && component.isEnabled() && component.isFocusable(); - } - } - - static Method requestFocusWithCause; - - static void callRequestFocusInWindow(Component target, CausedFocusEvent.Cause cause) { - if (requestFocusWithCause == null) { - requestFocusWithCause = SunToolkit.getMethod(Component.class, "requestFocusInWindow", new Class[] {CausedFocusEvent.Cause.class}); - } - if (requestFocusWithCause != null) { - try { - requestFocusWithCause.invoke(target, new Object[] {cause}); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - public void handleEvent(AWTEvent e) { - int id = e.getID(); - - switch(id) { - case PaintEvent.PAINT: - // Got native painting - paintPending = false; - // Fallthrough to next statement - case PaintEvent.UPDATE: - // Skip all painting while layouting and all UPDATEs - // while waiting for native paint - if (!isLayouting && !paintPending) { - paintArea.paint(target,false); - } - return; - case MouseEvent.MOUSE_PRESSED: - if (target == e.getSource() && !((InputEvent)e).isConsumed() && shouldFocusOnClick() - && !target.isFocusOwner() && canBeFocusedByClick(target)) - { - callRequestFocusInWindow(target, CausedFocusEvent.Cause.MOUSE_EVENT); - } - break; - default: - break; - } - - // Call the native code - nativeHandleEvent(e); - } - - /* New API for 1.1 */ - public Dimension getMinimumSize() { - return target.getSize(); - } - - /* New API for 1.1 */ - public Dimension getPreferredSize() { - return getMinimumSize(); - } - - // Do nothing for heavyweight implementation - public void layout() {} - - public Rectangle getBounds() { - return ((Component)target).getBounds(); - } - - public Object getTarget() { - return target; - } - - public java.awt.Toolkit getToolkit() { - // XXX: bogus - return Toolkit.getDefaultToolkit(); - } - - // fallback default font object - final static Font defaultFont = new Font(Font.DIALOG, Font.PLAIN, 12); - - public synchronized Graphics getGraphics() { - if (!disposed) { - Component target = (Component) this.target; - - /* Fix for bug 4746122. Color and Font shouldn't be null */ - Color bgColor = target.getBackground(); - if (bgColor == null) { - bgColor = SystemColor.window; - } - Color fgColor = target.getForeground(); - if (fgColor == null) { - fgColor = SystemColor.windowText; - } - Font font = target.getFont(); - if (font == null) { - font = defaultFont; - } - return new SunGraphics2D(surfaceData, fgColor, bgColor, font); - } - - return null; - } - - public Image createImage(ImageProducer producer) { - return new ToolkitImage(producer); - } - - public Image createImage(int width, int height) { - return graphicsConfig.createAcceleratedImage(target, width, height); - } - - public VolatileImage createVolatileImage(int width, int height) { - return new SunVolatileImage(target, width, height); - } - - public boolean prepareImage(Image img, int w, int h, ImageObserver o) { - return getToolkit().prepareImage(img, w, h, o); - } - - public int checkImage(Image img, int w, int h, ImageObserver o) { - return getToolkit().checkImage(img, w, h, o); - } - - public FontMetrics getFontMetrics(Font font) { - return X11FontMetrics.getFontMetrics(font); - } - - /* - * Subclasses should override disposeImpl() instead of dispose(). Client - * code should always invoke dispose(), never disposeImpl(). - */ - protected void disposeImpl() { - SurfaceData oldData = surfaceData; - surfaceData = null; - oldData.invalidate(); - MToolkit.targetDisposedPeer(target, this); - pDispose(); - } - public final void dispose() { - boolean call_disposeImpl = false; - - if (!disposed) { - synchronized (this) { - SunToolkit.awtLock(); - try { - if (!disposed) { - disposed = call_disposeImpl = true; - } - } finally { - SunToolkit.awtUnlock(); - } - } - } - - if (call_disposeImpl) { - disposeImpl(); - } - } - - native static boolean processSynchronousLightweightTransfer(Component heavyweight, Component descendant, - boolean temporary, boolean focusedWindowChangeAllowed, - long time); - public boolean requestFocus - (Component lightweightChild, boolean temporary, - boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause) { - if (processSynchronousLightweightTransfer((Component)target, lightweightChild, temporary, - focusedWindowChangeAllowed, time)) { - return true; - } else { - if (focusLog.isLoggable(Level.FINER)) { - focusLog.log(Level.FINER, "Current native focused window " + getNativeFocusedWindow()); - } - /** - * The problems with requests in non-focused window arise because shouldNativelyFocusHeavyweight - * checks that native window is focused while appropriate WINDOW_GAINED_FOCUS has not yet - * been processed - it is in EventQueue. Thus, SNFH allows native request and stores request record - * in requests list - and it breaks our requests sequence as first record on WGF should be the last focus - * owner which had focus before WLF. So, we should not add request record for such requests - * but store this component in mostRecent - and return true as before for compatibility. - */ - Container parent = (target instanceof Container) ? ((Container)target) : (target.getParent()); - // Search for parent window - while (parent != null && !(parent instanceof Window)) { - parent = getParent_NoClientCode(parent); - } - if (parent != null) { - Window parentWindow = (Window)parent; - // and check that it is focused - if (focusLog.isLoggable(Level.FINER)) { - focusLog.log(Level.FINER, "Parent window " + parentWindow); - } - if (!parentWindow.isFocused() && getNativeFocusedWindow() == parentWindow) { - // if it is not - skip requesting focus on Solaris - // but return true for compatibility. - return true; - } else if (getNativeFocusedWindow() != parentWindow) { - WindowPeer wpeer = (WindowPeer)parentWindow.getPeer(); - boolean res = wpeer.requestWindowFocus(); - if (focusLog.isLoggable(Level.FINER)) { - focusLog.log(Level.FINER, "Requested window focus: " + res); - } - // If parent window can be made focused and has been made focused(synchronously) - // then we can proceed with children, otherwise we retreat. - if (!(res && parentWindow.isFocused())) { - focusLog.finer("Waiting for asynchronous processing of window focus request"); - KeyboardFocusManagerPeerImpl.removeLastFocusRequest(target); - return false; - } - } - } - return _requestFocus(lightweightChild, temporary, focusedWindowChangeAllowed, time, cause); - } - } - - native boolean _requestFocus - (Component lightweightChild, boolean temporary, - boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause); - - static native Window getNativeFocusedWindow(); - - /* - * Post an event to the event queue. - */ - // NOTE: This method may be called by privileged threads. - // DO NOT INVOKE CLIENT CODE ON THIS THREAD! - void postEvent(AWTEvent event) { - MToolkit.postEvent(MToolkit.targetToAppContext(target), event); - } - - /* Callbacks for window-system events to the frame - * - * NOTE: This method may be called by privileged threads. - * DO NOT INVOKE CLIENT CODE ON THIS THREAD! - */ - void handleExpose(int x, int y, int w, int h) { - if ( !ComponentAccessor.getIgnoreRepaint(target) ) { - postEvent(new PaintEvent(target, PaintEvent.PAINT, - new Rectangle(x, y, w, h))); - } - } - - /* Callbacks for window-system events to the frame - * - * NOTE: This method may be called by privileged threads. - * DO NOT INVOKE CLIENT CODE ON THIS THREAD! - */ - void handleRepaint(int x, int y, int w, int h) { - if ( !ComponentAccessor.getIgnoreRepaint(target) ) { - postEvent(new PaintEvent(target, PaintEvent.UPDATE, - new Rectangle(x, y, w, h))); - } - } - - /* Return the component's z-order position relative to - * other peer'd siblings (don't count lightweight siblings - * or siblings who don't yet have valid peers). - * - * NOTE: This method may be called by privileged threads. - * DO NOT INVOKE CLIENT CODE ON THIS THREAD! - */ - public int getZOrderPosition_NoClientCode() { - // SECURITY: use _NoClientCode() methods, because we may - // be running on a privileged thread - Container p = getParent_NoClientCode(target); - if (p != null) { - // SECURITY: use _NoClientCode() methods, because we may - // be running on a privileged thread - Component children[] = getComponents_NoClientCode(p); - int i; - int index = 0; - for (i = 0; i < children.length; i++) { - if (children[i] == target) { - return index; - } else { - Object cpeer = MToolkit.targetToPeer(children[i]); - if (cpeer != null && - !(cpeer instanceof java.awt.peer.LightweightPeer)) { - index++; - } - } - } - } - return -1; - } - - /* - * drawXXX() methods are used to print the native components by - * rendering the Motif look ourselves. - * ToDo(aim): needs to query native motif for more accurate color - * information. - */ - void draw3DOval(Graphics g, Color bg, - int x, int y, int w, int h, boolean raised) { - Color c = g.getColor(); - Color shadow = bg.darker(); - Color highlight = bg.brighter(); - - g.setColor(raised ? highlight : shadow); - g.drawArc(x, y, w, h, 45, 180); - g.setColor(raised ? shadow : highlight); - g.drawArc(x, y, w, h, 225, 180); - g.setColor(c); - } - void draw3DRect(Graphics g, Color bg, - int x, int y, int width, int height, - boolean raised) { - Color c = g.getColor(); - Color shadow = bg.darker(); - Color highlight = bg.brighter(); - - g.setColor(raised ? highlight : shadow); - g.drawLine(x, y, x, y + height); - g.drawLine(x + 1, y, x + width - 1, y); - g.setColor(raised ? shadow : highlight); - g.drawLine(x + 1, y + height, x + width, y + height); - g.drawLine(x + width, y, x + width, y + height - 1); - g.setColor(c); - } - void drawScrollbar(Graphics g, Color bg, int thickness, int length, - int min, int max, int val, int vis, boolean horizontal) { - Color c = g.getColor(); - double f = (double)(length - 2*(thickness-1)) / Math.max(1, ((max - min) + vis)); - int v1 = thickness + (int)(f * (val - min)); - int v2 = (int)(f * vis); - int w2 = thickness-4; - int tpts_x[] = new int[3]; - int tpts_y[] = new int[3]; - - if (length < 3*w2 ) { - v1 = v2 = 0; - if (length < 2*w2 + 2) { - w2 = (length-2)/2; - } - } else if (v2 < 7) { - // enforce a minimum handle size - v1 = Math.max(0, v1 - ((7 - v2)>>1)); - v2 = 7; - } - - int ctr = thickness/2; - int sbmin = ctr - w2/2; - int sbmax = ctr + w2/2; - - // paint the background slightly darker - { - Color d = new Color((int) (bg.getRed() * 0.85), - (int) (bg.getGreen() * 0.85), - (int) (bg.getBlue() * 0.85)); - - g.setColor(d); - if (horizontal) { - g.fillRect(0, 0, length, thickness); - } else { - g.fillRect(0, 0, thickness, length); - } - } - - // paint the thumb and arrows in the normal background color - g.setColor(bg); - if (v1 > 0) { - if (horizontal) { - g.fillRect(v1, 3, v2, thickness-3); - } else { - g.fillRect(3, v1, thickness-3, v2); - } - } - - tpts_x[0] = ctr; tpts_y[0] = 2; - tpts_x[1] = sbmin; tpts_y[1] = w2; - tpts_x[2] = sbmax; tpts_y[2] = w2; - if (horizontal) { - g.fillPolygon(tpts_y, tpts_x, 3); - } else { - g.fillPolygon(tpts_x, tpts_y, 3); - } - - tpts_y[0] = length-2; - tpts_y[1] = length-w2; - tpts_y[2] = length-w2; - if (horizontal) { - g.fillPolygon(tpts_y, tpts_x, 3); - } else { - g.fillPolygon(tpts_x, tpts_y, 3); - } - - Color highlight = bg.brighter(); - - // // // // draw the "highlighted" edges - g.setColor(highlight); - - // outline & arrows - if (horizontal) { - g.drawLine(1, thickness, length - 1, thickness); - g.drawLine(length - 1, 1, length - 1, thickness); - - // arrows - g.drawLine(1, ctr, w2, sbmin); - g.drawLine(length - w2, sbmin, length - w2, sbmax); - g.drawLine(length - w2, sbmin, length - 2, ctr); - - } else { - g.drawLine(thickness, 1, thickness, length - 1); - g.drawLine(1, length - 1, thickness, length - 1); - - // arrows - g.drawLine(ctr, 1, sbmin, w2); - g.drawLine(sbmin, length - w2, sbmax, length - w2); - g.drawLine(sbmin, length - w2, ctr, length - 2); - } - - // thumb - if (v1 > 0) { - if (horizontal) { - g.drawLine(v1, 2, v1 + v2, 2); - g.drawLine(v1, 2, v1, thickness-3); - } else { - g.drawLine(2, v1, 2, v1 + v2); - g.drawLine(2, v1, thickness-3, v1); - } - } - - Color shadow = bg.darker(); - - // // // // draw the "shadowed" edges - g.setColor(shadow); - - // outline && arrows - if (horizontal) { - g.drawLine(0, 0, 0, thickness); - g.drawLine(0, 0, length - 1, 0); - - // arrows - g.drawLine(w2, sbmin, w2, sbmax); - g.drawLine(w2, sbmax, 1, ctr); - g.drawLine(length-2, ctr, length-w2, sbmax); - - } else { - g.drawLine(0, 0, thickness, 0); - g.drawLine(0, 0, 0, length - 1); - - // arrows - g.drawLine(sbmin, w2, sbmax, w2); - g.drawLine(sbmax, w2, ctr, 1); - g.drawLine(ctr, length-2, sbmax, length-w2); - } - - // thumb - if (v1 > 0) { - if (horizontal) { - g.drawLine(v1 + v2, 2, v1 + v2, thickness-2); - g.drawLine(v1, thickness-2, v1 + v2, thickness-2); - } else { - g.drawLine(2, v1 + v2, thickness-2, v1 + v2); - g.drawLine(thickness-2, v1, thickness-2, v1 + v2); - } - } - g.setColor(c); - } - - public String toString() { - return getClass().getName() + "[" + target + "]"; - } - - /* New 1.1 API */ - public void setVisible(boolean b) { - if (b) { - Dimension s = target.getSize(); - oldWidth = s.width; - oldHeight = s.height; - pShow(); - } else { - pHide(); - } - } - - /* New 1.1 API */ - public void setEnabled(boolean b) { - if (b) { - pEnable(); - } else { - pDisable(); - } - } - - /* New 1.1 API */ - public Point getLocationOnScreen() { - synchronized (target.getTreeLock()) { - Component comp = target; - while (comp != null && !(comp instanceof Window)) { - comp = getParent_NoClientCode(comp); - } - - // applets, embedded, etc - translate directly - if (comp == null || comp instanceof sun.awt.EmbeddedFrame) { - return pGetLocationOnScreen(); - } - - MWindowPeer wpeer = (MWindowPeer)(MToolkit.targetToPeer(comp)); - if (wpeer == null) { - return pGetLocationOnScreen(); - } - return pGetLocationOnScreen2((Window)comp, wpeer); - } - } - - public int serialNum = 0; - - /* Returns the native paint should be posted after setting new size - */ - public boolean checkNativePaintOnSetBounds(int width, int height) { - return (width != oldWidth) || (height != oldHeight); - } - - void setBounds(int x, int y, int width, int height) { - setBounds(x, y, width, height, SET_BOUNDS); - } - - /* New 1.1 API */ - public void setBounds(int x, int y, int width, int height, int op) { - if (disposed) return; - - Container parent = getParent_NoClientCode(target); - - // Should set paintPending before reshape to prevent - // thread race between PaintEvent and setBounds - // This part of the 4267393 fix proved to be unstable under solaris, - // dissabled due to regressions 4418155, 4486762, 4490079 - paintPending = false; //checkNativePaintOnSetBounds(width, height); - - // Note: it would be ideal to NOT execute this if it's - // merely a Move which is occurring. - if (parent != null && parent instanceof ScrollPane) { - MScrollPanePeer speer = (MScrollPanePeer)parent.getPeer(); - if (!speer.ignore) { - pReshape(x, y, width, height); - speer.childResized(width, height); - } - } else { - pReshape(x, y, width, height); - } - - if ((width != oldWidth) || (height != oldHeight)) { - SurfaceData oldData = surfaceData; - if (oldData != null) { - surfaceData = graphicsConfig.createSurfaceData(this); - oldData.invalidate(); - } - oldWidth = width; - oldHeight = height; - } - validateSurface(width, height); - serialNum++; - } - - void validateSurface(int width, int height) { - SunToolkit.awtLock(); - try { - if (!disposed && (width != oldWidth || height != oldHeight)) { - SurfaceData oldData = surfaceData; - if (oldData != null) { - surfaceData = graphicsConfig.createSurfaceData(this); - oldData.invalidate(); - } - oldWidth = width; - oldHeight = height; - } - } finally { - SunToolkit.awtUnlock(); - } - } - - public void beginValidate() { - } - - native void restoreFocus(); - - public void endValidate() { - restoreFocus(); - } - - public void beginLayout() { - // Skip all painting till endLayout - isLayouting = true; - } - - public void endLayout() { - if (!paintPending && !paintArea.isEmpty() && - !((Component)target).getIgnoreRepaint()) { - // if not waiting for native painting repaint damaged area - postEvent(new PaintEvent((Component)target, PaintEvent.PAINT, - new Rectangle())); - } - isLayouting = false; - } - - /** - * DEPRECATED: Replaced by setVisible(boolean). - */ - public void show() { - setVisible(true); - } - - /** - * DEPRECATED: Replaced by setVisible(boolean). - */ - public void hide() { - setVisible(false); - } - - /** - * DEPRECATED: Replaced by setEnabled(boolean). - */ - public void enable() { - setEnabled(true); - } - - /** - * DEPRECATED: Replaced by setEnabled(boolean). - */ - public void disable() { - setEnabled(false); - } - - /** - * DEPRECATED: Replaced by setBounds(int, int, int, int). - */ - public void reshape(int x, int y, int width, int height) { - setBounds(x, y, width, height); - } - - /** - * DEPRECATED: Replaced by getMinimumSize(). - */ - public Dimension minimumSize() { - return getMinimumSize(); - } - - /** - * DEPRECATED: Replaced by getPreferredSize(). - */ - public Dimension preferredSize() { - return getPreferredSize(); - } - - /** - * - */ - - public void addDropTarget(DropTarget dt) { - if (MToolkit.useMotifDnD()) { - addNativeDropTarget(dt); - } else { - Component comp = target; - while(!(comp == null || comp instanceof java.awt.Window)) { - comp = getParent_NoClientCode(comp); - } - - if (comp instanceof Window) { - MWindowPeer wpeer = (MWindowPeer)(comp.getPeer()); - if (wpeer != null) { - wpeer.addDropTarget(); - } - } - } - } - - /** - * - */ - - public void removeDropTarget(DropTarget dt) { - if (MToolkit.useMotifDnD()) { - removeNativeDropTarget(dt); - } else { - Component comp = target; - while(!(comp == null || comp instanceof java.awt.Window)) { - comp = getParent_NoClientCode(comp); - } - - if (comp instanceof Window) { - MWindowPeer wpeer = (MWindowPeer)(comp.getPeer()); - if (wpeer != null) { - wpeer.removeDropTarget(); - } - } - } - } - - public void notifyTextComponentChange(boolean add){ - Container parent = getParent_NoClientCode(target); - while(!(parent == null || - parent instanceof java.awt.Frame || - parent instanceof java.awt.Dialog)) { - parent = getParent_NoClientCode(parent); - } - - if (parent instanceof java.awt.Frame || - parent instanceof java.awt.Dialog) { - if (add) - ((MInputMethodControl)parent.getPeer()).addTextComponent((MComponentPeer)this); - else - ((MInputMethodControl)parent.getPeer()).removeTextComponent((MComponentPeer)this); - } - } - - native void addNativeDropTarget(DropTarget dt); - - native void removeNativeDropTarget(DropTarget dt); - - public GraphicsConfiguration getGraphicsConfiguration() { - GraphicsConfiguration ret = graphicsConfig; - if (ret == null) { - ret = target.getGraphicsConfiguration(); - } - return ret; - } - - // Returns true if we are inside begin/endLayout and - // are waiting for native painting - public boolean isPaintPending() { - return paintPending && isLayouting; - } - - public boolean handlesWheelScrolling() { - return false; - } - - /** - * The following multibuffering-related methods delegate to our - * associated GraphicsConfig (X11 or GLX) to handle the appropriate - * native windowing system specific actions. - */ - - private native long getWindow(long pData); - - public long getContentWindow() { - return getWindow(pData); - } - - public void createBuffers(int numBuffers, BufferCapabilities caps) - throws AWTException - { - backBuffer = graphicsConfig.createBackBuffer(this, numBuffers, caps); - xBackBuffer = graphicsConfig.createBackBufferImage(target, - backBuffer); - } - - public void flip(int x1, int y1, int x2, int y2, - BufferCapabilities.FlipContents flipAction) - { - if (backBuffer == 0) { - throw new IllegalStateException("Buffers have not been created"); - } - graphicsConfig.flip(this, target, xBackBuffer, - x1, y1, x2, y2, flipAction); - } - - public Image getBackBuffer() { - if (backBuffer == 0) { - throw new IllegalStateException("Buffers have not been created"); - } - return xBackBuffer; - } - - public void destroyBuffers() { - graphicsConfig.destroyBackBuffer(backBuffer); - backBuffer = 0; - xBackBuffer = null; - } - - /** - * @see java.awt.peer.ComponentPeer#isReparentSupported - */ - public boolean isReparentSupported() { - return false; - } - - /** - * @see java.awt.peer.ComponentPeer#reparent - */ - public void reparent(ContainerPeer newNativeParent) { - throw new UnsupportedOperationException(); - } - - /** - * Applies the shape to the native component window. - * @since 1.7 - */ - public void applyShape(Region shape) { - } - -}
--- a/src/solaris/classes/sun/awt/motif/MCustomCursor.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* - * Copyright 2003 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package sun.awt.motif; - -import sun.awt.X11CustomCursor; -import sun.awt.CustomCursor; -import java.awt.*; -import java.awt.image.*; -import sun.awt.image.ImageRepresentation; - -public class MCustomCursor extends X11CustomCursor { - - public MCustomCursor(Image cursor, Point hotSpot, String name) - throws IndexOutOfBoundsException { - super(cursor, hotSpot, name); - } - /** - * Returns the supported cursor size - */ - public static Dimension getBestCursorSize( - int preferredWidth, int preferredHeight) { - - // Fix for bug 4212593 The Toolkit.createCustomCursor does not - // check absence of the image of cursor - // We use XQueryBestCursor which accepts unsigned ints to obtain - // the largest cursor size that could be dislpayed - Dimension d = new Dimension(Math.abs(preferredWidth), Math.abs(preferredHeight)); - - queryBestCursor(d); - return d; - } - - private static native void queryBestCursor(Dimension d); - - protected native void createCursor(byte[] xorMask, byte[] andMask, - int width, int height, - int fcolor, int bcolor, - int xHotSpot, int yHotSpot); - - static { - cacheInit(); - } - - private native static void cacheInit(); -}
--- a/src/solaris/classes/sun/awt/motif/MDataTransferer.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,386 +0,0 @@ -/* - * Copyright 2000-2004 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package sun.awt.motif; - -import java.awt.Image; - -import java.awt.datatransfer.DataFlavor; - -import java.awt.image.BufferedImage; -import java.awt.image.ColorModel; -import java.awt.image.WritableRaster; - -import java.io.InputStream; -import java.io.IOException; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.imageio.ImageIO; -import javax.imageio.ImageTypeSpecifier; -import javax.imageio.ImageWriter; -import javax.imageio.spi.ImageWriterSpi; - -import sun.awt.datatransfer.DataTransferer; -import sun.awt.datatransfer.ToolkitThreadBlockedHandler; - -/** - * Platform-specific support for the data transfer subsystem. - * - * @author Roger Brinkley - * @author Danila Sinopalnikov - * - * @since 1.3.1 - */ -public class MDataTransferer extends DataTransferer { - private static final long FILE_NAME_ATOM; - private static final long DT_NET_FILE_ATOM; - private static final long PNG_ATOM; - private static final long JFIF_ATOM; - - static { - FILE_NAME_ATOM = getAtomForTarget("FILE_NAME"); - DT_NET_FILE_ATOM = getAtomForTarget("_DT_NETFILE"); - PNG_ATOM = getAtomForTarget("PNG"); - JFIF_ATOM = getAtomForTarget("JFIF"); - } - - /** - * Singleton constructor - */ - private MDataTransferer() { - } - - private static MDataTransferer transferer; - - static MDataTransferer getInstanceImpl() { - if (transferer == null) { - synchronized (MDataTransferer.class) { - if (transferer == null) { - transferer = new MDataTransferer(); - } - } - } - return transferer; - } - - public String getDefaultUnicodeEncoding() { - return "iso-10646-ucs-2"; - } - - public boolean isLocaleDependentTextFormat(long format) { - return false; - } - - public boolean isTextFormat(long format) { - return super.isTextFormat(format) - || isMimeFormat(format, "text"); - } - - protected String getCharsetForTextFormat(Long lFormat) { - long format = lFormat.longValue(); - if (isMimeFormat(format, "text")) { - String nat = getNativeForFormat(format); - DataFlavor df = new DataFlavor(nat, null); - // Ignore the charset parameter of the MIME type if the subtype - // doesn't support charset. - if (!DataTransferer.doesSubtypeSupportCharset(df)) { - return null; - } - String charset = df.getParameter("charset"); - if (charset != null) { - return charset; - } - } - return super.getCharsetForTextFormat(lFormat); - } - - public boolean isFileFormat(long format) { - return format == FILE_NAME_ATOM || format == DT_NET_FILE_ATOM; - } - - public boolean isImageFormat(long format) { - return format == PNG_ATOM || format == JFIF_ATOM - || isMimeFormat(format, "image"); - } - - protected Long getFormatForNativeAsLong(String str) { - // Just get the atom. If it has already been retrived - // once, we'll get a copy so this should be very fast. - long atom = getAtomForTarget(str); - if (atom <= 0) { - throw new InternalError("Cannot register a target"); - } - return Long.valueOf(atom); - } - - protected String getNativeForFormat(long format) { - return getTargetNameForAtom(format); - } - - public ToolkitThreadBlockedHandler getToolkitThreadBlockedHandler() { - return MToolkitThreadBlockedHandler.getToolkitThreadBlockedHandler(); - } - - /** - * Gets an atom for a format name. - */ - static native long getAtomForTarget(String name); - - /** - * Gets an format name for a given format (atom) - */ - private static native String getTargetNameForAtom(long atom); - - protected byte[] imageToPlatformBytes(Image image, long format) - throws IOException { - String mimeType = null; - if (format == PNG_ATOM) { - mimeType = "image/png"; - } else if (format == JFIF_ATOM) { - mimeType = "image/jpeg"; - } else { - // Check if an image MIME format. - try { - String nat = getNativeForFormat(format); - DataFlavor df = new DataFlavor(nat); - String primaryType = df.getPrimaryType(); - if ("image".equals(primaryType)) { - mimeType = df.getPrimaryType() + "/" + df.getSubType(); - } - } catch (Exception e) { - // Not an image MIME format. - } - } - if (mimeType != null) { - return imageToStandardBytes(image, mimeType); - } else { - String nativeFormat = getNativeForFormat(format); - throw new IOException("Translation to " + nativeFormat + - " is not supported."); - } - } - - /** - * Translates either a byte array or an input stream which contain - * platform-specific image data in the given format into an Image. - */ - protected Image platformImageBytesOrStreamToImage(InputStream inputStream, - byte[] bytes, - long format) - throws IOException { - String mimeType = null; - if (format == PNG_ATOM) { - mimeType = "image/png"; - } else if (format == JFIF_ATOM) { - mimeType = "image/jpeg"; - } else { - // Check if an image MIME format. - try { - String nat = getNativeForFormat(format); - DataFlavor df = new DataFlavor(nat); - String primaryType = df.getPrimaryType(); - if ("image".equals(primaryType)) { - mimeType = df.getPrimaryType() + "/" + df.getSubType(); - } - } catch (Exception e) { - // Not an image MIME format. - } - } - if (mimeType != null) { - return standardImageBytesOrStreamToImage(inputStream, bytes, mimeType); - } else { - String nativeFormat = getNativeForFormat(format); - throw new IOException("Translation from " + nativeFormat + - " is not supported."); - } - } - - /** - * Returns true if and only if the name of the specified format Atom - * constitutes a valid MIME type with the specified primary type. - */ - private boolean isMimeFormat(long format, String primaryType) { - String nat = getNativeForFormat(format); - - if (nat == null) { - return false; - } - - try { - DataFlavor df = new DataFlavor(nat); - if (primaryType.equals(df.getPrimaryType())) { - return true; - } - } catch (Exception e) { - // Not a MIME format. - } - - return false; - } - - /* - * The XDnD protocol prescribes that the Atoms used as targets for data - * transfer should have string names that represent the corresponding MIME - * types. - * To meet this requirement we check if the passed native format constitutes - * a valid MIME and return a list of flavors to which the data in this MIME - * type can be translated by the Data Transfer subsystem. - */ - public List getPlatformMappingsForNative(String nat) { - List flavors = new ArrayList(); - - if (nat == null) { - return flavors; - } - - DataFlavor df = null; - - try { - df = new DataFlavor(nat); - } catch (Exception e) { - // The string doesn't constitute a valid MIME type. - return flavors; - } - - Object value = df; - final String primaryType = df.getPrimaryType(); - final String baseType = primaryType + "/" + df.getSubType(); - - // For text formats we map natives to MIME strings instead of data - // flavors to enable dynamic text native-to-flavor mapping generation. - // See SystemFlavorMap.getFlavorsForNative() for details. - if ("text".equals(primaryType)) { - value = primaryType + "/" + df.getSubType(); - } else if ("image".equals(primaryType)) { - Iterator readers = ImageIO.getImageReadersByMIMEType(baseType); - if (readers.hasNext()) { - flavors.add(DataFlavor.imageFlavor); - } - } - - flavors.add(value); - - return flavors; - } - - private static ImageTypeSpecifier defaultSpecifier = null; - - private ImageTypeSpecifier getDefaultImageTypeSpecifier() { - if (defaultSpecifier == null) { - ColorModel model = ColorModel.getRGBdefault(); - WritableRaster raster = - model.createCompatibleWritableRaster(10, 10); - - BufferedImage bufferedImage = - new BufferedImage(model, raster, model.isAlphaPremultiplied(), - null); - - defaultSpecifier = new ImageTypeSpecifier(bufferedImage); - } - - return defaultSpecifier; - } - - /* - * The XDnD protocol prescribes that the Atoms used as targets for data - * transfer should have string names that represent the corresponding MIME - * types. - * To meet this requirement we return a list of formats that represent - * MIME types to which the data in this flavor can be translated by the Data - * Transfer subsystem. - */ - public List getPlatformMappingsForFlavor(DataFlavor df) { - List natives = new ArrayList(1); - - if (df == null) { - return natives; - } - - String charset = df.getParameter("charset"); - String baseType = df.getPrimaryType() + "/" + df.getSubType(); - String mimeType = baseType; - - if (charset != null && DataTransferer.isFlavorCharsetTextType(df)) { - mimeType += ";charset=" + charset; - } - - // Add a mapping to the MIME native whenever the representation class - // doesn't require translation. - if (df.getRepresentationClass() != null && - (df.isRepresentationClassInputStream() || - df.isRepresentationClassByteBuffer() || - byteArrayClass.equals(df.getRepresentationClass()))) { - natives.add(mimeType); - } - - if (DataFlavor.imageFlavor.equals(df)) { - String[] mimeTypes = ImageIO.getWriterMIMETypes(); - if (mimeTypes != null) { - for (int i = 0; i < mimeTypes.length; i++) { - Iterator writers = - ImageIO.getImageWritersByMIMEType(mimeTypes[i]); - - while (writers.hasNext()) { - ImageWriter imageWriter = (ImageWriter)writers.next(); - ImageWriterSpi writerSpi = - imageWriter.getOriginatingProvider(); - - if (writerSpi != null && - writerSpi.canEncodeImage(getDefaultImageTypeSpecifier())) { - natives.add(mimeTypes[i]); - break; - } - } - } - } - } else if (DataTransferer.isFlavorCharsetTextType(df)) { - final Iterator iter = DataTransferer.standardEncodings(); - - // stringFlavor is semantically equivalent to the standard - // "text/plain" MIME type. - if (DataFlavor.stringFlavor.equals(df)) { - baseType = "text/plain"; - } - - while (iter.hasNext()) { - String encoding = (String)iter.next(); - if (!encoding.equals(charset)) { - natives.add(baseType + ";charset=" + encoding); - } - } - - // Add a MIME format without specified charset. - if (!natives.contains(baseType)) { - natives.add(baseType); - } - } - - return natives; - } - protected native String[] dragQueryFile(byte[] bytes); -}
--- a/src/solaris/classes/sun/awt/motif/MDialogPeer.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -/* - * Copyright 1995-2008 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package sun.awt.motif; - -import java.util.Vector; -import java.awt.*; -import java.awt.peer.*; -import java.awt.event.*; -import sun.awt.motif.MInputMethodControl; -import sun.awt.im.*; - -class MDialogPeer extends MWindowPeer implements DialogPeer, MInputMethodControl { - - static Vector allDialogs = new Vector(); - - MDialogPeer(Dialog target) { - - /* create MWindowPeer object */ - super(); - - winAttr.nativeDecor = !target.isUndecorated(); - winAttr.initialFocus = true; - winAttr.isResizable = target.isResizable(); - winAttr.initialState = MWindowAttributes.NORMAL; - winAttr.title = target.getTitle(); - winAttr.icon = null; - if (winAttr.nativeDecor) { - winAttr.decorations = winAttr.AWT_DECOR_ALL | - winAttr.AWT_DECOR_MINIMIZE | - winAttr.AWT_DECOR_MAXIMIZE; - } else { - winAttr.decorations = winAttr.AWT_DECOR_NONE; - } - /* create and init native component */ - init(target); - allDialogs.addElement(this); - } - - public void setTitle(String title) { - pSetTitle(title); - } - - protected void disposeImpl() { - allDialogs.removeElement(this); - super.disposeImpl(); - } - - // NOTE: This method is called by privileged threads. - // DO NOT INVOKE CLIENT CODE ON THIS THREAD! - public void handleMoved(int x, int y) { - postEvent(new ComponentEvent(target, ComponentEvent.COMPONENT_MOVED)); - } - - public void show() { - pShowModal( ((Dialog)target).isModal() ); - updateAlwaysOnTop(alwaysOnTop); - } - - - // NOTE: This method may be called by privileged threads. - // DO NOT INVOKE CLIENT CODE ON THIS THREAD! - public void handleIconify() { -// Note: These routines are necessary for Coaleseing of native implementations -// As Dialogs do not currently send Iconify/DeIconify messages but -// Windows/Frames do. If this should be made consistent...to do so -// uncomment the postEvent. -// postEvent(new WindowEvent((Window)target, WindowEvent.WINDOW_ICONIFIED)); - } - - // NOTE: This method may be called by privileged threads. - // DO NOT INVOKE CLIENT CODE ON THIS THREAD! - public void handleDeiconify() { -// Note: These routines are necessary for Coaleseing of native implementations -// As Dialogs do not currently send Iconify/DeIconify messages but -// Windows/Frames do. If this should be made consistent...to do so -// uncomment the postEvent. -// postEvent(new WindowEvent((Window)target, WindowEvent.WINDOW_DEICONIFIED)); - } - - public void blockWindows(java.util.List<Window> toBlock) { - // do nothing - } - - @Override - final boolean isTargetUndecorated() { - return ((Dialog)target).isUndecorated(); - } -}
--- a/src/solaris/classes/sun/awt/motif/MDragSourceContextPeer.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -/* - * Copyright 1997-2005 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package sun.awt.motif; - -import java.awt.Component; -import java.awt.Cursor; -import java.awt.Image; -import java.awt.Point; - -import java.awt.datatransfer.Transferable; - -import java.awt.dnd.DragSourceContext; -import java.awt.dnd.DragGestureEvent; -import java.awt.dnd.InvalidDnDOperationException; - -import java.awt.event.InputEvent; - -import java.awt.peer.ComponentPeer; -import java.awt.peer.LightweightPeer; - -import java.util.Map; -import sun.awt.SunToolkit; -import sun.awt.dnd.SunDragSourceContextPeer; - -/** - * <p> - * TBC - * </p> - * - * @since JDK1.2 - * - */ - -final class MDragSourceContextPeer extends SunDragSourceContextPeer { - - private static final MDragSourceContextPeer theInstance = - new MDragSourceContextPeer(null); - - /** - * construct a new MDragSourceContextPeer - */ - - private MDragSourceContextPeer(DragGestureEvent dge) { - super(dge); - } - - static MDragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException { - theInstance.setTrigger(dge); - return theInstance; - } - - protected void startDrag(Transferable transferable, - long[] formats, Map formatMap) { - try { - long nativeCtxtLocal = startDrag(getTrigger().getComponent(), - transferable, - getTrigger().getTriggerEvent(), - getCursor(), - getCursor() == null ? 0 : getCursor().getType(), - getDragSourceContext().getSourceActions(), - formats, - formatMap); - setNativeContext(nativeCtxtLocal); - } catch (Exception e) { - throw new InvalidDnDOperationException("failed to create native peer: " + e); - } - - if (getNativeContext() == 0) { - throw new InvalidDnDOperationException("failed to create native peer"); - } - - MDropTargetContextPeer.setCurrentJVMLocalSourceTransferable(transferable); - } - - /** - * downcall into native code - */ - - private native long startDrag(Component component, - Transferable transferable, - InputEvent nativeTrigger, - Cursor c, int ctype, int actions, - long[] formats, Map formatMap); - - /** - * set cursor - */ - - public void setCursor(Cursor c) throws InvalidDnDOperationException { - SunToolkit.awtLock(); - super.setCursor(c); - SunToolkit.awtUnlock(); - } - - protected native void setNativeCursor(long nativeCtxt, Cursor c, int cType); - -}
--- a/src/solaris/classes/sun/awt/motif/MDropTargetContextPeer.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,147 +0,0 @@ -/* - * Copyright 1997-2005 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package sun.awt.motif; - -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.UnsupportedFlavorException; - -import java.awt.dnd.DnDConstants; -import java.awt.dnd.InvalidDnDOperationException; - -import java.io.InputStream; - -import java.util.Map; - -import java.io.IOException; -import sun.awt.dnd.SunDropTargetContextPeer; -import sun.awt.SunToolkit; - -/** - * <p> - * The MDropTargetContextPeer class is the class responsible for handling - * the interaction between the Motif DnD system and Java. - * </p> - * - * @since JDK1.2 - * - */ - -final class MDropTargetContextPeer extends SunDropTargetContextPeer { - - private long nativeDropTransfer; - - long nativeDataAvailable = 0; - Object nativeData = null; - - /** - * create the peer - */ - - static MDropTargetContextPeer createMDropTargetContextPeer() { - return new MDropTargetContextPeer(); - } - - /** - * create the peer - */ - - private MDropTargetContextPeer() { - super(); - } - - protected Object getNativeData(long format) { - SunToolkit.awtLock(); - if (nativeDropTransfer == 0) { - nativeDropTransfer = startTransfer(getNativeDragContext(), - format); - } else { - addTransfer (nativeDropTransfer, format); - } - - for (nativeDataAvailable = 0; - format != nativeDataAvailable;) { - try { - SunToolkit.awtLockWait(); - } catch (Throwable e) { - e.printStackTrace(); - } - } - SunToolkit.awtUnlock(); - - return nativeData; - } - - /** - * signal drop complete - */ - - protected void doDropDone(boolean success, int dropAction, - boolean isLocal) { - dropDone(getNativeDragContext(), nativeDropTransfer, isLocal, - success, dropAction); - } - - /** - * notify transfer complete - */ - - private void newData(long format, String type, byte[] data) { - nativeDataAvailable = format; - nativeData = data; - - SunToolkit.awtLockNotifyAll(); - } - - /** - * notify transfer failed - */ - - private void transferFailed(long format) { - nativeDataAvailable = format; - nativeData = null; - - SunToolkit.awtLockNotifyAll(); - } - - /** - * schedule a native DnD transfer - */ - - private native long startTransfer(long nativeDragContext, long format); - - /** - * schedule a native DnD data transfer - */ - - private native void addTransfer(long nativeDropTransfer, long format); - - /** - * signal that drop is completed - */ - - private native void dropDone(long nativeDragContext, long nativeDropTransfer, - boolean localTx, boolean success, int dropAction); -}
--- a/src/solaris/classes/sun/awt/motif/MEmbedCanvasPeer.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,584 +0,0 @@ -/* - * Copyright 2003-2005 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package sun.awt.motif; - -import java.awt.*; -import java.awt.dnd.DropTarget; -import java.awt.dnd.DropTargetListener; -import java.awt.event.*; -import java.awt.image.ColorModel; -import java.awt.image.ImageObserver; -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 java.util.logging.*; -import java.util.*; - -// FIXME: Add X errors handling -// FIXME: Add chaining of parameters to XEmbed-client if we are both(accelerators; XDND; focus already automatically) -public class MEmbedCanvasPeer extends MCanvasPeer implements WindowFocusListener, KeyEventPostProcessor, ModalityListener, WindowIDProvider { - private static final Logger xembedLog = Logger.getLogger("sun.awt.motif.xembed.MEmbedCanvasPeer"); - - final static int XEMBED_VERSION = 0, - XEMBED_MAPPED = (1 << 0); -/* XEMBED messages */ - final static int XEMBED_EMBEDDED_NOTIFY = 0; - final static int XEMBED_WINDOW_ACTIVATE = 1; - final static int XEMBED_WINDOW_DEACTIVATE = 2; - final static int XEMBED_REQUEST_FOCUS =3; - final static int XEMBED_FOCUS_IN = 4; - final static int XEMBED_FOCUS_OUT = 5; - final static int XEMBED_FOCUS_NEXT = 6; - final static int XEMBED_FOCUS_PREV = 7; -/* 8-9 were used for XEMBED_GRAB_KEY/XEMBED_UNGRAB_KEY */ - final static int XEMBED_GRAB_KEY = 8; - final static int XEMBED_UNGRAB_KEY = 9; - final static int XEMBED_MODALITY_ON = 10; - final static int XEMBED_MODALITY_OFF = 11; - final static int XEMBED_REGISTER_ACCELERATOR = 12; - final static int XEMBED_UNREGISTER_ACCELERATOR= 13; - final static int XEMBED_ACTIVATE_ACCELERATOR = 14; - - final static int NON_STANDARD_XEMBED_GTK_GRAB_KEY = 108; - final static int NON_STANDARD_XEMBED_GTK_UNGRAB_KEY = 109; - -// A detail code is required for XEMBED_FOCUS_IN. The following values are valid: -/* Details for XEMBED_FOCUS_IN: */ - final static int XEMBED_FOCUS_CURRENT = 0; - final static int XEMBED_FOCUS_FIRST = 1; - final static int XEMBED_FOCUS_LAST = 2; - -// Modifiers bits - final static int XEMBED_MODIFIER_SHIFT = (1 << 0); - final static int XEMBED_MODIFIER_CONTROL = (1 << 1); - final static int XEMBED_MODIFIER_ALT = (1 << 2); - final static int XEMBED_MODIFIER_SUPER = (1 << 3); - final static int XEMBED_MODIFIER_HYPER = (1 << 4); - - boolean applicationActive; // Whether the application is active(has focus) - Map<Long, AWTKeyStroke> accelerators = new HashMap<Long, AWTKeyStroke>(); // Maps accelerator ID into AWTKeyStroke - Map<AWTKeyStroke, Long> accel_lookup = new HashMap<AWTKeyStroke, Long>(); // Maps AWTKeyStroke into accelerator ID - Set<GrabbedKey> grabbed_keys = new HashSet<GrabbedKey>(); // A set of keys grabbed by client - Object ACCEL_LOCK = accelerators; // Lock object for working with accelerators; - Object GRAB_LOCK = grabbed_keys; // Lock object for working with keys grabbed by client - - MEmbedCanvasPeer() {} - - MEmbedCanvasPeer(Component target) { - super(target); - } - - void initialize() { - super.initialize(); - - installActivateListener(); - installAcceleratorListener(); - installModalityListener(); - - // XEmbed canvas should be non-traversable. - // FIXME: Probably should be removed and enforced setting of it by the users - target.setFocusTraversalKeysEnabled(false); - - initXEmbedServer(); - } - - void installModalityListener() { - ((SunToolkit)Toolkit.getDefaultToolkit()).addModalityListener(this); - } - - void deinstallModalityListener() { - ((SunToolkit)Toolkit.getDefaultToolkit()).removeModalityListener(this); - } - - void installAcceleratorListener() { - KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventPostProcessor(this); - } - - void deinstallAcceleratorListener() { - KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventPostProcessor(this); - } - - void installActivateListener() { - // FIXME: should watch for hierarchy changes - Window toplevel = getTopLevel(target); - if (toplevel != null) { - toplevel.addWindowFocusListener(this); - applicationActive = toplevel.isFocused(); - } - } - - void deinstallActivateListener() { - Window toplevel = getTopLevel(target); - if (toplevel != null) { - toplevel.removeWindowFocusListener(this); - } - } - - native boolean isXEmbedActive(); - - boolean isApplicationActive() { - return applicationActive; - } - - native void initDispatching(); - - native void endDispatching(); - - native void embedChild(long child); - - native void childDestroyed(); - - public void handleEvent(AWTEvent e) { - super.handleEvent(e); - if (isXEmbedActive()) { - switch (e.getID()) { - case FocusEvent.FOCUS_GAINED: - canvasFocusGained((FocusEvent)e); - break; - case FocusEvent.FOCUS_LOST: - canvasFocusLost((FocusEvent)e); - break; - case KeyEvent.KEY_PRESSED: - case KeyEvent.KEY_RELEASED: - if (!((InputEvent)e).isConsumed()) { - forwardKeyEvent((KeyEvent)e); - } - break; - } - } - } - - public Dimension getPreferredSize() { - if (isXEmbedActive()) { - Dimension dim = getEmbedPreferredSize(); - if (dim == null) { - return super.getPreferredSize(); - } else { - return dim; - } - } else { - return super.getPreferredSize(); - } - } - native Dimension getEmbedPreferredSize(); - public Dimension getMinimumSize() { - if (isXEmbedActive()) { - Dimension dim = getEmbedMinimumSize(); - if (dim == null) { - return super.getMinimumSize(); - } else { - return dim; - } - } else { - return super.getMinimumSize(); - } - } - native Dimension getEmbedMinimumSize(); - protected void disposeImpl() { - if (isXEmbedActive()) { - detachChild(); - } - deinstallActivateListener(); - deinstallModalityListener(); - deinstallAcceleratorListener(); - - destroyXEmbedServer(); - super.disposeImpl(); - } - - public boolean isFocusable() { - return true; - } - - Window getTopLevel(Component comp) { - while (comp != null && !(comp instanceof Window)) { - comp = comp.getParent(); - } - return (Window)comp; - } - - native Rectangle getClientBounds(); - - void childResized() { - if (xembedLog.isLoggable(Level.FINER)) { - Rectangle bounds = getClientBounds(); - xembedLog.finer("Child resized: " + bounds); - // It is not required to update embedder's size when client size changes - // However, since there is no any means to get client size it seems to be the - // only way to provide it. However, it contradicts with Java layout concept - - // so it is disabled for now. -// Rectangle my_bounds = getBounds(); -// setBounds(my_bounds.x, my_bounds.y, bounds.width, bounds.height, SET_BOUNDS); - } - postEvent(new ComponentEvent(target, ComponentEvent.COMPONENT_RESIZED)); - } - - void focusNext() { - if (isXEmbedActive()) { - xembedLog.fine("Requesting focus for the next component after embedder"); - postEvent(new InvocationEvent(target, new Runnable() { - public void run() { - KeyboardFocusManager.getCurrentKeyboardFocusManager().focusNextComponent(target); - } - })); - } else { - xembedLog.fine("Application is not active - denying focus next"); - } - } - - void focusPrev() { - if (isXEmbedActive()) { - xembedLog.fine("Requesting focus for the next component after embedder"); - postEvent(new InvocationEvent(target, new Runnable() { - public void run() { - KeyboardFocusManager.getCurrentKeyboardFocusManager().focusPreviousComponent(target); - } - })); - } else { - xembedLog.fine("Application is not active - denying focus prev"); - } - } - - void requestXEmbedFocus() { - if (isXEmbedActive()) { - xembedLog.fine("Requesting focus for client"); - postEvent(new InvocationEvent(target, new Runnable() { - public void run() { - target.requestFocusInWindow(); - } - })); - } else { - xembedLog.fine("Application is not active - denying request focus"); - } - } - - native void notifyChildEmbedded(); - - native void detachChild(); - - public void windowGainedFocus(WindowEvent e) { - applicationActive = true; - if (isXEmbedActive()) { - xembedLog.fine("Sending WINDOW_ACTIVATE"); - sendMessage(XEMBED_WINDOW_ACTIVATE); - } - } - - public void windowLostFocus(WindowEvent e) { - applicationActive = false; - if (isXEmbedActive()) { - xembedLog.fine("Sending WINDOW_DEACTIVATE"); - sendMessage(XEMBED_WINDOW_DEACTIVATE); - } - } - - void canvasFocusGained(FocusEvent e) { - if (isXEmbedActive()) { - xembedLog.fine("Forwarding FOCUS_GAINED"); - int flavor = XEMBED_FOCUS_CURRENT; - if (e instanceof CausedFocusEvent) { - CausedFocusEvent ce = (CausedFocusEvent)e; - if (ce.getCause() == CausedFocusEvent.Cause.TRAVERSAL_FORWARD) { - flavor = XEMBED_FOCUS_FIRST; - } else if (ce.getCause() == CausedFocusEvent.Cause.TRAVERSAL_BACKWARD) { - flavor = XEMBED_FOCUS_LAST; - } - } - sendMessage(XEMBED_FOCUS_IN, flavor, 0, 0); - } - } - - void canvasFocusLost(FocusEvent e) { - if (isXEmbedActive() && !e.isTemporary()) { - xembedLog.fine("Forwarding FOCUS_LOST"); - Component opp = e.getOppositeComponent(); - int num = 0; - try { - num = Integer.parseInt(opp.getName()); - } catch (NumberFormatException nfe) { - } - sendMessage(XEMBED_FOCUS_OUT, num, 0, 0); - } - } - - native void forwardKeyEvent(KeyEvent e); - - void grabKey(final long keysym, final long modifiers) { - postEvent(new InvocationEvent(target, new Runnable() { - public void run() { - GrabbedKey grab = new GrabbedKey(keysym, modifiers); - if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("Grabbing key: " + grab); - synchronized(GRAB_LOCK) { - grabbed_keys.add(grab); - } - } - })); - } - - void ungrabKey(final long keysym, final long modifiers) { - postEvent(new InvocationEvent(target, new Runnable() { - public void run() { - GrabbedKey grab = new GrabbedKey(keysym, modifiers); - if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("UnGrabbing key: " + grab); - synchronized(GRAB_LOCK) { - grabbed_keys.remove(grab); - } - } - })); - } - - void registerAccelerator(final long accel_id, final long keysym, final long modifiers) { - postEvent(new InvocationEvent(target, new Runnable() { - public void run() { - AWTKeyStroke stroke = getKeyStrokeForKeySym(keysym, modifiers); - if (stroke != null) { - if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("Registering accelerator " + accel_id + " for " + stroke); - synchronized(ACCEL_LOCK) { - accelerators.put(accel_id, stroke); - accel_lookup.put(stroke, accel_id); - } - } - // Propogate accelerators to the another embedder - propogateRegisterAccelerator(stroke); - } - })); - } - - void unregisterAccelerator(final long accel_id) { - postEvent(new InvocationEvent(target, new Runnable() { - public void run() { - AWTKeyStroke stroke = null; - synchronized(ACCEL_LOCK) { - stroke = accelerators.get(accel_id); - if (stroke != null) { - if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("Unregistering accelerator: " + accel_id); - accelerators.remove(accel_id); - accel_lookup.remove(stroke); // FIXME: How about several accelerators with the same stroke? - } - } - // Propogate accelerators to the another embedder - propogateUnRegisterAccelerator(stroke); - } - })); - } - - void propogateRegisterAccelerator(AWTKeyStroke stroke) { - // Find the top-level and see if it is XEmbed client. If so, ask him to - // register the accelerator - MWindowPeer parent = getParentWindow(); - if (parent != null && parent instanceof MEmbeddedFramePeer) { - MEmbeddedFramePeer embedded = (MEmbeddedFramePeer)parent; - embedded.registerAccelerator(stroke); - } - } - - void propogateUnRegisterAccelerator(AWTKeyStroke stroke) { - // Find the top-level and see if it is XEmbed client. If so, ask him to - // register the accelerator - MWindowPeer parent = getParentWindow(); - if (parent != null && parent instanceof MEmbeddedFramePeer) { - MEmbeddedFramePeer embedded = (MEmbeddedFramePeer)parent; - embedded.unregisterAccelerator(stroke); - } - } - - public boolean postProcessKeyEvent(KeyEvent e) { - // Processing events only if we are in the focused window. - MWindowPeer parent = getParentWindow(); - if (parent == null || !((Window)parent.target).isFocused() || target.isFocusOwner()) { - return false; - } - - boolean result = false; - - if (xembedLog.isLoggable(Level.FINER)) xembedLog.finer("Post-processing event " + e); - - // Process ACCELERATORS - AWTKeyStroke stroke = AWTKeyStroke.getAWTKeyStrokeForEvent(e); - long accel_id = 0; - boolean exists = false; - synchronized(ACCEL_LOCK) { - exists = accel_lookup.containsKey(stroke); - if (exists) { - accel_id = accel_lookup.get(stroke).longValue(); - } - } - if (exists) { - if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("Activating accelerator " + accel_id); - sendMessage(XEMBED_ACTIVATE_ACCELERATOR, accel_id, 0, 0); // FIXME: How about overloaded? - result = true; - } - - // Process Grabs, unofficial GTK feature - exists = false; - GrabbedKey key = new GrabbedKey(e); - synchronized(GRAB_LOCK) { - exists = grabbed_keys.contains(key); - } - if (exists) { - if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("Forwarding grabbed key " + e); - forwardKeyEvent(e); - result = true; - } - - return result; - } - - public void modalityPushed(ModalityEvent ev) { - sendMessage(XEMBED_MODALITY_ON); - } - - public void modalityPopped(ModalityEvent ev) { - sendMessage(XEMBED_MODALITY_OFF); - } - - int getModifiers(int state) { - int mods = 0; - if ((state & XEMBED_MODIFIER_SHIFT) != 0) { - mods |= InputEvent.SHIFT_DOWN_MASK; - } - if ((state & XEMBED_MODIFIER_CONTROL) != 0) { - mods |= InputEvent.CTRL_DOWN_MASK; - } - if ((state & XEMBED_MODIFIER_ALT) != 0) { - mods |= InputEvent.ALT_DOWN_MASK; - } - // FIXME: What is super/hyper? - // FIXME: Experiments show that SUPER is ALT. So what is Alt then? - if ((state & XEMBED_MODIFIER_SUPER) != 0) { - mods |= InputEvent.ALT_DOWN_MASK; - } -// if ((state & XEMBED_MODIFIER_HYPER) != 0) { -// mods |= InputEvent.DOWN_MASK; -// } - return mods; - } - - // Shouldn't be called on Toolkit thread. - AWTKeyStroke getKeyStrokeForKeySym(long keysym, long state) { - - int keycode = getAWTKeyCodeForKeySym((int)keysym); - int modifiers = getModifiers((int)state); - return AWTKeyStroke.getAWTKeyStroke(keycode, modifiers); - } - native int getAWTKeyCodeForKeySym(int keysym); - native void sendMessage(int msg); - native void sendMessage(int msg, long detail, long data1, long data2); - MWindowPeer getParentWindow() { - Component parent = target.getParent(); - synchronized(target.getTreeLock()) { - while (parent != null && !(parent.getPeer() instanceof MWindowPeer)) { - parent = parent.getParent(); - } - return (parent != null)?(MWindowPeer)parent.getPeer():null; - } - } - - private static class XEmbedDropTarget extends DropTarget { - public void addDropTargetListener(DropTargetListener dtl) - throws TooManyListenersException { - // Drop target listeners registered with this target will never be - // notified, since all drag notifications are routed to the XEmbed - // client. To avoid confusion we prohibit listeners registration - // by throwing TooManyListenersException as if there is a listener - // registered with this target already. - throw new TooManyListenersException(); - } - } - - public void setXEmbedDropTarget() { - // Register a drop site on the top level. - Runnable r = new Runnable() { - public void run() { - target.setDropTarget(new XEmbedDropTarget()); - } - }; - SunToolkit.executeOnEventHandlerThread(target, r); - } - - public void removeXEmbedDropTarget() { - // Unregister a drop site on the top level. - Runnable r = new Runnable() { - public void run() { - if (target.getDropTarget() instanceof XEmbedDropTarget) { - target.setDropTarget(null); - } - } - }; - SunToolkit.executeOnEventHandlerThread(target, r); - } - - public boolean processXEmbedDnDEvent(long ctxt, int eventID) { - if (target.getDropTarget() instanceof XEmbedDropTarget) { - forwardEventToEmbedded(ctxt, eventID); - return true; - } else { - return false; - } - } - - native void forwardEventToEmbedded(long ctxt, int eventID); - native void initXEmbedServer(); - native void destroyXEmbedServer(); - public native long getWindow(); -} -class GrabbedKey { - long keysym; - long modifiers; - GrabbedKey(long keysym, long modifiers) { - this.keysym = keysym; - this.modifiers = modifiers; - } - - GrabbedKey(KeyEvent ev) { - init(ev); - } - - native void initKeySymAndModifiers(KeyEvent e); - - private void init(KeyEvent e) { - initKeySymAndModifiers(e); - } - - public int hashCode() { - return (int)keysym & 0xFFFFFFFF; - } - - public boolean equals(Object o) { - if (!(o instanceof GrabbedKey)) { - return false; - } - GrabbedKey key = (GrabbedKey)o; - return (keysym == key.keysym && modifiers == key.modifiers); - } - - public String toString() { - return "Key combination[keysym=" + keysym + ", mods=" + modifiers + "]"; - } -}
--- a/src/solaris/classes/sun/awt/motif/MEmbeddedFrame.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,141 +0,0 @@ -/* - * Copyright 1996-2004 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package sun.awt.motif; - -import java.awt.Component; -import java.awt.peer.FramePeer; -import sun.awt.EmbeddedFrame; -import java.awt.peer.ComponentPeer; -import sun.awt.*; -import java.awt.*; - -public class MEmbeddedFrame extends EmbeddedFrame { - - /** - * Widget id of the shell widget - */ - long handle; - - public enum IDKind { - WIDGET, - WINDOW - }; - - public MEmbeddedFrame() { - } - - /** - * Backward-compatible implementation. This constructor takes widget which represents Frame's - * shell and uses it as top-level to build hierarchy of top-level widgets upon. It assumes that - * no XEmbed support is provided. - * @param widget a valid Xt widget pointer. - */ - public MEmbeddedFrame(long widget) { - this(widget, IDKind.WIDGET, false); - } - - /** - * New constructor, gets X Window id and allows to specify whether XEmbed is supported by parent - * X window. Creates hierarchy of top-level widgets under supplied window ID. - * @param winid a valid X window - * @param supportsXEmbed whether the host application supports XEMBED protocol - */ - public MEmbeddedFrame(long winid, boolean supportsXEmbed) { - this(winid, IDKind.WINDOW, supportsXEmbed); - } - - /** - * Creates embedded frame using ID as parent. - * @param ID parent ID - * @param supportsXEmbed whether the host application supports XEMBED protocol - * @param kind if WIDGET, ID represents a valid Xt widget pointer; if WINDOW, ID is a valid X Window - * ID - */ - public MEmbeddedFrame(long ID, IDKind kind, boolean supportsXEmbed) { - super(supportsXEmbed); - if (kind == IDKind.WIDGET) { - this.handle = ID; - } else { - this.handle = getWidget(ID); - } - MToolkit toolkit = (MToolkit)Toolkit.getDefaultToolkit(); - setPeer(toolkit.createEmbeddedFrame(this)); - /* - * addNotify() creates a LightweightDispatcher that propagates - * SunDropTargetEvents to subcomponents. - * NOTE: show() doesn't call addNotify() for embedded frames. - */ - addNotify(); - show(); - } - - public void synthesizeWindowActivation(boolean b) { - MEmbeddedFramePeer peer = (MEmbeddedFramePeer)getPeer(); - if (peer != null) { - if (peer.supportsXEmbed()) { - if (peer.isXEmbedActive()) { - // If XEmbed is active no synthetic focus events are allowed - everything - // should go through XEmbed - if (b) { - peer.requestXEmbedFocus(); - } - } - } else { - peer.synthesizeFocusInOut(b); - } - } - } - - public void show() { - if (handle != 0) { - mapWidget(handle); - } - super.show(); - } - - protected boolean traverseOut(boolean direction) { - MEmbeddedFramePeer xefp = (MEmbeddedFramePeer) getPeer(); - xefp.traverseOut(direction); - return true; - } - - // Native methods to handle widget <-> X Windows mapping - // - static native long getWidget(long winid); - static native int mapWidget(long widget); - public void registerAccelerator(AWTKeyStroke stroke) { - MEmbeddedFramePeer xefp = (MEmbeddedFramePeer) getPeer(); - if (xefp != null) { - xefp.registerAccelerator(stroke); - } - } - public void unregisterAccelerator(AWTKeyStroke stroke) { - MEmbeddedFramePeer xefp = (MEmbeddedFramePeer) getPeer(); - if (xefp != null) { - xefp.unregisterAccelerator(stroke); - } - } -}
--- a/src/solaris/classes/sun/awt/motif/MEmbeddedFramePeer.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,213 +0,0 @@ -/* - * Copyright 1996-2008 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package sun.awt.motif; - -import sun.awt.EmbeddedFrame; -import java.util.logging.*; -import java.awt.Component; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.Window; -import java.awt.AWTKeyStroke; -import java.awt.Component; -import java.awt.Container; -import sun.awt.SunToolkit; -import java.util.LinkedList; -import java.util.Iterator; - -import sun.java2d.SurfaceData; - -public class MEmbeddedFramePeer extends MFramePeer { - private static final Logger xembedLog = Logger.getLogger("sun.awt.motif.xembed.MEmbeddedFramePeer"); - -// A detail code is required for XEMBED_FOCUS_IN. The following values are valid: -/* Details for XEMBED_FOCUS_IN: */ - final static int XEMBED_FOCUS_CURRENT = 0; - final static int XEMBED_FOCUS_FIRST = 1; - final static int XEMBED_FOCUS_LAST = 2; - - LinkedList<AWTKeyStroke> strokes = new LinkedList<AWTKeyStroke>(); - - public MEmbeddedFramePeer(EmbeddedFrame target) { - super(target); - xembedLog.fine("Creating XEmbed-enabled motif embedded frame, frame supports XEmbed:" + supportsXEmbed()); - } - - void create(MComponentPeer parent) { - NEFcreate(parent, ((MEmbeddedFrame)target).handle); - } - native void NEFcreate(MComponentPeer parent, long handle); - native void pShowImpl(); - void pShow() { - pShowImpl(); - } - - boolean supportsXEmbed() { - EmbeddedFrame frame = (EmbeddedFrame)target; - if (frame != null) { - return frame.supportsXEmbed(); - } else { - return false; - } - } - - public void setVisible(boolean vis) { - super.setVisible(vis); - xembedLog.fine("Peer made visible"); - if (vis && !supportsXEmbed()) { - xembedLog.fine("Synthesizing FocusIn"); - // Fix for 4878303 - generate WINDOW_GAINED_FOCUS and update if we were focused - // since noone will do it for us(WM does it for regular top-levels) - synthesizeFocusInOut(true); - } - } - public native void synthesizeFocusInOut(boolean b); - - native boolean isXEmbedActive(); - native boolean isXEmbedApplicationActive(); - native void requestXEmbedFocus(); - - public boolean requestWindowFocus() { - xembedLog.fine("In requestWindowFocus"); - // Should check for active state of host application - if (isXEmbedActive()) { - if (isXEmbedApplicationActive()) { - xembedLog.fine("Requesting focus from embedding host"); - requestXEmbedFocus(); - return true; - } else { - xembedLog.fine("Host application is not active"); - return false; - } - } else { - xembedLog.fine("Requesting focus from X"); - return super.requestWindowFocus(); - } - } - - void registerAccelerator(AWTKeyStroke stroke) { -// if (stroke == null) return; -// strokes.add(stroke); -// if (isXEmbedActive()) { -// nativeRegisterAccelerator(stroke, strokes.size()-1); -// } - } - - void unregisterAccelerator(AWTKeyStroke stroke) { -// if (stroke == null) return; -// if (isXEmbedActive()) { -// int index = strokes.indexOf(stroke); -// nativeUnregisterAccelerator(index); -// } - } - - void notifyStarted() { - // Register accelerators -// int i = 0; -// Iterator<AWTKeyStroke> iter = strokes.iterator(); -// while (iter.hasNext()) { -// nativeRegisterAccelerator(iter.next(), i++); -// } - - updateDropTarget(); - } - - native void traverseOut(boolean direction); - - void handleFocusIn(int detail) { - xembedLog.log(Level.FINE, "handleFocusIn {0}", new Object[]{Integer.valueOf(detail)}); - switch(detail) { - case XEMBED_FOCUS_CURRENT: - // Do nothing - just restore to the current value - break; - case XEMBED_FOCUS_FIRST: - SunToolkit.executeOnEventHandlerThread(target, new Runnable() { - public void run() { - Component comp = ((Container)target).getFocusTraversalPolicy().getFirstComponent((Container)target); - if (comp != null) { - comp.requestFocusInWindow(); - } - }}); - break; - case XEMBED_FOCUS_LAST: - SunToolkit.executeOnEventHandlerThread(target, new Runnable() { - public void run() { - Component comp = ((Container)target).getFocusTraversalPolicy().getLastComponent((Container)target); - if (comp != null) { - comp.requestFocusInWindow(); - } - }}); - break; - } - } - public void handleWindowFocusIn() { - super.handleWindowFocusIn(); - xembedLog.fine("windowFocusIn"); - } - public void handleWindowFocusOut(Window oppositeWindow) { - super.handleWindowFocusOut(oppositeWindow); - xembedLog.fine("windowFocusOut, opposite is null?:" + (oppositeWindow==null)); - } - - native void pReshapePrivate(int x, int y, int w, int h); - - public void setBoundsPrivate(int x, int y, int width, int height) - { - if (disposed) - { - return; - } - - // Should set paintPending before reshape to prevent - // thread race between PaintEvent and setBounds - // This part of the 4267393 fix proved to be unstable under solaris, - // dissabled due to regressions 4418155, 4486762, 4490079 - paintPending = false; //checkNativePaintOnSetBounds(width, height); - - pReshapePrivate(x, y, width, height); - - if ((width != oldWidth) || (height != oldHeight)) - { - SurfaceData oldData = surfaceData; - if (oldData != null) { - surfaceData = graphicsConfig.createSurfaceData(this); - oldData.invalidate(); - } - oldWidth = width; - oldHeight = height; - } - validateSurface(width, height); - serialNum++; - } - - public native Rectangle getBoundsPrivate(); - - @Override - Rectangle constrainBounds(int x, int y, int width, int height) { - // We don't constrain the bounds of the EmbeddedFrames - return new Rectangle(x, y, width, height); - } -}
--- a/src/solaris/classes/sun/awt/motif/MFileDialogPeer.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,300 +0,0 @@ -/* - * Copyright 1995-2003 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package sun.awt.motif; - -import java.awt.*; -import java.awt.peer.*; -import java.io.*; -import java.awt.datatransfer.*; -import java.util.ArrayList; -import sun.awt.datatransfer.ToolkitThreadBlockedHandler; - -public class MFileDialogPeer extends MDialogPeer implements FileDialogPeer { - private FilenameFilter filter; - private String[] NativeFilteredFiles; - native void create(MComponentPeer parent); - void create(MComponentPeer parent, Object arg) { - create(parent); - } - public MFileDialogPeer(FileDialog target) { - super(target); - FileDialog fdialog = (FileDialog)target; - String dir = fdialog.getDirectory(); - String file = fdialog.getFile(); - FilenameFilter filter = fdialog.getFilenameFilter(); - - insets = new Insets(0, 0, 0, 0); - setDirectory(dir); - if (file != null) { - setFile(file); - } - setFilenameFilter(filter); - } - native void pReshape(int x, int y, int width, int height); - native void pDispose(); - native void pShow(); - native void pHide(); - native void setFileEntry(String dir, String file, String[] ffiles); - native void insertReplaceFileDialogText(String l); - public native void setFont(Font f); - - String getFilteredFile(String file) { - if (file == null) { - file = ((FileDialog)target).getFile(); - } - String dir = ((FileDialog)target).getDirectory(); - if (dir == null) { - dir = "./"; - } - if (file == null) { - file = ""; - } - if (filter != null && !filter.accept(new File(dir), file)) { - file = ""; - } - return file; - } - // NOTE: This method is called by privileged threads. - // DO NOT INVOKE CLIENT CODE ON THIS THREAD! - public void handleSelected(final String file) { - final FileDialog fileDialog = (FileDialog)target; - MToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() { - public void run() { - int index = file.lastIndexOf(java.io.File.separatorChar);/*2509*//*ibm*/ - String dir; - - if (index == -1) { - dir = "."+java.io.File.separator; - fileDialog.setFile(file); - } else { - dir = file.substring(0, index + 1); - fileDialog.setFile(file.substring(index + 1)); - } - fileDialog.setDirectory(dir); - fileDialog.hide(); - } - }); - } // handleSelected() - - // NOTE: This method is called by privileged threads. - // DO NOT INVOKE CLIENT CODE ON THIS THREAD! - public void handleCancel() { - final FileDialog fileDialog = (FileDialog)target; - MToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() { - public void run() { - fileDialog.setFile(null); - fileDialog.hide(); - } - }); - } // handleCancel() - - // NOTE: This method is called by privileged threads. - // DO NOT INVOKE CLIENT CODE ON THIS THREAD! - public void handleQuit() { - final FileDialog fileDialog = (FileDialog)target; - MToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() { - public void run() { - fileDialog.hide(); - } - }); - } // handleQuit() - - public void setDirectory(String dir) { - String file = ((FileDialog)target).getFile(); - setFileEntry((dir != null) ? dir : "./", (file != null) ? file - : "", null); - } - - - public void setFile(String file) { - String dir = ((FileDialog)target).getDirectory(); - if (dir == null) { - dir = "./"; - } - setFileEntry((dir != null) ? dir : "./", getFilteredFile(null), null); - } - class DirectoryFilter implements FilenameFilter { - FilenameFilter userFilter; - DirectoryFilter(FilenameFilter userFilter) { - this.userFilter = userFilter; - } - public boolean accept(File parent, String name) { - File toTest = new File(parent, name); - if (toTest.isDirectory()) { - return false; - } else if (userFilter != null) { - return userFilter.accept(parent, name); - } else { - return true; - } - } - } - public void doFilter(FilenameFilter filter, String dir) { - String d = (dir == null) ? (((FileDialog)target).getDirectory()):(dir); - String f = getFilteredFile(null); - File df = new File((d != null) ? d : "."); - String[] files = df.list(new DirectoryFilter(filter)); - String[] nffiles = NativeFilteredFiles; - - // At this point we have two file lists. - // The first one is a filtered list of files that we retrieve - // by using Java code and Java filter. - // The second one is a filtered list of files that we retrieve - // by using the native code and native pattern. - // We should find an intersection of these two lists. The result - // will be exactly what we expect to see in setFileEntry. - // For more details please see 4784704. - if ( files != null ) { - ArrayList filearr = new ArrayList(); - if (nffiles != null) { - for (int j = 0; j < files.length; j++) { - for (int n = 0; n < nffiles.length; n++) { - if (files[j].equals(nffiles[n])) { - filearr.add(files[j]); - break; - } - } - } - } - files = new String[filearr.size()]; - for (int i = 0; i < files.length; i++) { - files[i] = (String)filearr.get(i); - } - } - if (files == null || files.length == 0) { - files = new String[1]; - files[0] = ""; - } - setFileEntry((d != null) ? d : ".", (f != null) ? f : "", files); - } - private boolean proceedFiltering(final String dir, String[] nffiles, - boolean isPrivileged) - { - // Transfer the native filtered file list to the doFilter method. - NativeFilteredFiles = nffiles; - // If we are not on the Toolkit thread we can call doFilter() directly. - // If the filter is null no user code will be invoked - if (!isPrivileged || filter == null) { - try { - doFilter(filter, dir); - return true; - } catch(Exception e) { - e.printStackTrace(); - return false; - } - } - // Otherwise we have to call user code on EvenDispatchThread - final ToolkitThreadBlockedHandler priveleged_lock = - MToolkitThreadBlockedHandler.getToolkitThreadBlockedHandler(); - final boolean[] finished = new boolean[1]; - final boolean[] result = new boolean[1]; - finished[0] = false; - result[0] = false; - - - // Use the same Toolkit blocking mechanism as in DnD. - priveleged_lock.lock(); - - MToolkit.executeOnEventHandlerThread((FileDialog)target, new Runnable() { - public void run() { - priveleged_lock.lock(); - try { - doFilter(filter, dir); - result[0] = true; - } catch (Exception e) { - e.printStackTrace(); - result[0] = false; - } finally { - finished[0] = true; - priveleged_lock.exit(); - priveleged_lock.unlock(); - } - } - }); - - while (!finished[0]) { - priveleged_lock.enter(); - } - - priveleged_lock.unlock(); - - return result[0]; - } - - public void setFilenameFilter(FilenameFilter filter) { - this.filter = filter; - FileDialog fdialog = (FileDialog)target; - String dir = fdialog.getDirectory(); - String file = fdialog.getFile(); - setFile(file); - doFilter(filter, null); - } - - // Called from native widget when paste key is pressed and we - // already own the selection (prevents Motif from hanging while - // waiting for the selection) - // - public void pasteFromClipboard() { - Clipboard clipboard = target.getToolkit().getSystemClipboard(); - - Transferable content = clipboard.getContents(this); - if (content != null) { - try { - String data = (String)(content.getTransferData(DataFlavor.stringFlavor)); - insertReplaceFileDialogText(data); - } catch (Exception e) { - } - } - } - -// CAVEAT: -// Peer coalescing code turned over the fact that the following functions -// were being inherited from Dialog and were not implemented in awt_FileDialog.c -// Five methods decribed by the peer interface are at fault (setResizable, setTitle, -// toFront, toBack and handleFocusTraversalEvent). Additionally show has to be overridden -// as it was necessary to add a show function in MDialogPeer for modality flag passing. -// As a result we were winding up in awt_Dialog.c (now coalesced into awt_TopLevel). -// As Filedialogs are modal and its unclear to me that any of these functions -// can be called while the FD is on-screen let it go. RJM. - public void show() { - // must have our own show or we wind up in pShow for Window. Bad. Very bad. - setVisible(true); - setFilenameFilter(filter); - } - - /** - * MFileDialogPeer doesn't have native pData so we don't do restack on it - * @see java.awt.peer.ContainerPeer#restack - */ - public void restack() { - } - - /** - * @see java.awt.peer.ContainerPeer#isRestackSupported - */ - public boolean isRestackSupported() { - return false; - } -}
--- a/src/solaris/classes/sun/awt/motif/MFramePeer.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,511 +0,0 @@ -/* - * Copyright 1995-2008 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package sun.awt.motif; - -import java.util.Vector; -import java.awt.*; -import java.awt.peer.*; -import java.awt.event.*; -import sun.awt.motif.MInputMethodControl; -import sun.awt.im.*; -import java.awt.image.ColorModel; -import java.awt.image.BufferedImage; -import java.awt.image.DataBuffer; -import java.awt.image.DataBufferInt; -import java.awt.image.DataBufferByte; -import java.awt.image.DataBufferUShort; -import java.awt.image.ImageObserver; -import java.awt.image.WritableRaster; -import sun.awt.image.ImageRepresentation; -import sun.awt.image.ToolkitImage; - -class MFramePeer extends MWindowPeer implements FramePeer, MInputMethodControl { - static Vector allFrames = new Vector(); - - // XXX: Stub out for now. Need to propagate to normal size hints. - public void setMaximizedBounds(Rectangle b) {} - - public void create(MComponentPeer parent, Object arg) { - super.create( parent ); - } - - MFramePeer(Frame target) { - super(); - // set the window attributes for this Frame - winAttr.nativeDecor = !target.isUndecorated(); - winAttr.initialFocus = true; - winAttr.isResizable = target.isResizable(); - winAttr.initialState = target.getState(); - winAttr.title = target.getTitle(); - winAttr.icon = target.getIconImage(); - if (winAttr.nativeDecor) { - winAttr.decorations = winAttr.AWT_DECOR_ALL; - } else { - winAttr.decorations = winAttr.AWT_DECOR_NONE; - } - - // for input method windows, use minimal decorations - if (target instanceof InputMethodWindow) { - winAttr.initialFocus = false; - winAttr.decorations = (winAttr.AWT_DECOR_TITLE | winAttr.AWT_DECOR_BORDER); - } - - // create and init native component - init( target); - if (winAttr.icon != null) { - setIconImage(winAttr.icon); - } - allFrames.addElement(this); - } - - public void setTitle(String title) { - pSetTitle(title); - } - - protected void disposeImpl() { - allFrames.removeElement(this); - super.disposeImpl(); - } - - public void setMenuBar(MenuBar mb) { - MMenuBarPeer mbpeer = (MMenuBarPeer) MToolkit.targetToPeer(mb); - pSetMenuBar(mbpeer); - - Rectangle r = target.bounds(); - - pReshape(r.x, r.y, r.width, r.height); - if (target.isVisible()) { - target.validate(); - } - } - - public void setIconImage(Image im) { - int width; - int height; - GraphicsConfiguration defaultGC; - if (im != null) { // 4633887 Avoid Null pointer exception. - if (im instanceof ToolkitImage) { - ImageRepresentation ir = ((ToolkitImage)im).getImageRep(); - ir.reconstruct(ImageObserver.ALLBITS); - width = ir.getWidth(); - height = ir.getHeight(); - } - else { - width = im.getWidth(null); - height = im.getHeight(null); - } - if (pGetIconSize(width, height)) { - //Icons are displayed using the default visual, so create image - //using default GraphicsConfiguration - defaultGC = getGraphicsConfiguration().getDevice(). - getDefaultConfiguration(); - ColorModel model = defaultGC.getColorModel(); - WritableRaster raster = - model.createCompatibleWritableRaster(iconWidth, iconHeight); - Image image = new BufferedImage(model, raster, - model.isAlphaPremultiplied(), - null); - - // ARGB BufferedImage to hunt for transparent pixels - BufferedImage bimage = - new BufferedImage(iconWidth, iconHeight, - BufferedImage.TYPE_INT_ARGB); - ColorModel alphaCheck = bimage.getColorModel(); - Graphics g = image.getGraphics(); - Graphics big = bimage.getGraphics(); - try { - g.drawImage(im, 0, 0, iconWidth, iconHeight, null); - big.drawImage(im, 0, 0, iconWidth, iconHeight, null); - } finally { - g.dispose(); - big.dispose(); - } - - DataBuffer db = ((BufferedImage)image).getRaster().getDataBuffer(); - DataBuffer bidb = bimage.getRaster().getDataBuffer(); - byte[] bytedata = null; - int[] intdata = null; - int bidbLen = bidb.getSize(); - int imgDataIdx; - //Get native RGB value for window background color - //Should work for byte as well as int - int bgRGB = getNativeColor(SystemColor.window, defaultGC); - - /* My first attempt at a solution to bug 4175560 was to use - * the iconMask and iconPixmap attributes of Windows. - * This worked fine on CDE/dtwm, however olwm displayed only - * single color icons (white on background). Instead, the - * fix gets the default background window color and replaces - * transparent pixels in the icon image with this color. This - * solutions works well with dtwm as well as olwm. - */ - - for (imgDataIdx = 0; imgDataIdx < bidbLen; imgDataIdx++) { - if (alphaCheck.getAlpha(bidb.getElem(imgDataIdx)) == 0 ) { - //Assuming single data bank - db.setElem(imgDataIdx, bgRGB); - } - } - short[] ushortdata = null; - if (db instanceof DataBufferByte) { - // Pseudocolor data - bytedata = ((DataBufferByte)db).getData(); - } - else if (db instanceof DataBufferInt) { - // Truecolor data - intdata = ((DataBufferInt) db).getData(); - } - else if (db instanceof DataBufferUShort) { - // Truecolor data - ushortdata = ((DataBufferUShort) db).getData(); - } - pSetIconImage(bytedata, intdata, ushortdata, - iconWidth, iconHeight); - } - } - } - - native boolean pGetIconSize(int widthHint, int heightHint); - - // [jk] added ushortData for 16-bpp displays - native void pSetIconImage(byte[] byteData, - int[] intData, - short[] ushortData, - int iconWidth, int iconHeight); - - // NOTE: This method may be called by privileged threads. - // DO NOT INVOKE CLIENT CODE ON THIS THREAD! - public void handleIconify() { - postEvent(new WindowEvent((Window)target, WindowEvent.WINDOW_ICONIFIED)); - } - - // NOTE: This method may be called by privileged threads. - // DO NOT INVOKE CLIENT CODE ON THIS THREAD! - public void handleDeiconify() { - postEvent(new WindowEvent((Window)target, WindowEvent.WINDOW_DEICONIFIED)); - } - - - /** - * Called to inform the Frame that it has moved. - */ - // NOTE: This method may be called by privileged threads. - // DO NOT INVOKE CLIENT CODE ON THIS THREAD! - public void handleMoved(int x, int y) { - postEvent(new ComponentEvent(target, ComponentEvent.COMPONENT_MOVED)); - } - - static final int CROSSHAIR_INSET = 5; - - static final int BUTTON_Y = CROSSHAIR_INSET + 1; - static final int BUTTON_W = 17; - static final int BUTTON_H = 17; - - static final int SYS_MENU_X = CROSSHAIR_INSET + 1; - static final int SYS_MENU_CONTAINED_X = SYS_MENU_X + 5; - static final int SYS_MENU_CONTAINED_Y = BUTTON_Y + 7; - static final int SYS_MENU_CONTAINED_W = 8; - static final int SYS_MENU_CONTAINED_H = 3; - - static final int MAXIMIZE_X_DIFF = CROSSHAIR_INSET + BUTTON_W; - static final int MAXIMIZE_CONTAINED_X_DIFF = MAXIMIZE_X_DIFF - 5; - static final int MAXIMIZE_CONTAINED_Y = BUTTON_Y + 5; - static final int MAXIMIZE_CONTAINED_W = 8; - static final int MAXIMIZE_CONTAINED_H = 8; - - static final int MINIMIZE_X_DIFF = MAXIMIZE_X_DIFF + BUTTON_W; - static final int MINIMIZE_CONTAINED_X_DIFF = MINIMIZE_X_DIFF - 7; - static final int MINIMIZE_CONTAINED_Y = BUTTON_Y + 7; - static final int MINIMIZE_CONTAINED_W = 3; - static final int MINIMIZE_CONTAINED_H = 3; - - static final int TITLE_X = SYS_MENU_X + BUTTON_W; - static final int TITLE_W_DIFF = BUTTON_W * 3 + CROSSHAIR_INSET * 2 - 1; - static final int TITLE_MID_Y = BUTTON_Y + (BUTTON_H / 2); - - static final int MENUBAR_X = CROSSHAIR_INSET + 1; - static final int MENUBAR_Y = BUTTON_Y + BUTTON_H; - - static final int HORIZ_RESIZE_INSET = CROSSHAIR_INSET + BUTTON_H; - static final int VERT_RESIZE_INSET = CROSSHAIR_INSET + BUTTON_W; - - - /* - * Print the native component by rendering the Motif look ourselves. - * We also explicitly print the MenuBar since a MenuBar isn't a subclass - * of Component (and thus it has no "print" method which gets called by - * default). - */ - public void print(Graphics g) { - super.print(g); - - Frame f = (Frame)target; - Insets finsets = f.getInsets(); - Dimension fsize = f.getSize(); - - Color bg = f.getBackground(); - Color fg = f.getForeground(); - Color highlight = bg.brighter(); - Color shadow = bg.darker(); - - // Well, we could query for the currently running window manager - // and base the look on that, or we could just always do dtwm. - // aim, tball, and levenson all agree we'll just do dtwm. - - if (hasDecorations(MWindowAttributes.AWT_DECOR_BORDER)) { - - // top outer -- because we'll most likely be drawing on white paper, - // for aesthetic reasons, don't make any part of the outer border - // pure white - if (highlight.equals(Color.white)) { - g.setColor(new Color(230, 230, 230)); - } - else { - g.setColor(highlight); - } - g.drawLine(0, 0, fsize.width, 0); - g.drawLine(0, 1, fsize.width - 1, 1); - - // left outer - // if (highlight.equals(Color.white)) { - // g.setColor(new Color(230, 230, 230)); - // } - // else { - // g.setColor(highlight); - // } - g.drawLine(0, 0, 0, fsize.height); - g.drawLine(1, 0, 1, fsize.height - 1); - - // bottom cross-hair - g.setColor(highlight); - g.drawLine(CROSSHAIR_INSET + 1, fsize.height - CROSSHAIR_INSET, - fsize.width - CROSSHAIR_INSET, - fsize.height - CROSSHAIR_INSET); - - // right cross-hair - // g.setColor(highlight); - g.drawLine(fsize.width - CROSSHAIR_INSET, CROSSHAIR_INSET + 1, - fsize.width - CROSSHAIR_INSET, - fsize.height - CROSSHAIR_INSET); - - // bottom outer - g.setColor(shadow); - g.drawLine(1, fsize.height, fsize.width, fsize.height); - g.drawLine(2, fsize.height - 1, fsize.width, fsize.height - 1); - - // right outer - // g.setColor(shadow); - g.drawLine(fsize.width, 1, fsize.width, fsize.height); - g.drawLine(fsize.width - 1, 2, fsize.width - 1, fsize.height); - - // top cross-hair - // g.setColor(shadow); - g.drawLine(CROSSHAIR_INSET, CROSSHAIR_INSET, - fsize.width - CROSSHAIR_INSET, CROSSHAIR_INSET); - - // left cross-hair - // g.setColor(shadow); - g.drawLine(CROSSHAIR_INSET, CROSSHAIR_INSET, CROSSHAIR_INSET, - fsize.height - CROSSHAIR_INSET); - } - - if (hasDecorations(MWindowAttributes.AWT_DECOR_TITLE)) { - - if (hasDecorations(MWindowAttributes.AWT_DECOR_MENU)) { - - // system menu - g.setColor(bg); - g.fill3DRect(SYS_MENU_X, BUTTON_Y, BUTTON_W, BUTTON_H, true); - g.fill3DRect(SYS_MENU_CONTAINED_X, SYS_MENU_CONTAINED_Y, - SYS_MENU_CONTAINED_W, SYS_MENU_CONTAINED_H, true); - } - - // title bar - // g.setColor(bg); - g.fill3DRect(TITLE_X, BUTTON_Y, fsize.width - TITLE_W_DIFF, BUTTON_H, - true); - - if (hasDecorations(MWindowAttributes.AWT_DECOR_MINIMIZE)) { - - // minimize button - // g.setColor(bg); - g.fill3DRect(fsize.width - MINIMIZE_X_DIFF, BUTTON_Y, BUTTON_W, - BUTTON_H, true); - g.fill3DRect(fsize.width - MINIMIZE_CONTAINED_X_DIFF, - MINIMIZE_CONTAINED_Y, MINIMIZE_CONTAINED_W, - MINIMIZE_CONTAINED_H, true); - } - - if (hasDecorations(MWindowAttributes.AWT_DECOR_MAXIMIZE)) { - - // maximize button - // g.setColor(bg); - g.fill3DRect(fsize.width - MAXIMIZE_X_DIFF, BUTTON_Y, BUTTON_W, - BUTTON_H, true); - g.fill3DRect(fsize.width - MAXIMIZE_CONTAINED_X_DIFF, - MAXIMIZE_CONTAINED_Y, MAXIMIZE_CONTAINED_W, - MAXIMIZE_CONTAINED_H, true); - } - - // title bar text - g.setColor(fg); - Font sysfont = new Font(Font.SANS_SERIF, Font.PLAIN, 10); - g.setFont(sysfont); - FontMetrics sysfm = g.getFontMetrics(); - String ftitle = f.getTitle(); - g.drawString(ftitle, - ((TITLE_X + TITLE_X + fsize.width - TITLE_W_DIFF) / 2) - - (sysfm.stringWidth(ftitle) / 2), - TITLE_MID_Y + sysfm.getMaxDescent()); - } - - if (f.isResizable() && - hasDecorations(MWindowAttributes.AWT_DECOR_RESIZEH)) { - - // add resize cross hairs - - // upper-left horiz (shadow) - g.setColor(shadow); - g.drawLine(1, HORIZ_RESIZE_INSET, CROSSHAIR_INSET, - HORIZ_RESIZE_INSET); - // upper-left vert (shadow) - // g.setColor(shadow); - g.drawLine(VERT_RESIZE_INSET, 1, VERT_RESIZE_INSET, CROSSHAIR_INSET); - // upper-right horiz (shadow) - // g.setColor(shadow); - g.drawLine(fsize.width - CROSSHAIR_INSET + 1, HORIZ_RESIZE_INSET, - fsize.width, HORIZ_RESIZE_INSET); - // upper-right vert (shadow) - // g.setColor(shadow); - g.drawLine(fsize.width - VERT_RESIZE_INSET - 1, 2, - fsize.width - VERT_RESIZE_INSET - 1, CROSSHAIR_INSET + 1); - // lower-left horiz (shadow) - // g.setColor(shadow); - g.drawLine(1, fsize.height - HORIZ_RESIZE_INSET - 1, - CROSSHAIR_INSET, fsize.height - HORIZ_RESIZE_INSET - 1); - // lower-left vert (shadow) - // g.setColor(shadow); - g.drawLine(VERT_RESIZE_INSET, fsize.height - CROSSHAIR_INSET + 1, - VERT_RESIZE_INSET, fsize.height); - // lower-right horiz (shadow) - // g.setColor(shadow); - g.drawLine(fsize.width - CROSSHAIR_INSET + 1, - fsize.height - HORIZ_RESIZE_INSET - 1, fsize.width, - fsize.height - HORIZ_RESIZE_INSET - 1); - // lower-right vert (shadow) - // g.setColor(shadow); - g.drawLine(fsize.width - VERT_RESIZE_INSET - 1, - fsize.height - CROSSHAIR_INSET + 1, - fsize.width - VERT_RESIZE_INSET - 1, fsize.height); - - // upper-left horiz (highlight) - g.setColor(highlight); - g.drawLine(2, HORIZ_RESIZE_INSET + 1, CROSSHAIR_INSET, - HORIZ_RESIZE_INSET + 1); - // upper-left vert (highlight) - // g.setColor(highlight); - g.drawLine(VERT_RESIZE_INSET + 1, 2, VERT_RESIZE_INSET + 1, - CROSSHAIR_INSET); - // upper-right horiz (highlight) - // g.setColor(highlight); - g.drawLine(fsize.width - CROSSHAIR_INSET + 1, - HORIZ_RESIZE_INSET + 1, fsize.width - 1, - HORIZ_RESIZE_INSET + 1); - // upper-right vert (highlight) - // g.setColor(highlight); - g.drawLine(fsize.width - VERT_RESIZE_INSET, 2, - fsize.width - VERT_RESIZE_INSET, CROSSHAIR_INSET); - // lower-left horiz (highlight) - // g.setColor(highlight); - g.drawLine(2, fsize.height - HORIZ_RESIZE_INSET, CROSSHAIR_INSET, - fsize.height - HORIZ_RESIZE_INSET); - // lower-left vert (highlight) - // g.setColor(highlight); - g.drawLine(VERT_RESIZE_INSET + 1, - fsize.height - CROSSHAIR_INSET + 1, - VERT_RESIZE_INSET + 1, fsize.height - 1); - // lower-right horiz (highlight) - // g.setColor(highlight); - g.drawLine(fsize.width - CROSSHAIR_INSET + 1, - fsize.height - HORIZ_RESIZE_INSET, fsize.width - 1, - fsize.height - HORIZ_RESIZE_INSET); - // lower-right vert (highlight) - // g.setColor(highlight); - g.drawLine(fsize.width - VERT_RESIZE_INSET, - fsize.height - CROSSHAIR_INSET + 1, - fsize.width - VERT_RESIZE_INSET, fsize.height - 1); - } - - MenuBar mb = f.getMenuBar(); - if (mb != null) { - MMenuBarPeer peer = (MMenuBarPeer) MToolkit.targetToPeer(mb); - if (peer != null) { - Insets insets = getInsets(); - Graphics ng = g.create(); - int menubarX = 0; - int menubarY = 0; - if (hasDecorations(MWindowAttributes.AWT_DECOR_BORDER)) { - menubarX += CROSSHAIR_INSET + 1; - menubarY += CROSSHAIR_INSET + 1; - } - if (hasDecorations(MWindowAttributes.AWT_DECOR_TITLE)) { - menubarY += BUTTON_H; - } - try { - ng.translate(menubarX, menubarY); - peer.print(ng); - } finally { - ng.dispose(); - } - } - } - } - - // Saveunders are not done by Frame. - void setSaveUnder(boolean state) {} - - /* Returns the native paint should be posted after setting new size - */ - public boolean checkNativePaintOnSetBounds(int width, int height) { - // Fix for 4418155. Undecorated Frame does not repaint - // automticaly if shrinking. Should not wait for Expose - return ((Frame)target).isUndecorated() ? - ((width > oldWidth) || (height > oldHeight)): - ((width != oldWidth) || (height != oldHeight)); - } - - public void setBoundsPrivate(int x, int y, int width, int height) { - setBounds(x, y, width, height); - } - - public Rectangle getBoundsPrivate() { - return getBounds(); - } - - @Override - final boolean isTargetUndecorated() { - return ((Frame)target).isUndecorated(); - } -}
--- a/src/solaris/classes/sun/awt/motif/MGlobalCursorManager.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +0,0 @@ -/* - * Copyright 1999-2004 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package sun.awt.motif; - -import java.awt.*; -import sun.awt.GlobalCursorManager; -import sun.awt.GlobalCursorManager.*; - -public final class MGlobalCursorManager extends GlobalCursorManager { - - static { - cacheInit(); - } - - private native static void cacheInit(); - - // cached nativeContainer - private Component nativeContainer; - - - /** - * The MGlobalCursorManager is a singleton. - */ - private static MGlobalCursorManager manager; - - - static GlobalCursorManager getCursorManager() { - if (manager == null) { - manager = new MGlobalCursorManager(); - } - return manager; - } - - /** - * Should be called in response to a native mouse enter or native mouse - * button released message. Should not be called during a mouse drag. - */ - static void nativeUpdateCursor(Component heavy) { - MGlobalCursorManager.getCursorManager().updateCursorLater(heavy); - } - - - protected void setCursor(Component comp, Cursor cursor, boolean useCache) { - if (comp == null) { - return; - } - - Cursor cur = useCache ? cursor : getCapableCursor(comp); - - Component nc = useCache ? nativeContainer : getNativeContainer(comp); - - // System.out.println(" set cursor="+cursor+" on "+comp+" new curs="+cur); - if (nc != null && nc.isDisplayable()) { - nativeContainer = nc; - ((MComponentPeer)nc.getPeer()).pSetCursor(cur); - } - } - - private Component getNativeContainer(Component comp) { - while (comp != null && comp.isLightweight()) { - comp = comp.getParent(); - } - return comp; - } - - protected native void getCursorPos(Point p); - protected native Component findHeavyweightUnderCursor(); - - /* - * two native methods to call corresponding methods in Container and - * Component - */ - protected native Component findComponentAt(Container con, int x, int y); - protected native Point getLocationOnScreen(Component com); - - protected Component findHeavyweightUnderCursor(boolean useCache) { - return findHeavyweightUnderCursor(); - } - - private Cursor getCapableCursor(Component comp) { - Component c = comp; - while ((c != null) && !(c instanceof Window) && - c.isEnabled() && c.isVisible() && c.isDisplayable()) { - c = c.getParent(); - } - if (c instanceof Window) { - return (c.isEnabled() && c.isVisible() && c.isDisplayable() && comp.isEnabled()) ? - comp.getCursor() : - Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); - } else if (c == null) { - return null; - } - return getCapableCursor(c.getParent()); - } -}
--- a/src/solaris/classes/sun/awt/motif/MInputMethod.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +0,0 @@ -/* - * Copyright 2003-2005 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package sun.awt.motif; - -import java.awt.AWTException; -import java.awt.Component; -import java.awt.Container; -import java.awt.Window; -import java.awt.peer.ComponentPeer; -import sun.awt.X11InputMethod; -import sun.awt.SunToolkit; - -/** - * Input Method Adapter for XIM (with Motif) - * - * @author JavaSoft International - */ -public class MInputMethod extends X11InputMethod { - - public MInputMethod() throws AWTException { - super(); - } - - protected boolean openXIM() { - return openXIMNative(); - } - - protected boolean createXIC() { - MComponentPeer peer = (MComponentPeer)getPeer(clientComponentWindow); - if (peer == null) { - return false; - } - MComponentPeer tc = null; - if (peer instanceof MInputMethodControl) { - tc = ((MInputMethodControl)peer).getTextComponent(); - } - if (!createXICNative(peer, tc)) { - return false; - } - if (peer instanceof MInputMethodControl) { - ((MInputMethodControl)peer).addInputMethod(this); - } - return true; - } - - protected void setXICFocus(ComponentPeer peer, - boolean value, boolean active) { - setXICFocusNative((MComponentPeer)peer, value, active); - } - - protected Container getParent(Component client) { - // SECURITY: Use _NoClientCode(), because this thread may - // be privileged - return MComponentPeer.getParent_NoClientCode(client); - } - - /** - * Returns peer of the given client component. If the given client component - * doesn't have peer, peer of the native container of the client is returned. - */ - protected ComponentPeer getPeer(Component client) { - MComponentPeer peer = (MComponentPeer)MToolkit.targetToPeer(client); - if (peer != null) - return peer; - - Container nativeContainer = MToolkit.getNativeContainer(client); - peer = (MComponentPeer)MToolkit.targetToPeer(nativeContainer); - return peer; - } - - /** - * Changes the status area configuration that is to be requested - * by Frame or Dialog. - */ - void configureStatus() { - if (isDisposed()) { - return; - } - - MComponentPeer peer = (MComponentPeer)getPeer((Window) clientComponentWindow); - MComponentPeer tc = ((MInputMethodControl)peer).getTextComponent(); - if (tc != null) { - configureStatusAreaNative(tc); - } - } - - /* - * Subclasses should override disposeImpl() instead of dispose(). Client - * code should always invoke dispose(), never disposeImpl(). - */ - protected synchronized void disposeImpl() { - if (clientComponentWindow != null) { - MComponentPeer peer = (MComponentPeer)getPeer(clientComponentWindow); - if (peer instanceof MInputMethodControl) - ((MInputMethodControl)peer).removeInputMethod(this); - clientComponentWindow = null; - } - - super.disposeImpl(); - } - - /** - * @see java.awt.im.spi.InputMethod#removeNotify - */ - public synchronized void removeNotify() { - if (MToolkit.targetToPeer(getClientComponent()) != null) { - dispose(); - } else { - // We do not have to dispose XICs in case of lightweight component. - resetXIC(); - } - } - - /** - * Changes the internal XIC configurations. This is required the - * case that addition or elimination of text components has - * happened in the containment hierarchy. This method is invoked - * by Frame or Dialog. - */ - synchronized void reconfigureXIC(MInputMethodControl control) { - if (!isDisposed()) { - // Some IM servers require to reset XIC before destroying - // the XIC. I.e., Destroying XIC doesn't reset the internal - // state of the IM server. endComposition() takes care of - // resetting XIC and preedit synchronization. However, - // there is no client at this point. It is assumed that - // the previous client is still available for dispatching - // committed text which maintains client's composition - // context. - endComposition(); - resetXICifneeded(); - reconfigureXICNative((MComponentPeer) control, control.getTextComponent()); - } - } - - protected void awtLock() { - SunToolkit.awtLock(); - } - - protected void awtUnlock() { - SunToolkit.awtUnlock(); - } - - /* - * Native methods - */ - private native boolean openXIMNative(); - private native boolean createXICNative(MComponentPeer peer, MComponentPeer tc); - private native void reconfigureXICNative(MComponentPeer peer, - MComponentPeer tc); - private native void configureStatusAreaNative(MComponentPeer tc); - private native void setXICFocusNative(MComponentPeer peer, - boolean value, boolean active); -}
--- a/src/solaris/classes/sun/awt/motif/MInputMethodControl.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* - * Copyright 1997-2003 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package sun.awt.motif; - -import sun.awt.motif.MComponentPeer; -import sun.awt.motif.MInputMethod; - -/** - * An interface for controlling containment hierarchy configuration to - * keep track of existence of any TextArea or TextField and to manage - * input method status area. - * - * @auther JavaSoft International - */ -interface MInputMethodControl { - - /** - * Informs Frame or Dialog that a text component has been added to - * the hierarchy. - * @param textComponentPeer peer of the text component - */ - void addTextComponent(MComponentPeer textComponentPeer); - - /** - * Informs Frame or Dialog that a text component has been removed - * from the hierarchy. - * @param textComponentPeer peer of the text component - */ - void removeTextComponent(MComponentPeer textComponentPeer); - - /** - * Returns a text component peer in the containment hierarchy - * to obtain the Motif status area information - */ - MComponentPeer getTextComponent(); - - /** - * Inform Frame or Dialog that an MInputMethod has been - * constructed so that Frame and Dialog can invoke the method in - * MInputMethod to reconfigure XICs. - * @param inputMethod an MInputMethod instance - */ - void addInputMethod(MInputMethod inputMethod); - - /** - * Inform Frame or Dialog that an X11InputMethod is being destroyed. - * @param inputMethod an X11InputMethod instance - */ - void removeInputMethod(MInputMethod inputMethod); -}
--- a/src/solaris/classes/sun/awt/motif/MInputMethodDescriptor.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* - * Copyright 2003 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - - -package sun.awt.motif; - -import java.awt.im.spi.InputMethod; -import sun.awt.X11InputMethodDescriptor; - -/** - * Provides sufficient information about an input method - * to enable selection and loading of that input method. - * The input method itself is only loaded when it is actually used. - * - * @since JDK1.3 - */ - -class MInputMethodDescriptor extends X11InputMethodDescriptor { - - /** - * @see java.awt.im.spi.InputMethodDescriptor#createInputMethod - */ - public InputMethod createInputMethod() throws Exception { - return new MInputMethod(); - } -}
--- a/src/solaris/classes/sun/awt/motif/MLabelPeer.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -/* - * Copyright 1995-1996 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package sun.awt.motif; - -import java.awt.*; -import java.awt.peer.*; - -class MLabelPeer extends MComponentPeer implements LabelPeer { - native void create(MComponentPeer parent); - - public void initialize() { - Label l = (Label)target; - String txt; - int align; - - if ((txt = l.getText()) != null) { - setText(l.getText()); - } - if ((align = l.getAlignment()) != Label.LEFT) { - setAlignment(align); - } - super.initialize(); - } - - MLabelPeer(Label target) { - super(target); - } - - public Dimension getMinimumSize() { - FontMetrics fm = getFontMetrics(target.getFont()); - String label = ((Label)target).getText(); - if (label == null) label = ""; - return new Dimension(fm.stringWidth(label) + 14, - fm.getHeight() + 8); - } - - public native void setText(String label); - public native void setAlignment(int alignment); - - /* - * Print the native component by rendering the Motif look ourselves. - */ - public void print(Graphics g) { - Label l = (Label)target; - Dimension d = l.size(); - Color bg = l.getBackground(); - Color fg = l.getForeground(); - - g.setColor(bg); - g.fillRect(1, 1, d.width - 2, d.height - 2); - - g.setColor(fg); - g.setFont(l.getFont()); - FontMetrics fm = g.getFontMetrics(); - String lbl = l.getText(); - - switch (l.getAlignment()) { - case Label.LEFT: - g.drawString(lbl, 2, - (d.height + fm.getMaxAscent() - fm.getMaxDescent()) / 2); - break; - case Label.RIGHT: - g.drawString(lbl, d.width - (fm.stringWidth(lbl) + 2), - (d.height + fm.getMaxAscent() - fm.getMaxDescent()) / 2); - break; - case Label.CENTER: - g.drawString(lbl, (d.width - fm.stringWidth(lbl)) / 2, - (d.height + fm.getMaxAscent() - fm.getMaxDescent()) / 2); - break; - } - - target.print(g); - } - - /** - * DEPRECATED - */ - public Dimension minimumSize() { - return getMinimumSize(); - } - -}
--- a/src/solaris/classes/sun/awt/motif/MListPeer.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,390 +0,0 @@ -/* - * Copyright 1995-2004 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package sun.awt.motif; - -import java.awt.*; -import java.awt.peer.*; -import java.awt.event.ActionEvent; -import java.awt.event.ItemEvent; -import java.awt.event.MouseEvent; -import java.awt.event.MouseWheelEvent; - -class MListPeer extends MComponentPeer implements ListPeer { - native void create(MComponentPeer parent); - - void initialize() { - List li = (List)target; - - /* add any items that were already inserted in the target. */ - int nitems = li.countItems(); - for (int i = 0; i < nitems; i++) { - addItem(li.getItem(i), -1); - } - - /* set whether this list should allow multiple selections. */ - setMultipleSelections(li.allowsMultipleSelections()); - - /* make the visible position visible. */ - int index = li.getVisibleIndex(); - if (index >= 0) { - makeVisible(index); - } - - /* select the item if necessary. */ - int sel[] = li.getSelectedIndexes(); - for (int i = 0 ; i < sel.length ; i++) { - select(sel[i]); - } - - /* BugID 4060345 to avoid showing scrollbar in empty List */ - if (nitems == 0) { - addItem(" ", 0); - delItems(0, 0); - } - super.pSetScrollbarBackground(getParent_NoClientCode(li).getBackground()); - - if (!target.isBackgroundSet()) { - target.setBackground(SystemColor.text); - } - if (!target.isForegroundSet()) { - target.setForeground(SystemColor.textText); - } - - super.initialize(); - } - - MListPeer(List target) { - super(target); - } - - /* New method name for 1.1 */ - public void add(String item, int index) { - addItem(item, index); - } - - /* New method name for 1.1 */ - public void removeAll() { - clear(); - } - - /* New method name for 1.1 */ - public void setMultipleMode (boolean b) { - setMultipleSelections(b); - } - - /* New method name for 1.1 */ - public Dimension getPreferredSize(int rows) { - return preferredSize(rows); - } - - /* New method name for 1.1 */ - public Dimension getMinimumSize(int rows) { - return minimumSize(rows); - } - - public void setForeground(Color c) { - pSetInnerForeground(c); - } - - public native void setBackground(Color c); - public native void setMultipleSelections(boolean v); - public native boolean isSelected(int index); - public native void addItem(String item, int index); - public native void delItems(int start, int end); - public native void select(int index); - public native void deselect(int index); - public native void makeVisible(int index); - - public void clear() { - List l = (List)target; - int count = l.countItems(); - if (count > 0) { - delItems(0, count-1); - } - } - - public int[] getSelectedIndexes() { - List l = (List)target; - int len = l.countItems(); - int sel[] = new int[len]; - int nsel = 0; - for (int i = 0 ; i < len ; i++) { - if (isSelected(i)) { - sel[nsel++] = i; - } - } - int selected[] = new int[nsel]; - System.arraycopy(sel, 0, selected, 0, nsel); - return selected; - } - - // NOTE: This method may be called by privileged threads. - // DO NOT INVOKE CLIENT CODE ON THIS THREAD! - public void action(int index, final long when, final int modifiers) { - final List list = (List)target; - final int selectIndex = index; - - MToolkit.executeOnEventHandlerThread(list, new Runnable() { - public void run() { - list.select(selectIndex); - postEvent(new ActionEvent(target, ActionEvent.ACTION_PERFORMED, - list.getItem(selectIndex), when, - modifiers)); - } - }); - } // action() - - // NOTE: This method may be called by privileged threads. - // DO NOT INVOKE CLIENT CODE ON THIS THREAD! - public void handleListChanged(int index) { - final MListPeer listPeer = this; - final List list = (List)target; - final int listIndex = index; - - MToolkit.executeOnEventHandlerThread(list, new Runnable() { - public void run() { - int selected[] = listPeer.getSelectedIndexes(); - boolean isSelected = false; - - for (int i=0; i < selected.length; i++) { - if (listIndex == selected[i]) { - isSelected = true; - break; - } - } - postEvent(new ItemEvent(list, ItemEvent.ITEM_STATE_CHANGED, - Integer.valueOf(listIndex), - isSelected? ItemEvent.SELECTED : ItemEvent.DESELECTED)); - - } - }); - } // handleListChanged() - - public Dimension minimumSize() { - return minimumSize(4); - } - - public Dimension preferredSize(int v) { - return minimumSize(v); - } - - public Dimension minimumSize(int v) { - FontMetrics fm = getFontMetrics(((List)target).getFont()); - return new Dimension(SCROLLBAR + 2*MARGIN + - fm.stringWidth("0123456789abcde"), - ((fm.getHeight()+2*SPACE) * v) + - 2*MARGIN); - } - - public boolean isFocusable() { - return true; - } - - /* - * Print the native component by rendering the Motif look ourselves. - * ToDo(aim): needs to query native motif for more accurate size and - * color information, selected items, and item offset. - */ - final static int MARGIN = 2; - final static int SPACE = 1; - final static int SCROLLBAR = 16; - int fontHeight; - int fontAscent; - int fontLeading; - int vval; - int hval; - int vmax; - int hmax; - - public void print(Graphics g) { - List l = (List)target; - Dimension d = l.size(); - Color bg = l.getBackground(); - Color fg = l.getForeground(); - int numItems = l.getItemCount(); - FontMetrics fm = getFontMetrics(l.getFont()); - int w, h; - int vvis, hvis, vmin, hmin; - int max = 0; - - for (int i = 0; i < numItems; i++) { - int len = fm.stringWidth(l.getItem(i)); - max = Math.max(max, len); - } - - fontHeight = fm.getHeight(); - fontAscent = fm.getAscent(); - fontLeading = fm.getLeading(); - - hmin = vmin = 0; - - vvis = itemsInWindow(true); - vmax = Math.max(numItems - vvis, 0); - h = d.height - SCROLLBAR; - - if (vmax != 0) { - w = d.width - SCROLLBAR; - hvis = w - ((2 * SPACE) + (2 * MARGIN)); - hmax = Math.max(max - hvis, 0); - } else { - w = d.width; - hvis = w - ((2 * SPACE) + (2 * MARGIN)); - hmax = Math.max(max - hvis, 0); - } - if (hmax == 0) { - h = d.height; - vvis = itemsInWindow(false); - vmax = Math.max(numItems - vvis, 0); - } - if (vmax == 0) { - w = d.width; - hvis = w - ((2 * SPACE) + (2 * MARGIN)); - hmax = Math.max(max - hvis, 0); - } - - hval = 0; - vval = 0; - /* -System.out.println("print List: "+d.width+"x"+d.height+" numItems="+numItems+ -"max="+max+" vsb=("+vmin+".."+vmax+","+vval+","+vvis+ -") hsb=("+hmin+".."+hmax+","+hval+","+hvis+")"); -*/ - - g.setColor(bg); - g.fillRect(0, 0, w, h); - - if (hmax != 0) { - int sbw = d.width - ((vmax == 0) ? 0 : SCROLLBAR); - g.fillRect(1, d.height - SCROLLBAR - 3, sbw - 1, SCROLLBAR - 3); - Graphics ng = g.create(); - try { - ng.translate(0, d.height - (SCROLLBAR - 2)); - drawScrollbar(ng, bg, SCROLLBAR - 2, sbw, - hmin, hmax, hval, hvis, true); - } finally { - ng.dispose(); - } - } - if (vmax != 0) { - int sbh = d.height - ((hmax == 0) ? 0 : SCROLLBAR); - g.fillRect(d.width - SCROLLBAR - 3, 1, SCROLLBAR - 3, sbh - 1); - Graphics ng = g.create(); - try { - ng.translate(d.width - (SCROLLBAR - 2), 0); - drawScrollbar(ng, bg, SCROLLBAR - 2, sbh, - vmin, vmax, vval, vvis, false); - } finally { - ng.dispose(); - } - } - - draw3DRect(g, bg, 0, 0, w - 1, h - 1, false); - - if (numItems > 0) { - int n = itemsInWindow(hmax != 0); - int e = Math.min(numItems - 1, (vval + n) - 1); - paintItems(g, bg, fg, vval, e); - } - - target.print(g); - } - - int itemsInWindow(boolean scrollbarVisible) { - Dimension d = target.size(); - int h; - if (scrollbarVisible) { - h = d.height - ((2 * MARGIN) + SCROLLBAR); - } else { - h = d.height - 2*MARGIN; - } - int i = fontHeight - fontLeading; - return h / (i + (2 * SPACE)); - } - - void paintItem(Graphics g, Color bg, Color fg, int index, boolean isSelected) { - List l = (List)target; - Dimension d = l.size(); - int numItems = l.getItemCount(); - Color shadow = bg.darker(); - - if ((index < vval) || (index >= (vval + itemsInWindow(hmax != 0)))) { - return; - } - int w = d.width - ((2 * MARGIN) + ((vmax != 0)? SCROLLBAR : 0)); - int h = (fontHeight - fontLeading); - int htotal = h + (2 * SPACE); - int index2y = MARGIN + (index * htotal) + SPACE; - int y = index2y - (vval * htotal); - int x = MARGIN + SPACE; - Graphics ng = g.create(); - try { - if (index > numItems - 1) { - ng.setColor(bg); - ng.fillRect(x - 2, y - 2, w, h + 4); - return; - } - if (isSelected) { - ng.setColor(shadow); - ng.fillRect(x - 1, y - 1, w - 2, h + 2); - } else { - ng.setColor(bg); - ng.fillRect(x - 1, y - 1, w - 2, h + 2); - } - ng.setColor(bg); - - ng.drawRect(x - 2, y - 2, w - 1, h + 3); - ng.setColor(fg); - String str = (String)l.getItem(index); - ng.clipRect(x, y, w - (2 * SPACE), h); - ng.drawString(str, x - hval, y + fontAscent); - } finally { - ng.dispose(); - } - } - - void paintItems(Graphics g, Color bg, Color fg, int s, int e) { - for (int i = s ; i <= e ; i++) { - paintItem(g, bg, fg, i, false); - } - } - - public boolean handlesWheelScrolling() {return true;} - - public void handleEvent(AWTEvent e) { - if (e.getID() == MouseEvent.MOUSE_WHEEL) { - MouseWheelEvent mwe = (MouseWheelEvent)e; - nativeHandleMouseWheel(mwe.getScrollType(), - mwe.getScrollAmount(), - mwe.getWheelRotation()); - } - else { - super.handleEvent(e); - } - } - - native void nativeHandleMouseWheel(int scrollType, - int scrollAmount, - int wheelRotation); -}
--- a/src/solaris/classes/sun/awt/motif/MMenuBarPeer.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,192 +0,0 @@ -/* - * Copyright 1995-2003 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package sun.awt.motif; - -import java.awt.*; -import java.awt.peer.*; -import sun.awt.*; - -public class MMenuBarPeer implements MenuBarPeer { - long pData; - MenuBar target; - private X11GraphicsConfig graphicsConfig=null; - - private boolean disposed = false; - - static { - initIDs(); - } - - /** - * Initialize JNI field and method IDs for fields that may be accessed - from C. - */ - private static native void initIDs(); - - native void create(MFramePeer f); - - public MMenuBarPeer(MenuBar target) { - this.target = target; - MFramePeer parent = (MFramePeer) MToolkit.targetToPeer(MMenuItemPeer.getParent_NoClientCode(target)); - create(parent); - } - - protected void finalize() throws Throwable { - dispose(); - super.finalize(); - } - - /* - * Subclasses should override disposeImpl() instead of dispose(). Client - * code should always invoke dispose(), never disposeImpl(). - */ - private native void pDispose(); - protected void disposeImpl() { - MToolkit.targetDisposedPeer(target, this); - pDispose(); - } - public final void dispose() { - boolean call_disposeImpl = false; - - if (!disposed) { - synchronized (this) { - if (!disposed) { - disposed = call_disposeImpl = true; - } - } - } - - if (call_disposeImpl) { - disposeImpl(); - } - } - public void addMenu(Menu m) { - } - public void delMenu(int index) { - } - public void addHelpMenu(Menu m) { - } - - static final int GAP = 10; - static final int W_DIFF = (MFramePeer.CROSSHAIR_INSET + 1) * 2; - static final int H_DIFF = MFramePeer.BUTTON_Y + MFramePeer.BUTTON_H; - - /* - * Print the native component by rendering the Motif look ourselves. - * ToDo(aim): needs to query native motif for more appropriate size and - * color information. - */ - void print(Graphics g) { - MenuBar mb = (MenuBar)target; - Frame f = (Frame)MMenuItemPeer.getParent_NoClientCode(target); - Dimension fd = f.size(); - Insets insets = f.insets(); - - /* Calculate menubar dimension. */ - int width = fd.width; - int height = insets.top; - if (f.getPeer() instanceof MFramePeer) { - MFramePeer fpeer = (MFramePeer)f.getPeer(); - if (fpeer.hasDecorations(MWindowAttributes.AWT_DECOR_BORDER)) { - width -= W_DIFF; - height -= MFramePeer.BUTTON_Y; - } - if (fpeer.hasDecorations(MWindowAttributes.AWT_DECOR_MENU)) { - height -= MFramePeer.BUTTON_H; - } - } - Dimension d = new Dimension(width, height); - - Shape oldClipArea = g.getClip(); - g.clipRect(0, 0, d.width, d.height); - - Color bg = f.getBackground(); - Color fg = f.getForeground(); - Color highlight = bg.brighter(); - Color shadow = bg.darker(); - - // because we'll most likely be drawing on white paper, - // for aesthetic reasons, don't make any part of the outer border - // pure white - if (highlight.equals(Color.white)) { - g.setColor(new Color(230, 230, 230)); - } - else { - g.setColor(highlight); - } - g.drawLine(0, 0, d.width, 0); - g.drawLine(1, 1, d.width - 1, 1); - g.drawLine(0, 0, 0, d.height); - g.drawLine(1, 1, 1, d.height - 1); - g.setColor(shadow); - g.drawLine(d.width, 1, d.width, d.height); - g.drawLine(d.width - 1, 2, d.width - 1, d.height); - g.drawLine(1, d.height, d.width, d.height); - g.drawLine(2, d.height - 1, d.width, d.height - 1); - - int x = GAP; - int nitems = mb.countMenus(); - - Menu helpMenu = target.getHelpMenu(); - - for (int i = 0 ; i < nitems ; i++) { - Menu mn = target.getMenu(i); - String item = mn.getLabel(); - if (item == null) { - item = ""; - } - Font menuFont = mn.getFont(); - g.setFont(menuFont); - FontMetrics menuMetrics = g.getFontMetrics(); - int y = (d.height / 2) + menuMetrics.getMaxDescent(); - int w = menuMetrics.stringWidth(item) + GAP * 2; - - if (x >= d.width) { - break; - } - if (mn.isEnabled()) { - g.setColor(fg); - } - else { - // draw text as grayed out - g.setColor(shadow); - } - - if (helpMenu == mn) { - g.drawString(item, d.width - w + GAP, y); - } - else { - g.drawString(item, x, y); - x += w; - } - } - - g.setClip(oldClipArea); - } - - // Needed for MenuComponentPeer. - public void setFont(Font f) { - } -}
--- a/src/solaris/classes/sun/awt/motif/MMenuItemPeer.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,190 +0,0 @@ -/* - * Copyright 1995-2003 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package sun.awt.motif; - -import java.awt.*; -import java.awt.peer.*; -import java.awt.event.ActionEvent; -import sun.awt.AppContext; - -class MMenuItemPeer implements MenuItemPeer { - long pData; - long jniGlobalRef; - boolean isCheckbox = false; - MenuItem target; - boolean nativeCreated = false; - - private boolean disposed = false; - - static { - initIDs(); - } - - /** - * Initialize JNI field and method IDs - */ - private static native void initIDs(); - - native void createMenuItem(MMenuPeer parent); - - void create(MMenuPeer parent) { - if (parent.nativeCreated) { - createMenuItem(parent); - nativeCreated = true; - setEnabled(target.isEnabled()); - } - } - - protected MMenuItemPeer() { - } - - MMenuItemPeer(MenuItem target) { - this.target = target; - MMenuPeer parent = (MMenuPeer) MToolkit.targetToPeer(getParent_NoClientCode(target)); - create(parent); - } - - static native MenuContainer getParent_NoClientCode(MenuComponent menuComponent); - - protected void finalize() throws Throwable { - dispose(); - super.finalize(); - } - - public void setEnabled(boolean b) { - if (b) { - enable(); - } else { - disable(); - } - } - - public void setLabel(String label) { - if (!nativeCreated) { - return; - } - pSetLabel(label); - // Fix for bug 4234266 AWT component : MenuItem throw NullPointer exception. - MenuShortcut sc = target.getShortcut(); - setShortcut(sc != null ? sc.toString() : null ); - } - - public void setShortcut(String shortCut) { - if (!nativeCreated) { - return; - } - pSetShortcut(shortCut); - } - - native void pSetLabel(String label); - native void pSetShortcut(String shortCut); - - /** - * DEPRECATED but, for now, called by setEnabled(boolean). - */ - public void enable() { - if (!nativeCreated) { - return; - } - pEnable(); - } - native void pEnable(); - - /** - * DEPRECATED but, for now, called by setEnabled(boolean). - */ - public void disable() { - if (!nativeCreated) { - return; - } - pDisable(); - } - native void pDisable(); - - private void destroyNativeWidgetImpl() { - if (nativeCreated) { - pDispose(); - nativeCreated = false; - } - } - - void destroyNativeWidget() { - // We do not need to synchronize this method because the caller - // always holds the tree lock - - destroyNativeWidgetImpl(); - } - - /* - * Subclasses should override disposeImpl() instead of dispose(). Client - * code should always invoke dispose(), never disposeImpl(). - */ - protected void disposeImpl() { - // Don't call destroyNativeWidget() because on a Menu, this will - // cause a traversal of all the menu's MenuItems. This traversal was - // already done once by java.awt.Menu.removeNotify(). - - destroyNativeWidgetImpl(); - MToolkit.targetDisposedPeer(target, this); - } - public final void dispose() { - boolean call_disposeImpl = false; - - if (!disposed) { - synchronized (this) { - if (!disposed) { - disposed = call_disposeImpl = true; - } - } - } - - if (call_disposeImpl) { - disposeImpl(); - } - } - - native void pDispose(); - - void postEvent(AWTEvent event) { - MToolkit.postEvent(MToolkit.targetToAppContext(target), event); - } - - // NOTE: This method may be called by privileged threads. - // DO NOT INVOKE CLIENT CODE ON THIS THREAD! - public void action(final long when, final int modifiers) { - - MToolkit.executeOnEventHandlerThread(target, new Runnable() { - public void run() { - postEvent(new ActionEvent(target, ActionEvent.ACTION_PERFORMED, - target.getActionCommand(), when, - modifiers)); - } - }); - } - - // Needed for MenuComponentPeer. - public void setFont(Font f) { - } -}
--- a/src/solaris/classes/sun/awt/motif/MMenuPeer.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* - * Copyright 1995-1999 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package sun.awt.motif; - -import java.awt.*; -import java.awt.peer.*; - -public class MMenuPeer extends MMenuItemPeer implements MenuPeer { - native void createMenu(MMenuBarPeer parent); - native void createSubMenu(MMenuPeer parent); - - void create(MMenuPeer parent) { - if (parent.nativeCreated) { - createSubMenu(parent); - nativeCreated = true; - } - } - - protected MMenuPeer() { - } - - public MMenuPeer(Menu target) { - this.target = target; - MenuContainer parent = getParent_NoClientCode(target); - - if (parent instanceof MenuBar) { - MMenuBarPeer mb = (MMenuBarPeer) MToolkit.targetToPeer(parent); - createMenu(mb); - nativeCreated = true; - } else if (parent instanceof Menu) { - MMenuPeer m = (MMenuPeer) MToolkit.targetToPeer(parent); - create(m); - } else { - throw new IllegalArgumentException("unknown menu container class"); - } - } - - public void addSeparator() { - } - public void addItem(MenuItem item) { - } - public void delItem(int index) { - } - - void destroyNativeWidget() { - // We do not need to synchronize this method because the caller - // always holds the tree lock - - if (nativeCreated) { - Menu menu = (Menu) target; - int nitems = menu.getItemCount(); - for (int i = 0 ; i < nitems ; i++) { - MMenuItemPeer mipeer = - (MMenuItemPeer) MToolkit.targetToPeer(menu.getItem(i)); - mipeer.destroyNativeWidget(); - } - super.destroyNativeWidget(); - } - } - native void pDispose(); -}
--- a/src/solaris/classes/sun/awt/motif/MMouseDragGestureRecognizer.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,233 +0,0 @@ -/* - * Copyright 1998-2003 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package sun.awt.motif; - -import java.awt.Toolkit; -import java.awt.Component; - -import java.awt.Point; -import java.awt.dnd.DnDConstants; -import java.awt.dnd.DragSource; -import java.awt.dnd.MouseDragGestureRecognizer; -import java.awt.dnd.DragGestureListener; - -import java.awt.event.InputEvent; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.awt.event.MouseMotionListener; - -import java.lang.reflect.*; - -import sun.awt.dnd.SunDragSourceContextPeer; - -/** - * <p> - * This subclass of MouseDragGestureRecognizer defines a DragGestureRecognizer - * for Mouse based gestures on OSF/Motif. - * </p> - * - * @author Laurence P. G. Cable - * - * @see java.awt.dnd.DragGestureListener - * @see java.awt.dnd.DragGestureEvent - * @see java.awt.dnd.DragSource - */ - -class MMouseDragGestureRecognizer extends MouseDragGestureRecognizer { - - private static final long serialVersionUID = -841711780352520383L; - - /* - * constant for number of pixels hysterisis before drag is determined - * to have started - */ - - protected static int motionThreshold; - - - protected static final int ButtonMask = InputEvent.BUTTON1_DOWN_MASK | - InputEvent.BUTTON2_DOWN_MASK | - InputEvent.BUTTON3_DOWN_MASK; - - /** - * construct a new MMouseDragGestureRecognizer - * - * @param ds The DragSource for the Component c - * @param c The Component to observe - * @param act The actions permitted for this Drag - * @param dgl The DragGestureRecognizer to notify when a gesture is detected - * - */ - - protected MMouseDragGestureRecognizer(DragSource ds, Component c, int act, DragGestureListener dgl) { - super(ds, c, act, dgl); - } - - /** - * construct a new MMouseDragGestureRecognizer - * - * @param ds The DragSource for the Component c - * @param c The Component to observe - * @param act The actions permitted for this Drag - */ - - protected MMouseDragGestureRecognizer(DragSource ds, Component c, int act) { - this(ds, c, act, null); - } - - /** - * construct a new MMouseDragGestureRecognizer - * - * @param ds The DragSource for the Component c - * @param c The Component to observe - */ - - protected MMouseDragGestureRecognizer(DragSource ds, Component c) { - this(ds, c, DnDConstants.ACTION_NONE); - } - - /** - * construct a new MMouseDragGestureRecognizer - * - * @param ds The DragSource for the Component c - */ - - protected MMouseDragGestureRecognizer(DragSource ds) { - this(ds, null); - } - - /** - * determine the drop action from the event - */ - - protected int mapDragOperationFromModifiers(MouseEvent e) { - int mods = e.getModifiersEx(); - int btns = mods & ButtonMask; - - // Do not allow right mouse button drag since Motif DnD does not - // terminate drag operation on right mouse button release. - if (!(btns == InputEvent.BUTTON1_DOWN_MASK || - btns == InputEvent.BUTTON2_DOWN_MASK)) { - return DnDConstants.ACTION_NONE; - } - - return - SunDragSourceContextPeer.convertModifiersToDropAction(mods, - getSourceActions()); - } - - /** - * Invoked when the mouse has been clicked on a component. - */ - - public void mouseClicked(MouseEvent e) { - // do nothing - } - - /** - * Invoked when a mouse button has been pressed on a component. - */ - - public void mousePressed(MouseEvent e) { - events.clear(); - - if (mapDragOperationFromModifiers(e) != DnDConstants.ACTION_NONE) { - try { - motionThreshold = DragSource.getDragThreshold(); - } catch (Exception exc) { - motionThreshold = 5; - } - appendEvent(e); - } - } - - /** - * Invoked when a mouse button has been released on a component. - */ - - public void mouseReleased(MouseEvent e) { - events.clear(); - } - - /** - * Invoked when the mouse enters a component. - */ - - public void mouseEntered(MouseEvent e) { - events.clear(); - } - - /** - * Invoked when the mouse exits a component. - */ - - public void mouseExited(MouseEvent e) { - if (!events.isEmpty()) { // gesture pending - int dragAction = mapDragOperationFromModifiers(e); - - if (dragAction == DnDConstants.ACTION_NONE) { - events.clear(); - } - } - } - - /** - * Invoked when a mouse button is pressed on a component. - */ - - public void mouseDragged(MouseEvent e) { - if (!events.isEmpty()) { // gesture pending - int dop = mapDragOperationFromModifiers(e); - - - if (dop == DnDConstants.ACTION_NONE) { - return; - } - - MouseEvent trigger = (MouseEvent)events.get(0); - - Point origin = trigger.getPoint(); - Point current = e.getPoint(); - - int dx = Math.abs(origin.x - current.x); - int dy = Math.abs(origin.y - current.y); - - if (dx > motionThreshold || dy > motionThreshold) { - fireDragGestureRecognized(dop, ((MouseEvent)getTriggerEvent()).getPoint()); - } else - appendEvent(e); - } - } - - /** - * Invoked when the mouse button has been moved on a component - * (with no buttons no down). - */ - - public void mouseMoved(MouseEvent e) { - // do nothing - } -}
--- a/src/solaris/classes/sun/awt/motif/MPanelPeer.java Wed Sep 17 13:45:37 2008 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,201 +0,0 @@ -/* - * Copyright 1995-2003 Sun Microsystems, Inc. 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. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package sun.awt.motif; - -import java.awt.*; -import java.awt.peer.*; - -import sun.awt.SunGraphicsCallback; - -class MPanelPeer extends MCanvasPeer implements PanelPeer { - - MPanelPeer() {} - - MPanelPeer(Component target) { - super(target); - } - - MPanelPeer(Component target, Object arg) { - super(target, arg); - } - - public Insets getInsets() { - return new Insets(0, 0, 0, 0); - } - - public void paint(Graphics g) { - super.paint(g); - SunGraphicsCallback.PaintHeavyweightComponentsCallback.getInstance(). - runComponents(((Container)target).getComponents(), g, - SunGraphicsCallback.LIGHTWEIGHTS | - SunGraphicsCallback.HEAVYWEIGHTS); - } - public void print(Graphics g) { - super.print(g); - SunGraphicsCallback.PrintHeavyweightComponentsCallback.getInstance(). - runComponents(((Container)target).getComponents(), g, - SunGraphicsCallback.LIGHTWEIGHTS | - SunGraphicsCallback.HEAVYWEIGHTS); - } - - public void setBackground(Color c) { - Component comp; - int i; - - Container cont = (Container) target; - synchronized(target.getTreeLock()) { - int n = cont.getComponentCount(); - for(i=0; i < n; i++) { - comp = cont.getComponent(i); - MComponentPeer peer = (MComponentPeer) MToolkit.targetToPeer(comp); - if (peer != null) { - Color color = comp.getBackground(); - if (color == null || color.equals(c)) { - peer.setBackground(c); - peer.pSetBackground(c); - } - if ((comp instanceof java.awt.List) || - (comp instanceof java.awt.TextArea) || - (comp instanceof java.awt.ScrollPane)) { - peer.pSetScrollbarBackground(c); - } - } - } - } - pSetBackground(c); - } - - public void setForeground(Color c) { - Component comp; - int i; - - Container cont = (Container) target; - synchronized(target.getTreeLock()) { - int n = cont.getComponentCount(); - for(i=0; i < n; i++) { - comp = cont.getComponent(i); - MComponentPeer peer = (MComponentPeer) MToolkit.targetToPeer(comp); - if (peer != null) { - Color color = comp.getForeground(); - if (color == null || color.equals(c)) { - peer.setForeground(c); - peer.pSetForeground(c); - } - if ((comp instanceof java.awt.List) || - (comp instanceof java.awt.TextArea) || - (comp instanceof java.awt.ScrollPane)) { - peer.pSetInnerForeground(c); - } - } - } - } - pSetForeground(c); - } - - /** - * DEPRECATED: Replaced by getInsets(). - */ - public Insets insets() { - return getInsets(); - } - - /** - * Recursive method that handles the propagation of the displayChanged - * event into the entire hierarchy of peers. - * Unlike on win32, on X we don't worry about handling on-the-fly - * display settings changes, only windows being dragged across Xinerama - * screens. Thus, we only need to tell MCanvasPeers, not all - * MComponentPeers. - */ - private void recursiveDisplayChanged(Component c, int screenNum) { - if (c instanceof Container) { - Component children[] = ((Container)c).getComponents(); - for (int i = 0; i < children.length; ++i) { - recursiveDisplayChanged(children[i], screenNum); - } - } - ComponentPeer peer = c.getPeer(); - if (peer != null && peer instanceof MCanvasPeer) { - MCanvasPeer mPeer = (MCanvasPeer)peer; - mPeer.displayChanged(screenNum); - } - } - - /*