2005-07-13 08:46:11 -07:00
|
|
|
/*
|
2005-10-13 07:08:18 -07:00
|
|
|
* mooterm-keymap.h
|
2005-07-13 08:46:11 -07:00
|
|
|
*
|
2006-02-23 06:03:17 -08:00
|
|
|
* Copyright (C) 2004-2006 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
2005-07-13 08:46:11 -07:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* See COPYING file that comes with this distribution.
|
2005-07-23 21:58:57 -07:00
|
|
|
*/
|
2005-07-13 08:46:11 -07:00
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
#ifndef MOOTERM_COMPILATION
|
|
|
|
#error "This file may not be included"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __MOO_TERM_KEYMAP_H__
|
|
|
|
#define __MOO_TERM_KEYMAP_H__
|
2005-07-13 08:46:11 -07:00
|
|
|
|
|
|
|
#include <gdk/gdkkeysyms.h>
|
|
|
|
#include <string.h>
|
2005-07-14 23:37:09 -07:00
|
|
|
#include "mooterm/mooterm-private.h"
|
|
|
|
#include "mooterm/mootermpt.h"
|
2005-07-13 08:46:11 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
When the auxiliary keypad is in keypad numeric mode
|
|
|
|
(DECKPNM), the Enter key sends the same characters as
|
|
|
|
the Return key.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
If the DECCKM function is set, then the arrow keys send
|
|
|
|
application sequences to the host. If the DECCKM function
|
|
|
|
is reset, then the arrow keys send ANSI cursor sequences
|
|
|
|
to the host.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
MODE_DECNKM, Numeric Keypad Mode
|
|
|
|
This control function works like the DECKPAM and DECKPNM functions. DECNKM is
|
|
|
|
provided mainly for use with the request and report mode (DECRQM/DECRPM) control
|
|
|
|
functions.
|
|
|
|
Set: application sequences.
|
|
|
|
Reset: keypad characters.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
MODE_DECBKM, Backarrow Key Mode
|
|
|
|
This control function determines whether the Backspace key works as a
|
|
|
|
backspace key or delete key.
|
|
|
|
If DECBKM is set, Backspace works as a backspace key. When you press Backspace,
|
|
|
|
the terminal sends a BS character to the host.
|
|
|
|
If DECBKM is reset, Backspace works as a delete key. When you press Backspace,
|
|
|
|
the terminal sends a DEL character to the host.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
MODE_DECKPM, Key Position Mode
|
|
|
|
This control function selects whether the keyboard sends character codes or key
|
|
|
|
position reports to the host.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2005-07-14 23:37:09 -07:00
|
|
|
static void get_vt_key (MooTerm *term,
|
|
|
|
guint keyval,
|
|
|
|
char **string,
|
|
|
|
guint *len);
|
2005-07-13 08:46:11 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
2005-07-19 07:01:41 -07:00
|
|
|
#define SET_KEY(str) \
|
2005-07-14 23:37:09 -07:00
|
|
|
*string = g_strdup (str); \
|
|
|
|
*len = strlen (str);
|
2005-07-13 08:46:11 -07:00
|
|
|
|
|
|
|
|
2005-07-14 23:37:09 -07:00
|
|
|
#define CASE_GDK_KP_SOMETHING \
|
|
|
|
case GDK_KP_F1: \
|
|
|
|
case GDK_KP_F2: \
|
|
|
|
case GDK_KP_F3: \
|
|
|
|
case GDK_KP_F4: \
|
|
|
|
case GDK_KP_Enter: \
|
|
|
|
case GDK_KP_Home: \
|
|
|
|
case GDK_KP_Left: \
|
|
|
|
case GDK_KP_Up: \
|
|
|
|
case GDK_KP_Right: \
|
|
|
|
case GDK_KP_Down: \
|
|
|
|
case GDK_KP_Page_Up: \
|
|
|
|
case GDK_KP_Page_Down: \
|
|
|
|
case GDK_KP_End: \
|
|
|
|
case GDK_KP_Begin: \
|
|
|
|
case GDK_KP_Insert: \
|
|
|
|
case GDK_KP_Delete: \
|
|
|
|
case GDK_KP_Separator: \
|
|
|
|
case GDK_KP_Subtract: \
|
|
|
|
case GDK_KP_Decimal: \
|
|
|
|
case GDK_KP_0: \
|
|
|
|
case GDK_KP_1: \
|
|
|
|
case GDK_KP_2: \
|
|
|
|
case GDK_KP_3: \
|
|
|
|
case GDK_KP_4: \
|
|
|
|
case GDK_KP_5: \
|
|
|
|
case GDK_KP_6: \
|
|
|
|
case GDK_KP_7: \
|
|
|
|
case GDK_KP_8: \
|
|
|
|
case GDK_KP_9:
|
2005-07-13 08:46:11 -07:00
|
|
|
|
|
|
|
|
|
|
|
/* these are from VT102 manual */
|
2005-07-14 23:37:09 -07:00
|
|
|
static void get_keypad_key (MooTerm *term,
|
|
|
|
guint keyval,
|
|
|
|
char **string,
|
|
|
|
guint *len)
|
2005-07-13 08:46:11 -07:00
|
|
|
{
|
|
|
|
if (!term_get_mode (MODE_DECNKM))
|
|
|
|
{
|
|
|
|
switch (keyval)
|
|
|
|
{
|
2005-07-14 23:37:09 -07:00
|
|
|
case GDK_KP_Enter:
|
|
|
|
get_vt_key (term, GDK_Return, string, len);
|
|
|
|
break;
|
2005-07-13 08:46:11 -07:00
|
|
|
case GDK_KP_Subtract:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("-");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_0:
|
|
|
|
case GDK_KP_Insert:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("0");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_1:
|
|
|
|
case GDK_KP_End:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("1");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_2:
|
|
|
|
case GDK_KP_Down:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("2");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_3:
|
|
|
|
case GDK_KP_Page_Down:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("3");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_4:
|
|
|
|
case GDK_KP_Left:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("4");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_5:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("5");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_6:
|
|
|
|
case GDK_KP_Right:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("6");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_7:
|
|
|
|
case GDK_KP_Home:
|
|
|
|
case GDK_KP_Begin:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("7");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_8:
|
|
|
|
case GDK_KP_Up:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("8");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_9:
|
|
|
|
case GDK_KP_Page_Up:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("9");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_Decimal:
|
|
|
|
case GDK_KP_Delete:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("."); /* TODO should it be period/comma depending on locale? */
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_Separator:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY (","); /* TODO should it be period/comma depending on locale? */
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_F1:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033OP");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_F2:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033OQ");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_F3:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033OR");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_F4:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033OS");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (keyval)
|
|
|
|
{
|
|
|
|
case GDK_KP_0:
|
|
|
|
case GDK_KP_Insert:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033Op");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_1:
|
|
|
|
case GDK_KP_End:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033Oq");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_2:
|
|
|
|
case GDK_KP_Down:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033Or");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_3:
|
|
|
|
case GDK_KP_Page_Down:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033Os");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_4:
|
|
|
|
case GDK_KP_Left:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033Ot");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_5:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033Ou");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_6:
|
|
|
|
case GDK_KP_Right:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033Ov");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_7:
|
|
|
|
case GDK_KP_Home:
|
|
|
|
case GDK_KP_Begin:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033Ow");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_8:
|
|
|
|
case GDK_KP_Up:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033Ox");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_9:
|
|
|
|
case GDK_KP_Page_Up:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033Oy");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_KP_Subtract:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033Om");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_Decimal:
|
|
|
|
case GDK_KP_Delete:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033On"); /* TODO should it be period/comma depending on locale? */
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_Separator:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033Ol"); /* TODO should it be period/comma depending on locale? */
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_KP_Enter:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033OM");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_KP_F1:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033OP");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_F2:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033OQ");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_F3:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033OR");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_KP_F4:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033OS");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
|
2005-07-14 23:37:09 -07:00
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* VT102 manual */
|
|
|
|
static void get_arrow_key (MooTerm *term,
|
|
|
|
guint keyval,
|
|
|
|
char **string,
|
|
|
|
guint *len)
|
|
|
|
{
|
|
|
|
if (term_get_mode (MODE_DECNKM) && term_get_mode (MODE_DECCKM))
|
|
|
|
{
|
|
|
|
switch (keyval)
|
|
|
|
{
|
|
|
|
case GDK_Left:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033OD");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
2005-07-14 23:37:09 -07:00
|
|
|
case GDK_Up:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033OA");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
2005-07-14 23:37:09 -07:00
|
|
|
case GDK_Right:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033OC");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
2005-07-14 23:37:09 -07:00
|
|
|
case GDK_Down:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033OB");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
}
|
|
|
|
}
|
2005-07-14 23:37:09 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (keyval)
|
|
|
|
{
|
|
|
|
case GDK_Left:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[D");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_Up:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[A");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_Right:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[C");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_Down:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[B");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
2005-07-13 08:46:11 -07:00
|
|
|
|
2005-07-14 23:37:09 -07:00
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
}
|
|
|
|
}
|
2005-07-13 08:46:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
print ''.join(['case GDK_%s:\ncase GDK_%s:\n set_key ("\\%03o");\n break;\n' % (chr(i), chr(i+32), i-64) for i in range(ord('A'), ord('Z') + 1)])
|
|
|
|
*/
|
2005-07-14 23:37:09 -07:00
|
|
|
static void get_vt_ctl_key (G_GNUC_UNUSED MooTerm *term,
|
|
|
|
guint keyval,
|
|
|
|
char **string,
|
|
|
|
guint *len)
|
2005-07-13 08:46:11 -07:00
|
|
|
{
|
|
|
|
switch (keyval)
|
|
|
|
{
|
|
|
|
case GDK_A:
|
|
|
|
case GDK_a:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\001");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_B:
|
|
|
|
case GDK_b:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\002");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_C:
|
|
|
|
case GDK_c:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\003");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_D:
|
|
|
|
case GDK_d:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\004");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_E:
|
|
|
|
case GDK_e:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\005");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_F:
|
|
|
|
case GDK_f:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\006");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_G:
|
|
|
|
case GDK_g:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\007");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_H:
|
|
|
|
case GDK_h:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\010");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_I:
|
|
|
|
case GDK_i:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\011");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_J:
|
|
|
|
case GDK_j:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\012");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_K:
|
|
|
|
case GDK_k:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\013");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_L:
|
|
|
|
case GDK_l:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\014");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_M:
|
|
|
|
case GDK_m:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\015");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_N:
|
|
|
|
case GDK_n:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\016");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_O:
|
|
|
|
case GDK_o:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\017");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_P:
|
|
|
|
case GDK_p:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\020");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_Q:
|
|
|
|
case GDK_q:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\021");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_R:
|
|
|
|
case GDK_r:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\022");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_S:
|
|
|
|
case GDK_s:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\023");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_T:
|
|
|
|
case GDK_t:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\024");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_U:
|
|
|
|
case GDK_u:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\025");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_V:
|
|
|
|
case GDK_v:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\026");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_W:
|
|
|
|
case GDK_w:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\027");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_X:
|
|
|
|
case GDK_x:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\030");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_Y:
|
|
|
|
case GDK_y:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\031");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_Z:
|
|
|
|
case GDK_z:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\032");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_space:
|
2005-07-14 23:37:09 -07:00
|
|
|
*string = g_strdup ("\000");
|
2005-07-13 08:46:11 -07:00
|
|
|
*len = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_bracketleft:
|
|
|
|
case GDK_braceleft:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_backslash:
|
|
|
|
case GDK_bar:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\034");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_bracketright:
|
|
|
|
case GDK_braceright:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\035");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_asciitilde:
|
|
|
|
case GDK_quoteleft:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\036");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
|
|
|
case GDK_question:
|
|
|
|
case GDK_slash:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\037");
|
2005-07-13 08:46:11 -07:00
|
|
|
break;
|
2005-07-14 23:37:09 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void get_backspace_key (MooTerm *term,
|
|
|
|
char **normal,
|
|
|
|
guint *normal_length,
|
|
|
|
gboolean *suppress_meta_esc)
|
|
|
|
{
|
|
|
|
char c;
|
|
|
|
|
|
|
|
switch (term->priv->settings.backspace_binding)
|
|
|
|
{
|
|
|
|
case MOO_TERM_ERASE_ASCII_BACKSPACE:
|
|
|
|
*normal = g_strdup ("\010");
|
|
|
|
*normal_length = 1;
|
|
|
|
*suppress_meta_esc = FALSE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MOO_TERM_ERASE_ASCII_DELETE:
|
|
|
|
*normal = g_strdup ("\177");
|
|
|
|
*normal_length = 1;
|
|
|
|
*suppress_meta_esc = FALSE;
|
|
|
|
break;
|
2005-07-13 08:46:11 -07:00
|
|
|
|
2005-07-14 23:37:09 -07:00
|
|
|
case MOO_TERM_ERASE_DELETE_SEQUENCE:
|
|
|
|
*normal = g_strdup ("\033[3~");
|
|
|
|
*normal_length = 4;
|
|
|
|
*suppress_meta_esc = TRUE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* Use the tty's erase character. */
|
|
|
|
case MOO_TERM_ERASE_AUTO:
|
2005-07-13 08:46:11 -07:00
|
|
|
default:
|
2005-10-13 07:08:18 -07:00
|
|
|
c = _moo_term_pt_get_erase_char (term->priv->pt);
|
2005-07-14 23:37:09 -07:00
|
|
|
if (c)
|
|
|
|
{
|
|
|
|
*normal = g_strdup_printf("%c", c);
|
|
|
|
*normal_length = 1;
|
|
|
|
*suppress_meta_esc = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*normal = g_strdup ("\010");
|
|
|
|
*normal_length = 1;
|
|
|
|
*suppress_meta_esc = FALSE;
|
|
|
|
}
|
|
|
|
break;
|
2005-07-13 08:46:11 -07:00
|
|
|
}
|
2005-07-14 23:37:09 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void get_delete_key (MooTerm *term,
|
|
|
|
char **normal,
|
|
|
|
guint *normal_length,
|
|
|
|
gboolean *suppress_meta_esc)
|
|
|
|
{
|
|
|
|
switch (term->priv->settings.delete_binding)
|
|
|
|
{
|
|
|
|
case MOO_TERM_ERASE_ASCII_BACKSPACE:
|
|
|
|
*normal = g_strdup("\010");
|
|
|
|
*normal_length = 1;
|
|
|
|
break;
|
2005-07-13 08:46:11 -07:00
|
|
|
|
2005-07-14 23:37:09 -07:00
|
|
|
case MOO_TERM_ERASE_ASCII_DELETE:
|
|
|
|
*normal = g_strdup("\177");
|
|
|
|
*normal_length = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MOO_TERM_ERASE_DELETE_SEQUENCE:
|
|
|
|
case MOO_TERM_ERASE_AUTO:
|
|
|
|
default:
|
|
|
|
*normal = g_strdup ("\033[3~");
|
|
|
|
*normal_length = 4;
|
|
|
|
*suppress_meta_esc = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
2005-07-13 08:46:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-07-14 23:37:09 -07:00
|
|
|
static void get_vt_key (MooTerm *term,
|
|
|
|
guint keyval,
|
|
|
|
char **string,
|
|
|
|
guint *len)
|
2005-07-13 08:46:11 -07:00
|
|
|
{
|
|
|
|
switch (keyval)
|
|
|
|
{
|
2005-07-14 23:37:09 -07:00
|
|
|
case GDK_Left:
|
|
|
|
case GDK_Up:
|
|
|
|
case GDK_Right:
|
|
|
|
case GDK_Down:
|
|
|
|
get_arrow_key (term, keyval, string, len);
|
|
|
|
break;
|
|
|
|
|
|
|
|
CASE_GDK_KP_SOMETHING
|
|
|
|
get_keypad_key (term, keyval, string, len);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_Tab:
|
|
|
|
case GDK_KP_Tab:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\011");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_Linefeed:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\012");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_Clear:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\013");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_Return:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\015");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_Pause:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\023");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_Escape:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
/* keys below are from `infocmp xterm` */
|
|
|
|
|
|
|
|
case GDK_Home:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033OH");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_Page_Up:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[5~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_Page_Down:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[6~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_End:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033OF");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_Insert:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[2~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F1:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033OP");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F2:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033OQ");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F3:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033OR");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F4:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033OS");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F5:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[15~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F6:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[17~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F7:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[18~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F8:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[19~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F9:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[20~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F10:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[21~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F11:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[23~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F12:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[24~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F13:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033O2P");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F14:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033O2Q");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F15:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033O2R");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F16:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033O2S");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F17:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[15;2~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F18:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[17;2~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F19:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[18;2~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F20:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[19;2~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F21:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[20;2~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F22:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[21;2~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F23:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[23;2~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F24:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[24;2~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F25:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033O5P");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F26:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033O5Q");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F27:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033O5R");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F28:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033O5S");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F29:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[15;5~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F30:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[17;5~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F31:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[18;5~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F32:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[19;5~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F33:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[20;5~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F34:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[21;5~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
case GDK_F35:
|
2005-07-19 07:01:41 -07:00
|
|
|
SET_KEY ("\033[23;5~");
|
2005-07-14 23:37:09 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-07-13 08:46:11 -07:00
|
|
|
|
2005-07-14 23:37:09 -07:00
|
|
|
static gboolean key_is_modifier (guint keyval)
|
|
|
|
{
|
|
|
|
switch (keyval)
|
|
|
|
{
|
2005-07-13 08:46:11 -07:00
|
|
|
case GDK_Alt_L:
|
|
|
|
case GDK_Alt_R:
|
|
|
|
case GDK_Caps_Lock:
|
|
|
|
case GDK_Control_L:
|
|
|
|
case GDK_Control_R:
|
|
|
|
case GDK_Eisu_Shift:
|
|
|
|
case GDK_Hyper_L:
|
|
|
|
case GDK_Hyper_R:
|
|
|
|
case GDK_ISO_First_Group_Lock:
|
|
|
|
case GDK_ISO_Group_Lock:
|
|
|
|
case GDK_ISO_Group_Shift:
|
|
|
|
case GDK_ISO_Last_Group_Lock:
|
|
|
|
case GDK_ISO_Level3_Lock:
|
|
|
|
case GDK_ISO_Level3_Shift:
|
|
|
|
case GDK_ISO_Lock:
|
|
|
|
case GDK_ISO_Next_Group_Lock:
|
|
|
|
case GDK_ISO_Prev_Group_Lock:
|
|
|
|
case GDK_Kana_Lock:
|
|
|
|
case GDK_Kana_Shift:
|
|
|
|
case GDK_Meta_L:
|
|
|
|
case GDK_Meta_R:
|
|
|
|
case GDK_Num_Lock:
|
|
|
|
case GDK_Scroll_Lock:
|
|
|
|
case GDK_Shift_L:
|
|
|
|
case GDK_Shift_Lock:
|
|
|
|
case GDK_Shift_R:
|
|
|
|
case GDK_Super_L:
|
|
|
|
case GDK_Super_R:
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
#endif /* __MOO_TERM_KEYMAP_H__ */
|