diff options
author | Alexander Kurtakov | 2018-09-14 07:42:32 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2018-09-14 08:56:34 +0000 |
commit | 91d944a2728fb94da435621db049a01300511029 (patch) | |
tree | 6ae5704d10069d26b8985ee8363f55c8491bb38e /bundles | |
parent | 1c552f1b78085d1702d4367a934e41096ad18449 (diff) | |
download | eclipse.platform.swt-91d944a2728fb94da435621db049a01300511029.tar.gz eclipse.platform.swt-91d944a2728fb94da435621db049a01300511029.tar.xz eclipse.platform.swt-91d944a2728fb94da435621db049a01300511029.zip |
Bug 530841: [GTK2] Remove GTK 2.x support
Remove GTK3 checks in ExpandBar/Item - GTK 3.4 is min now.
Change-Id: I42bf2b50e98865ffac83a8818853819a45bd6fc4
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java | 7 | ||||
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java | 56 |
2 files changed, 25 insertions, 38 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java index 670824a398..584208938a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -157,9 +157,7 @@ void createHandle (int index) { GTK.gtk_container_set_border_width (handle, 0); // In GTK 3 font description is inherited from parent widget which is not how SWT has always worked, // reset to default font to get the usual behavior - if (GTK.GTK3) { - setFontDescription(defaultFont().handle); - } + setFontDescription(defaultFont().handle); } void createItem (ExpandItem item, int style, int index) { @@ -456,7 +454,6 @@ void setFontDescription (long /*int*/ font) { @Override void setForegroundGdkRGBA (GdkRGBA rgba) { - assert GTK.GTK3 : "GTK3 code was run by GTK2"; super.setForegroundGdkRGBA(rgba); for (int i = 0; i < itemCount; i++) { items[i].setForegroundRGBA (rgba); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java index 3fedc74bfc..bf96a0ba1f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -162,13 +162,11 @@ void deregister() { @Override void release (boolean destroy) { - if (GTK.GTK3) { - //454940 ExpandBar DND fix. - //Since controls are now nested under the Item, - //Item is responsible for it's release. - if (control != null && !control.isDisposed ()) { - control.release (destroy); - } + //454940 ExpandBar DND fix. + //Since controls are now nested under the Item, + //Item is responsible for it's release. + if (control != null && !control.isDisposed ()) { + control.release (destroy); } super.release (destroy); } @@ -440,8 +438,8 @@ void resizeControl (int yScroll) { * As of GTK3, the hierarchy is changed, this affected child-size allocation and a fix * is now neccessary. * See also other 454940 notes and similar fix in: 453827 */ - int x = (GTK.GTK3) ? 0 : allocation.x; - int y = (GTK.GTK3) ? 0 : allocation.y; + int x = 0 ; + int y = 0; if (x != -1 && y != -1) { int width = allocation.width; @@ -467,19 +465,14 @@ void resizeControl (int yScroll) { } } // Bug 479242: Bound calculation is correct without needing to use yScroll in GTK3 - if (GTK.GTK3) { - /* - * Bug 538114: ExpandBar has no content until resized or collapsed/expanded. - * When widget is first created inside ExpandItem's control, the size is allocated - * to be zero, and the widget is never shown during a layout operation, similar to - * Bug 487757. The fix is to show the control before setting any bounds. - */ - if (visible) GTK.gtk_widget_show(control.topHandle ()); - control.setBounds (x, y, width, Math.max (0, height), true, true); - } - else { - control.setBounds (x, y - yScroll, width, Math.max (0, height), true, true); - } + /* + * Bug 538114: ExpandBar has no content until resized or collapsed/expanded. + * When widget is first created inside ExpandItem's control, the size is allocated + * to be zero, and the widget is never shown during a layout operation, similar to + * Bug 487757. The fix is to show the control before setting any bounds. + */ + if (visible) GTK.gtk_widget_show(control.topHandle ()); + control.setBounds (x, y, width, Math.max (0, height), true, true); } control.setVisible (visible); } @@ -533,15 +526,13 @@ public void setControl (Control control) { this.control = control; if (control != null) { control.setVisible (expanded); - if (GTK.GTK3) { - //454940 ExpandBar DND fix. - //Reparenting on the GTK side. - //Proper hierachy on gtk side is required for DND to function properly. - //As ExpandItem's child can be created before the ExpandItem, our only - //option is to reparent the child upon the setControl(..) call. - //This is simmilar to TabFolder. - Control.gtk_widget_reparent (control, clientHandle ()); - } + //454940 ExpandBar DND fix. + //Reparenting on the GTK side. + //Proper hierachy on gtk side is required for DND to function properly. + //As ExpandItem's child can be created before the ExpandItem, our only + //option is to reparent the child upon the setControl(..) call. + //This is simmilar to TabFolder. + Control.gtk_widget_reparent (control, clientHandle ()); } parent.layoutItems (0, true); } @@ -586,7 +577,6 @@ void setFontDescription (long /*int*/ font) { } void setForegroundRGBA (GdkRGBA rgba) { - assert GTK.GTK3 : "GTK3 code was run by GTK2"; parent.setForegroundGdkRGBA (handle, rgba); if (labelHandle != 0) parent.setForegroundGdkRGBA (labelHandle, rgba); if (imageHandle != 0) parent.setForegroundGdkRGBA (imageHandle, rgba); |