diff options
author | Paul D'Pong | 2021-04-22 17:12:57 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2021-05-18 16:13:21 +0000 |
commit | 318b59619ce7beb19b2501cf8e619a24ac5e578e (patch) | |
tree | 229f2fa681117d593df9c0931f27e580e28c5ddc | |
parent | 0aa0a5fb05f20e92d789b22683a8a4de44fbf7bb (diff) | |
download | eclipse.platform.swt-318b59619ce7beb19b2501cf8e619a24ac5e578e.tar.gz eclipse.platform.swt-318b59619ce7beb19b2501cf8e619a24ac5e578e.tar.xz eclipse.platform.swt-318b59619ce7beb19b2501cf8e619a24ac5e578e.zip |
Bug 572943 - [gtk] First Radio Button is truncated with Gridlayout
- Problem is not with the GridLayout but how the button calculates its
size. The button size calculation seems to be incorrect when the
selection of the radio button is active before setting of the text
- Solution: Enforce selection of the radio button until after the font
has been set. Workaround is similar to Combo.setFontDescription
Change-Id: I62cb20ddaf60dd321ed9046b1d8835612be34ef0
Signed-off-by: Paul D'Pong <sdamrong@redhat.com>
Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/179684
Tested-by: Alexander Kurtakov <akurtako@redhat.com>
Reviewed-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java index 96ef0ae190..627fdd6a15 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java @@ -1000,7 +1000,20 @@ void setFontDescription (long fontDesc) { return; } else { super.setFontDescription (fontDesc); - if (labelHandle != 0) setFontDescription (labelHandle, fontDesc); + + if (GTK.GTK4) { + if (labelHandle != 0) setFontDescription(labelHandle, fontDesc); + } else { + /* + * GTK3 Workaround for bug which causes incorrect size + * calculation when the button (radio/check) is set active + * before setting font description. + */ + boolean selected = getSelection(); + if (selected) setSelection(!selected); + if (labelHandle != 0) setFontDescription(labelHandle, fontDesc); + setSelection(selected); + } } } |