Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6407744

GTK LAF tooltip insets wrong

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "1.6.0-beta2"
      Java(TM) SE Runtime Environment (build 1.6.0-beta2-b77)
      Java HotSpot(TM) 64-Bit Server VM (build 1.6.0-beta2-b77, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Linux helium 2.6.12-10-amd64-generic #1 Sat Mar 11 16:15:30 UTC 2006 x86_64 GNU/Linux


      A DESCRIPTION OF THE PROBLEM :
      Text in tooltips in the GTK LAF is too close to the tooltip's edge.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Start the SwingSet2 demo, switch to the GTK LAF, and hover until you get a tooltip. Remember what that looked like, and then point at the window's close icon until you get a native tooltip. (Ignore the fact that the color's wrong; I've submitted that separately as a regression in the hopes of getting a free t-shirt.) Notice that the insets are too small.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      A 4-pixel border around the text.
      ACTUAL -
      A 0-pixel border around the text.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      Here's a patch against 1.6.0-b77. As I've commented in the patch for the benefit of the code's maintainers, the current GTK implementation (and all previous implementations) use a hard-coded 4-pixel border. Follow the link to see for yourself, or just apply the patch and re-run SwingSet2 to see that it looks right.

      --- j2se/src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java.orig 2006-03-29 21:10:37.000000000 -0800
      +++ j2se/src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java 2006-03-29 21:14:43.000000000 -0800
      @@ -753,10 +753,9 @@
           }
       
           private Insets getToolTipInsets(SynthContext context, Insets insets) {
      - GTKStyle style = (GTKStyle)context.getStyle();
      -
      - insets.left = insets.right = style.getXThickness();
      - insets.top = insets.bottom = style.getYThickness();
      + // GTK+ currently (2006-03-02) hard-codes the border to 4 pixels. See:
      + // http://cvs.gnome.org/viewcvs/gtk%2B/gtk/gtktooltips.c?view=markup
      + insets.left = insets.right = insets.top = insets.bottom = 4;
               return insets;
           }

            peterz Peter Zhelezniakov
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: