[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: awt and swing fixes

Kaffe CVS cvs-commits at kaffe.org
Sat Jun 11 14:04:14 PDT 2005


PatchSet 6629 
Date: 2005/06/11 20:59:45
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: awt and swing fixes

Members: 
	ChangeLog:1.4155->1.4156 
	libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphics.java:1.13->1.14 
	libraries/javalib/javax/swing/ActionMap.java:1.5->1.6 
	libraries/javalib/javax/swing/JTextArea.java:1.10->1.11 
	libraries/javalib/javax/swing/SwingUtilities.java:1.15->1.16 
	libraries/javalib/javax/swing/plaf/basic/BasicListUI.java:1.10->1.11 
	libraries/javalib/javax/swing/plaf/basic/BasicTableUI.java:1.5->1.6 
	libraries/javalib/javax/swing/plaf/basic/BasicTextUI.java:1.12->1.13 
	libraries/javalib/javax/swing/text/PlainDocument.java:1.9->1.10 
	libraries/javalib/javax/swing/text/PlainView.java:1.7->1.8 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4155 kaffe/ChangeLog:1.4156
--- kaffe/ChangeLog:1.4155	Sat Jun 11 20:53:08 2005
+++ kaffe/ChangeLog	Sat Jun 11 20:59:45 2005
@@ -2,6 +2,55 @@
 
 	Resynced with GNU Classpath.
 	
+	2005-06-03  Roman Kennke  <roman at kennke.org>
+
+	* javax/swing/plaf/basic/BasicListUI.java
+	(damageLayout): Check for list beeing null before revalidating
+	it.
+
+	2005-06-03  Roman Kennke  <roman at kennke.org>
+
+	* javax/swing/text/PlainDocument.java
+	(removeUpdate): Fixed indices in text buffer access.
+	* javax/swing/text/PlainView.java
+	(drawLine): Simplified element access.
+
+	2005-06-03  Roman Kennke  <roman at kennke.org>
+
+	* javax/swing/JTextArea.java
+	(constructor): Set preferredSize to a sane default.
+	
+	2005-06-03  Roman Kennke  <roman at kennke.org>
+
+	* javax/swing/SwingUtilites.java
+	(replaceUIActionMap): Fixed loop again. Now correctly, I hope.
+	* javax/swing/ActionMap.java
+	(setParent): Make sure we don't build a loop.
+	* javax/swing/plaf/basic/BasicTextUI.java
+	(createActionMap): Create ActionMapUIResource instead of
+	plain ActionMap.
+
+	2005-06-03  Sven de Marothy  <sven at physto.se>
+
+	* gnu/java/awt/peer/gtk/GdkGraphics.java:
+	Removed declarations for the previously removed native methods.
+
+	2005-06-03  Roman Kennke  <roman at kennke.org>
+
+	* javax/swing/SwingUtilites.java
+	(replaceUIActionMap): Fixed condition in while loop that caused
+	infinite looping.
+
+	2005-06-03  Roman Kennke  <roman at kennke.org>
+
+	* javax/swing/plaf/basic/BasicTableUI.java
+	(uninstallDefault): Don't set properties to null, this corrupts
+	component state.
+	
+2005-06-11  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
+	
 	2005-06-02  Sven de Marothy  <sven at physto.se>
 
 	* java/awt/Component.java
Index: kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphics.java
diff -u kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphics.java:1.13 kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphics.java:1.14
--- kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphics.java:1.13	Sat Jun 11 20:23:07 2005
+++ kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphics.java	Sat Jun 11 20:59:48 2005
@@ -142,13 +142,6 @@
 
   public native void dispose();
 
-  native void copyPixmap (Graphics g, int x, int y, int width, int height);
-  native void copyAndScalePixmap (Graphics g, boolean flip_x, boolean flip_y,
-                                  int src_x, int src_y, 
-                                  int src_width, int src_height, 
-                                  int dest_x, int dest_y, 
-                                  int dest_width, int dest_height);
-
   public boolean drawImage (Image img, int x, int y, 
 			    Color bgcolor, ImageObserver observer)
   {
Index: kaffe/libraries/javalib/javax/swing/ActionMap.java
diff -u kaffe/libraries/javalib/javax/swing/ActionMap.java:1.5 kaffe/libraries/javalib/javax/swing/ActionMap.java:1.6
--- kaffe/libraries/javalib/javax/swing/ActionMap.java:1.5	Sun Oct 24 13:39:10 2004
+++ kaffe/libraries/javalib/javax/swing/ActionMap.java	Sat Jun 11 20:59:48 2005
@@ -133,7 +133,8 @@
    */
   public void setParent(ActionMap parentMap)
   {
-    parent = parentMap;
+    if (parentMap != this)
+      parent = parentMap;
   }
 
   /**
Index: kaffe/libraries/javalib/javax/swing/JTextArea.java
diff -u kaffe/libraries/javalib/javax/swing/JTextArea.java:1.10 kaffe/libraries/javalib/javax/swing/JTextArea.java:1.11
--- kaffe/libraries/javalib/javax/swing/JTextArea.java:1.10	Thu May 26 11:10:40 2005
+++ kaffe/libraries/javalib/javax/swing/JTextArea.java	Sat Jun 11 20:59:48 2005
@@ -188,6 +188,7 @@
     setText(text);
     setRows(rows);
     setColumns(columns);
+    setPreferredSize(new Dimension(440, 150));
   }
 
   /**
Index: kaffe/libraries/javalib/javax/swing/SwingUtilities.java
diff -u kaffe/libraries/javalib/javax/swing/SwingUtilities.java:1.15 kaffe/libraries/javalib/javax/swing/SwingUtilities.java:1.16
--- kaffe/libraries/javalib/javax/swing/SwingUtilities.java:1.15	Fri Jun 10 19:40:48 2005
+++ kaffe/libraries/javalib/javax/swing/SwingUtilities.java	Sat Jun 11 20:59:48 2005
@@ -1128,9 +1128,13 @@
       component.setActionMap(uiActionMap);
     else
       {
-        while(child.getParent() != null
-              && !(child.getParent() instanceof ActionMapUIResource))
-          child = child.getParent();
+        ActionMap parent = child.getParent();
+        while(parent != null)
+          {
+            child = parent;
+            parent = child.getParent();
+          }
+
         if (child != null)
           child.setParent(uiActionMap);
       }
Index: kaffe/libraries/javalib/javax/swing/plaf/basic/BasicListUI.java
diff -u kaffe/libraries/javalib/javax/swing/plaf/basic/BasicListUI.java:1.10 kaffe/libraries/javalib/javax/swing/plaf/basic/BasicListUI.java:1.11
--- kaffe/libraries/javalib/javax/swing/plaf/basic/BasicListUI.java:1.10	Sun May 15 09:46:22 2005
+++ kaffe/libraries/javalib/javax/swing/plaf/basic/BasicListUI.java	Sat Jun 11 20:59:50 2005
@@ -498,7 +498,8 @@
   void damageLayout()
   {
     updateLayoutStateNeeded = 1;
-    list.revalidate();
+    if (list != null)
+      list.revalidate();
   }
 
   /**
Index: kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTableUI.java
diff -u kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTableUI.java:1.5 kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTableUI.java:1.6
--- kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTableUI.java:1.5	Sat Jan  8 21:26:25 2005
+++ kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTableUI.java	Sat Jun 11 20:59:50 2005
@@ -209,12 +209,22 @@
 
   protected void uninstallDefaults() 
   {
-    table.setFont(null);
-    table.setGridColor(null);
-    table.setForeground(null);
-    table.setBackground(null);
-    table.setSelectionForeground(null);
-    table.setSelectionBackground(null);
+    // TODO: this method used to do the following which is not
+    // quite right (at least it breaks apps that run fine with the
+    // JDK):
+    //
+    // table.setFont(null);
+    // table.setGridColor(null);
+    // table.setForeground(null);
+    // table.setBackground(null);
+    // table.setSelectionForeground(null);
+    // table.setSelectionBackground(null);
+    //
+    // This would leave the component in a corrupt state, which is
+    // not acceptable. A possible solution would be to have component
+    // level defaults installed, that get overridden by the UI defaults
+    // and get restored in this method. I am not quite sure about this
+    // though. / Roman Kennke
   }
 
   protected void uninstallKeyboardActions() 
Index: kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextUI.java
diff -u kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextUI.java:1.12 kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextUI.java:1.13
--- kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextUI.java:1.12	Thu May 26 11:10:44 2005
+++ kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextUI.java	Sat Jun 11 20:59:50 2005
@@ -59,6 +59,7 @@
 import javax.swing.UIManager;
 import javax.swing.event.DocumentEvent;
 import javax.swing.event.DocumentListener;
+import javax.swing.plaf.ActionMapUIResource;
 import javax.swing.plaf.TextUI;
 import javax.swing.plaf.UIResource;
 import javax.swing.text.BadLocationException;
@@ -416,7 +417,7 @@
   ActionMap createActionMap()
   {
     Action[] actions = textComponent.getActions();
-    ActionMap am = new ActionMap();
+    ActionMap am = new ActionMapUIResource();
     for (int i = 0; i < actions.length; ++i)
       {
         String name = (String) actions[i].getValue(Action.NAME);
Index: kaffe/libraries/javalib/javax/swing/text/PlainDocument.java
diff -u kaffe/libraries/javalib/javax/swing/text/PlainDocument.java:1.9 kaffe/libraries/javalib/javax/swing/text/PlainDocument.java:1.10
--- kaffe/libraries/javalib/javax/swing/text/PlainDocument.java:1.9	Sat Jun 11 19:11:38 2005
+++ kaffe/libraries/javalib/javax/swing/text/PlainDocument.java	Sat Jun 11 20:59:51 2005
@@ -117,8 +117,8 @@
     super.removeUpdate(event);
 
     int p0 = event.getOffset();
-    int p1 = event.getLength() + p0;
     int len = event.getLength();
+    int p1 = len + p0;
 
     // check if we must collapse some elements
     int i1 = rootElement.getElementIndex(p0);
@@ -133,7 +133,7 @@
         Element newEl = createLeafElement(rootElement,
                                           SimpleAttributeSet.EMPTY,
                                           start, end - len);
-        rootElement.replace(i1, i1 - i1, new Element[]{ newEl });
+        rootElement.replace(i1, i2 - i1, new Element[]{ newEl });
       }
     else
       {
Index: kaffe/libraries/javalib/javax/swing/text/PlainView.java
diff -u kaffe/libraries/javalib/javax/swing/text/PlainView.java:1.7 kaffe/libraries/javalib/javax/swing/text/PlainView.java:1.8
--- kaffe/libraries/javalib/javax/swing/text/PlainView.java:1.7	Sun May 15 17:30:12 2005
+++ kaffe/libraries/javalib/javax/swing/text/PlainView.java	Sat Jun 11 20:59:51 2005
@@ -123,7 +123,7 @@
       {
 	metrics = g.getFontMetrics();
 	// FIXME: Selected text are not drawn yet.
-	Element line = getDocument().getDefaultRootElement().getElement(lineIndex);
+	Element line = getElement().getElement(lineIndex);
 	drawUnselectedText(g, x, y, line.getStartOffset(), line.getEndOffset());
 	//drawSelectedText(g, , , , );
       }




More information about the kaffe mailing list