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

Opaque tooltip on Linux #220

Closed
weisJ opened this issue Dec 1, 2020 · 17 comments · Fixed by #229
Closed

Opaque tooltip on Linux #220

weisJ opened this issue Dec 1, 2020 · 17 comments · Fixed by #229
Labels
bug Something isn't working linux

Comments

@weisJ
Copy link
Owner

weisJ commented Dec 1, 2020

@weisJ This bug seems to still be appearing on Linux.
image

I'm on Arch Linux x86_64 (5.9.8-arch1-1).

It also seems to be incredibly hard to activate tooltips. They don't appear after hovering, but can in some circumstances be triggered with control + f1, however this is very hard to trigger.

Originally posted by @x4e in #180 (comment)

@weisJ weisJ added bug Something isn't working linux labels Dec 1, 2020
@weisJ
Copy link
Owner Author

weisJ commented Dec 1, 2020

This bug seems to still be appearing on Linux.

The popup for the tooltip is configured here:

protected void setupPopup(final PopupType type, final Component contents, final int x, final int y) {

It would be very insightful what PopupType the popup has.
Are you comfortable with building the project locally? You can start the tooltip demo using

gradlew runDemo --class ui.toolTip.ToolTipDemo

It also seems to be incredibly hard to activate tooltips. They don't appear after hovering, but can in some circumstances be triggered with control + f1, however this is very hard to trigger.

The laf shouldn't change how tooltips are activated. Do you experience the same issue when using the system look and feel?

@x4e
Copy link

x4e commented Dec 1, 2020

Are you comfortable with building the project locally? You can start the tooltip demo using

image

It would be very insightful what PopupType the popup has.

type == HEAVY_WEIGHT

The laf shouldn't change how tooltips are activated. Do you experience the same issue when using the system look and feel?

On the demo it seems to be working ok. Probably something I'm doing wrong so don't worry about this part.

@x4e
Copy link

x4e commented Dec 1, 2020

Actually I take back that last part. It seems that sometimes the tooltip is triggered as my System.out.println(type) in DarkPopupFactory.java is being triggered, however often no tooltip shows up.
This is likely related to the opaque problem in some way.

@weisJ
Copy link
Owner Author

weisJ commented Dec 1, 2020

Could you print out the component hierarchy of the tooltip together with the corresponding background colours?

@x4e
Copy link

x4e commented Dec 2, 2020

Which variables are those stored in?

@weisJ
Copy link
Owner Author

weisJ commented Dec 2, 2020

You have to loop over the parents of the tooltip i.e.

Component p = content;
while(p != null) {
    System.out.println(p);
    System.out.println(p.getBackground());
    System.out.println(p.isOpaque());
    System.out.println("");
    p = p.getParent()
}

@x4e
Copy link

x4e commented Dec 2, 2020

This part when I hover over the button (no tooltip is shown)

javax.swing.JFrame[frame0,601,1242,337x296,invalid,layout=java.awt.BorderLayout,title=ToolTip Demo,resizable,normal,defaultCloseOperation=EXIT_ON_CLOSE,rootPane=javax.swing.JRootPane[,6,43,325x247,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=com.github.weisj.darklaf.ui.rootpane.DarkRootPaneBorder@1145ecf,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]
java.awt.SystemColor[i=7]
true
--
javax.swing.JToolTip[,0,0,1x1,invalid,alignmentX=0.0,alignmentY=0.0,border=com.github.weisj.darklaf.ui.tooltip.DarkTooltipBorder@54442b74,flags=16777224,maximumSize=,minimumSize=,preferredSize=,tipText=<html><p style="color:red;">This is the ToolTip demo text!<br><p style="color:blue;">This is the ToolTip demo text!<br><p style="color:green;">This is the ToolTip demo text!<br></html>]
UIColor[r=247, g=247,b=247]
true
--
javax.swing.JPanel[null.contentPane,0,0,0x0,invalid,layout=javax.swing.JRootPane$1,alignmentX=0.0,alignmentY=0.0,border=,flags=16777217,maximumSize=,minimumSize=,preferredSize=]
UIColor[r=242, g=242,b=242,a=000]
false
--
javax.swing.JLayeredPane[null.layeredPane,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,optimizedDrawingPossible=true]
UIColor[r=242, g=242,b=242]
false
--
javax.swing.JRootPane[,0,0,0x0,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=]
UIColor[r=242, g=242,b=242]
true
--
javax.swing.Popup$HeavyWeightWindow[win1,809,1358,1x1,invalid,hidden,layout=java.awt.BorderLayout,rootPaneCheckingEnabled=true]
java.awt.SystemColor[i=7]
true
--
javax.swing.JFrame[frame0,601,1242,337x296,invalid,layout=java.awt.BorderLayout,title=ToolTip Demo,resizable,normal,defaultCloseOperation=EXIT_ON_CLOSE,rootPane=javax.swing.JRootPane[,6,43,325x247,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=com.github.weisj.darklaf.ui.rootpane.DarkRootPaneBorder@1145ecf,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]
java.awt.SystemColor[i=7]
true

This part when I press control+f1 (tooltip is shown)

--
javax.swing.JToolTip[,0,0,1x1,invalid,alignmentX=0.0,alignmentY=0.0,border=com.github.weisj.darklaf.ui.tooltip.DarkTooltipBorder@73db22ba,flags=16777224,maximumSize=,minimumSize=,preferredSize=,tipText=<html><p style="color:red;">This is the ToolTip demo text!<br><p style="color:blue;">This is the ToolTip demo text!<br><p style="color:green;">This is the ToolTip demo text!<br></html>]
UIColor[r=247, g=247,b=247]
true
--
javax.swing.JPanel[null.contentPane,0,0,0x0,invalid,layout=javax.swing.JRootPane$1,alignmentX=0.0,alignmentY=0.0,border=,flags=16777217,maximumSize=,minimumSize=,preferredSize=]
UIColor[r=242, g=242,b=242,a=000]
false
--
javax.swing.JLayeredPane[null.layeredPane,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,optimizedDrawingPossible=true]
UIColor[r=242, g=242,b=242]
false
--
javax.swing.JRootPane[,0,0,0x0,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=]
UIColor[r=242, g=242,b=242]
true
--
javax.swing.Popup$HeavyWeightWindow[win3,716,1356,1x1,invalid,hidden,layout=java.awt.BorderLayout,rootPaneCheckingEnabled=true]
java.awt.SystemColor[i=7]
true
--
javax.swing.JFrame[frame0,601,1242,337x296,invalid,layout=java.awt.BorderLayout,title=ToolTip Demo,resizable,normal,defaultCloseOperation=EXIT_ON_CLOSE,rootPane=javax.swing.JRootPane[,6,43,325x247,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=com.github.weisj.darklaf.ui.rootpane.DarkRootPaneBorder@1145ecf,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]
java.awt.SystemColor[i=7]
true

@weisJ weisJ changed the title Opaque tooltip on Linix Opaque tooltip on Linux Dec 3, 2020
@weisJ
Copy link
Owner Author

weisJ commented Dec 4, 2020

@x4e For the opacity issue please try to check out the linux/tooltip branch.

As for the tooltip not being displayed sometimes you might want to try to set System.setProperty("darklaf.animations", "false").

@weisJ
Copy link
Owner Author

weisJ commented Dec 21, 2020

@x4e I have published the linux/tooltip branch. It can be tested using com.github.weisj:darklaf-core-linux-popup:latest.integration as a dependency.

@x4e
Copy link

x4e commented Dec 21, 2020

Thank You! That works a lot better.
There are still some minor issues highlighted in this video (https://youtu.be/-quKrqTuL40), being white background, tooltip being slightly displaced sometimes, and previous tooltips being visible in the background).
This is great though thanks!

@weisJ
Copy link
Owner Author

weisJ commented Dec 26, 2020

I just released another snapshot version for the linux/tooltip branch.
I had to deal with incorrect tooltip positioning multiple times already and it always was caused by system scaling factors. To make sure where to look for the problem could you log the following information for me:

GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
AffineTransform  transform = gc.getDefaultTransform();

System.out.println(gc);
System.out.println(gc.getDefaultScreenDevice());
System.out.println(transform);

Also which java version are you using?

@x4e
Copy link

x4e commented Dec 26, 2020

Also which java version are you using?

OpenJDK 15.0.1

To make your code run I had to change it to the following (I believe it has the intended functionality):

var gs = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
var gc = gs.getDefaultConfiguration();
System.out.println(gc);
System.out.println(gs);
System.out.println(gc.getDefaultTransform());

And the output is:

X11GraphicsConfig[dev=X11GraphicsDevice[screen=0],vis=0x21]
X11GraphicsDevice[screen=0]
AffineTransform[[1.0, 0.0, 0.0], [0.0, 1.0, 0.0]]

Video of tooltips in latest update: https://youtu.be/qcaXepwhWRY

@weisJ weisJ mentioned this issue Dec 26, 2020
@weisJ
Copy link
Owner Author

weisJ commented Dec 27, 2020

Does TooltipTest fail for you with the linux/tooltip branch?

@x4e
Copy link

x4e commented Jan 3, 2021

Sorry for the late response.

tooltip_linux
gradlew test succeeds with this tooltip screenshot so I'm guessing that means that the test is suceeding.

Tooltips in my actual project do not work at all now, and just briefly blink a black square before going away.

@weisJ
Copy link
Owner Author

weisJ commented Jan 23, 2021

@x4e the new snapshot version com.github.weisj:darklaf-core-linux-popup:latest.integration should fix the transparency issue. Could you verify that this is the case for you?

@weisJ
Copy link
Owner Author

weisJ commented Jan 23, 2021

Positioning also shouldn't be an issue anymore.

@x4e
Copy link

x4e commented Jan 26, 2021

Thank you so much! It works perfectly now. It's great to be able to maintain a project like this on so many different operating systems.
Feel free to close the issue.

@weisJ weisJ linked a pull request Jan 26, 2021 that will close this issue
@weisJ weisJ mentioned this issue Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working linux
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants