Backport patches to fix broken table editing
This commit is contained in:
parent
2d676dbd55
commit
6ea29d2336
|
@ -0,0 +1,263 @@
|
|||
From 8a745bffa40230e73fb229950d6d0520b474c8f3 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Williams
|
||||
Date: Tue, 13 Feb 2018 14:25:46 -0500
|
||||
Subject: Bug 511133: [GTK3.10+] Some critical icons missing on Ubuntu 16.04
|
||||
|
||||
This patch fixes Table/Tree drawing in EGit. It patch reverts the
|
||||
changes introduced for bug 438505, which causes this regression. This
|
||||
patch also contains fixes to prevent bug 438505 from being
|
||||
re-introduced.
|
||||
|
||||
EGit drawing was broken because TableItem.getBounds() was taking the
|
||||
position of the header into account. This is because we were drawing on
|
||||
the fixedHandle instead of the GtkTreeView. The positioning of the Table
|
||||
header broke simple drawing cases like Snippet051TableCenteredImage
|
||||
(JFace snippet). Reverting the fix back to drawing on the handle has
|
||||
fixed that issue.
|
||||
|
||||
Unfortunately this means bug 438505 is re-introduced. To fix that issue
|
||||
I have tweaked the re-parenting logic found in
|
||||
Table/Tree.setParentWindow(). GTK3.10+ onward only draws on toplevel or
|
||||
native GdkWindows. This means the Text widgets used for Table/Tree
|
||||
editing continue to get events, but they are not drawn. The solution to
|
||||
this problem is call gdk_window_raise/lower on these Text widgets when
|
||||
setVisible() is called. This raises and lowers the Text's GdkWindow when
|
||||
the widget's visibility is changed, ensuring that it actually is drawn
|
||||
when visible, and not when hidden. This isn't a huge change as the
|
||||
GdkWindow re-parenting already existed in Table/Tree.setParentWindow(),
|
||||
this patch just builds on that.
|
||||
|
||||
I have tested against the following cases/snippets:
|
||||
Snippet88
|
||||
Snippet019 (JFace snippets)
|
||||
Snippet025 (JFace snippets)
|
||||
Snippet026 (JFace snippets)
|
||||
Snippet051 (JFace snippets)
|
||||
use case from bug 438505
|
||||
use case from bug 436324
|
||||
use case from bug 460581
|
||||
use case from bug 458630
|
||||
|
||||
Additionally, using a child Eclipse I have verified that the missing
|
||||
EGit icons have returned. No AllNonBrowser JUnit tests fail.
|
||||
|
||||
Change-Id: I02b3fb30037a8f0f74de79144f8e563f5284d571
|
||||
Signed-off-by: Eric Williams <ericwill@redhat.com>---
|
||||
.../gtk/org/eclipse/swt/widgets/Control.java | 19 +++++++++++++--
|
||||
.../gtk/org/eclipse/swt/widgets/Table.java | 28 ++++++++++++----------
|
||||
.../gtk/org/eclipse/swt/widgets/TableItem.java | 3 ---
|
||||
.../gtk/org/eclipse/swt/widgets/Tree.java | 28 ++++++++++++----------
|
||||
.../gtk/org/eclipse/swt/widgets/TreeItem.java | 3 ---
|
||||
5 files changed, 49 insertions(+), 32 deletions(-)
|
||||
|
||||
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 5bb916a..e29d144 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
|
||||
@@ -64,6 +64,7 @@ public abstract class Control extends Widget implements Drawable {
|
||||
Accessible accessible;
|
||||
Control labelRelation;
|
||||
String cssBackground, cssForeground = " ";
|
||||
+ boolean reparentOnVisibility;
|
||||
|
||||
LinkedList <Event> dragDetectionQueue;
|
||||
|
||||
@@ -5360,7 +5361,7 @@ void setParentBackground () {
|
||||
if (fixedHandle != 0) setBackgroundColor (fixedHandle, null);
|
||||
}
|
||||
|
||||
-void setParentWindow (long /*int*/ widget) {
|
||||
+void setParentWindow (Control child) {
|
||||
}
|
||||
|
||||
boolean setRadioSelection (boolean value) {
|
||||
@@ -5565,6 +5566,13 @@ public void setVisible (boolean visible) {
|
||||
state &= ~HIDDEN;
|
||||
if ((state & (ZERO_WIDTH | ZERO_HEIGHT)) == 0) {
|
||||
if (enableWindow != 0) OS.gdk_window_show_unraised (enableWindow);
|
||||
+ /*
|
||||
+ * Raise this widget's GdkWindow if the reparentOnVisibility
|
||||
+ * flag has been set and visible is true. See bug 511133.
|
||||
+ */
|
||||
+ if (reparentOnVisibility && OS.GTK3) {
|
||||
+ OS.gdk_window_raise(gtk_widget_get_window(topHandle));
|
||||
+ }
|
||||
OS.gtk_widget_show (topHandle);
|
||||
}
|
||||
} else {
|
||||
@@ -5601,6 +5609,13 @@ public void setVisible (boolean visible) {
|
||||
OS.gtk_widget_hide (topHandle);
|
||||
if (isDisposed ()) return;
|
||||
if (enableWindow != 0) OS.gdk_window_hide (enableWindow);
|
||||
+ /*
|
||||
+ * Lower this widget's GdkWindow if the reparentOnVisibility
|
||||
+ * flag has been set and visible is false. See bug 511133.
|
||||
+ */
|
||||
+ if (reparentOnVisibility && OS.GTK3) {
|
||||
+ OS.gdk_window_lower(gtk_widget_get_window(topHandle));
|
||||
+ }
|
||||
sendEvent (SWT.Hide);
|
||||
}
|
||||
}
|
||||
@@ -5762,7 +5777,7 @@ void showWidget () {
|
||||
state |= ZERO_WIDTH | ZERO_HEIGHT;
|
||||
long /*int*/ topHandle = topHandle ();
|
||||
long /*int*/ parentHandle = parent.parentingHandle ();
|
||||
- parent.setParentWindow (topHandle);
|
||||
+ parent.setParentWindow (this);
|
||||
OS.gtk_container_add (parentHandle, topHandle);
|
||||
if (handle != 0 && handle != topHandle) OS.gtk_widget_show (handle);
|
||||
if ((state & (ZERO_WIDTH | ZERO_HEIGHT)) == 0) {
|
||||
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
|
||||
index e3d1441..b664f29 100644
|
||||
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
|
||||
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
|
||||
@@ -1258,9 +1258,6 @@ Rectangle getClientAreaInPixels () {
|
||||
int width = (state & ZERO_WIDTH) != 0 ? 0 : allocation.width;
|
||||
int height = (state & ZERO_HEIGHT) != 0 ? 0 : allocation.height;
|
||||
Rectangle rect = new Rectangle (fixedX [0] - binX [0], fixedY [0] - binY [0], width, height);
|
||||
- if (getHeaderVisible() && OS.GTK_VERSION > OS.VERSION(3, 9, 0)) {
|
||||
- rect.y += getHeaderHeightInPixels();
|
||||
- }
|
||||
return rect;
|
||||
}
|
||||
|
||||
@@ -1653,9 +1650,6 @@ TableItem getItemInPixels (Point point) {
|
||||
long /*int*/ [] path = new long /*int*/ [1];
|
||||
OS.gtk_widget_realize (handle);
|
||||
int y = point.y;
|
||||
- if (getHeaderVisible() && OS.GTK_VERSION > OS.VERSION(3, 9, 0)) {
|
||||
- y -= getHeaderHeightInPixels();
|
||||
- }
|
||||
if (!OS.gtk_tree_view_get_path_at_pos (handle, point.x, y, path, null, null, null)) return null;
|
||||
if (path [0] == 0) return null;
|
||||
long /*int*/ indices = OS.gtk_tree_path_get_indices (path [0]);
|
||||
@@ -2505,10 +2499,6 @@ boolean mnemonicMatch (char key) {
|
||||
@Override
|
||||
long /*int*/ paintWindow () {
|
||||
OS.gtk_widget_realize (handle);
|
||||
- if (fixedHandle != 0 && OS.GTK_VERSION > OS.VERSION(3, 9, 0)) {
|
||||
- OS.gtk_widget_realize (fixedHandle);
|
||||
- return OS.gtk_widget_get_window(fixedHandle);
|
||||
- }
|
||||
return OS.gtk_tree_view_get_bin_window (handle);
|
||||
}
|
||||
|
||||
@@ -3734,9 +3724,23 @@ void setParentBackground () {
|
||||
}
|
||||
|
||||
@Override
|
||||
-void setParentWindow (long /*int*/ widget) {
|
||||
+void setParentWindow (Control child) {
|
||||
long /*int*/ window = eventWindow ();
|
||||
- OS.gtk_widget_set_parent_window (widget, window);
|
||||
+ OS.gtk_widget_set_parent_window (child.topHandle(), window);
|
||||
+ /*
|
||||
+ * Feature in GTK3: all children of Table have their GdkWindows
|
||||
+ * re-parented so they are siblings of the parent Table
|
||||
+ * (i.e. on the same level in the z-order).
|
||||
+ *
|
||||
+ * To fix table editing in GTK3: raise/lower the
|
||||
+ * GdkWindow of these child widgets to make them visible when
|
||||
+ * setVisible() is called on them. This ensures they are properly
|
||||
+ * drawn when setVisible(true) is called, and properly hidden
|
||||
+ * when setVisible(false) is called. See bug 511133.
|
||||
+ */
|
||||
+ if (child != null && OS.GTK3) {
|
||||
+ child.reparentOnVisibility = true;
|
||||
+ }
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java
|
||||
index 6efb227..f904159 100644
|
||||
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java
|
||||
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java
|
||||
@@ -433,9 +433,6 @@ Rectangle getBoundsInPixels (int index) {
|
||||
}
|
||||
int width = OS.gtk_tree_view_column_get_visible (column) ? rect.width + 1 : 0;
|
||||
Rectangle r = new Rectangle (rect.x, rect.y, width, rect.height + 1);
|
||||
- if (parent.getHeaderVisible() && OS.GTK_VERSION > OS.VERSION(3, 9, 0)) {
|
||||
- r.y += parent.getHeaderHeightInPixels();
|
||||
- }
|
||||
return r;
|
||||
}
|
||||
|
||||
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
|
||||
index 58e0382..2428361 100644
|
||||
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
|
||||
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
|
||||
@@ -1244,9 +1244,6 @@ Rectangle getClientAreaInPixels () {
|
||||
int width = (state & ZERO_WIDTH) != 0 ? 0 : allocation.width;
|
||||
int height = (state & ZERO_HEIGHT) != 0 ? 0 : allocation.height;
|
||||
Rectangle rect = new Rectangle (fixedX [0] - binX [0], fixedY [0] - binY [0], width, height);
|
||||
- if (getHeaderVisible() && OS.GTK_VERSION > OS.VERSION(3, 9, 0)) {
|
||||
- rect.y += getHeaderHeightInPixels();
|
||||
- }
|
||||
return rect;
|
||||
}
|
||||
|
||||
@@ -1649,9 +1646,6 @@ TreeItem getItemInPixels (Point point) {
|
||||
OS.gtk_widget_realize (handle);
|
||||
int x = point.x;
|
||||
int y = point.y;
|
||||
- if (getHeaderVisible() && OS.GTK_VERSION > OS.VERSION(3, 9, 0)) {
|
||||
- y -= getHeaderHeightInPixels();
|
||||
- }
|
||||
if ((style & SWT.MIRRORED) != 0) x = getClientWidth () - x;
|
||||
long /*int*/ [] columnHandle = new long /*int*/ [1];
|
||||
if (!OS.gtk_tree_view_get_path_at_pos (handle, x, y, path, columnHandle, null, null)) return null;
|
||||
@@ -2635,10 +2629,6 @@ boolean mnemonicMatch (char key) {
|
||||
@Override
|
||||
long /*int*/ paintWindow () {
|
||||
OS.gtk_widget_realize (handle);
|
||||
- if (fixedHandle != 0 && OS.GTK_VERSION > OS.VERSION(3, 9, 0)) {
|
||||
- OS.gtk_widget_realize (fixedHandle);
|
||||
- return OS.gtk_widget_get_window(fixedHandle);
|
||||
- }
|
||||
return OS.gtk_tree_view_get_bin_window (handle);
|
||||
}
|
||||
|
||||
@@ -3725,9 +3715,23 @@ void setParentBackground () {
|
||||
}
|
||||
|
||||
@Override
|
||||
-void setParentWindow (long /*int*/ widget) {
|
||||
+void setParentWindow (Control child) {
|
||||
long /*int*/ window = eventWindow ();
|
||||
- OS.gtk_widget_set_parent_window (widget, window);
|
||||
+ OS.gtk_widget_set_parent_window (child.topHandle(), window);
|
||||
+ /*
|
||||
+ * Feature in GTK3: all children of Tree have their GdkWindows
|
||||
+ * re-parented so they are siblings of the parent Tree
|
||||
+ * (i.e. on the same level in the z-order).
|
||||
+ *
|
||||
+ * To fix table editing in GTK3: raise/lower the
|
||||
+ * GdkWindow of these child widgets to make them visible when
|
||||
+ * setVisible() is called on them. This ensures they are properly
|
||||
+ * drawn when setVisible(true) is called, and properly hidden
|
||||
+ * when setVisible(false) is called. See bug 511133.
|
||||
+ */
|
||||
+ if (child != null && OS.GTK3) {
|
||||
+ child.reparentOnVisibility = true;
|
||||
+ }
|
||||
}
|
||||
|
||||
void setScrollWidth (long /*int*/ column, TreeItem item) {
|
||||
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
|
||||
index 25bb96b..802a1f9 100644
|
||||
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
|
||||
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
|
||||
@@ -483,9 +483,6 @@ Rectangle getBoundsInPixels (int index) {
|
||||
}
|
||||
int width = OS.gtk_tree_view_column_get_visible (column) ? rect.width + 1 : 0;
|
||||
Rectangle r = new Rectangle (rect.x, rect.y, width, rect.height + 1);
|
||||
- if (parent.getHeaderVisible() && OS.GTK_VERSION > OS.VERSION(3, 9, 0)) {
|
||||
- r.y += parent.getHeaderHeightInPixels();
|
||||
- }
|
||||
return r;
|
||||
}
|
||||
|
||||
--
|
||||
cgit v1.1
|
||||
|
|
@ -0,0 +1,253 @@
|
|||
From 1a3294ba5966b01cc2953d4ad12ed02eb971b97f Mon Sep 17 00:00:00 2001
|
||||
From: Leo Ufimtsev
|
||||
Date: Wed, 14 Feb 2018 10:49:01 -0500
|
||||
Subject: Bug 510803 [GTK3] Regression in table editing capabilities in
|
||||
tabfolder.
|
||||
|
||||
Breakage occurred because tabItem reparented an item that had a
|
||||
non-standard gDk parent window.
|
||||
|
||||
Solution: fix gdk window parent for such special controls.
|
||||
(I.e ControlEditors in tables).
|
||||
|
||||
Verification:
|
||||
- Open child eclipse, change method signature.
|
||||
Now table cells can be edited via click.
|
||||
- Open attached snippet, with patch cells can be edited properly.
|
||||
- AllTests Gtk3.22
|
||||
- X11/Wayland.
|
||||
|
||||
Patchset 3:
|
||||
- Minor rename of methods to clarify that it's a *gdk* window,
|
||||
|
||||
Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=5108033
|
||||
Change-Id: I8dcaac950eb0847dd97016b2140c607012550d2f
|
||||
Signed-off-by: Leo Ufimtsev <lufimtse@redhat.com>
|
||||
---
|
||||
.../Eclipse SWT PI/gtk/library/os.c | 8 ++
|
||||
.../gtk/org/eclipse/swt/internal/gtk/OS.java | 4 +
|
||||
.../gtk/org/eclipse/swt/widgets/Composite.java | 10 ++
|
||||
.../gtk/org/eclipse/swt/widgets/Control.java | 51 ++++++++-
|
||||
.../gtk/org/eclipse/swt/widgets/ExpandItem.java | 2 +-
|
||||
.../gtk/org/eclipse/swt/widgets/TabItem.java | 4 +-
|
||||
.../gtk/org/eclipse/swt/widgets/Table.java | 6 +-
|
||||
.../gtk/org/eclipse/swt/widgets/Tree.java | 6 +-
|
||||
.../gtk/org/eclipse/swt/widgets/Widget.java | 15 ---
|
||||
.../Bug510803_TabFolder_Table_inPlaceEditing.java | 108 ------------------
|
||||
.../Bug510803_TabFolder_TreeEditor_Regression.java | 124 +++++++++++++++++++++
|
||||
11 files changed, 203 insertions(+), 135 deletions(-)
|
||||
delete mode 100644 tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug510803_TabFolder_Table_inPlaceEditing.java
|
||||
create mode 100644 tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug510803_TabFolder_TreeEditor_Regression.java
|
||||
|
||||
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
|
||||
index bf5de70..428d448 100644
|
||||
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
|
||||
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
|
||||
@@ -13853,7 +13853,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1reparent)
|
||||
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
|
||||
{
|
||||
OS_NATIVE_ENTER(env, that, _1gtk_1widget_1reparent_FUNC);
|
||||
+/*
|
||||
gtk_widget_reparent((GtkWidget *)arg0, (GtkWidget *)arg1);
|
||||
+*/
|
||||
+ {
|
||||
+ OS_LOAD_FUNCTION(fp, gtk_widget_reparent)
|
||||
+ if (fp) {
|
||||
+ ((void (CALLING_CONVENTION*)(GtkWidget *, GtkWidget *))fp)((GtkWidget *)arg0, (GtkWidget *)arg1);
|
||||
+ }
|
||||
+ }
|
||||
OS_NATIVE_EXIT(env, that, _1gtk_1widget_1reparent_FUNC);
|
||||
}
|
||||
#endif
|
||||
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
|
||||
index 2619114..57bbf52 100644
|
||||
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
|
||||
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
|
||||
@@ -487,6 +487,16 @@ void fixChildren (Shell newShell, Shell oldShell, Decorations newDecorations, De
|
||||
}
|
||||
|
||||
@Override
|
||||
+void fixParentGdkWindow() {
|
||||
+ assert OS.GTK3;
|
||||
+ // Changes to this method should be verified via
|
||||
+ // org.eclipse.swt.tests.gtk/*/Bug510803_TabFolder_TreeEditor_Regression.java (part two)
|
||||
+ for (Control child : _getChildren()) {
|
||||
+ child.fixParentGdkWindow();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+@Override
|
||||
void fixModal(long /*int*/ group, long /*int*/ modalGroup) {
|
||||
Control[] controls = _getChildren ();
|
||||
for (int i = 0; i < controls.length; i++) {
|
||||
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 e29d144..b0768d5 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
|
||||
@@ -2655,6 +2655,51 @@ void fixChildren (Shell newShell, Shell oldShell, Decorations newDecorations, De
|
||||
oldDecorations.fixDecorations (newDecorations, this, menus);
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * In some situations, a control has a non-standard parent GdkWindow (Note gDk, not gTk).
|
||||
+ * E.g, an TreeEditor who's parent is a Tree should have the Tree Viewer's inner bin as parent window.
|
||||
+ *
|
||||
+ * Note, composites should treat this differently and take child controls into consideration.
|
||||
+ */
|
||||
+void fixParentGdkWindow() {
|
||||
+ assert OS.GTK3;
|
||||
+ // Changes to this method should be verified via
|
||||
+ // org.eclipse.swt.tests.gtk/*/Bug510803_TabFolder_TreeEditor_Regression.java (part one)
|
||||
+ parent.setParentGdkWindow(this);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * Native gtkwidget re-parenting in SWT on Gtk3 needs to be handled in a special way because
|
||||
+ * some controls have non-standard GdkWindow as parents. (E.g ControlEditors), and other controls
|
||||
+ * like TabItem and ExpandBar use reparenting to preserve proper hierarchy for correct event traversal (like dnd).
|
||||
+ *
|
||||
+ * Note, GdkWindows != GtkWindows.
|
||||
+ *
|
||||
+ * You should never call gtk_widget_reparent() directly or reparent widgets outside this method,
|
||||
+ * otherwise you can break TabItem/TreeEditors.
|
||||
+ *
|
||||
+ * @param control that should be reparented.
|
||||
+ * @param newParentHandle pointer/handle to the new GtkWidget parent.
|
||||
+ */
|
||||
+static void gtk_widget_reparent (Control control, long /*int*/ newParentHandle) {
|
||||
+ if (OS.GTK3) {
|
||||
+ // Changes to this method should be verified via both parts in:
|
||||
+ // org.eclipse.swt.tests.gtk/*/Bug510803_TabFolder_TreeEditor_Regression.java
|
||||
+ long /*int*/ widget = control.topHandle();
|
||||
+ long /*int*/ parentContainer = OS.gtk_widget_get_parent (widget);
|
||||
+ assert parentContainer != 0 : "Improper use of Control.gtk_widget_reparent. Widget currently has no parent.";
|
||||
+ if (parentContainer != 0) {
|
||||
+ OS.g_object_ref (widget); //so that it won't get destroyed due to lack of references.
|
||||
+ OS.gtk_container_remove (parentContainer, widget);
|
||||
+ OS.gtk_container_add (newParentHandle, widget);
|
||||
+ OS.g_object_unref (widget);
|
||||
+ control.fixParentGdkWindow();
|
||||
+ }
|
||||
+ } else { // Gtk2.
|
||||
+ OS.gtk_widget_reparent(control.topHandle(), newParentHandle);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
@Override
|
||||
long /*int*/ fixedMapProc (long /*int*/ widget) {
|
||||
OS.gtk_widget_set_mapped (widget, true);
|
||||
@@ -5323,7 +5368,7 @@ public boolean setParent (Composite parent) {
|
||||
oldDecorations.fixAccelGroup ();
|
||||
}
|
||||
long /*int*/ newParent = parent.parentingHandle();
|
||||
- OS.gtk_widget_reparent(topHandle, newParent);
|
||||
+ gtk_widget_reparent(this, newParent);
|
||||
if (OS.GTK3) {
|
||||
OS.swt_fixed_move (newParent, topHandle, x, y);
|
||||
} else {
|
||||
@@ -5361,7 +5406,7 @@ void setParentBackground () {
|
||||
if (fixedHandle != 0) setBackgroundColor (fixedHandle, null);
|
||||
}
|
||||
|
||||
-void setParentWindow (Control child) {
|
||||
+void setParentGdkWindow (Control child) {
|
||||
}
|
||||
|
||||
boolean setRadioSelection (boolean value) {
|
||||
@@ -5777,7 +5822,7 @@ void showWidget () {
|
||||
state |= ZERO_WIDTH | ZERO_HEIGHT;
|
||||
long /*int*/ topHandle = topHandle ();
|
||||
long /*int*/ parentHandle = parent.parentingHandle ();
|
||||
- parent.setParentWindow (this);
|
||||
+ parent.setParentGdkWindow (this);
|
||||
OS.gtk_container_add (parentHandle, topHandle);
|
||||
if (handle != 0 && handle != topHandle) OS.gtk_widget_show (handle);
|
||||
if ((state & (ZERO_WIDTH | ZERO_HEIGHT)) == 0) {
|
||||
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 fcfbd33..6e48823 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
|
||||
@@ -532,7 +532,7 @@ public void setControl (Control control) {
|
||||
//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.
|
||||
- gtk_widget_reparent (control.topHandle (), clientHandle ());
|
||||
+ Control.gtk_widget_reparent (control, clientHandle ());
|
||||
}
|
||||
}
|
||||
parent.layoutItems (0, true);
|
||||
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java
|
||||
index 208a373..ce9b4cc 100644
|
||||
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java
|
||||
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java
|
||||
@@ -293,8 +293,8 @@ public void setControl (Control control) {
|
||||
}
|
||||
|
||||
if (control != null && OS.GTK3) {
|
||||
- // See implementation note about bug 454936 at the start of TabFolder.
|
||||
- OS.gtk_widget_reparent (control.topHandle (), pageHandle);
|
||||
+ // To understand why we reparent, see implementation note about bug 454936 at the start of TabFolder.
|
||||
+ Control.gtk_widget_reparent (control, pageHandle);
|
||||
}
|
||||
|
||||
Control oldControl = this.control, newControl = control;
|
||||
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
|
||||
index ccf01ec..c572e51 100644
|
||||
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
|
||||
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
|
||||
@@ -3726,9 +3726,9 @@ void setParentBackground () {
|
||||
}
|
||||
|
||||
@Override
|
||||
-void setParentWindow (Control child) {
|
||||
- long /*int*/ window = eventWindow ();
|
||||
- OS.gtk_widget_set_parent_window (child.topHandle(), window);
|
||||
+void setParentGdkWindow (Control child) {
|
||||
+ long /*int*/ parentGdkWindow = eventWindow ();
|
||||
+ OS.gtk_widget_set_parent_window (child.topHandle(), parentGdkWindow);
|
||||
/*
|
||||
* Feature in GTK3: all children of Table have their GdkWindows
|
||||
* re-parented so they are siblings of the parent Table
|
||||
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
|
||||
index 86b72a0..50de17c 100644
|
||||
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
|
||||
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
|
||||
@@ -3717,9 +3717,9 @@ void setParentBackground () {
|
||||
}
|
||||
|
||||
@Override
|
||||
-void setParentWindow (Control child) {
|
||||
- long /*int*/ window = eventWindow ();
|
||||
- OS.gtk_widget_set_parent_window (child.topHandle(), window);
|
||||
+void setParentGdkWindow (Control child) {
|
||||
+ long /*int*/ parentGdkWindow = eventWindow ();
|
||||
+ OS.gtk_widget_set_parent_window (child.topHandle(), parentGdkWindow);
|
||||
/*
|
||||
* Feature in GTK3: all children of Tree have their GdkWindows
|
||||
* re-parented so they are siblings of the parent Tree
|
||||
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
|
||||
index 40fe88c..2da1da5 100644
|
||||
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
|
||||
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
|
||||
@@ -951,21 +951,6 @@ long /*int*/ gtk_value_changed (long /*int*/ adjustment) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
-/**
|
||||
- * Reparent on gtk side.
|
||||
- * Note: Composites with a setControl() function should probably use this function
|
||||
- * to correct hierarchy on gtk side.
|
||||
- * @param widget the handle to the widget. (usually topHandle())
|
||||
- * @param newParent handle to the new widget.
|
||||
- */
|
||||
-void gtk_widget_reparent (long /*int*/ widget, long /*int*/ newParent) {
|
||||
- //Note, we do not actually call * 'gtk_widget_reparent(...) as it's deprecated as of gtk 3.14
|
||||
- OS.g_object_ref (widget); //so that it won't get destroyed due to lack of references.
|
||||
- OS.gtk_container_remove (OS.gtk_widget_get_parent (widget), widget);
|
||||
- OS.gtk_container_add (newParent, widget);
|
||||
- OS.g_object_unref (widget);
|
||||
-}
|
||||
-
|
||||
long /*int*/ gtk_window_state_event (long /*int*/ widget, long /*int*/ event) {
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,364 @@
|
|||
From 4b0412b94e47be8f2c5480568a36ec71809a148f Mon Sep 17 00:00:00 2001
|
||||
From: Eric Williams
|
||||
Date: Fri, 23 Mar 2018 16:12:53 -0400
|
||||
Subject: Bug 531928: [GTK3] Table editing is broken
|
||||
|
||||
The fix for bug 511133 introduced some logic which raises/lowers the
|
||||
GdkWindows of widgets who are children of Table or Tree. Unforunately,
|
||||
this breaks certain cases such as Tables/Trees that have more than one
|
||||
child widget.
|
||||
|
||||
Additionally, changing the drawing handle from fixedHandle to handle
|
||||
meant that some child widgets were not getting their draw events
|
||||
properly. According to GTK, child widgets with non-native windows should
|
||||
receive draw events from their parent containers using
|
||||
gtk_container_propagate_draw(). This patch follows this advice and
|
||||
connects a Table/Tree's fixedHandle to the draw signal. The incoming
|
||||
draw events to that fixedHandle are then propagated to the respective
|
||||
child widgets using gtk_container_propagate_draw().
|
||||
|
||||
A reproducer snippet is attached. This patch also fixes a regression
|
||||
from bug 511133 which caused the file permissions table (right click
|
||||
file -> properties -> resources) to be empty/contain only one checkbox.
|
||||
|
||||
Change-Id: I645a04df6773372aa27a360d3df9a3521437828f
|
||||
Signed-off-by: Eric Williams <ericwill@redhat.com>---
|
||||
.../Eclipse SWT PI/gtk/library/os.c | 18 ++++
|
||||
.../Eclipse SWT PI/gtk/library/os_stats.c | 1 +
|
||||
.../Eclipse SWT PI/gtk/library/os_stats.h | 1 +
|
||||
.../gtk/org/eclipse/swt/internal/gtk/OS.java | 15 ++++
|
||||
.../gtk/org/eclipse/swt/widgets/Composite.java | 44 ++++++++++
|
||||
.../gtk/org/eclipse/swt/widgets/Control.java | 14 ----
|
||||
.../gtk/org/eclipse/swt/widgets/Table.java | 32 ++++---
|
||||
.../gtk/org/eclipse/swt/widgets/TableItem.java | 3 -
|
||||
.../gtk/org/eclipse/swt/widgets/Tree.java | 32 ++++---
|
||||
.../gtk/org/eclipse/swt/widgets/TreeItem.java | 3 -
|
||||
.../Bug531928_TableTreeEditorVisibility.java | 98 ++++++++++++++++++++++
|
||||
11 files changed, 219 insertions(+), 42 deletions(-)
|
||||
create mode 100644 tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug531928_TableTreeEditorVisibility.java
|
||||
|
||||
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
|
||||
index cb6b841..5fc92d0 100644
|
||||
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
|
||||
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
|
||||
@@ -5532,6 +5532,24 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1container_1get_1children)
|
||||
}
|
||||
#endif
|
||||
|
||||
+#ifndef NO__1gtk_1container_1propagate_1draw
|
||||
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1container_1propagate_1draw)
|
||||
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2)
|
||||
+{
|
||||
+ OS_NATIVE_ENTER(env, that, _1gtk_1container_1propagate_1draw_FUNC);
|
||||
+/*
|
||||
+ gtk_container_propagate_draw((GtkContainer *)arg0, (GtkWidget *)arg1, (cairo_t *)arg2);
|
||||
+*/
|
||||
+ {
|
||||
+ OS_LOAD_FUNCTION(fp, gtk_container_propagate_draw)
|
||||
+ if (fp) {
|
||||
+ ((void (CALLING_CONVENTION*)(GtkContainer *, GtkWidget *, cairo_t *))fp)((GtkContainer *)arg0, (GtkWidget *)arg1, (cairo_t *)arg2);
|
||||
+ }
|
||||
+ }
|
||||
+ OS_NATIVE_EXIT(env, that, _1gtk_1container_1propagate_1draw_FUNC);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
#ifndef NO__1gtk_1container_1remove
|
||||
JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1container_1remove)
|
||||
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
|
||||
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
|
||||
index ebfe993..98f36e6 100644
|
||||
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
|
||||
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
|
||||
@@ -415,6 +415,7 @@ char * GTK_nativeFunctionNames[] = {
|
||||
"_1gtk_1container_1forall",
|
||||
"_1gtk_1container_1get_1border_1width",
|
||||
"_1gtk_1container_1get_1children",
|
||||
+ "_1gtk_1container_1propagate_1draw",
|
||||
"_1gtk_1container_1remove",
|
||||
"_1gtk_1container_1set_1border_1width",
|
||||
"_1gtk_1css_1provider_1get_1named",
|
||||
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
|
||||
index f707a39..97f4d14 100644
|
||||
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
|
||||
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
|
||||
@@ -413,6 +413,7 @@ typedef enum {
|
||||
_1gtk_1container_1forall_FUNC,
|
||||
_1gtk_1container_1get_1border_1width_FUNC,
|
||||
_1gtk_1container_1get_1children_FUNC,
|
||||
+ _1gtk_1container_1propagate_1draw_FUNC,
|
||||
_1gtk_1container_1remove_FUNC,
|
||||
_1gtk_1container_1set_1border_1width_FUNC,
|
||||
_1gtk_1css_1provider_1get_1named_FUNC,
|
||||
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
|
||||
index cc80140..78ba8d3 100644
|
||||
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
|
||||
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
|
||||
@@ -1676,6 +1676,21 @@ public class GTK extends OS {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
+ /**
|
||||
+ * @method flags=dynamic
|
||||
+ * @param container cast=(GtkContainer *)
|
||||
+ * @param child cast=(GtkWidget *)
|
||||
+ * @param cairo cast=(cairo_t *)
|
||||
+ */
|
||||
+ public static final native void _gtk_container_propagate_draw(long /*int*/ container, long /*int*/ child, long /*int*/ cairo);
|
||||
+ public static final void gtk_container_propagate_draw(long /*int*/ container, long /*int*/ child, long /*int*/ cairo) {
|
||||
+ lock.lock();
|
||||
+ try {
|
||||
+ _gtk_container_propagate_draw(container, child, cairo);
|
||||
+ } finally {
|
||||
+ lock.unlock();
|
||||
+ }
|
||||
+ }
|
||||
/** @param container cast=(GtkContainer *) */
|
||||
public static final native int _gtk_container_get_border_width(long /*int*/ container);
|
||||
public static final int gtk_container_get_border_width(long /*int*/ container) {
|
||||
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
|
||||
index 57bbf52..bd253c4 100644
|
||||
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
|
||||
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
|
||||
@@ -1374,6 +1374,50 @@ void printWidget (GC gc, long /*int*/ drawable, int depth, int x, int y) {
|
||||
newClip.dispose ();
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * Connects this widget's fixedHandle to the "draw" signal.<br>
|
||||
+ * NOTE: only the "draw" (EXPOSE) signal is connected, not EXPOSE_EVENT_INVERSE.
|
||||
+ */
|
||||
+void connectFixedHandleDraw () {
|
||||
+ long /*int*/ paintHandle = fixedHandle;
|
||||
+ int paintMask = OS.GDK_EXPOSURE_MASK;
|
||||
+ OS.gtk_widget_add_events (paintHandle, paintMask);
|
||||
+
|
||||
+ OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [DRAW], 0, display.getClosure (DRAW), true);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * <p>Propagates draw events from a parent container to its children using
|
||||
+ * gtk_container_propagate_draw(). This method only works if the fixedHandle
|
||||
+ * has been connected to the "draw" signal, and only propagates draw events
|
||||
+ * to other siblings of handle (i.e. other children of fixedHandle, but not
|
||||
+ * handle itself).</p>
|
||||
+ *
|
||||
+ * <p>It's useful to propagate draw events to other child widgets for things
|
||||
+ * like Table/Tree editors, or other scenarios where a widget is a child of
|
||||
+ * a non-standard container widget (i.e., not a direct child of a Composite).</p>
|
||||
+ *
|
||||
+ * @param container the parent container, i.e. fixedHandle
|
||||
+ * @param cairo the cairo context provided by GTK
|
||||
+ */
|
||||
+void propagateDraw (long /*int*/ container, long /*int*/ cairo) {
|
||||
+ if (container == fixedHandle && OS.GTK3) {
|
||||
+ long /*int*/ list = OS.gtk_container_get_children (container);
|
||||
+ long /*int*/ temp = list;
|
||||
+ while (temp != 0) {
|
||||
+ long /*int*/ child = OS.g_list_data (temp);
|
||||
+ if (child != 0) {
|
||||
+ Widget widget = display.getWidget (child);
|
||||
+ if (widget != this) {
|
||||
+ OS.gtk_container_propagate_draw(container, child, cairo);
|
||||
+ }
|
||||
+ }
|
||||
+ temp = OS.g_list_next (temp);
|
||||
+ }
|
||||
+ OS.g_list_free (list);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
@Override
|
||||
void redrawChildren () {
|
||||
super.redrawChildren ();
|
||||
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 7971ff6..f075de8 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
|
||||
@@ -5662,13 +5662,6 @@ public void setVisible (boolean visible) {
|
||||
state &= ~HIDDEN;
|
||||
if ((state & (ZERO_WIDTH | ZERO_HEIGHT)) == 0) {
|
||||
if (enableWindow != 0) OS.gdk_window_show_unraised (enableWindow);
|
||||
- /*
|
||||
- * Raise this widget's GdkWindow if the reparentOnVisibility
|
||||
- * flag has been set and visible is true. See bug 511133.
|
||||
- */
|
||||
- if (reparentOnVisibility && OS.GTK3) {
|
||||
- OS.gdk_window_raise(gtk_widget_get_window(topHandle));
|
||||
- }
|
||||
OS.gtk_widget_show (topHandle);
|
||||
}
|
||||
} else {
|
||||
@@ -5705,13 +5698,6 @@ public void setVisible (boolean visible) {
|
||||
OS.gtk_widget_hide (topHandle);
|
||||
if (isDisposed ()) return;
|
||||
if (enableWindow != 0) OS.gdk_window_hide (enableWindow);
|
||||
- /*
|
||||
- * Lower this widget's GdkWindow if the reparentOnVisibility
|
||||
- * flag has been set and visible is false. See bug 511133.
|
||||
- */
|
||||
- if (reparentOnVisibility && OS.GTK3) {
|
||||
- OS.gdk_window_lower(gtk_widget_get_window(topHandle));
|
||||
- }
|
||||
sendEvent (SWT.Hide);
|
||||
}
|
||||
}
|
||||
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
|
||||
index a64bdfc..dff41bd 100644
|
||||
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
|
||||
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
|
||||
@@ -85,7 +85,7 @@ public class Table extends Composite {
|
||||
GdkRGBA background, foreground;
|
||||
Color headerBackground, headerForeground;
|
||||
String headerCSSBackground, headerCSSForeground;
|
||||
- boolean ownerDraw, ignoreSize, ignoreAccessibility, pixbufSizeSet;
|
||||
+ boolean ownerDraw, ignoreSize, ignoreAccessibility, pixbufSizeSet, hasChildren;
|
||||
int maxWidth = 0;
|
||||
int topIndex;
|
||||
double cachedAdjustment, currentAdjustment;
|
||||
@@ -3739,18 +3739,18 @@ void setParentGdkWindow (Control child) {
|
||||
long /*int*/ parentGdkWindow = eventWindow ();
|
||||
OS.gtk_widget_set_parent_window (child.topHandle(), parentGdkWindow);
|
||||
/*
|
||||
- * Feature in GTK3: all children of Table have their GdkWindows
|
||||
- * re-parented so they are siblings of the parent Table
|
||||
- * (i.e. on the same level in the z-order).
|
||||
+ * Feature in GTK3: non-native GdkWindows are not drawn implicitly
|
||||
+ * as of GTK3.10+. It is the client's responsibility to propagate draw
|
||||
+ * events to these windows in the "draw" signal handler.
|
||||
*
|
||||
- * To fix table editing in GTK3: raise/lower the
|
||||
- * GdkWindow of these child widgets to make them visible when
|
||||
- * setVisible() is called on them. This ensures they are properly
|
||||
- * drawn when setVisible(true) is called, and properly hidden
|
||||
- * when setVisible(false) is called. See bug 511133.
|
||||
+ * This change breaks table editing on GTK3.10+, as the table editor
|
||||
+ * widgets no longer receive draw signals. The fix is to connect the
|
||||
+ * Table's fixedHandle to the draw signal, and propagate the draw
|
||||
+ * signal using gtk_container_propagate_draw(). See bug 531928.
|
||||
*/
|
||||
- if (child != null && OS.GTK3) {
|
||||
- child.reparentOnVisibility = true;
|
||||
+ if (OS.GTK_VERSION >= OS.VERSION(3, 10, 0)) {
|
||||
+ hasChildren = true;
|
||||
+ connectFixedHandleDraw();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4166,6 +4166,16 @@ void updateScrollBarValue (ScrollBar bar) {
|
||||
@Override
|
||||
long /*int*/ windowProc (long /*int*/ handle, long /*int*/ arg0, long /*int*/ user_data) {
|
||||
switch ((int)/*64*/user_data) {
|
||||
+ case EXPOSE_EVENT: {
|
||||
+ /*
|
||||
+ * If this Table has any child widgets, propagate the draw signal
|
||||
+ * to them using gtk_container_propagate_draw(). See bug 531928.
|
||||
+ */
|
||||
+ if (OS.GTK_VERSION >= OS.VERSION(3, 10, 0) && hasChildren) {
|
||||
+ propagateDraw(handle, arg0);
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
case EXPOSE_EVENT_INVERSE: {
|
||||
/*
|
||||
* Feature in GTK. When the GtkTreeView has no items it does not propagate
|
||||
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java
|
||||
index a1d3b89..c6031d2 100644
|
||||
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java
|
||||
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java
|
||||
@@ -361,9 +361,6 @@ Rectangle getBoundsinPixels () {
|
||||
}
|
||||
int width = OS.gtk_tree_view_column_get_visible (column) ? rect.width + 1 : 0;
|
||||
Rectangle r = new Rectangle (rect.x, rect.y, width, rect.height + 1);
|
||||
- if (parent.getHeaderVisible() && OS.GTK_VERSION > OS.VERSION(3, 9, 0)) {
|
||||
- r.y += parent.getHeaderHeightInPixels();
|
||||
- }
|
||||
return r;
|
||||
}
|
||||
|
||||
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
|
||||
index 6644346..1842b84 100644
|
||||
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
|
||||
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
|
||||
@@ -91,7 +91,7 @@ public class Tree extends Composite {
|
||||
int drawState, drawFlags;
|
||||
GdkColor drawForeground;
|
||||
GdkRGBA background, foreground;
|
||||
- boolean ownerDraw, ignoreSize, ignoreAccessibility, pixbufSizeSet;
|
||||
+ boolean ownerDraw, ignoreSize, ignoreAccessibility, pixbufSizeSet, hasChildren;
|
||||
int pixbufHeight, pixbufWidth;
|
||||
TreeItem topItem;
|
||||
double cachedAdjustment, currentAdjustment;
|
||||
@@ -3725,18 +3725,18 @@ void setParentGdkWindow (Control child) {
|
||||
long /*int*/ parentGdkWindow = eventWindow ();
|
||||
OS.gtk_widget_set_parent_window (child.topHandle(), parentGdkWindow);
|
||||
/*
|
||||
- * Feature in GTK3: all children of Tree have their GdkWindows
|
||||
- * re-parented so they are siblings of the parent Tree
|
||||
- * (i.e. on the same level in the z-order).
|
||||
+ * Feature in GTK3: non-native GdkWindows are not drawn implicitly
|
||||
+ * as of GTK3.10+. It is the client's responsibility to propagate draw
|
||||
+ * events to these windows in the "draw" signal handler.
|
||||
*
|
||||
- * To fix table editing in GTK3: raise/lower the
|
||||
- * GdkWindow of these child widgets to make them visible when
|
||||
- * setVisible() is called on them. This ensures they are properly
|
||||
- * drawn when setVisible(true) is called, and properly hidden
|
||||
- * when setVisible(false) is called. See bug 511133.
|
||||
+ * This change breaks tree editing on GTK3.10+, as the tree editor
|
||||
+ * widgets no longer receive draw signals. The fix is to connect the
|
||||
+ * Tree's fixedHandle to the draw signal, and propagate the draw
|
||||
+ * signal using gtk_container_propagate_draw(). See bug 531928.
|
||||
*/
|
||||
- if (child != null && OS.GTK3) {
|
||||
- child.reparentOnVisibility = true;
|
||||
+ if (OS.GTK_VERSION >= OS.VERSION(3, 10, 0)) {
|
||||
+ hasChildren = true;
|
||||
+ connectFixedHandleDraw();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4077,6 +4077,16 @@ void updateScrollBarValue (ScrollBar bar) {
|
||||
@Override
|
||||
long /*int*/ windowProc (long /*int*/ handle, long /*int*/ arg0, long /*int*/ user_data) {
|
||||
switch ((int)/*64*/user_data) {
|
||||
+ case EXPOSE_EVENT: {
|
||||
+ /*
|
||||
+ * If this Tree has any child widgets, propagate the draw signal
|
||||
+ * to them using gtk_container_propagate_draw(). See bug 531928.
|
||||
+ */
|
||||
+ if (OS.GTK_VERSION >= OS.VERSION(3, 10, 0) && hasChildren) {
|
||||
+ propagateDraw(handle, arg0);
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
case EXPOSE_EVENT_INVERSE: {
|
||||
/*
|
||||
* Feature in GTK. When the GtkTreeView has no items it does not propagate
|
||||
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
|
||||
index 03b847c..66307f8 100644
|
||||
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
|
||||
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
|
||||
@@ -547,9 +547,6 @@ Rectangle getBoundsInPixels () {
|
||||
}
|
||||
int width = OS.gtk_tree_view_column_get_visible (column) ? rect.width + 1 : 0;
|
||||
Rectangle r = new Rectangle (rect.x, rect.y, width, rect.height + 1);
|
||||
- if (parent.getHeaderVisible() && OS.GTK_VERSION > OS.VERSION(3, 9, 0)) {
|
||||
- r.y += parent.getHeaderHeightInPixels();
|
||||
- }
|
||||
return r;
|
||||
}
|
||||
|
||||
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
|
||||
index ddb326e..43acdb3 100644
|
||||
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
|
||||
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
|
||||
@@ -255,6 +255,8 @@
|
||||
#define gdk_cairo_create_LIB LIB_GDK
|
||||
#define gdk_colormap_alloc_color_LIB LIB_GDK
|
||||
#define gdk_colormap_free_colors_LIB LIB_GDK
|
||||
+#define gtk_container_propagate_draw_LIB LIB_GTK
|
||||
+#define gtk_widget_reparent_LIB LIB_GTK
|
||||
#define gtk_paint_box_LIB LIB_GTK
|
||||
#define gtk_paint_handle_LIB LIB_GTK
|
||||
#define gtk_paint_focus_LIB LIB_GTK
|
|
@ -62,7 +62,7 @@ index bc8963d..fbe4da3 100644
|
|||
@@ -21,3 +21,6 @@
|
||||
src.includes = about.html
|
||||
compilerArg=-proc:none
|
||||
jars.extra.classpath = java9/java9api.jar
|
||||
jars.extra.classpath = java10/java10api.jar
|
||||
+source.lib/apttestprocessors.jar = processors/
|
||||
+jars.compile.order = lib/apttestprocessors.jar,\
|
||||
+ .
|
||||
|
|
33
eclipse.spec
33
eclipse.spec
|
@ -6,7 +6,7 @@
|
|||
Epoch: 1
|
||||
|
||||
%global eb_commit 81122c55c72d9e308302c878f642f93c39507436
|
||||
%global eclipse_tag R4_7_3
|
||||
%global eclipse_tag S4_7_3_aRC2
|
||||
|
||||
%if 0%{?fedora} >= 28 || 0%{?rhel} > 7
|
||||
%global _jetty_version 9.4.9
|
||||
|
@ -53,7 +53,7 @@ Epoch: 1
|
|||
|
||||
Summary: An open, extensible IDE
|
||||
Name: eclipse
|
||||
Version: 4.7.3
|
||||
Version: 4.7.3a
|
||||
Release: 2%{?dist}
|
||||
License: EPL
|
||||
URL: http://www.eclipse.org/
|
||||
|
@ -151,6 +151,11 @@ Patch32: eclipse-bug-531844.patch
|
|||
# Fix menu appearance bug
|
||||
Patch33: eclipse-bug-431423.patch
|
||||
|
||||
# Fixes for broken table editors
|
||||
Patch34: eclipse-bug-531928-1.patch
|
||||
Patch35: eclipse-bug-531928-2.patch
|
||||
Patch36: eclipse-bug-531928-3.patch
|
||||
|
||||
# Use the jit on 32bit arm to speed up the build
|
||||
%ifarch %{arm}
|
||||
BuildRequires: java-1.8.0-openjdk-aarch32-devel
|
||||
|
@ -441,6 +446,9 @@ tar --strip-components=1 -xf %{SOURCE1}
|
|||
%patch32
|
||||
pushd eclipse.platform.swt
|
||||
%patch33 -p1
|
||||
%patch34 -p1
|
||||
%patch35 -p1
|
||||
%patch36 -p1
|
||||
popd
|
||||
|
||||
# Use ecj when bootstrapping
|
||||
|
@ -627,18 +635,19 @@ for f in rt.equinox.bundles/bundles/org.eclipse.equinox.security.linux.*/META-IN
|
|||
done
|
||||
|
||||
# Java 9 API stubs must be available at build time
|
||||
mkdir java9api
|
||||
pushd java9api
|
||||
xmvn -B -o install:install-file -Dfile=../eclipse.jdt.core/org.eclipse.jdt.compiler.apt/lib/java9api.jar \
|
||||
-Dpackaging=jar -DgroupId=org.eclipse -DartifactId=java9api -Dversion=9
|
||||
mkdir java10api
|
||||
pushd java10api
|
||||
xmvn -B -o install:install-file -Dfile=../eclipse.jdt.core/org.eclipse.jdt.compiler.apt/lib/java10api.jar \
|
||||
-Dpackaging=jar -DgroupId=org.eclipse -DartifactId=java10api -Dversion=10
|
||||
popd
|
||||
|
||||
# Add dep on Java 9 API stubs when compiling with JDT
|
||||
%pom_xpath_inject "pom:pluginManagement/pom:plugins/pom:plugin[pom:artifactId='tycho-compiler-plugin']/pom:dependencies" \
|
||||
"<dependency><groupId>org.eclipse</groupId><artifactId>java9api</artifactId><version>9</version></dependency>" eclipse-platform-parent
|
||||
"<dependency><groupId>org.eclipse</groupId><artifactId>java10api</artifactId><version>10</version></dependency>" eclipse-platform-parent
|
||||
|
||||
# Make Java 9 API stubs available for other packages
|
||||
%mvn_artifact "org.eclipse:java9api:jar:9" eclipse.jdt.core/org.eclipse.jdt.compiler.apt/lib/java9api.jar
|
||||
# Make Java 10 API stubs available for other packages
|
||||
%mvn_artifact "org.eclipse:java10api:jar:10" eclipse.jdt.core/org.eclipse.jdt.compiler.apt/lib/java10api.jar
|
||||
%mvn_alias "org.eclipse:java10api:jar:10" "org.eclipse:java9api:jar:9"
|
||||
|
||||
# Build fake ant bundle that contains symlinks to system jars
|
||||
dependencies/fake_ant_dependency.sh
|
||||
|
@ -1127,6 +1136,12 @@ fi
|
|||
%{_eclipsedir}/plugins/org.eclipse.osgi.util_*
|
||||
|
||||
%changelog
|
||||
* Mon Apr 09 2018 Mat Booth <mat.booth@redhat.com> - 1:4.7.3a-2
|
||||
- Backport patches to fix broken table editing
|
||||
|
||||
* Mon Apr 09 2018 Mat Booth <mat.booth@redhat.com> - 1:4.7.3a-1
|
||||
- Update to Oxygen.3a release for java 10 support
|
||||
|
||||
* Wed Mar 21 2018 Mat Booth <mat.booth@redhat.com> - 1:4.7.3-2
|
||||
- Bump jetty dependency
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
AGGREGATOR_PATH=git://git.eclipse.org/gitroot/platform/eclipse.platform.releng.aggregator.git
|
||||
TAG=R4_7_3
|
||||
TAG=S4_7_3_aRC2
|
||||
|
||||
rm -rf R4_platform-aggregator-$TAG
|
||||
rm -rf R4_platform-aggregator-$TAG.tar.xz
|
||||
|
@ -16,7 +16,7 @@ rm -rf production
|
|||
find . -type d -name ".git" | xargs rm -rf
|
||||
|
||||
# Delete pre-built binary artifacts except some test data that cannot be generated
|
||||
find . ! -path "*/JCL/*" ! -name "rtstubs*.jar" ! -name "java9api.jar" \
|
||||
find . ! -path "*/JCL/*" ! -name "rtstubs*.jar" ! -name "java10api.jar" \
|
||||
-type f -name *.jar -delete
|
||||
find . -type f -name *.class -delete
|
||||
find . -type f -name *.so -delete
|
||||
|
|
2
sources
2
sources
|
@ -1,2 +1,2 @@
|
|||
SHA512 (org.eclipse.linuxtools.eclipse-build-81122c55c72d9e308302c878f642f93c39507436.tar.xz) = 170d6801fd2c2f5f95c4d79cb14e36bb5db63142a52cafea81656f63dd132cf1a5b52b945fa0f85d4eed21ed660d22f46d2cdf9cde86e08fed06b16e9a22ed51
|
||||
SHA512 (R4_platform-aggregator-R4_7_3.tar.xz) = 59fab9afd70fc5326f3cfa176f2351aebffbb2239e63c721bfbaec92479826d040ad171fed8bebc490b86e989721b5d973824a22daba0d2561ecec0f41deffd3
|
||||
SHA512 (R4_platform-aggregator-S4_7_3_aRC2.tar.xz) = b593896a043dd25bac2d9f7938c3866107a86ca0f67269159fa64a635cba31c8c1c414ff6fb74f9f3650d21b94c4f24757608a29f1ee334438c85edbc30d284d
|
||||
|
|
Loading…
Reference in New Issue