classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] [patch] get jedit to the point of displaying main windows


From: graydon hoare
Subject: [cp-patches] [patch] get jedit to the point of displaying main windows
Date: Sat, 22 Jan 2005 05:18:56 -0500
User-agent: Mozilla Thunderbird 1.0 (X11/20041206)

hi,

this patch is one I feel a bit guilty about supplying because it really ought to be michael koch posting this; but anyways if you apply it to classpath CVS you should find that a suitably configured (cairo-using) build responds positively to this invocation:

 jamvm -Dgnu.java.awt.peer.gtk.Graphics=Graphics2D -jar jedit.jar

with a "working" (read: not-immediately crashing) jedit such as this:

 http://people.redhat.com/graydon/free-swing-jedit-jan-22-2005.png

congratulations all around, especially to michael and the other swing hackers; this is almost entirely not my work, but I got so encouraged by watching the splash screen start up this week that I felt compelled to "finish it off". this is a *huge* swing application (140 kloc) which will serve as a fantastic testcase for further work.

I have not committed this to gcj or classpath. as far as I know it does not even work fully on gcj yet. you may wish to alter it before committing, or omit some parts if you feel they are tasteless; some of the decisions made were probably optimistic or wrong. I just wanted to see how far I could get.

-graydon

2005-01-22  Graydon Hoare  <address@hidden>

        * gnu/java/awt/peer/gtk/GdkFontPeer.java
        (canDisplay): Implement optimistically.
        (canDisplayUpTo): Likewise.
        (getStringBounds): Implement.
        * gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java: New class.
        * gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java:
        Store toolkit reference
        (getScreenDevices): Return a single device.
        (getDefaultScreenDevice): Pass reference to this to device.
        * gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java:
        Store environment reference.
        (getConfigurations): Return a single config.
        (getDefaultConfiguration): Pass reference to this to config.
        * gnu/java/awt/peer/gtk/GtkToolkit.java
        (getBounds): New helper method.
        (getLocalGraphicsEnvironment): Pass reference to this to env.
        * java/awt/dnd/DropTarget.java
        (addDropTargetListener): Despite documentation, do not throw.
        * javax/swing/JComponent.java: Set a default DropTarget.
        * javax/swing/LayoutFocusTraversalPolicy.java: New class.
        * javax/swing/SortingFocusTraversalPolicy.java: New class.
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c:
        Make measurements tolerant of null vectors.
--- gnu/java/awt/peer/gtk/GdkFontPeer.java      16 Nov 2004 07:44:44 -0000      
1.3
+++ gnu/java/awt/peer/gtk/GdkFontPeer.java      22 Jan 2005 09:57:48 -0000
@@ -158,14 +158,16 @@
 
   public boolean canDisplay (Font font, char c)
   {
-    throw new UnsupportedOperationException ();
+    // FIXME: inquire with pango
+    return true;
   }
 
   public int canDisplayUpTo (Font font, CharacterIterator i, int start, int 
limit)
   {
-    throw new UnsupportedOperationException ();
+    // FIXME: inquire with pango
+    return -1;
   }
-
+  
   public GlyphVector createGlyphVector (Font font, 
                                         FontRenderContext ctx, 
                                         CharacterIterator i)
@@ -259,7 +261,8 @@
   public Rectangle2D getStringBounds (Font font, CharacterIterator ci, 
                                       int begin, int limit, FontRenderContext 
frc)
   {
-    throw new UnsupportedOperationException ();
+    GdkGlyphVector gv = new GdkGlyphVector(font, this, frc, buildString (ci, 
begin, limit));
+    return gv.getVisualBounds();
   }
 
   public boolean hasUniformLineMetrics (Font font)
--- gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java 1 Jan 1970 00:00:00 
-0000
+++ gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java 22 Jan 2005 09:57:48 
-0000
@@ -0,0 +1,138 @@
+/* GdkGraphicsConfiguration.java -- describes characteristics of graphics
+   Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.java.awt.peer.gtk;
+
+import java.awt.BufferCapabilities;
+import java.awt.ImageCapabilities;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.Rectangle;
+
+import java.awt.geom.AffineTransform;
+
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.VolatileImage;
+
+public class GdkGraphicsConfiguration 
+  extends GraphicsConfiguration
+{
+  GdkScreenGraphicsDevice gdkScreenGraphicsDevice;
+  ColorModel cm;
+  Rectangle bounds;
+
+  public GtkToolkit getToolkit()
+  {
+    return gdkScreenGraphicsDevice.getToolkit();
+  }
+
+  public GdkGraphicsConfiguration(GdkScreenGraphicsDevice dev)
+  {
+    this.gdkScreenGraphicsDevice = dev;
+    cm = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB).getColorModel();
+    bounds = getToolkit().getBounds();
+  }
+
+  public GraphicsDevice getDevice()
+  {
+    return gdkScreenGraphicsDevice;
+  }
+
+  public BufferedImage createCompatibleImage(int w, int h)
+  {
+    return new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
+  }
+
+  public BufferedImage createCompatibleImage(int w, int h, 
+                                             int transparency)
+  {
+    return createCompatibleImage(w, h);
+  }
+
+  public VolatileImage createCompatibleVolatileImage(int w, int h)
+  {
+    throw new java.lang.UnsupportedOperationException ();
+  }
+
+  public VolatileImage createCompatibleVolatileImage(int w, int h,
+                                                     ImageCapabilities caps)
+    throws java.awt.AWTException
+  {
+    throw new java.lang.UnsupportedOperationException ();
+  }
+
+  public ColorModel getColorModel()
+  {
+    return cm;
+  }
+
+  public ColorModel getColorModel(int transparency)
+  {
+    return getColorModel();
+  }
+
+  public AffineTransform getDefaultTransform()
+  {
+    // FIXME: extract the GDK DPI information here.
+    return new AffineTransform();
+  }
+
+  public AffineTransform getNormalizingTransform()
+  {
+    // FIXME: extract the GDK DPI information here.
+    return new AffineTransform();
+  }
+
+  public Rectangle getBounds()
+  {
+    return bounds;
+  }
+
+  public BufferCapabilities getBufferCapabilities()
+  {
+    return new BufferCapabilities(getImageCapabilities(), 
+                                  getImageCapabilities(),
+                                  BufferCapabilities.FlipContents.UNDEFINED);
+  }
+
+  public ImageCapabilities getImageCapabilities()
+  {
+    return new ImageCapabilities(false);
+  }
+
+}
--- gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java   3 Jan 2005 12:20:54 
-0000       1.5
+++ gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java   22 Jan 2005 09:57:48 
-0000
@@ -50,14 +50,23 @@
 
 public class GdkGraphicsEnvironment extends GraphicsEnvironment
 {
-  public GdkGraphicsEnvironment ()
+  GtkToolkit gtkToolkit;
+
+  public GtkToolkit getToolkit()
+  {
+    return gtkToolkit;
+  }
+
+  public GdkGraphicsEnvironment (GtkToolkit tk)
   {
     super();
+    gtkToolkit = tk;
   }
 
   public GraphicsDevice[] getScreenDevices ()
   {
-    throw new java.lang.UnsupportedOperationException ();
+    // FIXME: Support multiple screens, since GDK can.
+    return new GraphicsDevice[] { new GdkScreenGraphicsDevice (this) };
   }
 
   public GraphicsDevice getDefaultScreenDevice ()
@@ -65,7 +74,7 @@
     if (GraphicsEnvironment.isHeadless ())
       throw new HeadlessException ();
 
-    return new GdkScreenGraphicsDevice ();
+    return new GdkScreenGraphicsDevice (this);
   }
 
   public Graphics2D createGraphics (BufferedImage image)
--- gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java  3 Jan 2005 12:20:54 
-0000       1.1
+++ gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java  22 Jan 2005 09:57:48 
-0000
@@ -43,9 +43,17 @@
 
 public class GdkScreenGraphicsDevice extends GraphicsDevice
 {
-  public GdkScreenGraphicsDevice ()
+  GdkGraphicsEnvironment env;
+
+  public GtkToolkit getToolkit()
   {
+    return env.getToolkit();
+  }
+
+  public GdkScreenGraphicsDevice (GdkGraphicsEnvironment e)
+  {    
     super ();
+    env = e;
   }
 
   public int getType ()
@@ -62,12 +70,13 @@
   public GraphicsConfiguration[] getConfigurations ()
   {
     // FIXME: query X for the list of possible configurations
-    return null;
+    return new GraphicsConfiguration [] { new GdkGraphicsConfiguration(this) };
   }
 
   public GraphicsConfiguration getDefaultConfiguration ()
   {
+    
     // FIXME: query X for default configuration
-    return null;
+    return new GdkGraphicsConfiguration(this);
   }
 }
--- gnu/java/awt/peer/gtk/GtkToolkit.java       18 Jan 2005 09:43:45 -0000      
1.64
+++ gnu/java/awt/peer/gtk/GtkToolkit.java       22 Jan 2005 09:57:48 -0000
@@ -632,11 +632,18 @@
     throw new Error("not implemented");
   }
 
+  public Rectangle getBounds()
+  {
+    int[] dims = new int[2];
+    getScreenSizeDimensions(dims);
+    return new Rectangle(0, 0, dims[0], dims[1]);
+  }
+  
   // ClasspathToolkit methods
 
   public GraphicsEnvironment getLocalGraphicsEnvironment()
   {
-    return new GdkGraphicsEnvironment();
+    return new GdkGraphicsEnvironment(this);
   }
 
   public Font createFont(int format, InputStream stream)
--- java/awt/dnd/DropTarget.java        27 Sep 2004 15:11:46 -0000      1.8
+++ java/awt/dnd/DropTarget.java        22 Jan 2005 09:57:48 -0000
@@ -211,9 +211,10 @@
   public void addDropTargetListener (DropTargetListener dtl)
     throws TooManyListenersException
   {
-    if (dtl != null)
-      throw new TooManyListenersException ();
-    
+    // Sun's JDK does not, despite documentation, throw any sort of
+    // exception here when you install an additional DropTargetListener.
+    // So to be compatible, we do the same thing.
+
     dropTargetListener = dtl;
   }
 
--- javax/swing/JComponent.java 31 Dec 2004 16:30:08 -0000      1.31
+++ javax/swing/JComponent.java 22 Jan 2005 09:57:48 -0000
@@ -50,6 +50,7 @@
 import java.awt.Insets;
 import java.awt.Point;
 import java.awt.Rectangle;
+import java.awt.dnd.DropTarget;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.ContainerEvent;
@@ -395,6 +396,7 @@
   {
     super();
     super.setLayout(new FlowLayout());
+    setDropTarget(new DropTarget());
     defaultLocale = Locale.getDefault();
     debugGraphicsOptions = DebugGraphics.NONE_OPTION;
   }
--- javax/swing/LayoutFocusTraversalPolicy.java 1 Jan 1970 00:00:00 -0000
+++ javax/swing/LayoutFocusTraversalPolicy.java 22 Jan 2005 09:57:48 -0000
@@ -0,0 +1,55 @@
+/* LayoutFocusTraversalPolicy.java --
+   Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.awt.Component;
+import java.awt.FocusTraversalPolicy;
+
+/**
+ * @author Graydon Hoare
+ * 
+ * @since 1.4
+ */
+public abstract class LayoutFocusTraversalPolicy 
+  extends SortingFocusTraversalPolicy
+{
+  // FIXME: implement this in some clever fashion. I do not really
+  // understand the algorithm described in the javadocs. Will probably
+  // require some experiments with the implementation.
+}
--- javax/swing/SortingFocusTraversalPolicy.java        1 Jan 1970 00:00:00 
-0000
+++ javax/swing/SortingFocusTraversalPolicy.java        22 Jan 2005 09:57:48 
-0000
@@ -0,0 +1,314 @@
+/* SortingFocusTraversalPolicy.java --
+   Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.FocusTraversalPolicy;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.TreeSet;
+
+/**
+ * @author Graydon Hoare
+ * 
+ * @since 1.4
+ */
+public abstract class SortingFocusTraversalPolicy 
+  extends InternalFrameFocusTraversalPolicy
+{
+  /**
+   * The comparator used to sort elements in the focus traversal cycle
+   * managed by this class.
+   */
+  Comparator comparator;
+
+  /**
+   * <p>Whether or not to perform an "implicit DownCycle" when selecting
+   * successor components within a focus cycle.</p>
+   *
+   * <p>When this is true, requesting the "next" component following a
+   * component which is a focus cycle root (and, necessarily, a container)
+   * will enter the focus cycle root of that container, and return its
+   * default focus.</p>
+   *
+   * <p>When this property is false, requesting the "next" component will
+   * simply advance within the containing focus cycle, subject to the
+   * address@hidden #comparator} order and the address@hidden #accept} 
judgment.</p>
+   *
+   * @see #getNextFocusableComponent
+   */
+
+  boolean implicitDownCycleTraversal = true;
+
+  /**
+   * Decide whether a component is an acceptable focus owner. 
+   *
+   * @param comp The component which is a candidate for focus ownership.
+   *
+   * @return true iff the component is focusable, displayable, visible, and
+   * enabled; otherwise false
+   */
+  protected boolean accept (Component comp)
+  {
+    return comp.isFocusable()
+      && comp.isDisplayable()
+      && comp.isVisible()
+      && comp.isEnabled();
+  }
+
+  /**
+   * Get the current value of the address@hidden #comparator} property.
+   *
+   * @return the current value of the property
+   * 
+   * @see #setComparator
+   */
+  protected Comparator getComparator()
+  {
+    return comparator;
+  }
+
+  /**
+   * Set the current value of the address@hidden #comparator} property.
+   *
+   * @param comp the new value of the property
+   * 
+   * @see #getComparator
+   */
+  protected void setComparator(Comparator comp)
+  {
+    comparator = comp;
+  }
+
+  private TreeSet getSortedCycle(Container root, TreeSet set)
+  {
+    if (set == null)
+      set = (getComparator() == null 
+             ? new TreeSet(getComparator())  
+             : new TreeSet());
+    
+    if (root != null) 
+      {
+        Component[] comps = root.getComponents();
+        for (int i = 0; i < comps.length; ++i)
+          {
+            Component c = comps[i];
+            if (accept(c))
+              set.add(c);
+            if (c instanceof Container)
+              getSortedCycle( (Container) c, set);
+          }
+      }
+    return set;
+  }
+
+  /**
+   * Return the component which follows the specified component in this
+   * focus cycle, relative to the order imposed by address@hidden
+   * #comparator}. Candidate components are only considered if they are
+   * accepted by the address@hidden #accept} method.
+   *
+   * If address@hidden #getImplicitDownCycleTraversal} is <code>true</code> 
and the
+   * <code>comp</code> is a focus cycle root, an "implicit DownCycle"
+   * occurs and the method returns the
+   * <code>getDefaultComponent(comp)</code>.
+   * 
+   * @param root the focus cycle root to search for a successor within
+   * @param comp the component to search for the successor of
+   * 
+   * @throws IllegalArgumentException if either argument is null, or
+   * if the root is not a focus cycle root of the component
+   *
+   * @return the component following the specified component under
+   * the specified root, or null if no such component is found
+   */
+  public Component getComponentAfter(Container root, 
+                                     Component comp)
+  {
+    if (comp == null || root == null || !comp.isFocusCycleRoot(root))
+      throw new IllegalArgumentException();
+
+    if (getImplicitDownCycleTraversal() 
+        && comp instanceof Container
+        && ((Container)comp).isFocusCycleRoot())
+      {
+        return getDefaultComponent((Container)comp);
+      }
+
+    TreeSet set = getSortedCycle(root, null);
+    Iterator i = set.iterator();
+    while (i.hasNext())
+      {
+        Component c = (Component) i.next();
+        if (c != null && c.equals(comp))
+          {
+            if (i.hasNext())
+              return (Component) i.next();
+            else
+              break;
+          }
+      }
+    return null;
+  }
+
+
+  /**
+   * Return the component which precedes the specified component in this
+   * focus cycle, relative to the order imposed by address@hidden
+   * #comparator}. Candidate components are only considered if they are
+   * accepted by the address@hidden #accept} method.
+   * 
+   * @param root the focus cycle root to search for a predecessor within
+   * @param comp the component to search for the predecessor of
+   * 
+   * @throws IllegalArgumentException if either argument is null, or
+   * if the root is not a focus cycle root of the component
+   *
+   * @return the component preceding the specified component under the
+   * specified root, or null if no such component is found
+   */
+  public Component getComponentBefore(Container root, 
+                                      Component comp)
+  {
+    if (comp == null || root == null || !comp.isFocusCycleRoot(root))
+      throw new IllegalArgumentException();
+    TreeSet set = getSortedCycle(root, null);
+    Iterator i = set.iterator();
+    Component prev = null;
+    while (i.hasNext())
+      {
+        Component c = (Component) i.next();
+        if (c != null && c.equals(comp))
+          break;
+        prev = c;
+      }
+    return prev;
+  }
+
+  
+  /**
+   * Return the default component of <code>root</code>, which is by default
+   * the same as the first component, returned by address@hidden
+   * #getFirstComponent}.
+   *
+   * @param root the focus cycle root to return the default component of
+   *
+   * @throws IllegalArgumentException if root is null
+   * @return the default focus component for <code>root</code>
+   */
+  public Component getDefaultComponent(Container root)
+  {
+    return getFirstComponent(root);
+  }
+
+
+  /** 
+   * Return the first focusable component of the focus cycle root
+   * <code>comp</code> under the ordering imposed by the address@hidden
+   * #comparator} property. Candidate components are only considered if
+   * they are accepted by the address@hidden #accept} method.
+   *
+   * @param root the focus cycle root to search for the first component of
+   *
+   * @throws IllegalArgumentException if root is null
+   * @return the first component under <code>root</code>, or null if
+   * no components are found.
+   */
+  public Component getFirstComponent(Container root)
+  {
+    if (root == null)
+      throw new IllegalArgumentException();
+    TreeSet set = getSortedCycle(root, null);
+    Iterator i = set.iterator();
+    if (i.hasNext())
+      return (Component) i.next();
+    else
+      return null;
+  }
+
+  /** 
+   * Return the last focusable component of the focus cycle root
+   * <code>comp</code> under the ordering imposed by the address@hidden
+   * #comparator} property. Candidate components are only considered if
+   * they are accepted by the address@hidden #accept} method.
+   *
+   * @param root the focus cycle root to search for the last component of
+   *
+   * @throws IllegalArgumentException if root is null
+   * @return the last component under <code>root</code>, or null if
+   * no components are found.
+   */
+  public Component getLastComponent(Container root)
+  {
+    if (root == null)
+      throw new IllegalArgumentException();
+    TreeSet set = getSortedCycle(root, null);
+    Iterator i = set.iterator();
+    Component last = null;
+    while (i.hasNext())
+      last = (Component) i.next();
+    return last;
+  }
+
+
+  /**
+   * Return the current value of the address@hidden implicitDownCycleTraversal}
+   * property.
+   *
+   * @return the current value of the property
+   * @see setImplicitDownCycleTraversal
+   */
+  public boolean getImplicitDownCycleTraversal()
+  {
+    return implicitDownCycleTraversal;
+  }
+
+  /**
+   * Set the current value of the address@hidden implicitDownCycleTraversal}
+   * property.
+   *
+   * @param down the new value of the property
+   * @see getImplicitDownCycleTraversal
+   */
+  public void setImplicitDownCycleTraversal(boolean down)
+  {
+    implicitDownCycleTraversal = down;
+  }
+}
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c  19 Jan 2005 
08:10:27 -0000      1.10
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c  22 Jan 2005 
09:57:48 -0000
@@ -510,39 +510,40 @@
   gdk_threads_enter ();
   g_assert (self != NULL);
   vec = (struct glyphvec *)NSA_GET_GV_PTR (env, self);
-  g_assert (vec != NULL);
-  g_assert (vec->glyphitems != NULL);
-
-  pointsize = pango_font_description_get_size (vec->desc);
-  pointsize /= (double) PANGO_SCALE;
-
-  for (i = g_list_first (vec->glyphitems); i != NULL; i = g_list_next (i))
+  g_assert (vec != NULL);  
+  if (vec->glyphitems != NULL)
     {
-      g_assert (i->data != NULL);
-      gi = (PangoGlyphItem *)i->data;
-      g_assert (gi->glyphs != NULL);
+      pointsize = pango_font_description_get_size (vec->desc);
+      pointsize /= (double) PANGO_SCALE;
 
-      face = pango_ft2_font_get_face (gi->item->analysis.font);
-      assume_pointsize_and_identity_transform (pointsize, face);
-      
-      for (j = 0; j < gi->glyphs->num_glyphs; ++j)
+      for (i = g_list_first (vec->glyphitems); i != NULL; i = g_list_next (i))
        {
-         FT_Load_Glyph (face, gi->glyphs->glyphs[j].glyph, FT_LOAD_DEFAULT);
+         g_assert (i->data != NULL);
+         gi = (PangoGlyphItem *)i->data;
+         g_assert (gi->glyphs != NULL);
 
-         /* FIXME: also, this is probably not the correct set of metrics;
-            the "logical bounds" are some fancy combination of hori
-            advance and height such that it's good for inverting as a
-            highlight. revisit. */
-
-         tmp.x = x;
-         tmp.y = y;
-         tmp.width = DOUBLE_FROM_26_6 (face->glyph->advance.x);
-         tmp.height = DOUBLE_FROM_26_6 (face->glyph->advance.y);
-         union_rects (&rect, &tmp);
-         x += DOUBLE_FROM_26_6 (face->glyph->advance.x);
-         y += DOUBLE_FROM_26_6 (face->glyph->advance.y);
-       }
-    }      
+         face = pango_ft2_font_get_face (gi->item->analysis.font);
+         assume_pointsize_and_identity_transform (pointsize, face);
+      
+         for (j = 0; j < gi->glyphs->num_glyphs; ++j)
+           {
+             FT_Load_Glyph (face, gi->glyphs->glyphs[j].glyph, 
FT_LOAD_DEFAULT);
+
+             /* FIXME: also, this is probably not the correct set of metrics;
+                the "logical bounds" are some fancy combination of hori
+                advance and height such that it's good for inverting as a
+                highlight. revisit. */
+
+             tmp.x = x;
+             tmp.y = y;
+             tmp.width = DOUBLE_FROM_26_6 (face->glyph->advance.x);
+             tmp.height = DOUBLE_FROM_26_6 (face->glyph->advance.y);
+             union_rects (&rect, &tmp);
+             x += DOUBLE_FROM_26_6 (face->glyph->advance.x);
+             y += DOUBLE_FROM_26_6 (face->glyph->advance.y);
+           }
+       }      
+    }
 
   ret = rect_to_array (env, &rect);
   gdk_threads_leave ();
@@ -566,30 +567,30 @@
   g_assert (self != NULL);
   vec = (struct glyphvec *)NSA_GET_GV_PTR (env, self);
   g_assert (vec != NULL);
-  g_assert (vec->glyphitems != NULL);
- 
-  seek_glyph_idx (vec->glyphitems, idx, &gi, &font);
-  g_assert (gi != NULL);
-  g_assert (font != NULL);
-
-  pointsize = pango_font_description_get_size (vec->desc);
-  pointsize /= (double) PANGO_SCALE;
-  face = pango_ft2_font_get_face (font);
-
-  assume_pointsize_and_identity_transform (pointsize, face);  
-
-  FT_Load_Glyph (face, gi->glyph, FT_LOAD_DEFAULT);
-
-  /* FIXME: this is probably not the correct set of metrics;
-     the "logical bounds" are some fancy combination of hori
-     advance and height such that it's good for inverting as a
-     highlight. revisit. */
+  if (vec->glyphitems != NULL)
+    {
+      seek_glyph_idx (vec->glyphitems, idx, &gi, &font);
+      g_assert (gi != NULL);
+      g_assert (font != NULL);
+
+      pointsize = pango_font_description_get_size (vec->desc);
+      pointsize /= (double) PANGO_SCALE;
+      face = pango_ft2_font_get_face (font);
+
+      assume_pointsize_and_identity_transform (pointsize, face);  
+
+      FT_Load_Glyph (face, gi->glyph, FT_LOAD_DEFAULT);
+
+      /* FIXME: this is probably not the correct set of metrics;
+        the "logical bounds" are some fancy combination of hori
+        advance and height such that it's good for inverting as a
+        highlight. revisit. */
   
-  rect.x = 0; 
-  rect.y = 0; 
-  rect.width = DOUBLE_FROM_26_6 (face->glyph->advance.x);
-  rect.height = DOUBLE_FROM_26_6 (face->glyph->advance.y);
-
+      rect.x = 0; 
+      rect.y = 0; 
+      rect.width = DOUBLE_FROM_26_6 (face->glyph->advance.x);
+      rect.height = DOUBLE_FROM_26_6 (face->glyph->advance.y);
+    }
   ret = rect_to_array (env, &rect);
   gdk_threads_leave ();
   return ret;
@@ -612,25 +613,25 @@
   g_assert (self != NULL);
   vec = (struct glyphvec *)NSA_GET_GV_PTR (env, self);
   g_assert (vec != NULL);
-  g_assert (vec->glyphitems != NULL);
- 
-  seek_glyph_idx (vec->glyphitems, idx, &gi, &font);
-  g_assert (gi != NULL);
-  g_assert (font != NULL);
-
-  pointsize = pango_font_description_get_size (vec->desc);
-  pointsize /= (double) PANGO_SCALE;
-  face = pango_ft2_font_get_face (font);
+  if (vec->glyphitems != NULL)
+    {
+      seek_glyph_idx (vec->glyphitems, idx, &gi, &font);
+      g_assert (gi != NULL);
+      g_assert (font != NULL);
+
+      pointsize = pango_font_description_get_size (vec->desc);
+      pointsize /= (double) PANGO_SCALE;
+      face = pango_ft2_font_get_face (font);
 
-  assume_pointsize_and_identity_transform (pointsize, face);  
+      assume_pointsize_and_identity_transform (pointsize, face);  
   
-  FT_Load_Glyph (face, gi->glyph, FT_LOAD_DEFAULT);
-  /* FIXME: this needs to change for vertical layouts */
-  rect.x = DOUBLE_FROM_26_6 (face->glyph->metrics.horiBearingX);
-  rect.y = DOUBLE_FROM_26_6 (face->glyph->metrics.horiBearingY);
-  rect.width = DOUBLE_FROM_26_6 (face->glyph->metrics.width);
-  rect.height = DOUBLE_FROM_26_6 (face->glyph->metrics.height);
-
+      FT_Load_Glyph (face, gi->glyph, FT_LOAD_DEFAULT);
+      /* FIXME: this needs to change for vertical layouts */
+      rect.x = DOUBLE_FROM_26_6 (face->glyph->metrics.horiBearingX);
+      rect.y = DOUBLE_FROM_26_6 (face->glyph->metrics.horiBearingY);
+      rect.width = DOUBLE_FROM_26_6 (face->glyph->metrics.width);
+      rect.height = DOUBLE_FROM_26_6 (face->glyph->metrics.height);
+    }
   ret = rect_to_array (env, &rect);
   gdk_threads_leave ();
   return ret;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]