Bug 658654

Summary: JPopupMenus have inconsistent drop shadows when using compositing window managers
Product: [Fedora] Fedora Reporter: Joel Uckelman <uckelman>
Component: java-1.6.0-openjdkAssignee: Mario Torre <neugens>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 16CC: ahughes, dbhole, jvanek, langel, lkundrak, mjw, mmatejov, omajid, poncho
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
URL: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6800513
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-08 09:10:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
test program none

Description Joel Uckelman 2010-11-30 22:39:36 UTC
Created attachment 463840 [details]
test program

Description of problem:

The best way to see the problem is using the attached test program in conjunction with Compiz.

First, resize the window so that the popup menu is taller than the window. You will see that the popup gets a correctly rendered drop shadow. (This appears to be because it's a real, heavyweight component due to the fact that it extends outside of the parent window.) Then make the window tall enough so that the  popup menu fits entirely inside it, and bring up the menu again. This time, you'll see no drop shadow, presumably because in this case, it's a Swing component instead of a real component.

This looks really stupid.

Note that adding JPopupMenu.setDefaultLightWeightPopupEnabled(false), which you'd think would solve the problem, appears to have no effect here.

So, it appears that the JVM needs to detect whether a compositing window manager is running, and if so, always use heavyweight popups.


Version-Release number of selected component (if applicable):

java-1.6.0-openjdk-1.6.0.0-44.1.9.1.fc14.x86_64


How reproducible:

Always.

Steps to Reproduce:
1. See description above.
  
Actual results:

Popup menus should get drop shadows.

Expected results:

Popup menus get no drop shadows.

Comment 1 Joel Uckelman 2010-11-30 23:27:12 UTC
NB: The bug I'm reporting isn't the same as the one noted in the URL above---that Sun bug is specifically about the GTK LaF, while the bug I'm reporting seems to be LaF-independent.

Comment 2 Omair Majid 2011-03-25 21:56:54 UTC
Looks like JPopupMenu.setDefaultLightWeightPopupEnabled(false) makes the popup mediumweight, not heavy weight. We will have to patch JPopupMenu to make it heavyweight.

Comment 3 Joel Uckelman 2011-11-18 18:43:38 UTC
This is not only a problem with Compiz, I see now that I've tried GNOME 3---it happens with any compositing window manager, and still happens in F15.

Comment 4 Joel Uckelman 2012-03-26 19:49:44 UTC
This remains a problem with java-1.6.0-openjdk-1.6.0.0-65.1.11.1.fc16.x86_64 in Fedora 16.

Comment 5 Deepak Bhole 2012-03-26 20:10:12 UTC
Re-assigned to Mario -- Mario, can you please take a look when possible?

Comment 6 Mario Torre 2012-04-16 14:06:04 UTC
The bug 6800513 in the Sun bug database is really the same as this one (although the bug has been submitted specifically for the GTK laf).

As Omair correctly stated the problem is that the popup are made MEDIUM_WEIGHT rather tan HEAVY_WEIGHT, while the HW components are only used when the popup goes over the available space in the containing frame.

A fix for OpenJDK8 is under discussion on the AWT mailing list, but I don't know yet if we will push for OpenJDK7 as well.

Comment 7 Mario Torre 2012-05-30 16:28:38 UTC
The fix has been pushed upstream for the JDK8 tree.