Revision: 2741 http://geany.svn.sourceforge.net/geany/?rev=2741&view=rev Author: ntrel Date: 2008-07-02 04:58:01 -0700 (Wed, 02 Jul 2008)
Log Message: ----------- Fix behaviour of Home and End keys in non-editor widgets when they are set as keybindings for Go to Line Start/End. This uses a new ignore_keybinding variable because changing KeyCallback to return gboolean would break plugin keybindings.
Modified Paths: -------------- trunk/ChangeLog trunk/src/keybindings.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-07-01 14:20:16 UTC (rev 2740) +++ trunk/ChangeLog 2008-07-02 11:58:01 UTC (rev 2741) @@ -1,3 +1,12 @@ +2008-07-02 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> + + * src/keybindings.c: + Fix behaviour of Home and End keys in non-editor widgets when they + are set as keybindings for Go to Line Start/End. + This uses a new ignore_keybinding variable because changing + KeyCallback to return gboolean would break plugin keybindings. + + 2008-07-01 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/treeviews.c, src/callbacks.c, src/document.c, src/document.h:
Modified: trunk/src/keybindings.c =================================================================== --- trunk/src/keybindings.c 2008-07-01 14:20:16 UTC (rev 2740) +++ trunk/src/keybindings.c 2008-07-02 11:58:01 UTC (rev 2741) @@ -51,6 +51,8 @@ /* keyfile group name for non-plugin KB groups */ const gchar keybindings_keyfile_group_name[] = "Bindings";
+static gboolean ignore_keybinding = FALSE; + static GtkAccelGroup *kb_accel_group = NULL; static const gboolean swap_alt_tab_order = FALSE;
@@ -916,6 +918,7 @@ if (check_snippet_completion(keyval, state)) return TRUE;
+ ignore_keybinding = FALSE; for (g = 0; g < keybinding_groups->len; g++) { KeyBindingGroup *group = g_ptr_array_index(keybinding_groups, g); @@ -931,7 +934,7 @@
/* call the corresponding callback function for this shortcut */ kb->callback(i); - return TRUE; + return !ignore_keybinding; } } } @@ -1361,22 +1364,22 @@ { case GEANY_KEYS_GOTO_BACK: navqueue_go_back(); - break; + return; case GEANY_KEYS_GOTO_FORWARD: navqueue_go_forward(); - break; + return; case GEANY_KEYS_GOTO_LINE: on_go_to_line1_activate(NULL, NULL); - break; + return; case GEANY_KEYS_GOTO_MATCHINGBRACE: goto_matching_brace(doc); - break; + return; case GEANY_KEYS_GOTO_TOGGLEMARKER: { gboolean set = sci_is_marker_set_at_line(doc->sci, cur_line, 1);
sci_set_marker_at_line(doc->sci, cur_line, ! set, 1); - break; + return; } case GEANY_KEYS_GOTO_NEXTMARKER: { @@ -1387,7 +1390,7 @@ sci_set_current_line(doc->sci, mline); editor_display_current_line(doc, 0.5F); } - break; + return; } case GEANY_KEYS_GOTO_PREVIOUSMARKER: { @@ -1398,16 +1401,25 @@ sci_set_current_line(doc->sci, mline); editor_display_current_line(doc, 0.5F); } - break; + return; } case GEANY_KEYS_GOTO_TAGDEFINITION: if (check_current_word()) symbols_goto_tag(editor_info.current_word, TRUE); - break; + return; case GEANY_KEYS_GOTO_TAGDECLARATION: if (check_current_word()) symbols_goto_tag(editor_info.current_word, FALSE); - break; + return; + } + /* only check editor-sensitive keybindings when editor has focus */ + if (gtk_window_get_focus(GTK_WINDOW(main_widgets.window)) != GTK_WIDGET(doc->sci)) + { + ignore_keybinding = TRUE; + return; + } + switch (key_id) + { case GEANY_KEYS_GOTO_LINESTART: sci_cmd(doc->sci, editor_prefs.smart_home_key ? SCI_VCHOME : SCI_HOME); break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.