Sembra che GTK + -3 abbia perso l'impostazione "gtk-auto-mnemonics" dopo la versione 3.8 (a partire dalla versione 3.10 in poi).
La seguente patch per 3.14.4 dovrebbe riattivare "gtk-auto-mnemonics". Probabilmente funzionerà anche con altre versioni GTK + -3 come 3.16. Dopo la compilazione, avrai bisogno solo di questi file (i primi due sono collegamenti simbolici):
libgtk-3.so -> libgtk-3.so.0.1400.4
libgtk-3.so.0 -> libgtk-3.so.0.1400.4
libgtk-3.so.0.1400.4
http://ftp.gnome.org/pub/gnome/sources/gtk+/3.14/gtk+-3.14.4.tar.xz
Puoi facilmente iniziare a usare le cose compilate in questo modo (sostituiscile lib64
con lib
se necessario):
LD_LIBRARY_PATH=/folder/where/you/installed/lib64 file-roller
-
Non so perché, ma sembra che gli sviluppatori GTK + siano diventati davvero bravi a rimuovere il codice che forniva funzionalità utili come questa ... !!!
Se uno sviluppatore GTK + legge questo: in che modo queste righe di codice hanno danneggiato qualcuno o perché sono state rimosse ???
Se qualcuno è interessato al commit originale:
Sembra che le persone GTK + abbiano avuto una corsa di rimozione delle funzionalità in quel momento:
==========
diff -ur gtk+-3.14.4.old/gtk/gtklabel.c gtk+-3.14.4.new/gtk/gtklabel.c
--- gtk+-3.14.4.old/gtk/gtklabel.c 2014-10-21 16:20:55.000000000 +0200
+++ gtk+-3.14.4.new/gtk/gtklabel.c 2015-05-06 23:01:45.447209817 +0200
@@ -2561,11 +2561,12 @@
if (with_uline)
{
- gboolean enable_mnemonics = TRUE;
- gboolean auto_mnemonics = TRUE;
+ gboolean enable_mnemonics;
+ gboolean auto_mnemonics;
g_object_get (gtk_widget_get_settings (GTK_WIDGET (label)),
"gtk-enable-mnemonics", &enable_mnemonics,
+ "gtk-auto-mnemonics", &auto_mnemonics,
NULL);
if (!(enable_mnemonics && priv->mnemonics_visible &&
@@ -2775,8 +2776,8 @@
{
GtkLabelPrivate *priv = label->priv;
PangoAttrList *attrs;
- gboolean enable_mnemonics = TRUE;
- gboolean auto_mnemonics = TRUE;
+ gboolean enable_mnemonics;
+ gboolean auto_mnemonics;
if (priv->pattern_set)
return;
@@ -2784,8 +2785,9 @@
if (is_mnemonic)
{
g_object_get (gtk_widget_get_settings (GTK_WIDGET (label)),
- "gtk-enable-mnemonics", &enable_mnemonics,
- NULL);
+ "gtk-enable-mnemonics", &enable_mnemonics,
+ "gtk-auto-mnemonics", &auto_mnemonics,
+ NULL);
if (enable_mnemonics && priv->mnemonics_visible && pattern &&
(!auto_mnemonics ||
diff -ur gtk+-3.14.4.old/gtk/gtkmain.c gtk+-3.14.4.new/gtk/gtkmain.c
--- gtk+-3.14.4.old/gtk/gtkmain.c 2014-10-21 16:20:55.000000000 +0200
+++ gtk+-3.14.4.new/gtk/gtkmain.c 2015-05-06 22:47:35.375311109 +0200
@@ -1717,18 +1717,26 @@
((event->key.state & (gtk_accelerator_get_default_mod_mask ()) & ~(GDK_RELEASE_MASK|GDK_MOD1_MASK)) == 0) &&
!GTK_IS_MENU_SHELL (grab_widget))
{
- gboolean mnemonics_visible;
- GtkWidget *window;
+ gboolean auto_mnemonics;
- mnemonics_visible = (event->type == GDK_KEY_PRESS);
+ g_object_get (gtk_widget_get_settings (grab_widget),
+ "gtk-auto-mnemonics", &auto_mnemonics, NULL);
- window = gtk_widget_get_toplevel (grab_widget);
- if (GTK_IS_WINDOW (window))
+ if (auto_mnemonics)
{
- if (mnemonics_visible)
- _gtk_window_schedule_mnemonics_visible (GTK_WINDOW (window));
- else
- gtk_window_set_mnemonics_visible (GTK_WINDOW (window), FALSE);
+ gboolean mnemonics_visible;
+ GtkWidget *window;
+
+ mnemonics_visible = (event->type == GDK_KEY_PRESS);
+
+ window = gtk_widget_get_toplevel (grab_widget);
+ if (GTK_IS_WINDOW (window))
+ {
+ if (mnemonics_visible)
+ _gtk_window_schedule_mnemonics_visible (GTK_WINDOW (window));
+ else
+ gtk_window_set_mnemonics_visible (GTK_WINDOW (window), FALSE);
+ }
}
}
/* else fall through */
diff -ur gtk+-3.14.4.old/gtk/gtkmenushell.c gtk+-3.14.4.new/gtk/gtkmenushell.c
--- gtk+-3.14.4.old/gtk/gtkmenushell.c 2014-08-15 16:38:05.000000000 +0200
+++ gtk+-3.14.4.new/gtk/gtkmenushell.c 2015-05-06 22:53:03.442086931 +0200
@@ -898,9 +898,17 @@
_gtk_menu_shell_update_mnemonics (GtkMenuShell *menu_shell)
{
GtkMenuShell *target;
+ gboolean auto_mnemonics;
gboolean found;
gboolean mnemonics_visible;
+ g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu_shell)),
+ "gtk-auto-mnemonics", &auto_mnemonics,
+ NULL);
+
+ if (!auto_mnemonics)
+ return;
+
target = menu_shell;
found = FALSE;
while (target)
diff -ur gtk+-3.14.4.old/gtk/gtkwindow.c gtk+-3.14.4.new/gtk/gtkwindow.c
--- gtk+-3.14.4.old/gtk/gtkwindow.c 2014-10-21 16:20:55.000000000 +0200
+++ gtk+-3.14.4.new/gtk/gtkwindow.c 2015-05-06 22:59:47.780956630 +0200
@@ -5878,6 +5878,8 @@
GtkWindow *window = GTK_WINDOW (widget);
GtkWindowPrivate *priv = window->priv;
GdkWindow *gdk_window;
+ gboolean auto_mnemonics;
+ GtkPolicyType visible_focus;
GList *link;
if (!gtk_widget_is_toplevel (widget))
@@ -5966,10 +5968,15 @@
}
}
- /* if mnemonics visible is not already set
+ /* if auto-mnemonics is enabled and mnemonics visible is not already set
* (as in the case of popup menus), then hide mnemonics initially
*/
- if (!priv->mnemonics_visible_set)
+ g_object_get (gtk_widget_get_settings (widget),
+ "gtk-auto-mnemonics", &auto_mnemonics,
+ "gtk-visible-focus", &visible_focus,
+ NULL);
+
+ if (auto_mnemonics && !priv->mnemonics_visible_set)
gtk_window_set_mnemonics_visible (window, FALSE);
/* inherit from transient parent, so that a dialog that is
@@ -7834,6 +7841,7 @@
GdkEventFocus *event)
{
GtkWindow *window = GTK_WINDOW (widget);
+ gboolean auto_mnemonics;
/* It appears spurious focus in events can occur when
* the window is hidden. So we'll just check to see if
@@ -7845,7 +7853,9 @@
_gtk_window_set_has_toplevel_focus (window, TRUE);
_gtk_window_set_is_active (window, TRUE);
- if (gtk_window_has_mnemonic_modifier_pressed (window))
+ g_object_get (gtk_widget_get_settings (widget),
+ "gtk-auto-mnemonics", &auto_mnemonics, NULL);
+ if (auto_mnemonics && gtk_window_has_mnemonic_modifier_pressed (window))
_gtk_window_schedule_mnemonics_visible (window);
}
@@ -7857,12 +7867,16 @@
GdkEventFocus *event)
{
GtkWindow *window = GTK_WINDOW (widget);
+ gboolean auto_mnemonics;
_gtk_window_set_has_toplevel_focus (window, FALSE);
_gtk_window_set_is_active (window, FALSE);
/* set the mnemonic-visible property to false */
- gtk_window_set_mnemonics_visible (window, FALSE);
+ g_object_get (gtk_widget_get_settings (widget),
+ "gtk-auto-mnemonics", &auto_mnemonics, NULL);
+ if (auto_mnemonics)
+ gtk_window_set_mnemonics_visible (window, FALSE);
return FALSE;
}