Bug 372607 - Tree should expand/collapse on Arrow_Left/Arrow_Right
Define keybinding via css to expand/collapse with arrows. Tested to work
on GTK 3.20. Adjusted selector for previous version.
Leo:
Small adjustment:
< Gtk3.20 : gtk-key-bindings
>=Gtk3.20 : -gtk-key-bindings
Tested:
- Works on Gtk3.8, 3.10, ... 3.20, 3.22(beta)
- CSS has no effect on <=Gtk3.6 (but 3.6 is 4 years old)
Change-Id: Ifa0a0b226e0003d55c44e2e1a4093e09e275fe1e
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Signed-off-by: Lev Ufimtsev <lufimtse@redhat.com>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
index c0cd834..f2d33d3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
@@ -711,13 +711,19 @@
"GtkToolbar {padding-top: 4px; padding-bottom: 4px;}\n"
+ "GtkToolbar GtkButton {padding: 2px 4px 3px 4px;}\n"
+ ".undershoot.top, .undershoot.right, .undershoot.bottom, .undershoot.left {background-image: none;}\n"
- + "GtkToolbar GtkMenuButton {padding: 1px 0px 1px 0px;}\n";
+ + "GtkToolbar GtkMenuButton {padding: 1px 0px 1px 0px;}\n"
+ + "@binding-set SWTTreeViewBinding { bind \"Left\" { \"expand-collapse-cursor-row\" (0,0,0) };"
+ + "bind \"Right\" { \"expand-collapse-cursor-row\" (0,1,0) }; } "
+ + "GtkTreeView { gtk-key-bindings: SWTTreeViewBinding; }\n";
} else {
css =
"toolbar {padding-top: 2px; padding-bottom: 2px;}\n"
+ "toolbar button {padding: 2px;}"
+ "toolbar button.popup {padding: 0px;}\n"
+ "toolbar toolbutton button {padding: 0px 0px 0px 0px;}"
+ + "@binding-set SWTTreeViewBinding { bind \"Left\" { \"expand-collapse-cursor-row\" (0,0,0) };"
+ + "bind \"Right\" { \"expand-collapse-cursor-row\" (0,1,0) }; } "
+ + "treeview { -gtk-key-bindings: SWTTreeViewBinding; }"
+ "scrolledwindow undershoot.top, scrolledwindow undershoot.right, scrolledwindow undershoot.bottom, "
+ "scrolledwindow undershoot.left {background-image: none;}\n";
/*