Make common bash Ctrl-[a-z] keyboard shortcuts work in the VTE.
(Not sure why Ctrl-Shift-[cv] copy/paste shortcuts still don't work). git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1908 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
12a5ba8df3
commit
05a8bf08a2
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
* src/keybindings.c:
|
* src/keybindings.c:
|
||||||
Fix selecting text with Shift-{PageUp,PageDown} (closes #1801315).
|
Fix selecting text with Shift-{PageUp,PageDown} (closes #1801315).
|
||||||
|
* src/keybindings.c, src/vte.c:
|
||||||
|
Make common bash Ctrl-[a-z] keyboard shortcuts work in the VTE.
|
||||||
|
(Not sure why Ctrl-Shift-[cv] copy/paste shortcuts still don't work).
|
||||||
|
|
||||||
|
|
||||||
2007-09-25 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
2007-09-25 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||||
|
1
NEWS
1
NEWS
@ -3,6 +3,7 @@ Geany 0.12 (TBA)
|
|||||||
Bugs fixed:
|
Bugs fixed:
|
||||||
* Fixed opening the same file twice from the message window/command-line.
|
* Fixed opening the same file twice from the message window/command-line.
|
||||||
* Fixed Ctrl-Shift keybindings not working when caps lock is on.
|
* Fixed Ctrl-Shift keybindings not working when caps lock is on.
|
||||||
|
* Fixed common bash Ctrl-[a-z] keyboard shortcuts not working in the VTE.
|
||||||
* Fixed saving the wrong document when using Save All with unnamed
|
* Fixed saving the wrong document when using Save All with unnamed
|
||||||
documents.
|
documents.
|
||||||
* Fixed replacing with '^' or '$' regex chars.
|
* Fixed replacing with '^' or '$' regex chars.
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
#include "navqueue.h"
|
#include "navqueue.h"
|
||||||
#include "symbols.h"
|
#include "symbols.h"
|
||||||
|
#include "vte.h"
|
||||||
|
|
||||||
|
|
||||||
const gboolean swap_alt_tab_order = FALSE;
|
const gboolean swap_alt_tab_order = FALSE;
|
||||||
@ -654,6 +655,59 @@ static gboolean check_construct_completion(GdkEventKey *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static gboolean set_sensitive(gpointer widget)
|
||||||
|
{
|
||||||
|
gtk_widget_set_sensitive(GTK_WIDGET(widget), TRUE);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static gboolean check_vte(GdkEventKey *event, guint keyval)
|
||||||
|
{
|
||||||
|
#ifndef HAVE_VTE
|
||||||
|
return FALSE;
|
||||||
|
#else
|
||||||
|
GtkWidget *menubar;
|
||||||
|
|
||||||
|
if (! vte_info.have_vte)
|
||||||
|
return FALSE;
|
||||||
|
if (gtk_window_get_focus(GTK_WINDOW(app->window)) != vc->vte)
|
||||||
|
return FALSE;
|
||||||
|
if (event->state == (GDK_CONTROL_MASK | GDK_SHIFT_MASK) &&
|
||||||
|
(keyval == GDK_c || keyval == GDK_v)) // copy/paste
|
||||||
|
return TRUE;
|
||||||
|
if (event->state != GDK_CONTROL_MASK)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
// Check Ctrl-[a-z] terminal shortcuts
|
||||||
|
switch (keyval)
|
||||||
|
{
|
||||||
|
case GDK_a:
|
||||||
|
case GDK_c:
|
||||||
|
case GDK_d:
|
||||||
|
case GDK_e:
|
||||||
|
case GDK_k:
|
||||||
|
case GDK_q:
|
||||||
|
case GDK_r:
|
||||||
|
case GDK_s:
|
||||||
|
case GDK_u:
|
||||||
|
case GDK_w:
|
||||||
|
case GDK_z:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
/* Temporarily disable the menubar to prevent conflicting menu accelerators.
|
||||||
|
* Ideally we would just somehow disable the menubar without redrawing it,
|
||||||
|
* but maybe that's not possible. */
|
||||||
|
menubar = lookup_widget(app->window, "menubar1");
|
||||||
|
gtk_widget_set_sensitive(menubar, FALSE);
|
||||||
|
g_idle_add(&set_sensitive, (gpointer) menubar);
|
||||||
|
return TRUE;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* central keypress event handler, almost all keypress events go to this function */
|
/* central keypress event handler, almost all keypress events go to this function */
|
||||||
gboolean keybindings_got_event(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
|
gboolean keybindings_got_event(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
|
||||||
{
|
{
|
||||||
@ -673,7 +727,9 @@ gboolean keybindings_got_event(GtkWidget *widget, GdkEventKey *event, gpointer u
|
|||||||
if (event->state & GDK_MOD2_MASK)
|
if (event->state & GDK_MOD2_MASK)
|
||||||
event->state -= GDK_MOD2_MASK;
|
event->state -= GDK_MOD2_MASK;
|
||||||
|
|
||||||
// special case
|
// special cases
|
||||||
|
if (check_vte(event, keyval))
|
||||||
|
return FALSE;
|
||||||
if (check_construct_completion(event))
|
if (check_construct_completion(event))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
23
src/vte.c
23
src/vte.c
@ -60,6 +60,7 @@ static const gchar VTE_WORDCHARS[] = "-A-Za-z0-9,./?%&#:_";
|
|||||||
#define VTE_TERMINAL(obj) (GTK_CHECK_CAST((obj), VTE_TYPE_TERMINAL, VteTerminal))
|
#define VTE_TERMINAL(obj) (GTK_CHECK_CAST((obj), VTE_TYPE_TERMINAL, VteTerminal))
|
||||||
#define VTE_TYPE_TERMINAL (vf->vte_terminal_get_type())
|
#define VTE_TYPE_TERMINAL (vf->vte_terminal_get_type())
|
||||||
|
|
||||||
|
static void create_vte();
|
||||||
static void vte_start(GtkWidget *widget);
|
static void vte_start(GtkWidget *widget);
|
||||||
static gboolean vte_button_pressed(GtkWidget *widget, GdkEventButton *event, gpointer user_data);
|
static gboolean vte_button_pressed(GtkWidget *widget, GdkEventButton *event, gpointer user_data);
|
||||||
static gboolean vte_keypress(GtkWidget *widget, GdkEventKey *event, gpointer data);
|
static gboolean vte_keypress(GtkWidget *widget, GdkEventKey *event, gpointer data);
|
||||||
@ -76,6 +77,7 @@ enum
|
|||||||
POPUP_PREFERENCES
|
POPUP_PREFERENCES
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* taken from anjuta, thanks */
|
/* taken from anjuta, thanks */
|
||||||
static gchar **vte_get_child_environment(void)
|
static gchar **vte_get_child_environment(void)
|
||||||
{
|
{
|
||||||
@ -133,9 +135,6 @@ static void override_menu_key()
|
|||||||
|
|
||||||
void vte_init(void)
|
void vte_init(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
GtkWidget *vte, *scrollbar, *hbox, *frame;
|
|
||||||
|
|
||||||
if (vte_info.have_vte == FALSE)
|
if (vte_info.have_vte == FALSE)
|
||||||
{ // app->have_vte can be false, even if VTE is compiled in, think of command line option
|
{ // app->have_vte can be false, even if VTE is compiled in, think of command line option
|
||||||
geany_debug("Disabling terminal support");
|
geany_debug("Disabling terminal support");
|
||||||
@ -171,6 +170,17 @@ void vte_init(void)
|
|||||||
vte_register_symbols(module);
|
vte_register_symbols(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
create_vte();
|
||||||
|
|
||||||
|
// setup the f10 menu override (so it works before the widget is first realized).
|
||||||
|
override_menu_key();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void create_vte()
|
||||||
|
{
|
||||||
|
GtkWidget *vte, *scrollbar, *hbox, *frame;
|
||||||
|
|
||||||
vte = vf->vte_terminal_new();
|
vte = vf->vte_terminal_new();
|
||||||
vc->vte = vte;
|
vc->vte = vte;
|
||||||
scrollbar = gtk_vscrollbar_new(GTK_ADJUSTMENT(VTE_TERMINAL(vte)->adjustment));
|
scrollbar = gtk_vscrollbar_new(GTK_ADJUSTMENT(VTE_TERMINAL(vte)->adjustment));
|
||||||
@ -206,9 +216,6 @@ void vte_init(void)
|
|||||||
|
|
||||||
// the vte widget has to be realised before color changes take effect
|
// the vte widget has to be realised before color changes take effect
|
||||||
g_signal_connect(G_OBJECT(vte), "realize", G_CALLBACK(vte_apply_user_settings), NULL);
|
g_signal_connect(G_OBJECT(vte), "realize", G_CALLBACK(vte_apply_user_settings), NULL);
|
||||||
|
|
||||||
// setup the f10 menu override (so it works before the widget is first realized).
|
|
||||||
override_menu_key();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -240,7 +247,8 @@ static gboolean vte_keypress(GtkWidget *widget, GdkEventKey *event, gpointer dat
|
|||||||
event->keyval == GDK_d ||
|
event->keyval == GDK_d ||
|
||||||
event->keyval == GDK_C ||
|
event->keyval == GDK_C ||
|
||||||
event->keyval == GDK_D) &&
|
event->keyval == GDK_D) &&
|
||||||
event->state & GDK_CONTROL_MASK)
|
event->state & GDK_CONTROL_MASK &&
|
||||||
|
! (event->state & GDK_SHIFT_MASK) && ! (event->state & GDK_MOD1_MASK))
|
||||||
{
|
{
|
||||||
vte_get_working_directory(); // try to keep the working directory when restarting the VTE
|
vte_get_working_directory(); // try to keep the working directory when restarting the VTE
|
||||||
|
|
||||||
@ -254,7 +262,6 @@ static gboolean vte_keypress(GtkWidget *widget, GdkEventKey *event, gpointer dat
|
|||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user