Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JComboBox] Incorrect popup location on high dpi screens. #162

Closed
Ilolka1337 opened this issue May 4, 2020 · 42 comments
Closed

[JComboBox] Incorrect popup location on high dpi screens. #162

Ilolka1337 opened this issue May 4, 2020 · 42 comments
Labels
bug Something isn't working windows Related to the windows operating system

Comments

@Ilolka1337
Copy link

Ilolka1337 commented May 4, 2020

Screenshots
image

Additional Information:

  • OS: [Win]
  • OS Version: [10]
  • Darklaf Version: [2.1.1]

Additional context
I have only 5 ComboBoxes, I switch one of them and the topic starts to shift visually

@Ilolka1337 Ilolka1337 added the bug Something isn't working label May 4, 2020
@weisJ
Copy link
Owner

weisJ commented May 4, 2020

Please provide a proper description of what you expect to happen and what’s happening instead.

Without more context the screenshot isn’t telling me anything. Also please provide a minimal example to reproduce.

@Ilolka1337
Copy link
Author

@weisJ i can but only later and apparently this problem is relevant only for 4K monitors

@Ilolka1337
Copy link
Author

Ilolka1337 commented May 4, 2020

@weisJ
23.zip
that’s all i run and this problem is still there

Code:

public class GUI extends JFrame {

    public static void main(String[] args) {
        SwingUtilities.invokeLater(() -> {
            LafManager.install(new SolarizedDarkTheme());
            GUI frame = new GUI();
            frame.setVisible(true);
        });
    }

    public GUI() {
        LafManager.setDecorationsEnabled(true);

        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(200, 300);
        setLocationRelativeTo(null);

        JTabbedPane tabsPane = new JTabbedPane(JTabbedPane.BOTTOM);
        getContentPane().add(tabsPane, BorderLayout.EAST);

        Filer filer = new Filer();
        GridBagLayout gridBagLayout = (GridBagLayout) filer.getLayout();
        gridBagLayout.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0};
        tabsPane.addTab("filer", null, filer, null);
    }

    static class Filer extends JPanel {

        public Filer() {
            GridBagLayout gbl_this = new GridBagLayout();
            gbl_this.columnWidths = new int[]{0, 0};
            gbl_this.rowHeights = new int[]{35, 25, 162, 0};
            gbl_this.columnWeights = new double[]{1.0, Double.MIN_VALUE};
            gbl_this.rowWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE};
            this.setLayout(gbl_this);

            JComboBox<String> comboBox = new JComboBox<>();
            GridBagConstraints con = new GridBagConstraints();
            con.fill = GridBagConstraints.HORIZONTAL;
            con.insets = new Insets(0, 0, 5, 5);
            con.gridx = 15;
            con.gridy = 0;
            comboBox.addItem("test");
            comboBox.addItem("test2");
            comboBox.addItem("test3");
            comboBox.addItem("test4");
            comboBox.addItem("test5");
            comboBox.addItem("test6");

            this.add(comboBox, con);
        }
    }
}

@weisJ
Copy link
Owner

weisJ commented May 4, 2020

I have added the code to your comment. Please refrain from uploading code as a zip archive if it's only two files.

Also I still don't know what issue you are exactly encountering. The program works fine for me (aside from the weird choice of layout) and your screenshot doesn't give me any context.

@Ilolka1337
Copy link
Author

image

@Ilolka1337
Copy link
Author

image

@Ilolka1337
Copy link
Author

@weisJ i do not know how to explain it

@weisJ weisJ added the needs reproduction The issue can't be reproduced and needs a reproducible example. label May 4, 2020
@Ilolka1337
Copy link
Author

@weisJ i can try to record a video

@weisJ
Copy link
Owner

weisJ commented May 4, 2020

apparently this problem is relevant only for 4K monitors

What is your resolution exactly?
Do you use Windows screen scaling?
Which java version do you use?
How many monitors do you use?

@Ilolka1337
Copy link
Author

What is your resolution exactly? - Display: 3840x2280
Do you use Windows screen scaling? - default(recommended)
Which java version do you use? - Java version: 1.8.0_202
How many monitors do you use? - maybe this problem is only on 4K I tested on my 1920x1080 there was nothing

@weisJ
Copy link
Owner

weisJ commented May 4, 2020

What is your resolution exactly? - Display: 3840x2280
Do you use Windows screen scaling? - default(recommended)

Now I'm just interested how big the monitor is. Usually windows recommends 150%-200% for resolutions that big. What is the dpi of the monitor.

Which java version do you use? - Java version: 1.8.0_202

Please try with Java >=9

How many monitors do you use? - maybe this problem is only on 4K I tested on my 1920x1080 there was nothing

I meant how many at the same time.

@Ilolka1337
Copy link
Author

@weisJ i can’t test this in Java 9, it causes blur in all applications

@Ilolka1337
Copy link
Author

How many monitors do you use? - 3 monitors

@weisJ
Copy link
Owner

weisJ commented May 4, 2020

How many monitors do you use? - 3 monitors

Can you try using only the 4k monitor.

i can’t test this in Java 9, it causes blur in all applications

That's very strange and increases my suspicion that this isn't actually a darklaf issue.
Why do I think that:

  • The calculation of the popup location isn't even done by darklaf.
  • Java 8 doesn't support proper ui scaling and has no official high dpi support.

@Ilolka1337
Copy link
Author

can you try using only the 4k monitor. - in the morning I tested and so and so / result: nothing

in the morning i tested setDecorations, this fixed the problem only with the decorations turned off

@weisJ
Copy link
Owner

weisJ commented May 4, 2020

in the morning i tested setDecorations, this fixed the problem only with the decorations turned off

Please clarify. Do enabled or disabled decorations produce the error?

@Ilolka1337
Copy link
Author

@weisJ Please clarify. Do enabled or disabled decorations produce the error? - when enabled

@weisJ
Copy link
Owner

weisJ commented May 5, 2020

How many monitors do you use? - 3 monitors

Can you try using only the 4k monitor.

i can’t test this in Java 9, it causes blur in all applications

That's very strange and increases my suspicion that this isn't actually a darklaf issue.
Why do I think that:

  • The calculation of the popup location isn't even done by darklaf.
  • Java 8 doesn't support proper ui scaling and has no official high dpi support.

Please try with only the 4k monitor connected and with Java 9 (ignore the fact that its's blurry).

Do you use Windows screen scaling? - default(recommended)

What value is actually recommended to you? is it 100% (most likely it isn't)
Did you change any settings for java to override the system scaling? i.e.
java.exe -> Properties -> Compatibility -> Change high DPI settings

@Ilolka1337
Copy link
Author

@weisJ

Please try with only the 4k monitor connected and with Java 9 (ignore the fact that its's blurry).

no changes

What value is actually recommended to you? is it 100% (most likely it isn't)

300% - 350%

as I wrote to you, this problem only appears when setDecorationsEnabled(true)

@weisJ maybe problem in decorations? because as I wrote with the decorations disabled, there is no such problem

I hope you can fix it for a 4k monitor

@weisJ
Copy link
Owner

weisJ commented May 6, 2020

Did you try java 9? Do you have any overridden settings for dpi scaling.
Do you also experience the issue if you simply use a single combo box centred in the frame (e.g. by using a GridBagLayout with null constraints)?

It’s really important that you answer all the questions as otherwise I can’t do anything about the issue. I have a monitor with a resolution of 3000 x 2000 myself an don’t experience any issues (regardless of system scaling) that’s why I need more context in order to reproduce the issue.

@weisJ weisJ changed the title when I select a ComboBox with the theme something strange happens [JComboBox] Incorrect popup location on high dpi screens. May 7, 2020
@weisJ weisJ added the windows Related to the windows operating system label May 7, 2020
@Ilolka1337
Copy link
Author

@weisJ
Actually, I get this with the very programs where setDecorationsEnabled(true) is set
I think this problem can only be caused on some systems
I checked in Java 9 the same thing
image

@Ilolka1337
Copy link
Author

@weisJ this is how the GraxCode application works for me
image

@Ilolka1337
Copy link
Author

@weisJ
this problem cannot be described; you must see it yourself
this problem is only in darklaf all i can tell you

@weisJ
Copy link
Owner

weisJ commented May 10, 2020

Please answer all my questions:

Did you change any settings for java to override the system scaling? i.e.
java.exe -> Properties -> Compatibility -> Change high DPI settings

As long as I can't reproduce the issue I won't be able to da anything about it as much as I'd like to. But without confirmation that it is actually directly related to darklaf and not caused by any other changes on your side I don't think I can actually do something.

@Ilolka1337
Copy link
Author

@weisJ

Did you change any settings for java to override the system scaling? i.e.
java.exe -> Properties -> Compatibility -> Change high DPI settings

I have everything by default

As long as I can't reproduce the issue I won't be able to da anything about it as much as I'd like to. But without confirmation that it is actually directly related to darklaf and not caused by any other changes on your side I don't think I can actually do something.

I did not change anything in windows after installation, I have no problems with themes other than darklaf

@weisJ
Copy link
Owner

weisJ commented May 12, 2020

Please feel free to build darklaf locally and check if you can find the issue. My first assessment would be that the issue would be somewhere in Decorations.cpp. You can try to disable some parts of the window procedure or the decorations installation to see if the issue persists. If you have any questions on what the code does feel free to ask me and I'll try to clarify.

I can't possibly offer a solution without being able to reproduce the issue.

@Ilolka1337
Copy link
Author

@weisJ
I don’t know well c++, maybe you will just send libraries that I will have to test?

@weisJ
Copy link
Owner

weisJ commented May 13, 2020

You don’t need to know any c++ only a compiler. If you don’t have any installed currently I recommend using the Visual Studio command line tools.

Some things you can try:

I won’t send you any libraries as it’s a huge effort to do “remote debugging” of this kind.

@weisJ weisJ added the help wanted Extra attention is needed label May 13, 2020
@weisJ
Copy link
Owner

weisJ commented May 17, 2020

I think I could isolate a scenario where I can reproduce the issue. Currently working on a fix.

@weisJ weisJ added windows Related to the windows operating system and removed help wanted Extra attention is needed needs reproduction The issue can't be reproduced and needs a reproducible example. windows Related to the windows operating system labels May 17, 2020
@weisJ
Copy link
Owner

weisJ commented May 17, 2020

Please try the current repository version.

@Ilolka1337
Copy link
Author

@weisJ same

@Ilolka1337
Copy link
Author

�[34m[2020-05-20 05:05:41]�[33m [WARNING]�[0m�[33m Could not load color with id'Windows.Icons.windowCloseHover.color' fallbacks[] Using color java.awt.Color[r=255,g=0,b=0] instead.�[0m�[01m [at com.github.weisj.darklaf.icons.IconColorMapper]�[2m�[0m
�[34m[2020-05-20 05:05:41]�[33m [WARNING]�[0m�[33m Could not load color with id'Windows.Icons.windowCloseHover.color' fallbacks[] Using color java.awt.Color[r=255,g=0,b=0] instead.�[0m�[01m [at com.github.weisj.darklaf.icons.IconColorMapper]�[2m�[0m

@weisJ
Copy link
Owner

weisJ commented May 20, 2020

Are you sure you are running an up to date version? Does the message get printed every time?

@Ilolka1337
Copy link
Author

@weisJ
well damn, I liked darklaf so much, but on some systems it seems to be broken in that the application interface starts to fly inside the application

@Ilolka1337
Copy link
Author

@weisJ
How can I help you fix this problem?

@Ilolka1337
Copy link
Author

@weisJ
I recorded a video so you can look at this problem
https://mega.nz/file/PuAhBYjK#MGC-euIl_ty86a9DsmDzpQBCXz0pcc-dOOmi0p1Uiz4

@weisJ
Copy link
Owner

weisJ commented May 26, 2020

Thank you very much for the video.

How can I help you fix this problem?

The first step would be to try to reproduce the issue on a different machine. Do you have access to another Windows machine which you could try with your monitor?

Generally you can always try the current master branch using:

  • Build darklaf:
    git clone https://github.com/weisJ/darklaf.git
    cd darklaf
    gradlew build
    
    If you don't have a c++ toolchain installed (or the build fails while building the native binaries) you can download the latest binary in the correct loactions
    • libdarklaf-macos.dylib -> macos/libraries/macos-x86-64/
    • darklaf-windows_x86-64.dll -> windows/libraries/windowx-x86-64
    • darklaf-windows_x86.dll -> windows/libraries/windowx-x86
  • Run the demos. e.g. for the combo box demo run:
    gradlew runDemo --class ui.comboBox.ComboBoxDemo
    
    You can add your own code into core/test/java/ and run it using
    gradlew runDemo --class <qualified path to your class>
    

@Ilolka1337
Copy link
Author

Ilolka1337 commented May 26, 2020

@weisJ

The first step would be to try to reproduce the issue on a different machine. Do you have access to another Windows machine which you could try with your monitor?

no, but I checked in a virtual machine this problem is unlikely in the computer

seems to be a problem that is only available on some computers or windows systems

@Ilolka1337
Copy link
Author

@Ilolka1337
Copy link
Author

@weisJ
for some reason, everything is fine only with buttondemo
https://mega.nz/file/3qZyXY5L#F6bI0FNyflNlLqgDWQQ9NVuMjFWzPuUtMbEnAuORnuM

@weisJ
Copy link
Owner

weisJ commented May 27, 2020

Could you please try the the latest revision? You'll need to re-download the latest binaries if you aren't compiling them yourself.

@weisJ
Copy link
Owner

weisJ commented May 27, 2020

@Ilolka1337 I am closing this issue and moving the topic to #172 as the paint bleeding is a separate issue.

@weisJ weisJ closed this as completed May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working windows Related to the windows operating system
Projects
None yet
Development

No branches or pull requests

2 participants