Make pressing escape focus the editor when using incremental search

or the Goto Line entries.
Add keybindings_cmd() to mimic a keybinding action.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1723 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2007-07-18 15:35:52 +00:00
parent 46282107f8
commit fc9e92cf0f
7 changed files with 59 additions and 4 deletions

View File

@ -5,6 +5,11 @@
* src/navqueue.c:
Fix possible segfault when a file is closed and using go forward.
Fix 2 possible memory leaks when files have been closed.
* src/interface.c, src/keybindings.c, src/keybindings.h,
src/callbacks.c, src/callbacks.h, geany.glade:
Make pressing escape focus the editor when using incremental search
or the Goto Line entries.
Add keybindings_cmd() to mimic a keybinding action.
2007-07-17 Nick Treleaven <nick.treleaven@btinternet.com>

View File

@ -1823,6 +1823,7 @@
<property name="activates_default">False</property>
<signal name="activate" handler="on_entry1_activate" last_modification_time="Sat, 30 Apr 2005 23:58:03 GMT"/>
<signal name="changed" handler="on_entry1_changed" last_modification_time="Tue, 03 May 2005 09:18:59 GMT"/>
<signal name="key_press_event" handler="on_entry1_key_press_event" last_modification_time="Wed, 18 Jul 2007 14:55:05 GMT"/>
</widget>
</child>
</widget>
@ -1882,6 +1883,7 @@
<property name="activates_default">False</property>
<property name="width_chars">8</property>
<signal name="activate" handler="on_entry_goto_line_activate" last_modification_time="Sun, 26 Feb 2006 17:07:52 GMT"/>
<signal name="key_press_event" handler="on_entry_goto_line_key_press_event" last_modification_time="Wed, 18 Jul 2007 15:09:25 GMT"/>
</widget>
</child>
</widget>

View File

@ -622,6 +622,20 @@ on_entry1_changed (GtkEditable *editable,
}
gboolean
on_entry1_key_press_event (GtkWidget *widget,
GdkEventKey *event,
gpointer user_data)
{
if (event->keyval == GDK_Escape)
{
keybindings_cmd(GEANY_KEYS_SWITCH_EDITOR);
return TRUE;
}
return FALSE;
}
// search text
void
on_toolbutton18_clicked (GtkToolButton *toolbutton,
@ -1248,6 +1262,15 @@ on_entry_goto_line_activate (GtkEntry *entry,
}
gboolean
on_entry_goto_line_key_press_event (GtkWidget *widget,
GdkEventKey *event,
gpointer user_data)
{
return on_entry1_key_press_event(widget, event, user_data);
}
void
on_toolbutton_goto_clicked (GtkToolButton *toolbutton,
gpointer user_data)
@ -2110,4 +2133,3 @@ gboolean on_motion_event(GtkWidget *widget, GdkEventMotion *event, gpointer user
return FALSE;
}

View File

@ -583,3 +583,13 @@ on_motion_event (GtkWidget *widget,
GdkEventMotion *event,
gpointer user_data);
gboolean
on_entry1_key_press_event (GtkWidget *widget,
GdkEventKey *event,
gpointer user_data);
gboolean
on_entry_goto_line_key_press_event (GtkWidget *widget,
GdkEventKey *event,
gpointer user_data);

View File

@ -1576,12 +1576,18 @@ create_window1 (void)
g_signal_connect ((gpointer) entry1, "changed",
G_CALLBACK (on_entry1_changed),
NULL);
g_signal_connect ((gpointer) entry1, "key_press_event",
G_CALLBACK (on_entry1_key_press_event),
NULL);
g_signal_connect ((gpointer) toolbutton18, "clicked",
G_CALLBACK (on_toolbutton18_clicked),
NULL);
g_signal_connect ((gpointer) entry_goto_line, "activate",
G_CALLBACK (on_entry_goto_line_activate),
NULL);
g_signal_connect ((gpointer) entry_goto_line, "key_press_event",
G_CALLBACK (on_entry_goto_line_key_press_event),
NULL);
g_signal_connect ((gpointer) toolbutton25, "clicked",
G_CALLBACK (on_toolbutton_goto_clicked),
NULL);

View File

@ -697,6 +697,13 @@ static binding *fill(KBCallback func, guint key, GdkModifierType mod, const gcha
}
/* Mimic a keybinding action */
void keybindings_cmd(GeanyKeyCommand cmd_id)
{
keys[cmd_id]->cb_func(cmd_id);
}
/* These are the callback functions, either each group or each shortcut has it's
* own function. */
@ -1211,3 +1218,4 @@ static void cb_func_nav_forward(G_GNUC_UNUSED guint key_id)
{
navqueue_go_forward();
}

View File

@ -45,7 +45,7 @@ typedef struct binding
} binding;
enum
typedef enum
{
GEANY_KEYS_MENU_NEW = 0,
GEANY_KEYS_MENU_OPEN,
@ -149,16 +149,18 @@ enum
GEANY_KEYS_EDIT_COMPLETECONSTRUCT,
GEANY_KEYS_EDIT_SUPPRESSCOMPLETION,
GEANY_MAX_KEYS
};
}
GeanyKeyCommand;
binding *keys[GEANY_MAX_KEYS];
void keybindings_init(void);
void keybindings_free(void);
void keybindings_cmd(GeanyKeyCommand cmd_id);
/* just write the content of the keys array to the config file */
void keybindings_write_to_file(void);