JDK-8159968 : Ubuntu 16.04 + HiDPI: menu is broken
  • Type: Bug
  • Component: javafx
  • Sub-Component: window-toolkit
  • Affected Version: 9
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2016-06-21
  • Updated: 2016-12-16
  • Resolved: 2016-12-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
similar to JDK-8159963

Ubuntu 16.04 (Unity) + HiDPI + JDK9b122

Please run the following sample:

import javafx.application.Application;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class MenuApp extends Application {

    public Parent createContent() {

        VBox vbox = new VBox(20);
        vbox.setPrefSize(300, 200);
        final MenuBar menuBar = new MenuBar();
        Menu m1 = new Menu("one");
        m1.getItems().addAll(new MenuItem("111"), new MenuItem("222"));
        Menu m2 = new Menu("two");
        m2.getItems().addAll(new MenuItem("aaa"), new MenuItem("bbb"));
        Menu menu = new Menu("menu");
        menu.getItems().addAll(m1, m2);
        menuBar.getMenus().addAll(menu);
        vbox.getChildren().addAll(menuBar);
        return vbox;
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        primaryStage.setScene(new Scene(createContent()));
        primaryStage.show();
    }

    public static void main(String[] args) { launch(args); }
}

Cannot navigate over the menu items (but the menu become selected when moving the mouse over it)
Comments
core issue resolved by JDK-8163496 new issue in JDK-8171336
16-12-2016

At first I thought this was fixed by JDK-8163496, the first couple of touches on the menu look right, but then the popup windows stopped showing up. I wonder if it is the same issue I saw testing JDK-8159963 where the window is showing up in the wrong spot.
16-12-2016

> GTK3 the issue does not manifest so brightly when using JDK8 (b132) on the same machine (Ubuntu 16.04, GTK3, HiDPI). sometimes (rarely) the menu occurs at a wrong position, but at least it is visible and navigable. so probably that's not only GTK3-related issue.
14-09-2016

Some information that might help vaguely recollected from when I worked on it a few weeks ago... I'm pretty sure that the last I left it (testing on 14.04, not 16.04, but using GTK3) there was a discrepancy between what the GDK events listed as the location and the location we computed by querying GDK calls. Part of the issue is that the event lists the location of the child window, but we need to know the location of the decorated frame instead, and part of it may be that GDK uses "cached information" for some of its calls in order to avoid a round trip to the X server. I thought perhaps the issue might be that we process the CONFIGURE event first before we hand it to GDK, but after I changed the order and handed the event to GDK first and then ran our own event processing code, we still seemed to come up with the wrong answer. Potential solutions might be to either force GDK to sync up (though this happens once per window move event so we'd have to make sure it wasn't that expensive an operation), or to get the location of the decorated frame some other way than to use the GDK query call we are currently using... (This comment probably belongs on JDK-8159963 as that is where most of the discussion of this issue is taking place (the two bugs are likely dups of one another). I'll copy it to that bug report and we can continue discussion there...)
13-09-2016

asking for 9-client-defer-candidate as there are no resources to address this in 9.
11-09-2016

As mentioned in JDK-8159963, the remaining issue seems to be related more to mismanagement of a window's location by the gtk_window_get_position() function. The issue will be tracked on that bug report and this bug may be closed as a duplicate if the final solution fixes this problem as well.
08-09-2016

Reassigning to David as per JDK-8159963 as these are likely related issues.
08-09-2016

Similar to the issues seen with JDK-8159963, much of this bug has been fixed with the fix of JDK-8159892 which disabled the automatic scaling of GTK3, but the menu popup appears on the wrong part of the screen and isn't operable (though it renders correctly in its odd position). Switching to another top level window and switching back to the MenuApp window fixes the screen positioning of the popup, though, just as it does with the test case in JDK-8159963.
11-08-2016

please see also JDK-8163101, JDK-8160270 - probably the issues are of the same nature...
05-08-2016

This may be a duplicate of JDK-8159892 as it probably relates to how the GTK3 interfaces deal with coordinates on a scaled screen. One manifestation is bad rendering and another manifestation is screen locations are off. Time will tell as more work is done to fix JDK-8159592.
04-08-2016

in case of non-HiDPI display the menu appears in a wrong place (especially when scale > 1)
22-06-2016

scale = 1.5 was used for testing. when using scale = 2, the stage is simply rendered incorrectly (JDK-8159892)
21-06-2016