Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Pun2016-06-28 17:12:38 -0400
committerEric Williams2016-07-29 10:16:18 -0400
commit7a85190cd50667abdba5e2c750a98f54b33545ce (patch)
tree13da38254189bb0d74e8caac431757ea783f41b1
parent148d337fe588ffb9b31cbdd0ae5295b738e5f5c7 (diff)
downloadeclipse.platform.swt-7a85190cd50667abdba5e2c750a98f54b33545ce.tar.gz
eclipse.platform.swt-7a85190cd50667abdba5e2c750a98f54b33545ce.tar.xz
eclipse.platform.swt-7a85190cd50667abdba5e2c750a98f54b33545ce.zip
Bug 496880 - [GTK3] Misaligned text next to radio button in preference
page gtk_widget_set_align() causes alignment issues when run on a label widget. Changed setting alignments to be done by gtk_label_set_align() instead. Tested on GTK2, GTK3.14, 3.16, 3.18, and 3.2 Change-Id: Ic59634c7239c41b200918b3a8c6f15cf8ae30f4b Signed-off-by: Ian Pun <ipun@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java5
2 files changed, 13 insertions, 8 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 c21c4e624b..1fff34b4ba 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
@@ -740,8 +740,8 @@ void _setAlignment (int alignment) {
}
}
- if (OS.GTK3) {
- gtk_widget_set_align(labelHandle,OS.GTK_ALIGN_START, OS.GTK_ALIGN_CENTER);
+ if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
+ gtk_label_set_align(labelHandle,0.0f,0.5f);
gtk_widget_set_align(imageHandle,OS.GTK_ALIGN_START, OS.GTK_ALIGN_CENTER);
} else {
OS.gtk_misc_set_alignment (labelHandle, 0.0f, 0.5f);
@@ -756,8 +756,8 @@ void _setAlignment (int alignment) {
OS.gtk_box_set_child_packing (boxHandle, labelHandle, true, true, 0, OS.GTK_PACK_END);
OS.gtk_box_set_child_packing (boxHandle, imageHandle, true, true, 0, OS.GTK_PACK_START);
- if (OS.GTK3) {
- gtk_widget_set_align(labelHandle,OS.GTK_ALIGN_START, OS.GTK_ALIGN_CENTER);
+ if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
+ gtk_label_set_align(labelHandle,0.0f,0.5f);
gtk_widget_set_align(imageHandle,OS.GTK_ALIGN_END, OS.GTK_ALIGN_CENTER);
} else {
OS.gtk_misc_set_alignment (labelHandle, 0f, 0.5f);
@@ -770,8 +770,8 @@ void _setAlignment (int alignment) {
OS.gtk_box_set_child_packing (boxHandle, imageHandle, true, true, 0, OS.GTK_PACK_START);
}
- if (OS.GTK3) {
- gtk_widget_set_align(labelHandle,OS.GTK_ALIGN_CENTER, OS.GTK_ALIGN_CENTER);
+ if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
+ gtk_label_set_align(labelHandle,0.5f,0.5f);
gtk_widget_set_align(imageHandle,OS.GTK_ALIGN_CENTER, OS.GTK_ALIGN_CENTER);
} else {
OS.gtk_misc_set_alignment (labelHandle, 0.5f, 0.5f);
@@ -792,8 +792,8 @@ void _setAlignment (int alignment) {
}
}
- if (OS.GTK3) {
- gtk_widget_set_align(labelHandle,OS.GTK_ALIGN_END, OS.GTK_ALIGN_CENTER);
+ if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
+ gtk_label_set_align(labelHandle,1.0f,0.5f);
gtk_widget_set_align(imageHandle,OS.GTK_ALIGN_END, OS.GTK_ALIGN_CENTER);
} else {
OS.gtk_misc_set_alignment (labelHandle, 1.0f, 0.5f);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
index 3726887cc9..9d94298b5e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
@@ -4141,6 +4141,11 @@ void gtk_widget_set_align(long /*int*/ widget, int hAlign, int vAlign) {
OS.gtk_widget_set_valign (widget, vAlign);
}
+void gtk_label_set_align(long /*int*/ label, float xAlign, float yAlign) {
+ OS.gtk_label_set_xalign(label, xAlign);
+ OS.gtk_label_set_yalign(label, yAlign);
+}
+
void setBackground () {
if ((state & BACKGROUND) == 0 && backgroundImage == null) {
if ((state & PARENT_BACKGROUND) != 0) {

Back to the top