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

8273355: Flickering on tooltip appearance IntelliJ IDEA 2021.2.1 #7931

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -289,6 +289,15 @@ protected void setVisibleImpl(final boolean visible) {
updateFocusableWindowState();
super.setVisibleImpl(visible);
// TODO: update graphicsConfig, see 4868278
if (visible) {
// Set correct background for a window before making it visible.
// It is necessary to eliminate a flashing effect
// (when initial background color replaced with the content layer's color)
Color color = getBackground();
if (color != null) {
platformWindow.setBackground(color);
Copy link
Member

@mrserb mrserb Mar 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it skips the texture property I guess it will break it?
I think the easiest solution for this issue is to add a new method to the LWWindowPeer:

  public void setBackground(final Color c) {
       Color oldBg = getBackground();
       if (oldBg == c || (oldBg != null && oldBg.equals(c))) {
           return;
       }
       super.setBackground(c);
       updateOpaque();
   }
}

Copy link
Contributor Author

@avu avu Mar 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it skips the texture property I guess it will break it?
I've not noticed it in my testing. Do you mean particular tests? But anyway your suggestion looks more elegant and it works in my scenarios, also I've run test-jdk_desktop_part1 with it. No related problem was found.

Copy link
Member

@mrserb mrserb Mar 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CPlatformWindow.setOpaque() changes the background of the native window only if the texture property is not set. So if the code will change the color directly somewhere then the texture property will be broken. Not sure that we have a test for that.
Please update the copyright date.

Copy link
Contributor Author

@avu avu Mar 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mrserb updated.

}
}
platformWindow.setVisible(visible);
if (isSimpleWindow()) {
KeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance();
@@ -139,6 +139,8 @@ public default void setMaximizedBounds(int x, int y, int w, int h){}

public void setOpaque(boolean isOpaque);

public void setBackground(Color color);

public void enterFullScreenMode();

public void exitFullScreenMode();
@@ -180,6 +180,9 @@ public void setOpacity(float opacity) {}
@Override
public void setOpaque(boolean isOpaque) {}

@Override
public void setBackground(Color color) {}

@Override
public void enterFullScreenMode() {}

@@ -948,6 +948,12 @@ public void setOpaque(boolean isOpaque) {
SwingUtilities.invokeLater(this::invalidateShadow);
}

@Override
public void setBackground(Color color) {
int rgb = color.getRGB();
execute(ptr->CWrapper.NSWindow.setBackgroundColor(ptr, rgb));
}

@Override
public void enterFullScreenMode() {
isFullScreenMode = true;
@@ -25,6 +25,7 @@

package sun.lwawt.macosx;

import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.GraphicsDevice;
@@ -181,6 +182,10 @@ public void setOpacity(float opacity) {
public void setOpaque(boolean isOpaque) {
}

@Override
public void setBackground(Color color) {
}

@Override
public void enterFullScreenMode() {
}