Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2013-09-20 07:48:43 -0400
committerAlexander Kurtakov2013-09-20 07:48:43 -0400
commitd60423eb940f186e5cecbc6305de1958854f9bf5 (patch)
treea685719897103980dc8853cbffb8f2881c21f26f
parentb13322c23252be2e18c8feb951edcbcc47c09fe4 (diff)
downloadeclipse.platform.swt-d60423eb940f186e5cecbc6305de1958854f9bf5.tar.gz
eclipse.platform.swt-d60423eb940f186e5cecbc6305de1958854f9bf5.tar.xz
eclipse.platform.swt-d60423eb940f186e5cecbc6305de1958854f9bf5.zip
Bug 417601 - [GTK3] Menu items are missing keyboard shortcuts
It is a matter of connecting the GtkAccelLabel to the handle in order to get the shortcuts in the way GTK represent them. This doesn't allow custom formatting of the shortcut text but GTK does not provide an API to achieve that. What worked for GTK 2.x was simply abusing the fact that structs were all public not considering sealing at all. Bonus point for shortcut text being consistent with other GTK applications. Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java
index ae2f94ae98..acd1acf4d4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java
@@ -884,8 +884,10 @@ public void setText (String string) {
long /*int*/ label = OS.gtk_bin_get_child (handle);
if (label != 0 && OS.GTK_IS_LABEL(label)) {
OS.gtk_label_set_text_with_mnemonic (label, buffer);
- if (!OS.GTK3) {
- if (OS.GTK_IS_ACCEL_LABEL(label)) {
+ if (OS.GTK_IS_ACCEL_LABEL(label)) {
+ if (OS.GTK3) {
+ OS.gtk_accel_label_set_accel_widget(label, handle);
+ } else {
buffer = Converter.wcsToMbcs (null, accelString, true);
long /*int*/ ptr = OS.g_malloc (buffer.length);
OS.memmove (ptr, buffer, buffer.length);

Back to the top