-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
8258979: The image didn't show correctly with GTK LAF #17294
Conversation
👋 Welcome back abhiscxk! A progress list of the required criteria for merging this PR into |
@kumarabhi006 The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Looks like the bug is confidential/not public. |
Already updated the bug but it is still not reflected. |
Webrevs
|
JBS image suggests that no image is rendered either for collapsed or expanded icon for Ubuntu20.10-x64 but it seems you are seeing expanded icon but not collapsed icon, is that correct? WHich ubuntu you tested against? Did you check on ubuntu 20.10 in case |
Yes, only collapsed icon is not rendered.
22.04
Didn't have 201.0 machine, so couldn't check. |
How about latest 23.10? Probably you should install and check there as well if you dont have that.....There is a need to check in latest OracleLinux too as there is a difference in observations across ubuntu versions.. |
Ok, will check and update. |
Modified the manual test to automated and tested in mach5 machines. Test passed on all platforms. Test passed on specific ubuntu 20.10 machine multiple times.
Installed 23.10 machine in my local and verified the automated test. Ran the test on oracle linux as well and it passed. CI link is attached in JBS for automated test. |
SynthGraphicsUtils.paintIcon(collapsedIcon, context, g, x, y, w, h); | ||
} | ||
else { | ||
SynthGraphicsUtils.paintIcon(collapsedIcon, context, g, x, y, w, h); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guess it's a copy of ExpandedIconWrapper
class, so CollapsedIconWrapper
and ExpandedIconWrapper
can be optimised to use common method passing in the "icon" argument..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I merge the two classes into one class like instead of separate ExpandedIconWrapper
and CollapsedIconWrapper
, only one IconWrapper
class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guess you could since they are all private..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merged ExpandedIconWrapper
and CollapsedIconWrapper
class to IconWrapper
class.
|
||
private Icon expandedIconWrapper = new IconWrapper(IconType.EXPANDED); | ||
|
||
private Icon collapsedIconWrapper = new IconWrapper(IconType.COLLAPSED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you can pass in collapsedIcon
or expandedIcon
to IconWrapper
class which can save it in icon
field and
Then IconWrapper class can just call SynthGraphicsUtils.paintIcon(icon, context, g, x, y, w, h);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried with this approach first but images didn't render at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess those might be null at class initialisation stage so it didn't render..you can try
expandedIconWrapper = new IconWrapper(expandedIcon);
collapsedIconWrappr - new IconWrapper(collapsedICon);
in updateStyle() where it sets
setExpandedIcon(style.getIcon(context, "Tree.expandedIcon"));
setCollapsedIcon(style.getIcon(context, "Tree.collapsedIcon"));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
@@ -150,6 +157,9 @@ private void updateStyle(JTree tree) { | |||
LookAndFeel.installProperty( | |||
tree, JTree.SHOWS_ROOT_HANDLES_PROPERTY, showsRootHandles); | |||
|
|||
expandedIconWrapper = new IconWrapper(expandedIcon); | |||
collapsedIconWrapper = new IconWrapper(collapsedIcon); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems updateStyle
is called for all propertyChange
event so it can cause memory leak by doing the class instantiation every time it is called..
Probably better place to instantiate this objects is in installDefaults
after calling updateStyle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
} | ||
else { | ||
SynthGraphicsUtils.paintIcon(expandedIcon, context, g, x, y, w, h); | ||
SynthGraphicsUtils.paintIcon(iconType, context, g, x, y, w, h); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guess it can be further optimized in all these methods
if (context == null) {
context = getContext(tree);
}
SynthGraphicsUtils.paintIcon(iconType, context, g, x, y, w, h);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
@@ -782,40 +791,34 @@ public String getName() { | |||
// To get the correct context we return an instance of this that fetches |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add collapsedIcon in the comment too now..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
@kumarabhi006 This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 1065 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
* @run main bug8038113 | ||
*/ | ||
|
||
public class bug8038113 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it be better to change the file & class name to something meaningful instead of bug id since now two bugs refer to same test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think so. Since I am converting the test from applet based it should be ok to just mention the new bug id in jtreg tags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, else it look good to me.
/integrate |
Going to push as commit 82a63a0.
Your commit was automatically rebased without conflicts. |
@kumarabhi006 Pushed as commit 82a63a0. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
The collapsed icon for JTree is not painted using
Icon.paintIcon(Component c, Graphics g, int x, int y)
in GTK LAF. The collapsed icon is returned from BasicTreeUI class which doesn't contain any icon image whereas the expanded icon is returned from SynthTreeUI class and expanded icon is rendered correctly.The proposed fix is to return collapsed icon as an object of collapsed icon wrapper which implements synthIcon and is similar to the expanded icon implementation.
Test mentioned in JBS is an applet based which is converted to main based now and extended for all installed LAFs on the system.
No regression caused with the fix, link is attached in JBS .
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/17294/head:pull/17294
$ git checkout pull/17294
Update a local copy of the PR:
$ git checkout pull/17294
$ git pull https://git.openjdk.org/jdk.git pull/17294/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 17294
View PR using the GUI difftool:
$ git pr show -t 17294
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/17294.diff
Webrev
Link to Webrev Comment