Branch: refs/heads/master Author: Forkest Forkest@users.noreply.github.com Committer: Colomban Wendling ban@herbesfolles.org Date: Sun, 05 Feb 2017 11:52:51 UTC Commit: 67d6562f203ad1d46969c36be70606fee0b73096 https://github.com/geany/geany/commit/67d6562f203ad1d46969c36be70606fee0b730...
Log Message: ----------- Fix cut and copy actions in non-Latin keyboard layouts
Mark the associated menu items sensitive when the menu is hidden, so that GTK's accelerator handling can trigger them. This works around incorrect handling in Geany's code of keybindings coming from multiple layouts for cut/copy/delete actions.
Partial workaround for #998, #1286 and #1368.
Modified Paths: -------------- data/geany.glade src/callbacks.c src/ui_utils.c src/ui_utils.h
Modified: data/geany.glade 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -6321,6 +6321,7 @@ <object class="GtkMenuBar" id="menubar1"> <property name="visible">True</property> <property name="can_focus">False</property> + <signal name="deactivate" handler="on_menubar1_deactivate" after="yes" swapped="no"/> <child> <object class="GtkMenuItem" id="file1"> <property name="visible">True</property>
Modified: src/callbacks.c 10 lines changed, 10 insertions(+), 0 deletions(-) =================================================================== @@ -200,6 +200,16 @@ static void on_edit1_activate(GtkMenuItem *menuitem, gpointer user_data) }
+static void on_menubar1_deactivate(GtkMenuShell *menushell, gpointer user_data) +{ + /* we re-enable items that were disabled in on_edit1_activate() on menu popdown to + * workaround mutli-layout keyboard issues in our keybinding handling code, so that + * GTK's accelerator handling can catch them. + * See https://github.com/geany/geany/issues/1368#issuecomment-273678207 */ + ui_menu_copy_items_set_sensitive(TRUE); +} + + void on_undo1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current();
Modified: src/ui_utils.c 15 lines changed, 11 insertions(+), 4 deletions(-) =================================================================== @@ -512,10 +512,19 @@ void ui_update_popup_goto_items(gboolean enable) }
+void ui_menu_copy_items_set_sensitive(gboolean sensitive) +{ + guint i, len; + + len = G_N_ELEMENTS(widgets.menu_copy_items); + for (i = 0; i < len; i++) + ui_widget_set_sensitive(widgets.menu_copy_items[i], sensitive); +} + + void ui_update_menu_copy_items(GeanyDocument *doc) { gboolean enable = FALSE; - guint i, len; GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
g_return_if_fail(doc == NULL || doc->is_valid); @@ -533,9 +542,7 @@ void ui_update_menu_copy_items(GeanyDocument *doc) enable = gtk_text_buffer_get_selection_bounds(buffer, NULL, NULL); }
- len = G_N_ELEMENTS(widgets.menu_copy_items); - for (i = 0; i < len; i++) - ui_widget_set_sensitive(widgets.menu_copy_items[i], enable); + ui_menu_copy_items_set_sensitive(enable); }
Modified: src/ui_utils.h 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -297,6 +297,8 @@ void ui_update_popup_copy_items(GeanyDocument *doc); void ui_update_popup_goto_items(gboolean enable);
+void ui_menu_copy_items_set_sensitive(gboolean sensitive); + void ui_update_menu_copy_items(GeanyDocument *doc);
void ui_update_insert_include_item(GeanyDocument *doc, gint item);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).